1const genericCache=new Map;export async function fetchCache(url,prefix="",options={}){const cacheKey=url+prefix;if(genericCache.has(cacheKey)){const{body,headers}=genericCache.get(cacheKey);return Promise.resolve(new Response(body,{headers}))}const res=await fetch(url,options);if(res.status===200){const clone=res.clone(),body=await clone.text(),headersObj={};for(const[key,value]of clone.headers.entries())headersObj[key]=value;genericCache.set(cacheKey,{body,headers:headersObj})}return res}export function hasInFetchCache(urlPrefix){return genericCache.has(urlPrefix)}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,...config.customt4&&{customt4:config.customt4}}}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(callback){let requestId=null,lastArgs=null;const throttled=function(...args){lastArgs=args,requestId===null&&(requestId=requestAnimationFrame(()=>{callback.apply(this,lastArgs),requestId=null,lastArgs=null}))};return throttled.cancel=()=>{requestId!==null&&(cancelAnimationFrame(requestId),requestId=null)},throttled}const{currencyFormat,currencyCode}=themeHDN.settings,placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,rate=parseFloat(Shopify.currency?.rate||1)*(themeHDN.settings.currencyFormat.indexOf("with_comma_separator")==-1?100:1);export class currency{static getCents(money){return currencyFormat.indexOf("with_comma_separator")!==-1&&(money=money.replace(/[,.]/g,match=>match===","?".":",")),parseFloat(money.replace(/^[^0-9]+|[^0-9.]/g,"",""),10)*rate}static#formatWithDelimiters(number,precision=2,thousands=",",decimal="."){if(isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);let parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount}static formatMoney(cents,format=currencyFormat){if(currencyCode&&typeof Intl<"u"){const amount=Number(cents)/100,noDecimals=format.includes("amount_no_decimals");return new Intl.NumberFormat(document.documentElement.lang||"en-US",{style:"currency",currency:currencyCode,currencyDisplay:"symbol",...noDecimals?{minimumFractionDigits:0,maximumFractionDigits:0}:{}}).format(amount)}let value="";switch(typeof cents=="string"&&(cents=cents.replace(".","")),format.match(placeholderRegex)[1]){case"amount":value=this.#formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=this.#formatWithDelimiters(cents,0);break;case"amount_with_space_separator":value=this.#formatWithDelimiters(cents,2," ",".");break;case"amount_with_comma_separator":value=this.#formatWithDelimiters(cents,2,".",",");break;case"amount_with_apostrophe_separator":value=this.#formatWithDelimiters(cents,2,"'",".");break;case"amount_no_decimals_with_comma_separator":value=this.#formatWithDelimiters(cents,0,".",",");break;case"amount_no_decimals_with_space_separator":value=this.#formatWithDelimiters(cents,0," ");break;case"amount_no_decimals_with_apostrophe_separator":value=this.#formatWithDelimiters(cents,0,"'");break}return format.replace(placeholderRegex,value)}static convert(money,format){return this.formatMoney(this.getCents(money),format)}}export function $4(selector,container=document){return container?container.querySelector(selector):null}export function $id4(selector){return document.getElementById(selector)}export function $$4(selector,container=document){return container?[...container.querySelectorAll(selector)]:null}const predefinedMediaQueries={mobile:"screen and (max-width: 767px)",tablet:"screen and (min-width: 768px) and (max-width: 1149px)",hover:"screen and (hover: hover) and (pointer: fine)",motion:"(prefers-reduced-motion: no-preference)"};export function matchMediaQuery(type){return window.matchMedia(predefinedMediaQueries[type]||type).matches}
1export function createImg(imgObj={}){const img=new Image,attrs=imgObj.attrs||{},{alt,src}=imgObj;for(const key in attrs)img.setAttribute(key,attrs[key]);return img.alt=alt||"",img.src=src,img.srcset=renderSrcset(src,JSON.parse(attrs["data-widths"])),imgObj.onload&&img.addEventListener("load",function(){const parentImage=img.parentElement||img;parentImage.removeAttribute("loading"),parentImage.setAttribute("loaded","")},{once:!0}),img}function normalizeImageSrc(src){return/^https?:\/\//.test(src)?src:`https://${src.replace(/^\/+/,"")}`}export function renderSrcset(baseSrc,widths){const url=new URL(normalizeImageSrc(baseSrc)),maxWidth=parseInt(url.searchParams.get("width")||widths[widths.length-1]);return widths.filter(w=>w<=maxWidth).map(w=>(url.searchParams.set("width",w),`${url.toString()} ${w}w`)).join(", ")}export const requestIdleCallback=typeof window.requestIdleCallback=="function"?window.requestIdleCallback:setTimeout,yieldToMainThread=()=>typeof scheduler<"u"&&"yield"in scheduler?scheduler.yield():new Promise(resolve=>{requestAnimationFrame(()=>{setTimeout(resolve,0)})});export function checkImagesLoaded(source){if(!source)return Promise.resolve();const promises=(Array.isArray(source)?source:[source]).map(item=>new Promise((resolve,reject)=>{let img;if(typeof item=="string")img=new Image,img.src=item;else if(item instanceof HTMLImageElement){if(img=item,img.complete&&img.naturalWidth!==0)return resolve(img)}else return reject(new TypeError("Invalid image source"));img.addEventListener("load",()=>resolve(img),{once:!0}),img.addEventListener("error",()=>reject(new Error(`Failed to load ${img.src}`)),{once:!0})}));return Promise.all(promises)}function isVisible(element){return element.offsetWidth>0||element.offsetHeight>0}export function getArrVisible(arrDom){return arrDom.filter(el=>isVisible(el))}export const admEvts={select:"shopify:block:select",deselect:"shopify:block:deselect",seSelect:"shopify:section:select",seDeselect:"shopify:section:deselect",seLoad:"shopify:section:load",seUnload:"shopify:section:unload",seReorder:"shopify:section:reorder"};export class AutoplayElement extends HTMLElement{#controller;constructor(){super(),this.timer=null,this.isPlaying=!1,this.isPaused=this.interval,this.timeRemaining=new WeakMap,this.startTime=new WeakMap,this.timerMap=new WeakMap,this.elementSet=new WeakSet}get interval(){return this._interval=this._interval||parseInt(this.getAttribute("autoplay"))||0}get customPlayFn(){return null}get customPauseFn(){return null}get _this(){return this.getAttribute("pause-on-hover")?this.closest(this.getAttribute("pause-on-hover"))||this:this}connectedCallback(){if(this.#controller=new AbortController,!this.interval)return;this.timeRemaining.set(this,this.interval);const{signal}=this.#controller,_this=this._this;this.play(),this.hasAttribute("pause-on-hover")&&(_this.addEventListener("mouseenter",this.pause.bind(this),{signal}),_this.addEventListener("mouseleave",this.resume.bind(this),{signal})),this.initObserver(),document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this),{signal}),Shopify.designMode?(this.addEventListener(admEvts.select,()=>{this.forceStop=!0,this.pause()},{signal}),this.addEventListener(admEvts.deselect,()=>{this.forceStop=!1,this.resume()},{signal})):(_this.addEventListener("focusin",this.pause.bind(this),{signal}),_this.addEventListener("focusout",this.resume.bind(this),{signal}))}disconnectedCallback(){this.#controller.abort(),this.stop(),this.destroy()}initObserver(){new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting?(this.inView=!0,this.resume()):(this.inView=!1,this.pause())})}).observe(this),this.elementSet.add(this)}handleVisibilityChange(){document.hidden?this.pause():this.inView&&this.resume()}play(){if(!this.interval||this.isPlaying&&!this.isPaused)return;this.isPlaying=!0,this.isPaused=!1,this.startTime.set(this,performance.now());const timer=setTimeout(()=>{this.isPlaying=!1,this.timeRemaining.set(this,this.interval),this.play(),this.customPlayFn&&this.customPlayFn(this)},this.timeRemaining.get(this)||this.interval);this.timerMap.set(this,timer),this.updateRemainingState()}pause(){if(!this.isPlaying||this.isPaused)return;const timer=this.timerMap.get(this);clearTimeout(timer),this.isPaused=!0,this.isPlaying=!1;const elapsed=performance.now()-this.startTime.get(this);this.timeRemaining.set(this,Math.max((this.timeRemaining.get(this)||this.interval)-elapsed,
160)),this.customPauseFn&&this.customPauseFn(this),this.updateRemainingState()}resume(){this.isPaused&&(this.isPaused=!1,this.play())}stop(){const timer=this.timerMap.get(this);clearTimeout(timer),this.isPlaying=!1,this.isPaused=!1,this.timeRemaining.set(this,this.interval),this.updateRemainingState()}reset(){this.forceStop||(this.stop(),this.play())}destroy(){const observer=this.elementSet.has(this)?this.elementSet.delete(this):null;this.elementSet=null,this.timeRemaining=null,this.startTime=null,this.timerMap=null}updateRemainingState(){this.style.setProperty("--hdt-play-state",this.isPaused?"paused":"running")}}export const animationContent={none:"none",ani0:["translateY(0)","translateY(0)"],ani1:["translateY(150px)","translateY(0)"],ani2:["translateY(-150px)","translateY(0)"],ani3:["translateX(-500px)","translateX(0)"],ani4:["translateX(500px)","translateX(0)"],ani5:["translateX(-150px)","translateX(0)"],ani6:["translateX(150px)","translateX(0)"],ani7:["scale(0.6)","scale(1)"],ani8:["translateY(100px) rotate3d(1, 0, 0, 90deg) scale(0.6)","perspective(1000px) translateY(0) rotate3d(1, 0, 0, 0deg) scale(1)"],ani9:["translateY(-100px) rotate3d(1, 0, 0, 90deg) scale(0.6)","perspective(1000px) translateY(0) rotate3d(1, 0, 0, 0deg) scale(1)"],ani10:["translateX(-100px) rotate3d(0, 1, 0, -90deg) scale(0.6)","perspective(1000px) translateY(0px) rotate3d(0, 1, 0, 0deg) scale(1)"],ani11:["translateX(100px) rotate3d(0, 1, 0, 90deg) scale(0.6)","perspective(1000px) translateY(0px) rotate3d(0, 1, 0, 0deg) scale(1)"]},expiresManager={PREFIX:"theme4:",set(key,minDays){localStorage.setItem(`${this.PREFIX}${key}`,JSON.stringify({expires:Date.now()+minDays*864e5}))},check(key){const raw=localStorage.getItem(`${this.PREFIX}${key}`);if(!raw)return null;try{const{expires}=JSON.parse(raw);return Date.now()<expires?!0:(localStorage.removeItem(`${this.PREFIX}${key}`),!1)}catch{return localStorage.removeItem(`${this.PREFIX}${key}`),!1}}};const liveRegion=document.getElementById("hdt-cart-live-region");export const announce=(message,isError=!1)=>{liveRegion&&(liveRegion.setAttribute("aria-live",isError?"assertive":"polite"),liveRegion.textContent="",setTimeout(()=>{liveRegion.textContent=message},100))}; 2//# sourceMappingURL=/cdn/shop/t/12/assets/utilities.js.map?v=85449539673680879391790868953
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.