1export const requestIdleCallback=typeof window.requestIdleCallback=="function"?(cb,opts)=>window.requestIdleCallback(cb,opts):cb=>window.setTimeout(cb,0),yieldToMainThread=()=>"yield"in scheduler?scheduler.yield():new Promise(resolve=>{requestAnimationFrame(()=>{setTimeout(resolve,0)})});export function isLowPowerDevice(){return Number(navigator.hardwareConcurrency)<=2||Number(navigator.deviceMemory)<=2}export function supportsViewTransitions(){return typeof document.startViewTransition=="function"}export const viewTransition={current:void 0};const viewTransitionTypes={"product-grid":async()=>{const grid=document.querySelector(".product-grid"),productCards=[...document.querySelectorAll(".product-grid .product-grid__item")];if(!(!grid||!productCards.length))return await new Promise(resolve=>requestIdleCallback(()=>{const cardsToAnimate=getCardsToAnimate(grid,productCards);productCards.forEach((card,index)=>{index<cardsToAnimate?card.style.setProperty("view-transition-name",`product-card-${card.dataset.productId}`):card.style.setProperty("content-visibility","hidden")}),resolve(null)})),()=>productCards.forEach(card=>{card.style.removeProperty("view-transition-name"),card.style.removeProperty("content-visibility")})}};export function startViewTransition(callback,types){return!supportsViewTransitions()||isLowPowerDevice()||prefersReducedMotion()?Promise.resolve(callback()):new Promise(async resolve=>{let cleanupFunctions=[];if(types){for(const type of types)if(viewTransitionTypes[type]){const cleanupFunction=await viewTransitionTypes[type]();cleanupFunction&&cleanupFunctions.push(cleanupFunction)}}const transition=document.startViewTransition(callback);viewTransition.current||(viewTransition.current=transition.finished),types&&types.forEach(type=>transition.types.add(type)),transition.finished.then(()=>{viewTransition.current=void 0,cleanupFunctions.forEach(cleanupFunction=>cleanupFunction()),resolve()})})}export function fetchConfig(type="json",config={}){const headers={"Content-Type":"application/json",Accept:`application/${type}`,...config.headers};return type==="javascript"&&(headers["X-Requested-With"]="XMLHttpRequest",delete headers["Content-Type"]),{method:"POST",headers,body:config.body}}export function debounce(fn,wait){let timeout;function debounced(...args){clearTimeout(timeout),timeout=setTimeout(()=>fn.apply(this,args),wait)}return debounced.cancel=()=>{clearTimeout(timeout)},debounced}export function throttle(fn,delay){let lastCall=0;function throttled(...args){const now=performance.now();now-lastCall>=delay&&(lastCall=now,fn.apply(this,args))}return throttled.cancel=()=>{lastCall=performance.now()},throttled}const reducedMotion=matchMedia("(prefers-reduced-motion: reduce)");export function prefersReducedMotion(){return reducedMotion.matches}export function normalizeString(str){return str.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase()}export function onDocumentLoaded(callback){document.readyState==="complete"?callback():window.addEventListener("load",callback)}export function onDocumentReady(callback,options){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",callback,options):callback()}export function removeWillChangeOnAnimationEnd(event){const target=event.target;target&&target instanceof HTMLElement&&(target.style.setProperty("will-change","unset"),target.removeEventListener("animationend",removeWillChangeOnAnimationEnd))}export function onAnimationEnd(elements,callback,options={subtree:!0}){const animationPromises=(Array.isArray(elements)?elements.flatMap(element=>element.getAnimations(options)):elements.getAnimations(options)).reduce((acc,animation)=>(animation.timeline instanceof DocumentTimeline&&acc.push(animation.finished),acc),[]);return Promise.allSettled(animationPromises).then(callback)}const scrollLockOwners=new Set;let scrollLockObserver;function pruneDisconnectedScrollLockOwners(){for(const owner of scrollLockOwners)owner.isConnected||scrollLockOwners.delete(owner)}function syncScrollLock(){if(pruneDisconnectedScrollLockOwners(),scrollLockOwners.size>0){document.documentElement.setAttribute("scroll-lock",""),scrollLockObserver||(scrollLockObserver=new MutationObserver(syncScrollLock),scrollLockObserver.observe(document.documentElement,{childList:!0,subtree:!0}));return}document.documentElement.removeAttribute("scroll-lock"),scrollLockObserver?.disconnect(),scrollLockObserver=void 0}export function lockScroll(owner){scrollLockOwners.add(owner),syncScrollLock()}export function unlockScroll(owner){scrollLockOwners.delete(owner),syncScrollLock()}export function isClickedOutside(event,element){return event.target instanceof HTMLDialogElement||!(event.target instanceof Element)?!isPointWithinElement(event.clientX,event.clientY,element):!element.contains(event.target)}export function isPointWithinElement(x,y,element){const{left,right,top,bottom}=element.getBoundingClientRect();return x>=left&&x<=right&&y>=top&&y<=bottom}export const mediaQueryLarge=matchMedia("(min-width: 750px)");export function isMobileBreakpoint(){return!mediaQueryLarge.matches}
1export function isDesktopBreakpoint(){return mediaQueryLarge.matches}export function isTouchDevice(){return"ontouchstart"in window&&navigator.maxTouchPoints>0}export function clamp(value,min,max){return Math.max(min,Math.min(value,max))}export function center(element,axis){const{left,width,top,height}=element.getBoundingClientRect(),point={x:left+width/2,y:top+height/2};return axis?point[axis]:point}export function start(element,axis){const{left,top}=element.getBoundingClientRect(),point={x:left,y:top};return axis?point[axis]:point}export function closest(values,target){return values.reduce(function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})}export function preventDefault(event){event.preventDefault()}export function getVisibleElements(root,elements,ratio=1,axis){if(!elements?.length)return[];const rootRect=root.getBoundingClientRect();return elements.filter(element=>{const{width,height,top,right,left,bottom}=element.getBoundingClientRect();if(ratio<1){const intersectionLeft=Math.max(rootRect.left,left),intersectionRight=Math.min(rootRect.right,right),intersectionWidth=Math.max(0,intersectionRight-intersectionLeft);if(axis==="x")return width>0&&intersectionWidth/width>=ratio;const intersectionTop=Math.max(rootRect.top,top),intersectionBottom=Math.min(rootRect.bottom,bottom),intersectionHeight=Math.max(0,intersectionBottom-intersectionTop);if(axis==="y")return height>0&&intersectionHeight/height>=ratio;const intersectionArea=intersectionWidth*intersectionHeight,elementArea=width*height;return elementArea>0&&intersectionArea/elementArea>=ratio}const isWithinX=left>=rootRect.left&&right<=rootRect.right;if(axis==="x")return isWithinX;const isWithinY=top>=rootRect.top&&bottom<=rootRect.bottom;return(axis==="y"||isWithinX)&&isWithinY})}export function getIOSVersion(){const{userAgent}=navigator;if(!/(iPhone|iPad)/i.test(userAgent))return null;const version=userAgent.match(/OS ([\d_]+)/)?.[1],[major,minor]=version?.split("_")||[];return!version||!major?null:{fullString:version.replace("_","."),major:parseInt(major,10),minor:minor?parseInt(minor,10):0}}function getCardsToAnimate(grid,cards){if(!grid||!cards||cards.length===0)return 0;const itemSample=cards[0];if(!itemSample)return 0;const gridRect=grid.getBoundingClientRect(),visibleArea={top:Math.max(0,gridRect.top),bottom:Math.min(window.innerHeight,gridRect.bottom)},visibleHeight=Math.round(visibleArea.bottom-visibleArea.top);if(visibleHeight<=0)return 0;const cardSample=itemSample.querySelector("product-card"),gridStyle=getComputedStyle(grid),galleryAspectRatio=cardSample?.refs?.cardGallery?.style.getPropertyValue("--gallery-aspect-ratio")||"";let aspectRatio=parseFloat(galleryAspectRatio)||.5;if(galleryAspectRatio?.includes("/")){const[width="1",height="2"]=galleryAspectRatio.split("/");aspectRatio=parseInt(width,10)/parseInt(height,10)}const cardGap=parseInt(cardSample?.refs?.productCardLink?.style.getPropertyValue("--product-card-gap")||"")||12,gridGap=parseInt(gridStyle.getPropertyValue("--product-grid-gap"))||12,detailsSize=((parseInt(gridStyle.fontSize)||16)+2)*2,isMobile=window.innerWidth<750,cardWidth=isMobile?Math.round((gridRect.width-gridGap)/2):100,cardHeight=Math.round(cardWidth/aspectRatio)+cardGap+detailsSize,columnsInGrid=isMobile?2:Math.floor((gridRect.width+gridGap)/(cardWidth+gridGap)),rowsInGrid=Math.ceil((visibleHeight-gridGap)/(cardHeight+gridGap));return columnsInGrid*rowsInGrid}export function preloadImage(src){const image=new Image;image.src=src}export class TextComponent extends HTMLElement{shimmer(){this.setAttribute("shimmer","")}}customElements.get("text-component")||customElements.define("text-component",TextComponent);export function resetShimmer(container=document.body){container.querySelectorAll("[shimmer]").forEach(item=>item.removeAttribute("shimmer"))}export function changeMetaThemeColor(color){const metaThemeColor=document.head.querySelector('meta[name="theme-color"]');metaThemeColor&&color&&metaThemeColor.setAttribute("content",color)}export function getViewParameterValue(){return new URLSearchParams(window.location.search).get("view")}export function parseIntOrDefault(value,defaultValue){if(value==null||value==="")return defaultValue;const parsed=parseInt(value.toString());return isNaN(parsed)?defaultValue:parsed}class Scheduler{#queue=new Set;#scheduled=!1;schedule=async task=>{this.#queue.add(task),this.#scheduled||(this.#scheduled=!0,viewTransition.current&&await viewTransition.current,requestAnimationFrame(this.flush))};flush=()=>{for(const task of this.#queue)setTimeout(task,0);this.#queue.clear(),this.#scheduled=!1}}
1export const scheduler=new Scheduler;export function oncePerEditorSession(element,sessionKeyName,callback){const isInThemeEditor=window.Shopify?.designMode,shopifyEditorSectionId=JSON.parse(element.dataset.shopifyEditorSection||"{}").id,shopifyEditorBlockId=JSON.parse(element.dataset.shopifyEditorBlock||"{}").id,uniqueSessionKey=`${sessionKeyName}-${shopifyEditorSectionId||shopifyEditorBlockId}`;isInThemeEditor&&sessionStorage.getItem(uniqueSessionKey)||(callback(),isInThemeEditor&&sessionStorage.setItem(uniqueSessionKey,"true"))}export class ResizeNotifier extends ResizeObserver{#initialized=!1;constructor(callback){super(entries=>{if(this.#initialized)return callback(entries,this);this.#initialized=!0})}disconnect(){this.#initialized=!1,super.disconnect()}}export function setHeaderMenuStyle(){const headerComponent=document.querySelector("#header-component");headerComponent&&window.requestAnimationFrame(()=>{const overflowList=headerComponent?.querySelector("overflow-list"),hasReachedMinimum=overflowList&&overflowList.hasAttribute("minimum-reached");headerComponent.dataset.menuStyle=isTouchDevice()||hasReachedMinimum?"drawer":"menu"})}export function calculateHeaderGroupHeight(header=document.querySelector("#header-component"),headerGroup=document.querySelector("#header-group")){if(!headerGroup)return 0;let totalHeight=0;const children=headerGroup.children;for(let i=0;i<children.length;i++){const element=children[i];element===header||!(element instanceof HTMLElement)||(totalHeight+=element.offsetHeight)}return header instanceof HTMLElement&&header.hasAttribute("transparent")&&header.parentElement?.nextElementSibling?totalHeight+header.offsetHeight:totalHeight}function updateTransparentHeaderOffset(){const header=document.querySelector("#header-component"),hasHeaderSection=document.querySelector("#header-group")?.querySelector(".header-section");if(!hasHeaderSection||!header?.hasAttribute("transparent")){document.body.style.setProperty("--transparent-header-offset-boolean","0");return}const shouldApplyOffset=hasHeaderSection.nextElementSibling?.classList.contains("shopify-section")?"0":"1";document.body.style.setProperty("--transparent-header-offset-boolean",shouldApplyOffset)}function updateHeaderHeights(){const header=document.querySelector("header-component");if(!(header instanceof HTMLElement))return;const headerHeight=header.offsetHeight,headerGroupHeight=calculateHeaderGroupHeight(header),headerTopRow=header.querySelector(".header__row--top");document.body.style.setProperty("--header-height",`${headerHeight}px`),document.body.style.setProperty("--header-group-height",`${headerGroupHeight}px`),headerTopRow&&window.requestAnimationFrame(function(){header.style.setProperty("--top-row-height",`${headerTopRow.offsetHeight}px`)})}export function updateAllHeaderCustomProperties(){updateHeaderHeights(),updateTransparentHeaderOffset(),setHeaderMenuStyle()}typeof Theme<"u"&&(Theme.utilities={...Theme.utilities,scheduler}); 2//# sourceMappingURL=/cdn/shop/t/3/assets/utilities.js.map?v=86469562398914351581782122108
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.