1export function shopRoot(){return window.Shopify?.routes?.root||"/"}export function openCart(){customElements.whenDefined("ia-cart").then(()=>document.querySelector("ia-cart")?.open())}export function formatPrice(cents,{stripZeroCents=!0}={}){const dollars=cents/100,formatted=new Intl.NumberFormat("en-US",{style:"currency",currency:Shopify.currency.active}).format(dollars);return stripZeroCents?formatted.replace(/\.00$/,""):formatted}export function getTimestamp(){return new Date().getTime()}export function fetchConfig(){return{method:"POST",headers:{"Content-Type":"application/json"}}}export async function handleFetchResponse(response){if(!response.ok){const error=await response.json();throw new Error(error?.description||error.message||"An error occurred")}return response.json()}export async function addToCart(formData){const config=fetchConfig("javascript");config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"],config.body=formData;const response=await fetch(`${shopRoot()}cart/add.js`,config);return handleFetchResponse(response)}export async function updateCart({data}){const response=await fetch(`${shopRoot()}cart/update.js`,{...fetchConfig(),body:JSON.stringify({...data})});return handleFetchResponse(response)}export async function changeCart({id,quantity,planId,sections}){const response=await fetch(`${shopRoot()}cart/change.js`,{...fetchConfig(),body:JSON.stringify({id,quantity,selling_plan:planId,sections})});return handleFetchResponse(response)}export function reviveScripts(root){root.querySelectorAll("script").forEach(stale=>{const fresh=document.createElement("script");for(const{name,value}of stale.attributes)fresh.setAttribute(name,value);fresh.textContent=stale.textContent,stale.replaceWith(fresh)})}export async function processDynamicHTML(html){html.querySelectorAll("style").forEach(styleTag=>{const styleId=styleTag.id||`dynamic-style-${Date.now()}-${Math.random()}`;if(!document.getElementById(styleId)){const newStyle=document.createElement("style");styleTag.id&&(newStyle.id=styleTag.id),newStyle.textContent=styleTag.textContent,document.head.appendChild(newStyle)}});const scriptTags=html.querySelectorAll("script"),scriptPromises=[];scriptTags.forEach(scriptTag=>{if(scriptTag.type==="module"){const newScript=document.createElement("script");newScript.type="module",scriptTag.src?newScript.src=scriptTag.src:newScript.textContent=scriptTag.textContent,(document.body||document.documentElement).appendChild(newScript);const promise=new Promise(resolve=>{newScript.onload=resolve,newScript.onerror=resolve,setTimeout(resolve,3e3)});scriptPromises.push(promise)}else if(scriptTag.src){const newScript=document.createElement("script");newScript.src=scriptTag.src,scriptTag.async&&(newScript.async=!0),scriptTag.defer&&(newScript.defer=!0);const promise=new Promise(resolve=>{newScript.onload=resolve,newScript.onerror=resolve,setTimeout(resolve,2e3)});scriptPromises.push(promise),document.head.appendChild(newScript)}else if(scriptTag.textContent.trim())try{new Function(scriptTag.textContent)()}catch(error){console.warn("processDynamicHTML: Error executing inline script",error)}}),await Promise.all(scriptPromises)}export function debugEnabled(){if(window.iaDebugAllowed!==!0)return!1;try{return new URLSearchParams(window.location.search).has("ia-debug")||window.localStorage.getItem("ia-debug")==="1"}catch{return!1}}export const IMAGE_LADDER=[90,180,360,540,720,900,1080,1296,1512,1728,1944,2160,2376,2592,2880,3024,3440,3840,4472];export function srcsetFor(url,naturalWidth,slot){if(!url)return"";const at=w=>url+(url.includes("?")?"&":"?")+"width="+w,ladder=slot?[slot,slot*2,slot*3]:IMAGE_LADDER,rungs=naturalWidth?ladder.filter(w=>w<naturalWidth):ladder.slice();return naturalWidth&&rungs.push(naturalWidth),rungs.map(w=>`${at(w)} ${w}w`).join(", ")}export function lockPage(locked){const body=document.body;body.classList.contains("ia-overflow-hidden")!==locked&&(body.classList.toggle("ia-overflow-hidden",locked),window.dispatchEvent(new Event("resize")))} 2//# sourceMappingURL=/cdn/shop/t/568/assets/ia-util-helpers.js.map?v=64950726974168162851790194901
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.