if(typeof lookbookDialogRef>"u"){class LookbookDialogDot extends HTMLElement{constructor(){super()}connectedCallback(){this.RESERVED_SPACE=20,this.left=0,this.top=0,this.inLeftHalf=!0,this.dialog=this.querySelector("[data-lookbook-dialog]"),this.productItem=this.querySelector(".product-item"),this.closeDialogButton=this.querySelector("[data-close-lookbook-dialog-button]"),this.productItem.appendChild(this.closeDialogButton),window.innerWidth>1024?this.addEventListener("click",this.toggleDialog.bind(this)):this.closeDialogButton.style.display="none",window.addEventListener("resize",this.onResize.bind(this))}onResize(){window.innerWidth>1024?(this.removeEventListener("click",this.toggleDialog.bind(this)),this.addEventListener("click",this.toggleDialog.bind(this)),this.closeDialogButton.style.display="block"):(this.removeEventListener("click",this.toggleDialog.bind(this)),this.closeDialogButton.style.display="none"),this.dialog.hasAttribute("open")&&this.closeDialog()}resetPosition(){this.left=0,this.top=0,this.setPosition()}toggleDialog(e){if(!(window.innerWidth<=1024)){if(e.target.matches("[data-close-lookbook-dialog-button]"))return document.body.classList.contains("cursor-fixed__show")&&document.body.classList.remove("active-cursor-fixed"),this.closeDialog();if(this.checkIsQuickshop3(e))return this.closeDialog();if(this.checkIsQuickView(e))return this.closeDialog();if(!(e.target.closest(".product-item")||e.target.matches(".product-item"))){if(this.dialog.hasAttribute("open"))return document.body.classList.contains("cursor-fixed__show")&&document.body.classList.remove("active-cursor-fixed"),this.closeDialog();e.target.matches(".glyphicon")&&(e.stopImmediatePropagation(),document.body.classList.contains("cursor-fixed__show")&&document.body.classList.add("active-cursor-fixed"),this.openDialog())}}}checkIsQuickshop3(e){return document.body.classList.contains("quick_shop_option_3")?e.target.matches("[data-quickshop-popup]")||e.target.closest("[data-quickshop-popup]"):!1}checkIsQuickView(e){return e.target.matches("[data-open-quick-view-popup]")||e.target.closest("[data-open-quick-view-popup]")||e.target.matches(".card-quickview")}openDialog(){this.currentTop=window.scrollY,this.resetPosition(),this.dialog.showModal(),this.calculatePosition({currentWindowTop:this.currentTop}),this.setPosition(),window.scrollTo({top:this.currentTop}),this.productItem.scrollIntoView({block:"nearest",behavior:"smooth"})}closeDialog(){this.productItem.classList.add("closing"),setTimeout(()=>{this.resetPosition(),this.dialog.close(),this.productItem.classList.remove("closing")},500)}calculatePosition({currentWindowTop}){const lookbookDotBox=this.getBoundingClientRect(),dialogBox=this.productItem.getBoundingClientRect();if(window.innerWidth>1024){const{left:dotLeft,right:dotRight,top:dotTop,width:dotWidth}=lookbookDotBox,{left:dialogLeft,top:dialogTop,width:dialogWidth,height:dialogHeight}=dialogBox,axis=window.innerWidth/2;dotLeft+dotWidth/2>axis&&(this.inLeftHalf=!1),this.left=LookbookDialogDot.getLeft({inLeftHalf:this.inLeftHalf,reservedSpace:this.RESERVED_SPACE,right:dotRight,left:dotLeft,dialogLeft,dialogWidth}),this.top=LookbookDialogDot.getTop({top:dotTop,dialogHeight,dialogTop,currentWindowTop,reservedSpace:this.RESERVED_SPACE})}else this.top=50,this.left=50}setPosition(){this.productItem.style.setProperty("--top",this.top),this.productItem.style.setProperty("--left",this.left)}static getLeft(params){const{inLeftHalf,reservedSpace,right,left,dialogLeft,dialogWidth}=params;let intendedLeft,deltaLeft;return inLeftHalf?(intendedLeft=right+reservedSpace,deltaLeft=-1*(dialogLeft-intendedLeft)):(intendedLeft=left-reservedSpace-dialogWidth,deltaLeft=intendedLeft-dialogLeft),deltaLeft}static getTop(params){const{top,dialogHeight,reservedSpace,dialogTop,currentWindowTop}=params;let intendedTop,deltaTop;return top+dialogHeight+reservedSpace>currentWindowTop+window.innerHeight?(intendedTop=top-dialogHeight+reservedSpace,deltaTop=-1*(dialogTop-intendedTop)):(intendedTop=top-reservedSpace,deltaTop=intendedTop-dialogTop),deltaTop}}class LookbookWrapper extends HTMLElement{constructor(){super()}connectedCallback(){this.lookbookIcons=[...this.querySelectorAll("[data-lookbook-icon]")],this.initialized=!1,window.innerWidth<=1024&&this.lookbookIcons.forEach(icon=>{icon.addEventListener("click",this.onClick.bind(this))}),window.addEventListener("resize",this.onResize.bind(this)),setTimeout(()=>{this.initialized=!0},150)}onResize(){window.innerWidth<=1024?this.lookbookIcons.forEach(icon=>{icon.removeEventListener("click",this.onClick.bind(this)),icon.addEventListener("click",this.onClick.bind(this))}):this.lookbookIcons.forEach(icon=>{icon.removeEventListener("click",this.onClick.bind(this))})}onClick(e){window.innerWidth>1024||!this.initialized||this.buildPopup(e)}buildPopup(e){const icon=e.currentTarget,currentIndex=this.lookbookIcons.indexOf(icon);this.lookbookIcons.forEach(icon2=>{const productItem=icon2.querySelector(".product-item"),dialog=icon2.querySelector("[data-lookbook-dialog]");if(productItem){const signature=`sig-${productItem.dataset.productId}-${Date.now().toString()}`;dialog.dataset.signature=signature,productItem.dataset.signature=signature,LookbookMobilePopup.appendItem(productItem)}}),LookbookMobilePopup.togglePopup(!0,currentIndex)}}class LookbookMobilePopup extends HTMLElement{constructor(){super()}connectedCallback(){this.contentWrapper=this.querySelector("[data-lookbook-mobile-images-container]"),this.closeButton=this.querySelector("[data-close-lookbook-modal]"),this.closeButton.addEventListener("click",()=>{LookbookMobilePopup.togglePopup(!1)}),this.addEventListener("click",this.onSelfClick.bind(this)),window.addEventListener("resize",this.onResize.bind(this))}onSelfClick(e){e.target.tagName.toLowerCase()==="lookbook-mobile-popup"&&(LookbookMobilePopup.togglePopup(!1),document.getElementById("halo-card-mobile-popup")?.classList.remove("show"),document.body.classList.remove("quick_shop_popup_mobile"))}onResize(){LookbookMobilePopup.togglePopup(!1)}static appendItem(item){document.querySelector("[data-lookbook-popup-mobile] [data-lookbook-mobile-images-container]").appendChild(item)}static togglePopup(isOpen,indexToScroll=0){const contentWrapper=document.querySelector("[data-lookbook-popup-mobile] [data-lookbook-mobile-images-container]");if(LookbookMobilePopup.checkAndSetOverflowing(contentWrapper),document.body.classList.toggle("mobile-popup-active",isOpen),isOpen)setTimeout(()=>{document.querySelectorAll("[data-lookbook-popup-mobile] .product-item")[indexToScroll]?.scrollIntoView({behavior:"smooth",block:"start"})},400);else{const items=contentWrapper.querySelectorAll("[data-signature]");setTimeout(()=>{items.forEach(item=>{const signature=item.dataset.signature;document.querySelector(`[data-lookbook-dialog][data-signature="${signature}"]`).appendChild(item)})},350)}}static checkAndSetOverflowing(contentWrapper=null){contentWrapper&&contentWrapper.classList.toggle("center",contentWrapper.scrollWidth<=contentWrapper.clientWidth)}}class CursorFixedLookbook extends HTMLElement{constructor(){super(),this.pos={x:0,y:0},this.ratio=.65,this.isStuck=!1,this.mouse={x:-100,y:-100},this.cursorOuter=this.querySelector(".cursor--large"),this.cursorInner=this.querySelector(".cursor--small"),this.cursorOuterOriginalState={width:this.cursorOuter.getBoundingClientRect().width,height:this.cursorOuter.getBoundingClientRect().height}}connectedCallback(){window.matchMedia("(min-width: 1200px)").matches&&(this.init(),this.onEnterButton(),this.onLeaveButton(),this.onEnterDrawerOverlay(),this.onLeaveDrawerOverlay()),window.matchMedia("(min-width: 1200px)").onchange=event=>{event.matches&&(this.init(),this.onEnterButton(),this.onLeaveButton(),this.onEnterDrawerOverlay(),this.onLeaveDrawerOverlay())}}init(){document.addEventListener("pointermove",this.moveOnSite.bind(this)),document.addEventListener("pointerenter",this.moveOnSite.bind(this)),document.addEventListener("pointerleave",this.moveOutSite.bind(this)),document.addEventListener("pointerout",this.moveOutSite.bind(this)),document.addEventListener("pointermove",this.updateCursorPosition.bind(this)),document.addEventListener("pointerdown",this.pointerDown.bind(this)),document.addEventListener("pointerup",this.pointerUp.bind(this))}moveOutSite(){gsap.to(this,.15,{opacity:0})}moveOnSite(){gsap.to(this,.15,{opacity:1})}pointerDown(){this.classList.contains("on-overlay")||(gsap.to(this.cursorInner,.15,{scale:2}),gsap.to(this.cursorOuter,.15,{scale:2}))}pointerUp(){gsap.to(this.cursorInner,.15,{scale:1}),gsap.to(this.cursorOuter,.15,{scale:1}),this.classList.contains("on-overlay")&&this.classList.remove("on-overlay")}onEnterDefault(){gsap.to(this.cursorInner,.15,{opacity:0}),gsap.to(this.cursorOuter,.15,{scale:2})}onLeaveDefault(){gsap.to(this.cursorInner,.15,{opacity:1}),gsap.to(this.cursorOuter,.15,{scale:1})}onEnterButton(){document.querySelectorAll(".cartTool-item, .arrow-icon-scroll, .recently-viewed-icon").forEach(btn=>{btn.addEventListener("pointerenter",e=>{btn.parentElement.classList.contains("cursor-fixed__parallax-inner")||this.onEnterDefault()})}),document.querySelectorAll(".card-title, .media, .dropdown-label, .card-media, .card-compare").forEach(btn=>{btn.addEventListener("pointerenter",e=>{btn.parentElement.classList.contains("cursor-fixed__parallax-inner")||this.onEnterDefault()})})}onLeaveButton(){document.querySelectorAll(".cartTool-item, .arrow-icon-scroll, .recently-viewed-icon").forEach(btn=>{btn.addEventListener("pointerout",e=>{btn.parentElement.classList.contains("cursor-fixed__parallax-inner")||this.onLeaveDefault()})}),document.querySelectorAll(".card-title, .card-title, .media, .dropdown-label, .card-media, .card-compare").forEach(btn=>{btn.addEventListener("pointerout",e=>{btn.parentElement.classList.contains("cursor-fixed__parallax-inner")||this.onLeaveDefault()})})}onEnterDrawerOverlay(){document.querySelectorAll(".background-overlay").forEach(ovl=>{ovl.addEventListener("pointermove",()=>{this.classList.add("on-overlay"),gsap.to(this.cursorOuter,.15,{scale:2})})})}onLeaveDrawerOverlay(){document.querySelectorAll(".background-overlay").forEach(ovl=>{ovl.addEventListener("pointerout",()=>{this.classList.remove("on-overlay"),gsap.to(this.cursorOuter,.15,{scale:1})})})}callParallax(e,parent){this.parallaxIt(e,parent,20)}parallaxIt(e,parent,movement){const rect=parent.getBoundingClientRect();this.mouse.x=e.clientX-rect.left,this.mouse.y=e.clientY-rect.top,gsap.to(parent,.3,{x:(this.mouse.x-rect.width/2)/rect.width*movement,y:(this.mouse.y-rect.height/2)/rect.height*movement,ease:"Power2.easeOut"})}updateCursorPosition(e){this.mouse.x=e.clientX,this.mouse.y=e.clientY,this.pos.x+=(this.mouse.x-this.pos.x)*this.ratio,this.pos.y+=(this.mouse.y-this.pos.y)*this.ratio,gsap.to(this.cursorInner,{duration:.15,x:this.pos.x,y:this.pos.y,xPercent:-50,yPercent:-50}),gsap.to(this.cursorOuter,{duration:.4,x:this.pos.x,y:this.pos.y,xPercent:-50,yPercent:-50})}}var lookbookDialogRef=LookbookDialogDot;window.addEventListener("load",()=>{customElements.define("lookbook-dialog-dot",LookbookDialogDot),customElements.define("lookbook-wrapper",LookbookWrapper),customElements.define("lookbook-mobile-popup",LookbookMobilePopup),document.body.classList.contains("cursor-fixed__show")&&customElements.define("cursor-fixed-lookbook",CursorFixedLookbook)})} //# sourceMappingURL=/cdn/shop/t/5/assets/lookbook-script.js.map?v=158340134871365312081733254278