"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[41],{29:(e,n,t)=>{t.d(n,{a:()=>o});var r=t(0);function o({size:e,iconClass:n}){return(0,r.jsx)("div",{"aria-hidden":"true",role:"presentation",class:n,style:{width:e||"",height:e||"",backgroundImage:"var(--icon-close)",backgroundSize:"contain",cursor:"pointer",backgroundRepeat:"no-repeat",backgroundOrigin:"content-box"}})}},38:(e,n,t)=>{t.d(n,{a:()=>i});var r=t(0),o=t(11),a=t(1);const s='\n a[href],\n area[href],\n input:not([type="hidden"]):not([disabled]):not([tabindex="-1"]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]):not([tabindex="-1"]),\n iframe,\n object,\n embed,\n [tabindex]:not([tabindex="-1"]),\n [contenteditable]:not([contenteditable="false"]),\n audio[controls],\n video[controls],\n summary',i=(0,o.forwardRef)((({children:e,disabled:n=!1,isActive:t,autoFocus:o=!0,restoreFocus:i=!0,as:l="div",className:c,style:u,"aria-label":d,"aria-labelledby":f,"aria-modal":m,role:p,id:h,"data-testid":b,onTransitionEnd:g,onAnimationEnd:v},y)=>{const x=(0,a.useRef)(null),j=(0,a.useRef)(null),k=(0,a.useRef)(null),_=(0,a.useRef)(null),w=(0,a.useRef)(null),E=(0,a.useRef)(!n);(0,a.useLayoutEffect)((()=>{E.current=!n}),[n]);const C=(0,a.useCallback)((()=>void 0!==t?t():E.current),[t]),N=(0,a.useCallback)((e=>{x.current=e,"function"==typeof y?y(e):y&&(y.current=e)}),[y]),L=(0,a.useCallback)((()=>{const e=x.current;if(!e)return null;const n=Array.from(e.querySelectorAll(s));for(const e of n)if(e!==j.current&&e!==k.current)return e;return null}),[]),R=(0,a.useCallback)((()=>{const e=x.current;if(!e)return null;const n=Array.from(e.querySelectorAll(s));for(let e=n.length-1;e>=0;e--){const t=n[e];if(t!==j.current&&t!==k.current)return t}return null}),[]),S=(0,a.useCallback)((()=>{var e;if(!C())return;const n=R();n?n.focus():null===(e=x.current)||void 0===e||e.focus()}),[C,R]),M=(0,a.useCallback)((()=>{var e;if(!C())return;const n=L();n?n.focus():null===(e=x.current)||void 0===e||e.focus()}),[C,L]);(0,a.useEffect)((()=>{if("undefined"==typeof document)return;const e=e=>{const n=e.target;if(!n||n===document.body)return;const t=x.current;t&&t.contains(n)||(w.current=n)};return document.addEventListener("focusin",e,!0),()=>{document.removeEventListener("focusin",e,!0)}}),[]),(0,a.useEffect)((()=>{var e;if("undefined"!=typeof document&&!n){if(i){w.current&&!document.body.contains(w.current)&&(w.current=null);let e=document.activeElement;e&&e!==document.body||(e=w.current),e&&e!==document.body&&document.body.contains(e)?_.current=e:_.current=null}return o&&(null===(e=x.current)||void 0===e||e.focus({preventScroll:!0})),()=>{i&&_.current instanceof HTMLElement&&_.current!==document.body&&document.body.contains(_.current)&&_.current.focus({preventScroll:!0}),_.current=null}}}),[n,o,i]),(0,a.useEffect)((()=>{if("undefined"==typeof document)return;const e=x.current,n=n=>{if(C()&&"Tab"===n.key&&e&&document.activeElement===e)if(n.preventDefault(),n.shiftKey){const e=R();null==e||e.focus()}else{const e=L();null==e||e.focus()}},t=n=>{if(!C()||!e)return;const t=n.target;if(t!==j.current&&t!==k.current&&!e.contains(t)){n.stopPropagation();const t=L();t?t.focus():e.focus()}};return document.addEventListener("keydown",n,!0),document.addEventListener("focusin",t,!0),()=>{document.removeEventListener("keydown",n,!0),document.removeEventListener("focusin",t,!0)}}),[C,L,R]);const I={position:"fixed",top:0,left:0,width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"},A=void 0!==t?0:n?-1:0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{ref:j,style:I,tabIndex:A,onFocus:S,"aria-hidden":"true"}),(0,r.jsx)(l,{ref:N,id:h,tabIndex:-1,className:c,style:u,role:p,"aria-label":d,"aria-labelledby":f,"aria-modal":m,"data-testid":b,onTransitionEnd:g,onAnimationEnd:v,children:e}),(0,r.jsx)("div",{ref:k,style:I,tabIndex:A,onFocus:M,"aria-hidden":"true"})]})}));i.displayName="FocusLock"},43:(e,n,t)=>{t.d(n,{a:()=>l});var r=t(0),o=t(1),a=t(11),s=t(38);let i=[];function l({isOpen:e,children:n,keepMounted:t=!1,onEscape:l}){const[c,u]=(0,o.useState)(!1),d=(0,o.useRef)(Symbol("focus-portal")),f=(0,o.useRef)(null);!function(e){const n=(0,o.useRef)(null);(0,o.useEffect)((()=>{if("undefined"!=typeof document&&e)return n.current=document.activeElement,()=>{n.current instanceof HTMLElement&&(n.current.focus(),n.current=null)}}),[e])}(e);const m=function(e,n){const[t,r]=(0,o.useState)("inactive"),a=(0,o.useRef)(e);return a.current=e,(0,o.useEffect)((()=>{if(!e)return void r("inactive");r("waiting");let t=!1;const o=requestAnimationFrame((()=>{if(t||!a.current)return;const e=n.current;if(!e)return void r("complete");const o=e.querySelector("[data-animate]")||e.firstElementChild;if(!o)return void r("complete");const s=o.getAnimations({subtree:!1});0!==s.length?Promise.all(s.map((e=>e.finished))).then((()=>{!t&&a.current&&r("complete")})).catch((()=>{!t&&a.current&&r("complete")})):r("complete")}));return()=>{t=!0,cancelAnimationFrame(o)}}),[e,n]),t}(e,f);(0,o.useEffect)((()=>{if(!e)return void u(!1);const n=d.current;return i.push(n),u(!0),()=>{i=i.filter((e=>e!==n))}}),[e]),(0,o.useEffect)((()=>{if("undefined"==typeof document||!e||!l)return;const n=e=>{"Escape"===e.key&&i[i.length-1]===d.current&&(e.stopPropagation(),e.preventDefault(),l())};return document.addEventListener("keydown",n,!0),()=>document.removeEventListener("keydown",n,!0)}),[e,l]);const p=(0,o.useCallback)((()=>!!e&&i[i.length-1]===d.current),[e]);if("undefined"==typeof document)return null;if(!e&&!t)return null;const h="complete"!==m||!c;return(0,a.createPortal)((0,r.jsx)(s.a,{ref:f,disabled:h,isActive:p,autoFocus:e&&c,restoreFocus:!1,children:n}),document.body)}},44:(e,n,t)=>{t.d(n,{a:()=>l});var r=t(0),o=t(14),a=t(29),s=t(43),i=t(50);function l({isOpen:e,onClose:n,children:t,title:l,fitContent:c=!1,keepMounted:u=!1}){const{dialogProps:d}=(0,i.a)({isOpen:e,label:l}),f=e?o.a.modalOverlay:o.a.modalOverlayHidden;return(0,r.jsx)(s.a,{isOpen:e,keepMounted:u,onEscape:n,children:(0,r.jsxs)("div",{className:f,"aria-hidden":!e,children:[(0,r.jsx)("div",{className:o.a.modalBackground,onClick:n,role:"presentation"}),(0,r.jsxs)("div",Object.assign({},d,{className:[o.a.modal,c?o.a.fitContent:""].join(" "),children:[(0,r.jsx)("button",{className:o.a.closeBtn,onClick:n,"aria-label":"Close dialog",children:(0,r.jsx)(a.a,{size:"14px",iconClass:o.a.closeIconSVG})}),t]}))]})})}},196:(e,n,t)=>{t.d(n,{a:()=>h,b:()=>b,c:()=>f,d:()=>p,e:()=>m});var r=t(0),o=t(1),a=t(141),s=t(3),i=t(142),l=t(28),c=t(165),u=t(44),d=t(15);function f(e){const n=e.split("/"),t=n[n.length-1];return parseInt(null!=t?t:"0",10)}function m(e,n){return e.replace(/\{(\w+)\}/g,((e,t)=>{var r;return String(null!==(r=n[t])&&void 0!==r?r:"")}))}function p(e,n,t){const o=m(e,n),s=o.match(/^(.*?)<([^>]+)>(.*)$/);if(!s)return(0,r.jsx)("span",{children:o});const[,i,l,c]=s;return(0,r.jsxs)("span",{children:[i,(0,r.jsx)("button",{type:"button",className:a.a.modalLink,onClick:t,children:l}),c]})}function h({sectionProps:e,apps:{cart:n}}){var t,h;const[g,v]=(0,o.useState)(!1),y=(0,s.d)((e=>({pathname:e.pathname,config:e.config}))),x=n.cart.value,j=(0,l.a)(null==x?void 0:x.currency),k=(0,o.useMemo)((()=>e.eligible_products?new Set(e.eligible_products.map((e=>f(e.id)))):new Set),[e.eligible_products]),{eligibleItems:_,eligibleCount:w}=(0,o.useMemo)((()=>{if(!(null==x?void 0:x.items))return{eligibleItems:[],eligibleCount:0};const e=x.items.filter((e=>!!k.has(e.product_id)&&!(0,c.d)(e))),n=e.reduce(((e,n)=>e+n.quantity),0);return{eligibleItems:e,eligibleCount:n}}),[null==x?void 0:x.items,k]);if(0===_.length||!x)return(0,r.jsx)(r.Fragment,{});const E=e.quantity_threshold,C=w>=E,N=Math.max(0,E-w),L=Math.min(100,w/E*100),R=_.reduce(((e,n)=>e+n.discounted_price*n.quantity),0)/100,S=_.reduce(((e,n)=>e+n.original_price*n.quantity),0)/100,M=(w>0?S/w:0)*E,I=M-(null!==(t=e.promotion_price)&&void 0!==t?t:0),A=M>0?Math.round(I/M*100):0,O=C?e.border_color_complete:e.border_color_in_progress,F=m(e.savings_message,{percentage:A,quantity:E});return(0,r.jsxs)("div",{className:a.a.groupContainer,style:{"--border-color":O},children:[(0,r.jsxs)("div",{className:a.a.header,children:[(0,r.jsx)("span",{className:a.a.statusLabel,children:C?e.complete_label:e.in_progress_label}),(0,r.jsx)("span",{className:a.a.promoName,children:e.short_name})]}),(0,r.jsx)("div",{className:a.a.progressMessage,children:C?(0,r.jsxs)("span",{className:a.a.completeMessage,children:[(0,r.jsx)(b,{}),(0,r.jsxs)("span",{children:["You're getting ",A,"% off (-",j(I),")"]})]}):p(e.in_progress_message,{remaining:N},(()=>v(!0)))}),(0,r.jsx)("div",{className:a.a.progressBarContainer,children:(0,r.jsx)("div",{className:a.a.progressBar,style:{width:`${L}%`}})}),(0,r.jsx)("ul",{className:a.a.itemsContainer,"aria-label":"Promotion items",children:_.map(((e,t)=>(0,r.jsx)("li",{"aria-label":(0,d.b)(e.product_title,e.options_with_values),children:(0,r.jsx)(i.a,Object.assign({},e,{cartItemkKey:e.key,pathname:y.pathname,line:t+1,flags:{moveToWishList:"disabled"},cartApp:n,height:y.config.product_image_height,width:y.config.product_image_width,hostname:y.config.hostname,currency:x.currency,formatCurrency:j}))},e.key)))}),(0,r.jsxs)("div",{className:a.a.footer,children:[(0,r.jsxs)("div",{className:a.a.subtotalRow,children:[(0,r.jsx)("span",{className:a.a.subtotalLabel,children:e.offer_subtotal_label}),(0,r.jsx)("span",{className:a.a.subtotalValue,children:j(R)})]}),(0,r.jsx)("div",{className:a.a.savingsRow,children:F})]}),e.eligible_modal_content&&(0,r.jsx)(u.a,{isOpen:g,onClose:()=>v(!1),title:null!==(h=e.short_name)&&void 0!==h?h:"Eligible styles",children:(0,r.jsxs)("div",{className:a.a.modalContent,children:[(0,r.jsx)("h3",{children:e.short_name}),(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:e.eligible_modal_content}}),(0,r.jsx)("button",{type:"button",className:a.a.okBtn,onClick:()=>v(!1),children:"OK"})]})})]})}function b(){return(0,r.jsxs)("svg",{className:a.a.checkmarkIcon,width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("circle",{cx:"8.5",cy:"8.5",r:"8",fill:"currentColor"}),(0,r.jsx)("path",{d:"M5 8.5L7.5 11L12 6",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}},50:(e,n,t)=>{t.d(n,{a:()=>a});var r=t(1),o=t(51);function a({isOpen:e,label:n,labelledBy:t}){return(0,o.a)(e),{dialogProps:(0,r.useMemo)((()=>({role:"dialog","aria-modal":!0,"aria-label":t?void 0:n,"aria-labelledby":t,tabIndex:-1})),[n,t])}}},51:(e,n,t)=>{t.d(n,{a:()=>s});var r=t(1);let o=0,a=null;function s(e){(0,r.useEffect)((()=>{if("undefined"!=typeof document&&e){if(0===o){a={overflow:document.body.style.overflow,paddingRight:document.body.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",document.body.style.paddingRight=`${e}px`}return o++,()=>{o--,o<0&&(o=0),0===o&&a&&(document.body.style.overflow=a.overflow,document.body.style.paddingRight=a.paddingRight,a=null)}}}),[e])}}}]);