"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[40],{56:(e,t,r)=>{r.d(t,{a:()=>M});var a=r(0),i=r(30),n=r(1),o=r(7),s=r(71),l=r(4),c=r(66),d=r(53),u=r(34),p=r(11),h=r(25),m=r(3),g=r(58),v=r(49),f=r(6);function x({disruptor:e}){return"bite_disruptor"===e.type?(0,a.jsx)(b,{disruptor:e}):(0,a.jsx)(y,{disruptor:e})}function b({disruptor:e}){return e.biteHtml?(0,a.jsx)("div",{style:{display:"grid"},dangerouslySetInnerHTML:{__html:e.biteHtml}}):(0,a.jsx)(m.Fragment,{})}function y({disruptor:e}){var t;return(0,a.jsxs)("div",{class:g.a.card,style:{color:e.text_color},children:[(0,a.jsx)(j,{media:e.media}),(0,a.jsx)("div",{class:g.a.title,dangerouslySetInnerHTML:{__html:e.title}}),(0,a.jsx)("div",{class:g.a.body,dangerouslySetInnerHTML:{__html:null!==(t=e.body_text)&&void 0!==t?t:""}}),(0,a.jsx)(_,{disruptor:e})]})}function j({media:e}){var t,r;return"image"===e.type&&e.url?(0,a.jsx)(o.a,{src:(0,f.b)(e.url),alt:null!==(t=e.altText)&&void 0!==t?t:"",initialWidth:null!==(r=e.width)&&void 0!==r?r:400,cssClass:g.a.media}):"video"===e.type&&e.sources.length>0?(0,a.jsx)("div",{class:g.a.media,children:(0,a.jsx)(v.a,{sources:e.sources,className:g.a.mediaVideo})}):(0,a.jsx)(m.Fragment,{})}const C={primary:g.a.cta_primary,secondary:g.a.cta_secondary,tertiary:g.a.cta_tertiary};function _({disruptor:e}){var t;if(!e.cta_url||!e.cta_label||!e.cta_style)return(0,a.jsx)(m.Fragment,{});const r=null!==(t=C[e.cta_style])&&void 0!==t?t:g.a.cta_primary;return(0,a.jsx)("a",{href:e.cta_url,class:`${g.a.cta} ${r}`,children:e.cta_label})}var P=r(50),S=r(72),O=r(80),w=r(57),I=r(64),T=r(20),k=r(73),A=r(90),N=r(69),V=r(42),B=r(5);function H({isOpen:e,onClose:t,title:r,products:i,buttonMessage:o,addToCartProperties:s,initialVariantId:l,cartApp:c}){var d;const[u,p]=(0,n.useState)(0),h=(0,n.useRef)(null),m=(0,n.useRef)(null),g=(0,n.useMemo)((()=>i.filter(B.e)),[i]),v=()=>{const e=h.current,t=m.current;if(!e||!t)return;const r=e.scrollLeft/(e.scrollWidth-e.clientWidth);t.style.setProperty("--scroll-progress",r.toString())},f=()=>{const e=h.current;if(!e)return;v();const t=e.getBoundingClientRect(),r=Array.from(e.children),a=r[r.length-1];if(!a)return;const i=a.getBoundingClientRect().right-t.right<45;let n=1/0;r.forEach(((e,r)=>{const a=e.getBoundingClientRect();if(i&&a.left<0)return;const o=Math.abs(a.left-t.left)+(a.left<0?20:0);o{const e=h.current;if(e)return e.addEventListener("scroll",f),v(),()=>{e.removeEventListener("scroll",f)}}),[h.current,g.length]),0===g.length)return null;const x=1===g.length,b=null===(d=g[0])||void 0===d?void 0:d.title,y=null!=r?r:b?`Quick shop for ${b}`:"Quick shop";return(0,a.jsx)(k.a,{isOpen:e,onClose:t,size:"large",title:y,showTitle:!!r,children:(0,a.jsxs)("div",{className:V.a.modalContent,"data-single-product":x,children:[(0,a.jsxs)("div",{className:V.a.sliderContainer,ref:m,children:[g.length>1&&(0,a.jsx)(N.a,{direction:"left",onClick:()=>{const e=h.current;if(!e)return;const t=.8*e.offsetWidth;e.scrollBy({left:-t,behavior:"smooth"})},className:V.a.arrowLeft,ariaLabel:"Previous products"}),(0,a.jsx)("div",{className:V.a.productsSlider,ref:h,"data-slider":"true","data-single-product":x,children:g.map((e=>(0,a.jsx)(A.a,{product:e,onClose:t,buttonMessage:o,addToCartProperties:s,initialVariantId:l,cartApp:c},e.handle)))}),g.length>1&&(0,a.jsx)(N.a,{direction:"right",onClick:()=>{const e=h.current;if(!e)return;const t=.8*e.offsetWidth;e.scrollBy({left:t,behavior:"smooth"})},className:V.a.arrowRight,ariaLabel:"Next products"})]}),g.length>1&&(0,a.jsx)("div",{className:V.a.sliderDots,children:g.map(((e,t)=>(0,a.jsx)("button",{type:"button",className:[V.a.dot,t===u&&V.a.dotActive].join(" "),onClick:()=>(e=>{const t=h.current;if(!t)return;const r=Array.from(t.children)[e];r&&r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})})(t),"aria-label":`Go to product ${t+1}`},t)))})]})})}const L=300;function M({product:e,collectionHandle:t,replaceStateEnabled:r,initialVariantId:i,showSelectedOptions:n,cartApp:o}){return(null==e?void 0:e.handle)?!("type"in(s=e))||"disruptor"!==s.type&&"bite_disruptor"!==s.type?(0,a.jsx)(D,{product:e,collectionHandle:t,replaceStateEnabled:r,initialVariantId:i,showSelectedOptions:n,cartApp:o}):(0,a.jsx)(x,{disruptor:e}):null;var s}function D({product:e,collectionHandle:t,replaceStateEnabled:r,initialVariantId:m,showSelectedOptions:g,cartApp:v}){var f;const{getHexForOptionColor:x,EXCLUDE_TAGS:b,promo_prefix_tag:y,product_image_height:j,product_image_width:C,disable_color_swatches:_,showVendor:O,cardPriceDisplay:k,soldOutBadgeText:A,onSaleBadgeText:N,quickshopButton:V}=(0,l.d)((e=>({getHexForOptionColor:e.getHexForOptionColor,EXCLUDE_TAGS:e.config.exclude_tags,promo_prefix_tag:e.config.promo_prefix_tag,product_image_width:e.config.product_image_width,product_image_height:e.config.product_image_height,disable_color_swatches:e.config.disable_color_swatches,showVendor:e.showVendor,cardPriceDisplay:e.cardPriceDisplay,soldOutBadgeText:e.soldOutBadgeText,onSaleBadgeText:e.onSaleBadgeText,quickshopButton:e.quickshopButton}))),[B,M]=(0,n.useState)(!1),D=!0===e.isPack,R=V&&"disabled"!==V&&!D,W=e.options.find((e=>"Color"===e.name)),{pricePrefix:$,priceText:q,showCompareAtPrice:U,onSaleDataAttribute:G,compareAtPriceText:Q,priceClassName:z,ssrStyle:K}=function(e,t){var r;const{country:a,internationalPricing:i,dynamicCurrencyChange:o}=(0,l.d)((e=>({country:e.country,internationalPricing:e.internationalPricing,dynamicCurrencyChange:e.dynamicCurrencyChange}))),s=Boolean((0,I.d)(o,i)&&a&&"US"!==a),c=(0,n.useMemo)((()=>{const t=[e.handle];if(e.preorderSiblingHandle&&t.push(e.preorderSiblingHandle),e.combinedKey){const r=e.variants.map((e=>{var t;return null===(t=e.selectedOptions)||void 0===t?void 0:t.childProductHandle})).filter((e=>!!e));t.push(...r)}return[...new Set(t)]}),[e.handle,e.preorderSiblingHandle,e.combinedKey,e.variants]),{data:d,className:u,ssrStyle:p}=(0,w.a)(c,s,a),h=(null===(r=d[c[0]])||void 0===r?void 0:r.currency)||"USD",m=(0,T.b)({currency:h});return(0,n.useMemo)((()=>{if(e.priceTextOverride)return{priceText:e.priceTextOverride,pricePrefix:"",showCompareAtPrice:!1,onSaleDataAttribute:{},compareAtPriceText:void 0,priceClassName:u,ssrStyle:p};if(s&&Object.keys(d).length>0){const r=function(e,t,r,a,i,n,o){var s,l,c,d;const u=null!==(s=e.priceRange.variantIds)&&void 0!==s?s:[],p=[],h=[],m=[];for(const e of a){const t=null!==(c=null===(l=r[e])||void 0===l?void 0:l.variants)&&void 0!==c?c:[];for(const e of t)null!=e.price.amount&&h.push(e.price.amount),null!=(null===(d=e.compareAtPrice)||void 0===d?void 0:d.amount)&&m.push(e.compareAtPrice.amount),u.includes(e.id)&&null!=e.price.amount&&p.push(e.price.amount)}const g=p.length>0?p:h;if(0===g.length)return;const v=F(Math.min(...g),Math.max(...g),m.length>0?Math.max(...m):void 0,t,i);return Object.assign(Object.assign({},v),{priceClassName:n,ssrStyle:o})}(e,t,d,c,m,u,p);if(r)return r}const r=function(e,t,r){const{minPrice:a,maxPrice:i}=function(e){let{minPrice:t,maxPrice:r}=e.priceRange;if(null==t||Number.isNaN(t)){const a=e.variants.find((t=>t.variantId===e.defaultVariantId));a&&(t=parseFloat(a.price),r=t)}return{minPrice:t,maxPrice:r}}(e),n=F(a,i,e.compareAtRange.maxPrice,t,r);return Object.assign(Object.assign({},n),{priceClassName:"",ssrStyle:void 0})}(e,t,m);return s?Object.assign(Object.assign({},r),{priceClassName:u,ssrStyle:p}):r}),[s,e,t,d,c,m,u,p])}(e,k),X=null!=m?m:e.defaultVariantId,J=e.variants.find((e=>e.variantId===X)),[Y,Z]=(0,n.useState)(null!=J?J:e.variants[0]),ee=(0,u.c)(e.imageMap,Y)[0],te=(0,h.b)(e,Y);if(!ee)return null;const re=(0,n.useMemo)((()=>{var t,r,a;const i=null!==(t=Y.badge)&&void 0!==t?t:e.badge;return"string"==typeof i?i:Y.oos&&!Y.preorderVariant?A||null:Y.compareAtPrice&&parseFloat(Y.price){r&&(e.preventDefault(),location.replace(te))},class:i.a.link,"data-orly-type":t,"data-orly-handle":e.handle,children:[(0,a.jsxs)("div",{className:i.a.heroImageContainer,children:[re&&(0,a.jsx)("div",{class:i.a.bestSeller,"data-badge":re,children:re}),(0,a.jsx)(o.a,{src:ee.src,initialWidth:L,cssClass:i.a.heroImage,alt:`${ae}: ${ee.model}`,height:j,width:C,fullSizeWidth:oe}),R&&(0,a.jsx)(E,{mode:V,onClick:e=>{e.preventDefault(),e.stopPropagation(),M(!0)}})]}),(0,a.jsxs)("div",{class:i.a.textWrapper,children:[O&&(0,a.jsx)("div",{class:i.a.vendor,children:e.vendor}),g&&Y.selectedOptions&&(0,a.jsx)("span",{class:i.a.selectedOptions,children:Object.entries(Y.selectedOptions).filter((([e])=>"childProductHandle"!==e)).map((([,e])=>e)).join(" | ")}),(0,a.jsx)("div",{class:i.a.title,children:ie}),ne&&(0,a.jsx)("div",{class:i.a.subtitle,children:ne}),(0,a.jsx)("div",{class:i.a.price,children:(0,a.jsx)("span",{class:z,style:K,children:(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{class:i.a.originalPrice,style:U&&Q?void 0:"visibility:hidden",children:Q})," ",$,(0,a.jsx)("span",Object.assign({},G,{style:i.a.productCardPrice,children:q}))]})})}),(0,a.jsx)(S.a,{reviewCount:e.reviewCount,reviewRating:e.reviewRating}),y&&e.plpPromoText&&(0,a.jsx)("div",{class:i.a.plpPromoText,children:e.plpPromoText})]})]}),(0,a.jsx)(s.a,{appearance:"plp",product:e,selectedVariant:Y}),(0,a.jsx)("div",{class:i.a.colorSwatchContainer,children:!_&&W&&(0,a.jsx)(c.a,{product:e,small:!0,maxItems:12,hideLabel:!0,option:W,getHexForOptionColor:x,selectedVariant:Y,findProductVariantWithOption:t=>{var r;return(0,d.a)({option:t,variants:e.variants,currentOptions:null!==(r=null==J?void 0:J.selectedOptions)&&void 0!==r?r:{},fallbackVariant:J})},setSelectedVariantId:t=>{const r=e.variants.find((e=>e.variantId===t));r&&Z(r)}})}),R&&(0,a.jsx)(H,{isOpen:B,onClose:()=>M(!1),products:[e],initialVariantId:Y.variantId,cartApp:v})]})}function E({mode:e,onClick:t}){return"cartButton"===e?(0,a.jsx)("button",{type:"button",className:i.a.quickshopIconButton,onClick:t,"aria-label":"Quick add to cart",children:(0,a.jsx)("div",{className:i.a.quickshopIcon})}):(0,a.jsx)("button",{type:"button",className:i.a.quickshopOverlay,onClick:t,"aria-label":e,children:e})}function F(e,t,r,a,i){const n=null!=t&&e!==t,o="range"===a&&n,s=o?"":n?"From ":"",l=o?`${i(e)} – ${i(t)}`:i(e),c=null!=r&&r>e,d=(0,O.a)(c);let u;return c&&null!=r&&(u=i(r)),{pricePrefix:s,priceText:l,showCompareAtPrice:c,onSaleDataAttribute:d,compareAtPriceText:u}}}}]);