"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[22],{45:function(e,t,n){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ShippingNotification=void 0;const i=n(0),r=(n(1),n(2)),s=a(n(65)),o=n(667),{wrapper:u,wrapperCompact:c,wrapperLabel:D,wrapperCountDown:d,wrapperCountDownNew:g}=s.default;t.ShippingNotification=function({compact:e=!1,className:t="",shippingNotificationVariant:n}){const{shippingTime:a,messageLine1:s,messageLine2:f}=(0,o.useShippingNotification)(n);return(0,i.jsx)("div",Object.assign({className:(0,r.cx)(u,e&&c,t)},{children:(0,i.jsxs)("div",{children:[(0,i.jsx)("div",Object.assign({className:D},{children:s})),(0,i.jsxs)("div",Object.assign({className:"default"===n?d:g},{children:[f,(0,i.jsx)("span",{children:a})]}))]})}))}},667:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.calculateShippingDay=t.getShippingTime=t.useShippingNotification=void 0;const a=n(3);function i(e,t,n,a){const i=new Date(e,t,1),r=(n-i.getDay()+7)%7+7*(a-1);return i.setDate(1+r),i}function r(e,t,n){const a=new Date(e,t+1,0);let i=n-a.getDay();return i>0&&(i-=7),a.setDate(a.getDate()+i),a}function s(e){const t=e.getMonth()+1,n=e.getDate();return e.getFullYear()+"-"+(t<10?"0"+t:t)+"-"+(n<10?"0"+n:n)}function o(e){const t=e.getFullYear(),n=s(e),a=e.getDay();return n===t+"-01-01"&&0===a?new Date(t+1,0,2):n===t+"-07-04"&&0===a?new Date(t,6,5):n===t+"-12-25"&&0===a?new Date(t,11,26):n===t+"-01-01"&&6===a?new Date(t-1,11,31):n===t+"-07-04"&&6===a?new Date(t,6,3):n===t+"-12-25"&&6===a?new Date(t,11,24):n===t+"-11-11"&&0===a?new Date(t,10,12):e}function u(e,t){const n=e.getDay(),a=s(e),i=t.some((e=>s(e)===a));return 0===n||6===n||i}function c(e,t,n){for(;t>0;)e.setDate(e.getDate()+1),u(e,n)||t--;return e}function D(e=new Date){const t=new Date(Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e).replace(" 24:"," 00:"));return t instanceof Date&&!isNaN(t.getTime())?t:new Date}function d(e){const t=D();if(!(t instanceof Date)||isNaN(t.getTime()))return console.log("invalid date"),"";const n=(d=t.getFullYear(),[{date:new Date(d,0,1),name:"New Year's Day"},{date:i(d,0,1,3),name:"Martin Luther King Jr. Day"},{date:i(d,1,1,3),name:"Presidents' Day"},{date:r(d,4,1),name:"Memorial Day"},{date:new Date(d,6,4),name:"Independence Day"},{date:new Date(d,5,19),name:"Juneteenth National Independence Day"},{date:i(d,8,1,1),name:"Labor Day"},{date:i(d,9,1,2),name:"Columbus Day"},{date:new Date(d,10,11),name:"Veterans Day"},{date:i(d,10,4,4),name:"Thanksgiving Day"},{date:new Date(d,11,25),name:"Christmas Day"}].map((e=>({date:o(e.date),name:e.name}))).map((e=>e.date))),a=function(e,t){const n=new Date(e);return n.setHours(15,30,0,0),e.getTime()===n.getTime()||e>n||u(e,t)?c(n,1,t):n}(t,n),s=function(e,t){return c(new Date(e),2,t)}(a,n);var d;if("COUNTDOWN"===e){const e=function(e){const t=D(),n=e.getTime()-t.getTime();return n<0?{hours:0,minutes:0,isLessThanOneMinute:!0}:{hours:Math.floor(n/36e5),minutes:Math.floor(n/6e4%60),isLessThanOneMinute:!1}}(a);return function(e){return function(e,t,n){if(n)return"less than a minute";const a=[];return e>0&&a.push(`${e} hour${1===e?"":"s"}`),t>0&&a.push(`${t} minute${1===t?"":"s"}`),a.join(" ")}(e.hours,e.minutes,e.isLessThanOneMinute)}(e)}return function(e){return`${["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]}, ${["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."][e.getMonth()]} ${e.getDate()}`}(s)}t.useShippingNotification=e=>{var t,n;try{const[i,r]=(0,a.useState)("default"!=e?d("COUNTDOWN"):""),s="default"!=e?d("DELIVERY_DAY"):m(),o=null!==(t={default:"Order now and it ships by",countdown:"Order now and it ships",countdownWithDate:`Want it by ${s}?`}[e])&&void 0!==t?t:"",u=null!==(n={default:s,countdown:"within ",countdownWithDate:"order within "}[e])&&void 0!==n?n:"";return(0,a.useEffect)((()=>{"countdown"!==e&&"countdownWithDate"!==e||setInterval((()=>r(d("COUNTDOWN"))),15e3)}),[]),{shippingTime:i,messageLine1:o,messageLine2:u}}catch(e){return{shippingTime:"",messageLine1:"",messageLine2:""}}},t.getShippingTime=d;const g=1,f=((new Date).getTimezoneOffset(),"en-US"),l={weekday:"long",day:"numeric",month:"long"};function m(e,t){var n=new Date;n.setDate(n.getDate()),n.setHours(16),n.setMinutes(0),n.setMilliseconds(0);let a=p(n,g);if(e&&!h(new Date(e)))a=new Date(e);else if(t){const e=p(n,g,t);h(e)||(a=e)}return a.toLocaleString(f,l)}function h(e){return new Date(e.toDateString())=0;)i.setTime(e.getTime()+864e5*a),w(i)&&--t,++a;if(n)for(i.setDate(i.getDate()+n);!w(i);)i.setDate(i.getDate()+1);return i}function w(e){var t=e.getDay();if(0===t||6===t)return!1;let n=["12/31+5","1/1","1/2+1","1-3/1","2-3/1","5~1/1","7/3+5","7/4","7/5+1","9-1/1","10-2/1","11/10+5","11/11","11/12+1","11-4/4","12/24+5","12/25","12/26+1"];var a=e.getDate(),i=e.getMonth()+1,r=i+"/"+a;if(n.indexOf(r)>-1)return!1;var s=r+"+"+t;if(n.indexOf(s)>-1)return!1;var o=i+"-"+(Math.floor((a-1)/7)+1)+"/"+t;if(n.indexOf(o)>-1)return!1;var u=new Date(e);u.setMonth(u.getMonth()+1),u.setDate(0);var c=i+"~"+(Math.floor((u.getDate()-a-1)/7)+1)+"/"+t;return!(n.indexOf(c)>-1)}t.calculateShippingDay=m}}]);