const appendFileToHead=function(i,s,o,g,r,a,m){a=s.createElement(o),m=s.getElementsByTagName(o)[0],a.type=g.blob.type.split(";")[0].trim(),a.appendChild(s.createTextNode(g.text)),a.onload=r(g),m?m.parentNode.insertBefore(a,m):s.head.appendChild(a)};function fetchInject(inputs,promise){if(!(inputs&&Array.isArray(inputs)))return Promise.reject(new Error("`inputs` must be an array"));if(promise&&!(promise instanceof Promise))return Promise.reject(new Error("`promise` must be a promise"));const resources=[],deferreds=promise?[].concat(promise):[],thenables=[];return inputs.forEach(input=>deferreds.push(window.fetch(input).then(res=>[res.clone().text(),res.blob()]).then(promises=>Promise.all(promises).then(resolved=>{resources.push({text:resolved[0],blob:resolved[1]})})))),Promise.all(deferreds).then(()=>(resources.forEach(resource=>{thenables.push({then:resolve=>{resource.blob.type.split(";")[0].trim()==="text/css"?appendFileToHead(window,document,"style",resource,resolve):appendFileToHead(window,document,"script",resource,resolve)}})}),Promise.all(thenables)))}function loadScript(url){return new Promise((resolve,reject)=>{let script=document.createElement("script");script.type="text/javascript",script.src=url,script.addEventListener("load",()=>resolve(script),!1),script.addEventListener("error",()=>reject(script),!1),document.body.appendChild(script)})}window.customElements.define("loess-3d-model",class extends HTMLElement{async connectedCallback(){await fetchInject([window.LoessTheme.styles.modelViewerUiStyles]),Shopify.loadFeatures([{name:"shopify-xr",version:"1.0",onLoad:this.setupShopifyXR.bind(this)},{name:"model-viewer-ui",version:"1.0",onLoad:()=>{this.modelViewerUI=new Shopify.ModelViewerUI(this.querySelector("model-viewer"))}}])}disconnectedCallback(){var _this$modelViewerUI;(_this$modelViewerUI=this.modelViewerUI)===null||_this$modelViewerUI===void 0||_this$modelViewerUI.destroy()}setupShopifyXR(errors){if(!errors){if(!window.ShopifyXR){document.addEventListener("shopify_xr_initialized",()=>this.setupShopifyXR());return}document.querySelectorAll('[id^="ProductJSON-"]').forEach(modelJSON=>{window.ShopifyXR.addModels(JSON.parse(modelJSON.textContent)),modelJSON.remove()}),window.ShopifyXR.setupXRElements()}}play(){var _this$modelViewerUI2;(_this$modelViewerUI2=this.modelViewerUI)===null||_this$modelViewerUI2===void 0||_this$modelViewerUI2.play()}pause(){var _this$modelViewerUI3;(_this$modelViewerUI3=this.modelViewerUI)===null||_this$modelViewerUI3===void 0||_this$modelViewerUI3.pause()}});class Button extends HTMLButtonElement{constructor(){super(),this.addEventListener("click",this._onClick.bind(this))}static get observedAttributes(){return["aria-expanded"]}attributeChangedCallback(name,oldValue,newValue){oldValue==="false"&&newValue==="true"?this.target.open=!0:oldValue==="true"&&newValue==="false"&&(this.target.open=!1)}connectedCallback(){this.handleState=this._handleState.bind(this),document.addEventListener("expandable-html-element:open",this.handleState),document.addEventListener("expandable-html-element:close",this.handleState)}disconnectedCallback(){document.removeEventListener("expandable-html-element:open",this.handleState),document.removeEventListener("expandable-html-element:close",this.handleState)}_handleState(event){this.target===event.target&&(event.stopPropagation(),event.type=="expandable-html-element:open"?(this.expanded=!0,this.targetFocus&&this.targetFocus.focus()):this.expanded=!1)}get expanded(){return this.getAttribute("aria-expanded")==="true"}set expanded(value){this.setAttribute("aria-expanded",String(value))}get target(){return document.getElementById(this.getAttribute("aria-controls"))}get targetFocus(){return document.getElementById(this.getAttribute("target-focus"))}_onClick(){this.expanded=!this.expanded}}window.customElements.define("loess-button",Button,{extends:"button"});function debounce(func,timeout=300){let timer;return(...args)=>{clearTimeout(timer),timer=setTimeout(()=>{func.apply(this,args)},timeout)}}function fetchConfig(type="json"){return{method:"POST",headers:{"Content-Type":"application/json",Accept:`application/${type}`}}}customElements.define("loess-cart-notes",class extends HTMLTextAreaElement{constructor(){super(),this.addEventListener("input",debounce(event=>{const body=JSON.stringify({note:event.target.value});fetch(`${window.LoessTheme.routes.cart_update_url}`,{...fetchConfig(),body})}))}},{extends:"textarea"}),customElements.define("loess-cart-remove-button",class extends HTMLElement{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault(),(this.closest("loess-cart-items")||this.closest("loess-cart-drawer-items")).updateQuantity(this.dataset.index,0)},{once:!0})}});const CartItems=class extends HTMLElement{constructor(){super(),this.currentItemCount=Array.from(this.querySelectorAll('[name="updates[]"]')).reduce((total,quantityInput)=>total+parseInt(quantityInput.value),0),this.debouncedOnChange=debounce(event=>{event.target.name!=="note"&&this.onChange(event)}),this.addEventListener("change",this.debouncedOnChange.bind(this))}onChange(event){this.updateQuantity(event.target.dataset.index,event.target.value,document.activeElement.getAttribute("name"))}getSectionsToRender(){return[{id:"MainCartItems",section:document.getElementById("MainCartItems").dataset.id,selector:".cart-items"},{id:"MainCartItems",section:document.getElementById("MainCartItems").dataset.id,selector:".cart-payment-terms"},{id:"CartTotalPrice",section:"cart-total-price",selector:".shopify-section"},{id:"HeaderCartIcon",section:"header-cart-icon",selector:".shopify-section"},{id:"FreeShippingTextMobile",section:"free-shipping-text",selector:".shopify-section"},{id:"FreeShippingTextLarge",section:"free-shipping-text",selector:".shopify-section"}]}updateQuantity(line,quantity,name){var _document$querySelect;this.enableLoading(line),(_document$querySelect=document.querySelector(".cart-errors"))===null||_document$querySelect===void 0||_document$querySelect.classList.remove("cart-errors--visible");const body=JSON.stringify({line,quantity,sections:this.getSectionsToRender().map(section=>section.section),sections_url:window.location.pathname});fetch(`${window.LoessTheme.routes.cart_change_url}`,{...fetchConfig(),body}).then(response=>response.json()).then(state=>{this.renderCartItems(state),this.disableLoading()}).catch(()=>{this.querySelectorAll(".loading-overlay").forEach(overlay=>overlay.classList.add("hidden")),document.querySelector(".cart-errors").classList.add("cart-errors--visible"),document.querySelector(".cart-errors > span").textContent=window.LoessTheme.cartStrings.error,this.disableLoading()})}renderCartItems(state){var _this$parentElement$n;const parsedState=state;this.classList.toggle("is-empty",parsedState.item_count===0),(_this$parentElement$n=this.parentElement.nextElementSibling)===null||_this$parentElement$n===void 0||_this$parentElement$n.classList.toggle("hide",parsedState.item_count===0),this.renderHTML(parsedState),this.dispatchCartUpdatedEvent(parsedState)}renderHTML(parsedState){this.getSectionsToRender().forEach(section=>{var _document$getElementB;const elementToReplace=((_document$getElementB=document.getElementById(section.id))===null||_document$getElementB===void 0?void 0:_document$getElementB.querySelector(section.selector))||document.getElementById(section.id);if(!elementToReplace)return;const parsedHTML=new DOMParser().parseFromString(parsedState.sections[section.section],"text/html").querySelector(section.selector);parsedHTML&&(elementToReplace.innerHTML=parsedHTML.innerHTML)})}dispatchCartUpdatedEvent(parsedState){document.documentElement.dispatchEvent(new CustomEvent("cart:updated",{bubbles:!0,detail:{cart:parsedState}}))}updateLiveRegions(line,itemCount){this.currentItemCount===itemCount&&(document.getElementById(`Line-item-error-${line}`).querySelector(".cart-item__error-text").innerHTML=window.LoessTheme.cartStrings.quantityError.replace("[quantity]",document.getElementById(`Quantity-${line}`).value)),this.currentItemCount=itemCount;const cartStatus=document.getElementById("cart-live-region-text");cartStatus.setAttribute("aria-hidden",!1),setTimeout(()=>{cartStatus.setAttribute("aria-hidden",!0)},1e3)}enableLoading(line){document.getElementById("MainCartItems").classList.add("cart__items--disabled"),this.querySelectorAll(`#CartItem-${line} .loading-overlay`).forEach(overlay=>overlay.classList.remove("hidden")),document.activeElement.blur()}disableLoading(){document.getElementById("MainCartItems").classList.remove("cart__items--disabled")}};customElements.define("loess-cart-items",CartItems);const CartDrawerItems=class extends CartItems{getSectionsToRender(){return[{id:"MainCartItems",section:"cart-drawer-items",selector:".cart-items"},{id:"HeaderCartIcon",section:"header-cart-icon",selector:".shopify-section"},{id:"FreeShippingText",section:"free-shipping-text",selector:".shopify-section"},{id:"CartDrawerTotalPrice",section:"cart-total-price",selector:".shopify-section"}]}};customElements.define("loess-cart-drawer-items",CartDrawerItems);const CartNotification=class extends CartItems{renderCartItems(state){this.cartItemKey=state.key,this.renderHTML(state),this.dispatchCartUpdatedEvent(state)}getSectionsToRender(){return[{id:"HeaderCartIcon",section:"header-cart-icon",selector:".shopify-section"},{id:"CartNotificationButton",section:"cart-notification-button",selector:".shopify-section"},{id:"CartNotificationProduct",section:"cart-notification-product",selector:`[id="CartNotificationProduct-${this.cartItemKey}"]`},{id:"FreeShippingText",section:"free-shipping-text",selector:".shopify-section"}]}};customElements.define("loess-cart-notification",CartNotification),window.customElements.define("loess-cart-drawer-checkout",class extends HTMLElement{constructor(){super(),this.parentElement.addEventListener("click",this.redirect.bind(this))}redirect(){this.parentElement.nextElementSibling.classList.remove("hide"),this.parentElement.remove()}}),window.customElements.define("loess-cart-recommendations",class extends HTMLElement{constructor(){super(),this.productId&&this.initProductRecommendations()}connectedCallback(){document.documentElement.addEventListener("cart:updated",event=>{this.updateProductId(event),this.initProductRecommendations()})}async initProductRecommendations(){const text=await(await fetch(this.buildQueryString())).text();this.injectHTMLResponse(text)}updateProductId(event){var _event$detail$cart$it;this.setAttribute("product-id",event.detail.cart.product_id||((_event$detail$cart$it=event.detail.cart.items[0])===null||_event$detail$cart$it===void 0?void 0:_event$detail$cart$it.product_id)||this.productId)}buildQueryString(){return`${window.LoessTheme.routes.product_recommendations_url}?section_id=cart-drawer-recommendations&product_id=${this.productId}&limit=${this.limit}`}injectHTMLResponse(text){const div=document.createElement("div");div.innerHTML=text;const productRecommendations=div.querySelector(".shopify-section");if(productRecommendations&&productRecommendations.innerHTML.trim().length){var _this$querySelector;(_this$querySelector=this.querySelector("ul"))===null||_this$querySelector===void 0||_this$querySelector.remove(),this.insertAdjacentHTML("beforeend",productRecommendations.innerHTML)}}get productId(){return this.getAttribute("product-id")}get limit(){return this.getAttribute("limit")}});const StickyScrollMixin={setupStickyScroll(element){this.getInitialValues(element),this.checkPosition=this.checkPosition.bind(this),window.addEventListener("scroll",this.checkPosition)},destroyStickyScroll(){window.removeEventListener("scroll",this.checkPosition)},getInitialValues(element){this.element=element,this.lastKnownY=window.scrollY,this.currentTop=0,this.pendingRaf=!1,this.stickyHeaderOffset=this.getStickyHeaderOffset()},checkPosition(){this.pendingRaf||(this.pendingRaf=!0,requestAnimationFrame(()=>{const{top}=this.element.getBoundingClientRect(),maxTop=top+window.scrollY-this.element.offsetTop+this.getTopOffset(),minTop=this.element.clientHeight-window.innerHeight+30;window.scrollYsummary:first-of-type","details"],candidateSelector=candidateSelectors.join(","),NoElement=typeof Element>"u",matches=NoElement?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,getRootNode=!NoElement&&Element.prototype.getRootNode?function(element){return element.getRootNode()}:function(element){return element.ownerDocument},getCandidates=function(el,includeContainer,filter){var candidates=Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));return includeContainer&&matches.call(el,candidateSelector)&&candidates.unshift(el),candidates=candidates.filter(filter),candidates},getCandidatesIteratively=function getCandidatesIteratively2(elements,includeContainer,options){for(var candidates=[],elementsToCheck=Array.from(elements);elementsToCheck.length;){var element=elementsToCheck.shift();if(element.tagName==="SLOT"){var assigned=element.assignedElements(),content=assigned.length?assigned:element.children,nestedCandidates=getCandidatesIteratively2(content,!0,options);options.flatten?candidates.push.apply(candidates,nestedCandidates):candidates.push({scope:element,candidates:nestedCandidates})}else{var validCandidate=matches.call(element,candidateSelector);validCandidate&&options.filter(element)&&(includeContainer||!elements.includes(element))&&candidates.push(element);var shadowRoot=element.shadowRoot||typeof options.getShadowRoot=="function"&&options.getShadowRoot(element),validShadowRoot=!options.shadowRootFilter||options.shadowRootFilter(element);if(shadowRoot&&validShadowRoot){var _nestedCandidates=getCandidatesIteratively2(shadowRoot===!0?element.children:shadowRoot.children,!0,options);options.flatten?candidates.push.apply(candidates,_nestedCandidates):candidates.push({scope:element,candidates:_nestedCandidates})}else elementsToCheck.unshift.apply(elementsToCheck,element.children)}}return candidates},getTabindex=function(node,isScope){return node.tabIndex<0&&(isScope||/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName)||node.isContentEditable)&&isNaN(parseInt(node.getAttribute("tabindex"),10))?0:node.tabIndex},sortOrderedTabbables=function(a,b){return a.tabIndex===b.tabIndex?a.documentOrder-b.documentOrder:a.tabIndex-b.tabIndex},isInput=function(node){return node.tagName==="INPUT"},isHiddenInput=function(node){return isInput(node)&&node.type==="hidden"},isDetailsWithSummary=function(node){var r=node.tagName==="DETAILS"&&Array.prototype.slice.apply(node.children).some(function(child){return child.tagName==="SUMMARY"});return r},getCheckedRadio=function(nodes,form){for(var i=0;isummary:first-of-type"),nodeUnderDetails=isDirectSummary?node.parentElement:node;if(matches.call(nodeUnderDetails,"details:not([open]) *"))return!0;var nodeRootHost=getRootNode(node).host,nodeIsAttached=nodeRootHost?.ownerDocument.contains(nodeRootHost)||node.ownerDocument.contains(node);if(!displayCheck||displayCheck==="full"){if(typeof getShadowRoot=="function"){for(var originalNode=node;node;){var parentElement=node.parentElement,rootNode=getRootNode(node);if(parentElement&&!parentElement.shadowRoot&&getShadowRoot(parentElement)===!0)return isZeroArea(node);node.assignedSlot?node=node.assignedSlot:!parentElement&&rootNode!==node.ownerDocument?node=rootNode.host:node=parentElement}node=originalNode}if(nodeIsAttached)return!node.getClientRects().length}else if(displayCheck==="non-zero-area")return isZeroArea(node);return!1},isDisabledFromFieldset=function(node){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName))for(var parentNode=node.parentElement;parentNode;){if(parentNode.tagName==="FIELDSET"&&parentNode.disabled){for(var i=0;i=0)},sortByOrder=function sortByOrder2(candidates){var regularTabbables=[],orderedTabbables=[];return candidates.forEach(function(item,i){var isScope=!!item.scope,element=isScope?item.scope:item,candidateTabindex=getTabindex(element,isScope),elements=isScope?sortByOrder2(item.candidates):element;candidateTabindex===0?isScope?regularTabbables.push.apply(regularTabbables,elements):regularTabbables.push(element):orderedTabbables.push({documentOrder:i,tabIndex:candidateTabindex,item,isScope,content:elements})}),orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc,sortable){return sortable.isScope?acc.push.apply(acc,sortable.content):acc.push(sortable.content),acc},[]).concat(regularTabbables)},tabbable=function(el,options){options=options||{};var candidates;return options.getShadowRoot?candidates=getCandidatesIteratively([el],options.includeContainer,{filter:isNodeMatchingSelectorTabbable.bind(null,options),flatten:!1,getShadowRoot:options.getShadowRoot,shadowRootFilter:isValidShadowRootTabbable}):candidates=getCandidates(el,options.includeContainer,isNodeMatchingSelectorTabbable.bind(null,options)),sortByOrder(candidates)},focusable=function(el,options){options=options||{};var candidates;return options.getShadowRoot?candidates=getCandidatesIteratively([el],options.includeContainer,{filter:isNodeMatchingSelectorFocusable.bind(null,options),flatten:!0,getShadowRoot:options.getShadowRoot}):candidates=getCandidates(el,options.includeContainer,isNodeMatchingSelectorFocusable.bind(null,options)),candidates},isTabbable=function(node,options){if(options=options||{},!node)throw new Error("No node provided");return matches.call(node,candidateSelector)===!1?!1:isNodeMatchingSelectorTabbable(options,node)},focusableCandidateSelector=candidateSelectors.concat("iframe").join(","),isFocusable=function(node,options){if(options=options||{},!node)throw new Error("No node provided");return matches.call(node,focusableCandidateSelector)===!1?!1:isNodeMatchingSelectorFocusable(options,node)};/*! * focus-trap 6.9.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE */function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1;i0){var activeTrap=trapQueue[trapQueue.length-1];activeTrap!==trap&&activeTrap.pause()}var trapIndex=trapQueue.indexOf(trap);trapIndex===-1||trapQueue.splice(trapIndex,1),trapQueue.push(trap)},deactivateTrap:function(trap){var trapIndex=trapQueue.indexOf(trap);trapIndex!==-1&&trapQueue.splice(trapIndex,1),trapQueue.length>0&&trapQueue[trapQueue.length-1].unpause()}}}(),isSelectableInput=function(node){return node.tagName&&node.tagName.toLowerCase()==="input"&&typeof node.select=="function"},isEscapeEvent=function(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27},isTabEvent=function(e){return e.key==="Tab"||e.keyCode===9},delay=function(fn){return setTimeout(fn,0)},findIndex=function(arr,fn){var idx=-1;return arr.every(function(value,i){return fn(value)?(idx=i,!1):!0}),idx},valueOrHandler=function(value){for(var _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)params[_key-1]=arguments[_key];return typeof value=="function"?value.apply(void 0,params):value},getActualTarget=function(event){return event.target.shadowRoot&&typeof event.composedPath=="function"?event.composedPath()[0]:event.target},createFocusTrap=function(elements,userOptions){var doc=userOptions?.document||document,config=_objectSpread2({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},userOptions),state={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},trap,getOption=function(configOverrideOptions,optionName,configOptionName){return configOverrideOptions&&configOverrideOptions[optionName]!==void 0?configOverrideOptions[optionName]:config[configOptionName||optionName]},findContainerIndex=function(element){return state.containerGroups.findIndex(function(_ref){var container=_ref.container,tabbableNodes=_ref.tabbableNodes;return container.contains(element)||tabbableNodes.find(function(node){return node===element})})},getNodeForOption=function(optionName){var optionValue=config[optionName];if(typeof optionValue=="function"){for(var _len2=arguments.length,params=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)params[_key2-1]=arguments[_key2];optionValue=optionValue.apply(void 0,params)}if(optionValue===!0&&(optionValue=void 0),!optionValue){if(optionValue===void 0||optionValue===!1)return optionValue;throw new Error("`".concat(optionName,"` was specified but was not a node, or did not return a node"))}var node=optionValue;if(typeof optionValue=="string"&&(node=doc.querySelector(optionValue),!node))throw new Error("`".concat(optionName,"` as selector refers to no known node"));return node},getInitialFocusNode=function(){var node=getNodeForOption("initialFocus");if(node===!1)return!1;if(node===void 0)if(findContainerIndex(doc.activeElement)>=0)node=doc.activeElement;else{var firstTabbableGroup=state.tabbableGroups[0],firstTabbableNode=firstTabbableGroup&&firstTabbableGroup.firstTabbableNode;node=firstTabbableNode||getNodeForOption("fallbackFocus")}if(!node)throw new Error("Your focus-trap needs to have at least one focusable element");return node},updateTabbableNodes=function(){if(state.containerGroups=state.containers.map(function(container){var tabbableNodes=tabbable(container,config.tabbableOptions),focusableNodes=focusable(container,config.tabbableOptions);return{container,tabbableNodes,focusableNodes,firstTabbableNode:tabbableNodes.length>0?tabbableNodes[0]:null,lastTabbableNode:tabbableNodes.length>0?tabbableNodes[tabbableNodes.length-1]:null,nextTabbableNode:function(node){var forward=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,nodeIdx=focusableNodes.findIndex(function(n){return n===node});if(!(nodeIdx<0))return forward?focusableNodes.slice(nodeIdx+1).find(function(n){return isTabbable(n,config.tabbableOptions)}):focusableNodes.slice(0,nodeIdx).reverse().find(function(n){return isTabbable(n,config.tabbableOptions)})}}}),state.tabbableGroups=state.containerGroups.filter(function(group){return group.tabbableNodes.length>0}),state.tabbableGroups.length<=0&&!getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},tryFocus=function tryFocus2(node){if(node!==!1&&node!==doc.activeElement){if(!node||!node.focus){tryFocus2(getInitialFocusNode());return}node.focus({preventScroll:!!config.preventScroll}),state.mostRecentlyFocusedNode=node,isSelectableInput(node)&&node.select()}},getReturnFocusNode=function(previousActiveElement){var node=getNodeForOption("setReturnFocus",previousActiveElement);return node||(node===!1?!1:previousActiveElement)},checkPointerDown=function(e){var target=getActualTarget(e);if(!(findContainerIndex(target)>=0)){if(valueOrHandler(config.clickOutsideDeactivates,e)){trap.deactivate({returnFocus:config.returnFocusOnDeactivate&&!isFocusable(target,config.tabbableOptions)});return}valueOrHandler(config.allowOutsideClick,e)||e.preventDefault()}},checkFocusIn=function(e){var target=getActualTarget(e),targetContained=findContainerIndex(target)>=0;targetContained||target instanceof Document?targetContained&&(state.mostRecentlyFocusedNode=target):(e.stopImmediatePropagation(),tryFocus(state.mostRecentlyFocusedNode||getInitialFocusNode()))},checkTab=function(e){var target=getActualTarget(e);updateTabbableNodes();var destinationNode=null;if(state.tabbableGroups.length>0){var containerIndex=findContainerIndex(target),containerGroup=containerIndex>=0?state.containerGroups[containerIndex]:void 0;if(containerIndex<0)e.shiftKey?destinationNode=state.tabbableGroups[state.tabbableGroups.length-1].lastTabbableNode:destinationNode=state.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var startOfGroupIndex=findIndex(state.tabbableGroups,function(_ref2){var firstTabbableNode=_ref2.firstTabbableNode;return target===firstTabbableNode});if(startOfGroupIndex<0&&(containerGroup.container===target||isFocusable(target,config.tabbableOptions)&&!isTabbable(target,config.tabbableOptions)&&!containerGroup.nextTabbableNode(target,!1))&&(startOfGroupIndex=containerIndex),startOfGroupIndex>=0){var destinationGroupIndex=startOfGroupIndex===0?state.tabbableGroups.length-1:startOfGroupIndex-1,destinationGroup=state.tabbableGroups[destinationGroupIndex];destinationNode=destinationGroup.lastTabbableNode}}else{var lastOfGroupIndex=findIndex(state.tabbableGroups,function(_ref3){var lastTabbableNode=_ref3.lastTabbableNode;return target===lastTabbableNode});if(lastOfGroupIndex<0&&(containerGroup.container===target||isFocusable(target,config.tabbableOptions)&&!isTabbable(target,config.tabbableOptions)&&!containerGroup.nextTabbableNode(target))&&(lastOfGroupIndex=containerIndex),lastOfGroupIndex>=0){var _destinationGroupIndex=lastOfGroupIndex===state.tabbableGroups.length-1?0:lastOfGroupIndex+1,_destinationGroup=state.tabbableGroups[_destinationGroupIndex];destinationNode=_destinationGroup.firstTabbableNode}}}else destinationNode=getNodeForOption("fallbackFocus");destinationNode&&(e.preventDefault(),tryFocus(destinationNode))},checkKey=function(e){if(isEscapeEvent(e)&&valueOrHandler(config.escapeDeactivates,e)!==!1){e.preventDefault(),trap.deactivate();return}if(isTabEvent(e)){checkTab(e);return}},checkClick=function(e){var target=getActualTarget(e);findContainerIndex(target)>=0||valueOrHandler(config.clickOutsideDeactivates,e)||valueOrHandler(config.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},addListeners=function(){if(state.active)return activeFocusTraps.activateTrap(trap),state.delayInitialFocusTimer=config.delayInitialFocus?delay(function(){tryFocus(getInitialFocusNode())}):tryFocus(getInitialFocusNode()),doc.addEventListener("focusin",checkFocusIn,!0),doc.addEventListener("mousedown",checkPointerDown,{capture:!0,passive:!1}),doc.addEventListener("touchstart",checkPointerDown,{capture:!0,passive:!1}),doc.addEventListener("click",checkClick,{capture:!0,passive:!1}),doc.addEventListener("keydown",checkKey,{capture:!0,passive:!1}),trap},removeListeners=function(){if(state.active)return doc.removeEventListener("focusin",checkFocusIn,!0),doc.removeEventListener("mousedown",checkPointerDown,!0),doc.removeEventListener("touchstart",checkPointerDown,!0),doc.removeEventListener("click",checkClick,!0),doc.removeEventListener("keydown",checkKey,!0),trap};return trap={get active(){return state.active},get paused(){return state.paused},activate:function(activateOptions){if(state.active)return this;var onActivate=getOption(activateOptions,"onActivate"),onPostActivate=getOption(activateOptions,"onPostActivate"),checkCanFocusTrap=getOption(activateOptions,"checkCanFocusTrap");checkCanFocusTrap||updateTabbableNodes(),state.active=!0,state.paused=!1,state.nodeFocusedBeforeActivation=doc.activeElement,onActivate&&onActivate();var finishActivation=function(){checkCanFocusTrap&&updateTabbableNodes(),addListeners(),onPostActivate&&onPostActivate()};return checkCanFocusTrap?(checkCanFocusTrap(state.containers.concat()).then(finishActivation,finishActivation),this):(finishActivation(),this)},deactivate:function(deactivateOptions){if(!state.active)return this;var options=_objectSpread2({onDeactivate:config.onDeactivate,onPostDeactivate:config.onPostDeactivate,checkCanReturnFocus:config.checkCanReturnFocus},deactivateOptions);clearTimeout(state.delayInitialFocusTimer),state.delayInitialFocusTimer=void 0,removeListeners(),state.active=!1,state.paused=!1,activeFocusTraps.deactivateTrap(trap);var onDeactivate=getOption(options,"onDeactivate"),onPostDeactivate=getOption(options,"onPostDeactivate"),checkCanReturnFocus=getOption(options,"checkCanReturnFocus"),returnFocus=getOption(options,"returnFocus","returnFocusOnDeactivate");onDeactivate&&onDeactivate();var finishDeactivation=function(){delay(function(){returnFocus&&tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)),onPostDeactivate&&onPostDeactivate()})};return returnFocus&&checkCanReturnFocus?(checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation,finishDeactivation),this):(finishDeactivation(),this)},pause:function(){return state.paused||!state.active?this:(state.paused=!0,removeListeners(),this)},unpause:function(){return!state.paused||!state.active?this:(state.paused=!1,updateTabbableNodes(),addListeners(),this)},updateContainerElements:function(containerElements){var elementsAsArray=[].concat(containerElements).filter(Boolean);return state.containers=elementsAsArray.map(function(element){return typeof element=="string"?doc.querySelector(element):element}),state.active&&updateTabbableNodes(),this}},trap.updateContainerElements(elements),trap};function sendEvent(element,name,data={}){element.dispatchEvent(new CustomEvent(name,{detail:data,bubbles:!0}))}class ExpandableHTMLElement extends HTMLElement{constructor(){super(),this.addEventListener("click",event=>{event.target.hasAttribute("close")&&(event.stopPropagation(),event.target.closest(this.tagName).open=!1)})}static get observedAttributes(){return["open"]}attributeChangedCallback(name,oldValue,newValue){newValue!==null?setTimeout(()=>this.focusTrap.activate(),150):this.focusTrap.deactivate(),this.sendEvent()}get overlay(){return this.hasAttribute("overlay")}get open(){return this.hasAttribute("open")}set open(value){value?this.setAttribute("open",""):this.removeAttribute("open")}get focusTrap(){return this._focusTrap=this._focusTrap||createFocusTrap(this,this.focusTrapOptions)}get focusTrapOptions(){return{allowOutsideClick:event=>event.target.getAttribute("aria-controls")===this.id,clickOutsideDeactivates:event=>event.target.getAttribute("aria-controls")!==this.id,onDeactivate:()=>this.open=!1,...this._focusTrapOptions}}set focusTrapOptions(options){this._focusTrapOptions=options}sendEvent(){sendEvent(this,this.open?"expandable-html-element:open":"expandable-html-element:close")}}class Modal extends ExpandableHTMLElement{constructor(){super(),this.mql=window.matchMedia("(max-width: 751px)"),this.closeButton=this.querySelector(".modal__close-button"),this.addEventListener("click",event=>{this.onClickOverlay(event.target)},!1)}async attributeChangedCallback(name,oldValue,newValue){switch(await this._animate().finished,super.attributeChangedCallback(name,oldValue,newValue),name){case"open":document.documentElement.classList.toggle("scroll-lock",this.open),this.closeButton.style.display="flex";break}}onClickOverlay(target){target===this&&(this.open=!1,this.closeButton.style.display="none")}_animate(){const keyframes={opacity:[0,1],visibility:["hidden","visible"],transform:this.mql.matches||!this.mql.matches&&this.querySelector(".modal__inner").classList.contains("modal__inner--fullscreen")?["translateY(100px)","translateY(0)"]:["translate(-50%, calc(-50% + 100px))","translate(-50%, -50%)"]};return this.querySelector(".modal__inner").animate(keyframes,{duration:150*window.LoessTheme.animations.multiplier,direction:this.open?"normal":"reverse",easing:"cubic-bezier(0.5, 0, 0.175, 1)"})}}window.customElements.define("loess-modal",Modal),window.customElements.define("loess-cart-notification-popup",class extends Modal{_animate(){const keyframes={opacity:[0,1],visibility:["hidden","visible"],transform:["translateY(-10px)","translateY(0)"]};return this.querySelector(".cart-notification").animate(keyframes,{duration:150*window.LoessTheme.animations.multiplier,direction:this.open?"normal":"reverse",easing:"cubic-bezier(0.5, 0, 0.175, 1)"})}}),window.customElements.define("loess-collapsible-panel",class extends ExpandableHTMLElement{constructor(){super(),this.dismissable||(this.focusTrapOptions={fallbackFocus:this,onDeactivate:()=>{}}),this.animationOnInit=this.open||!1}async attributeChangedCallback(name,oldValue,newValue){if(this.animationOnInit){this.animationOnInit=!1;return}await this._animate().finished,super.attributeChangedCallback(name,oldValue,newValue)}_animate(){const keyframes={opacity:[0,1],visibility:["hidden","visible"],height:["0px",`${this.scrollHeight}px`]};return this.animate(keyframes,{duration:150*window.LoessTheme.animations.multiplier,direction:this.open?"normal":"reverse",easing:"cubic-bezier(0.5, 0, 0.175, 1)"})}get dismissable(){return this.hasAttribute("dismissable")}});class Drawer extends ExpandableHTMLElement{constructor(){super(),this.addEventListener("click",event=>{this.onClickOverlay(event.target)},!1)}async attributeChangedCallback(name,oldValue,newValue){switch(await this._animate().finished,super.attributeChangedCallback(name,oldValue,newValue),name){case"open":this.classList.contains("drawer--inner")||document.documentElement.classList.toggle("scroll-lock",this.open);break}}get position(){return this.getAttribute("position")||"left"}onClickOverlay(target){target===this&&(this.open=!1)}_animate(){const keyframes={visibility:["hidden","visible"],transform:this.position=="left"?["translateX(-100%)","translateX(0)"]:["translateX(100%)","translateX(0)"]};return this.animate(keyframes,{duration:150*window.LoessTheme.animations.multiplier,direction:this.open?"normal":"reverse",easing:"cubic-bezier(0.5, 0, 0.175, 1)"})}}window.customElements.define("loess-drawer",Drawer);const LoessFilters=class extends Drawer{constructor(){super(),this.mql=window.matchMedia("(max-width: 990px)"),this.sticky&&(this.mql.addListener(this.setupTabletDrawer.bind(this)),this.setupTabletDrawer(this.mql)),this.sticky&&!this.mql.matches&&this.setupStickyScroll(this),this.addEventListener("click",event=>{event.target.nodeName!=="INPUT"||event.target.type!=="checkbox"||event.target.name.startsWith("filter.")&&this.onFilterChange(event)})}setupTabletDrawer(event){this.classList.toggle("drawer",event.matches)}onFilterChange(event){const formData=new FormData(event.target.closest("form")),searchParams=new URLSearchParams(formData).toString();sendEvent(this,"filters:changed",{searchParams})}get sticky(){return this.hasAttribute("sticky")}};Object.assign(LoessFilters.prototype,StickyScrollMixin),window.customElements.define("loess-filters",LoessFilters),window.customElements.define("loess-filters-toggle",class extends HTMLButtonElement{constructor(){super(),this.isHidden=!0,this.list=this.previousElementSibling,this.listElements=this.list.querySelectorAll(".collection-filter__list-item--hidden"),this.addEventListener("click",this.onClickToggle.bind(this))}onClickToggle(){this.expanded=!this.expanded,this.isHidden=!this.isHidden,this.listElements.forEach(item=>item.toggleAttribute("hidden"))}get expanded(){return this.getAttribute("aria-expanded")==="true"}set expanded(value){this.setAttribute("aria-expanded",String(value))}},{extends:"button"}),window.customElements.define("loess-filters-clear",class extends HTMLAnchorElement{constructor(){super(),this.addEventListener("click",this.onFilterCleared.bind(this))}onFilterCleared(event){event.preventDefault();const url=new URL(this.href),searchParams=new URLSearchParams(url.search).toString();sendEvent(this,"filters:changed",{searchParams})}},{extends:"a"}),window.customElements.define("loess-filters-price",class extends HTMLElement{constructor(){super(),this.rangeInput=this.querySelectorAll(".price-range__range"),this.priceInput=this.querySelectorAll(".price-range__input"),this.range=this.querySelector(".price-slider__progress"),this.priceGap=10,this.priceInput.forEach(input=>{input.addEventListener("input",this.onInputPrice.bind(this)),input.addEventListener("change",this.onChangePrice.bind(this))}),this.rangeInput.forEach(input=>{input.addEventListener("input",this.onInputRange.bind(this)),input.addEventListener("change",this.onChangePrice.bind(this))}),this.range.style.left="0%",this.range.style.right="0%"}onInputPrice(event){const minPrice=parseInt(this.priceInput[0].value),maxPrice=parseInt(this.priceInput[1].value);maxPrice-minPrice>=this.priceGap&&maxPrice<=this.rangeInput[1].max&&(event.target.hasAttribute("input-min")?(this.rangeInput[0].value=minPrice,this.range.style.left=minPrice/this.rangeInput[0].max*100+"%"):(this.rangeInput[1].value=maxPrice,this.range.style.right=100-maxPrice/this.rangeInput[1].max*100+"%"))}onInputRange(event){const minVal=parseInt(this.rangeInput[0].value),maxVal=parseInt(this.rangeInput[1].value);maxVal-minValinput.name===checkboxPropertyName),this.recipientOtherProperties=properties.filter(input=>input.name!==checkboxPropertyName),this.recipientFieldsContainer=this.querySelector(".gift-card-recipient__fields"),(_this$recipientCheckb=this.recipientCheckbox)===null||_this$recipientCheckb===void 0||_this$recipientCheckb.addEventListener("change",this.synchronizeProperties.bind(this)),this.synchronizeProperties()}synchronizeProperties(){this.recipientOtherProperties.forEach(property=>property.disabled=!this.recipientCheckbox.checked),this.recipientFieldsContainer.classList.toggle("hidden",!this.recipientCheckbox.checked)}});async function imageLoaded(image){return image.complete?Promise.resolve():new Promise(resolve=>image.onload=resolve)}const IntersectionObserverMixin={setupIntersectionObserver(callback,rootMargin="0px 0px 200px 0px"){const handleIntersect=(entries,observer)=>{entries[0].isIntersecting&&(callback&&callback(),observer.disconnect())};new IntersectionObserver(handleIntersect.bind(this),{rootMargin}).observe(this)}},LoessImage=class extends HTMLImageElement{async connectedCallback(){await imageLoaded(this),this.setupIntersectionObserver(async()=>{this.parallax&&(await loadScript("https://cdn.jsdelivr.net/npm/simple-parallax-js@5.6.1/dist/simpleParallax.min.js"),await this.setupSimpleParallax()),requestAnimationFrame(()=>{this.removeAttribute("reveal")})},"0px 0px -100px 0px")}setupSimpleParallax(){return new Promise(resolve=>{resolve(new simpleParallax(this,{orientation:"down",scale:1.7,customWrapper:"[parallax]"}))})}get reveal(){return this.hasAttribute("reveal")}get parallax(){return this.parentElement.getAttribute("parallax")==="true"}};Object.assign(LoessImage.prototype,IntersectionObserverMixin),window.customElements.define("loess-image",LoessImage,{extends:"img"}),window.customElements.define("loess-input-field",class extends HTMLInputElement{constructor(){super(),this.addEventListener("keyup",this.handleKeyUp)}handleKeyUp(){this.classList.toggle("input__field--has-input",this.value!=="")}},{extends:"input"}),window.customElements.define("loess-localization-form",class extends HTMLElement{constructor(){super(),this.inputs=this.querySelector('input[name="locale_code"], input[name="country_code"]'),this.querySelectorAll("a").forEach(link=>{link.addEventListener("click",this._onClick.bind(this))})}_onClick(event){event.preventDefault();const form=this.querySelector("form");this.inputs.value=event.currentTarget.dataset.value,form&&form.submit()}}),window.customElements.define("loess-main-menu",class extends HTMLElement{constructor(){super(),this.showTimeout=null,Array.from(this.querySelectorAll(".has-dropdown[aria-expanded]")).forEach(item=>{item.parentElement.addEventListener("mouseenter",event=>{this.showDropdown(event.target)}),window.matchMedia("(hover: hover)").matches||item.addEventListener("click",event=>{event.target.getAttribute(!1)||(event.preventDefault(),this.showDropdown(event.target.parentElement))})})}showDropdown(navItem){const anchor=navItem.querySelector(".has-dropdown"),dropdown=anchor.nextElementSibling;this.showTimeout=setTimeout(()=>{if(anchor.getAttribute("aria-expanded")==="true")return;anchor.setAttribute("aria-expanded","true"),dropdown.removeAttribute("hidden");const mouseLeaveHandler=()=>{this.closeDropdown(navItem),navItem.removeEventListener("mouseleave",mouseLeaveHandler)};navItem.addEventListener("mouseleave",mouseLeaveHandler),this.showTimeout=null},0),navItem.addEventListener("mouseleave",()=>{this.showTimeout&&clearTimeout(this.showTimeout)},{once:!0})}closeDropdown(navItem){const anchor=navItem.querySelector(".has-dropdown"),dropdown=anchor.nextElementSibling;requestAnimationFrame(()=>{anchor.setAttribute("aria-expanded","false"),setTimeout(()=>{dropdown.setAttribute("hidden",""),clearTimeout(this.showTimeout)},0)})}},{extends:"nav"}),window.customElements.define("loess-modal-product",class extends Modal{constructor(){super(),this.href&&(this.innerElement=this.querySelector(".modal__inner"),this.contentElement=this.querySelector(".modal__inner-dynamic-content"),this.closeButton=this.querySelector(".modal__close-button"),this.spinner=this.querySelector(".modal__spinner"))}connectedCallback(){this.handleState=this._handleState.bind(this),this.handleVariantChange=this._handleVariantChange.bind(this),document.addEventListener("expandable-html-element:open",this.handleState),document.addEventListener("expandable-html-element:close",this.handleState),document.addEventListener("product-card:variant:changed",this.handleVariantChange)}disconnectedCallback(){document.removeEventListener("expandable-html-element:open",this.handleState),document.removeEventListener("expandable-html-element:close",this.handleState),document.removeEventListener("product-card:variant:changed",this.handleVariantChange)}_handleState(event){event.stopPropagation(),event.target==this&&(event.type=="expandable-html-element:open"?this.fetchPage():(this.controller&&this.controller.abort(),this.resetModal()))}_handleVariantChange(event){if(!event.detail.variantId||event.target!=this.closest("loess-product-card"))return;const link=document.createElement("a");link.setAttribute("href",this.href);const url=new URL(link.href);url.searchParams.set("variant",event.detail.variantId),this.setAttribute("href",url.toString())}async fetchPage(){this.controller=new AbortController;const responseText=await(await fetch(this.href,{signal:this.controller.signal})).text(),html=new DOMParser().parseFromString(responseText,"text/html");await this.renderModalContent(html),this.innerElement.classList.add("modal__inner--fit-height"),window.Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init()}renderModalContent(html){return new Promise(resolve=>{this.contentElement.innerHTML=html.getElementById("MainContent").innerHTML,this.spinner.classList.add("hidden"),this.closeButton.style.display="flex",resolve()})}resetModal(){this.contentElement.innerHTML="",this.innerElement.classList.remove("modal__inner--fit-height"),this.spinner.classList.remove("hidden"),this.closeButton.style.display="none"}_animate(){const keyframes={opacity:[0,1],visibility:["hidden","visible"],transform:["translateY(calc(-50% + 100px))","translateY(-50%)"]};return this.querySelector(".modal__inner").animate(keyframes,{duration:150*window.LoessTheme.animations.multiplier,direction:this.open?"normal":"reverse",easing:"cubic-bezier(0.5, 0, 0.175, 1)"})}get href(){return`${this.getAttribute("href")}`}}),window.customElements.define("loess-modal-video",class extends Modal{constructor(){super(),this.loaded=!1,this.closeButton=this.querySelector(".modal__close-button")}connectedCallback(){this.handleState=this._handleState.bind(this),document.addEventListener("expandable-html-element:open",this.handleState),document.addEventListener("expandable-html-element:close",this.handleState)}disconnectedCallback(){document.removeEventListener("expandable-html-element:open",this.handleState),document.removeEventListener("expandable-html-element:close",this.handleState)}_handleState(event){event.stopPropagation(),event.target==this&&(event.type=="expandable-html-element:open"?this.play():this.pause())}load(){return new Promise(resolve=>{const iframe=this.querySelector("iframe");iframe.src=iframe.dataset.src,iframe.addEventListener("load",()=>{var _this$querySelector;(_this$querySelector=this.querySelector(".spinner"))===null||_this$querySelector===void 0||_this$querySelector.remove(),this.loaded=!0,this.closeButton.style.display="flex",resolve()})})}async play(){this.loaded||await this.load(),this.type==="youtube"?this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*"):this.type==="vimeo"&&this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({method:"play"}),"*")}pause(){this.loaded&&(this.type==="youtube"?this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*"):this.type==="vimeo"&&this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({method:"pause"}),"*"))}get type(){return this.getAttribute("type")}}),window.customElements.define("loess-overlay",class extends HTMLElement{static get observedAttributes(){return["open"]}async attributeChangedCallback(name){switch(name){case"open":document.documentElement.classList.toggle("scroll-lock",this.open);break}}connectedCallback(){this.handleState=this._handleState.bind(this),document.addEventListener("expandable-html-element:open",this.handleState),document.addEventListener("expandable-html-element:close",this.handleState)}disconnectedCallback(){document.removeEventListener("expandable-html-element:open",this.handleState),document.removeEventListener("expandable-html-element:close",this.handleState)}_handleState(event){event.stopPropagation(),event.target.overlay&&(event.type=="expandable-html-element:open"?this.open=!0:this.open=!1)}get open(){return this.hasAttribute("open")}set open(value){value?this.setAttribute("open",""):this.removeAttribute("open")}}),window.customElements.define("loess-pagination",class extends HTMLElement{constructor(){super(),this.asyncLoad&&this.addEventListener("click",this.onPageClick.bind(this))}onPageClick(event){event.preventDefault();const searchParams=new URLSearchParams(window.location.search);searchParams.set("page",event.target.dataset.page),sendEvent(this,"pagination:link:clicked",{searchParams:searchParams.toString()})}get asyncLoad(){return this.hasAttribute("async")}},{extends:"nav"}),window.customElements.define("loess-popover",class extends ExpandableHTMLElement{}),window.customElements.define("loess-product-card",class extends HTMLElement{constructor(){super(),this.colorSwatches=this.querySelectorAll(".card-swatches__button"),this.colorSwatches.length&&this.colorSwatches.forEach(colorSwatch=>{colorSwatch.addEventListener("mouseenter",this.onColorSwatchHover.bind(this)),colorSwatch.addEventListener("click",this.onColorSwatchClick.bind(this))})}onColorSwatchHover(event){this.preloadImage(event.target)}async onColorSwatchClick(event){const image=this.preloadImage(event.target);await imageLoaded(image),image.hasAttribute("hidden")&&(image.removeAttribute("hidden"),this.updateActiveState(event.target),this.variantImages.filter(primaryImage=>primaryImage!==image).forEach(image2=>image2.setAttribute("hidden","true")),this.updateProductLinks(event.target),sendEvent(this,"product-card:variant:changed",{variantId:event.target.dataset.variantId}))}preloadImage(colorSwatch){const image=this.getImageWithId(colorSwatch);return image.setAttribute("loading","eager"),image}getImageWithId(colorSwatch){return this.variantImages=this.variantImage||Array.from(this.querySelectorAll(".card__primary-image")),this.variantImages.find(image=>image.dataset.mediaId===colorSwatch.dataset.mediaId)}updateActiveState(colorSwatch){const activeClass="card-swatches__button--active";this.colorSwatches.forEach(colorSwatch2=>{colorSwatch2.classList.remove(activeClass)}),colorSwatch.classList.add(activeClass)}updateProductLinks(colorSwatch){this.productLinks=this.productLinks||this.querySelectorAll(':not(loess-modal-product)[href*="/products"]'),this.productLinks.forEach(link=>{const url=new URL(link.href);url.searchParams.set("variant",colorSwatch.dataset.variantId),link.setAttribute("href",url.toString())})}}),customElements.define("loess-product-form",class extends HTMLElement{constructor(){super(),this.form=this.querySelector("form"),this.form.querySelector("[name=id]").disabled=!1,this.form.addEventListener("submit",this.onSubmitHandler.bind(this)),this.cart=document.querySelector("loess-cart-notification")||document.querySelector("loess-cart-drawer-items")}async onSubmitHandler(event){if(event.preventDefault(),this.submitButton=this.submitButton||this.querySelector('[type="submit"]'),this.submitButton.getAttribute("aria-disabled")==="true")return;this.handleErrorMessage(),this.submitButton.setAttribute("aria-disabled",!0),this.submitButton.querySelector("span").classList.add("hide"),this.querySelector(".spinner").classList.remove("hide");const config=fetchConfig("javascript");config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"];const formData=new FormData(this.form);this.cart&&this.redirectType!="page"&&(formData.append("sections",this.cart.getSectionsToRender().map(section=>section.section)),formData.append("sections_url",window.location.pathname)),config.body=formData,fetch(`${window.LoessTheme.routes.cart_add_url}`,config).then(response=>response.json()).then(async state=>{if(state.status){this.handleErrorMessage(state.description),this.error=!0;return}if(this.error=!1,!this.cart){window.location=window.LoessTheme.routes.cart_url;return}if(this.redirectType!="page"){const modalProduct=this.closest("loess-modal-product");modalProduct&&(modalProduct.open=!1,await new Promise(r=>setTimeout(r,100*window.LoessTheme.animations.multiplier)))}if(this.redirectType=="drawer")this.cart.renderCartItems(state),setTimeout(()=>{document.querySelector(`[aria-controls="${this.cart.closest("loess-drawer").id}"`).click()},100);else if(this.redirectType=="popup"){this.cart.renderCartItems(state);const cartPopup=this.cart.closest("loess-cart-notification-popup");cartPopup.open=!0,cartPopup.focus()}else{window.location=window.LoessTheme.routes.cart_url;return}}).catch(e=>{console.error(e)}).finally(()=>{this.submitButton.removeAttribute("aria-disabled"),this.redirectType!="page"&&(this.submitButton.querySelector("span").classList.remove("hide"),this.querySelector(".spinner").classList.add("hide"))})}handleErrorMessage(errorMessage=!1){this.errorMessageWrapper=this.errorMessageWrapper||this.querySelector('.form-message[role="alert"]'),this.errorMessageWrapper&&(this.errorMessage=this.errorMessage||this.errorMessageWrapper.querySelector(".form-message__text"),this.errorMessageWrapper.classList.toggle("hidden",!errorMessage),errorMessage&&(this.errorMessage.textContent=errorMessage))}get redirectType(){return this.getAttribute("redirect-type")}}),window.customElements.define("loess-product-filters",class extends HTMLElement{constructor(){super(),this.searchParamsInitial=window.location.search.slice(1),this.searchParamsPrev=window.location.search.slice(1),this.addEventListener("pagination:link:clicked",this.renderPage.bind(this)),this.addEventListener("filters:changed",this.renderPage.bind(this))}connectedCallback(){const onHistoryChange=event=>{const searchParams=event.state?event.state.searchParams:this.searchParamsInitial;searchParams!==this.searchParamsPrev&&this.renderPage(searchParams,!1)};window.addEventListener("popstate",onHistoryChange)}async renderPage(event,updateURLHash=!0){var _event$detail;let searchParams=event==null||(_event$detail=event.detail)===null||_event$detail===void 0?void 0:_event$detail.searchParams;updateURLHash||(searchParams=event),this.searchParamsPrev=searchParams;const url=`${window.location.pathname}?section_id=${this.sectionId}&${this.terms?`q=${this.terms}`:""}&${searchParams}`;this.setAttribute("loading","");const responseText=await(await fetch(url)).text(),html=new DOMParser().parseFromString(responseText,"text/html");html.querySelector(".product-grid-empty")?(document.querySelector(".collection-utility-bar__count-text")&&(document.querySelector(".collection-utility-bar__count-text").style.display="none"),document.querySelector(".collection-utility-bar__sorting")&&(document.querySelector(".collection-utility-bar__sorting").style.display="none"),document.getElementById("FilterProductGrid").innerHTML="",document.getElementById("FilterProductGrid").insertAdjacentElement("afterbegin",html.querySelector(".product-grid-empty"))):(this.renderProductGrid(html),this.renderFilterValues(html,event),this.renderActiveFilters(html),this.renderProductCount(html),updateURLHash&&this.updateURLHash(searchParams)),this.removeAttribute("loading"),requestAnimationFrame(()=>{this.querySelector(".collection").scrollIntoView({behavior:"smooth",block:"start"})})}renderProductGrid(html){var _html$querySelector,_html$querySelector$p;document.querySelector(".collection-bar").parentElement.innerHTML=(_html$querySelector=html.querySelector(".collection-bar"))===null||_html$querySelector===void 0||(_html$querySelector$p=_html$querySelector.parentElement)===null||_html$querySelector$p===void 0?void 0:_html$querySelector$p.innerHTML,document.getElementById("FilterProductGrid").innerHTML=html.getElementById("FilterProductGrid").innerHTML}renderFilterValues(html){const filterDrawersParent=html.getElementById("FilterDrawers"),filterMobileTemp=filterDrawersParent.querySelector("#FilterDrawerMobile");if(filterMobileTemp){const filterMobileButtons=Array.from(this.querySelectorAll(".scroller-tabs button")),filterMobileOffsetLeft=this.querySelector('.scroller-tabs button[aria-expanded="true"]').offsetLeft,filterMobileScrollTop=this.querySelector(".drawer__content").scrollTop;filterMobileButtons.forEach(button=>{const toggle=filterMobileTemp.querySelector(`[aria-controls="${button.getAttribute("aria-controls")}"]`),panel=filterMobileTemp.querySelector(`[id="${button.getAttribute("aria-controls")}"]`),isExpanded=button.getAttribute("aria-expanded")==="true";toggle.setAttribute("aria-expanded",isExpanded?"true":"false"),toggle.parentElement.toggleAttribute("active",isExpanded),panel.removeAttribute("hidden"),panel.removeAttribute("open"),panel.setAttribute(isExpanded?"open":"hidden","")}),this.querySelector("#FilterDrawerMobile").innerHTML=filterDrawersParent.querySelector("#FilterDrawerMobile").innerHTML;const scrollerTabs=this.querySelector("loess-scroller-tabs");scrollerTabs.scrollTo({behavior:"instant",left:filterMobileOffsetLeft-scrollerTabs.clientWidth/2+scrollerTabs.selectedButton.clientWidth/2}),this.querySelector(".drawer__content").scrollTop=filterMobileScrollTop}const filterLargeTemp=filterDrawersParent.querySelector("#FilterDrawerLarge");filterLargeTemp&&(Array.from(this.querySelectorAll('.collection-filter > button[is="loess-button"]')).forEach(button=>{const toggle=filterLargeTemp.querySelector(`[aria-controls="${button.getAttribute("aria-controls")}"]`),isExpanded=button.getAttribute("aria-expanded")==="true";toggle.setAttribute("aria-expanded",isExpanded?"true":"false"),toggle.nextElementSibling.toggleAttribute("open",isExpanded);const listToggleButton=button.nextElementSibling.querySelector(".collection-filter__more-button");if(listToggleButton?.getAttribute("aria-expanded")=="true"){const toggleButtonIndex=listToggleButton.getAttribute("index"),toggleButton=filterLargeTemp.querySelector(`.collection-filter__more-button[index="${toggleButtonIndex}"]`);Array.from(toggleButton.previousElementSibling.querySelectorAll(".collection-filter__list-item--hidden")).map(element=>{element.removeAttribute("hidden"),toggleButton.setAttribute("aria-expanded","true")})}}),this.querySelector("#FilterDrawerLarge").innerHTML=filterLargeTemp.innerHTML)}renderActiveFilters(html){var _html$querySelector2;const activeFiltersHTML=(_html$querySelector2=html.querySelector(".collection-active-filters"))===null||_html$querySelector2===void 0?void 0:_html$querySelector2.innerHTML;this.querySelectorAll(".collection-active-filters").forEach(element=>{element.innerHTML=activeFiltersHTML||""})}renderProductCount(html){document.getElementById("FilterProductCount").innerHTML=html.getElementById("FilterProductCount").innerHTML}updateURLHash(searchParams){history.pushState({searchParams},"",`${window.location.pathname}${searchParams&&"?".concat(searchParams)}`)}get sectionId(){return this.getAttribute("section-id")}get terms(){return this.getAttribute("terms")}}),window.customElements.define("loess-product-image-zoom",class extends ExpandableHTMLElement{async connectedCallback(){this.gallery=this.parentElement.querySelector("loess-product-gallery"),this.focusTrapOptions={fallbackFocus:this}}disconnectedCallback(){var _this$pswpModule;(_this$pswpModule=this.pswpModule)===null||_this$pswpModule===void 0||_this$pswpModule.destroy()}async attributeChangedCallback(name,oldValue,newValue){switch(super.attributeChangedCallback(name,oldValue,newValue),name){case"open":this.open&&(this.pswpModule=await this.loadPhotoSwipe(),this.initializePhotoSwipe())}}async loadPhotoSwipe(){return await import("https://cdn.jsdelivr.net/npm/photoswipe@5.3.2/dist/photoswipe.esm.min.js")}initializePhotoSwipe(){const options={dataSource:this.buildImages(),index:this.gallery.getActiveSlideIndex(),zoom:!1,counter:!1,bgOpacity:1,closeOnVerticalDrag:!1,closeSVG:'',arrowNextSVG:'',arrowPrevSVG:''},pswp=new this.pswpModule.default(options);pswp.init(),pswp.on("close",()=>{this.open=!1})}buildImages(){return Array.from(this.gallery.querySelectorAll("img")).map(image=>({srcset:image.srcset,src:image.src,width:image.getAttribute("width"),height:image.getAttribute("height"),alt:image.alt}))}}),window.customElements.define("loess-predictive-search",class extends HTMLElement{constructor(){super(),this.input=this.querySelector('input[type="search"]'),this.results=this.querySelector(".predictive-search-results__list"),this.input.addEventListener("input",debounce(()=>{this.onChange()}).bind(this))}getQuery(){return this.input.value.trim()}onChange(){const searchTerm=this.getQuery();if(this.results.innerHTML="",this.querySelector("loess-predictive-search-results").hidden=!1,this.querySelector("loess-predictive-search-results").setAttribute("loading",""),!searchTerm.length){this.querySelector("loess-predictive-search-results").hidden=!0;return}this.searchTerm=searchTerm,this.getSearchResults()}async getSearchResults(){const response=await fetch(this.buildQueryString());if(!response.ok)throw new Error(response.status);const text=await response.text();this.injectHTMLResponse(text),this.querySelector("loess-predictive-search-results").removeAttribute("loading")}buildQueryString(){return`${this.fetchUrl}?q=${encodeURIComponent(this.searchTerm)}&${encodeURIComponent("resources[type]")}=${this.resources}&${encodeURIComponent("resources[limit]")}=8&${encodeURIComponent("resources[limit_scope]")}=each&${encodeURIComponent("resources[options][fields]")}=title,product_type,variants.title,vendor,body§ion_id=predictive-search`}injectHTMLResponse(text){const responseMarkup=new DOMParser().parseFromString(text,"text/html").querySelector("#shopify-section-predictive-search").innerHTML;this.results.innerHTML=responseMarkup}get fetchUrl(){return this.getAttribute("fetch-url")}get resources(){return this.getAttribute("resources")}}),window.customElements.define("loess-qr-code",class extends HTMLElement{constructor(){super(),this._generateQRCode()}identifier(){return this.getAttribute("identifier")}async _generateQRCode(){await fetchInject([window.LoessTheme.scripts.QRCode]),new QRCode(this,{text:this.identifier,width:120,height:120})}}),window.customElements.define("loess-quantity-input",class extends HTMLElement{constructor(){super(),this.input=this.querySelector("input"),this.changeEvent=new Event("change",{bubbles:!0}),this.querySelectorAll("button").forEach(button=>button.addEventListener("click",this.onButtonClick.bind(this)))}onButtonClick(event){event.preventDefault();const previousValue=this.input.value;event.target.name==="plus"?this.input.stepUp():this.input.stepDown(),previousValue!==this.input.value&&this.input.dispatchEvent(this.changeEvent)}}),window.customElements.define("loess-scroller",class extends HTMLElement{constructor(){super(),!(!this.enabledScrollerMobile&&!this.enabledScrollerLarge)&&(this.scroller=this.querySelector("ul"),this.scroller.style.scrollSnapType="x mandatory",this._checkMediaQueryBreakpoint())}connectedCallback(){this.previousSlide=this._previousSlide.bind(this),this.nextSlide=this._nextSlide.bind(this),this.addEventListener("scroller:previousButton:clicked",this.previousSlide),this.addEventListener("scroller:nextButton:clicked",this.nextSlide)}disconnectedCallback(){this.removeEventListener("scroller:previousButton:clicked",this.previousSlide),this.removeEventListener("scroller:nextButton:clicked",this.nextSlide)}_checkMediaQueryBreakpoint(){this.mediaQueryList=[window.matchMedia("(min-width: 991px)"),window.matchMedia("(min-width: 751px)")],this.mediaQueryList.forEach(mediaQuery=>{mediaQuery.addListener(this.mediaQueryHandler.bind(this))}),this.mediaQueryHandler()}async mediaQueryHandler(){var _this$dots,_this$dots2;this.scroller.scrollLeft=0,await window.customElements.whenDefined("loess-scroller-dots"),this.dots=this.querySelector("loess-scroller-dots"),(_this$dots=this.dots)===null||_this$dots===void 0||_this$dots.reset(),this.observer&&this.observer.disconnect(),this.numberOfColumns&&(this.items.length<=this.numberOfColumns||(this._setupItemsIntersectionObserver(),(_this$dots2=this.dots)===null||_this$dots2===void 0||_this$dots2.build(this.sentinels)))}_setupItemsIntersectionObserver(){const options={root:!this.mediaQueryList[0].matches&&this.sentinels.length!==2?this.scroller:null,rootMargin:this.observerRootMargin};this.observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{var _this$dots3;entry.isIntersecting&&((_this$dots3=this.dots)===null||_this$dots3===void 0||_this$dots3.setActiveItem(entry.target))})},options),this.sentinels.forEach(item=>{this.observer.observe(item)})}get observerRootMargin(){return this.mediaQueryList[0].matches?"0px":this.items.length===this.sentinels.length?"-50%":"-25%"}get sentinels(){return Array.from(this.items).filter((element,index,array)=>index%this.numberOfColumns==0)}get numberOfColumns(){return this.mediaQueryList[0].matches&&this.enabledScrollerLarge?this.columnsLarge:this.mediaQueryList[1].matches&&this.enabledScrollerTablet?this.columnsTablet:this.columnsMobile}get enabledScrollerMobile(){return this.hasAttribute("columns-mobile")}get enabledScrollerTablet(){return this.hasAttribute("columns-tablet")}get enabledScrollerLarge(){return this.hasAttribute("columns-large")}get columnsMobile(){return Number(this.getAttribute("columns-mobile"))}get columnsTablet(){return Number(this.getAttribute("columns-tablet")||this.columnsMobile+1)}get columnsLarge(){return Number(this.getAttribute("columns-large"))}get items(){return this.scroller.children}_previousSlide(event){event.target.nextElementSibling.removeAttribute("disabled"),event.target.toggleAttribute("disabled",this.scroller.scrollLeft-(this.scroller.clientWidth+10)<=0),this._changeSlide(-1)}_nextSlide(event){event.target.previousElementSibling.removeAttribute("disabled"),event.target.toggleAttribute("disabled",this.scroller.scrollLeft+(this.scroller.clientWidth+10)*2>=this.scroller.scrollWidth),this._changeSlide(1)}_changeSlide(direction){this.scroller.scrollBy({left:direction*(this.scroller.clientWidth+10),behavior:"smooth"})}}),window.customElements.define("loess-scroller-dots",class extends HTMLElement{constructor(){super(),this.orderedList=this.querySelector("ol")}reset(){this.orderedList.innerHTML="",delete this.orderedListItems}build(items){this.items=items,this.items.forEach(()=>{const listItem=this.querySelector("template").content.cloneNode(!0);this.orderedList.appendChild(listItem)})}setActiveItem(target,parent=null){var _this$items;this.orderedListItems=this.orderedListItems||this.orderedList.querySelectorAll("li"),this.orderedListItems.forEach(listItem=>{listItem.removeAttribute("active")});const index=(_this$items=this.items)===null||_this$items===void 0?void 0:_this$items.indexOf(target);parent!==null&&(index=[...parent].indexOf(target)),this.orderedList.children[index].setAttribute("active","")}}),window.customElements.define("loess-scroller-buttons",class extends HTMLElement{constructor(){super(),this.previousButton=this.querySelector("button:first-of-type"),this.nextButton=this.querySelector("button:last-of-type")}connectedCallback(){this.previousButton.addEventListener("click",()=>{sendEvent(this.previousButton,"scroller:previousButton:clicked")}),this.nextButton.addEventListener("click",()=>{sendEvent(this.nextButton,"scroller:nextButton:clicked")})}}),window.customElements.define("loess-scroller-tabs",class extends HTMLElement{constructor(){super(),this.buttons=Array.from(this.querySelectorAll("button")),this.buttons.forEach(button=>{button.addEventListener("click",this.onButtonClick.bind(this))}),Shopify.designMode&&this.addEventListener("shopify:block:select",this.onButtonClick.bind(this))}get selectedButton(){return this.buttons.find(button=>button.getAttribute("aria-expanded")==="true")}async onButtonClick(event){this.selectedButton!==event.target&&(this.contentToHide=document.getElementById(this.selectedButton.getAttribute("aria-controls")),this.contentToShow=document.getElementById(event.target.getAttribute("aria-controls")),this.updateButtons(event.target),Shopify.designMode&&event.detail.load?(this.contentToHide.hidden=!0,this.contentToShow.hidden=!1):this.animateContent())}onButtonHover(event){const contentToShow=document.getElementById(event.target.getAttribute("aria-controls"));this.loadContentImages(contentToShow)}loadContentImages(contentToShow){const images=contentToShow.querySelectorAll("img");images&&images.forEach(image=>image.setAttribute("loading","eager"))}updateButtons(button){this.selectedButton.parentElement.removeAttribute("active"),button.parentElement.setAttribute("active",""),this.selectedButton.setAttribute("aria-expanded","false"),button.setAttribute("aria-expanded","true"),this.scrollTo({behavior:"smooth",left:this.selectedButton.offsetLeft-this.clientWidth/2+this.selectedButton.clientWidth/2})}async animateContent(){const options={duration:150*window.LoessTheme.animations.multiplier,easing:"ease-in-out"};await this.contentToHide.animate({opacity:[1,0]},options).finished,this.contentToHide.hidden=!0,this.contentToShow.hidden=!1,await this.contentToShow.animate({opacity:[0,1]},options).finished}}),window.customElements.define("loess-share-button",class extends Button{constructor(){var _this$collapsiblePane;super(),this.collapsiblePanel=this.parentElement.nextElementSibling,this.copyOrShareButton=this.collapsiblePanel.querySelector("button"),this.urlToShare=((_this$collapsiblePane=this.collapsiblePanel.querySelector("input"))===null||_this$collapsiblePane===void 0?void 0:_this$collapsiblePane.value)||document.location.href,this.copyOrShareButton.addEventListener("click",this.copyOrShare.bind(this))}copyOrShare(){navigator.share?navigator.share({url:this.urlToShare,title:document.title}):this.copyToClipboard()}async copyToClipboard(){await navigator.clipboard.writeText(this.urlToShare),alert(window.LoessTheme.strings.copiedToClipboard)}},{extends:"button"}),window.customElements.define("loess-shipping-country-selector",class extends HTMLSelectElement{constructor(){super(),this.addEventListener("change",this.updateProvinceSelector.bind(this)),this.setDefaultSelectOption(this),this.updateProvinceSelector()}setDefaultSelectOption(selector){if(selector.getAttribute("data-default-option")!=""){for(let i=0;i!==selector.options.length;++i)if(selector.options[i].text===selector.getAttribute("data-default-option")){selector.selectedIndex=i;break}}}updateProvinceSelector(){const selectedOption=this.options[this.selectedIndex],provinceElement=document.getElementById(this.getAttribute("aria-owns")),provinceElementSelector=provinceElement.querySelector("select"),provinces=JSON.parse(selectedOption.getAttribute("data-provinces"));if(provinceElementSelector.innerHTML="",provinces.length===0){provinceElement.classList.add("input-group--hidden");return}provinces.forEach(data=>{provinceElementSelector.options.add(new Option(data[1],data[0]))}),provinceElement.classList.remove("input-group--hidden"),this.setDefaultSelectOption(provinceElementSelector)}},{extends:"select"}),window.customElements.define("loess-sort-by",class extends HTMLSelectElement{constructor(){super(),this.resizeElement(),this.addEventListener("change",this.onChange.bind(this))}onChange(event){const searchParams=new URLSearchParams(window.location.search);searchParams.set("sort_by",event.target.value),searchParams.delete("page"),this.resizeElement(),sendEvent(this,"filters:changed",{searchParams:searchParams.toString()})}resizeElement(){const tempSelect=document.createElement("select"),tempOption=document.createElement("option");tempSelect.appendChild(tempOption),tempOption.innerHTML=this.options[this.selectedIndex].textContent,this.insertAdjacentElement("afterend",tempSelect),this.style.width=`${tempSelect.clientWidth}px`,tempSelect.remove()}},{extends:"select"}),customElements.define("loess-variant-picker",class extends HTMLElement{constructor(){super(),this.options=[],this.addEventListener("change",this.onVariantChange.bind(this)),this.checkForInstallmentsBanner()}onVariantChange(event){this.eventTarget=event.target,this.getOptions(),this.updateMasterId(),this.currentVariant?(this.renderProductInfo(),this.updateUrl(),this.updateFullDetailsLinkUrl(),this.updateVariantInput(),this.checkForInstallmentsBanner(),this.dispatchEvent()):(this.toggleAddButton(!0,"",!0),this.setUnavailable())}getOptions(){this.options=Array.from(this.querySelectorAll("loess-variant-selects, loess-variant-radios")).map(input=>input.getOptionValue())}updateMasterId(){this.currentVariant=this.getVariantData().find(variant=>!variant.options.map((option,index)=>this.options[index]===option).includes(!1))}updateUrl(){!this.currentVariant||this.shouldUpdateUrl==="false"||window.history.replaceState({},"",`${this.productUrl}?variant=${this.currentVariant.id}`)}updateFullDetailsLinkUrl(){if(!this.currentVariant)return;const fullDetailsLink=document.querySelector(`#ProductFullDetailsLinks-${this.sectionId}`);fullDetailsLink&&(fullDetailsLink.href=`${this.productUrl}?variant=${this.currentVariant.id}`)}updateVariantInput(){document.querySelectorAll(`#product-form-${this.sectionId}, #product-form-installment-${this.sectionId}`).forEach(productForm=>{const input=productForm.querySelector('input[name="id"]');input.value=this.currentVariant.id})}async renderProductInfo(){const responseText=await(await fetch(`${this.productUrl}?section_id=${this.sectionId}&variant=${this.currentVariant.id}`)).text(),html=new DOMParser().parseFromString(responseText,"text/html");this.rerenderBlocks(html);const price=document.getElementById(`ProductPrice-${this.sectionId}`);price&&price.classList.remove("hidden"),this.toggleAddButton(!this.currentVariant.available,window.LoessTheme.cartStrings.soldOut)}rerenderBlocks(html){["ProductPrice","VariantPickers","Share","StockAvailability","PickupAvailability"].forEach(block=>{const element=document.getElementById(`${block}-${this.sectionId}`);element&&(element.innerHTML=html.getElementById(`${block}-${this.sectionId}`).innerHTML)})}getVariantData(){return this.variantData=this.variantData||JSON.parse(document.querySelector(`#ProductVariantData-${this.sectionId}[type="application/json"]`).textContent),this.variantData}dispatchEvent(){sendEvent(this.eventTarget,"product:variant:changed",{sectionId:this.sectionId,variant:this.currentVariant})}toggleAddButton(disable=!0,text,modifyClass=!0){const productForm=document.getElementById(`product-form-${this.sectionId}`);if(!productForm)return;const addButton=productForm.querySelector('[name="add"]'),addButtonText=productForm.querySelector('[name="add"] > span');addButton&&(disable?(addButton.setAttribute("disabled","disabled"),text&&(addButtonText.textContent=text)):(addButton.removeAttribute("disabled"),addButtonText.textContent=window.LoessTheme.cartStrings.addToCart))}setUnavailable(){const button=document.getElementById(`product-form-${this.sectionId}`),addButton=button.querySelector('[name="add"]'),addButtonText=button.querySelector('[name="add"] > span'),price=document.getElementById(`ProductPrice-${this.sectionId}`);addButton&&(addButtonText.textContent=window.LoessTheme.cartStrings.unavailable,price&&price.classList.add("hidden"))}async checkForInstallmentsBanner(){const modalProduct=this.closest("loess-modal-product");if(!modalProduct)return;await new Promise(r=>setTimeout(r,500));const paymentTerms=modalProduct.querySelector("shopify-payment-terms");paymentTerms&&(paymentTerms.shadowRoot.querySelector(".shopify-installments").style.pointerEvents="none",paymentTerms.shadowRoot.querySelector(".shopify-installments__learn-more").style.pointerEvents="auto")}get sectionId(){return this.getAttribute("section-id")}get productUrl(){return this.getAttribute("product-url")}get shouldUpdateUrl(){return this.getAttribute("should-update-url")}}),customElements.define("loess-variant-selects",class extends HTMLElement{getOptionValue(){return this.querySelector("select").value}}),customElements.define("loess-variant-radios",class extends HTMLElement{getOptionValue(){return Array.from(this.querySelectorAll("input")).find(radio=>radio.checked).value}}),window.customElements.define("loess-cookie-banner",class extends HTMLElement{constructor(){super(),this.declineButton=this.querySelector("button:first-of-type"),this.acceptButton=this.querySelector("button:last-of-type")}connectedCallback(){Shopify.designMode&&(document.addEventListener("shopify:section:select",event=>{event.detail.sectionId===this.sectionId&&(this.open=!0)}),document.addEventListener("shopify:section:deselect",event=>{event.detail.sectionId===this.sectionId&&(this.open=!1)})),this.declineButton.addEventListener("click",this._handleDecline.bind(this)),this.acceptButton.addEventListener("click",this._handleAccept.bind(this)),window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1",onLoad:this._initCookieBanner.bind(this)}])}get sectionId(){return this.getAttribute("section-id")}set open(value){this.toggleAttribute("hidden",!value)}_initCookieBanner(){window.Shopify.customerPrivacy.shouldShowGDPRBanner()&&(this.open=!0)}_handleAccept(){window.Shopify.customerPrivacy.setTrackingConsent(!0,()=>this.open=!1)}_handleDecline(){window.Shopify.customerPrivacy.setTrackingConsent(!1,()=>this.open=!1)}});function throttle(callback,wait,immediate=!1){let timeout=null,initialCall=!0;return function(){const callNow=immediate&&initialCall,next=()=>{callback.apply(this,arguments),timeout=null};callNow&&(initialCall=!1,next()),timeout||(timeout=setTimeout(next,wait))}}window.customElements.define("loess-header",class extends HTMLElement{connectedCallback(){this.resizeObserver=new ResizeObserver(this._updateHeightProperty.bind(this)).observe(this),this.transparent&&(this.isTransparentLocked=!1,document.addEventListener("expandable-html-element:open",this._lockTransparentState.bind(this)),document.addEventListener("expandable-html-element:close",this._lockTransparentState.bind(this)),this.addEventListener("mouseenter",this._toggleTransparency.bind(this),!0),this.addEventListener("mouseleave",this._toggleTransparency.bind(this))),this.transparent&&this.sticky&&(this._onScroll=throttle(this._toggleTransparency.bind(this),100),window.addEventListener("scroll",this._onScroll,{passive:!0}),this._toggleTransparency())}disconnectedCallback(){this.resizeObserver&&this.resizeObserver.disconnect(),this.sticky&&this.transparent&&window.removeEventListener("scroll",this._onScroll)}get sticky(){return this.hasAttribute("sticky")}get transparent(){return this.hasAttribute("transparent")}_lockTransparentState(event){["SideBarMenu","CartDrawer","HeaderSearch"].includes(event.target.id)&&(this.isTransparentLocked=event.type==="expandable-html-element:open",this._toggleTransparency())}_toggleTransparency(event){this.sticky&&window.scrollY>15||event&&event.type==="mouseenter"||this.isTransparentLocked?this.classList.remove("header--transparent"):this.classList.add("header--transparent")}_updateHeightProperty(entries){for(const entry of entries){const height=entry.borderBoxSize&&entry.borderBoxSize.length>0?entry.borderBoxSize[0].blockSize:entry.target.clientHeight;document.documentElement.style.setProperty("--header-height",`${height}px`)}}});const LoessSlideshow=class extends HTMLElement{constructor(){super(),this.texts=Array.from(this.querySelectorAll("loess-slideshow-text")),this.images=Array.from(this.querySelectorAll("loess-slideshow-image")),this.backgrounds=Array.from(this.closest("section").querySelectorAll(".hero-background")),this.dots=Array.from(this.querySelectorAll(".hero-controls, .hero-slider-buttons")).map(element=>Array.from(element.querySelectorAll(".slider-dots > ol > li"))),this.autoPlay&&(this.progressBars=Array.from(this.querySelectorAll("loess-slideshow-progress"))),this.previousSlideIndex=0,this.currentSlideIndex=0,this.isAnimating=!1}connectedCallback(){this.setupIntersectionObserver(this.play.bind(this)),this.previousSlide=this.previousSlide.bind(this),this.nextSlide=this.nextSlide.bind(this),this.addEventListener("slideshow:previousButton:clicked",this.previousSlide),this.addEventListener("slideshow:nextButton:clicked",this.nextSlide),Shopify.designMode&&this.addEventListener("shopify:block:select",event=>{this.pause();const index=Array.from(event.target.parentNode.children).indexOf(event.target)||0;this.currentSlideIndex=index,this.changeSlide()})}disconnectedCallback(){this.removeEventListener("slideshow:previousButton:clicked",this.previousSlide),this.removeEventListener("slideshow:nextButton:clicked",this.nextSlide)}previousSlide(){this.currentSlideIndex<=0?this.currentSlideIndex=this.images.length-1:this.currentSlideIndex--,this.changeSlide()}nextSlide(event){this.currentSlideIndex>=this.images.length-1?this.currentSlideIndex=0:this.currentSlideIndex++,this.changeSlide(event)}changeSlide(){this.isAnimating||this.previousSlideIndex!=this.currentSlideIndex&&(this.autoPlay&&this.progressBars.forEach(element=>{element.reset()}),this.isAnimating=!0,this.updateImage(),this.updateText(),this.updateBackground(),this.updateDots(),this.previousSlideIndex=this.currentSlideIndex)}async updateImage(){const previousImage=this.images[this.previousSlideIndex],nextImage=this.images[this.currentSlideIndex];this.animationStyle=="swipe"?await this.animateSwipe(previousImage,nextImage):await this.animateFade(previousImage,nextImage),this.autoPlay&&this.progressBars.forEach(element=>{element.play()}),this.isAnimating=!1}async animateSwipe(previousImage,nextImage){previousImage.setAttribute("hidden",""),nextImage.removeAttribute("hidden"),await nextImage.animate({visibility:["hidden","visible"],clipPath:["inset(0 0 0 100%)","inset(0 0 0 0)"]},{duration:200*window.LoessTheme.animations.multiplier,easing:"cubic-bezier(0.65, 0.05, 0.36, 1)"}).finished,previousImage.style.visibility="hidden",nextImage.style.visibility="visible"}async animateFade(previousImage,nextImage){const options={duration:150*window.LoessTheme.animations.multiplier,easing:"ease-in-out"};this.type=="image-background"?await previousImage.animate({opacity:[1,0]},options):await previousImage.animate({opacity:[1,0]},options).finished,previousImage.style.visibility="hidden",nextImage.style.visibility="visible",await nextImage.animate({opacity:[0,1]},options).finished}async updateText(){if(this.texts.length===1)return;const previousText=this.texts[this.previousSlideIndex],nextText=this.texts[this.currentSlideIndex],previousTextChunks=previousText.querySelectorAll(".rich-text > *:not(.hero-slider-buttons)"),nextTextChunks=nextText.querySelectorAll(".rich-text > *:not(.hero-slider-buttons)");previousTextChunks.forEach(async text=>{await text.animate({opacity:[1,0]},{duration:50*window.LoessTheme.animations.multiplier,easing:"ease-in-out"}).finished}),previousText.hidden=!0,this.type=="image-background"&&await new Promise(r=>setTimeout(r,250*window.LoessTheme.animations.multiplier)),nextText.hidden=!1,nextTextChunks.forEach(async text=>{await text.animate({opacity:[0,1]},{duration:150*window.LoessTheme.animations.multiplier,easing:"ease-in-out"}).finished})}async updateBackground(){if(this.backgrounds.length<=1)return;const previousBackground=this.backgrounds[this.previousSlideIndex],nextBackground=this.backgrounds[this.currentSlideIndex];nextBackground.classList.remove("hero-background--hidden"),await nextBackground.animate({opacity:[0,1]},{duration:100*window.LoessTheme.animations.multiplier,easing:"ease-in-out"}).finished,previousBackground.classList.add("hero-background--hidden")}updateDots(){this.dots.forEach(dot=>{const previousDot=dot[this.previousSlideIndex],nextDot=dot[this.currentSlideIndex];previousDot.removeAttribute("active"),nextDot.setAttribute("active","")})}pause(){this.style.setProperty("--auto-play-state","paused")}play(){this.autoPlay&&this.style.setProperty("--auto-play-state","running")}get autoPlay(){return this.hasAttribute("auto-play")}get type(){return this.getAttribute("type")}get animationStyle(){return this.getAttribute("animation-style")}};Object.assign(LoessSlideshow.prototype,IntersectionObserverMixin),window.customElements.define("loess-slideshow",LoessSlideshow),window.customElements.define("loess-slideshow-buttons",class extends HTMLElement{constructor(){super(),this.previousButton=this.querySelector("button:first-of-type"),this.nextButton=this.querySelector("button:last-of-type"),this.previousButton.addEventListener("click",()=>{sendEvent(this.previousButton,"slideshow:previousButton:clicked")}),this.nextButton.addEventListener("click",()=>{sendEvent(this.nextButton,"slideshow:nextButton:clicked")})}}),window.customElements.define("loess-slideshow-progress",class extends HTMLElement{constructor(){super(),this.circle=this.querySelector("circle:first-child"),this.circle.addEventListener("animationend",event=>{sendEvent(event.target,"slideshow:nextButton:clicked")})}reset(){this.circle.classList.remove("slider-progress-bar__circle--animation")}play(){this.circle.classList.add("slider-progress-bar__circle--animation")}}),window.customElements.define("loess-product",class extends HTMLElement{async connectedCallback(){await window.customElements.whenDefined("loess-product-gallery"),await window.customElements.whenDefined("loess-scroller-dots"),this.gallery=this.querySelector("loess-product-gallery"),this.thumbnails=this.parentElement.querySelector(".main-product-media__thumbnails"),this.thumbnails&&(this.slideIndex=this.gallery.getActiveSlideIndex(),this.addEventListener("product:thumbnail:clicked",this.onClickThumbnail),this.addEventListener("scroller:previousButton:clicked",this.onClickPreviousButton),this.addEventListener("scroller:nextButton:clicked",this.onClickNextButton),this.addEventListener("product:variant:changed",this.onVariantChange))}onClickPreviousButton(event){event.stopPropagation(),this.slideIndex=this.slideIndex-1,this.gallery.previousSlide(event,this.gallery.children[this.slideIndex])}onClickNextButton(event){event.stopPropagation(),this.slideIndex=this.slideIndex+1,this.gallery.nextSlide(event,this.gallery.children[this.slideIndex])}onClickThumbnail(event){event.stopPropagation(),this.gallery.changeSlide(event.target)}onVariantChange(event){event.stopPropagation(),this.resetErrorMessage();const currentVariant=event.detail.variant;if(!currentVariant||!currentVariant.featured_media)return;const mediaId=`ProductMedia-${event.detail.sectionId}-${currentVariant.featured_media.id}`;this.gallery.changeSlide(document.getElementById(mediaId));const thumbnail=this.thumbnails.querySelector(`[aria-controls=${mediaId}]`);this.thumbnails.updateThumbnailState(thumbnail)}resetErrorMessage(){this.errorMessageWrapper=this.errorMessageWrapper||this.querySelector('.form-message[role="alert"]'),this.errorMessageWrapper.classList.add("hidden")}});const LoessProductGallery=class extends HTMLElement{constructor(){super(),this.product=this.closest("loess-product"),this.items=Array.from(this.children),!(this.items.length<=1)&&(this.dots=Array.from(this.parentElement.querySelector(".slider-dots > ol").children),this.height=this.offsetHeight,this.transitioning=!1,this.changeSlide(this.querySelector("[active]"),!1),this.parentHasSticky&&this.setupStickyScroll(this.parentElement),this.checkFor3dModel())}async connectedCallback(){this.resizeObserver=new ResizeObserver(()=>{this.setContainerHeight(this.querySelector("[active]"),!1)}).observe(this),this.imageZoomEnabled&&this.addEventListener("click",()=>{this.querySelector("[active]").getAttribute("media-type")=="image"&&(this.zoomButton=this.parentElement.querySelector(".main-product__media-zoom-button"),this.zoomButton.click())})}disconnectedCallback(){this.resizeObserver&&this.resizeObserver.disconnect(),this.parentHasSticky&&this.destroyStickyScroll(this.parentElement)}previousSlide(event,target){event.target.nextElementSibling.removeAttribute("disabled"),event.target.toggleAttribute("disabled",target==this.firstElementChild),this.changeSlide(target)}nextSlide(event,target){event.target.previousElementSibling.removeAttribute("disabled"),event.target.toggleAttribute("disabled",target==this.lastElementChild),this.changeSlide(target)}async changeSlide(target,animate=!0){let slide;target!=null&&(target.hasAttribute("aria-controls")?slide=this.querySelector(`#${target.getAttribute("aria-controls")}`):slide=target,this.pauseAllMedia(),this.checkForSlideType(slide),this.scrollTo({behavior:animate?"smooth":"instant",left:slide.offsetLeft}),this.dots&&this.setActiveDot(slide),this.setActiveSlide(slide),await this.waitForScrollEnd(),this.setContainerHeight(slide,animate),this.currentSlide=this.querySelector("[active]"),this.imageZoomEnabled&&this.toggleImageZoomVisibility())}toggleImageZoomVisibility(){const isImageMediaType=this.querySelector("[active]").getAttribute("media-type")=="image";this.parentElement.querySelector(".main-product__media-zoom-button").classList.toggle("hide",!isImageMediaType)}pauseAllMedia(){this.querySelectorAll("video").forEach(video=>video.pause()),this.querySelectorAll("loess-3d-model").forEach(model=>{model.modelViewerUI&&model.modelViewerUI.pause()}),this.querySelectorAll("loess-video").forEach(video=>{if(video.getAttribute("type")!="native")if(video.getAttribute("type")==="youtube"){var _video$querySelector;(_video$querySelector=video.querySelector("iframe"))===null||_video$querySelector===void 0||_video$querySelector.contentWindow.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*")}else{var _video$querySelector2;(_video$querySelector2=video.querySelector("iframe"))===null||_video$querySelector2===void 0||_video$querySelector2.contentWindow.postMessage(JSON.stringify({method:"pause"}),"*")}})}checkFor3dModel(){const mediaWrapper=document.querySelector("loess-3d-model");mediaWrapper&&(this.initialModel3dId=mediaWrapper.getAttribute("model-id"))}checkForSlideType(slide){const slideType=slide.firstElementChild,slideTagName=slideType.tagName;slideTagName=="LOESS-3D-MODEL"?slideType.play():slideTagName=="LOESS-VIDEO"&&(slideType.getAttribute("type")=="native"?slideType.querySelector("video").play():slideType.play()),this.updateViewButtonModelId(slideType)}updateViewButtonModelId(slideType){var _mediaWrapper$querySe;(_mediaWrapper$querySe=this.closest(".main-product__media-gallery-wrapper").querySelector(".product__xr-button"))===null||_mediaWrapper$querySe===void 0||_mediaWrapper$querySe.setAttribute("data-shopify-model3d-id",slideType.getAttribute("model-id")||this.initialModel3dId)}async setContainerHeight(slide,animate){const keyframes={height:[`${this.height}px`,`${slide?.offsetHeight}px`]};await this.animate(keyframes,{duration:animate?150*window.LoessTheme.animations.multiplier:0,easing:"cubic-bezier(0.5, 0, 0.175, 1)"}).finished,this.height=slide?.offsetHeight,this.style.height=`${this.height}px`,this.style.paddingBottom="0px"}setActiveSlide(slide){this.items.map(item=>item.removeAttribute("active")),slide.setAttribute("active","")}setActiveDot(slide){this.dots.map(dot=>dot.removeAttribute("active"));const index=[...slide.parentElement.children].indexOf(slide);this.dots[index].setAttribute("active","")}waitForScrollEnd(){let last_changed_frame=0,last_x=this.scrollLeft;return new Promise(resolve=>{const tick=frames=>{frames>=500||frames-last_changed_frame>20?resolve():(this.scrollLeft!=last_x&&(last_changed_frame=frames,last_x=this.scrollLeft),requestAnimationFrame(tick.bind(null,frames+1)))};tick(0)})}getActiveSlideIndex(){const activeSlide=this.querySelector("[active]");return[...activeSlide.parentElement.children].indexOf(activeSlide)}get imageZoomEnabled(){return this.getAttribute("image-zoom")==="true"}get parentHasSticky(){return this.parentElement.hasAttribute("sticky")}};Object.assign(LoessProductGallery.prototype,StickyScrollMixin),window.customElements.define("loess-product-gallery",LoessProductGallery),window.customElements.define("loess-product-thumbnails",class extends HTMLUListElement{constructor(){super(),this.buttons=Array.from(this.children).map(child=>child.querySelector("button")),this.buttons.forEach(button=>{button.addEventListener("click",this.onClickButton.bind(this))}),this.positionActiveThumbnail(this.buttons[0],!1)}onClickButton(event){this.updateThumbnailState(event.currentTarget),sendEvent(event.currentTarget,"product:thumbnail:clicked")}updateThumbnailState(element){this.resetAriaCurrent(element),this.positionActiveThumbnail(element,!0)}resetAriaCurrent(target){this.buttons.map(button=>button.removeAttribute("aria-current")),target.setAttribute("aria-current","true")}positionActiveThumbnail(target,animate=!0){this.scrollTo({behavior:animate?"smooth":"instant",top:target.offsetTop-this.clientHeight/2+target.clientHeight/2,left:target.offsetLeft-this.clientWidth/2+target.clientWidth/2})}},{extends:"ul"}),window.customElements.define("loess-popup",class extends ExpandableHTMLElement{constructor(){super(),window.location.pathname!=="/challenge"&&(Shopify.designMode||this._getWithExpiry("loess:theme:popup")||setTimeout(()=>{this.open=!0,this._setWithExpiry("loess:theme:popup",this.daysInSeconds)},this.delayVisibility*1e3))}connectedCallback(){this.toggleVisibility=this._toggleVisibility.bind(this),Shopify.designMode&&(document.addEventListener("shopify:section:select",this.toggleVisibility),document.addEventListener("shopify:section:deselect",this.toggleVisibility))}disconnectedCallback(){Shopify.designMode&&(document.removeEventListener("shopify:section:select",this.toggleVisibility),document.removeEventListener("shopify:section:deselect",this.toggleVisibility))}_setWithExpiry(key,expiration){const item={expiry:new Date().getTime()+expiration};localStorage.setItem(key,JSON.stringify(item))}_getWithExpiry(key){const storedItem=localStorage.getItem(key);if(!storedItem)return null;const item=JSON.parse(storedItem);return new Date().getTime()>item.expiry?(localStorage.removeItem(key),null):!0}_toggleVisibility(event){event.detail.sectionId===this.sectionId&&(event.type==="shopify:section:select"?this.open=!0:this.open=!1)}get daysInSeconds(){return this.dayFrequency*864e5}get sectionId(){return this.getAttribute("section-id")}get dayFrequency(){return this.getAttribute("day-frequency")}get delayVisibility(){return this.getAttribute("delay-visibility")}}),window.customElements.define("loess-product-recommendations",class extends HTMLElement{constructor(){super(),this.isLoaded=!1}connectedCallback(){this.initProductRecommendations()}async initProductRecommendations(){if(this.loaded)return;this.loaded=!0;const section=this.closest(".shopify-section"),intent=this.getAttribute("intent")||"related",url=`${Shopify.routes.root}recommendations/products?product_id=${this.getAttribute("product-id")}&limit=${this.getAttribute("limit")||4}§ion_id=${section.id.replace("shopify-section-","")}&intent=${intent}`,response=await fetch(url,{priority:"low"}),productRecommendationsSelector=new DOMParser().parseFromString(await response.text(),"text/html").querySelector("loess-product-recommendations");productRecommendationsSelector.childElementCount>0?this.replaceChildren(...document.importNode(productRecommendationsSelector,!0).childNodes):intent==="related"?section.remove():this.remove()}}),customElements.define("loess-recently-viewed-products",class extends HTMLElement{constructor(){super(),this.loaded=!1,Shopify.designMode||(this.collapsiblePanel=this.querySelector("loess-collapsible-panel"),this.button=this.querySelector('button[is="loess-button"]'),this.button&&this.setAttributesBasedOnLocalStorage())}connectedCallback(){Shopify.designMode||(this.handleState=this._handleState.bind(this),document.addEventListener("expandable-html-element:open",this.handleState),document.addEventListener("expandable-html-element:close",this.handleState),"requestIdleCallback"in window?requestIdleCallback(this._getProductIdSet.bind(this),{timeout:2e3}):this._getProductIdSet())}disconnectedCallback(){document.removeEventListener("expandable-html-element:open",this.handleState),document.removeEventListener("expandable-html-element:close",this.handleState)}async _getProductIdSet(){if(this.loaded)return;this.loaded=!0;const response=await fetch(`${this.fetchUrl}&q=${this.buildQueryString()}`),div=document.createElement("div");div.innerHTML=await response.text();const recentlyViewedProductsElement=div.querySelector("loess-recently-viewed-products");recentlyViewedProductsElement.hasChildNodes()&&(this.innerHTML=recentlyViewedProductsElement.innerHTML),Shopify.designMode||this.setupClearHistoryButton()}_handleState(event){event.stopPropagation(),event.target==this.querySelector("loess-collapsible-panel")&&(event.type=="expandable-html-element:open"?this.setLocalStorageToggle("open"):this.setLocalStorageToggle(""))}setLocalStorageToggle(status){localStorage.setItem("loess:recent-products:toggle",status)}getLocalStorageToggle(){return localStorage.getItem("loess:recent-products:toggle")}setAttributesBasedOnLocalStorage(){localStorage.getItem("loess:recent-products:toggle")==="open"?(this.button.setAttribute("aria-expanded","true"),this.collapsiblePanel.setAttribute("open","")):(this.button.setAttribute("aria-expanded","false"),this.collapsiblePanel.removeAttribute("open"))}buildQueryString(){const items=JSON.parse(localStorage.getItem("loess:recently-viewed-products")||"[]");return this.hasAttribute("excluded-product-id")&&items.includes(parseInt(this.getAttribute("excluded-product-id")))&&items.splice(items.indexOf(parseInt(this.getAttribute("excluded-product-id"))),1),items.map(item=>"id:"+item).slice(0,20).join(" OR ")}setupClearHistoryButton(){const clearHistoryButton=this.querySelector("button[clear-history]");clearHistoryButton&&clearHistoryButton.addEventListener("click",()=>{confirm("Are you sure you want to clear your recently viewed products?")&&(this.style.display="none",localStorage.removeItem("loess:recent-products"))})}get fetchUrl(){return this.getAttribute("fetch-url")}}),window.customElements.define("loess-shipping-calculator",class extends HTMLElement{constructor(){super(),this.button=this.querySelector('button[type="button"]'),this.button.addEventListener("click",this.calculate.bind(this))}async calculate(){const spinner=this.parentElement.querySelector(".shipping-rates__spinner"),results=this.parentElement.querySelector(".shipping-rates__results");this.button.setAttribute("disabled",""),spinner.classList.remove("hide"),results?.remove(),this.country=this.querySelector('[name="shipping-rates[country]"]').value,this.province=this.querySelector('[name="shipping-rates[province]"]').value,this.zip=this.querySelector('[name="shipping-rates[zip]"]').value;const response=await fetch(`${window.LoessTheme.routes.cart_url}/prepare_shipping_rates.json?shipping_address[country]=${this.country}&shipping_address[province]=${this.province}&shipping_address[zip]=${this.zip}`,{method:"POST"});if(response.ok){const shippingRates=await this.getShippingRates();this.injectShippingRates(shippingRates)}else{const jsonError=await response.json();this.injectErrors(jsonError)}spinner.classList.add("hide"),this.button.removeAttribute("disabled")}async getShippingRates(){const responseText=await(await fetch(`${window.LoessTheme.routes.cart_url}/async_shipping_rates.json?shipping_address[country]=${this.country}&shipping_address[province]=${this.province}&shipping_address[zip]=${this.zip}`)).text();return responseText==="null"?this.getShippingRates():JSON.parse(responseText).shipping_rates}injectShippingRates(shippingRates){let shippingRatesList="";shippingRates.forEach(shippingRate=>{shippingRatesList+=`
  • ${shippingRate.presentment_name}: ${shippingRate.currency} ${shippingRate.price}
  • `});const html=`
    ${shippingRates.length===0?window.LoessTheme.strings.shippingCalculatorNoResults:shippingRates.length===1?window.LoessTheme.strings.shippingCalculatorOneResult:window.LoessTheme.strings.shippingCalculatorMultipleResults} ${shippingRatesList===""?"":`
      ${shippingRatesList}
    `}
    `;this.insertAdjacentHTML("afterend",html)}injectErrors(errors){let shippingRatesList="";Object.keys(errors).forEach(errorKey=>{shippingRatesList+=`
  • ${errorKey} ${errors[errorKey]}
  • `});const html=`
    ${window.LoessTheme.strings.shippingCalculatorError}
      ${shippingRatesList}
    `;this.insertAdjacentHTML("afterend",html)}});const LoessVideo=class extends HTMLElement{constructor(){super(),this.loaded=!1}connectedCallback(){this.setupIntersectionObserver(async()=>{this.play(),this.parallax&&(await loadScript("https://cdn.jsdelivr.net/npm/simple-parallax-js@5.6.1/dist/simpleParallax.min.js"),await this.setupSimpleParallax())}),this.handleState=this._handleState.bind(this),document.addEventListener("expandable-html-element:open",this.handleState),document.addEventListener("expandable-html-element:close",this.handleState)}disconnectedCallback(){document.removeEventListener("expandable-html-element:open",this.handleState),document.removeEventListener("expandable-html-element:close",this.handleState)}setupSimpleParallax(){return new Promise(resolve=>{resolve(new simpleParallax(this,{orientation:"down",scale:1.7,customWrapper:"[parallax]"}))})}_handleState(event){event.stopPropagation(),event.target.tagName.toLowerCase()==="loess-modal-video"&&(event.type=="expandable-html-element:open"?this.pause():this.play())}load(){return new Promise(resolve=>{const template=this.querySelector("template"),node=template.content.firstElementChild.cloneNode(!0);node.addEventListener("load",()=>{this.loaded=!0,resolve()}),template.replaceWith(node)})}async play(){this.loaded||await this.load();const coverImage=this.querySelector(":not(iframe)")||this.nextElementSibling;coverImage&&(coverImage.style.display="none"),this.type==="youtube"?this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*"):this.type==="vimeo"&&this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({method:"play"}),"*")}pause(){this.loaded&&(this.type==="youtube"?this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*"):this.type==="vimeo"&&this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({method:"pause"}),"*"))}get type(){return this.getAttribute("type")}get parallax(){return this.parentElement.getAttribute("parallax")==="true"}};Object.assign(LoessVideo.prototype,IntersectionObserverMixin),window.customElements.define("loess-video",LoessVideo); //# sourceMappingURL=/cdn/shop/t/2/assets/theme.js.map?v=102528014611405747341694010501