"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[27],{159:(e,t,a)=>{a.d(t,{a:()=>s});var i=a(4);const r={hanger:(0,i.A)(),"tshirt-pants":(0,i.$)()},s=e=>r[e]},160:(e,t,a)=>{a.d(t,{a:()=>te});var i=a(1),r=a(0),s=a(8),n=a(315),o=a(93),l=a(103),c=a(161);const{wrapper:d,wrapperBadge:u,wrapperImage:p}=c.a,v=({imageMap:e,currentColor:t,alt:a,productLink:i,isDesktopDevice:s,selectedSize:n})=>{const o=["1X","2X","3X","4X","5X","6X","7X","8X","9X","10X"].includes(n)?`${t} Plus`:t;return(0,r.jsx)("div",Object.assign({className:d},{children:(0,r.jsxs)("div",Object.assign({className:p},{children:[i&&(0,r.jsx)("a",Object.assign({href:i,target:s?"_blank":"_self",className:u},{children:"View product details"})),(0,r.jsx)("img",{src:e[o]||e[t],alt:a})]}))}))};var m=a(162);const{wrapper:h,wrapperActualPrice:j,wrapperComparePrice:f,wrapperCrossedPrice:b,wrapperActualPriceRed:S,wrapperPercentage:x}=m.a,w=({currentVariant:e,currency:t="$",discountValue:a=0})=>{var i;if(!e)return(0,r.jsx)(r.Fragment,{});const s=(o=Number(e.priceV2.amount),l=a,parseFloat((o-o*(l/100)).toFixed(2))).toFixed(2);var o,l;const c=(null===(i=e.compareAtPrice)||void 0===i?void 0:i.amount)||e.priceV2.amount,d=Number(c)>Number(s),u=((e,t)=>{if(e<=0||t<0||t>e)throw new Error("Invalid price values");return(e-t)/e*100})(Number(c),Number(s)),p=u>15;return(0,r.jsxs)("div",Object.assign({className:h},{children:[d&&(0,r.jsx)("p",Object.assign({className:(0,n.a)(f,b)},{children:`${t}${c}`})),(0,r.jsx)("p",Object.assign({className:(0,n.a)(j,d&&S)},{children:`${t}${s}`})),p&&(0,r.jsx)("p",Object.assign({className:x},{children:`(${u.toFixed(0)}% off)`}))]}))};var g=a(2),O=a(163);const{wrapper:C,wrapperTitle:M,wrapperDetails:N,wrapperSize:P,wrapperColor:z,wrapperParagraph:D}=O.a,y=({title:e,imageMap:t,options:a,variants:i,colors:s,handle:n,isMainProduct:c,mainProductCurrentVariant:d,outfitDiscount:u,vendor:p,id:m,handleSelectProduct:h,isDesktopDevice:j,handleSoldOutMissyAndPlus:f})=>{var b,S;const x=(null===(b=a[1])||void 0===b?void 0:b.values)||[],{selectedColor:O,selectedSize:y,selectedVariant:k,excludedSizes:V,availableSizes:A,handleColorChange:B,createProductLink:T,ref:$,setSelectedSize:F,isOutfit:I}=(({variants:e,handle:t,title:a,vendor:i,id:r,isMainProduct:s,mainProductCurrentVariant:n,handleSelectProduct:o,outfitDiscount:l,allSizes:c,handleSoldOutMissyAndPlus:d})=>{var u,p;const v=e.find((e=>e.availableForSale)),m=null!==(u=null==v?void 0:v.optionMap.Size)&&void 0!==u?u:"",h=null!==(p=null==v?void 0:v.optionMap.Color)&&void 0!==p?p:"",[j,f]=(0,g.useState)(s&&n?n.optionMap.Color||"":h),[b,S]=(0,g.useState)(s&&n?n.optionMap.Size||"":m),x=(0,g.useCallback)(((e,t)=>t?`/products/${e}?variant=${t}`:`/products/${e}`),[]),w=(0,g.useRef)(null),O=(0,g.useMemo)((()=>{var s;const n=e.find((e=>e.optionMap.Color===j&&e.optionMap.Size===b));return n?(d&&d(!1),Object.assign(Object.assign({},n),{title:(null==n?void 0:n.title)||a,vendor:i,url:x(t,n.id),productId:r,outfitDiscount:null!==(s=null==n?void 0:n.outfitDiscount)&&void 0!==s?s:l})):(d&&d(!0),w.current)}),[j,b,e,a,i,t,r,x]);(0,g.useEffect)((()=>{O&&(w.current=O)}),[null==O?void 0:O.id]);const{availableSizes:C,excludedSizes:M}=(0,g.useMemo)((()=>{const t=e.filter((e=>e.optionMap.Color===j)),a=new Set(c),i=[];return t.forEach((({optionMap:e,availableForSale:t})=>{const r=e.Size;r&&(a.add(r),t||i.push(r))})),{availableSizes:Array.from(a),excludedSizes:i}}),[j,e]),N=(0,g.useCallback)((e=>{f(e.target.value)}),[]);return(0,g.useEffect)((()=>{O&&o(O)}),[null==O?void 0:O.id]),{selectedColor:j,selectedSize:b,selectedVariant:O,excludedSizes:M,availableSizes:C,handleColorChange:N,createProductLink:x,ref:(0,g.useRef)(null),setSelectedSize:S,isOutfit:!0}})({variants:i,handle:n,title:e,vendor:p,id:m,isMainProduct:c,mainProductCurrentVariant:d,handleSelectProduct:h,outfitDiscount:u,allSizes:x,handleSoldOutMissyAndPlus:f}),X=(0,g.useMemo)((()=>{const e=i.filter((e=>e.optionMap.Color===O));return x.filter((t=>!e.some((e=>e.optionMap.Size===t))))}),[O,i]);return(0,r.jsxs)("div",Object.assign({className:C},{children:[(0,r.jsx)(v,{imageMap:t,currentColor:O,alt:e,productLink:c?"":T(n,null==k?void 0:k.id),isDesktopDevice:j,selectedSize:y}),(0,r.jsxs)("div",Object.assign({className:N},{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",Object.assign({className:M},{children:(null==k?void 0:k.title)||e})),(0,r.jsx)(w,{currentVariant:k,discountValue:null!==(S=null==k?void 0:k.outfitDiscount)&&void 0!==S?S:u})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",Object.assign({className:z},{children:[(0,r.jsx)("p",Object.assign({className:D},{children:"Color:"})),(0,r.jsx)(o.a,{colors:s,variants:i,currentVariant:null!=k?k:{availableForSale:!1,compareAtPrice:{amount:"",currencyCode:"USD"},id:"",optionMap:{Color:"",Size:""},priceCurrency:"USD",priceV2:{amount:"",currencyCode:"USD"},quantityAvailable:0,sku:""},currentColor:O,ref:$,onChangeHandler:B,currency:"$",isOutfit:I})]})),(0,r.jsxs)("div",Object.assign({className:P},{children:[(0,r.jsx)("p",Object.assign({className:D},{children:"Size:"})),A.map(((t,a)=>(0,r.jsx)(l.a,{actualSize:y,setCurrentVariantBySize:e=>F(e),unavailableSizes:[...V,...X],sizeLabel:t,isOutfit:I,sizesNotExistInCurrentVariant:X},t+e+a)))]}))]})]}))]}))};var k=a(4),V=a(164);const{wrapper:A,wrapperIcon:B,wrapperTitle:T,wrapperTitleNoModal:$}=V.a,F=({handleShowOutfit:e,discountTitle:t,noModal:a=!1})=>(0,r.jsxs)("div",Object.assign({className:A},{children:[!a&&(0,r.jsx)("div",Object.assign({onClick:e,className:B},{children:(0,r.jsx)(k.m,{})})),t&&(0,r.jsx)("h1",Object.assign({className:(0,n.a)(T,a&&$)},{children:t}))]}));var I=a(165);const{wrapper:X,wrapperButton:E,spinner:L,spinnerPath:_,btnBusy:R,wrapperButtonNoModal:U,wrapperNoModal:q,wrapperButtonNoModalMarginBottom:W}=I.a,H=({totalPriceWithDiscount:e,addToCartOutfit:t,selectedProduct:a,isDisabledAddToCartButton:i,isBusy:s,handleShowOutfit:o,noModal:l=!1,isSoldOutMissyAndPlus:c=!1})=>{const d=()=>{const e=(new Date).getTime();return a.map((t=>({id:t.id,quantity:1,properties:{_outfitId:e},image:"",product_title:t.title,variant_title:"",variant_id:Number(t.id),price:100*Number(t.priceV2.amount),final_price:100*Number(t.priceV2.amount),url:t.url,vendor:t.vendor})))},u=e>0,p=i||c;return(0,r.jsx)("div",Object.assign({class:(0,n.a)(X,l&&q)},{children:(0,r.jsxs)("button",Object.assign({disabled:p,onClick:()=>t({items:d()},o),className:(0,n.a)(E,l&&U,W)},{children:["Add outfit to cart "+(u?`(${e.toFixed(2)})`:""),s&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",Object.assign({className:L,viewBox:"0 0 50 50"},{children:(0,r.jsx)("circle",{className:(0,n.a)(_),cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"})})),(0,r.jsx)("span",{className:R})]})]}))}))};var Y=a(166);const{wrapper:G,overlay:J,overlayActive:K,wrapperOpen:Q,wrapperOutfitProducts:Z,wrapperRelative:ee}=Y.a,te=({outfitsProducts:e,handleShowOutfit:t,showOutfit:a,mainProductId:o,currentVariant:l,addToCartOutfit:c,isMobile:d,isBusy:u,pdpButtonText:p,isDesktopDevice:v,discountTitle:m,noModal:h=!1})=>{(0,s.a)(a);const{top:j}=((e,t)=>{const[a,i]=(0,g.useState)(0),r=(0,g.useMemo)((()=>140),[]),s=(0,g.useMemo)((()=>0),[]),n=(0,g.useCallback)((()=>{if(t)return;const a=window.scrollY;if(0===a)return void i(e?s:r);if(e)return void(a>s&&i("auto"));const n=Math.max(0,r-a);i(n)}),[e,r,s]);return(0,g.useEffect)((()=>(window.addEventListener("scroll",n),n(),()=>{window.removeEventListener("scroll",n)})),[n]),{top:a}})(d,a),[f,b]=(0,g.useState)([]),[S,x]=(0,g.useState)(!1),w=e=>{x(e)},O=e=>{if(!e.availableForSale)return void b(f.filter((t=>t.productId!==e.productId)));const t=f.findIndex((t=>t.productId===e.productId));if(-1===t)return void b((t=>[...t,e]));const a=[...f];a[t]=e,b(a)},C=!(e.length===f.length)||u,M=f.reduce(((e,t)=>{const a=t.priceV2.amount,i=t.outfitDiscount;return e+((r=Number(a))-r*i/100);var r}),0);return(0,r.jsxs)(i.Fragment,{children:[(0,r.jsx)("div",{className:(0,n.a)(J,a&&!h&&K),onClick:t}),(0,r.jsxs)("div",Object.assign({style:{top:j},className:(0,n.a)(G,a&&Q,h&&ee)},{children:[(0,r.jsx)(F,{handleShowOutfit:t,discountTitle:m,noModal:h}),(0,r.jsx)("div",Object.assign({className:Z},{children:e.map(((e,t)=>(0,i.createElement)(y,Object.assign({},e,{key:e.title,isMainProduct:e.id===o,mainProductCurrentVariant:l,handleSelectProduct:O,isDesktopDevice:v,handleSoldOutMissyAndPlus:w}))))})),(0,r.jsx)(H,{selectedProduct:f,totalPriceWithDiscount:M,addToCartOutfit:c,isDisabledAddToCartButton:C,isBusy:u,handleShowOutfit:t,noModal:h,isSoldOutMissyAndPlus:S})]}))]})}}}]);