PageSourceSearch

https://swissbeauty.in/cdn/shop/t/62/assets/header-v2-BEEwuiEx.js

js swissbeauty.in collected 2026-09-28 05:51:30 UTC 94,492 bytes, 38 lines download raw bytes

vendor: 8,759 bytes, lines 1-27
1function $(){return $=Object.assign?Object.assign.bind():function(v){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(v[s]=t[s])}return v},$.apply(this,arguments)}var st={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:1/0,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onBegin:function(v){},onComplete:function(v){},preStringTyped:function(v,e){},onStringTyped:function(v,e){},onLastStringBackspaced:function(v){},onTypingPaused:function(v,e){},onTypingResumed:function(v,e){},onReset:function(v){},onStop:function(v,e){},onStart:function(v,e){},onDestroy:function(v){}},it=new((function(){function v(){}var e=v.prototype;return e.load=function(t,s,i){if(t.el=typeof i=="string"?document.querySelector(i):i,t.options=$({},st,s),t.isInput=t.el.tagName.toLowerCase()==="input",t.attr=t.options.attr,t.bindInputFocusEvents=t.options.bindInputFocusEvents,t.showCursor=!t.isInput&&t.options.showCursor,t.cursorChar=t.options.cursorChar,t.cursorBlinking=!0,t.elContent=t.attr?t.el.getAttribute(t.attr):t.el.textContent,t.contentType=t.options.contentType,t.typeSpeed=t.options.typeSpeed,t.startDelay=t.options.startDelay,t.backSpeed=t.options.backSpeed,t.smartBackspace=t.options.smartBackspace,t.backDelay=t.options.backDelay,t.fadeOut=t.options.fadeOut,t.fadeOutClass=t.options.fadeOutClass,t.fadeOutDelay=t.options.fadeOutDelay,t.isPaused=!1,t.strings=t.options.strings.map(function(l){return l.trim()}),t.stringsElement=typeof t.options.stringsElement=="string"?document.querySelector(t.options.stringsElement):t.options.stringsElement,t.stringsElement){t.strings=[],t.stringsElement.style.cssText="clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;";var r=Array.prototype.slice.apply(t.stringsElement.children),n=r.length;if(n)for(var a=0;a<n;a+=1)t.strings.push(r[a].innerHTML.trim())}for(var h in t.strPos=0,t.currentElContent=this.getCurrentElContent(t),t.currentElContent&&t.currentElContent.length>0&&(t.strPos=t.currentElContent.length-1,t.strings.unshift(t.currentElContent)),t.sequence=[],t.strings)t.sequence[h]=h;t.arrayPos=0,t.stopNum=0,t.loop=t.options.loop,t.loopCount=t.options.loopCount,t.curLoop=0,t.shuffle=t.options.shuffle,t.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},t.typingComplete=!1,t.autoInsertCss=t.options.autoInsertCss,t.autoInsertCss&&(this.appendCursorAnimationCss(t),this.appendFadeOutAnimationCss(t))},e.getCurrentElContent=function(t){return t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:t.contentType==="html"?t.el.innerHTML:t.el.textContent},e.appendCursorAnimationCss=function(t){var s="data-typed-js-cursor-css";if(t.showCursor&&!document.querySelector("["+s+"]")){var i=document.createElement("style");i.setAttribute(s,"true"),i.innerHTML=`
2        .typed-cursor{
3          opacity: 1;
4        }
5        .typed-cursor.typed-cursor--blink{
6          animation: typedjsBlink 0.7s infinite;
7          -webkit-animation: typedjsBlink 0.7s infinite;
8                  animation: typedjsBlink 0.7s infinite;
9        }
10        @keyframes typedjsBlink{
11          50% { opacity: 0.0; }
12        }
13        @-webkit-keyframes typedjsBlink{
14          0% { opacity: 1; }
15          50% { opacity: 0.0; }
16          100% { opacity: 1; }
17        }
18      `,document.body.appendChild(i)}},e.appendFadeOutAnimationCss=function(t){var s="data-typed-fadeout-js-css";if(t.fadeOut&&!document.querySelector("["+s+"]")){var i=document.createElement("style");i.setAttribute(s,"true"),i.innerHTML=`
19        .typed-fade-out{
20          opacity: 0;
21          transition: opacity .25s;
22        }
23        .typed-cursor.typed-cursor--blink.typed-fade-out{
24          -webkit-animation: 0;
25          animation: 0;
26        }
27      `,document.body.appendChild(i)}},v})()),tt=new((function(){function v(){}var e=v.prototype;return e.typeHtmlChars=function(t,s,i){if(i.contentType!=="html")return s;var r=t.substring(s).charAt(0);if(r==="<"||r==="&"){var n;for(n=r==="<"?">":";";t.substring(s+1).charAt(0)!==n&&!(1+ ++s>t.length););s++}return s},e.backSpaceHtmlChars=function(t,s,i){if(i.contentType!=="html")return s;var r=t.substring(s).charAt(0);if(r===">"||r===";"){var n;for(n=r===">"?"<":"&";t.substring(s-1).charAt(0)!==n&&!(--s<0););s--}return s},v})()),rt=(function(){function v(t,s){it.load(this,s,t),this.begin()}var e=v.prototype;return e.toggle=function(){this.pause.status?this.start():this.stop()},e.stop=function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))},e.start=function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))},e.destroy=function(){this.reset(!1),this.options.onDestroy(this)},e.reset=function(t){t===void 0&&(t=!0),clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())},e.begin=function(){var t=this;this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.strPos===0?t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos):t.backspace(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)},e.typewrite=function(t,s){var i=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var r=this.humanizer(this.typeSpeed),n=1;this.pause.status!==!0?this.timeout=setTimeout(function(){s=tt.typeHtmlChars(t,s,i);var a=0,h=t.substring(s);if(h.charAt(0)==="^"&&/^\^\d+/.test(h)){var l=1;l+=(h=/\d+/.exec(h)[0]).length,a=parseInt(h),i.temporaryPause=!0,i.options.onTypingPaused(i.arrayPos,i),t=t.substring(0,s)+t.substring(s+l),i.toggleBlinking(!0)}if(h.charAt(0)==="`"){for(;t.substring(s+n).charAt(0)!=="`"&&(n++,!(s+n>t.length)););var g=t.substring(0,s),w=t.substring(g.length+1,s+n),u=t.substring(s+n+1);t=g+w+u,n--}i.timeout=setTimeout(function(){i.toggleBlinking(!1),s>=t.length?i.doneTyping(t,s):i.keepTyping(t,s,n),i.temporaryPause&&(i.temporaryPause=!1,i.options.onTypingResumed(i.arrayPos,i))},a)},r):this.setPauseStatus(t,s,!0)},e.keepTyping=function(t,s,i){s===0&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));var r=t.substring(0,s+=i);this.replaceText(r),this.typewrite(t,s)},e.doneTyping=function(t,s){var i=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){i.backspace(t,s)},this.backDelay))},e.backspace=function(t,s){var i=this;if(this.pause.status!==!0){if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var r=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){s=tt.backSpaceHtmlChars(t,s,i);var n=t.substring(0,s);if(i.replaceText(n),i.smartBackspace){var a=i.strings[i.arrayPos+1];i.stopNum=a&&n===a.substring(0,s)?s:0}s>i.stopNum?(s--,i.backspace(t,s)):s<=i.stopNum&&(i.arrayPos++,i.arrayPos===i.strings.length?(i.arrayPos=0,i.options.onLastStringBackspaced(),i.shuffleStringsIfNeeded(),i.begin()):i.typewrite(i.strings[i.sequence[i.arrayPos]],s))},r)}else this.setPauseStatus(t,s,!1)},e.complete=function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0},e.setPauseStatus=function(t,s,i){this.pause.typewrite=i,this.pause.curString=t,this.pause.curStrPos=s},e.toggleBlinking=function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))},e.humanizer=function(t){return Math.round(Math.random()*t/2)+t},e.shuffleStringsIfNeeded=function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))},e.initFadeOut=function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>
27t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)},e.replaceText=function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:this.contentType==="html"?this.el.innerHTML=t:this.el.textContent=t},e.bindFocusEvents=function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(s){t.stop()}),this.el.addEventListener("blur",function(s){t.el.value&&t.el.value.length!==0||t.start()}))},e.insertCursor=function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))},v})();class at extends HTMLElement{constructor(){var e,t,s;super(),this.sticky=this.dataset.sticky=="true",this.navDisplayBtns=this.querySelectorAll('[data-role="nav-display"]'),this.navHideBtns=this.querySelectorAll('[data-role="nav-hide"]'),this.mobileNavigation=this.querySelector('[data-role="mobile-nav"]'),this.headerOverlay=this.querySelector('[data-role="header-overlay"]'),this.headerMainWrapper=this.closest("#shopify-section-header-v2"),this.headerTopBar=this.querySelector('[data-role="header-top-bar"]'),this.mobileWrapper=document.querySelector('[data-role="custom-mobile-nav"]'),this.announcementBar=document.querySelector("#shopify-section-announcement-bar-v2"),this.mobileSearchWrapper=this.querySelector('[data-role="mobile-search-wrapper"]'),this.lastScroll=0,this.currentDisplay=!0,this.cartOpenBtns=this.querySelectorAll('[data-role="cart-open"]'),this.cartCountEls=this.querySelectorAll('[data-role="cart-count"]'),this.headerWalletIcon=this.querySelector('[data-role="header-cashback-icon"]'),this.cashbackLoginIcon=this.querySelector('[data-role="header-cashback-login"]'),this.mobileLinks=Array.from(((e=this.mobileNavigation)==null?void 0:e.querySelectorAll("a"))||[]),this.desktopLinks=Array.from(this.querySelectorAll('[data-role="parent-nav"]')),this.parentNavs=Array.from(document.querySelectorAll('[data-role="parent-nav"]')),this._searchOverlayOpen=!1,this.cartOpenBtns.forEach(i=>{i.addEventListener("click",r=>{var n,a;r.stopPropagation(),document.dispatchEvent(new Event("cart:open")),dataLayer.push({event:custom_data_events.mini_cart.events.header_view_cart}),dataLayer.push({event:custom_data_events.mini_cart_v2.events[0].name,cart_items:JSON.parse(((n=document.querySelector('mini-cart script[data-id="cart-items-data"]'))==null?void 0:n.innerHTML)||"[]"),summary:JSON.parse(((a=document.querySelector('mini-cart script[data-id="cart-summar-data"]'))==null?void 0:a.innerHTML)||"{}")})})}),this.parentNavs.forEach(i=>{i.addEventListener("mouseenter",this.displayMegaDrop.bind(this,i,!0)),i.addEventListener("mouseleave",this.displayMegaDrop.bind(this,i,!1))}),["custom:updateCart","cart:updated","ajaxProduct:added"].forEach(i=>{document.addEventListener(i,r=>{const n=r.detail.cart.item_count;this.cartCountEls.forEach(a=>{a.innerHTML=n,a.style.opacity=n>0?"1":"0"})})}),this.navDisplayBtns.forEach(i=>{i.addEventListener("click",()=>{var r,n;(r=this.mobileWrapper)==null||r.classList.remove("sw-hidden"),(n=this.mobileWrapper)==null||n.classList.add("!sw-left-0"),dataLayer.push({event:window.custom_data_events.header.events[1].name,page_handle:window.location.pathname}),this.displayMobileNavigation.call(this)})}),this.navHideBtns.forEach(i=>i.addEventListener("click",this.hideMobileNavigation.bind(this))),console.log(this.mobileLinks,"here --->"),[...this.mobileLinks,...this.desktopLinks].forEach(i=>i.addEventListener("click",this.handleLinkClick.bind(this))),(t=this.cashbackLoginIcon)==null||t.addEventListener("click",()=>{window.handleKpAndShopifyLogin("/account")}),(s=this.headerWalletIcon)!=null&&s.querySelector('[data-role="header-cashback-amount"]')&&this.getWalletData(),this.animation=null,this.closing=!1,this.isExpanding=!1,window.innerWidth<768&&(window.addEventListener("scroll",this.handleDocumentScroll.bind(this),{passive:!0}),this.headerMainWrapper.style.top=this.announcementBar.offsetHeight+"px"),document.addEventListener("search:open",()=>{var i;this._searchOverlayOpen=!0,window.innerWidth<768&&((i=this.hideHeaderTopBar)==null||i.call(this))}),document.addEventListener("search:close",i=>{var n,a;this._searchOverlayOpen=!1;
27const r=!!((n=i?.detail)!=null&&n.keepHidden);window.innerWidth<768&&(r?(a=this.hideHeaderTopBar)==null||a.call(this):this.forceShowHeaderTopBar())})}connectedCallback(){var e,t,s,i,r,n;new theme.CartDrawer,this.mobileNavigationClone=(e=this.mobileNavigation)==null?void 0:e.cloneNode(!0),(t=this.mobileNavigation)==null||t.remove(),this.mobileNavigation=this.mobileNavigationClone,(s=this.headerMainWrapper)==null||s.insertAdjacentElement("afterend",this.mobileNavigation),(r=(i=this.mobileNavigation)==null?void 0:i.querySelector('[data-role="nav-hide"]'))==null||r.addEventListener("click",this.hideMobileNavigation.bind(this)),Array.from((n=this.mobileNavigation)==null?void 0:n.querySelectorAll("a")).forEach(a=>a.addEventListener("click",this.handleLinkClick.bind(this)))}displayMegaDrop(e,t){const s=e.querySelector('[data-role="mega-drop"]');s&&(t?this.displayDesktopDrop(s):this.hideDesktopDrop(s))}forceShowHeaderTopBar(){var e,t;this.headerTopBarAnimation&&this.headerTopBarAnimation.cancel(),this.announcementBarAnimation&&this.announcementBarAnimation.cancel(),this.currentDisplay=!0,this.headerMainWrapper&&(this.headerMainWrapper.style.transform="translateY(0px)"),this.announcementBar&&(this.announcementBar.style.transform="translateY(0px)"),(e=this.mobileSearchWrapper)==null||e.classList.remove("is-hidden"),(t=this.mobileSearchWrapper)==null||t.classList.add("is-visible")}displayDesktopDrop(e){e.style.display="block",e.animate({opacity:[0,1]},{duration:400,easing:"ease-out"})}hideDesktopDrop(e){const t=e.animate({opacity:[1,0]},{duration:400,easing:"ease-out"});t.onfinish=()=>e.style.display=""}displayMobileNavigation(){var e,t;(e=this.headerOverlay)==null||e.classList.add("active"),(t=this.mobileNavigation)==null||t.classList.add("active"),document.body.style.overflow="hidden",this.expand()}hideMobileNavigation(){var e,t;(e=this.headerOverlay)==null||e.classList.remove("active"),(t=this.mobileWrapper)==null||t.classList.remove("!sw-left-0"),document.body.style.overflow="",this.shrink()}expand(){var s,i;(s=this.mobileNavigation)==null||s.classList.add("updating"),this.isExpanding=!0,this.mobileNavigation.style.overflow="hidden";const e="0px",t=`${this.mobileNavigation.offsetWidth}px`;this.animation&&this.animation.cancel(),this.animation=(i=this.mobileNavigation)==null?void 0:i.animate({width:[e,t]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.onAnimationFinish(),this.animation.oncancel=()=>this.onAnimationFinish()}shrink(){var s,i;(s=this.mobileNavigation)==null||s.classList.add("updating"),this.closing=!0,this.mobileNavigation.style.overflow="hidden";const e=`${this.mobileNavigation.offsetWidth}px`,t="0px";this.animation&&this.animation.cancel(),this.animation=(i=this.mobileNavigation)==null?void 0:i.animate({width:[e,t]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.onAnimationFinish(!0)}onAnimationFinish(e=!1){var t,s;e&&((t=this.mobileNavigation)==null||t.classList.remove("active")),this.animation=null,this.closing=!1,this.isExpanding=!1,this.mobileNavigation.style.width="",this.mobileNavigation.style.overflow="",(s=this.mobileNavigation)==null||s.classList.remove("updating")}handleLinkClick(e){const t=e.currentTarget||e.target.closest("a");if(!t)return;const s=t.getAttribute("href")||"";if(!s)return;const i=/^https?:\/\//i.test(s),r=(t.getAttribute("target")||"").toLowerCase()==="_blank",n=t.closest("toggle-expand")?2:1,a=this.mobileLinks.findIndex(h=>h.getAttribute("href")==s);dataLayer.push({event:window.custom_data_events.header_navigation.events.clicked,link:s,position:a,level:n});try{sessionStorage.removeItem("sw_reopen_mobile_nav"),sessionStorage.removeItem("sw_reopen_mobile_nav_ts")}catch{}if(i||r){e.preventDefault(),window.open(s,"_blank","noopener");return}e.preventDefault(),window.location.href=s}async getCurrentCartData(){try{let e=sessionStorage.getItem("CARTID");return e||(e=(await fetch("/cart.js").then(s=>s.json())).token,sessionStorage.setItem("CARTID",e)),{cart:{id:e}}}catch(e){console.log("Failed to get cart",e)}}async getGASessionId(){return new Promise(e=>{gtag("get","G-N71XHS094H","session_id",t=>e(t)),setTimeout(()=>{e(null)},3e3)})}async getWalletData(){var e,t,s,i;try{(e=this.headerWalletIcon)==null||e.classList.add("activating");let r=null;try{r=await this.getGASessionId()}catch(h){console.log("Failed to get ga session id",h.message)}const a=await(await fetch("/apps/cashback-v2/widget/balance",{headers:new Headers({"x-gasession-id":r})})).json();if(!a.ok)throw new Error("Blance fetch failed");this.headerWalletIcon.querySelector('[data-role="header-cashback-amount"]').innerHTML=this.moneyFormatter(a.balance),a.balance==0?(t=this.headerWalletIcon)==null||t.closest('[data-role="header-cashback-wrapper"]').classList.remove("customer"):(s=this.headerWalletIcon)==null||s.closest('[data-role="header-cashback-wrapper"]').classList.add("customer"),eventHandler("cashback_balance_loaded",{balance:a.balance})}catch(r){console.warn("Wallet fetch error",r)}finally{(i=this.headerWalletIcon)==null||i.classList.remove("activating")}}async eventHandler(e,t){try{let s=await this.getGASessionId.call(this);const n=await(await fetch("/apps/latest-proxy/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({eventName:e,session_id:s,params:t})})).json()}catch(s){console.log("Failed to add event reason -->"+s.message)}}moneyFormatter(e){return new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR"}).format(e)}hideHeaderTopBar(){var s;if(!this.currentDisplay)return;this.currentDisplay=!1,this.headerTopBarAnimation&&this.headerTopBarAnimation.cancel();let e=this.headerTopBar.offsetHeight+this.announcementBar.offsetHeight-12;this.headerTopBarAnimation=this.headerMainWrapper.animate({transform:["translateY(0px)",`translateY(-${e}px)`]},{duration:150,easing:"ease-in",fill:"forwards"}),this.announcementBarAnimation&&this.announcementBarAnimation.cancel();let t=this.announcementBar.offsetHeight;this.announcementBarAnimation=(s=this.announcementBar)==null?void 0:s.animate({transform:["translateY(0px)",`translateY(-${t}px)`]},{easing:"ease-in",duration:150,fill:"forwards"}),this.announcementBarAnimation.onfinish=()=>
27{this.mobileSearchWrapper.classList.add("is-hidden"),this.mobileSearchWrapper.classList.remove("is-visible")}}displayHeaderTopBar(){var s;if(window.scrollY===0&&document.documentElement.scrollTop===0||this.currentDisplay)return;this.currentDisplay=!0,this.headerTopBarAnimation&&this.headerTopBarAnimation.cancel();let e=this.headerTopBar.offsetHeight+this.announcementBar.offsetHeight-12;console.log("here is the translateVal",e),this.headerTopBarAnimation=this.headerMainWrapper.animate({transform:[`translateY(-${e}px)`,"translateY(0px)"]},{duration:150,easing:"ease-in",fill:"forwards"}),this.announcementBarAnimation&&this.announcementBarAnimation.cancel();let t=this.announcementBar.offsetHeight;this.announcementBarAnimation=(s=this.announcementBar)==null?void 0:s.animate({transform:[`translateY(-${t}px)`,"translateY(0px)"]},{easing:"ease-in",duration:150,fill:"forwards"}),this.announcementBarAnimation.onfinish=()=>{this.mobileSearchWrapper.classList.remove("is-hidden"),this.mobileSearchWrapper.classList.add("is-visible")}}handleDocumentScroll(){var i,r;if(document.body.classList.contains("search-open")||this._searchOverlayOpen)return;const e=50,t=window.pageYOffset,s=t-this.lastScroll;Math.abs(s)>e&&(s>0?(console.log("need to hide the header"),this.hideHeaderTopBar.call(this),this.mobileWrapperAnimation&&this.mobileWrapperAnimation.cancel(),this.mobileWrapperAnimation=(i=this.mobileWrapper)==null?void 0:i.animate({marginTop:["0px","-52px"]},{duration:150,easing:"ease-in",fill:"forwards"})):(console.log("need to display the header"),this.displayHeaderTopBar.call(this),this.mobileWrapperAnimation&&this.mobileWrapperAnimation.cancel(),this.mobileWrapperAnimation=(r=this.mobileWrapper)==null?void 0:r.animate({marginTop:["0px","-52px"]},{duration:150,easing:"ease-out",fill:"forwards"})),this.lastScroll=t)}}customElements.define("sticky-header",at);class nt extends HTMLElement{constructor(){var e;super(),this.triggerButton=this.querySelector('[data-role="trigger"]'),this.content=this.querySelector('[data-role="content"]'),this.animation=null,this.isExpanding=!1,this.isClosing=!1,(e=this.triggerButton)==null||e.addEventListener("click",()=>{this.classList.contains("active")?this.shrink.call(this):this.expand.call(this)})}expand(){this.content.style.maxHeight="10000px",this.classList.add("active"),this.isExpanding=!0;const e="0px",t=`${this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.content.animate({height:[e,t]},{duration:400,easing:"ease-out"})}shrink(){this.classList.remove("active"),this.isClosing=!0;const e=`${this.content.offsetHeight}px`,t="0px";this.animation&&this.animation.cancel(),this.animation=this.content.animate({height:[e,t]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.content.style.maxHeight=""}}customElements.define("toggle-expand",nt);class N{constructor({storageKey:e="sw_search_history",max:t=12,root:s,onClear:i,onRemove:r}){this.storageKey=e,this.max=t,this.root=s,this.wrap=null,this.listEl=null,this.toggleBtn=null,this.collapseEl=null,this.chevron=null,this.clearBtn=null,this._isCollapsed=!0,this._ignoreNextOuterScrollCollapse=!1,this._t=null,this.onClear=i,this.onRemove=r}bind(){var t;if(!this.root||(this.wrap=this.root.querySelector('[data-role="predictive_search_history_wrap"]'),this.listEl=this.root.querySelector('[data-role="history-list"]'),this.toggleBtn=this.root.querySelector('[data-role="history-toggle"]'),this.collapseEl=this.root.querySelector('[data-role="history-collapse"]'),this.chevron=this.root.querySelector('[data-role="history-chevron"]'),this.clearBtn=this.root.querySelector('[data-role="history-clear"]'),!this.wrap||!this.listEl||!this.toggleBtn||!this.collapseEl)||this.wrap.dataset.bound==="1")return;this.wrap.dataset.bound="1",this.toggleBtn.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),this.setCollapsed(!this._isCollapsed)}),(t=this.clearBtn)==null||t.addEventListener("click",s=>{var i;s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),this.clear(),this.render(),(i=this.onClear)==null||i.call(this)}
27),this.listEl.addEventListener("click",s=>{var n;const i=s.target.closest('[data-role="history-remove"]');if(i){s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation();const a=i.dataset.value||"";this.remove(a),this.render(),(n=this.onRemove)==null||n.call(this,a);return}const r=s.target.closest('[data-role="history-item"]');if(r){s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation();const a=r.dataset.value||r.textContent||"",h=String(a).trim();if(!h)return;this.root.dispatchEvent(new CustomEvent("sw:history:select",{bubbles:!0,detail:{term:h}}))}});const e=()=>{this._ignoreNextOuterScrollCollapse=!0,clearTimeout(this._t),this._t=setTimeout(()=>{this._ignoreNextOuterScrollCollapse=!1},250)};this.listEl.addEventListener("scroll",e,{passive:!0}),this.listEl.addEventListener("wheel",e,{passive:!0}),this.listEl.addEventListener("touchmove",e,{passive:!0})}getAll(){try{const e=JSON.parse(localStorage.getItem(this.storageKey)||"[]");return Array.isArray(e)?e:[]}catch{return[]}}setAll(e){localStorage.setItem(this.storageKey,JSON.stringify(e||[]))}add(e){const t=(e||"").trim();if(!t)return;let s=this.getAll();s=s.filter(i=>String(i).toLowerCase()!==t.toLowerCase()),s.unshift(t),s.length>this.max&&(s=s.slice(0,this.max)),this.setAll(s)}remove(e){const t=(e||"").trim().toLowerCase();if(!t)return;const s=this.getAll().filter(i=>String(i).toLowerCase()!==t);this.setAll(s)}clear(){this.setAll([])}setCollapsed(e){var t,s;this._isCollapsed=!!e,(t=this.collapseEl)==null||t.classList.toggle("is-collapsed",this._isCollapsed),(s=this.chevron)==null||s.classList.toggle("is-rotated",!this._isCollapsed)}collapseOnOuterScroll(){this._ignoreNextOuterScrollCollapse||this.wrap&&this.wrap.dataset.forceHidden!=="1"&&this.getAll().length&&(this._isCollapsed||this.setCollapsed(!0))}hide(e=!0){if(!this.wrap)return;const t=this.root.querySelector('[data-role="history-shell"]')||this.wrap;this.wrap.dataset.forceHidden=e?"1":"0",this.wrap.classList.add("sw-hidden"),t?.classList.add("sw-hidden")}show(){if(!this.wrap)return;const e=this.getAll(),t=this.root.querySelector('[data-role="history-shell"]')||this.wrap,s=e.length===0;this.wrap.dataset.forceHidden="0",this.wrap.classList.toggle("sw-hidden",s),t?.classList.toggle("sw-hidden",s),s||this.setCollapsed(!1)}render(){if(!this.listEl||!this.wrap)return;const e=this.getAll(),t=this.root.querySelector('[data-role="history-shell"]')||this.wrap,i=this.wrap.dataset.forceHidden==="1"||e.length===0;this.wrap.classList.toggle("sw-hidden",i),t?.classList.toggle("sw-hidden",i),this.listEl.innerHTML=e.map(r=>`
28        <li class="sw-flex sw-border-b sw-border-[#D9D9D9] sw-gap-3 sw-py-2 xl:sw-py-2 sw-m-0 sw-items-center" data-role="searchresult-item">
29          <span class="sw-flex sw-items-center">
30            <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
31              <path d="M11.05 2.49998C6.80833 2.38331 3.33333 5.79165 3.33333 9.99998H1.84167C1.46667 9.99998 1.28333 10.45 1.55 10.7083L3.875 13.0416C4.04167 13.2083 4.3 13.2083 4.46667 13.0416L6.79167 10.7083C7.05 10.45 6.86667 9.99998 6.49167 9.99998H5C5 6.74998 7.65 4.12498 10.9167 4.16665C14.0167 4.20831 16.625 6.81665 16.6667 9.91665C16.7083 13.175 14.0833 15.8333 10.8333 15.8333C9.49167 15.8333 8.25 15.375 7.26667 14.6C6.93333 14.3416 6.46667 14.3666 6.16667 14.6666C5.81667 15.0166 5.84167 15.6083 6.23333 15.9083C7.5 16.9083 9.09167 17.5 10.8333 17.5C15.0417 17.5 18.45 14.025 18.3333 9.78331C18.225 5.87498 14.9583 2.60831 11.05 2.49998ZM10.625 6.66665C10.2833 6.66665 10 6.94998 10 7.29165V10.3583C10 10.65 10.1583 10.925 10.4083 11.075L13.0083 12.6166C13.3083 12.7916 13.6917 12.6916 13.8667 12.4C14.0417 12.1 13.9417 11.7166 13.65 11.5416L11.25 10.1166V7.28331C11.25 6.94998 10.9667 6.66665 10.625 6.66665Z" fill="black"/>
32            </svg>
33          </span>
34          <button type="button" class="sw-flex-1 sw-text-left sw-text-[16px] sw-font-normal sw-font-primary" data-role="history-item" data-value="${this._escapeAttr(r)}">${this._escapeHtml(r)}</button>
35          <button type="button" class="sw-ml-auto sw-text-[#777]" data-role="history-remove" data-value="${this._escapeAttr(r)}" aria-label="Remove">\u2715</button>
36        </li>
37      `).join("")}_escapeHtml(e){return String(e).replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}_escapeAttr(e){return this._escapeHtml(e).replace(/"/g,"&quot;")}}
37class ot{constructor({container:e,grid:t,loader:s,sentinel:i,countEl:r,termEl:n,headerEl:a,sectionId:h="search-results-popup",perPage:l=24,onResultMeta:g}={}){this.container=e,this.grid=t,this.loader=s,this.sentinel=i,this.countEl=r,this.termEl=n,this.headerEl=a,this.sectionId=h,this.perPage=l,this.term="",this.total=0,this.nextUrl="",this.loading=!1,this.abort=null,this.onResultMeta=g,this._pageCache=new Map,this._prefetchAbort=null,this._reqId=0,this.keepLoaderVisible=!1,this.keepHeaderVisibleDuringLoading=!1,this.suppressAutoLoadNextOnce=!1,this._scrollHandler=this._onContainerScroll.bind(this),this._scrollBoundEl=null,this._bindScroll()}_bindScroll(){const e=this.container||window;this._scrollBoundEl!==e&&(this._scrollBoundEl&&(this._scrollBoundEl.removeEventListener("scroll",this._scrollHandler),this._scrollBoundEl.removeEventListener("wheel",this._scrollHandler),this._scrollBoundEl.removeEventListener("touchmove",this._scrollHandler)),this._scrollBoundEl=e,e.addEventListener("scroll",this._scrollHandler,{passive:!0}),e.addEventListener("wheel",this._scrollHandler,{passive:!0}),e.addEventListener("touchmove",this._scrollHandler,{passive:!0}))}_onContainerScroll(){if(this.loading||!this.nextUrl)return;const e=this.container;e&&e.scrollHeight-(e.scrollTop+e.clientHeight)<=800&&this.loadNext()}showHeader(){var e;(e=this.headerEl)==null||e.classList.remove("sw-hidden")}hideHeader(){var e;(e=this.headerEl)==null||e.classList.add("sw-hidden")}syncEndState(){if(!this.sentinel)return;const e=!this.loading&&!this.nextUrl&&this.total>0;this.sentinel.classList.toggle("sw-hidden",!e)}resetUI(){this.term="",this.total=0,this.nextUrl="",this.loading=!1,this.sentinel&&(this.sentinel.dataset.nextUrl="",this.sentinel.classList.add("sw-hidden")),this.grid&&(this.grid.innerHTML=""),this.hideLoader(),this.keepHeaderVisibleDuringLoading||this.hideHeader(),this.countEl&&(this.countEl.textContent=""),this.termEl&&(this.termEl.textContent="")}clearForLoading(e=""){this.total=0,this.nextUrl="",this.loading=!0,this.grid&&(this.grid.innerHTML=""),this.countEl&&(this.countEl.textContent=""),this.termEl&&(this.termEl.textContent=e?`\u201C${e}\u201D`:""),this.sentinel&&(this.sentinel.dataset.nextUrl="",this.sentinel.classList.add("sw-hidden")),this.hideHeader(),this.showLoader()}showLoader(){var e;(e=this.loader)==null||e.classList.remove("sw-hidden")}hideLoader(){var e;(e=this.loader)==null||e.classList.add("sw-hidden")}normalizeSearchUrl(e){var n,a;const t=((a=(n=window.Shopify)==null?void 0:n.routes)==null?void 0:a.root)||"/",s=new URL(e,window.location.origin);s.searchParams.set("section_id",this.sectionId),s.searchParams.set("limit",String(this.perPage)),s.searchParams.set("type","product"),s.searchParams.set("options[prefix]","last");const i=new URL(window.location.href);return["_fd","pb","preview_theme_id","shop","host"].forEach(h=>{i.searchParams.has(h)&&s.searchParams.set(h,i.searchParams.get(h))}),(s.pathname.startsWith(t)?s.pathname:t.replace(/\/$/,"")+s.pathname)+"?"+s.searchParams.toString()}buildFirstUrl(e){const t=String(e||"").trim(),s=new URLSearchParams;s.set("q",t),s.set("term",t),s.set("type","product"),s.set("options[prefix]","last"),this.baseQuery=s.toString(),this.loadedPage=1;const i=this.normalizeSearchUrl(`/search?${this.baseQuery}`);return console.log("========== FULL SEARCH =========="),console.log("Search term :",t),console.log("Search U
37RL  :",i),console.log("================================="),i}_prefetch(e){var s,i;if(!e)return;const t=this.normalizeSearchUrl(e);if(!this._pageCache.has(t)){if(this._pageCache.size>10){const r=this._pageCache.keys().next().value;this._pageCache.delete(r)}try{(i=(s=this._prefetchAbort)==null?void 0:s.abort)==null||i.call(s)}catch{}this._prefetchAbort=new AbortController,fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest"},signal:this._prefetchAbort.signal}).then(r=>{if(!r.ok)throw new Error(`Prefetch failed ${r.status}`);return r.text()}).then(r=>this._pageCache.set(t,r)).catch(()=>{})}}async setQuery(e){var r,n,a,h;const t=(e||"").trim();if(!t)return this.resetUI();if(!this.grid)return;this._reqId+=1;const s=this._reqId;try{(n=(r=this.abort)==null?void 0:r.abort)==null||n.call(r)}catch{}this.abort=new AbortController,this.term=t,this.total=0,this.nextUrl="",this.loading=!0,this.showLoader(),this.grid&&(this.grid.innerHTML=""),this.countEl&&(this.countEl.textContent=""),this.termEl&&(this.termEl.textContent=`\u201C${t}\u201D`),this.hideHeader(),this.sentinel&&(this.sentinel.dataset.nextUrl="",this.sentinel.classList.add("sw-hidden"));const i=(a=document.querySelector('[data-id="search-container"]'))==null?void 0:a.querySelector('[data-role="empty-result"]');i&&(i.classList.add("sw-force-hide"),i.style.display="none",i.setAttribute("aria-hidden","true")),this.hideHeader(),this.syncEndState(),this.countEl&&(this.countEl.textContent=""),this.termEl&&(this.termEl.textContent=`\u201C${t}\u201D`);try{await this.fetchAndRender(this.buildFirstUrl(t),{replace:!0,rid:s})}catch(l){if(l?.name==="AbortError")return;s===this._reqId&&(console.warn(l),this.total=-1,this.nextUrl="",this.sentinel&&(this.sentinel.dataset.nextUrl="",this.sentinel.classList.add("sw-hidden")),this.countEl&&(this.countEl.textContent=""),this.grid&&(this.grid.innerHTML=""),this.hideHeader())}finally{s===this._reqId&&(this.loading=!1,this.keepLoaderVisible||this.hideLoader(),!(((h=this.grid)==null?void 0:h.querySelectorAll("product-card").length)>0)&&this.total<=0&&this.hideHeader(),this.syncEndState(),this.total>0?this.showHeader():this.hideHeader(),this.suppressAutoLoadNextOnce?this.suppressAutoLoadNextOnce=!1:requestAnimationFrame(()=>{this._onContainerScroll()}))}}async loadNext(){if(this.loading||!this.nextUrl)return;this.loading=!0,this.showLoader(),this.syncEndState();const e=this._reqId;try{await this.fetchAndRender(this.nextUrl,{replace:!1,rid:e})}finally{e===this._reqId&&(this.loading=!1,this.hideLoader(),this.syncEndState(),requestAnimationFrame(()=>{this._onContainerScroll()}))}}async fetchAndRender(e,{replace:t,rid:s}){var d,p;const i=this.normalizeSearchUrl(e);let r=this._pageCache.get(i);if(r)this._pageCache.delete(i);else{const y=await fetch(i,{method:"GET",credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/html"},signal:(d=this.abort)==null?void 0:d.signal});if(!y.ok)throw new Error(`[Search] Search section fetch failed: ${y.status} ${i}`);r=await y.text()}if(s!==this._reqId)return;const n=new DOMParser().parseFromString(r,"text/html"),a=n.querySelector('[data-role="full-search-root"]'),h=n.querySelector('[data-role="full-grid"]'),l=n.querySelector('[data-role="infinite-sentinel"]');if(!a||!h||!l){console.warn("[Search] results section parse failed",{finalUrl:i,hasRoot:!!a,hasGrid:!!h,hasSentinel:!!l,htmlPreview:r.slice(0,500)}),this.total=-1,this.nextUrl="",this.sentinel&&(this.sentinel.dataset.nextUrl=""),this.syncEndState();return}const g=Number(a.dataset.total||0),w=this.term,u=h.innerHTML||"",m=h.querySelectorAll("product-card").length;if(t&&m<=0){this.total=0,this.nextUrl="",this.countEl&&(this.countEl.textContent="0"),this.sentinel&&(this.sentinel.dataset.nextUrl="",this.sentinel.classList.add("sw-hidden")),this.syncEndState();return}const f=l.dataset.nextUrl||"",c=!!f.trim();let o="";if(c&&this.baseQuery){const y=(t?1:this.loadedPage)+1;o=this.normalizeSearchUrl(`/search?${this.baseQuery}&type=product&page=${y}`),this.loadedPage=y}else c&&(o=this.normalizeSearchUrl(f));t?(this.grid.innerHTML=u,this.container&&(this.container.scrollTop=0)):this.grid.insertAdjacentHTML("beforeend",u),t&&(this.total=g,this.countEl&&(this.countEl.textContent=String(this.total)),this.termEl&&(this.termEl.textContent=`\u201C${w}\u201D`),(p=this.onResultMeta)==null||p.call(this,{term:w||this.term,total:Number(g||0),hasResults:Number(g||0)>0})),this.nextUrl=o,this.sentinel&&(this.sentinel.dataset.nextUrl=o||""),this.syncEndState(),this.nextUrl&&this._prefetch(this.nextUrl)}}class ct extends HTMLElement{constructor(){var t,s,i,r,n,a,h,l,g,w,u,m,f;super(),this.searchInput=this.querySelector('[data-role="search-input"]'),this.searchSection=document.querySelector("template#predective-search"),this.searchCloseBtn=this.querySelectorAll('[data-role="search-close"]'),this.searchClearBtn=this.querySelectorAll('[data-role="search-clear"]'),this.searchBtn=this.querySelector('[data-role="search"]'),this.searchSectionId=(s=(t=this.searchSection)==null?void 0:t.dataset)==null?void 0:s.id,this.searchIcon=this.querySelector('[data-role="search-icon"]'),this.searchContainer=document.querySelector('[data-id="search-container"]'),this._scrollY=0,this._isSearchOpen=!1,this._searchEventDispatched=!1,this._predictReqId=0,this.display=!1,this.showing=!1,this.hiding=!1,this.animation=null,this._predictAbort=null,this._predictCache=new Map,this._committedTerm=null,this._suppressPredictiveOnce=!1,this._minPredictChars=2,this._fullResultsReqId=0,this._predictLoading=!1,this._allowEmptyState=!1,this._outerLastScrollTop=0,this._outerLastWindowScrollY=window.scrollY||window.pageYOffset||0,this._touchStartX=0,this._touchStartY=0,this._isCommittedSearchRunning=!1,this._searchRunId=0,this._activeResultToken=0,this._activeResultTerm="",this._activeResultPromise=null,this._lastPredictiveKeywords=[],this.debounceOnChange=this.debounce(()=>{this._isCommittedSearchRunning||this.handleInput.call(this)},250),this._pendingSearchKeyword="",this._committedSearchKeyword="",this._lastTrackedKeyword="",this._lastTrackedKeywordWithResults="",this._lastTrendingClicked="",document.addEventListener("click",c=>{var o,d;if(c.target.classList.contains("add-to-cart")||c.target.closest(".add-to-cart")){const p=c.target.classList.contains("add-to-cart")?c.target:c.target.closest(".add-to-cart");p.closest('[data-id="search-container"]')&&((d=(o=p.closest('form[action="/cart/add"]'))==null?void 0:o.querySelector('input[name="id"]'))==null||d.value)}}),(i=this.searchInput)==null||i.addEventListener("focus",()=>{this.ensureSearchMarkup(),this.openSearch(),this.syncHistoryState(),this._hidePredictiveWrapper(),this._hideEmptyState(),this._setInputCaretHidden(!1),dataLayer.push({event:window.custom_data_events["search-v2"].events[0].name,page_handle:window.location.pathname})}),(r=this.searchIcon)==null||r.addEventListener("focus",()=>{this.ensureSearchMarkup(),this.openSearch(),this.syncHistoryState(),this._hidePredictiveWrapper(),this._hideEmptyState(),this._setInputCaretHidden(!1),dataLayer.push({event:window.custom_data_events["search-v2"].events[0].name,page_handle:window.location.pathname})}),(n=this.searchInput)==null||n.addEventListener("click",()=>{this.ensureSearchMarkup(),this.openSearch(),requestAnimationFrame(()=>{var c;(c=this.searchInput)==null||c.focus(),this.syncHistoryState(),this._hideEmptyState(),this._setInputCaretHidden(!1)})}),(a=this.searchIcon)==null||a.addEventListener("click",()=>{this.ensureSearchMarkup(),this.openSearch(),requestAnimationFrame(()=>{var c;(c=this.searchInput)==null||c.focus(),this.syncHistoryState(),this._hideEmptyState(),this._setInputCaretHidden(!1)})}),document.addEventListener("click",c=>{var o,d,p,y;if(c.target.closest("predective-search")||c.target==this||c.target.closest('[data-id="search-container"]'))this.display=!0;else{if(this._isAnyModalOpen()){this.display=!0;return}this.display=!1,(o=this.searchInput)==null||o.blur(),this.searchInput.value="",(d=this.searchInput)==null||d.dispatchEvent(new Event("input")),this.searchInput.classList.remove("active"),(y=(p=this.searchInput)==null?void 0:p.parentElement)==null||y.classList.remove("active-search-wrap"),this.hidePredectiveSearch.call(this)}}),(h=this.searchCloseBtn)==null||h.forEach(c=>{c.addEventListener("click",o=>
37{var d,p,y,_,S,b;o.preventDefault(),(d=this.searchInput)==null||d.blur(),this.searchInput&&(this.searchInput.value="",this.searchInput.setAttribute("value",""),this.searchInput.dispatchEvent(new Event("input",{bubbles:!0})),this.searchInput.classList.remove("active"),(y=(p=this.searchInput)==null?void 0:p.parentElement)==null||y.classList.remove("active-search-wrap"),(S=(_=this.searchInput)==null?void 0:_.closest('[data-role="header-wrapper"]'))==null||S.classList.remove("header-wrapper-active"),this._setInputCaretHidden(!1),this.pushBackButtonClickEvent()),(b=this.hidePredectiveSearch)==null||b.call(this)})}),(l=this.searchClearBtn)==null||l.forEach(c=>{c.addEventListener("click",async o=>{var d,p,y,_,S,b,E,L,H;o.preventDefault(),o.stopPropagation(),this.searchInput&&(this._committedTerm=null,this._committedSearchKeyword="",this._pendingSearchKeyword="",this._lastTrackedKeyword="",this._lastTrackedKeywordWithResults="",this._suppressPredictiveOnce=!1,this.searchInput.value="",this.searchInput.setAttribute("value",""),(p=(d=this.searchInput)==null?void 0:d.parentElement)==null||p.classList.remove("search-input-back"),(_=(y=this._predictAbort)==null?void 0:y.abort)==null||_.call(y),(S=this._hidePredictiveWrapper)==null||S.call(this),this._hideEmptyState(),(E=(b=this.fullResults)==null?void 0:b.resetUI)==null||E.call(b),this.searchInput.dispatchEvent(new Event("input",{bubbles:!0})),this.getSectionMarkup.call(this),(H=(L=this.history)==null?void 0:L.render)==null||H.call(L),this.syncHistoryState(),this._setInputCaretHidden(!1),this.searchInput.focus(),this.pushClearButtonClickEvent())})}),(g=this.searchInput)==null||g.addEventListener("input",()=>{var o;const c=(((o=this.searchInput)==null?void 0:o.value)||"").trim();this._pendingSearchKeyword=c,this._setInputCaretHidden(!1),c.length>0?(this._hideHistoryImmediately(),this._hideEmptyState()):(this._restoreDefaultSearchMarkup(),this.syncHistoryState(),this._hideEmptyState())}),(w=this.searchInput)==null||w.addEventListener("input",this.debounceOnChange.bind(this)),(u=this.searchInput)==null||u.addEventListener("keydown",async c=>{var d,p,y;if(c.key!=="Enter")return;c.preventDefault(),c.stopPropagation(),c.stopImmediatePropagation();const o=(((d=this.searchInput)==null?void 0:d.value)||"").trim();o&&((y=(p=this.debounceOnChange)==null?void 0:p.cancel)==null||y.call(p),await this.commitSearch(o))}),document.addEventListener("click",async c=>{var o,d,p,y;if(c.target.closest('[data-role="keyword"]')||c.target.dataset.role=="keyword"){if(c.target.closest(".trending-key-wrap")||c.target.closest('[data-role="predictive_search_wrapper"]'))return;const _=c.target.closest('[data-role="keyword"]')?c.target.closest('[data-role="keyword"]'):c.target,S=(_.dataset&&_.dataset.value?_.dataset.value:"")||(_.dataset&&_.dataset.keyword?_.dataset.keyword:"")||(_.textContent?_.textContent.trim():"")||(_.innerHTML?_.innerHTML.trim():"");if(!S)return;this._committedTerm=S,this._suppressPredictiveOnce=!0,this.searchInput&&(this.searchInput.value=S,this.searchInput.setAttribute("value",S)),this._setInputCaretHidden(!0),(o=this.searchInput)==null||o.focus(),this._hideHistoryImmediately(),(d=this._hidePredictiveWrapper)==null||d.call(this),this._hideEmptyState(),await this.commitSearch(S),this._shouldKeepFocusAfterSearch()?(y=this.searchInput)==null||y.focus():(p=this.searchInput)==null||p.blur(),dataLayer.push({event:window.custom_data_events.search.events.keyword_clicked,clicked_search_keyword:S})}}),(m=this.searchContainer)==null||m.addEventListener("click",c=>{var o;if(c.target.closest("product-card")&&c.target.getAttribute("href")){c.preventDefault();let d=c.target.getAttribute("href"),p=c.target.closest("product-card");dataLayer.push({event:window.custom_data_events.search.events.product_clicked,clicked_product_title:(o=p?.dataset)==null?void 0:o.title}),window.location=d}}),document.addEventListener("click",async c=>{const o=c.target.closest('[data-role="history-item"]');if(!o)return;const d=(o.dataset.value||o.textContent||"").trim();d&&(!this.searchContainer||!this.searchContainer.contains(o)||(this._committedSearchKeyword=d,this._committedTerm=d,this._suppressPredictiveOnce=!0,this.searchInput.value=d,this.searchInput.setAttribute("value",d),this._hideHistoryImmediately(),this._hidePredictiveWrapper(),this._hideEmptyState(),this._setInputCaretHidden(!0),await this.commitSearch(d),this._afterCommittedSearchUI(),this.pushKeywordSearchedEvent(d)))}),document.addEventListener("click",async c=>{var _,S,b,E;if(c.target.closest('[data-role="history-item"]'))return;const d=c.target.closest('[data-role="searchresult-item"]'),p=!!c.target.closest('[data-role="predictive_search_history_wrap"]');if(d&&!p){if(!this._isActiveSearchInstance())return;c.preventDefault(),c.stopPropagation(),c.stopImmediatePropagation();const L=((_=d.dataset)==null?void 0:_.keyword)||((S=d.textContent)==null?void 0:S.trim())||"";if(!L)return;this._committedSearchKeyword=L,this._committedTerm=L,this._suppressPredictiveOnce=!0,this.searchInput&&(this.searchInput.value=L,this.searchInput.setAttribute("value",L),this.searchInput.dispatchEvent(new Event("change",{bubbles:!0}))),this._hideHistoryImmediately(),this._hidePredictiveWrapper(),this._hideEmptyState(),this._setInputCaretHidden(!0),await this.commitSearch(L,{skipPredictivePrepare:!0}),this._afterCommittedSearchUI(),this.pushKeywordSearchedEvent(L),this.pushSearchDropdownClickEvent(L);return}const y=c.target.closest('.trending-key-wrap [data-role="keyword"]');if(y){if(!this._isActiveSearchInstance())return;c.preventDefault(),c.stopPropagation(),c.stopImmediatePropagation();const L=((b=y.dataset)==null?void 0:b.keyword)||((E=y.textContent)==null?void 0:E.trim())||"";if(!L)return;this._committedSearchKeyword=L,this._committedTerm=L,this._suppressPredictiveOnce=!0,this.searchInput&&(this.searchInput.value=L,this.searchInput.setAttribute("value",L)),this._hideHistoryImmediately(),this._hidePredictiveWrapper(),this._hideEmptyState(),this._setInputCaretHidden(!0),await this.commitSearch(L),this._afterCommittedSearchUI(),this.pushTrendingSearchClickedEvent(L);return}}),window.__shopByCategoryBound||(window.__shopByCategoryBound=!0,document.addEventListener("click",function(c){var _,S;const o=c.target.closest("[data-role='shop-by-category']");if(!o)return;const d=o.closest("a");if(!d||d.dataset.shopCatProcessing==="1")return;d.dataset.shopCatProcessing="1",c.preventDefault(),c.stopPropagation(),c.stopImmediatePropagation();const p=d.getAttribute("href")||"",y=((S=(_=d.querySelector("span:last-child"))==null?void 0:_.innerText)==null?void 0:S.trim())||"";console.log("Clicked:",y,p),dataLayer.push({event:window.custom_data_events["search-v2"].events[8].name,category_label:y,category_url:p,page_handle:window.location.pathname}),setTimeout(()=>{d.dataset.shopCatProcessing="0",window.location.href=p},300)},!0)),this._hideOnOuterScroll=this._hideOnOuterScroll||(c=>{var _,S,b,E,L,H,T,A,x;if(((S=(_=this.searchContainer)==null?void 0:_.style)==null?void 0:S.display)!=="block")return;const o=c?.target,d=(b=o?.closest)==null?void 0:b.call(o,'[data-role="predictive_search_wrapper"]'),p=(E=o?.closest)==null?void 0:E.
37call(o,'[data-role="predictive_search_history_wrap"]'),y=((L=o?.closest)==null?void 0:L.call(o,'[data-role="results-area"]'))||((H=o?.closest)==null?void 0:H.call(o,'[data-role="results-grid"]'));if(!(d||p||y)){if(c.type==="wheel"){const C=Math.abs(c.deltaX||0),P=Math.abs(c.deltaY||0);if(C>P)return}if(c.type==="touchmove"){const C=(T=c.touches)==null?void 0:T[0];if(!C)return;const P=Math.abs((C.clientX||0)-this._touchStartX),k=Math.abs((C.clientY||0)-this._touchStartY);if(P>k)return}if(c.type==="scroll")if(o===window||o===document||o===document.documentElement||o===document.body){const C=window.scrollY||window.pageYOffset||0;if(C===this._outerLastWindowScrollY)return;this._outerLastWindowScrollY=C}else{const C=o?.scrollTop??0;if(C===this._outerLastScrollTop)return;this._outerLastScrollTop=C}this._hidePredictiveWrapper(),(x=(A=this.history)==null?void 0:A.collapseOnOuterScroll)==null||x.call(A)}}),this._onTouchStartForOuterScroll=this._onTouchStartForOuterScroll||(c=>{var d;const o=(d=c.touches)==null?void 0:d[0];o&&(this._touchStartX=o.clientX||0,this._touchStartY=o.clientY||0)});const e=((f=this.searchContainer)==null?void 0:f.querySelector('[data-role="container"]'))||this.searchContainer;e?.addEventListener("touchstart",this._onTouchStartForOuterScroll,{passive:!0,capture:!0}),e?.addEventListener("scroll",this._hideOnOuterScroll,{passive:!0,capture:!0}),e?.addEventListener("wheel",this._hideOnOuterScroll,{passive:!0,capture:!0}),e?.addEventListener("touchmove",this._hideOnOuterScroll,{passive:!0,capture:!0}),window.addEventListener("scroll",this._hideOnOuterScroll,{passive:!0,capture:!0}),this._onMobileScrollHideKeyboard=this._onMobileScrollHideKeyboard||(()=>{this._hideKeyboardOnMobileScroll()}),e?.addEventListener("scroll",this._onMobileScrollHideKeyboard,{passive:!0,capture:!0}),e?.addEventListener("touchmove",this._onMobileScrollHideKeyboard,{passive:!0,capture:!0}),window.addEventListener("scroll",this._onMobileScrollHideKeyboard,{passive:!0,capture:!0}),document.addEventListener("sw:history:select",async c=>{var o;try{const d=(((o=c?.detail)==null?void 0:o.term)||"").trim();if(!d||!this.searchContainer||!this.searchContainer.contains(c.target))return;this._committedSearchKeyword=d,this._committedTerm=d,this._suppressPredictiveOnce=!0,this.searchInput.value=d,this.searchInput.setAttribute("value",d),this._hideHistoryImmediately(),this._hidePredictiveWrapper(),this._hideEmptyState(),this._setInputCaretHidden(!0),await this.commitSearch(d),this._afterCommittedSearchUI(),this.pushKeywordSearchedEvent(d)}catch(d){console.warn("[PredectiveSearch] sw:history:select error",d)}},!0)}_isMobileSearchView(){return window.matchMedia("(max-width: 1024px)").matches}_shouldKeepFocusAfterSearch(){return!1}_isActiveSearchInstance(){const e=document.querySelector('predective-search [data-role="search-input"].active');if(e)return e===this.searchInput;const t=document.querySelector("predective-search label.active-search-wrap");return t?t.closest("predective-search")===this:document.activeElement===this.searchInput}_setInputCaretHidden(e=!0){this.searchInput&&(this.searchInput.classList.toggle("sw-hide-caret",!!e),this.classList.toggle("search-caret-hidden",!!e))}_closeMobileKeyboard(){try{const e=document.activeElement;e&&typeof e.blur=="function"&&e.blur(),this.searchInput&&typeof this.searchInput.blur=="function"&&(this.searchInput.blur(),this.searchInput.setAttribute("readonly","readonly"),requestAnimationFrame(()=>{this.searchInput.removeAttribute("readonly")}))}catch{}}_afterCommittedSearchUI(){var e,t;this._hidePredictiveWrapper(),this._hideHistoryImmediately(),this._setInputCaretHidden(!0),(e=this.fullResults)!=null&&e.container&&(this.fullResults.container.scrollTop=0),this.searchContainer&&(this.searchContainer.scrollTop=0),this._isMobileSearchView()?this._closeMobileKeyboard():(t=this.searchInput)==null||t.blur()}_hideKeyboardOnMobileScroll(){!this._isMobileSearchView()||!this._isSearchContainerOpen()||!this.searchInput||!(document.activeElement===this.searchInput||this.searchInput.matches(":focus"))||requestAnimationFrame(()=>{this._closeMobileKeyboard(),this._setInputCaretHidden(!0)})}_showEmptyState(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="empty-result"]');if(e){if(!this._allowEmptyState){e.classList.add("sw-force-hide"),e.style.display="none",e.setAttribute("aria-hidden","true");return}e.classList.remove("sw-force-hide"),e.style.display="",e.removeAttribute("aria-hidden")}}_hideEmptyState(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="empty-result"]');this._allowEmptyState=!1,e&&(e.classList.add("sw-force-hide"),e.style.display="none",e.setAttribute("aria-hidden","true"))}_setSearchLoadingUI(){var r,n,a,h,l,g,w;this._allowEmptyState=!1,this._hideEmptyState(),this._hideHistoryImmediately();const e=(r=this.searchContainer)==null?void 0:r.querySelector('[data-role="no-search-container"]');(n=this.searchContainer)==null||n.querySelector('[data-role="results-grid"]');const t=(a=this.searchContainer)==null?void 0:a.querySelector('[data-role="results-header"]'),s=(h=this.searchContainer)==null?void 0:h.querySelector('[data-role="search-count"]'),i=(l=this.searchContainer)==null?void 0:l.querySelector('[data-role="results-sentinel"]');e?.classList.add("sw-hidden"),t?.classList.add("sw-hidden"),s&&(s.textContent=""),i&&(i.dataset.nextUrl="",i.classList.add("sw-hidden")),(w=(g=this.fullResults)==null?void 0:g.showLoader)==null||w.call(g)}_showDefaultSearchContent(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="no-search-container"]');e?.classList.remove("sw-hidden")}_showDefaultSearchContentAfterResults(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="no-search-container"]');e&&(e.classList.add("sw-hidden"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.classList.remove("sw-hidden")})}))}_syncEmptyStateByCount(e=""){var m,f,c,o,d,p,y,_;const t=(m=this.searchContainer)==null?void 0:m.querySelector('[data-role="empty-result"]'),s=(f=this.searchContainer)==null?void 0:f.querySelector('[data-role="search-count"]'),i=(c=this.searchContainer)==null?void 0:c.querySelector('[data-role="predictive_search_wrapper"]'),r=(o=this.searchContainer)==null?void 0:o.querySelector('[data-role="results-grid"]'),n=(d=this.searchContainer)==null?void 0:d.querySelector('[data-role="results-loader"]');if(!t||!s)return;const a=(e||"").trim(),h=(((p=this.searchInput)==null?void 0:p.value)||"").trim();if(!a||!h){this._hideEmptyState();return}if(a.toLowerCase()!==h.toLowerCase()){this._hideEmptyState();return}const l=i&&i.style.display!=="none"&&!!i.querySelector('[data-role="searchresult-item"]'),g=n&&!n.classList.contains("sw-hidden")&&window.getComputedStyle(n).display!=="none";if((y=this.fullResults)!=null&&y.loading||this._predictLoading||l||g){this._hideEmptyState();return}const w=((_=r?.querySelectorAll("product-card"))==null?void 0:_.length)||0,u=parseInt(s.textContent||"0",10)||0;if(w>0||u>0){this._hideEmptyState();return}this._allowEmptyState=!0,this._showEmptyState()}_lockBodyScroll(){this._isSearchOpen||(this._isSearchOpen=!0,this._scrollY=window.scrollY||window.pageYOffset||0,document.body.classList.add("search-open"),document.body.style.position="fixed",document.body.style.top=`-${this._scrollY}px`,document.body.style.left="0",document.body.style.right="0",document.body.style.width="100%")}_unlockBodyScroll(){this._isSearchOpen&&(this._isSearchOpen=!1,document.body.classList.remove("search-open"),document.body.style.position="",document.body.style.top="",document.body.style.left="",document.body.style.right="",document.body.style.width="",window.scrollTo(0,this._scrollY||0))}_hidePredictiveWrapper(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="predictive_search_wrapper"]');e&&(e.classList.remove("is-visible"),e.style.display="none")}_showPredictiveWrapper(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="predictive_search_wrapper"]');e&&(e.classList.add("is-visible"),e.style.display="block")}_isInputEmpty(){var t;return(((t=this.searchInput)==null?void 0:t.value)||"").trim().length===0}_hideHistoryImmediately(){var e;(e=this.history)!=null&&e.wrap&&(this.history.hide(!0),this.history.render())}_isAnyModalOpen(){return!!document.querySelector('[aria-modal="true"], [role="dialog"], .modal, .sw-modal, .quickview, .quick-view, .quickview-modal, [data-role="quickview"], [data-role="quickview-modal"]')}_isInsideSearchUI(e){var i,r;if(!e)return!1;const t=!!((i=e.closest)!=null&&i.call(e,"predective-search")),s=!!((r=e.closest)!=null&&r.call(e,'[data-id="search-container"]'));return t||s}_isSearchContainerOpen(){if(!this.searchContainer)return!1;if(this.showing||this.searchContainer.style.display==="block"||this.searchContainer.classList.contains("active"))return!0;const e=window.getComputedStyle(this.searchContainer);return e.display!=="none"&&e.visibility!=="hidden"}_refreshHistoryUI(){this.history&&(this.history.root=this.searchContainer,this.history.bind(),this.history.render())}_restoreDefaultSearchMarkup(){if(!this.searchSection||!this.searchContainer)return;const t=this.searchSection.content.cloneNode(!0).querySelector('[data-role="container"]');t&&(this.searchContainer.innerHTML=t.outerHTML,this.rebindFullResults(),this.history=this.history||new N({storageKey:"sw_search_history",max:12,root:this.searchContainer,onClear:()=>{this.clearSearchInputAndResetUI(),this.pushClearButtonClickEvent()},onRemove:s=>{this.pushSearchHistoryRemoveEvent(s)}}),this.history.root=this.searchContainer,this.history.bind(),this.history.wrap&&(this.history.wrap.dataset.forceHidden="0"),this.history.render(),this._hidePredictiveWrapper(),this._hideEmptyState())}ensureSearchMarkup(){var e,t,s,i;(!this.searchSection||!((t=(e=this.searchContainer)==null?void 0:e.innerHTML)!=null&&t.trim()))&&(this.searchSection=document.querySelector("template#predective-search"),this.searchSectionId=(i=(s=this.searchSection)==null?void 0:s.dataset)==null?void 0:i.id,this.get
37SectionMarkup())}openSearch(){var e,t,s,i,r,n;if(!this.showing){(e=this.searchInput)==null||e.classList.add("active"),(s=(t=this.searchInput)==null?void 0:t.parentElement)==null||s.classList.add("active-search-wrap"),(r=(i=this.searchInput)==null?void 0:i.closest('[data-role="header-wrapper"]'))==null||r.classList.add("header-wrapper-active"),this.displayPredectiveSearch();let a=JSON.parse(((n=document.querySelector('script[type="applicationId/json"][data-id="search-data"]'))==null?void 0:n.innerHTML)||"{}");dataLayer.push({event:window.custom_data_events["search-v2"].events[1].name,page_handle:window.location.pathname,...a})}}syncHistoryState(){if(!this.history)return;this._refreshHistoryUI();const e=this._isSearchContainerOpen(),t=this.history.getAll(),s=Array.isArray(t)&&t.length>0,i=this._isInputEmpty();if(e&&i&&s){this.history.show(),this.history.render(),this._hidePredictiveWrapper(),this._hideEmptyState();return}this.history.hide(!0),this.history.render()}clearSearchInputAndResetUI(){var e,t,s,i;this.searchInput&&(this._committedTerm=null,this._committedSearchKeyword="",this._pendingSearchKeyword="",this._lastTrackedKeyword="",this._lastTrackedKeywordWithResults="",this._suppressPredictiveOnce=!1,this.searchInput.value="",this.searchInput.setAttribute("value",""),(t=(e=this._predictAbort)==null?void 0:e.abort)==null||t.call(e),this._restoreDefaultSearchMarkup(),(i=(s=this.fullResults)==null?void 0:s.resetUI)==null||i.call(s),this._setInputCaretHidden(!1),this._hideEmptyState(),this.searchInput.focus(),requestAnimationFrame(()=>{this._refreshHistoryUI(),this.syncHistoryState()}))}connectedCallback(){var e,t;this._connectedOnce||(this._connectedOnce=!0,this.searchSection=document.querySelector("template#predective-search"),this.searchSectionId=(t=(e=this.searchSection)==null?void 0:e.dataset)==null?void 0:t.id,this.getSectionMarkup.call(this),this.initTypingEffect.call(this),this.setModalPositionForDesktop.call(this),window.addEventListener("resize",this.setModalPositionForDesktop.bind(this)))}rebindFullResults(){var t;const e=((t=this.searchContainer)==null?void 0:t.querySelector('[data-role="container"]'))||this.searchContainer;this.fullResults=new ot({container:e,grid:this.searchContainer.querySelector('[data-role="results-grid"]'),loader:this.searchContainer.querySelector('[data-role="results-loader"]'),sentinel:this.searchContainer.querySelector('[data-role="results-sentinel"]'),countEl:this.searchContainer.querySelector('[data-role="search-count"]'),termEl:this.searchContainer.querySelector('[data-role="search-category"]'),headerEl:this.searchContainer.querySelector('[data-role="results-header"]'),sectionId:"search-results-popup",perPage:24,onResultMeta:({term:s,hasResults:i})=>{var a,h;const r=(this._committedTerm||"").trim().toLowerCase(),n=(s||"").trim().toLowerCase();i&&r&&r===n&&((h=(a=this.history)==null?void 0:a.add)==null||h.call(a,this._committedSearchKeyword||s),this._committedTerm=null),this._hideHistoryImmediately(),(s||"").trim()&&this._setInputCaretHidden(!0)}})}_syncResultsHeader(e){var a,h,l;const t=(e||"").trim(),s=(a=this.searchContainer)==null?void 0:a.querySelector('[data-role="results-header"]'),i=(h=this.searchContainer)==null?void 0:h.querySelector('[data-role="search-category"]');if(!s||!i)return;i.textContent=`\u201C${t}\u201D`;const r=(l=this.searchContainer)==null?void 0:l.querySelector('[data-role="search-count"]'),n=parseInt(r?.textContent||"0",10);!t||n===0?s.classList.add("sw-hidden"):s.classList.remove("sw-hidden")}initTypingEffect(){var t,s,i,r;const e=(t=this.dataset.inputs)==null?void 0:t.split(",");if(e?.length>0){this.typed=new rt(this.searchInput,{strings:e,typeSpeed:50,attr:"placeholder",loop:!0,fadeOutDelay:400,backDelay:1e3,showCursor:!0,cursorChar:"|"}),(s=this.searchInput)==null||s.addEventListener("focus",()=>{var a;return(a=this.typed)==null?void 0:a.start()}),(i=this.searchInput)==null||i.addEventListener("focusout",()=>{var a;return(a=this.typed)==null?void 0:a.start()});let n=null;(r=this.searchInput)==null||r.addEventListener("input",()=>{var w;const a=(w=this.searchInput)==null?void 0:w.parentElement;if(a){if(!((this.searchInput.value??"").replace(/[\s\u00A0]+/g,"").length>=1)){a.classList.remove("search-input-active"),a.classList.remove("search-input-back"),clearTimeout(n);return}a.classList.toggle("search-input-back",!0),a.classList.remove("search-input-active"),a.offsetWidth,a.classList.add("search-input-active"),clearTimeout(n),n=setTimeout(()=>{a.classList.remove("search-input-active")},1500)}})}}redirectToSearchPage(){}getSectionMarkup(){if(!this.searchSection||!this.searchContainer)return;const t=this.searchSection.content.cloneNode(!0).querySelector('[data-role="container"]');if(!t){console.warn("[PredectiveSearch] template missing [data-role='container']");return}this.searchContainer.innerHTML=t.outerHTML,this.rebindFullResults(),this.history=this.history||new N({storageKey:"sw_search_history",max:12,root:this.searchContainer,onClear:()=>{this.clearSearchInputAndResetUI(),this.pushClearButtonClickEvent()},onRemove:s=>{this.pushSearchHistoryRemoveEvent(s)}}),this.history.root=this.searchContainer,this.history.bind(),this.history.wrap&&(this.history.wrap.dataset.forceHidden="0"),this.history.render(),this._hidePredictiveWrapper(),this._hideEmptyState(),requestAnimationFrame(()=>{this.syncHistoryState()})}_storePredictiveKeywords(){var t;const e=(t=this.searchContainer)==null?void 0:t.querySelector('[data-role="predictive_search_wrapper"]');this._lastPredictiveKeywords=Array.from(e?.querySelectorAll('[data-role="searchresult-item"]')||[]).map(s=>{var i,r;return((i=s.dataset)==null?void 0:i.keyword)||((r=s.textContent)==null?void 0:r.trim())||""}).map(s=>
37String(s).trim()).filter(Boolean)}_getBestPredictiveKeyword(e=""){const t=String(e||"").trim(),s=this._lastPredictiveKeywords||[];if(!s.length)return t;const i=t.toLowerCase();return s.find(r=>r.toLowerCase()===i)||s.find(r=>r.toLowerCase().startsWith(i))||s.find(r=>r.toLowerCase().includes(i))||s[0]||t}_getSearchCandidates(e=""){const t=String(e||"").trim(),s=this._lastPredictiveKeywords||[],i=this._getBestPredictiveKeyword(t);return Array.from(new Set([i,...s,t].map(r=>String(r||"").trim()).filter(Boolean)))}async _ensurePredictiveReady(e=""){const t=String(e||"").trim();!t||t.length<this._minPredictChars||(this._suppressPredictiveOnce=!0,await this.getResultsData(),this._storePredictiveKeywords())}async runFullSearch(e="",{committed:t=!1,keepInput:s=!1,historyTerm:i=""}={}){var f,c,o,d,p,y,_,S,b,E,L,H,T,A,x,C,P;const r=String(e||"").trim();if(!r)return 0;const n=String(i||r).trim(),a=(f=this.searchContainer)==null?void 0:f.querySelector('[data-role="results-grid"]');(!this.fullResults||!a||this.fullResults.grid!==a||!((c=this.fullResults.grid)!=null&&c.isConnected))&&this.rebindFullResults();const h=++this._activeResultToken;this._allowEmptyState=!1,this._hideEmptyState();const l=(o=this.searchContainer)==null?void 0:o.querySelector('[data-role="results-grid"]'),g=(d=this.searchContainer)==null?void 0:d.querySelector('[data-role="results-header"]'),w=(p=this.searchContainer)==null?void 0:p.querySelector('[data-role="search-count"]');(y=this.searchContainer)==null||y.querySelector('[data-role="search-category"]'),t&&(this._isCommittedSearchRunning=!0,(S=(_=this.debounceOnChange)==null?void 0:_.cancel)==null||S.call(_),this._hidePredictiveWrapper(),this._hideHistoryImmediately(),this._setInputCaretHidden(!0));const u=this._getSearchCandidates(r).map(k=>String(k||"").trim()).filter(Boolean),m=Array.from(new Set([r,...u.filter(k=>k.toLowerCase()!==r.toLowerCase())]));console.log("[SEARCH CANDIDATES]",{typed:r,candidates:m}),t&&this.fullResults&&(this.fullResults.keepHeaderVisibleDuringLoading=!0,this.fullResults.suppressAutoLoadNextOnce=!0),(E=(b=this.fullResults)==null?void 0:b.clearForLoading)==null||E.call(b,n||r);try{for(const k of m){if(h!==this._activeResultToken||(await((L=this.fullResults)==null?void 0:L.setQuery(k)),h!==this._activeResultToken))return 0;if(((H=this.fullResults)==null?void 0:H.total)===-1)continue;const M=Number(((T=this.fullResults)==null?void 0:T.total)||0);if(M>0)return this._hideEmptyState(),this._showDefaultSearchContentAfterResults(),this.searchInput&&!s&&(this.searchInput.value=k,this.searchInput.setAttribute("value",k)),t?((x=(A=this.history)==null?void 0:A.add)==null||x.call(A,n),this.pushKeywordSearchedEvent(n)):this.trackKeywordSearchAfterResults(r),M}return l&&(l.innerHTML=""),w&&(w.textContent="0"),g?.classList.add("sw-hidden"),this._allowEmptyState=!0,this._showEmptyState(),this._showDefaultSearchContent(),0}catch(k){return console.warn("[Search] runFullSearch failed",k),this._allowEmptyState=!0,this._showDefaultSearchContent(),this._showEmptyState(),0}finally{h===this._activeResultToken&&(this._isCommittedSearchRunning=!1,this.fullResults&&(this.fullResults.keepHeaderVisibleDuringLoading=!1),(P=(C=this.fullResults)==null?void 0:C.hideLoader)==null||P.call(C))}}async commitSearch(e="",t={}){var w,u,m,f,c,o,d,p,y,_;const s=String(e||"").trim();if(!s)return 0;const i=!!t.skipPredictivePrepare;if(this._isCommittedSearchRunning&&((u=(w=this._committedSearchKeyword)==null?void 0:w.toLowerCase)==null?void 0:u.call(w))===s.toLowerCase())return 0;i||(this._lastPredictiveKeywords=[]),this.ensureSearchMarkup();const n=(m=this.searchContainer)==null?void 0:m.querySelector('[data-role="results-grid"]');(!this.fullResults||!n||this.fullResults.grid!==n||!((f=this.fullResults.grid)!=null&&f.isConnected))&&this.rebindFullResults(),(o=(c=this.debounceOnChange)==null?void 0:c.cancel)==null||o.call(c),this._committedSearchKeyword=s,this._committedTerm=s,this._suppressPredictiveOnce=!0,this._allowEmptyState=!1,this.searchInput&&(this.searchInput.value=s,this.searchInput.setAttribute("value",s),this.searchInput.dispatchEvent(new Event("change",{bubbles:!0}))),this._hideEmptyState(),this._hideHistoryImmediately();const a=(d=this.searchContainer)==null?void 0:d.querySelector('[data-role="no-search-container"]');if(a?.classList.add("sw-hidden"),(y=(p=this.fullResults)==null?void 0:p.showLoader)==null||y.call(p),!i)try{await this._ensurePredictiveReady(s)}catch(S){console.warn("[Search] predictive prepare before search failed",S)}const h=s;this._hidePredictiveWrapper(),this._setInputCaretHidden(!0),await new Promise(S=>requestAnimationFrame(S));const l=await this.runFullSearch(h,{committed:!0,keepInput:!0,historyTerm:s}),g=(_=this.searchContainer)==null?void 0:_.querySelector('[data-role="search-category"]');return g&&(g.textContent=`\u201C${s}\u201D`),l>0&&this._hideEmptyState(),l}async handleInput(){var n,a,h,l,g,w,u;if(this._isCommittedSearchRunning)return;const e=++this._fullResultsReqId;if(!(((n=this.searchInput)==null?void 0:n.value)||"").trim()){this._activeResultToken+=1,(h=(a=this._predictAbort)==null?void 0:a.abort)==null||h.call(a),this._restoreDefaultSearchMarkup(),(g=(l=this.fullResults)==null?void 0:l.resetUI)==null||g.call(l),this._hideEmptyState(),this._setInputCaretHidden(!1),requestAnimationFrame(()=>{this._refreshHistoryUI(),this.syncHistoryState()});return}this._setSearchLoadingUI();try{await this.getResultsData()}catch(m){console.warn("[Search] predictive failed, continuing full search",m)}if(e!==this._fullResultsReqId)return;const s=(((w=this.searchInput)==null?void 0:w.value)||"").trim();if(!s)return;const i=(u=this.searchContainer)==null?void 0:u.querySelector('[data-role="predictive_search_wrapper"]');i!=null&&i.querySelector('[data-role="searchresult-item"]')?(this._showPredictiveWrapper(),this._applyPredictiveIconsAndHistoryTop()):this._hidePredictiveWrapper(),await this.runFullSearch(s,{committed:!1,keepInput:!0})}async getResultsData(){var o,d,p,y,_,S,b,E,L,H,T,A,x,C,P,k,M,j,X,z,V,G,O,J,D,Q;const e=(((o=this.searchInput)==null?void 0:o.value)||"").trim();if(!e)return this._predictLoading=!1,!1;const t=++this._predictReqId;this._predictLoading=!0,(p=(d=this._predictAbort)==null?void 0:d.abort)==null||p.call(d),this._predictAbort=new AbortController;const s=e.toLowerCase();if(this._predictCache.has(s)){if((((y=this.searchInput)==null?void 0:y.value)||"").trim().toLowerCase()!==s||t!==this._predictReqId)return this._predictLoading=!1,!1;const R=this._predictCache.get(s),Z=(_=this.searchContainer)==null?void 0:_.querySelector('[data-role="predictive_search_wrapper"]');if(!Z)return this._predictLoading=!1,!1;if(Z.innerHTML=R,this._storePredictiveKeywords(),(((S=this.searchInput)==null?void 0:S.value)||"").trim().length>0){const B=(b=this.searchContainer)==null?void 0:b.querySelector('[data-role="predictive_search_history_wrap"]'),W=(E=this.searchContainer)==null?void 0:E.querySelector('[data-role="history-shell"]');B&&(B.dataset.forceHidden="1",B.classList.add("sw-hidden")),W?.classList.add("sw-hidden")}return this.history=this.history||new N({storageKey:"sw_search_history",max:12,root:this.searchContainer,onClear:()=>{this.clearSearchInputAndResetUI(),this.pushClearButtonClickEvent()},onRemove:B=>
37{this.pushSearchHistoryRemoveEvent(B)}}),this.history.root=this.searchContainer,this.history.bind(),this.history.render(),(H=(L=this.history)==null?void 0:L.hide)==null||H.call(L,!0),(A=(T=this.history)==null?void 0:T.render)==null||A.call(T),this._hideEmptyState(),this._predictLoading=!1,!1}(x=this.searchContainer)==null||x.classList.add("active");const i=encodeURIComponent(this.searchInput.value||""),r=window.Shopify.routes.root+`search/suggest?q=${i}&resources[type]=product,query,collection,page,article&resources[limit]=8&resources[options][fields]=title,product_type,variants.title,variants.sku&options[prefix]=last&section_id=${this.searchSectionId}&tolerance=4`;let n="";try{const I=await fetch(r,{method:"GET",credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/html"},signal:this._predictAbort.signal});if(!I.ok)throw new Error(`[Search] suggest fetch failed: ${I.status} ${r}`);n=await I.text()}catch(I){return console.warn("[Search] suggest API failed",I),(C=this.searchContainer)==null||C.classList.remove("active"),this._predictLoading=!1,!1}const a=(((P=this.searchInput)==null?void 0:P.value)||"").trim().toLowerCase();if(t!==this._predictReqId||a!==s)return(k=this.searchContainer)==null||k.classList.remove("active"),this._predictLoading=!1,!1;(M=this.searchContainer)==null||M.classList.remove("active");const g=(j=new DOMParser().parseFromString(n,"text/html").querySelector("template"))==null?void 0:j.content,w=g?.querySelector('[data-role="container"]');if(!w)return this._predictLoading=!1,!1;const u=w.querySelector('[data-role="predictive_search_wrapper"]'),m=(X=this.searchContainer)==null?void 0:X.querySelector('[data-role="predictive_search_wrapper"]');if(!m||!u)return this._predictLoading=!1,!1;if(m.innerHTML=u.innerHTML,this._storePredictiveKeywords(),(((z=this.searchInput)==null?void 0:z.value)||"").trim().length>0){const I=(V=this.searchContainer)==null?void 0:V.querySelector('[data-role="predictive_search_history_wrap"]'),R=(G=this.searchContainer)==null?void 0:G.querySelector('[data-role="history-shell"]');I&&(I.dataset.forceHidden="1",I.classList.add("sw-hidden")),R?.classList.add("sw-hidden")}if(this._predictCache.set(s,u.innerHTML),this._predictCache.size>50){const I=this._predictCache.keys().next().value;this._predictCache.delete(I)}return this.history=this.history||new N({storageKey:"sw_search_history",max:12,root:this.searchContainer,onClear:()=>{this.clearSearchInputAndResetUI(),this.pushClearButtonClickEvent()},onRemove:I=>{this.pushSearchHistoryRemoveEvent(I)}}),this.history.root=this.searchContainer,this.history.bind(),this.history.render(),(J=(O=this.history)==null?void 0:O.hide)==null||J.call(O,!0),(Q=(D=this.history)==null?void 0:D.render)==null||Q.call(D),this._hideEmptyState(),this._predictLoading=!1,!!w.querySelector('[data-role="empty-result"]')}debounce(e,t){let s;const i=(...r)=>{clearTimeout(s),s=setTimeout(()=>e.apply(this,r),t)};return i.cancel=()=>{clearTimeout(s),s=null},i}setModalPositionForDesktop(){var e;if(this.searchContainer)if(window.innerWidth>1024){if((e=this.checkVisibility)!=null&&e.call(this)){let t=this.offsetLeft+this.offsetWidth;this.searchContainer.style.right=`calc(100vw - ${t}px)`}}else this.searchContainer.style.right=""}displayPredectiveSearch(){var e;this.showing=!0,this.closing=!1,this.searchContainer.style.display="block",this._searchEventDispatched||(this._searchEventDispatched=!0,document.dispatchEvent(new CustomEvent("search:open"))),this._lockBodyScroll(),this.animation&&this.animation.cancel(),this.animation=(e=this.searchContainer)==null?void 0:e.animate({opacity:[0,1]},{duration:400,easing:"ease-out"}),requestAnimationFrame(()=>{this._refreshHistoryUI(),this.syncHistoryState()}),setTimeout(()=>{this._refreshHistoryUI(),this.syncHistoryState()},50)}hidePredectiveSearch(){var s;this.closing=!0,this.showing=!1,this.animation&&this.animation.cancel();const t=(this._scrollY||window.scrollY||0)>50;this.animation=(s=this.searchContainer)==null?void 0:s.animate({opacity:[1,0]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>{this.searchContainer.style.display="",this._unlockBodyScroll(),this._setInputCaretHidden(!1),this._searchEventDispatched&&(this._searchEventDispatched=!1,document.dispatchEvent(new CustomEvent("search:close",{detail:{keepHidden:t}})))}}_psSetIcon(e,t){if(!e)return;const s=e.querySelector('[data-icon="history"]'),i=e.querySelector('[data-icon="trending"]'),r=e.querySelector('[data-icon="search"]');s?.classList.toggle("sw-hidden",t!=="history"),i?.classList.toggle("sw-hidden",t!=="trending"),r?.classList.toggle("sw-hidden",t!=="search")}_applyPredictiveIconsAndHistoryTop(){var u,m,f,c;const e=(((u=this.searchInput)==null?void 0:u.value)||"").trim();if(!e)return;const t=(m=this.searchContainer)==null?void 0:m.querySelector('[data-role="predictive_search_wrapper"]');if(!t)return;const s=t.querySelector("ul");if(!s)return;const i=Array.from(s.querySelectorAll("li[data-suggest-item]"));if(!i.length)return;const r=((c=(f=this.history)==null?void 0:f.getAll)==null?void 0:c.call(f))||[],n=e.toLowerCase(),a=r.some(o=>String(o).toLowerCase()===n);if(a){const o=i.find(d=>(d.dataset.keyword||"").toLowerCase()===n);o&&s.prepend(o)}const h=Array.from(s.querySelectorAll("li[data-suggest-item]")),l=a?1:0,g=h.length-l,w=Math.ceil(g/2);h.forEach((o,d)=>{const p=(o.dataset.keyword||"").toLowerCase();if(a&&p===n&&d===0){this._psSetIcon(o,"history");return}const y=d-l;y>=0&&y<w?this._psSetIcon(o,"trending"):this._psSetIcon(o,"search")})}getSearchData(){var e;try{return JSON.parse(((e=document.querySelector('script[type="applicationId/json"][data-id="search-data"]'))==null?void 0:e.innerHTML)||"{}")}catch(t){return console.error("Failed to parse search-data",t),{}}}getPredictiveSearchSuggestions(){var t;return Array.from(((t=this.searchContainer)==null?void 0:t.querySelectorAll('[data-role="predictive_search_wrapper"] [data-role="searchresult-item"]'))||[]).map(s=>{var i,r;return{keyword:((i=s.dataset)==null?void 0:i.keyword)||"",type:((r=s.dataset)==null?void 0:r.suggestionType)||""}}).filter(s=>s.keyword)}getSearchResultProducts(){var t;return Array.from(((t=this.searchContainer)==null?void 0:t.querySelectorAll("product-card"))||[]).map(s=>{var i,r,n,a,h,l,g,w,u,m;return{title:((i=s.dataset)==null?void 0:i.title)||"",id:((r=s.dataset)==null?void 0:r.id)||"",sku:((n=s.dataset)==null?void 0:n.sku)||((a=s.dataset)==null?void 0:a.variantSku)||"",variantTitle:((h=s.dataset)==null?void 0:h.variantTitle)||"",variantId:((l=s.dataset)==null?void 0:l.variantId)||"",inventory:((g=s.dataset)==null?void 0:g.inventory)||"",price:((w=s.dataset)==null?void 0:w.price)||"",comparePrice:((u=s.dataset)==null?void 0:u.comparePrice)||"",href:((m=s.querySelector("a"))==null?void 0:m.getAttribute("href"))||""}})}normalizeMoney(e){if(e==null||e==="")return 0;const t=Number(e);if(Number.isNaN(t))return 0;const s=t/100;return Number.isInteger(s)?s:Number(s.toFixed(2))}pushKeywordSearchedEvent(e=""){var h;const t=(e||"").trim();if(!t||this._lastTrackedKeyword&&this._lastTrackedKeyword.toLowerCase()===t.toLowerCase())return;const s=(h=this.searchContainer)==null?void 0:h.querySelector('[data-role="search-count"]'),i=parseInt(s?.textContent||"0",10),r=this.getPredictiveSearchSuggestions(),a=(this.getSearchResultProducts()||[]).slice(0,12).map(l=>({variantId:l.variantId||"",title:l.title||"",sku:l.sku||"",variant:l.variantTitle||"",price:this.normalizeMoney(l.price),mrp:this.normalizeMoney(l.comparePrice),currentInventory:Number(l.inventory)||0}));dataLayer.push({event:window.custom_data_events["search-v2"].events[2].name,page_handle:window.location.pathname,search_input:t,search_suggestions:r,result_count:isNaN(i)?0:i,items:a}),this._lastTrackedKeyword=t,this._lastTrackedKeywordWithResults=t}trackKeywordSearchAfterResults(e=""){var h;const t=(e||"").trim();if(!t)return;const s=(h=this.searchContainer)==null?void 0:h.querySelector('[data-role="search-count"]'),i=parseInt(s?.textContent||"0",10);if(this._lastTrackedKeywordWithResults&&this._lastTrackedKeywordWithResults.toLowerCase()===t.toLowerCase())return;const r=this.getPredictiveSearchSuggestions(),a=(this.getSearchResultProducts()||[]).slice(0,12).map(l=>({variantId:l.variantId||"",title:l.title||"",sku:l.sku||"",variant:l.variantTitle||"",price:this.normalizeMoney(l.price),mrp:this.normalizeMoney(l.comparePrice),currentInventory:Number(l.inventory)||0}));dataLayer.push({event:window.custom_data_events["search-v2"].events[2].name,page_handle:window.location.pathname,search_input:t,search_suggestions:r,result_count:isNaN(i)?0:i,items:a}),this._lastTrackedKeywordWithResults=t,this._lastTrackedKeyword=t}pushTrendingSearchClickedEvent(e=""){const t=(e||"").trim();if(!t)return;const i=(this.getSearchResultProducts()||[]).slice(0,12).map(r=>({variantId:r.variantId||"",title:r.title||"",sku:r.sku||"",variant:r.variantTitle||"",price:this.normalizeMoney(r.price),mrp:this.normalizeMoney(r.comparePrice),currentInventory:Number(r.inventory)||0}));dataLayer.push({event:window.custom_data_events["search-v2"].events[3].name,page_handle:window.location.pathname,clicked_input:t,items:i})}pushSearchHistoryRemoveEvent(e=""){const t=(e||"").trim();t&&dataLayer.push({event:window.custom_data_events["search-v2"].events[4].name,page_handle:window.location.pathname,keyword:t})}pushSearchDropdownClickEvent(e=""){const t=(e||"").trim();t&&dataLayer.push({event:window.custom_data_events["search-v2"].events[5].name,page_handle:window.location.pathname,search_values:t})}pushBackButtonClickEvent(){dataLayer.push({event:window.custom_data_events["search-v2"].events[6].name,page_handle:window.location.pathname})}pushClearButtonClickEvent(){dataLayer.push({event:window.custom_data_events["search-v2"].events[7].name,page_handle:window.location.pathname})}}customElements.define("predective-search",ct);const q=document.querySelector('[data-role="mobile-search-wrapper"]'),K=q?.querySelector('[for="search-input"]'),F=q?.querySelector('[data-role="search-close"]'),U=document.querySelector('[data-role="nav-display"]'),Y=document.querySelector('[data-role="nav-hide"]'),et=document.body;U?.addEventListener("click",()=>{et.classList.add("menu-open")}),Y?.addEventListener("click",()=>{et.classList.remove("menu-open")});function ht(){q?.classList.add("expand-search")}K?.addEventListener("click",function(v){v.preventDefault(),v.stopPropagation(),window.scrollY===0&&window.scrollBy({top:100,behavior:"smooth"}),ht()}),F?.addEventListener("click",function(v){}),document.addEventListener("click",function(v){q!=null&&q.classList.contains("expand-search")&&q.contains(v.target)}),document.addEventListener("click",v=>{if(v.target.dataset.role=="circular-logo-link"||v.target.closest('[data-role="circular-logo-link"]')){v.preventDefault();let t=(v.target.dataset.role=="circular-logo-link"?v.target:v.target.closest('[data-role="circular-logo-link"]')).getAttribute("href");dataLayer.push({event:window.custom_data_events.logo_list.events[0].name,link:t}),window.location.href=t}}),(function(){try{if(!/^\/products\/[^\/]+/i.test(window.location.pathname))return;const e=new URL(window.location.href);if(![...e.searchParams.keys()].length)return;const t=["pr_prod_strat","pr_rec_id","pr_rec_pid","pr_ref_pid","pr_seq","pr_id","pr_ref_id","utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid"];let s=!1;if(t.forEach(i=>
37{e.searchParams.has(i)&&(e.searchParams.delete(i),s=!0)}),s){const i=e.pathname+(e.searchParams.toString()?`?${e.searchParams.toString()}`:"")+e.hash;window.history.replaceState({},"",i)}}catch{}})();class lt extends HTMLElement{connectedCallback(){this.STORAGE_KEY="recently_viewed_products",this.MAX=Number(this.dataset.limit)||10,this.HIDE_CURRENT=(this.dataset.hideCurrent??"true")!=="false";const e=this.getHandleFromPath(window.location.pathname);e&&this.saveHandle(e),this.render()}getHandleFromPath(e){const t=e.match(/^\/products\/([^\/\?#]+)/);return t?decodeURIComponent(t[1]):null}getList(){try{const e=localStorage.getItem(this.STORAGE_KEY),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}}setList(e){localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e))}saveHandle(e){const t=this.getList(),s=[e,...t.filter(i=>i!==e)];this.setList(s.slice(0,this.MAX))}showLoader(e){const t=this.querySelector("[role='status']");t&&(t.style.display=e?"":"none")}async fetchCardHTML(e){try{const t=`/products/${e}?section_id=recently-viewed-card`,s=await fetch(t,{credentials:"same-origin"});if(s.status===404)return{html:"",invalid:!0};if(!s.ok)return{html:"",invalid:!1};const i=(await s.text()).trim(),n=new DOMParser().parseFromString(i,"text/html").querySelector("#shopify-section-recently-viewed-card");return{html:n?n.innerHTML.trim():"",invalid:!1}}catch{return{html:"",invalid:!1}}}async render(){const e=this.querySelector('[data-role="recently-viewed-items"]');if(!e)return;let t=this.getList();if(!t.length){this.remove();return}const s=this.getHandleFromPath(window.location.pathname);if(this.HIDE_CURRENT&&s&&t.length>1&&(t=t.filter(i=>i!==s)),t=t.slice(0,this.MAX),!t.length){this.remove();return}this.showLoader(!0),e.innerHTML="";try{const i=await Promise.all(t.map(l=>this.fetchCardHTML(l))),r=[],n=[];if(i.forEach((l,g)=>{l.html&&r.push(l.html),l.invalid&&n.push(t[g])}),n.length){const g=this.getList().filter(w=>!n.includes(w));this.setList(g)}if(!r.length){this.remove();return}let a=[];for(let l=0;l<r.length;l++){const g=r[l],m=new DOMParser().parseFromString(g,"text/html").querySelector('script[type="applicationId/json"][data-id="productCard-data"]');if(m)try{const f=JSON.parse(m.innerHTML||"{}");a.push(f)}catch{}}const h=document.querySelector('script[type="applicationId/json"][data-id="search-data"]');if(h)try{const l=JSON.parse(h.innerHTML||"{}");l.previously_bought=a,h.innerHTML=JSON.stringify(l)}catch{}e.innerHTML=r.join("")}catch(i){console.warn("[RecentlyViews] render failed",i),this.remove();return}finally{this.showLoader(!1)}}}customElements.define("recently-views",lt),(function(){const e=".custom-scroll-horizontal, .custom-scroll-horizontal-card";function t(r){if(!r||r.dataset.fakeScrollbar==="1")return;r.dataset.fakeScrollbar="1",r.classList.add("sw-has-fake-scrollbar");const n=document.createElement("div");n.className="sw-fake-scrollbar";const a=document.createElement("div");a.className="sw-fake-thumb",n.appendChild(a),r.insertAdjacentElement("afterend",n);const h=()=>{const o=r.scrollWidth-r.clientWidth;if(o<=0){n.style.display="none";return}n.style.display="block";const d=r.clientWidth/r.scrollWidth,p=n.clientWidth||1,y=Math.max(24,Math.floor(p*d));a.style.width=y+"px";const _=r.scrollLeft/o,S=p-y,b=Math.max(0,Math.min(S,Math.floor(S*_)));a.style.transform=`translateX(${b}px)`};let l=!1,g=0,w=0;const u=o=>{l=!0,g=o.touches?o.touches[0].clientX:o.clientX,w=r.scrollLeft,o.preventDefault()},m=o=>{if(!l)return;const p=(o.touches?o.touches[0].clientX:o.clientX)-g,y=r.scrollWidth-r.clientWidth,_=n.clientWidth||1,S=a.offsetWidth||24,b=Math.max(1,_-S),E=p/b*y;r.scrollLeft=w+E},f=()=>{l=!1};a.addEventListener("mousedown",u),a.addEventListener("touchstart",u,{passive:!1}),window.addEventListener("mousemove",m,{passive:!0}),window.addEventListener("touchmove",m,{passive:!0}),window.addEventListener("mouseup",f),window.addEventListener("touchend",f),h(),r.addEventListener("scroll",h,{passive:!0}),window.addEventListener("resize",h,{passive:!0}),new ResizeObserver(()=>h()).observe(r),setTimeout(h,200),setTimeout(h,800)}function s(r=document){r.querySelectorAll(e).forEach(t)}s(),document.addEventListener("shopify:section:load",()=>s()),document.addEventListener("shopify:section:reorder",()=>s()),document.addEventListener("shopify:section:select",()=>s()),new MutationObserver(r=>
37{for(const n of r)n.addedNodes&&n.addedNodes.forEach(a=>{var h,l;a instanceof HTMLElement&&((h=a.matches)!=null&&h.call(a,e)&&t(a),(l=a.querySelectorAll)==null||l.call(a,e).forEach(t))})}).observe(document.documentElement,{childList:!0,subtree:!0})})(),window.getGASessionId=async()=>new Promise((e,t)=>{gtag("get","G-N71XHS094H","session_id",s=>e(s))});class dt extends HTMLElement{constructor(){var t,s,i,r,n,a,h,l,g,w;super(),this.tabsButton=Array.from(this.querySelectorAll('[data-role="open-close-tabs"]')),this.moreButton=this.querySelector('[data-role="more-btn"]'),this.moreMenuLinks=this.querySelectorAll('[data-role="more-menu-link"]'),this.closeBtn=this.querySelector('[data-role="close-btn"'),this.navWrapper=this.querySelector('[data-role="custom-mobile-nav"]'),this.bodyWrapper=this.querySelector('[data="body-content-wrapper"]'),this.headerLoginTop=this.querySelector('[data-role="header-login-top"]'),this.myAccount=this.querySelector('[data-role="header-my-account"]'),this.swissWallet=this.querySelector('[data-role="swiss-wallet"]'),this.trackMyOrder=this.querySelector('[data-role="track-my-order"]'),this.contactUs=this.querySelector('[data-role="contact-us"]'),this.offerSliderImages=this.querySelectorAll('[data-role="offer-slider-cta"]'),this.menuTitle=this.querySelectorAll('[data-role="menu-title"'),this.expandedMenuLinks=this.querySelectorAll('[data-role="expanded-menu-links"]'),this.instagram=this.querySelector('[data-role="social-instagram"]'),this.facebook=this.querySelector('[data-role="social-facebook"]'),this.youtube=this.querySelector('[data-role="social-youtube"]'),this.twitter=this.querySelector('[data-role="social-twitter"]'),this.linkedin=this.querySelector('[data-role="social-linkedin"]');const e=()=>{var u;(u=this.navWrapper)==null||u.classList.remove("!sw-left-0"),document.body.style.overflow="",document.body.classList.remove("menu-open");try{sessionStorage.removeItem("sw_reopen_mobile_nav"),sessionStorage.removeItem("sw_reopen_mobile_nav_ts")}catch{}};this.tabsButton.forEach(u=>{u.addEventListener("click",()=>{var d,p;this.submenu=u.querySelector('[data-role="submenu-wrapper"]');const m=u.querySelector('[data-role="plus-icon"]'),f=u.querySelector('[data-role="minus-icon"]'),c=u.querySelector('[data-role="tab-class"]'),o=u.querySelector('[data-role="active-link"]');(d=this.submenu)==null||d.classList.toggle("active"),(p=this.submenu)!=null&&p.classList.contains("active")?(m?.classList.add("sw-hidden"),f?.classList.remove("sw-hidden"),c?.classList.add("sw-bg-[#fdf3f7]"),o?.classList.add("sw-text-[#FC2679]")):(m?.classList.remove("sw-hidden"),f?.classList.add("sw-hidden"),c?.classList.remove("sw-bg-[#fdf3f7]"),o?.classList.remove("sw-text-[#FC2679]"))})}),(t=this.moreButton)==null||t.addEventListener("click",()=>{var d,p;const u=this.querySelector('[data-role="more-sublinks"]'),m=(d=this.moreButton)==null?void 0:d.querySelector('[data-role="plus-icon"]'),f=(p=this.moreButton)==null?void 0:p.querySelector('[data-role="minus-icon"]'),c=this.querySelector('[data-role="more-active-link"]');u?.classList.toggle("active");const o=u?.classList.contains("active");o&&dataLayer.push({events:"more_menu_expand",page_handle:window.location.pathname}),o?(m?.classList.add("sw-hidden"),f?.classList.remove("sw-hidden"),c?.classList.add("sw-text-[#FC2679]")):(m?.classList.remove("sw-hidden"),f?.classList.add("sw-hidden"),c?.classList.remove("sw-text-[#FC2679]")),setTimeout(()=>{this.bodyWrapper.scrollTo({top:this.moreButton.offsetTop-80,behavior:"smooth"})},150)}),this.moreMenuLinks.forEach((u,m)=>{u.addEventListener("click",()=>{e(),dataLayer.push({event:"more_submenu_clicked",page_handle:window.location.pathname,link_title:u.textContent.trim(),position:m+1,link:u.getAttribute("href")})})}),(s=this.closeBtn)==null||s.addEventListener("click",()=>{e(),dataLayer.push({event:window.custom_data_events.header.events[2].name,page_handle:window.location.pathname})}),(i=this.headerLoginTop)==null||i.addEventListener("click",u=>{if(typeof window.handleKpAndShopifyLogin!="function")return;u.preventDefault();const m=window.location.pathname+window.location.search;try{sessionStorage.setItem("sw_reopen_mobile_nav","true"),sessionStorage.setItem("sw_reopen_mobile_nav_ts",String(Date.now()))}catch{}this.markLoginAttemptPending(),dataLayer.push({event:window.custom_data_events.header.events[3].name,page_handle:window.location.pathname}),window.handleKpAndShopifyLogin(m)}),(r=this.myAccount)==null||r.addEventListener("click",u=>{const m=this.myAccount.dataset.guest==="true";dataLayer.push({event:window.custom_data_events.header.events[3].name,page_handle:window.location.pathname}),m&&typeof window.handleKpAndShopifyLogin=="function"&&(u.preventDefault(),this.markLoginAttemptPending(),window.handleKpAndShopifyLogin(`${window.Shopify.routes.root}account`))}),(n=this.swissWallet)==null||n.addEventListener("click",u=>{const m=!!this.swissWallet.dataset.customer;dataLayer.push({event:window.custom_data_events.header.events[4].name}),!m&&typeof window.handleKpAndShopifyLogin=="function"&&(u.preventDefault(),this.markLoginAttemptPending(),window.handleKpAndShopifyLogin(`${window.Shopify.routes.root}pages/wallet`))}),this.trackMyOrder.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[5].name})}),this.contactUs.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[6].name})}
37),[...this.offerSliderImages].forEach((u,m)=>u.addEventListener("click",()=>{const f=u.getAttribute("href")||"";f&&(console.log(u),dataLayer.push({event:"offer_slider_clicked",link:f,position:m+1}))})),this.menuTitle.forEach((u,m)=>{u.addEventListener("click",()=>{const f=u.closest("li"),c=!!(f!=null&&f.querySelector('[data-role="submenu-wrapper"]'));dataLayer.push({event:c?"menu_expand_clicked":"menu_title_clicked",page_handle:window.location.pathname,position:m+1,menu_title:u.textContent.trim()})})}),this.expandedMenuLinks.forEach((u,m)=>{u.addEventListener("click",()=>{var d;e();const f=u.closest('[data-role="submenu-wrapper"]'),c=f?.closest("li"),o=((d=c?.querySelector('[data-role="menu-title"]'))==null?void 0:d.textContent.trim())||"";dataLayer.push({event:"submenu_clicked",page_handle:window.location.pathname,parent_name:o,submenu_title:u.textContent.trim(),submenu_position:m+1,link:u.getAttribute("href")})})}),(a=this.instagram)==null||a.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[7].name,page_handle:window.location.pathname})}),(h=this.youtube)==null||h.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[8].name,page_handle:window.location.pathname})}),(l=this.linkedin)==null||l.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[9].name,page_handle:window.location.pathname})}),(g=this.twitter)==null||g.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[10].name,page_handle:window.location.pathname})}),(w=this.facebook)==null||w.addEventListener("click",()=>{dataLayer.push({event:window.custom_data_events.header.events[11].name,page_handle:window.location.pathname})})}markLoginAttemptPending(){try{sessionStorage.setItem("sw_login_attempt_pending","true"),sessionStorage.setItem("sw_login_attempt_ts",String(Date.now()))}catch{}}}customElements.define("mobile-nav",dt),(function(){try{const e=sessionStorage.getItem("sw_reopen_mobile_nav")==="true",t=Number(sessionStorage.getItem("sw_reopen_mobile_nav_ts")||0),s=t&&Date.now()-t<6e5;
37if(sessionStorage.removeItem("sw_reopen_mobile_nav"),sessionStorage.removeItem("sw_reopen_mobile_nav_ts"),!e||!s)return;const i=()=>{var r;(r=document.querySelector('[data-role="nav-display"]'))==null||r.click()};document.readyState==="complete"?requestAnimationFrame(i):window.addEventListener("load",()=>{requestAnimationFrame(i)})}catch{}})(),(function(){try{const e=sessionStorage.getItem("sw_login_attempt_pending")==="true",t=Number(sessionStorage.getItem("sw_login_attempt_ts")||0),s=t&&Date.now()-t<6e5;if(sessionStorage.removeItem("sw_login_attempt_pending"),sessionStorage.removeItem("sw_login_attempt_ts"),!e||!s)return;const i=()=>{var n,a,h;((n=window.Shopify)!=null&&n.customer||((h=(a=document.querySelector('[data-role="header-my-account"]'))==null?void 0:a.dataset)==null?void 0:h.guest)==="false")&&dataLayer.push({event:window.custom_data_events.header.events[12].name,page_handle:window.location.pathname})};document.readyState==="complete"?requestAnimationFrame(i):window.addEventListener("load",()=>{requestAnimationFrame(i)})}catch{}})();
38//# sourceMappingURL=/cdn/shop/t/62/assets/header-v2-BEEwuiEx.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.