@occluze/tether 0.6.4 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- (()=>{var fn=Object.defineProperty;var M=(t,e)=>{for(var n in e)fn(t,n,{get:e[n],enumerable:!0})};var Lt={};M(Lt,{DEFAULTS:()=>Xt,cfg:()=>o,configure:()=>Zt,isConfigured:()=>Tt,log:()=>q,reportError:()=>P,warn:()=>U});var Xt={domain:"",token:"",apiVersion:"2026-07",country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,revalidate:!0,storageKey:null,cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",variantUrl:!1,maxAge:60,lowStock:5,autoMount:!0,observe:!1,astro:!0,partsUrl:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},o={...Xt};function Zt(t={}){return Object.keys(o).forEach(e=>delete o[e]),Object.assign(o,Xt,t),o.domain&&(o.domain=String(o.domain).replace(/^https?:\/\//,"").replace(/\/.*$/,"")),o.storageKey||(o.storageKey=`${o.prefix}:cart:${o.domain}`),o.apiVersion==="unstable"&&U('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),o}var Tt=()=>!!(o.domain&&o.token);function q(...t){o.debug&&console.log(`[${o.prefix}]`,...t)}function U(...t){console.warn(`[${o.prefix}]`,...t)}function P(t,e){if(U(e,t&&(t.message||t.code)?t.message||t.code:t),typeof o.onError=="function")try{o.onError(t,e)}catch{}}var re={};M(re,{TetherError:()=>E,endpoint:()=>Be,gql:()=>_,request:()=>qt,unwrap:()=>ne,withContext:()=>Ot});var E=class extends Error{constructor(e,{status:n,errors:r,userErrors:i,code:s}={}){super(e),this.name="TetherError",this.code=s||(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=r,this.userErrors=i}};function Be(t=o){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}function Ot(t,e=o){let n=[];if(e.country&&n.push(`country: ${String(e.country).toUpperCase()}`),e.language&&n.push(`language: ${String(e.language).toUpperCase().replace("-","_")}`),!n.length||/@inContext/.test(t))return t;let r=`@inContext(${n.join(", ")})`;return/^\s*\{/.test(t)?`query ${r} ${t.trimStart()}`:t.replace(/^(\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?)/,`$1 ${r}`)}var te=t=>new Promise(e=>setTimeout(e,t));function ee(t,e){return t===401||t===403?`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${/^shpat_/.test(e.token)?", not an Admin API token (shpat_\u2026)":""}`:t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}async function qt(t,e,n={},{context:r=!0}={}){if(!t.domain||!t.token)throw new E("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let i=r?Ot(e,t):e,s=t.maxAge??60;s>0&&!/^\s*mutation\b/.test(i)&&(i+=` #${Math.floor(Date.now()/(s*1e3))}`);let a=JSON.stringify({query:i,variables:n}),c=0;for(;;){let u;try{u=await(t.fetch||fetch)(Be(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:a})}catch(m){if(c++<t.retries){await te(300*2**c);continue}throw new E(`Network error: ${m.message}`,{code:"NETWORK"})}if(u.status===430)throw new E("Shopify security rejection (430)",{status:430});if((u.status===429||u.status>=500)&&c++<t.retries){q("retry",u.status,c),await te(300*2**c);continue}let h;try{h=await u.json()}catch{throw new E(u.ok?`Invalid response (${u.status})`:ee(u.status,t),{status:u.status})}if(h.errors?.length){if(h.errors.some(C=>/quantityAvailable/.test(C.message||""))&&/\bquantityAvailable\b/.test(a))return q("no inventory permission, retrying without quantityAvailable"),qt(t,e.replace(/\bquantityAvailable\b/g,""),n,{context:r});if(h.errors.some(C=>/'warnings'/.test(C.message||""))&&/warnings \{ code message target \}/.test(e))return qt(t,e.replace(/ warnings \{ code message target \}/g,""),n,{context:r});if(h.errors.some(C=>C.extensions?.code==="THROTTLED")&&c++<t.retries){await te(500*2**c);continue}let v=h.errors.map(C=>C.message).filter(Boolean).join(" | ");throw new E(u.ok?v||"Storefront API error":u.status===401||u.status===403||!v?ee(u.status,t):v,{status:u.status,errors:h.errors})}if(!u.ok)throw new E(ee(u.status,t),{status:u.status});return h.data}}var _=(t,e,n)=>qt(o,t,e,n);function ne(t,e){if(!t)throw new E(`${e}: empty response`);let n=t.userErrors||[];if(n.length)throw new E(n.map(r=>r.message).join(" | "),{userErrors:n});return t}var Ee={};M(Ee,{Cart:()=>A,focusables:()=>Rt,toLineInput:()=>Ze});var se={};M(se,{ALLOCATION_FIELDS:()=>He,SELLING_PLAN_FIELDS:()=>Qe,cartFragment:()=>Nt,collectionFields:()=>ie,metafieldIdentifiers:()=>Ke,productFragment:()=>gt});var x="amount currencyCode",tt="url altText width height";function Ke(t=o){return(t.metafields||[]).map(e=>{if(typeof e=="string"){let n=e.indexOf(".");return{namespace:e.slice(0,n),key:e.slice(n+1)}}return e}).filter(e=>e.namespace&&e.key)}function mn(t=o){let e=Ke(t);return e.length?`metafields(identifiers:[${e.map(r=>`{namespace: ${JSON.stringify(r.namespace)}, key: ${JSON.stringify(r.key)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${tt}}}}}`:""}var Qe=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${x}}}... on SellingPlanFixedPriceAdjustment{price{${x}}}}}`,He=` sellingPlan{id}checkoutChargeAmount{${x}}remainingBalanceChargeAmount{${x}}priceAdjustments{price{${x}}compareAtPrice{${x}}perDeliveryPrice{${x}}unitPrice{${x}}}`;function gt(t=o){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${tt}}images(first:${t.imagesFirst}){nodes{${tt}}}options{name optionValues{name swatch{color image{previewImage{${tt}}}}}}priceRange{minVariantPrice{${x}}maxVariantPrice{${x}}}compareAtPriceRange{minVariantPrice{${x}}maxVariantPrice{${x}}}${mn(t)} sellingPlanGroups(first:${t.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${t.sellingPlansFirst}){nodes{${Qe}}}}}variants(first:${t.variantsFirst}){nodes{id title availableForSale currentlyNotInStock quantityAvailable sku barcode selectedOptions{name value}image{${tt}}price{${x}}compareAtPrice{${x}}unitPrice{${x}}sellingPlanAllocations(first:${t.sellingPlansFirst}){nodes{${He}}}}}}`}function Nt(){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${x}}totalAmount{${x}}checkoutChargeAmount{${x}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${x}}subtotalAmount{${x}}amountPerQuantity{${x}}compareAtAmountPerQuantity{${x}}}discountAllocations{discountedAmount{${x}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${x}}priceAdjustments{price{${x}}compareAtPrice{${x}}perDeliveryPrice{${x}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping quantityAvailable image{${tt}}price{${x}}compareAtPrice{${x}}selectedOptions{name value}product{id title handle vendor featuredImage{${tt}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}function ie(){return`
1
+ (()=>{var fn=Object.defineProperty;var M=(t,e)=>{for(var n in e)fn(t,n,{get:e[n],enumerable:!0})};var Lt={};M(Lt,{DEFAULTS:()=>Zt,cfg:()=>o,configure:()=>te,isConfigured:()=>Tt,log:()=>O,reportError:()=>P,warn:()=>U});var Zt={domain:"",token:"",apiVersion:"2026-07",country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,revalidate:!0,storageKey:null,cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",variantUrl:!1,maxAge:60,lowStock:5,autoMount:!0,observe:!1,astro:!0,partsUrl:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},o={...Zt};function te(t={}){return Object.keys(o).forEach(e=>delete o[e]),Object.assign(o,Zt,t),o.domain&&(o.domain=String(o.domain).replace(/^https?:\/\//,"").replace(/\/.*$/,"")),o.storageKey||(o.storageKey=`${o.prefix}:cart:${o.domain}`),o.apiVersion==="unstable"&&U('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),o}var Tt=()=>!!(o.domain&&o.token);function O(...t){o.debug&&console.log(`[${o.prefix}]`,...t)}function U(...t){console.warn(`[${o.prefix}]`,...t)}function P(t,e){if(U(e,t&&(t.message||t.code)?t.message||t.code:t),typeof o.onError=="function")try{o.onError(t,e)}catch{}}var ie={};M(ie,{TetherError:()=>E,endpoint:()=>Ke,gql:()=>_,request:()=>qt,unwrap:()=>re,withContext:()=>Ot});var E=class extends Error{constructor(e,{status:n,errors:r,userErrors:i,code:s}={}){super(e),this.name="TetherError",this.code=s||(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=r,this.userErrors=i}};function Ke(t=o){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}function Ot(t,e=o){let n=[];if(e.country&&n.push(`country: ${String(e.country).toUpperCase()}`),e.language&&n.push(`language: ${String(e.language).toUpperCase().replace("-","_")}`),!n.length||/@inContext/.test(t))return t;let r=`@inContext(${n.join(", ")})`;return/^\s*\{/.test(t)?`query ${r} ${t.trimStart()}`:t.replace(/^(\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?)/,`$1 ${r}`)}var ee=t=>new Promise(e=>setTimeout(e,t));function ne(t,e){return t===401||t===403?`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${/^shpat_/.test(e.token)?", not an Admin API token (shpat_\u2026)":""}`:t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}async function qt(t,e,n={},{context:r=!0}={}){if(!t.domain||!t.token)throw new E("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let i=r?Ot(e,t):e,s=t.maxAge??60;s>0&&!/^\s*mutation\b/.test(i)&&(i+=` #${Math.floor(Date.now()/(s*1e3))}`);let a=JSON.stringify({query:i,variables:n}),c=0;for(;;){let u;try{u=await(t.fetch||fetch)(Ke(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:a})}catch(m){if(c++<t.retries){await ee(300*2**c);continue}throw new E(`Network error: ${m.message}`,{code:"NETWORK"})}if(u.status===430)throw new E("Shopify security rejection (430)",{status:430});if((u.status===429||u.status>=500)&&c++<t.retries){O("retry",u.status,c),await ee(300*2**c);continue}let h;try{h=await u.json()}catch{throw new E(u.ok?`Invalid response (${u.status})`:ne(u.status,t),{status:u.status})}if(h.errors?.length){if(h.errors.some(C=>/quantityAvailable/.test(C.message||""))&&/\bquantityAvailable\b/.test(a))return O("no inventory permission, retrying without quantityAvailable"),qt(t,e.replace(/\bquantityAvailable\b/g,""),n,{context:r});if(h.errors.some(C=>/'warnings'/.test(C.message||""))&&/warnings \{ code message target \}/.test(e))return qt(t,e.replace(/ warnings \{ code message target \}/g,""),n,{context:r});if(h.errors.some(C=>C.extensions?.code==="THROTTLED")&&c++<t.retries){await ee(500*2**c);continue}let v=h.errors.map(C=>C.message).filter(Boolean).join(" | ");throw new E(u.ok?v||"Storefront API error":u.status===401||u.status===403||!v?ne(u.status,t):v,{status:u.status,errors:h.errors})}if(!u.ok)throw new E(ne(u.status,t),{status:u.status});return h.data}}var _=(t,e,n)=>qt(o,t,e,n);function re(t,e){if(!t)throw new E(`${e}: empty response`);let n=t.userErrors||[];if(n.length)throw new E(n.map(r=>r.message).join(" | "),{userErrors:n});return t}var Ce={};M(Ce,{Cart:()=>A,focusables:()=>Rt,toLineInput:()=>tn});var ae={};M(ae,{ALLOCATION_FIELDS:()=>Ge,SELLING_PLAN_FIELDS:()=>He,cartFragment:()=>Nt,collectionFields:()=>se,metafieldIdentifiers:()=>Qe,productFragment:()=>gt});var w="amount currencyCode",tt="url altText width height";function Qe(t=o){return(t.metafields||[]).map(e=>{if(typeof e=="string"){let n=e.indexOf(".");return{namespace:e.slice(0,n),key:e.slice(n+1)}}return e}).filter(e=>e.namespace&&e.key)}function mn(t=o){let e=Qe(t);return e.length?`metafields(identifiers:[${e.map(r=>`{namespace: ${JSON.stringify(r.namespace)}, key: ${JSON.stringify(r.key)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${tt}}}}}`:""}var He=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${w}}}... on SellingPlanFixedPriceAdjustment{price{${w}}}}}`,Ge=` sellingPlan{id}checkoutChargeAmount{${w}}remainingBalanceChargeAmount{${w}}priceAdjustments{price{${w}}compareAtPrice{${w}}perDeliveryPrice{${w}}unitPrice{${w}}}`;function gt(t=o){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${tt}}images(first:${t.imagesFirst}){nodes{${tt}}}options{name optionValues{name swatch{color image{previewImage{${tt}}}}}}priceRange{minVariantPrice{${w}}maxVariantPrice{${w}}}compareAtPriceRange{minVariantPrice{${w}}maxVariantPrice{${w}}}${mn(t)} sellingPlanGroups(first:${t.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${t.sellingPlansFirst}){nodes{${He}}}}}variants(first:${t.variantsFirst}){nodes{id title availableForSale currentlyNotInStock quantityAvailable sku barcode selectedOptions{name value}image{${tt}}price{${w}}compareAtPrice{${w}}unitPrice{${w}}sellingPlanAllocations(first:${t.sellingPlansFirst}){nodes{${Ge}}}}}}`}function Nt(){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${w}}totalAmount{${w}}checkoutChargeAmount{${w}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${w}}subtotalAmount{${w}}amountPerQuantity{${w}}compareAtAmountPerQuantity{${w}}}discountAllocations{discountedAmount{${w}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${w}}priceAdjustments{price{${w}}compareAtPrice{${w}}perDeliveryPrice{${w}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping quantityAvailable image{${tt}}price{${w}}compareAtPrice{${w}}selectedOptions{name value}product{id title handle vendor featuredImage{${tt}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}function se(){return`
2
2
  id handle title description descriptionHtml
3
3
  image { ${tt} }
4
- seo { title description }`}var he={};M(he,{clearProductCache:()=>le,getProduct:()=>nt,getProducts:()=>vt,getRecommendations:()=>bt,hydrateProducts:()=>ue,normalizeProductKey:()=>ct,primeProduct:()=>et,refreshProducts:()=>pe,takeStale:()=>de});var F=new Map,Ge=[],ae=new Map,oe=!1,yt=0,ce=t=>typeof t=="string"&&t.startsWith("gid://");function ct(t){let e=String(t??"").trim();if(!e)return null;if(ce(e))return e;if(/^\d+$/.test(e))return`gid://shopify/Product/${e}`;let n=e.match(/\/products\/([^/?#]+)/);return n?n[1]:e}function et(t){if(!t)return;let e=Promise.resolve(t);F.set(t.handle,e),F.set(t.id,e)}function nt(t){let e=ct(t);if(!e)return Promise.reject(new E("empty product key",{code:"NOT_FOUND"}));if(F.has(e))return F.get(e);let n=new Promise((r,i)=>{ae.set(e,{resolve:r,reject:i}),Ge.push(e),oe||(oe=!0,setTimeout(gn,0))});return F.set(e,n),n}async function gn(){oe=!1;let t=yt,e=Ge.splice(0);if(!e.length)return;let n=e.filter(ce),r=e.filter(f=>!ce(f)),i=[],s=[],a={};n.length&&(i.push("$ids: [ID!]!"),a.ids=n,s.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),r.forEach((f,h)=>{i.push(`$h${h}: String!`),a[`h${h}`]=f,s.push(`h${h}: product(handle: $h${h}) { ...TetherProduct }`)});let c=`query TetherProducts(${i.join(",")}){${s.join(" ")}}${gt()}`;q("fetch products",e);let u=(f,h)=>{let m=ae.get(f);ae.delete(f),m&&h(m)};try{let f=await _(c,a),h=new Map;(f.byId||[]).forEach(m=>{m&&h.set(m.id,m)}),r.forEach((m,k)=>{f[`h${k}`]&&h.set(m,f[`h${k}`])}),e.forEach(m=>u(m,k=>{if(h.has(m)){let v=h.get(m);t===yt&&(et(v),_t.set(v.handle,Date.now()),_t.set(v.id,Date.now())),k.resolve(v)}else{let v=F.get(m);t===yt&&setTimeout(()=>{F.get(m)===v&&F.delete(m)},1e4),k.reject(new E(`Product not found: ${m}`,{code:"NOT_FOUND"}))}}))}catch(f){e.forEach(h=>u(h,m=>{t===yt&&F.delete(h),m.reject(f)}))}}function le(){F.clear(),yt++,ot.clear(),_t.clear()}var ot=new Set,_t=new Map,yn=6e4;function ue(t){(t||[]).forEach(e=>{!e?.id||!e.handle||Date.now()-(_t.get(e.handle)||0)<yn&&F.has(e.handle)||(et(e),ot.add(e.handle),ot.add(e.id))})}function de(t){let e=ct(t);if(!ot.has(e))return!1;let n=F.get(e);return ot.delete(e),n?.then?.(r=>{ot.delete(r.handle),ot.delete(r.id)}),!0}function pe(t){return t.forEach(e=>F.delete(ct(e))),t.map(e=>nt(e))}async function vt({collection:t,query:e,first:n=o.collectionFirst,after:r=null,sortKey:i,reverse:s=!1,filters:a}={}){let c=gt();if(t){let f=await _(`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${ie()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}${c}`,{handle:t,first:n,after:r,sortKey:i||void 0,reverse:s,filters:a||void 0});if(!f.collection)throw new E(`Collection not found: ${t}`,{code:"NOT_FOUND"});let{products:h,...m}=f.collection;return h.nodes.forEach(et),{collection:m,products:h.nodes,pageInfo:h.pageInfo}}let u=await _(`query TetherSearch($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}${c}`,{first:n,after:r,query:e||void 0,sortKey:i||void 0,reverse:s});return u.products.nodes.forEach(et),{collection:null,products:u.products.nodes,pageInfo:u.products.pageInfo}}async function bt(t,e="RELATED"){let n=ct(typeof t=="object"?t?.id:t),r=n?.startsWith("gid://"),s=(await _(`query TetherRecs(${r?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${r?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}${gt()}`,r?{id:n,intent:e}:{handle:n,intent:e})).productRecommendations||[];return s.forEach(et),s}var xt={};M(xt,{GID:()=>R,allPlans:()=>H,allocationFor:()=>V,findPlan:()=>wt,hasPlans:()=>vn,planAdjustment:()=>me,planCheckoutCharge:()=>fe,planPrice:()=>$t,planSavings:()=>Dt,plansForVariant:()=>bn,toGid:()=>Ft});var R={product:t=>Ft(t,"Product"),variant:t=>Ft(t,"ProductVariant"),sellingPlan:t=>Ft(t,"SellingPlan")};function Ft(t,e){let n=String(t??"").trim();return n?n.startsWith("gid://")?n:/^\d+$/.test(n)?`gid://shopify/${e}/${n}`:n:null}function H(t){return(t?.sellingPlanGroups?.nodes||[]).flatMap(n=>(n.sellingPlans?.nodes||[]).map(r=>({...r,group:n})))}function vn(t){return H(t).length>0}function V(t,e){return!t||!e?null:(t.sellingPlanAllocations?.nodes||[]).find(n=>n.sellingPlan?.id===e)||null}function bn(t,e){return H(t).filter(n=>V(e,n.id))}function $t(t,e){let r=V(t,e)?.priceAdjustments?.[0];return r?.perDeliveryPrice||r?.price||t?.price||null}function fe(t,e){let n=V(t,e);return n?.checkoutChargeAmount||n?.priceAdjustments?.[0]?.price||t?.price||null}function Dt(t,e){let n=parseFloat(t?.price?.amount),r=parseFloat($t(t,e)?.amount);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r>=n?{amount:null,percentage:0}:{amount:{amount:(n-r).toFixed(2),currencyCode:t.price.currencyCode},percentage:Math.round((1-r/n)*100)}}function me(t){let e=t?.priceAdjustments?.[0]?.adjustmentValue;if(!e)return null;switch(e.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:e.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:e.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:e.price};default:return null}}function wt(t,e){if(!e)return null;let n=H(t),r=R.sellingPlan(e),i=String(e).trim().toLowerCase();return n.find(s=>s.id===r)||n.find(s=>s.name.toLowerCase()===i)||n.find(s=>(s.options||[]).some(a=>String(a.value).toLowerCase()===i))||null}var Ae={};M(Ae,{attr:()=>g,busy:()=>K,cdnUrl:()=>ze,dataKey:()=>Je,emit:()=>$,formatDate:()=>ve,formatMoney:()=>D,formatPercent:()=>ye,get:()=>p,has:()=>G,hasTemplate:()=>be,imageUrl:()=>jt,notifyLayoutChanged:()=>J,parseJSONAttr:()=>xe,productUrl:()=>At,qsa:()=>w,readText:()=>ge,repeat:()=>B,repeatKeyed:()=>$e,sameImage:()=>Mt,scoped:()=>rt,sel:()=>l,setImage:()=>j,setSelected:()=>Pt,setText:()=>S,setTextTracked:()=>W,show:()=>L,toAttributes:()=>lt,watchImages:()=>we});var g=t=>`${o.prefix}-${t}`,l=(t,e)=>e===void 0?`[${g(t)}]`:`[${g(t)}="${e}"]`,p=(t,e)=>t.getAttribute(g(e)),G=(t,e)=>t.hasAttribute(g(e)),Je=()=>`data-${o.prefix}-key`;function At(t,e){let n=o.productPath||"/product";if(!/\{(handle|id)\}/.test(n))return`${n.replace(/\/$/,"")}/${t}`;let r=e?String(e).split("/").pop():"";return n.replace(/\{handle\}/g,encodeURIComponent(t||"")).replace(/\{id\}/g,encodeURIComponent(r))}var w=(t,e)=>t?[...t.querySelectorAll(e)]:[],rt=(t,e,n)=>w(t,e).filter(r=>r.closest(n)===t);function $(t,e,n=document){n.dispatchEvent(new CustomEvent(`${o.prefix}:${t}`,{detail:e,bubbles:!0}))}function ye(t,e=o.locale){if(!t)return"";try{return new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100)}catch{return`${t}%`}}function D(t){if(!t)return"";if(typeof o.formatMoney=="function")return o.formatMoney(t,o.locale);let e=parseFloat(t.amount);if(Number.isNaN(e))return"";try{return new Intl.NumberFormat(o.locale||void 0,{style:"currency",currency:t.currencyCode}).format(e)}catch{return`${t.currencyCode} ${e.toFixed(2)}`}}function ve(t){if(!t)return"";try{return new Date(t).toLocaleDateString(o.locale||void 0)}catch{return""}}function jt(t,{width:e,height:n,crop:r}={}){if(!t)return t;try{let i=new URL(t);return e&&i.searchParams.set("width",String(e)),n&&i.searchParams.set("height",String(n)),r&&i.searchParams.set("crop",r),i.toString()}catch{return t}}function ze(t,e){if(!t||!e)return t;let n=r=>e.getAttribute(r)??e.getAttribute(`${o.prefix}-${r}`)??e.getAttribute(`data-${r}`);return jt(t,{width:n("max-width"),height:n("max-height"),crop:n("max-width")||n("max-height")?n("crop"):null})}var Mt=(t,e)=>!!(t&&e)&&t.split("?")[0]===e.split("?")[0];function j(t,e,n){if(!e)return;let r=ze(e,t);if(t.tagName==="IMG"&&Mt(t.getAttribute("src"),r)){n!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",n);return}t.tagName==="IMG"?(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",r),n!=null&&t.setAttribute("alt",n),t.getAttribute("loading")||t.setAttribute("loading","lazy")):t.style.backgroundImage=`url("${r}")`}function S(t,e){let n=e==null?"":String(e);t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value=n:t.textContent=n}var ge=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.textContent;function W(t,e){let n=ge(t);S(t,e);let r=ge(t);if(n!==r&&t.dataset.tetherSeen&&typeof o.onValueChange=="function")try{o.onValueChange(t,n)}catch{}t.dataset.tetherSeen="1"}function L(t,e){let n="tetherPrevDisplay";if(e){if(t.dataset.tetherShown!==void 0)return;t.dataset.tetherShown="",t.removeAttribute("hidden"),t.dataset[n]!==void 0?(t.style.display=t.dataset[n],delete t.dataset[n]):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(`${o.prefix}-display`)||"block")}else delete t.dataset.tetherShown,t.dataset[n]===void 0&&t.style.display!=="none"&&(t.dataset[n]=t.style.display||""),t.style.display="none"}function Pt(t,e){t.classList.toggle("is-selected",e),t.setAttribute("aria-pressed",e?"true":"false"),t.tagName==="INPUT"&&(t.type==="radio"||t.type==="checkbox")&&(t.checked=e);let n=t.querySelector?.('input[type="radio"],input[type="checkbox"]');n&&(n.checked=e)}var Ut=new WeakMap,be=t=>!!Ut.get(t);function Ye(t){if(!Ut.has(t)){let e=t.firstElementChild?.cloneNode(!0)??null;Ut.set(t,e),t.innerHTML=""}return Ut.get(t)}function B(t,e,n){let r=Ye(t);if(!r){e.length&&U("repeater without a template child",t);return}t.innerHTML="",e.forEach((i,s)=>{let a=r.cloneNode(!0);n(a,i,s),t.appendChild(a)})}function $e(t,e,n,r,{onEnter:i,onLeave:s}={}){let a=Ye(t);if(!a){U("repeater without a template child",t);return}let c=Je(),u=`data-${o.prefix}-leaving`,f=()=>[...t.children].filter(b=>b.hasAttribute(c)&&!b.hasAttribute(u)),h=new Map(f().map(b=>[b.getAttribute(c),b])),m=[],k=new Set;e.forEach((b,N)=>{let d=String(n(b,N)),y=h.get(d);y?h.delete(d):(y=a.cloneNode(!0),y.setAttribute(c,d),k.add(y)),r(y,b,N,k.has(y)),m.push(y)});let v=m.filter(b=>!k.has(b)),C=f().filter(b=>v.includes(b));if(!(C.length===v.length&&C.every((b,N)=>b===v[N]))){h.forEach(b=>b.remove()),m.forEach(b=>t.appendChild(b));return}m.forEach((b,N)=>{if(!k.has(b))return;let d=m[N-1];if(d&&d.parentNode===t?d.after(b):t.prepend(b),i)try{i(b)}catch{}}),h.forEach(b=>{b.setAttribute(u,""),b.removeAttribute(c),b.style.pointerEvents="none",b.inert=!0;let N=()=>b.remove();if(s)try{s(b,N)}catch{N()}else N()})}var We=null;function J(t){clearTimeout(We),We=setTimeout(()=>{typeof o.onLayoutChange=="function"?o.onLayoutChange(t):window.ScrollTrigger?.refresh&&window.ScrollTrigger.refresh(),$("layout-changed",{reason:t})},120)}function we(t,e){let n=w(t,"img").filter(s=>!s.complete);if(!n.length)return;let r=n.length,i=()=>{--r===0&&J(`${e}:images`)};n.forEach(s=>{s.addEventListener("load",i,{once:!0}),s.addEventListener("error",i,{once:!0})})}function K(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve():(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>t.removeAttribute("aria-busy")))}function xe(t,e){let n=t&&p(t,e);if(!n)return null;try{return JSON.parse(n)}catch{return U(`invalid JSON in ${g(e)}`,t),null}}function lt(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,n])=>({key:e,value:String(n??"")})):[]}function Ze(t,e=1,n={}){let r=typeof t=="object"&&t!==null?t:{variantId:t,quantity:e,...n},i=R.variant(r.merchandiseId||r.variantId||r.id);if(!i)throw new E("add(): variantId is required");let s={merchandiseId:i,quantity:Math.max(1,parseInt(r.quantity??1,10)||1)},a=r.sellingPlanId||r.sellingPlan;a&&(s.sellingPlanId=R.sellingPlan(a));let c=lt(r.attributes);return c.length&&(s.attributes=c),s}function Xe(t,e,n){return`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${Nt()}`}var $n='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Vt=null,Rt=t=>w(t,$n).filter(e=>e.offsetParent!==null||e===document.activeElement);function Pe(t){w(document,l("cart-open")).forEach(e=>e.setAttribute("aria-expanded",String(t))),w(document,l("cart-drawer")).forEach(e=>{e.hasAttribute("role")||e.setAttribute("role","dialog"),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")&&e.setAttribute("aria-label",p(e,"cart-label")||"Cart"),e.setAttribute("aria-modal",String(t)),e.classList.contains(o.cartDrawerOpenClass)||(e.setAttribute("aria-hidden","true"),o.cartFocus!==!1&&(e.inert=!0))})}var Se=t=>/does not exist|not found|invalid id/i.test(t?.message||""),A={state:null,_chain:Promise.resolve(),id(){try{return localStorage.getItem(o.storageKey)}catch{return null}},_setId(t){try{t?localStorage.setItem(o.storageKey,t):localStorage.removeItem(o.storageKey)}catch{}},get lines(){return this.state?.lines?.nodes||[]},get count(){return this.state?.totalQuantity||0},lastError:null,customerAccessToken:null,pendingQty:new Map,warnings:[],loaded:!1,_take(t,e){let n=ne(t,e);return this.warnings=(n.warnings||[]).filter((r,i,s)=>s.findIndex(a=>a.message===r.message)===i).map(r=>({...r,message:typeof o.warningText=="function"&&o.warningText(r)||r.message})),this.warnings.length&&$("cart-warning",{warnings:this.warnings}),n.cart},_queue(t){let e=this._chain.then(t,t).then(n=>(this.lastError&&(this.lastError=null,this.render()),n),n=>{throw this.lastError=n,this.render(),$("cart-error",{error:n}),n});return this._chain=e.catch(()=>{}),e},_commit(t,e){this.state=t,t?.id&&this._setId(t.id);try{localStorage.setItem(`${o.storageKey}:seen`,`${Date.now()}|${t?.totalQuantity||0}`)}catch{}return this.render(),$("cart-updated",{cart:t,reason:e}),t},async init(){let t=this.id();if(!t)return this.state=null,this.loaded=!0,this.render(),$("cart-updated",{cart:null,reason:"load"}),null;if(!this.loaded)try{let e=(localStorage.getItem(`${o.storageKey}:seen`)||"").split("|")[1];e&&w(document,l("cart-count")).forEach(n=>{/^\s*0?\s*$/.test(n.textContent)&&(n.textContent=e)})}catch{}try{let e=await _(`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${Nt()}`,{id:t});e.cart?this.state=e.cart:(this._setId(null),this.state=null)}catch(e){P(e,"cart load failed"),this.lastError=e,Se(e)&&this._setId(null),this.state=null}return this.loaded=!0,this.render(),$("cart-updated",{cart:this.state,reason:"load"}),this.state},async _create(t={}){let e=o.country||this.customerAccessToken?{...o.country?{countryCode:String(o.country).toUpperCase()}:{},...this.customerAccessToken?{customerAccessToken:this.customerAccessToken}:{}}:void 0,n=await _(Xe("cartCreate","$input: CartInput!","input: $input"),{input:{buyerIdentity:e,...t}});return this._take(n.cartCreate,"cartCreate")},async _mutate(t,e,n,r,i){let s=this.id();if(!s)return i?this._create(i):null;try{let a=await _(Xe(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`),{...r,cartId:s});return this._take(a[t],t)}catch(a){if(i&&Se(a))return q("cart expired, creating a new one"),this._setId(null),this._create(i);throw a}},add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(i=>Ze(i,e,n));return this._queue(async()=>{let i=await this._mutate("cartLinesAdd","$lines: [CartLineInput!]!","lines: $lines",{lines:r},{lines:r});return this._commit(i,"add"),$("added",{cart:i,lines:r}),o.openCartOnAdd&&this.open(),i})},updateLine(t,e){let n=typeof e=="number"?{quantity:e}:{...e};if(n.quantity!==void 0&&n.quantity<=0)return this.removeLine(t);let r={id:t};return n.quantity!==void 0&&(r.quantity=n.quantity),"sellingPlanId"in n&&(r.sellingPlanId=n.sellingPlanId?R.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=lt(n.attributes)),(n.merchandiseId||n.variantId)&&(r.merchandiseId=R.variant(n.merchandiseId||n.variantId)),this._queue(async()=>this._commit(await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[r]}),"update"))},changeQuantity(t,e){let n=this.lines.find(a=>a.id===t);if(!n)return Promise.resolve(this.state);let r=Math.max(0,(this.pendingQty.get(t)?.qty??n.quantity)+e),i={qty:r,done:!1};this.pendingQty.set(t,i),this.render(),$("cart-updated",{cart:this.state,reason:"pending"});let s=()=>this.pendingQty.get(t)===i;return this._queue(async()=>{if(!s())return this.state;let a=this.lines.find(u=>u.id===t);if(a&&a.quantity===r)return this.state;let c=r>0?await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[{id:t,quantity:r}]}):await this._mutate("cartLinesRemove","$lineIds: [ID!]!","lineIds: $lineIds",{lineIds:[t]});return s()?this._commit(c,r>0?"update":"remove"):(this.state=c,c?.id&&this._setId(c.id),c)}).finally(()=>{s()&&(this.pendingQty.delete(t),this.render(),$("cart-updated",{cart:this.state,reason:"settled"}))})},quantityOf(t){return this.pendingQty.get(t.id)?.qty??t.quantity},removeLine(t){let e=Array.isArray(t)?t:[t];return this._queue(async()=>this._commit(await this._mutate("cartLinesRemove","$lineIds: [ID!]!","lineIds: $lineIds",{lineIds:e}),"remove"))},clear(){let t=this.lines.map(e=>e.id);return t.length?this.removeLine(t):Promise.resolve(this.state)},setNote(t){return this._queue(async()=>this._commit(await this._mutate("cartNoteUpdate","$note: String!","note: $note",{note:t??""},{note:t??""}),"note"))},setAttributes(t){let e=new Map((this.state?.attributes||[]).map(r=>[r.key,r.value]));lt(t).forEach(r=>e.set(r.key,r.value));let n=[...e].filter(([,r])=>r!=="").map(([r,i])=>({key:r,value:i}));return this._queue(async()=>this._commit(await this._mutate("cartAttributesUpdate","$attributes: [AttributeInput!]!","attributes: $attributes",{attributes:n},{attributes:n}),"attributes"))},setDiscountCodes(t){let e=(Array.isArray(t)?t:[t]).map(n=>String(n).trim()).filter(Boolean);return this._queue(async()=>this._commit(await this._mutate("cartDiscountCodesUpdate","$discountCodes: [String!]!","discountCodes: $discountCodes",{discountCodes:e},{discountCodes:e}),"discount"))},async applyDiscount(t){let e=(this.state?.discountCodes||[]).map(i=>i.code),n=await this.setDiscountCodes([...new Set([...e,t])]);if((n?.discountCodes||[]).find(i=>i.code.toLowerCase()===String(t).toLowerCase())?.applicable)return n;throw await this.removeDiscount(t).catch(()=>{}),new E(`Discount code not valid: ${t}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let e=String(t).toLowerCase();return this.setDiscountCodes((this.state?.discountCodes||[]).map(n=>n.code).filter(n=>n.toLowerCase()!==e))},setBuyerIdentity(t,{create:e=!0}={}){return this._queue(async()=>{let n=await this._mutate("cartBuyerIdentityUpdate","$buyerIdentity: CartBuyerIdentityInput!","buyerIdentity: $buyerIdentity",{buyerIdentity:t},e?{buyerIdentity:t}:null).catch(r=>{if(e||!Se(r))throw r;return this._setId(null),null});return this._commit(n,"buyer-identity")})},async checkout(t=o.checkoutTarget){let e=this.id();if(!e||this.state&&!this.count)return null;let n=t==="_blank"?window.open("","_blank"):null;if(n)try{n.opener=null}catch{}try{let r=await _("query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }",{id:e}),i=this.beforeCheckout&&await this.beforeCheckout().catch(()=>null)||r.cart?.checkoutUrl;if(i&&this.customerAccessToken&&(i+=`${i.includes("?")?"&":"?"}logged_in=true`),!i)throw new E("No checkoutUrl (cart empty or expired)");return $("checkout",{url:i,cart:this.state}),n&&!n.closed?n.location.href=i:window.location.href=i,i}catch(r){return n&&n.close(),P(r,"checkout failed"),null}},drawers(){return w(document,l("cart-drawer"))},_open:!1,isOpen(){let t=this.drawers();return t.length?t.some(e=>e.classList.contains(o.cartDrawerOpenClass)):this._open},open(){if(this.isOpen())return;this._open=!0;let t=this.drawers().filter(e=>p(e,"cart-drawer")!=="manual");t.forEach(e=>{e.inert=!1,e.classList.add(o.cartDrawerOpenClass),e.setAttribute("aria-hidden","false")}),Pe(!0),o.cartFocus!==!1&&t[0]&&(Vt=document.activeElement,setTimeout(()=>{let e=Rt(t[0])[0]||t[0];e===t[0]&&!t[0].hasAttribute("tabindex")&&(t[0].tabIndex=-1),e.focus?.({preventScroll:!0})},60)),typeof o.onCartOpen=="function"&&o.onCartOpen(t),$("cart-toggled",{open:!0})},close(){if(!this.isOpen())return;this._open=!1;let t=this.drawers(),e=t.some(n=>n.contains(document.activeElement));t.forEach(n=>{n.classList.remove(o.cartDrawerOpenClass),n.setAttribute("aria-hidden","true"),o.cartFocus!==!1&&(n.inert=!0)}),Pe(!1),e&&Vt?.isConnected&&Vt.focus({preventScroll:!0}),Vt=null,typeof o.onCartClose=="function"&&o.onCartClose(t),$("cart-toggled",{open:!1})},toggle(){this.isOpen()?this.close():this.open()},subscribe(t){let e=()=>t(this.state,{open:this.isOpen(),count:this.count,loaded:this.loaded,warnings:this.warnings}),n=()=>e();return["cart-updated","cart-toggled"].forEach(r=>document.addEventListener(`${o.prefix}:${r}`,n)),e(),()=>["cart-updated","cart-toggled"].forEach(r=>document.removeEventListener(`${o.prefix}:${r}`,n))},render(){let t=this.state,e=t?t.totalQuantity:0,n=s=>t?D(t.cost?.[s]):"";Pe(this.isOpen()),w(document,l("cart-count")).forEach(s=>W(s,e)),w(document,l("cart-subtotal")).forEach(s=>W(s,n("subtotalAmount"))),w(document,l("cart-total")).forEach(s=>W(s,n("totalAmount"))),w(document,l("cart-checkout-charge")).forEach(s=>W(s,n("checkoutChargeAmount")));let r=this.lines.some(s=>s.sellingPlanAllocation),i={"cart-empty":e===0,"cart-filled":e>0,"cart-has-subscription":r,"cart-no-subscription":!r,"cart-has-discount":(t?.discountCodes||[]).some(s=>s.applicable),"cart-error":!!this.lastError,"cart-warning":this.warnings.length>0};w(document,l("cart-warning")).forEach(s=>W(s,[...new Set(this.warnings.map(a=>a.message))].join(" "))),w(document,l("show")).forEach(s=>{let a=p(s,"show");a in i&&!s.closest(l("product"))&&L(s,i[a])}),w(document,l("checkout")).forEach(s=>{s.classList.toggle("is-disabled",!e),s.setAttribute("aria-disabled",String(!e))}),w(document,`textarea${l("cart-note")},input${l("cart-note")}`).forEach(s=>{document.activeElement!==s&&(s.value=t?.note||"")}),w(document,l("cart-discounts")).forEach(s=>{B(s,t?.discountCodes||[],(a,c)=>{a.setAttribute(g("discount-code"),c.code);let u=a.querySelector(l("discount","code"))||(a.firstElementChild?null:a);u&&S(u,c.code),a.classList.toggle("is-inapplicable",!c.applicable)})}),w(document,l("cart-lines")).forEach(s=>{$e(s,this.lines,a=>a.id,(a,c)=>xn(a,c),{onEnter:o.onLineEnter,onLeave:o.onLineLeave})}),t&&J("cart")}};function wn(t,e){let n=t.merchandise||{},r=t.sellingPlanAllocation?.sellingPlan;switch(e){case"title":return n.product?.title;case"product-title":return n.product?.title;case"variant-title":return n.title==="Default Title"?"":n.title;case"options":return(n.selectedOptions||[]).filter(i=>i.value!=="Default Title").map(i=>`${i.name}: ${i.value}`).join(", ");case"vendor":return n.product?.vendor;case"sku":return n.sku;case"price":return D(t.cost?.amountPerQuantity||n.price);case"compare-at-price":return D(t.cost?.compareAtAmountPerQuantity||n.compareAtPrice);case"line-total":return D(t.cost?.totalAmount);case"line-subtotal":return D(t.cost?.subtotalAmount);case"quantity":return A.quantityOf(t);case"plan":return r?.name||"";case"plan-description":return r?.description||"";case"components":return(t.lineComponents||[]).map(i=>`${i.quantity} \xD7 ${i.merchandise?.product?.title||""}`).join(", ");default:if(e.startsWith("attribute:")){let i=e.slice(10);return(t.attributes||[]).find(s=>s.key===i)?.value||""}return}}function xn(t,e){let n=e.merchandise||{},r=!!e.sellingPlanAllocation;t.setAttribute(g("line-id"),e.id),t.classList.toggle("is-subscription",r),w(t,l("line")).forEach(c=>{let u=p(c,"line");if(u==="image")return j(c,n.image?.url||n.product?.featuredImage?.url,n.product?.title);if(u==="url"){let h=At(n.product?.handle,n.product?.id),m=new URLSearchParams;n.id&&m.set("variant",String(n.id).split("/").pop());let k=e.sellingPlanAllocation?.sellingPlan?.id;k&&m.set("selling_plan",k.split("/").pop());let v=m.toString();return c.setAttribute("href",v?`${h}${h.includes("?")?"&":"?"}${v}`:h)}let f=wn(e,u);f!==void 0&&W(c,f)});let i=A.warnings.find(c=>c.target===e.id);t.classList.toggle("is-warning",!!i);let s=A.pendingQty.has(e.id);t.classList.toggle("is-busy",s),s?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),w(t,l("line","warning")).forEach(c=>W(c,i?.message||""));let a={subscription:r,"one-time":!r,"on-sale":parseFloat(e.cost?.compareAtAmountPerQuantity?.amount)>parseFloat(e.cost?.amountPerQuantity?.amount),"has-components":(e.lineComponents||[]).length>0,warning:!!i};w(t,l("line-show")).forEach(c=>{let u=p(c,"line-show");u in a&&L(c,a[u])}),w(t,`select${l("line-plan")}`).forEach(c=>{let u=n.product?.handle;u&&nt(u).then(f=>{let h=H(f),k=[...!f.requiresSellingPlan&&p(c,"line-plan")!=="subscription-only"?[{value:"",label:c.getAttribute(g("one-time-label"))||"One-time purchase"}]:[],...h.map(C=>({value:C.id,label:C.name}))],v=k.map(C=>C.value).join("|");c.dataset.tetherSig!==v&&(c.innerHTML="",k.forEach(C=>{let at=document.createElement("option");at.value=C.value,at.textContent=C.label,c.appendChild(at)}),c.dataset.tetherSig=v),c.value=e.sellingPlanAllocation?.sellingPlan?.id||"",L(c,h.length>0)}).catch(f=>P(f,"line plan options"))})}var Ie={};M(Ie,{ProductScope:()=>St,rememberOptionNames:()=>Ht,scopes:()=>it});var ke={};M(ke,{STATUS_KEYS:()=>Kt,boundary:()=>Bt,isNotFound:()=>ht,ownedBy:()=>Ce,resolveProductKey:()=>z,setScopeStatus:()=>Y});function z(t,e=window.location,n="product"){let r=(p(t,n)||"").trim();if(!r.toLowerCase().startsWith("url:"))return{key:r||null,fromUrl:!1,raw:r};let i=r.slice(4).trim(),s=null;if(i.toLowerCase()==="path"){let a=e.pathname.split("/").filter(Boolean);s=a.length?An(a[a.length-1]):null}else s=new URLSearchParams(e.search).get(i||"handle");return s=s&&s.trim()?s.trim():null,{key:s,fromUrl:!0,raw:r}}function An(t){try{return decodeURIComponent(t)}catch{return t}}var Kt=["loading","ready","error","not-found"],ht=t=>t?.code==="NOT_FOUND",Bt=()=>["product","collection","products","recommendations"].map(t=>l(t)).join(","),Ce=(t,e)=>t===e||t.parentElement?.closest(Bt())===e;function Y(t,e,n){let r=e==="not-found";t.setAttribute(g("state"),r?"error":e),e==="error"||r?t.setAttribute(g("error"),r?"not-found":n?.code||"error"):t.removeAttribute(g("error")),rt(t,l("show"),Bt()).forEach(i=>{let s=p(i,"show");Kt.includes(s)&&L(i,s===e)}),(e==="error"||r)&&rt(t,l("add-to-cart"),Bt()).forEach(i=>{i.classList.add("is-disabled"),i.setAttribute("aria-disabled","true"),"disabled"in i&&(i.disabled=!0)})}var it=new WeakMap,tn=()=>l("product");function Pn(t,e){let n=e.indexOf("."),r=e.slice(0,n),i=e.slice(n+1);return(t.metafields||[]).find(a=>a&&a.namespace===r&&a.key===i)||null}var Qt=new Map;function Ht(t){(t||[]).forEach(e=>{e?.handle&&!Qt.has(e.handle)&&Qt.set(e.handle,(e.options||[]).map(n=>n.name))})}var St=class{constructor(e,n){this.root=e,this.product=n,this.selected={},this.variant=null,this.quantity=Math.max(0,parseInt(p(e,"quantity")??"1",10)||(G(e,"quantity")?0:1)),this.plans=H(n),this.purchase="one-time",this.planId=null,it.set(e,this),e.setAttribute(g("state"),"ready"),e.removeAttribute(g("error")),this.initSelection(),this.initPurchase(),this.renderProduct(),this.bind(),this.renderVariant(),we(e,"product"),J("product"),$("product-ready",{product:n,scope:this},e)}update(e){let n=this.variant?.id;this.product=e,this.plans=H(e),this.planId&&!this.plans.some(i=>i.id===this.planId)&&(this.planId=this.plans[0]?.id||null),!this.plans.length&&this.purchase==="subscription"&&(this.purchase="one-time");let r=e.variants.nodes.find(i=>i.id===n);r&&(this.selected={},r.selectedOptions.forEach(i=>{this.selected[i.name]=i.value})),this.root.setAttribute(g("state"),"ready"),this.root.removeAttribute(g("error")),this.renderProduct(),this.renderVariant(),J("product"),$("product-updated",{product:e,scope:this},this.root)}$(e){let n=rt(this.root,e,tn());return this.root.matches(e)?[this.root,...n]:n}optName(e){let n=this.product?.options||[];if(!e||n.some(i=>i.name===e))return e;let r=(Qt.get(this.product.handle)||[]).indexOf(e);return r>=0&&n[r]?n[r].name:e}initSelection(){let e=this.product.variants.nodes,n=e.find(i=>i.availableForSale)||e[0];n&&n.selectedOptions.forEach(i=>{this.selected[i.name]=i.value});let r=new URLSearchParams(window.location.search).get("variant")||p(this.root,"variant");if(r){let i=R.variant(r),s=e.find(a=>a.id===i);s&&(this.selected={},s.selectedOptions.forEach(a=>{this.selected[a.name]=a.value}))}}initPurchase(){if(!this.plans.length)return;let e=new URLSearchParams(window.location.search),n=wt(this.product,e.get("selling_plan")),r=wt(this.product,p(this.root,"default-plan"));this.planId=(n||r||this.plans[0]).id;let i=n?"subscription":p(this.root,"default-purchase")||o.defaultPurchase;this.purchase=this.product.requiresSellingPlan||i==="subscription"?"subscription":"one-time"}findVariant(){return this.product.variants.nodes.find(e=>e.selectedOptions.every(n=>this.selected[n.name]===n.value))||null}isValueAvailable(e,n){return this.product.variants.nodes.some(r=>r.availableForSale&&r.selectedOptions.every(i=>i.name===e?i.value===n:this.selected[i.name]===i.value))}get plan(){return this.plans.find(e=>e.id===this.planId)||null}get subscriptionAvailable(){return!!(this.variant&&this.plans.some(e=>V(this.variant,e.id)))}get isSubscription(){return this.purchase==="subscription"&&!!V(this.variant,this.planId)}getLine(){if(!this.variant)return null;let e={merchandiseId:this.variant.id,quantity:this.quantity};this.isSubscription&&(e.sellingPlanId=this.planId);let n=this.collectAttributes();return n.length&&(e.attributes=n),e}collectAttributes(){let e=lt(xe(this.root,"line-attributes")),n=this.$(l("line-attribute")).map(r=>{let i=p(r,"line-attribute"),s;return r.type==="checkbox"?s=r.checked?r.value&&r.value!=="on"?r.value:"Yes":"":r.type==="radio"?s=r.checked?r.value:null:s=r.value,s==null||s===""?null:{key:i,value:String(s)}}).filter(Boolean);return[...e,...n]}select(e,n){if(this.selected[e]===n)return;let r=this.product.variants.nodes.filter(s=>s.selectedOptions.some(a=>a.name===e&&a.value===n));if(!r.length)return;let i={...this.selected,[e]:n};if(!r.some(s=>s.selectedOptions.every(a=>i[a.name]===a.value))){let s=c=>c.selectedOptions.filter(u=>u.name!==e&&this.selected[u.name]===u.value).length*2+(c.availableForSale?1:0);r.reduce((c,u)=>s(u)>s(c)?u:c).selectedOptions.forEach(c=>{i[c.name]=c.value})}this.selected=i,this.renderVariant()}selectVariant(e){let n=this.product.variants.nodes.find(r=>r.id===R.variant(e));n&&(this.selected={},n.selectedOptions.forEach(r=>{this.selected[r.name]=r.value}),this.renderVariant())}setPurchase(e){let n=e==="subscription"?"subscription":"one-time";n==="one-time"&&this.product.requiresSellingPlan||this.purchase!==n&&(this.purchase=n,this.renderVariant())}selectPlan(e){let n=wt(this.product,e);n&&(this.planId=n.id,this.purchase="subscription",this.renderVariant())}setQuantity(e){let n=G(this.root,"quantity")?0:1;this.quantity=Math.max(n,parseInt(e,10)||0),this.$(l("qty")).forEach(r=>S(r,this.quantity)),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let e=this.getLine();if(!e||e.quantity<1)return null;let n=await A.add(e);return $("product-added",{product:this.product,variant:this.variant,line:e},this.root),n}bind(){let e=n=>n&&n.closest(tn())===this.root;this.root.addEventListener("click",n=>{let r=n.target;if(!r?.closest)return;let i=r.closest(l("option-value"));if(e(i)&&i.closest(l("option-list"))){n.preventDefault(),this.select(this.optName(p(i.closest(l("option-list")),"option-list")),p(i,"option-value"));return}let s=r.closest(l("plan-value"));if(e(s)){n.preventDefault(),this.selectPlan(p(s,"plan-value"));return}let a=r.closest(`${l("purchase")}:not(select)`);if(e(a)){a.tagName!=="INPUT"&&n.preventDefault(),this.setPurchase(p(a,"purchase"));return}let c=r.closest(l("qty-plus"));if(e(c)){n.preventDefault(),this.setQuantity(this.quantity+1);return}let u=r.closest(l("qty-minus"));if(e(u)){n.preventDefault(),this.setQuantity(this.quantity-1);return}let f=r.closest(l("add-to-cart"));e(f)&&(n.preventDefault(),this.onAddClick(f))}),this.root.addEventListener("change",n=>{let r=n.target;e(r)&&(r.matches(`select${l("option")}`)?this.select(this.optName(p(r,"option")),r.value):r.matches(`select${l("variant-select")}`)?this.selectVariant(r.value):r.matches(`select${l("plan")}`)?r.value?this.selectPlan(r.value):this.setPurchase("one-time"):r.matches(`select${l("purchase")}`)?this.setPurchase(r.value):r.matches(l("qty"))&&this.setQuantity(r.value))})}onAddClick(e){let n=e.querySelector(l("add-label"))||e,r=p(e,"adding-text"),i=s=>S(n,s);n.dataset.tetherLabel===void 0&&(n.dataset.tetherLabel=n.tagName==="INPUT"?n.value:n.textContent),K(e,async()=>{r&&i(r);try{await this.addToCart()}catch(s){P(s,"add to cart failed"),$("error",{error:s,context:"add-to-cart"},this.root)}finally{r&&i(n.dataset.tetherLabel)}}).then(()=>{this.renderVariant()})}renderProduct(){let e=this.product;Qt.has(e.handle)||this.$(`${l("option-list")},select${l("option")}`).map(i=>p(i,"option-list")||p(i,"option")).some(i=>e.options.some(s=>s.name===i))&&Ht([e]);let n=this.product;this.$(l("bind")).forEach(r=>{let i=p(r,"bind")||"",s={title:n.title,"description-text":n.description,vendor:n.vendor,type:n.productType,handle:n.handle}[i];if(s!==void 0)return S(r,s);switch(i){case"description":r.innerHTML=n.descriptionHtml||"";return;case"published-at":return S(r,ve(n.publishedAt));case"min-price":return S(r,D(n.priceRange.minVariantPrice));case"max-price":return S(r,D(n.priceRange.maxVariantPrice));case"featured-image":return j(r,n.featuredImage?.url,n.featuredImage?.altText||n.title);case"url":case"link":r.setAttribute("href",At(n.handle,n.id)),i==="url"&&!r.firstElementChild&&!r.textContent.trim()&&S(r,n.title);return;case"images":{let a=[...r.children].map(c=>c.tagName==="IMG"?c:c.querySelector("img"));if(!be(r)&&a.length===n.images.nodes.length&&a.every((c,u)=>Mt(c?.getAttribute("src"),n.images.nodes[u].url)))return}return B(r,n.images.nodes,(a,c)=>{let u=a.matches(`img,${l("bind","image")}`)?a:a.querySelector("img")||a;j(u,c.url,c.altText||n.title)});case"tags":{let a=(r.getAttribute("exclude")||"").split(",").map(c=>c.trim()).filter(Boolean);return B(r,n.tags.filter(c=>!a.includes(c)),(c,u)=>S(c,u))}default:if(/^image:\d+$/.test(i)){let a=n.images.nodes[i.slice(6)-1]||n.featuredImage;return j(r,a?.url,a?.altText||n.title)}if(i.startsWith("metafield:")){let a=Pn(n,i.slice(10));return a?a.reference?.image?j(r,a.reference.image.url,a.reference.image.altText):(/^(rich_text|multi_line_text)_field$/.test(a.type)&&(r.style.whiteSpace="pre-line"),S(r,a.value)):S(r,"")}return}}),this.$(l("option-list")).forEach(r=>{let i=this.optName(p(r,"option-list")),s=n.options.find(a=>a.name===i);return!s||s.optionValues.length<=1&&G(r,"hide-single")?L(r,!1):B(r,s.optionValues,(a,c)=>{a.setAttribute(g("option-value"),c.name);let u=a.querySelector(l("bind","option-value"));u?S(u,c.name):a.firstElementChild||S(a,c.name);let f=a.querySelector(l("bind","swatch"));f&&c.swatch?.color&&(f.style.backgroundColor=c.swatch.color),f&&c.swatch?.image?.previewImage&&j(f,c.swatch.image.previewImage.url,c.name)})}),this.$(`select${l("option")}`).forEach(r=>{let i=n.options.find(s=>s.name===this.optName(p(r,"option")));if(!i)return L(r,!1);r.innerHTML="",i.optionValues.forEach(s=>r.appendChild(new Option(s.name,s.name)))}),this.$(`select${l("variant-select")}`).forEach(r=>{r.innerHTML="",n.variants.nodes.forEach(i=>r.appendChild(new Option(i.title,i.id)))}),this.$(l("plan-list")).forEach(r=>{let i=(p(r,"plan-list")||"").trim(),s=["","true","all","*"].includes(i.toLowerCase())?null:i,a=this.plans.filter(c=>!s||c.group.name===s);B(r,a,(c,u)=>{c.setAttribute(g("plan-value"),u.id),!c.firstElementChild&&!c.querySelector(l("plan-bind"))&&S(c,u.name)})}),this.$(`select${l("plan")}`).forEach(r=>{r.innerHTML="",!n.requiresSellingPlan&&p(r,"plan")!=="subscription-only"&&r.appendChild(new Option(r.getAttribute(g("one-time-label"))||"One-time purchase","")),this.plans.forEach(i=>r.appendChild(new Option(i.name,i.id)))})}renderVariant(){let e=this.product,n=this.findVariant();if(n||([n]=e.variants.nodes,n&&(this.selected={},n.selectedOptions.forEach(d=>{this.selected[d.name]=d.value}))),this.variant=n,!n)return;if(this.plans.length&&!V(n,this.planId)){let d=this.plans.find(y=>V(n,y.id));d&&(this.planId=d.id)}let r=this.isSubscription,i=n.price,s=this.planId?$t(n,this.planId):null,a=r?s:i,c=r&&V(n,this.planId)?.priceAdjustments?.[0]?.compareAtPrice||n.compareAtPrice,u=c&&parseFloat(c.amount)>parseFloat(a.amount),f=u?Math.round((1-parseFloat(a.amount)/parseFloat(c.amount))*100):0,h=this.planId?Dt(n,this.planId):{amount:null,percentage:0},m=this.plan,k={amount:(parseFloat(a.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:a.currencyCode},v=D,C=d=>ye(d),at={price:()=>v(a),"total-price":()=>v(k),"one-time-price":()=>v(i),"subscription-price":()=>v(s),"subscription-savings":()=>C(h.percentage),"subscription-savings-amount":()=>v(h.amount),"checkout-charge":()=>{let d=r?fe(n,this.planId):a;return d&&v({amount:(parseFloat(d.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:d.currencyCode})},"plan-name":()=>m?.name,"plan-description":()=>m?.description,"plan-group":()=>m?.group?.name,"compare-at-price":()=>u?v(c):"","unit-price":()=>v(n.unitPrice),"discount-percentage":()=>`${f}%`,"discount-amount":()=>u?v({amount:String(parseFloat(c.amount)-parseFloat(a.amount)),currencyCode:a.currencyCode}):"","variant-title":()=>n.title,"variant-id":()=>n.id,sku:()=>n.sku,barcode:()=>n.barcode,stock:()=>n.quantityAvailable,quantity:()=>this.quantity};this.$(l("bind")).forEach(d=>{let y=p(d,"bind");y==="variant-image"?j(d,n.image?.url||e.featuredImage?.url,n.image?.altText||e.title):at[y]&&S(d,at[y]())}),this.$(l("option-selected")).forEach(d=>S(d,this.selected[this.optName(p(d,"option-selected"))]||"")),this.$(l("option-list")).forEach(d=>{let y=this.optName(p(d,"option-list"));w(d,l("option-value")).forEach(I=>{let X=p(I,"option-value");Pt(I,this.selected[y]===X);let T=!this.isValueAvailable(y,X);I.classList.toggle("is-unavailable",T),I.setAttribute("data-unavailable",T?"true":"false")})}),this.$(`select${l("option")}`).forEach(d=>{d.value=this.selected[this.optName(p(d,"option"))]||""}),this.$(`select${l("variant-select")}`).forEach(d=>{d.value=n.id}),this.$(l("purchase")).forEach(d=>{if(d.tagName==="SELECT"){d.value=this.purchase;return}let y=p(d,"purchase");Pt(d,y===this.purchase);let I=y==="subscription"?!this.subscriptionAvailable:e.requiresSellingPlan;d.classList.toggle("is-unavailable",I)}),this.$(l("plan-value")).forEach(d=>{let y=p(d,"plan-value"),I=this.plans.find(T=>T.id===y),X=!!V(n,y);Pt(d,r&&y===this.planId),d.classList.toggle("is-unavailable",!X),w(d,l("plan-bind")).forEach(T=>{let Z=me(I),Ve=Dt(n,y),pn=p(T,"plan-bind"),Re={name:()=>I?.name,option:()=>(I?.options||[]).map(hn=>hn.value).join(", "),description:()=>I?.description,price:()=>v($t(n,y)),savings:()=>C(Ve.percentage),"savings-amount":()=>v(Ve.amount),adjustment:()=>Z?Z.type==="percentage"?`${Z.value}%`:v(Z.value):""}[pn];Re&&S(T,Re())})}),this.$(`select${l("plan")}`).forEach(d=>{d.value=r?this.planId:""});let b=n.quantityAvailable!=null&&n.quantityAvailable>0&&n.quantityAvailable<=(o.lowStock??5),N={"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":!!u,"not-on-sale":!u,"has-variants":e.variants.nodes.length>1,"single-variant":e.variants.nodes.length===1,"low-stock":b,"plenty-in-stock":n.availableForSale&&!b,"subscription-available":this.subscriptionAvailable,"subscription-unavailable":!this.subscriptionAvailable,"subscription-only":!!e.requiresSellingPlan,"one-time-available":!e.requiresSellingPlan,"subscription-selected":r,"one-time-selected":!r,"has-savings":r?h.percentage>0:!!u,loading:!1,ready:!0,error:!1,"not-found":!1};this.$(l("show")).forEach(d=>{let y=p(d,"show");y in N&&(Kt.includes(y)&&!Ce(d,this.root)||L(d,N[y]))}),this.root.classList.toggle("is-subscription",r),this.root.setAttribute(g("purchase-mode"),r?"subscription":"one-time"),this.$(l("add-to-cart")).forEach(d=>{let y=!n.availableForSale;d.classList.toggle("is-disabled",y),d.setAttribute("aria-disabled",String(y)),"disabled"in d&&(d.disabled=y);let I=p(d,"soldout-text"),X=p(d,"subscribe-text");if(I||X){let T=d.querySelector(l("add-label"))||d;T.dataset.tetherLabel===void 0&&(T.dataset.tetherLabel=T.tagName==="INPUT"?T.value:T.textContent);let Z=T.dataset.tetherLabel;r&&X&&(Z=X),y&&I&&(Z=I),d.getAttribute("aria-busy")!=="true"&&S(T,Z)}}),$("variant-changed",{product:e,variant:n,selected:{...this.selected},purchase:this.purchase,sellingPlanId:r?this.planId:null},this.root)}};var Te={};M(Te,{ListScope:()=>Et,listSelector:()=>ut});var ut=()=>`${l("collection")},${l("products")},${l("recommendations")}`,Et=class{constructor(e){this.root=e,this.products=[],this.pageInfo=null,this.collection=null,Y(e,"loading"),e.addEventListener("click",n=>{let r=n.target.closest?.(l("load-more"));r&&r.closest(ut())===e&&(n.preventDefault(),K(r,()=>this.load(!0)))})}$(e){return rt(this.root,e,ut())}options(){let e=this.root,n={first:parseInt(p(e,"limit")||"",10)||void 0,sortKey:p(e,"sort")||void 0,reverse:p(e,"reverse")==="true"};if(G(e,"collection"))n.collection=p(e,"collection");else{let r=p(e,"products")||"";n.query=r.startsWith("url:")?new URL(window.location.href).searchParams.get(r.slice(4))||"":r}return n}async load(e=!1){let n=this.loadToken=(this.loadToken||0)+1,r=()=>n!==this.loadToken;try{if(G(this.root,"recommendations")){let{key:i}=z(this.root,window.location,"recommendations"),s=this.root.closest(l("product"));if(!i&&s&&({key:i}=z(s)),!i)throw new E("No product for recommendations",{code:"NOT_FOUND"});let a=await bt(i,p(this.root,"intent")||"RELATED");if(r())return;let c=parseInt(p(this.root,"limit")||"",10);this.products=c?a.slice(0,c):a}else{let i=await vt({...this.options(),after:e?this.pageInfo?.endCursor:null});if(r())return;this.collection=i.collection,this.pageInfo=i.pageInfo,this.products=e?[...this.products,...i.products]:i.products}this.render(),Y(this.root,"ready"),$("list-ready",{products:this.products,collection:this.collection},this.root)}catch(i){if(r())return;e||Y(this.root,ht(i)?"not-found":"error",i),ht(i)&&G(this.root,"recommendations")||P(i,"list load failed"),$("error",{error:i,context:"list"},this.root)}}render(){let e=this.collection;this.$(l("collection-bind")).forEach(r=>{switch(p(r,"collection-bind")){case"title":return S(r,e?.title||"");case"description":r.innerHTML=e?.descriptionHtml||"";return;case"image":return j(r,e?.image?.url,e?.image?.altText||e?.title);case"count":return S(r,this.products.length);default:return}}),this.$(l("list")).forEach(r=>{B(r,this.products,(i,s)=>{i.setAttribute(g("product"),s.handle),i.removeAttribute(g("state"))}),$("list-rendered",{container:r},this.root)});let n=this.products.length===0;this.$(l("show")).forEach(r=>{let i=p(r,"show");i==="list-empty"&&L(r,n),i==="list-filled"&&L(r,!n)}),this.$(l("load-more")).forEach(r=>L(r,!!this.pageInfo?.hasNextPage)),J("list")}};var Ne={};M(Ne,{hydrateFromPage:()=>Oe,liveLists:()=>mt,liveProducts:()=>ft,mountProduct:()=>zt,mountedLists:()=>Wt,mountedProducts:()=>Ct,pruneLive:()=>Jt,retryFailed:()=>Le,settleMarket:()=>Yt,trackMarket:()=>qe,within:()=>dt});var Ct=new WeakSet,Wt=new WeakSet,ft=new Set,mt=new Set,en=new WeakMap;function Jt(){ft.forEach(t=>{t.isConnected||ft.delete(t)}),mt.forEach(t=>{t.root.isConnected||mt.delete(t)})}function dt(t,e){return[...t.matches?.(e)?[t]:[],...w(t,e)]}function zt(t){if(Ct.has(t))return!1;let{key:e,fromUrl:n,raw:r}=z(t);if(!e)return n?(Ct.add(t),Y(t,"not-found"),$("product-not-found",{key:null,source:r},t)):t.closest(ut())||U(`[${g("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t),!1;Ct.add(t),ft.add(t);let i={};en.set(t,i);let s=()=>en.get(t)===i;it.get(t)?t.setAttribute(g("state"),"updating"):Y(t,"loading");let a=nt(e);return Q?.add(a),a.then(c=>{if(!s())return;let u=it.get(t);u?u.update(c):new St(t,c),Sn(t,c),o.revalidate!==!1&&de(e)&&En(e)}).catch(c=>{if(!s())return;let u=ht(c);Y(t,u?"not-found":"error",c),u?($("product-not-found",{key:e,source:r},t),n?q(`product not found: ${e}`):P(c,`product ${e}`)):(P(c,`product ${e}`),$("error",{error:c,context:"product",key:e},t))}),!0}function Sn(t,e){let n=p(t,"page-title");!n||typeof document>"u"||(document.title=n.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function Le(){Jt(),ft.forEach(t=>{t.getAttribute(g("state"))!=="error"||t.getAttribute(g("error"))==="not-found"||(Ct.delete(t),zt(t))})}var Gt=new Set;function En(t){Gt.size||setTimeout(Cn,0),Gt.add(t)}function Cn(){let t=[...Gt];Gt=new Set,pe(t).forEach((e,n)=>e.then(r=>{ft.forEach(i=>{let s=it.get(i);if(!s||!i.isConnected)return;let a=z(i).key;a!==t[n]&&a!==r.handle&&a!==r.id||JSON.stringify(s.product)!==JSON.stringify(r)&&s.update(r)})}).catch(r=>P(r,`refresh ${t[n]}`)))}var nn=new WeakSet,Q=null,qe=t=>(Q?.add(t),t);function Yt(){if(!Q)return;let t=[...Q];Promise.allSettled(t).then(()=>{!Q||t.some(e=>!Q.has(e))||(t.length===Q.size?(Q=null,document.documentElement.classList.remove(`${o.prefix}-market-pending`)):Yt())})}function Oe(t=document){w(t.ownerDocument||t,'script[type="application/json"][data-tether-hydrate]').forEach(e=>{if(!nn.has(e)){nn.add(e);try{let n=JSON.parse(e.textContent);Ht(n.products);let r=(i,s)=>String(i||"").toUpperCase()===String(s||"").toUpperCase();r(n.country,o.country)&&r(n.language,o.language)?ue(n.products):(q("hydration skipped: other market"),Q||(Q=new Set,document.documentElement.classList.add(`${o.prefix}-market-pending`)))}catch(n){U("bad data-tether-hydrate",n)}}})}var{cfg:kn}=Lt,rn={"config.js":Lt,"client.js":re,"dom.js":Ae,"fragments.js":se,"loader.js":he,"selling-plans.js":xt,"status.js":ke,"cart.js":Ee,"product.js":Ie,"collection.js":Te,"mounting.js":Ne},_e=typeof document<"u"&&document.currentScript?.src||"",kt={};function O(t){if(kt[t])return kt[t];let e=kn.partsUrl||_e.replace(/[^/]*$/,""),n=/\.min\.js(\?|$)/.test(_e)||!_e?".min":"",r=`${e.replace(/\/?$/,"/")}tether.${t}${n}.js`;return kt[t]=new Promise((i,s)=>{let a=document.createElement("script");a.src=r,a.async=!0,a.onload=()=>window.Tether?.__parts?.[t]?i(window.Tether.__parts[t]):s(new Error(`${r} did not register`)),a.onerror=()=>{delete kt[t],s(new Error(`Could not load ${r}. Host it next to the Tether script, or set partsUrl.`))},document.head.appendChild(a)}),kt[t]}var sn="0.6.4",st=null,Fe=null;function pt(t=document){if(!Tt())return 0;let e=0;return Jt(),Oe(t),dt(t,ut()).forEach(n=>{if(Wt.has(n))return;Wt.add(n),e++;let r=new Et(n);mt.add(r),n.addEventListener(`${o.prefix}:list-rendered`,i=>pt(i.detail.container)),qe(r.load())}),dt(t,l("product")).forEach(n=>{zt(n)&&e++}),dt(t,`${l("country-select")},${l("country-bind")}`).length&&O("markets").then(n=>n.renderCountrySelects(t)).catch(n=>P(n,"markets")),(o.account?.clientId||o.account?.server)&&(dt(t,`[${g("account-login")}],[${g("account-bind")}],[${g("orders")}],[${g("show")}^="logged-"]`).length||/[?&]code=/.test(window.location.search)||qn())&&O("account").then(n=>n.mountAccount(t)).catch(n=>P(n,"account")),dt(t,l("search")).length&&O("search").then(n=>n.mountSearch(t)).catch(n=>P(n,"search")),w(t,l("account-link")).forEach(n=>{n.setAttribute("href",`https://${o.domain}/account`)}),Yt(),A.render(),q(`mounted ${e} scope(s)`,t),e}function cn(){A.close()}function In(t){let e=t?.closest?.(l("product"));return e&&it.get(e)||null}var an=!1;function Tn(){an||(an=!0,document.addEventListener("click",t=>{let e=t.target;if(!e?.closest)return;if(e.closest(l("cart-open"))){t.preventDefault(),A.toggle();return}if(e.closest(l("cart-close"))){t.preventDefault(),A.close();return}let n=e.closest(l("cart-clear"));if(n){t.preventDefault(),K(n,()=>A.clear().catch(c=>P(c,"cart clear")));return}let r=e.closest(l("checkout"));if(r){t.preventDefault(),K(r,()=>A.checkout());return}let i=e.closest(on());if(i&&i.closest(l("cart-lines"))){let c=i.getAttribute(`data-${o.prefix}-key`),u=A.lines.find(h=>h.id===c),f=h=>{t.preventDefault(),h().catch(m=>P(m,"cart line"))};if(e.closest(l("line-remove")))return i.classList.add("is-busy"),f(()=>A.removeLine(c));if(u&&e.closest(l("line-plus")))return f(()=>A.changeQuantity(c,1));if(u&&e.closest(l("line-minus")))return f(()=>A.changeQuantity(c,-1))}let s=e.closest(l("discount-remove"));if(s){t.preventDefault();let c=s.closest(l("discount-code"))?.getAttribute(g("discount-code"));c&&A.removeDiscount(c).catch(u=>P(u,"discount"));return}let a=e.closest(l("group-add"));a&&(t.preventDefault(),K(a,()=>ln(a)))}),document.addEventListener("change",t=>{let e=t.target;if(!e?.closest)return;let n=e.closest(on()),r=n?.getAttribute(`data-${o.prefix}-key`),i=(s,a)=>{n.classList.add("is-busy"),n.setAttribute("aria-busy","true"),s.catch(c=>P(c,a))};r&&e.matches(`input${l("line","quantity")}`)?i(A.updateLine(r,parseInt(e.value,10)||0),"cart line"):r&&e.matches(`select${l("line-plan")}`)?i(A.updateLine(r,{sellingPlanId:e.value||null}),"cart line plan"):e.matches(`select${l("country-select")}`)?e.value&&je(e.value).catch(s=>P(s,"country")):e.matches(l("cart-note"))&&A.setNote(e.value).catch(s=>P(s,"cart note"))}),document.addEventListener("submit",t=>{let e=t.target.closest?.(l("discount-form"));if(!e)return;t.preventDefault();let n=e.querySelector(l("discount-input"))||e.querySelector("input"),r=n?.value.trim();r&&K(e,async()=>{let i=s=>{e.classList.toggle("is-invalid",s),n&&(s?n.setAttribute("aria-invalid","true"):n.removeAttribute("aria-invalid"))};try{await A.applyDiscount(r),i(!1),$("discount-applied",{code:r},e),n&&(n.value="")}catch(s){i(!0),s?.code==="INVALID_DISCOUNT"?$("discount-invalid",{code:r},e):P(s,"discount")}})},!0),document.addEventListener("input",t=>{let e=t.target.closest?.(l("discount-form"));e&&(e.classList.remove("is-invalid"),t.target.removeAttribute?.("aria-invalid"))}),window.addEventListener("storage",t=>{o.domain&&t.key?.startsWith(`${o.prefix}:`)&&O("extras").then(e=>e.onStorage(t)).catch(()=>{})}),document.addEventListener(`${o.prefix}:variant-changed`,t=>{let e=t.target;(o.variantUrl||e.hasAttribute?.(g("variant-url")))&&O("extras").then(n=>n.writeVariantUrl(e,t.detail)).catch(()=>{})}),o.astro!==!1&&(document.addEventListener("astro:page-load",()=>(st||Promise.resolve()).then(()=>{let t=De();if(!t&&Ue){try{t=JSON.parse(localStorage.getItem(`${o.prefix}:market:${o.domain}`)||"null")}catch{t=null}t=t?.country?t:dn}Ue=!!De(),t?.country&&(String(t.country).toUpperCase()!==String(o.country||"").toUpperCase()||String(t.language||"").toUpperCase()!==String(o.language||"").toUpperCase())?je(t.country,{language:t.language??null,locale:t.locale,remember:!1}).then(()=>pt(document),()=>pt(document)):pt(document)})),document.addEventListener("astro:before-swap",()=>cn())),window.addEventListener("online",()=>{Le(),mt.forEach(t=>{t.root.getAttribute(g("state"))==="error"&&t.load()})}),document.addEventListener("keydown",t=>{if(!A.isOpen())return;if(t.key==="Escape"){A.close();return}if(t.key!=="Tab"||o.cartFocus===!1)return;let e=A.drawers().find(s=>s.classList.contains(o.cartDrawerOpenClass)),n=e?Rt(e):[];if(!n.length)return;let r=n[0],i=n[n.length-1];(!e.contains(document.activeElement)||t.shiftKey&&document.activeElement===r||!t.shiftKey&&document.activeElement===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}))}function on(){return`[data-${o.prefix}-key]`}var ln=t=>O("extras").then(e=>e.addGroup(t)),It=null;function un(t={}){return st&&!Object.keys(t).length?st:(Zt({...window.TETHER_CONFIG||{},...t}),Tt()?(Tn(),o.observe&&Nn(),o.analytics&&!It&&(It=[],["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"].forEach(e=>document.addEventListener(`${o.prefix}:${e}`,n=>It.push(n))),document.addEventListener("astro:page-load",()=>It.push(new CustomEvent(`${o.prefix}:page`))),O("analytics").then(e=>e.startAnalytics(It)).catch(e=>P(e,"analytics"))),st=Ln(t).then(()=>A.init()).then(async e=>{let n=o.country?String(o.country).toUpperCase():null;if(e&&n&&e.buyerIdentity?.countryCode&&e.buyerIdentity.countryCode!==n)try{e=await A.setBuyerIdentity({countryCode:n},{create:!1})}catch(r){P(r,"cart country")}return $("ready",{cart:e}),Me}),st):(U("TETHER_CONFIG is missing domain or token. Tether is idle."),st=Promise.resolve(null),st))}function De(t=document){let e=r=>t.querySelector(`meta[name="${o.prefix}-page-${r}"]`)?.getAttribute("content")||void 0,n=e("country");return n?{country:n.toUpperCase(),language:e("language"),locale:e("locale")}:null}var dn=null,Ue=!1;async function Ln(t){let e=o.markets||{};dn={country:o.country,language:o.language,locale:o.locale};let n=De();if(Ue=!!n,n){o.country=n.country,o.language=n.language?n.language.toUpperCase():void 0,n.locale&&(o.locale=n.locale);return}if(e.detect===!1)return;let r=null;if(e.detect)try{r=(await O("markets")).detectMarket(e)}catch(i){P(i,"markets");return}else if(e.remember!==!1){try{r=JSON.parse(localStorage.getItem(`${o.prefix}:market:${o.domain}`)||"null")}catch{}r&&!/^[A-Z]{2}$/.test(r.country||"")&&(r=null)}r&&(r.country&&(o.country=r.country),r.language&&(o.language=r.language),r.locale&&!t.locale&&(o.locale=r.locale),q("market",r))}function qn(){try{return!!(sessionStorage[`${o.prefix}:account:${o.domain}`]||localStorage[`${o.prefix}:account:${o.domain}`]||localStorage[`${o.prefix}:account-hint:${o.domain}`])}catch{return!1}}var On=new Proxy({},{get:(t,e)=>(...n)=>O("account").then(r=>r[e](...n))});function je(t,e){return O("markets").then(n=>n.setCountry(t,e))}function Nn(){if(Fe||typeof MutationObserver>"u")return;let t=null,e=new Set;Fe=new MutationObserver(n=>{n.forEach(r=>r.addedNodes.forEach(i=>{i.nodeType===1&&e.add(i)})),clearTimeout(t),t=setTimeout(()=>{e.forEach(r=>{r.isConnected&&pt(r)}),e.clear()},50)}),Fe.observe(document.body,{childList:!0,subtree:!0})}var Me={VERSION:sn,init:un,mount:pt,unmount:cn,get config(){return o},get ready(){return st||Promise.resolve(null)},query:_,withContext:Ot,cart:A,getProduct:nt,getProducts:vt,getRecommendations:bt,getScope:In,addGroup:ln,account:On,primeProduct:et,normalizeProductKey:ct,clearProductCache:le,formatMoney:D,imageUrl:jt,plans:xt,TetherError:E,resolveProductKey:z,setCountry:je,detectMarket:t=>O("markets").then(e=>e.detectMarket(t||o.markets)),getLocalization:()=>O("markets").then(t=>t.getLocalization()),diagnose:t=>O("diagnose").then(e=>e.diagnose({...t,version:sn})),__core:rn,__parts:{},on(t,e){let n=r=>e(r.detail,r);return document.addEventListener(`${o.prefix}:${t}`,n),()=>document.removeEventListener(`${o.prefix}:${t}`,n)}},Sr=Me;if(typeof window<"u"&&typeof document<"u"&&(window.Tether=Me,window.TETHER_CONFIG&&window.TETHER_CONFIG.autoMount!==!1&&!window.TETHER_INTEGRATION)){let e=()=>un().then(()=>pt(document));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}})();
4
+ seo { title description }`}var fe={};M(fe,{clearProductCache:()=>ue,getProduct:()=>nt,getProducts:()=>vt,getRecommendations:()=>bt,hydrateProducts:()=>de,normalizeProductKey:()=>ct,primeProduct:()=>et,refreshProducts:()=>he,takeStale:()=>pe});var F=new Map,We=[],oe=new Map,ce=!1,yt=0,le=t=>typeof t=="string"&&t.startsWith("gid://");function ct(t){let e=String(t??"").trim();if(!e)return null;if(le(e))return e;if(/^\d+$/.test(e))return`gid://shopify/Product/${e}`;let n=e.match(/\/products\/([^/?#]+)/);return n?n[1]:e}function et(t){if(!t)return;let e=Promise.resolve(t);F.set(t.handle,e),F.set(t.id,e)}function nt(t){let e=ct(t);if(!e)return Promise.reject(new E("empty product key",{code:"NOT_FOUND"}));if(F.has(e))return F.get(e);let n=new Promise((r,i)=>{oe.set(e,{resolve:r,reject:i}),We.push(e),ce||(ce=!0,setTimeout(gn,0))});return F.set(e,n),n}async function gn(){ce=!1;let t=yt,e=We.splice(0);if(!e.length)return;let n=e.filter(le),r=e.filter(f=>!le(f)),i=[],s=[],a={};n.length&&(i.push("$ids: [ID!]!"),a.ids=n,s.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),r.forEach((f,h)=>{i.push(`$h${h}: String!`),a[`h${h}`]=f,s.push(`h${h}: product(handle: $h${h}) { ...TetherProduct }`)});let c=`query TetherProducts(${i.join(",")}){${s.join(" ")}}${gt()}`;O("fetch products",e);let u=(f,h)=>{let m=oe.get(f);oe.delete(f),m&&h(m)};try{let f=await _(c,a),h=new Map;(f.byId||[]).forEach(m=>{m&&h.set(m.id,m)}),r.forEach((m,k)=>{f[`h${k}`]&&h.set(m,f[`h${k}`])}),e.forEach(m=>u(m,k=>{if(h.has(m)){let v=h.get(m);t===yt&&(et(v),_t.set(v.handle,Date.now()),_t.set(v.id,Date.now())),k.resolve(v)}else{let v=F.get(m);t===yt&&setTimeout(()=>{F.get(m)===v&&F.delete(m)},1e4),k.reject(new E(`Product not found: ${m}`,{code:"NOT_FOUND"}))}}))}catch(f){e.forEach(h=>u(h,m=>{t===yt&&F.delete(h),m.reject(f)}))}}function ue(){F.clear(),yt++,ot.clear(),_t.clear()}var ot=new Set,_t=new Map,yn=6e4;function de(t){(t||[]).forEach(e=>{!e?.id||!e.handle||Date.now()-(_t.get(e.handle)||0)<yn&&F.has(e.handle)||(et(e),ot.add(e.handle),ot.add(e.id))})}function pe(t){let e=ct(t);if(!ot.has(e))return!1;let n=F.get(e);return ot.delete(e),n?.then?.(r=>{ot.delete(r.handle),ot.delete(r.id)}),!0}function he(t){return t.forEach(e=>F.delete(ct(e))),t.map(e=>nt(e))}async function vt({collection:t,query:e,first:n=o.collectionFirst,after:r=null,sortKey:i,reverse:s=!1,filters:a}={}){let c=gt();if(t){let f=await _(`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${se()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}${c}`,{handle:t,first:n,after:r,sortKey:i||void 0,reverse:s,filters:a||void 0});if(!f.collection)throw new E(`Collection not found: ${t}`,{code:"NOT_FOUND"});let{products:h,...m}=f.collection;return h.nodes.forEach(et),{collection:m,products:h.nodes,pageInfo:h.pageInfo}}let u=await _(`query TetherSearch($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}${c}`,{first:n,after:r,query:e||void 0,sortKey:i||void 0,reverse:s});return u.products.nodes.forEach(et),{collection:null,products:u.products.nodes,pageInfo:u.products.pageInfo}}async function bt(t,e="RELATED"){let n=ct(typeof t=="object"?t?.id:t),r=n?.startsWith("gid://"),s=(await _(`query TetherRecs(${r?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${r?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}${gt()}`,r?{id:n,intent:e}:{handle:n,intent:e})).productRecommendations||[];return s.forEach(et),s}var xt={};M(xt,{GID:()=>R,allPlans:()=>H,allocationFor:()=>V,findPlan:()=>wt,hasPlans:()=>vn,planAdjustment:()=>ge,planCheckoutCharge:()=>me,planPrice:()=>$t,planSavings:()=>Dt,plansForVariant:()=>bn,toGid:()=>Ft});var R={product:t=>Ft(t,"Product"),variant:t=>Ft(t,"ProductVariant"),sellingPlan:t=>Ft(t,"SellingPlan")};function Ft(t,e){let n=String(t??"").trim();return n?n.startsWith("gid://")?n:/^\d+$/.test(n)?`gid://shopify/${e}/${n}`:n:null}function H(t){return(t?.sellingPlanGroups?.nodes||[]).flatMap(n=>(n.sellingPlans?.nodes||[]).map(r=>({...r,group:n})))}function vn(t){return H(t).length>0}function V(t,e){return!t||!e?null:(t.sellingPlanAllocations?.nodes||[]).find(n=>n.sellingPlan?.id===e)||null}function bn(t,e){return H(t).filter(n=>V(e,n.id))}function $t(t,e){let r=V(t,e)?.priceAdjustments?.[0];return r?.perDeliveryPrice||r?.price||t?.price||null}function me(t,e){let n=V(t,e);return n?.checkoutChargeAmount||n?.priceAdjustments?.[0]?.price||t?.price||null}function Dt(t,e){let n=parseFloat(t?.price?.amount),r=parseFloat($t(t,e)?.amount);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r>=n?{amount:null,percentage:0}:{amount:{amount:(n-r).toFixed(2),currencyCode:t.price.currencyCode},percentage:Math.round((1-r/n)*100)}}function ge(t){let e=t?.priceAdjustments?.[0]?.adjustmentValue;if(!e)return null;switch(e.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:e.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:e.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:e.price};default:return null}}function wt(t,e){if(!e)return null;let n=H(t),r=R.sellingPlan(e),i=String(e).trim().toLowerCase();return n.find(s=>s.id===r)||n.find(s=>s.name.toLowerCase()===i)||n.find(s=>(s.options||[]).some(a=>String(a.value).toLowerCase()===i))||null}var Pe={};M(Pe,{attr:()=>g,busy:()=>K,cdnUrl:()=>Ye,dataKey:()=>ze,emit:()=>$,formatDate:()=>be,formatMoney:()=>D,formatPercent:()=>ve,get:()=>p,has:()=>G,hasTemplate:()=>$e,imageUrl:()=>jt,notifyLayoutChanged:()=>J,parseJSONAttr:()=>Ae,productUrl:()=>At,qsa:()=>x,readText:()=>ye,repeat:()=>B,repeatKeyed:()=>we,sameImage:()=>Mt,scoped:()=>rt,sel:()=>l,setImage:()=>j,setSelected:()=>Pt,setText:()=>S,setTextTracked:()=>W,show:()=>L,toAttributes:()=>lt,watchImages:()=>xe});var g=t=>`${o.prefix}-${t}`,l=(t,e)=>e===void 0?`[${g(t)}]`:`[${g(t)}="${e}"]`,p=(t,e)=>t.getAttribute(g(e)),G=(t,e)=>t.hasAttribute(g(e)),ze=()=>`data-${o.prefix}-key`;function At(t,e){let n=o.productPath||"/product";if(!/\{(handle|id)\}/.test(n))return`${n.replace(/\/$/,"")}/${t}`;let r=e?String(e).split("/").pop():"";return n.replace(/\{handle\}/g,encodeURIComponent(t||"")).replace(/\{id\}/g,encodeURIComponent(r))}var x=(t,e)=>t?[...t.querySelectorAll(e)]:[],rt=(t,e,n)=>x(t,e).filter(r=>r.closest(n)===t);function $(t,e,n=document){n.dispatchEvent(new CustomEvent(`${o.prefix}:${t}`,{detail:e,bubbles:!0}))}function ve(t,e=o.locale){if(!t)return"";try{return new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100)}catch{return`${t}%`}}function D(t){if(!t)return"";if(typeof o.formatMoney=="function")return o.formatMoney(t,o.locale);let e=parseFloat(t.amount);if(Number.isNaN(e))return"";try{return new Intl.NumberFormat(o.locale||void 0,{style:"currency",currency:t.currencyCode}).format(e)}catch{return`${t.currencyCode} ${e.toFixed(2)}`}}function be(t){if(!t)return"";try{return new Date(t).toLocaleDateString(o.locale||void 0)}catch{return""}}function jt(t,{width:e,height:n,crop:r}={}){if(!t)return t;try{let i=new URL(t);return e&&i.searchParams.set("width",String(e)),n&&i.searchParams.set("height",String(n)),r&&i.searchParams.set("crop",r),i.toString()}catch{return t}}function Ye(t,e){if(!t||!e)return t;let n=r=>e.getAttribute(r)??e.getAttribute(`${o.prefix}-${r}`)??e.getAttribute(`data-${r}`);return jt(t,{width:n("max-width"),height:n("max-height"),crop:n("max-width")||n("max-height")?n("crop"):null})}var Mt=(t,e)=>!!(t&&e)&&t.split("?")[0]===e.split("?")[0];function j(t,e,n){if(!e)return;let r=Ye(e,t);if(t.tagName==="IMG"&&Mt(t.getAttribute("src"),r)){n!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",n);return}t.tagName==="IMG"?(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",r),n!=null&&t.setAttribute("alt",n),t.getAttribute("loading")||t.setAttribute("loading","lazy")):t.style.backgroundImage=`url("${r}")`}function S(t,e){let n=e==null?"":String(e);t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value=n:t.textContent=n}var ye=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.textContent;function W(t,e){let n=ye(t);S(t,e);let r=ye(t);if(n!==r&&t.dataset.tetherSeen&&typeof o.onValueChange=="function")try{o.onValueChange(t,n)}catch{}t.dataset.tetherSeen="1"}function L(t,e){let n="tetherPrevDisplay";if(e){if(t.dataset.tetherShown!==void 0)return;t.dataset.tetherShown="",t.removeAttribute("hidden"),t.dataset[n]!==void 0?(t.style.display=t.dataset[n],delete t.dataset[n]):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(`${o.prefix}-display`)||"block")}else delete t.dataset.tetherShown,t.dataset[n]===void 0&&t.style.display!=="none"&&(t.dataset[n]=t.style.display||""),t.style.display="none"}function Pt(t,e){t.classList.toggle("is-selected",e),t.setAttribute("aria-pressed",e?"true":"false"),t.tagName==="INPUT"&&(t.type==="radio"||t.type==="checkbox")&&(t.checked=e);let n=t.querySelector?.('input[type="radio"],input[type="checkbox"]');n&&(n.checked=e)}var Ut=new WeakMap,$e=t=>!!Ut.get(t);function Xe(t){if(!Ut.has(t)){let e=t.firstElementChild?.cloneNode(!0)??null;Ut.set(t,e),t.innerHTML=""}return Ut.get(t)}function B(t,e,n){let r=Xe(t);if(!r){e.length&&U("repeater without a template child",t);return}t.innerHTML="",e.forEach((i,s)=>{let a=r.cloneNode(!0);n(a,i,s),t.appendChild(a)})}function we(t,e,n,r,{onEnter:i,onLeave:s}={}){let a=Xe(t);if(!a){U("repeater without a template child",t);return}let c=ze(),u=`data-${o.prefix}-leaving`,f=()=>[...t.children].filter(b=>b.hasAttribute(c)&&!b.hasAttribute(u)),h=new Map(f().map(b=>[b.getAttribute(c),b])),m=[],k=new Set;e.forEach((b,N)=>{let d=String(n(b,N)),y=h.get(d);y?h.delete(d):(y=a.cloneNode(!0),y.setAttribute(c,d),k.add(y)),r(y,b,N,k.has(y)),m.push(y)});let v=m.filter(b=>!k.has(b)),C=f().filter(b=>v.includes(b));if(!(C.length===v.length&&C.every((b,N)=>b===v[N]))){h.forEach(b=>b.remove()),m.forEach(b=>t.appendChild(b));return}m.forEach((b,N)=>{if(!k.has(b))return;let d=m[N-1];if(d&&d.parentNode===t?d.after(b):t.prepend(b),i)try{i(b)}catch{}}),h.forEach(b=>{b.setAttribute(u,""),b.removeAttribute(c),b.style.pointerEvents="none",b.inert=!0;let N=()=>b.remove();if(s)try{s(b,N)}catch{N()}else N()})}var Je=null;function J(t){clearTimeout(Je),Je=setTimeout(()=>{typeof o.onLayoutChange=="function"?o.onLayoutChange(t):window.ScrollTrigger?.refresh&&window.ScrollTrigger.refresh(),$("layout-changed",{reason:t})},120)}function xe(t,e){let n=x(t,"img").filter(s=>!s.complete);if(!n.length)return;let r=n.length,i=()=>{--r===0&&J(`${e}:images`)};n.forEach(s=>{s.addEventListener("load",i,{once:!0}),s.addEventListener("error",i,{once:!0})})}function K(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve():(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>t.removeAttribute("aria-busy")))}function Ae(t,e){let n=t&&p(t,e);if(!n)return null;try{return JSON.parse(n)}catch{return U(`invalid JSON in ${g(e)}`,t),null}}function lt(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,n])=>({key:e,value:String(n??"")})):[]}function tn(t,e=1,n={}){let r=typeof t=="object"&&t!==null?t:{variantId:t,quantity:e,...n},i=R.variant(r.merchandiseId||r.variantId||r.id);if(!i)throw new E("add(): variantId is required");let s={merchandiseId:i,quantity:Math.max(1,parseInt(r.quantity??1,10)||1)},a=r.sellingPlanId||r.sellingPlan;a&&(s.sellingPlanId=R.sellingPlan(a));let c=lt(r.attributes);return c.length&&(s.attributes=c),s}function Ze(t,e,n){return`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${Nt()}`}var $n='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Vt=null,Rt=t=>x(t,$n).filter(e=>e.offsetParent!==null||e===document.activeElement);function Se(t){x(document,l("cart-open")).forEach(e=>e.setAttribute("aria-expanded",String(t))),x(document,l("cart-drawer")).forEach(e=>{e.hasAttribute("role")||e.setAttribute("role","dialog"),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")&&e.setAttribute("aria-label",p(e,"cart-label")||"Cart"),e.setAttribute("aria-modal",String(t)),e.classList.contains(o.cartDrawerOpenClass)||(e.setAttribute("aria-hidden","true"),o.cartFocus!==!1&&(e.inert=!0))})}var Ee=t=>/does not exist|not found|invalid id/i.test(t?.message||""),A={state:null,_chain:Promise.resolve(),id(){try{return localStorage.getItem(o.storageKey)}catch{return null}},_setId(t){try{t?localStorage.setItem(o.storageKey,t):localStorage.removeItem(o.storageKey)}catch{}},get lines(){return this.state?.lines?.nodes||[]},get count(){return this.state?.totalQuantity||0},lastError:null,customerAccessToken:null,pendingQty:new Map,warnings:[],loaded:!1,_take(t,e){let n=re(t,e);return this.warnings=(n.warnings||[]).filter((r,i,s)=>s.findIndex(a=>a.message===r.message)===i).map(r=>({...r,message:typeof o.warningText=="function"&&o.warningText(r)||r.message})),this.warnings.length&&$("cart-warning",{warnings:this.warnings}),n.cart},_queue(t){let e=this._chain.then(t,t).then(n=>(this.lastError&&(this.lastError=null,this.render()),n),n=>{throw this.lastError=n,this.render(),$("cart-error",{error:n}),n});return this._chain=e.catch(()=>{}),e},_commit(t,e){this.state=t,t?.id&&this._setId(t.id);try{localStorage.setItem(`${o.storageKey}:seen`,`${Date.now()}|${t?.totalQuantity||0}`)}catch{}return this.render(),$("cart-updated",{cart:t,reason:e}),t},async init(){let t=this.id();if(!t)return this.state=null,this.loaded=!0,this.render(),$("cart-updated",{cart:null,reason:"load"}),null;if(!this.loaded)try{let e=(localStorage.getItem(`${o.storageKey}:seen`)||"").split("|")[1];e&&x(document,l("cart-count")).forEach(n=>{/^\s*0?\s*$/.test(n.textContent)&&(n.textContent=e)})}catch{}try{let e=await _(`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${Nt()}`,{id:t});e.cart?this.state=e.cart:(this._setId(null),this.state=null)}catch(e){P(e,"cart load failed"),this.lastError=e,Ee(e)&&this._setId(null),this.state=null}return this.loaded=!0,this.render(),$("cart-updated",{cart:this.state,reason:"load"}),this.state},async _create(t={}){let e=o.country||this.customerAccessToken?{...o.country?{countryCode:String(o.country).toUpperCase()}:{},...this.customerAccessToken?{customerAccessToken:this.customerAccessToken}:{}}:void 0,n=await _(Ze("cartCreate","$input: CartInput!","input: $input"),{input:{buyerIdentity:e,...t}});return this._take(n.cartCreate,"cartCreate")},async _mutate(t,e,n,r,i){let s=this.id();if(!s)return i?this._create(i):null;try{let a=await _(Ze(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`),{...r,cartId:s});return this._take(a[t],t)}catch(a){if(i&&Ee(a))return O("cart expired, creating a new one"),this._setId(null),this._create(i);throw a}},add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(i=>tn(i,e,n));return this._queue(async()=>{let i=await this._mutate("cartLinesAdd","$lines: [CartLineInput!]!","lines: $lines",{lines:r},{lines:r});return this._commit(i,"add"),$("added",{cart:i,lines:r}),o.openCartOnAdd&&this.open(),i})},updateLine(t,e){let n=typeof e=="number"?{quantity:e}:{...e};if(n.quantity!==void 0&&n.quantity<=0)return this.removeLine(t);let r={id:t};return n.quantity!==void 0&&(r.quantity=n.quantity),"sellingPlanId"in n&&(r.sellingPlanId=n.sellingPlanId?R.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=lt(n.attributes)),(n.merchandiseId||n.variantId)&&(r.merchandiseId=R.variant(n.merchandiseId||n.variantId)),this._queue(async()=>this._commit(await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[r]}),"update"))},changeQuantity(t,e){let n=this.lines.find(a=>a.id===t);if(!n)return Promise.resolve(this.state);let r=Math.max(0,(this.pendingQty.get(t)?.qty??n.quantity)+e),i={qty:r,done:!1};this.pendingQty.set(t,i),this.render(),$("cart-updated",{cart:this.state,reason:"pending"});let s=()=>this.pendingQty.get(t)===i;return this._queue(async()=>{if(!s())return this.state;let a=this.lines.find(u=>u.id===t);if(a&&a.quantity===r)return this.state;let c=r>0?await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[{id:t,quantity:r}]}):await this._mutate("cartLinesRemove","$lineIds: [ID!]!","lineIds: $lineIds",{lineIds:[t]});return s()?this._commit(c,r>0?"update":"remove"):(this.state=c,c?.id&&this._setId(c.id),c)}).finally(()=>{s()&&(this.pendingQty.delete(t),this.render(),$("cart-updated",{cart:this.state,reason:"settled"}))})},quantityOf(t){return this.pendingQty.get(t.id)?.qty??t.quantity},removeLine(t){let e=Array.isArray(t)?t:[t];return this._queue(async()=>this._commit(await this._mutate("cartLinesRemove","$lineIds: [ID!]!","lineIds: $lineIds",{lineIds:e}),"remove"))},clear(){let t=this.lines.map(e=>e.id);return t.length?this.removeLine(t):Promise.resolve(this.state)},setNote(t){return this._queue(async()=>this._commit(await this._mutate("cartNoteUpdate","$note: String!","note: $note",{note:t??""},{note:t??""}),"note"))},setAttributes(t){let e=new Map((this.state?.attributes||[]).map(r=>[r.key,r.value]));lt(t).forEach(r=>e.set(r.key,r.value));let n=[...e].filter(([,r])=>r!=="").map(([r,i])=>({key:r,value:i}));return this._queue(async()=>this._commit(await this._mutate("cartAttributesUpdate","$attributes: [AttributeInput!]!","attributes: $attributes",{attributes:n},{attributes:n}),"attributes"))},setDiscountCodes(t){let e=(Array.isArray(t)?t:[t]).map(n=>String(n).trim()).filter(Boolean);return this._queue(async()=>this._commit(await this._mutate("cartDiscountCodesUpdate","$discountCodes: [String!]!","discountCodes: $discountCodes",{discountCodes:e},{discountCodes:e}),"discount"))},async applyDiscount(t){let e=(this.state?.discountCodes||[]).map(i=>i.code),n=await this.setDiscountCodes([...new Set([...e,t])]);if((n?.discountCodes||[]).find(i=>i.code.toLowerCase()===String(t).toLowerCase())?.applicable)return n;throw await this.removeDiscount(t).catch(()=>{}),new E(`Discount code not valid: ${t}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let e=String(t).toLowerCase();return this.setDiscountCodes((this.state?.discountCodes||[]).map(n=>n.code).filter(n=>n.toLowerCase()!==e))},setBuyerIdentity(t,{create:e=!0}={}){return this._queue(async()=>{let n=await this._mutate("cartBuyerIdentityUpdate","$buyerIdentity: CartBuyerIdentityInput!","buyerIdentity: $buyerIdentity",{buyerIdentity:t},e?{buyerIdentity:t}:null).catch(r=>{if(e||!Ee(r))throw r;return this._setId(null),null});return this._commit(n,"buyer-identity")})},async checkout(t=o.checkoutTarget){let e=this.id();if(!e||this.state&&!this.count)return null;let n=t==="_blank"?window.open("","_blank"):null;if(n)try{n.opener=null}catch{}try{let r=await _("query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }",{id:e}),i=this.beforeCheckout&&await this.beforeCheckout().catch(()=>null)||r.cart?.checkoutUrl;if(i&&this.customerAccessToken&&(i+=`${i.includes("?")?"&":"?"}logged_in=true`),!i)throw new E("No checkoutUrl (cart empty or expired)");return $("checkout",{url:i,cart:this.state}),n&&!n.closed?n.location.href=i:window.location.href=i,i}catch(r){return n&&n.close(),P(r,"checkout failed"),null}},drawers(){return x(document,l("cart-drawer"))},_open:!1,isOpen(){let t=this.drawers();return t.length?t.some(e=>e.classList.contains(o.cartDrawerOpenClass)):this._open},open(){if(this.isOpen())return;this._open=!0;let t=this.drawers().filter(e=>p(e,"cart-drawer")!=="manual");t.forEach(e=>{e.inert=!1,e.classList.add(o.cartDrawerOpenClass),e.setAttribute("aria-hidden","false")}),Se(!0),o.cartFocus!==!1&&t[0]&&(Vt=document.activeElement,setTimeout(()=>{let e=Rt(t[0])[0]||t[0];e===t[0]&&!t[0].hasAttribute("tabindex")&&(t[0].tabIndex=-1),e.focus?.({preventScroll:!0})},60)),typeof o.onCartOpen=="function"&&o.onCartOpen(t),$("cart-toggled",{open:!0})},close(){if(!this.isOpen())return;this._open=!1;let t=this.drawers(),e=t.some(n=>n.contains(document.activeElement));t.forEach(n=>{n.classList.remove(o.cartDrawerOpenClass),n.setAttribute("aria-hidden","true"),o.cartFocus!==!1&&(n.inert=!0)}),Se(!1),e&&Vt?.isConnected&&Vt.focus({preventScroll:!0}),Vt=null,typeof o.onCartClose=="function"&&o.onCartClose(t),$("cart-toggled",{open:!1})},toggle(){this.isOpen()?this.close():this.open()},subscribe(t){let e=()=>t(this.state,{open:this.isOpen(),count:this.count,loaded:this.loaded,warnings:this.warnings}),n=()=>e();return["cart-updated","cart-toggled"].forEach(r=>document.addEventListener(`${o.prefix}:${r}`,n)),e(),()=>["cart-updated","cart-toggled"].forEach(r=>document.removeEventListener(`${o.prefix}:${r}`,n))},render(){let t=this.state,e=t?t.totalQuantity:0,n=s=>t?D(t.cost?.[s]):"";Se(this.isOpen()),x(document,l("cart-count")).forEach(s=>W(s,e)),x(document,l("cart-subtotal")).forEach(s=>W(s,n("subtotalAmount"))),x(document,l("cart-total")).forEach(s=>W(s,n("totalAmount"))),x(document,l("cart-checkout-charge")).forEach(s=>W(s,n("checkoutChargeAmount")));let r=this.lines.some(s=>s.sellingPlanAllocation),i={"cart-empty":e===0,"cart-filled":e>0,"cart-has-subscription":r,"cart-no-subscription":!r,"cart-has-discount":(t?.discountCodes||[]).some(s=>s.applicable),"cart-error":!!this.lastError,"cart-warning":this.warnings.length>0};x(document,l("cart-warning")).forEach(s=>W(s,[...new Set(this.warnings.map(a=>a.message))].join(" "))),x(document,l("show")).forEach(s=>{let a=p(s,"show");a in i&&!s.closest(l("product"))&&L(s,i[a])}),x(document,l("checkout")).forEach(s=>{s.classList.toggle("is-disabled",!e),s.setAttribute("aria-disabled",String(!e))}),x(document,`textarea${l("cart-note")},input${l("cart-note")}`).forEach(s=>{document.activeElement!==s&&(s.value=t?.note||"")}),x(document,l("cart-discounts")).forEach(s=>{B(s,t?.discountCodes||[],(a,c)=>{a.setAttribute(g("discount-code"),c.code);let u=a.querySelector(l("discount","code"))||(a.firstElementChild?null:a);u&&S(u,c.code),a.classList.toggle("is-inapplicable",!c.applicable)})}),x(document,l("cart-lines")).forEach(s=>{we(s,this.lines,a=>a.id,(a,c)=>xn(a,c),{onEnter:o.onLineEnter,onLeave:o.onLineLeave})}),t&&J("cart")}};function wn(t,e){let n=t.merchandise||{},r=t.sellingPlanAllocation?.sellingPlan;switch(e){case"title":return n.product?.title;case"product-title":return n.product?.title;case"variant-title":return n.title==="Default Title"?"":n.title;case"options":return(n.selectedOptions||[]).filter(i=>i.value!=="Default Title").map(i=>`${i.name}: ${i.value}`).join(", ");case"vendor":return n.product?.vendor;case"sku":return n.sku;case"price":return D(t.cost?.amountPerQuantity||n.price);case"compare-at-price":return D(t.cost?.compareAtAmountPerQuantity||n.compareAtPrice);case"line-total":return D(t.cost?.totalAmount);case"line-subtotal":return D(t.cost?.subtotalAmount);case"quantity":return A.quantityOf(t);case"plan":return r?.name||"";case"plan-description":return r?.description||"";case"components":return(t.lineComponents||[]).map(i=>`${i.quantity} \xD7 ${i.merchandise?.product?.title||""}`).join(", ");default:if(e.startsWith("attribute:")){let i=e.slice(10);return(t.attributes||[]).find(s=>s.key===i)?.value||""}return}}function xn(t,e){let n=e.merchandise||{},r=!!e.sellingPlanAllocation;t.setAttribute(g("line-id"),e.id),t.classList.toggle("is-subscription",r),x(t,l("line")).forEach(c=>{let u=p(c,"line");if(u==="image")return j(c,n.image?.url||n.product?.featuredImage?.url,n.product?.title);if(u==="url"){let h=At(n.product?.handle,n.product?.id),m=new URLSearchParams;n.id&&m.set("variant",String(n.id).split("/").pop());let k=e.sellingPlanAllocation?.sellingPlan?.id;k&&m.set("selling_plan",k.split("/").pop());let v=m.toString();return c.setAttribute("href",v?`${h}${h.includes("?")?"&":"?"}${v}`:h)}let f=wn(e,u);f!==void 0&&W(c,f)});let i=A.warnings.find(c=>c.target===e.id);t.classList.toggle("is-warning",!!i);let s=A.pendingQty.has(e.id);t.classList.toggle("is-busy",s),s?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),x(t,l("line","warning")).forEach(c=>W(c,i?.message||""));let a={subscription:r,"one-time":!r,"on-sale":parseFloat(e.cost?.compareAtAmountPerQuantity?.amount)>parseFloat(e.cost?.amountPerQuantity?.amount),"has-components":(e.lineComponents||[]).length>0,warning:!!i};x(t,l("line-show")).forEach(c=>{let u=p(c,"line-show");u in a&&L(c,a[u])}),x(t,`select${l("line-plan")}`).forEach(c=>{let u=n.product?.handle;u&&nt(u).then(f=>{let h=H(f),k=[...!f.requiresSellingPlan&&p(c,"line-plan")!=="subscription-only"?[{value:"",label:c.getAttribute(g("one-time-label"))||"One-time purchase"}]:[],...h.map(C=>({value:C.id,label:C.name}))],v=k.map(C=>C.value).join("|");c.dataset.tetherSig!==v&&(c.innerHTML="",k.forEach(C=>{let at=document.createElement("option");at.value=C.value,at.textContent=C.label,c.appendChild(at)}),c.dataset.tetherSig=v),c.value=e.sellingPlanAllocation?.sellingPlan?.id||"",L(c,h.length>0)}).catch(f=>P(f,"line plan options"))})}var Te={};M(Te,{ProductScope:()=>St,rememberOptionNames:()=>Ht,scopes:()=>it});var Ie={};M(Ie,{STATUS_KEYS:()=>Kt,boundary:()=>Bt,isNotFound:()=>ht,ownedBy:()=>ke,resolveProductKey:()=>z,setScopeStatus:()=>Y});function z(t,e=window.location,n="product"){let r=(p(t,n)||"").trim();if(!r.toLowerCase().startsWith("url:"))return{key:r||null,fromUrl:!1,raw:r};let i=r.slice(4).trim(),s=null;if(i.toLowerCase()==="path"){let a=e.pathname.split("/").filter(Boolean);s=a.length?An(a[a.length-1]):null}else s=new URLSearchParams(e.search).get(i||"handle");return s=s&&s.trim()?s.trim():null,{key:s,fromUrl:!0,raw:r}}function An(t){try{return decodeURIComponent(t)}catch{return t}}var Kt=["loading","ready","error","not-found"],ht=t=>t?.code==="NOT_FOUND",Bt=()=>["product","collection","products","recommendations"].map(t=>l(t)).join(","),ke=(t,e)=>t===e||t.parentElement?.closest(Bt())===e;function Y(t,e,n){let r=e==="not-found";t.setAttribute(g("state"),r?"error":e),e==="error"||r?t.setAttribute(g("error"),r?"not-found":n?.code||"error"):t.removeAttribute(g("error")),rt(t,l("show"),Bt()).forEach(i=>{let s=p(i,"show");Kt.includes(s)&&L(i,s===e)}),(e==="error"||r)&&rt(t,l("add-to-cart"),Bt()).forEach(i=>{i.classList.add("is-disabled"),i.setAttribute("aria-disabled","true"),"disabled"in i&&(i.disabled=!0)})}var it=new WeakMap,en=()=>l("product");function Pn(t,e){let n=e.indexOf("."),r=e.slice(0,n),i=e.slice(n+1);return(t.metafields||[]).find(a=>a&&a.namespace===r&&a.key===i)||null}var Qt=new Map;function Ht(t){(t||[]).forEach(e=>{e?.handle&&!Qt.has(e.handle)&&Qt.set(e.handle,(e.options||[]).map(n=>n.name))})}var St=class{constructor(e,n){this.root=e,this.product=n,this.selected={},this.variant=null,this.quantity=Math.max(0,parseInt(p(e,"quantity")??"1",10)||(G(e,"quantity")?0:1)),this.plans=H(n),this.purchase="one-time",this.planId=null,it.set(e,this),e.setAttribute(g("state"),"ready"),e.removeAttribute(g("error")),this.initSelection(),this.initPurchase(),this.renderProduct(),this.bind(),this.renderVariant(),xe(e,"product"),J("product"),$("product-ready",{product:n,scope:this},e)}update(e){let n=this.variant?.id;this.product=e,this.plans=H(e),this.planId&&!this.plans.some(i=>i.id===this.planId)&&(this.planId=this.plans[0]?.id||null),!this.plans.length&&this.purchase==="subscription"&&(this.purchase="one-time");let r=e.variants.nodes.find(i=>i.id===n);r&&(this.selected={},r.selectedOptions.forEach(i=>{this.selected[i.name]=i.value})),this.root.setAttribute(g("state"),"ready"),this.root.removeAttribute(g("error")),this.renderProduct(),this.renderVariant(),J("product"),$("product-updated",{product:e,scope:this},this.root)}$(e){let n=rt(this.root,e,en());return this.root.matches(e)?[this.root,...n]:n}optName(e){let n=this.product?.options||[];if(!e||n.some(i=>i.name===e))return e;let r=(Qt.get(this.product.handle)||[]).indexOf(e);return r>=0&&n[r]?n[r].name:e}initSelection(){let e=this.product.variants.nodes,n=e.find(i=>i.availableForSale)||e[0];n&&n.selectedOptions.forEach(i=>{this.selected[i.name]=i.value});let r=new URLSearchParams(window.location.search).get("variant")||p(this.root,"variant");if(r){let i=R.variant(r),s=e.find(a=>a.id===i);s&&(this.selected={},s.selectedOptions.forEach(a=>{this.selected[a.name]=a.value}))}}initPurchase(){if(!this.plans.length)return;let e=new URLSearchParams(window.location.search),n=wt(this.product,e.get("selling_plan")),r=wt(this.product,p(this.root,"default-plan"));this.planId=(n||r||this.plans[0]).id;let i=n?"subscription":p(this.root,"default-purchase")||o.defaultPurchase;this.purchase=this.product.requiresSellingPlan||i==="subscription"?"subscription":"one-time"}findVariant(){return this.product.variants.nodes.find(e=>e.selectedOptions.every(n=>this.selected[n.name]===n.value))||null}isValueAvailable(e,n){return this.product.variants.nodes.some(r=>r.availableForSale&&r.selectedOptions.every(i=>i.name===e?i.value===n:this.selected[i.name]===i.value))}get plan(){return this.plans.find(e=>e.id===this.planId)||null}get subscriptionAvailable(){return!!(this.variant&&this.plans.some(e=>V(this.variant,e.id)))}get isSubscription(){return this.purchase==="subscription"&&!!V(this.variant,this.planId)}getLine(){if(!this.variant)return null;let e={merchandiseId:this.variant.id,quantity:this.quantity};this.isSubscription&&(e.sellingPlanId=this.planId);let n=this.collectAttributes();return n.length&&(e.attributes=n),e}collectAttributes(){let e=lt(Ae(this.root,"line-attributes")),n=this.$(l("line-attribute")).map(r=>{let i=p(r,"line-attribute"),s;return r.type==="checkbox"?s=r.checked?r.value&&r.value!=="on"?r.value:"Yes":"":r.type==="radio"?s=r.checked?r.value:null:s=r.value,s==null||s===""?null:{key:i,value:String(s)}}).filter(Boolean);return[...e,...n]}select(e,n){if(this.selected[e]===n)return;let r=this.product.variants.nodes.filter(s=>s.selectedOptions.some(a=>a.name===e&&a.value===n));if(!r.length)return;let i={...this.selected,[e]:n};if(!r.some(s=>s.selectedOptions.every(a=>i[a.name]===a.value))){let s=c=>c.selectedOptions.filter(u=>u.name!==e&&this.selected[u.name]===u.value).length*2+(c.availableForSale?1:0);r.reduce((c,u)=>s(u)>s(c)?u:c).selectedOptions.forEach(c=>{i[c.name]=c.value})}this.selected=i,this.renderVariant()}selectVariant(e){let n=this.product.variants.nodes.find(r=>r.id===R.variant(e));n&&(this.selected={},n.selectedOptions.forEach(r=>{this.selected[r.name]=r.value}),this.renderVariant())}setPurchase(e){let n=e==="subscription"?"subscription":"one-time";n==="one-time"&&this.product.requiresSellingPlan||this.purchase!==n&&(this.purchase=n,this.renderVariant())}selectPlan(e){let n=wt(this.product,e);n&&(this.planId=n.id,this.purchase="subscription",this.renderVariant())}setQuantity(e){let n=G(this.root,"quantity")?0:1;this.quantity=Math.max(n,parseInt(e,10)||0),this.$(l("qty")).forEach(r=>S(r,this.quantity)),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let e=this.getLine();if(!e||e.quantity<1)return null;let n=await A.add(e);return $("product-added",{product:this.product,variant:this.variant,line:e},this.root),n}bind(){let e=n=>n&&n.closest(en())===this.root;this.root.addEventListener("click",n=>{let r=n.target;if(!r?.closest)return;let i=r.closest(l("option-value"));if(e(i)&&i.closest(l("option-list"))){n.preventDefault(),this.select(this.optName(p(i.closest(l("option-list")),"option-list")),p(i,"option-value"));return}let s=r.closest(l("plan-value"));if(e(s)){n.preventDefault(),this.selectPlan(p(s,"plan-value"));return}let a=r.closest(`${l("purchase")}:not(select)`);if(e(a)){a.tagName!=="INPUT"&&n.preventDefault(),this.setPurchase(p(a,"purchase"));return}let c=r.closest(l("qty-plus"));if(e(c)){n.preventDefault(),this.setQuantity(this.quantity+1);return}let u=r.closest(l("qty-minus"));if(e(u)){n.preventDefault(),this.setQuantity(this.quantity-1);return}let f=r.closest(l("add-to-cart"));e(f)&&(n.preventDefault(),this.onAddClick(f))}),this.root.addEventListener("change",n=>{let r=n.target;e(r)&&(r.matches(`select${l("option")}`)?this.select(this.optName(p(r,"option")),r.value):r.matches(`select${l("variant-select")}`)?this.selectVariant(r.value):r.matches(`select${l("plan")}`)?r.value?this.selectPlan(r.value):this.setPurchase("one-time"):r.matches(`select${l("purchase")}`)?this.setPurchase(r.value):r.matches(l("qty"))&&this.setQuantity(r.value))})}onAddClick(e){let n=e.querySelector(l("add-label"))||e,r=p(e,"adding-text"),i=s=>S(n,s);n.dataset.tetherLabel===void 0&&(n.dataset.tetherLabel=n.tagName==="INPUT"?n.value:n.textContent),K(e,async()=>{r&&i(r);try{await this.addToCart()}catch(s){P(s,"add to cart failed"),$("error",{error:s,context:"add-to-cart"},this.root)}finally{r&&i(n.dataset.tetherLabel)}}).then(()=>{this.renderVariant()})}renderProduct(){let e=this.product;Qt.has(e.handle)||this.$(`${l("option-list")},select${l("option")}`).map(i=>p(i,"option-list")||p(i,"option")).some(i=>e.options.some(s=>s.name===i))&&Ht([e]);let n=this.product;this.$(l("bind")).forEach(r=>{let i=p(r,"bind")||"",s={title:n.title,"description-text":n.description,vendor:n.vendor,type:n.productType,handle:n.handle}[i];if(s!==void 0)return S(r,s);switch(i){case"description":r.innerHTML=n.descriptionHtml||"";return;case"published-at":return S(r,be(n.publishedAt));case"min-price":return S(r,D(n.priceRange.minVariantPrice));case"max-price":return S(r,D(n.priceRange.maxVariantPrice));case"featured-image":return j(r,n.featuredImage?.url,n.featuredImage?.altText||n.title);case"url":case"link":r.setAttribute("href",At(n.handle,n.id)),i==="url"&&!r.firstElementChild&&!r.textContent.trim()&&S(r,n.title);return;case"images":{let a=[...r.children].map(c=>c.tagName==="IMG"?c:c.querySelector("img"));if(!$e(r)&&a.length===n.images.nodes.length&&a.every((c,u)=>Mt(c?.getAttribute("src"),n.images.nodes[u].url)))return}return B(r,n.images.nodes,(a,c)=>{let u=a.matches(`img,${l("bind","image")}`)?a:a.querySelector("img")||a;j(u,c.url,c.altText||n.title)});case"tags":{let a=(r.getAttribute("exclude")||"").split(",").map(c=>c.trim()).filter(Boolean);return B(r,n.tags.filter(c=>!a.includes(c)),(c,u)=>S(c,u))}default:if(/^image:\d+$/.test(i)){let a=n.images.nodes[i.slice(6)-1]||n.featuredImage;return j(r,a?.url,a?.altText||n.title)}if(i.startsWith("metafield:")){let a=Pn(n,i.slice(10));return a?a.reference?.image?j(r,a.reference.image.url,a.reference.image.altText):(/^(rich_text|multi_line_text)_field$/.test(a.type)&&(r.style.whiteSpace="pre-line"),S(r,a.value)):S(r,"")}return}}),this.$(l("option-list")).forEach(r=>{let i=this.optName(p(r,"option-list")),s=n.options.find(a=>a.name===i);return!s||s.optionValues.length<=1&&G(r,"hide-single")?L(r,!1):B(r,s.optionValues,(a,c)=>{a.setAttribute(g("option-value"),c.name);let u=a.querySelector(l("bind","option-value"));u?S(u,c.name):a.firstElementChild||S(a,c.name);let f=a.querySelector(l("bind","swatch"));f&&c.swatch?.color&&(f.style.backgroundColor=c.swatch.color),f&&c.swatch?.image?.previewImage&&j(f,c.swatch.image.previewImage.url,c.name)})}),this.$(`select${l("option")}`).forEach(r=>{let i=n.options.find(s=>s.name===this.optName(p(r,"option")));if(!i)return L(r,!1);r.innerHTML="",i.optionValues.forEach(s=>r.appendChild(new Option(s.name,s.name)))}),this.$(`select${l("variant-select")}`).forEach(r=>{r.innerHTML="",n.variants.nodes.forEach(i=>r.appendChild(new Option(i.title,i.id)))}),this.$(l("plan-list")).forEach(r=>{let i=(p(r,"plan-list")||"").trim(),s=["","true","all","*"].includes(i.toLowerCase())?null:i,a=this.plans.filter(c=>!s||c.group.name===s);B(r,a,(c,u)=>{c.setAttribute(g("plan-value"),u.id),!c.firstElementChild&&!c.querySelector(l("plan-bind"))&&S(c,u.name)})}),this.$(`select${l("plan")}`).forEach(r=>{r.innerHTML="",!n.requiresSellingPlan&&p(r,"plan")!=="subscription-only"&&r.appendChild(new Option(r.getAttribute(g("one-time-label"))||"One-time purchase","")),this.plans.forEach(i=>r.appendChild(new Option(i.name,i.id)))})}renderVariant(){let e=this.product,n=this.findVariant();if(n||([n]=e.variants.nodes,n&&(this.selected={},n.selectedOptions.forEach(d=>{this.selected[d.name]=d.value}))),this.variant=n,!n)return;if(this.plans.length&&!V(n,this.planId)){let d=this.plans.find(y=>V(n,y.id));d&&(this.planId=d.id)}let r=this.isSubscription,i=n.price,s=this.planId?$t(n,this.planId):null,a=r?s:i,c=r&&V(n,this.planId)?.priceAdjustments?.[0]?.compareAtPrice||n.compareAtPrice,u=c&&parseFloat(c.amount)>parseFloat(a.amount),f=u?Math.round((1-parseFloat(a.amount)/parseFloat(c.amount))*100):0,h=this.planId?Dt(n,this.planId):{amount:null,percentage:0},m=this.plan,k={amount:(parseFloat(a.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:a.currencyCode},v=D,C=d=>ve(d),at={price:()=>v(a),"total-price":()=>v(k),"one-time-price":()=>v(i),"subscription-price":()=>v(s),"subscription-savings":()=>C(h.percentage),"subscription-savings-amount":()=>v(h.amount),"checkout-charge":()=>{let d=r?me(n,this.planId):a;return d&&v({amount:(parseFloat(d.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:d.currencyCode})},"plan-name":()=>m?.name,"plan-description":()=>m?.description,"plan-group":()=>m?.group?.name,"compare-at-price":()=>u?v(c):"","unit-price":()=>v(n.unitPrice),"discount-percentage":()=>`${f}%`,"discount-amount":()=>u?v({amount:String(parseFloat(c.amount)-parseFloat(a.amount)),currencyCode:a.currencyCode}):"","variant-title":()=>n.title,"variant-id":()=>n.id,sku:()=>n.sku,barcode:()=>n.barcode,stock:()=>n.quantityAvailable,quantity:()=>this.quantity};this.$(l("bind")).forEach(d=>{let y=p(d,"bind");y==="variant-image"?j(d,n.image?.url||e.featuredImage?.url,n.image?.altText||e.title):at[y]&&S(d,at[y]())}),this.$(l("option-selected")).forEach(d=>S(d,this.selected[this.optName(p(d,"option-selected"))]||"")),this.$(l("option-list")).forEach(d=>{let y=this.optName(p(d,"option-list"));x(d,l("option-value")).forEach(I=>{let X=p(I,"option-value");Pt(I,this.selected[y]===X);let T=!this.isValueAvailable(y,X);I.classList.toggle("is-unavailable",T),I.setAttribute("data-unavailable",T?"true":"false")})}),this.$(`select${l("option")}`).forEach(d=>{d.value=this.selected[this.optName(p(d,"option"))]||""}),this.$(`select${l("variant-select")}`).forEach(d=>{d.value=n.id}),this.$(l("purchase")).forEach(d=>{if(d.tagName==="SELECT"){d.value=this.purchase;return}let y=p(d,"purchase");Pt(d,y===this.purchase);let I=y==="subscription"?!this.subscriptionAvailable:e.requiresSellingPlan;d.classList.toggle("is-unavailable",I)}),this.$(l("plan-value")).forEach(d=>{let y=p(d,"plan-value"),I=this.plans.find(T=>T.id===y),X=!!V(n,y);Pt(d,r&&y===this.planId),d.classList.toggle("is-unavailable",!X),x(d,l("plan-bind")).forEach(T=>{let Z=ge(I),Re=Dt(n,y),pn=p(T,"plan-bind"),Be={name:()=>I?.name,option:()=>(I?.options||[]).map(hn=>hn.value).join(", "),description:()=>I?.description,price:()=>v($t(n,y)),savings:()=>C(Re.percentage),"savings-amount":()=>v(Re.amount),adjustment:()=>Z?Z.type==="percentage"?`${Z.value}%`:v(Z.value):""}[pn];Be&&S(T,Be())})}),this.$(`select${l("plan")}`).forEach(d=>{d.value=r?this.planId:""});let b=n.quantityAvailable!=null&&n.quantityAvailable>0&&n.quantityAvailable<=(o.lowStock??5),N={"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":!!u,"not-on-sale":!u,"has-variants":e.variants.nodes.length>1,"single-variant":e.variants.nodes.length===1,"low-stock":b,"plenty-in-stock":n.availableForSale&&!b,"subscription-available":this.subscriptionAvailable,"subscription-unavailable":!this.subscriptionAvailable,"subscription-only":!!e.requiresSellingPlan,"one-time-available":!e.requiresSellingPlan,"subscription-selected":r,"one-time-selected":!r,"has-savings":r?h.percentage>0:!!u,loading:!1,ready:!0,error:!1,"not-found":!1};this.$(l("show")).forEach(d=>{let y=p(d,"show");y in N&&(Kt.includes(y)&&!ke(d,this.root)||L(d,N[y]))}),this.root.classList.toggle("is-subscription",r),this.root.setAttribute(g("purchase-mode"),r?"subscription":"one-time"),this.$(l("add-to-cart")).forEach(d=>{let y=!n.availableForSale;d.classList.toggle("is-disabled",y),d.setAttribute("aria-disabled",String(y)),"disabled"in d&&(d.disabled=y);let I=p(d,"soldout-text"),X=p(d,"subscribe-text");if(I||X){let T=d.querySelector(l("add-label"))||d;T.dataset.tetherLabel===void 0&&(T.dataset.tetherLabel=T.tagName==="INPUT"?T.value:T.textContent);let Z=T.dataset.tetherLabel;r&&X&&(Z=X),y&&I&&(Z=I),d.getAttribute("aria-busy")!=="true"&&S(T,Z)}}),$("variant-changed",{product:e,variant:n,selected:{...this.selected},purchase:this.purchase,sellingPlanId:r?this.planId:null},this.root)}};var Le={};M(Le,{ListScope:()=>Et,listSelector:()=>ut});var ut=()=>`${l("collection")},${l("products")},${l("recommendations")}`,Et=class{constructor(e){this.root=e,this.products=[],this.pageInfo=null,this.collection=null,Y(e,"loading"),e.addEventListener("click",n=>{let r=n.target.closest?.(l("load-more"));r&&r.closest(ut())===e&&(n.preventDefault(),K(r,()=>this.load(!0)))})}$(e){return rt(this.root,e,ut())}options(){let e=this.root,n={first:parseInt(p(e,"limit")||"",10)||void 0,sortKey:p(e,"sort")||void 0,reverse:p(e,"reverse")==="true"};if(G(e,"collection"))n.collection=p(e,"collection");else{let r=p(e,"products")||"";n.query=r.startsWith("url:")?new URL(window.location.href).searchParams.get(r.slice(4))||"":r}return n}async load(e=!1){let n=this.loadToken=(this.loadToken||0)+1,r=()=>n!==this.loadToken;try{if(G(this.root,"recommendations")){let{key:i}=z(this.root,window.location,"recommendations"),s=this.root.closest(l("product"));if(!i&&s&&({key:i}=z(s)),!i)throw new E("No product for recommendations",{code:"NOT_FOUND"});let a=await bt(i,p(this.root,"intent")||"RELATED");if(r())return;let c=parseInt(p(this.root,"limit")||"",10);this.products=c?a.slice(0,c):a}else{let i=await vt({...this.options(),after:e?this.pageInfo?.endCursor:null});if(r())return;this.collection=i.collection,this.pageInfo=i.pageInfo,this.products=e?[...this.products,...i.products]:i.products}this.render(),Y(this.root,"ready"),$("list-ready",{products:this.products,collection:this.collection},this.root)}catch(i){if(r())return;e||Y(this.root,ht(i)?"not-found":"error",i),ht(i)&&G(this.root,"recommendations")||P(i,"list load failed"),$("error",{error:i,context:"list"},this.root)}}render(){let e=this.collection;this.$(l("collection-bind")).forEach(r=>{switch(p(r,"collection-bind")){case"title":return S(r,e?.title||"");case"description":r.innerHTML=e?.descriptionHtml||"";return;case"image":return j(r,e?.image?.url,e?.image?.altText||e?.title);case"count":return S(r,this.products.length);default:return}}),this.$(l("list")).forEach(r=>{B(r,this.products,(i,s)=>{i.setAttribute(g("product"),s.handle),i.removeAttribute(g("state"))}),$("list-rendered",{container:r},this.root)});let n=this.products.length===0;this.$(l("show")).forEach(r=>{let i=p(r,"show");i==="list-empty"&&L(r,n),i==="list-filled"&&L(r,!n)}),this.$(l("load-more")).forEach(r=>L(r,!!this.pageInfo?.hasNextPage)),J("list")}};var _e={};M(_e,{hydrateFromPage:()=>Ne,liveLists:()=>mt,liveProducts:()=>ft,mountProduct:()=>zt,mountedLists:()=>Wt,mountedProducts:()=>Ct,pruneLive:()=>Jt,retryFailed:()=>qe,settleMarket:()=>Yt,trackMarket:()=>Oe,within:()=>dt});var Ct=new WeakSet,Wt=new WeakSet,ft=new Set,mt=new Set,nn=new WeakMap;function Jt(){ft.forEach(t=>{t.isConnected||ft.delete(t)}),mt.forEach(t=>{t.root.isConnected||mt.delete(t)})}function dt(t,e){return[...t.matches?.(e)?[t]:[],...x(t,e)]}function zt(t){if(Ct.has(t))return!1;let{key:e,fromUrl:n,raw:r}=z(t);if(!e)return n?(Ct.add(t),Y(t,"not-found"),$("product-not-found",{key:null,source:r},t)):t.closest(ut())||U(`[${g("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t),!1;Ct.add(t),ft.add(t);let i={};nn.set(t,i);let s=()=>nn.get(t)===i;it.get(t)?t.setAttribute(g("state"),"updating"):Y(t,"loading");let a=nt(e);return Q?.add(a),a.then(c=>{if(!s())return;let u=it.get(t);u?u.update(c):new St(t,c),Sn(t,c),o.revalidate!==!1&&pe(e)&&En(e)}).catch(c=>{if(!s())return;let u=ht(c);Y(t,u?"not-found":"error",c),u?($("product-not-found",{key:e,source:r},t),n?O(`product not found: ${e}`):P(c,`product ${e}`)):(P(c,`product ${e}`),$("error",{error:c,context:"product",key:e},t))}),!0}function Sn(t,e){let n=p(t,"page-title");!n||typeof document>"u"||(document.title=n.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function qe(){Jt(),ft.forEach(t=>{t.getAttribute(g("state"))!=="error"||t.getAttribute(g("error"))==="not-found"||(Ct.delete(t),zt(t))})}var Gt=new Set;function En(t){Gt.size||setTimeout(Cn,0),Gt.add(t)}function Cn(){let t=[...Gt];Gt=new Set,he(t).forEach((e,n)=>e.then(r=>{ft.forEach(i=>{let s=it.get(i);if(!s||!i.isConnected)return;let a=z(i).key;a!==t[n]&&a!==r.handle&&a!==r.id||JSON.stringify(s.product)!==JSON.stringify(r)&&s.update(r)})}).catch(r=>P(r,`refresh ${t[n]}`)))}var rn=new WeakSet,Q=null,Oe=t=>(Q?.add(t),t);function Yt(){if(!Q)return;let t=[...Q];Promise.allSettled(t).then(()=>{!Q||t.some(e=>!Q.has(e))||(t.length===Q.size?(Q=null,document.documentElement.classList.remove(`${o.prefix}-market-pending`)):Yt())})}function Ne(t=document){x(t.ownerDocument||t,'script[type="application/json"][data-tether-hydrate]').forEach(e=>{if(!rn.has(e)){rn.add(e);try{let n=JSON.parse(e.textContent);Ht(n.products);let r=(i,s)=>String(i||"").toUpperCase()===String(s||"").toUpperCase();r(n.country,o.country)&&r(n.language,o.language)?de(n.products):(O("hydration skipped: other market"),Q||(Q=new Set,document.documentElement.classList.add(`${o.prefix}-market-pending`)))}catch(n){U("bad data-tether-hydrate",n)}}})}var{cfg:kn}=Lt,Xt={"config.js":Lt,"client.js":ie,"dom.js":Pe,"fragments.js":ae,"loader.js":fe,"selling-plans.js":xt,"status.js":Ie,"cart.js":Ce,"product.js":Te,"collection.js":Le,"mounting.js":_e},Fe=typeof document<"u"&&document.currentScript?.src||"",kt={};function q(t){if(kt[t])return kt[t];let e=kn.partsUrl||Fe.replace(/[^/]*$/,""),n=/\.min\.js(\?|$)/.test(Fe)||!Fe?".min":"",r=`${e.replace(/\/?$/,"/")}tether.${t}${n}.js`;return kt[t]=new Promise((i,s)=>{let a=document.createElement("script");a.src=r,a.async=!0,a.onload=()=>window.Tether?.__parts?.[t]?i(window.Tether.__parts[t]):s(new Error(`${r} did not register`)),a.onerror=()=>{delete kt[t],s(new Error(`Could not load ${r}. Host it next to the Tether script, or set partsUrl.`))},document.head.appendChild(a)}),kt[t]}Xt["lazy.js"]={loadPart:q,coreModules:Xt};var sn="0.6.6",st=null,De=null;function pt(t=document){if(!Tt())return 0;let e=0;return Jt(),Ne(t),dt(t,ut()).forEach(n=>{if(Wt.has(n))return;Wt.add(n),e++;let r=new Et(n);mt.add(r),n.addEventListener(`${o.prefix}:list-rendered`,i=>pt(i.detail.container)),Oe(r.load())}),dt(t,l("product")).forEach(n=>{zt(n)&&e++}),dt(t,`${l("country-select")},${l("country-bind")}`).length&&q("markets").then(n=>n.renderCountrySelects(t)).catch(n=>P(n,"markets")),(o.account?.clientId||o.account?.server)&&(dt(t,["account-login","account-bind","account-link","orders","order","addresses","subscriptions","profile-form","address-form"].map(n=>`[${g(n)}]`).join(",")+`,[${g("show")}^="logged-"]`).length||/[?&]code=/.test(window.location.search)||qn())&&q("account").then(n=>n.mountAccount(t)).catch(n=>P(n,"account")),dt(t,l("search")).length&&q("search").then(n=>n.mountSearch(t)).catch(n=>P(n,"search")),Yt(),A.render(),O(`mounted ${e} scope(s)`,t),e}function cn(){A.close()}function In(t){let e=t?.closest?.(l("product"));return e&&it.get(e)||null}var an=!1;function Tn(){an||(an=!0,document.addEventListener("click",t=>{let e=t.target;if(!e?.closest)return;if(e.closest(l("cart-open"))){t.preventDefault(),A.toggle();return}if(e.closest(l("cart-close"))){t.preventDefault(),A.close();return}let n=e.closest(l("cart-clear"));if(n){t.preventDefault(),K(n,()=>A.clear().catch(c=>P(c,"cart clear")));return}let r=e.closest(l("checkout"));if(r){t.preventDefault(),K(r,()=>A.checkout());return}let i=e.closest(on());if(i&&i.closest(l("cart-lines"))){let c=i.getAttribute(`data-${o.prefix}-key`),u=A.lines.find(h=>h.id===c),f=h=>{t.preventDefault(),h().catch(m=>P(m,"cart line"))};if(e.closest(l("line-remove")))return i.classList.add("is-busy"),f(()=>A.removeLine(c));if(u&&e.closest(l("line-plus")))return f(()=>A.changeQuantity(c,1));if(u&&e.closest(l("line-minus")))return f(()=>A.changeQuantity(c,-1))}let s=e.closest(l("discount-remove"));if(s){t.preventDefault();let c=s.closest(l("discount-code"))?.getAttribute(g("discount-code"));c&&A.removeDiscount(c).catch(u=>P(u,"discount"));return}let a=e.closest(l("group-add"));a&&(t.preventDefault(),K(a,()=>ln(a)))}),document.addEventListener("change",t=>{let e=t.target;if(!e?.closest)return;let n=e.closest(on()),r=n?.getAttribute(`data-${o.prefix}-key`),i=(s,a)=>{n.classList.add("is-busy"),n.setAttribute("aria-busy","true"),s.catch(c=>P(c,a))};r&&e.matches(`input${l("line","quantity")}`)?i(A.updateLine(r,parseInt(e.value,10)||0),"cart line"):r&&e.matches(`select${l("line-plan")}`)?i(A.updateLine(r,{sellingPlanId:e.value||null}),"cart line plan"):e.matches(`select${l("country-select")}`)?e.value&&Me(e.value).catch(s=>P(s,"country")):e.matches(l("cart-note"))&&A.setNote(e.value).catch(s=>P(s,"cart note"))}),document.addEventListener("submit",t=>{let e=t.target.closest?.(l("discount-form"));if(!e)return;t.preventDefault();let n=e.querySelector(l("discount-input"))||e.querySelector("input"),r=n?.value.trim();r&&K(e,async()=>{let i=s=>{e.classList.toggle("is-invalid",s),n&&(s?n.setAttribute("aria-invalid","true"):n.removeAttribute("aria-invalid"))};try{await A.applyDiscount(r),i(!1),$("discount-applied",{code:r},e),n&&(n.value="")}catch(s){i(!0),s?.code==="INVALID_DISCOUNT"?$("discount-invalid",{code:r},e):P(s,"discount")}})},!0),document.addEventListener("input",t=>{let e=t.target.closest?.(l("discount-form"));e&&(e.classList.remove("is-invalid"),t.target.removeAttribute?.("aria-invalid"))}),window.addEventListener("storage",t=>{o.domain&&t.key?.startsWith(`${o.prefix}:`)&&q("extras").then(e=>e.onStorage(t)).catch(()=>{})}),document.addEventListener(`${o.prefix}:variant-changed`,t=>{let e=t.target;(o.variantUrl||e.hasAttribute?.(g("variant-url")))&&q("extras").then(n=>n.writeVariantUrl(e,t.detail)).catch(()=>{})}),o.astro!==!1&&(document.addEventListener("astro:page-load",()=>(st||Promise.resolve()).then(()=>{let t=Ue();if(!t&&je){try{t=JSON.parse(localStorage.getItem(`${o.prefix}:market:${o.domain}`)||"null")}catch{t=null}t=t?.country?t:dn}je=!!Ue(),t?.country&&(String(t.country).toUpperCase()!==String(o.country||"").toUpperCase()||String(t.language||"").toUpperCase()!==String(o.language||"").toUpperCase())?Me(t.country,{language:t.language??null,locale:t.locale,remember:!1}).then(()=>pt(document),()=>pt(document)):pt(document)})),document.addEventListener("astro:before-swap",()=>cn())),window.addEventListener("online",()=>{qe(),mt.forEach(t=>{t.root.getAttribute(g("state"))==="error"&&t.load()})}),document.addEventListener("keydown",t=>{if(!A.isOpen())return;if(t.key==="Escape"){A.close();return}if(t.key!=="Tab"||o.cartFocus===!1)return;let e=A.drawers().find(s=>s.classList.contains(o.cartDrawerOpenClass)),n=e?Rt(e):[];if(!n.length)return;let r=n[0],i=n[n.length-1];(!e.contains(document.activeElement)||t.shiftKey&&document.activeElement===r||!t.shiftKey&&document.activeElement===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}))}function on(){return`[data-${o.prefix}-key]`}var ln=t=>q("extras").then(e=>e.addGroup(t)),It=null;function un(t={}){return st&&!Object.keys(t).length?st:(te({...window.TETHER_CONFIG||{},...t}),Tt()?(Tn(),o.observe&&Nn(),o.analytics&&!It&&(It=[],["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"].forEach(e=>document.addEventListener(`${o.prefix}:${e}`,n=>It.push(n))),document.addEventListener("astro:page-load",()=>It.push(new CustomEvent(`${o.prefix}:page`))),q("analytics").then(e=>e.startAnalytics(It)).catch(e=>P(e,"analytics"))),st=Ln(t).then(()=>A.init()).then(async e=>{let n=o.country?String(o.country).toUpperCase():null;if(e&&n&&e.buyerIdentity?.countryCode&&e.buyerIdentity.countryCode!==n)try{e=await A.setBuyerIdentity({countryCode:n},{create:!1})}catch(r){P(r,"cart country")}return $("ready",{cart:e}),Ve}),st):(U("TETHER_CONFIG is missing domain or token. Tether is idle."),st=Promise.resolve(null),st))}function Ue(t=document){let e=r=>t.querySelector(`meta[name="${o.prefix}-page-${r}"]`)?.getAttribute("content")||void 0,n=e("country");return n?{country:n.toUpperCase(),language:e("language"),locale:e("locale")}:null}var dn=null,je=!1;async function Ln(t){let e=o.markets||{};dn={country:o.country,language:o.language,locale:o.locale};let n=Ue();if(je=!!n,n){o.country=n.country,o.language=n.language?n.language.toUpperCase():void 0,n.locale&&(o.locale=n.locale);return}if(e.detect===!1)return;let r=null;if(e.detect)try{r=(await q("markets")).detectMarket(e)}catch(i){P(i,"markets");return}else if(e.remember!==!1){try{r=JSON.parse(localStorage.getItem(`${o.prefix}:market:${o.domain}`)||"null")}catch{}r&&!/^[A-Z]{2}$/.test(r.country||"")&&(r=null)}r&&(r.country&&(o.country=r.country),r.language&&(o.language=r.language),r.locale&&!t.locale&&(o.locale=r.locale),O("market",r))}function qn(){try{return!!(sessionStorage[`${o.prefix}:account:${o.domain}`]||localStorage[`${o.prefix}:account:${o.domain}`]||localStorage[`${o.prefix}:account-hint:${o.domain}`])}catch{return!1}}var On=new Proxy({},{get:(t,e)=>(...n)=>q("account").then(r=>r[e](...n))});function Me(t,e){return q("markets").then(n=>n.setCountry(t,e))}function Nn(){if(De||typeof MutationObserver>"u")return;let t=null,e=new Set;De=new MutationObserver(n=>{n.forEach(r=>r.addedNodes.forEach(i=>{i.nodeType===1&&e.add(i)})),clearTimeout(t),t=setTimeout(()=>{e.forEach(r=>{r.isConnected&&pt(r)}),e.clear()},50)}),De.observe(document.body,{childList:!0,subtree:!0})}var Ve={VERSION:sn,init:un,mount:pt,unmount:cn,get config(){return o},get ready(){return st||Promise.resolve(null)},query:_,withContext:Ot,cart:A,getProduct:nt,getProducts:vt,getRecommendations:bt,getScope:In,addGroup:ln,account:On,primeProduct:et,normalizeProductKey:ct,clearProductCache:ue,formatMoney:D,imageUrl:jt,plans:xt,TetherError:E,resolveProductKey:z,setCountry:Me,detectMarket:t=>q("markets").then(e=>e.detectMarket(t||o.markets)),getLocalization:()=>q("markets").then(t=>t.getLocalization()),diagnose:t=>q("diagnose").then(e=>e.diagnose({...t,version:sn})),__core:Xt,__parts:{},on(t,e){let n=r=>e(r.detail,r);return document.addEventListener(`${o.prefix}:${t}`,n),()=>document.removeEventListener(`${o.prefix}:${t}`,n)}},Er=Ve;if(typeof window<"u"&&typeof document<"u"&&(window.Tether=Ve,window.TETHER_CONFIG&&window.TETHER_CONFIG.autoMount!==!1&&!window.TETHER_INTEGRATION)){let e=()=>un().then(()=>pt(document));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}})();
5
5
  //# sourceMappingURL=tether.min.js.map