"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[18],{33:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HeroSlider=function({product:e,selectedVariant:t,pdpVideo:n,showModelInformation:i,isDesktop:g,embedded:b}){const y=(0,a.useMemo)((()=>{var i,s,a;const l=(0,c.getImagesForVariant)(e.imageMap,t,h.getAssignment),o=null===(i=null==t?void 0:t.selectedOptions.find((e=>"Color"===e.name)))||void 0===i?void 0:i.value;return n&&o&&(null===(s=e.productVideos)||void 0===s?void 0:s[o])?[...l.slice(0,g?2:1),{src:null===(a=e.productVideos)||void 0===a?void 0:a[o]},...l.slice(g?2:1)]:l}),[t]),_=(0,p.useRef)(null),[j,x]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{y.forEach(v),Object.values(e.imageMap).forEach((e=>{e.slice(0,2).forEach(v)}));const t=new r.default({gallery:"#hero-slider",children:"a",pswpModule:d.default,bgOpacity:.9,arrowKeys:!0});return n&&t.on("contentLoad",(e=>{var t;const{content:n}=e;if(null===(t=n.data.src)||void 0===t?void 0:t.endsWith(".mp4")){e.preventDefault(),n.element=document.createElement("div"),n.element.className="pswp__video-container";const t=document.createElement("video");t.setAttribute("playsinline",""),t.setAttribute("muted",""),t.setAttribute("loop",""),t.setAttribute("style","width: 100vw;"),t.setAttribute("autoplay",""),t.src=n.data.src,n.element.appendChild(t)}})),t.init(),j?!g&&_.current&&(_.current.scrollLeft=0):x(!0),()=>{null==t||t.destroy()}}),[y]),(0,s.jsxs)("div",{class:["pswp-gallery",g?o.default.container:m,b?l.default.embeddedContainer:""].join(" "),ref:_,id:"hero-slider",children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:".pswp--touch .pswp__button--arrow { visibility: visible; };\n "+(n?" .pswp__video-container {\n position: relative;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n .pswp__video-container video {\n background: #444;\n object-fit: cover; \n width: 100%;\n height: 100%;\n max-width: 800px;\n max-height: 600px;\n pointer-events: auto;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }":"")}}),y.map((({src:e,model:t,width:n,height:a},r)=>(0,s.jsxs)("a",{class:[g?o.default.item:f,b?l.default.embeddedImage:""].join(" "),"data-pswp-type":(null==e?void 0:e.endsWith(".mp4"))?"video":"image",href:e,"data-pswp-width":n,"data-pswp-height":a,target:"_blank",rel:"noreferrer",children:[(null==e?void 0:e.endsWith(".mp4"))?(0,s.jsx)(w,{src:e,preload:"metadata",className:g?o.default.item:f}):(0,s.jsx)(u.LazyImage,{src:e,initialWidth:300,width:n,height:a}),i&&t&&(0,s.jsx)("div",{class:l.default.modelOverlay,children:t})]},r)))]})};const s=n(0),a=(n(1),n(3)),l=i(n(40)),o=i(n(41)),r=i(n(183)),d=i(n(184));n(185);const u=n(4),c=n(34),p=n(3),h=n(2),{sliderContainer:m,sliderItem:f}=l.default;function v(e){(new Image).src=e.src}function w({src:e,className:t}){const n=(0,p.useRef)(null);return(0,a.useEffect)((()=>{var e;(null==n?void 0:n.current)&&(null===(e=null==n?void 0:n.current)||void 0===e||e.load())}),[e]),(0,s.jsx)("video",{playsInline:!0,ref:n,src:e,preload:"metadata",class:t,muted:!0,loop:!0,autoPlay:!0})}}}]);