@occluze/tether 0.5.0 → 0.6.0
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.
- package/README.md +9 -7
- package/dist/esm/astro.js +1 -1
- package/dist/esm/chunks/account-WAWNASZU.js +1 -0
- package/dist/esm/chunks/analytics-22NMIVBV.js +1 -0
- package/dist/esm/chunks/chunk-4UR45XTC.js +1 -0
- package/dist/esm/chunks/chunk-6R752OYZ.js +1 -0
- package/dist/esm/chunks/chunk-BGIKQY6H.js +1 -0
- package/dist/esm/chunks/chunk-CISGFYOF.js +1 -0
- package/dist/esm/chunks/chunk-KARKXC6G.js +1 -0
- package/dist/esm/chunks/chunk-YXCXIPQV.js +4 -0
- package/dist/esm/chunks/{chunk-RBVRRQIU.js → chunk-YZMBXS6Y.js} +1 -1
- package/dist/esm/chunks/chunk-ZVUPVSLF.js +1 -0
- package/dist/esm/chunks/diagnose-6ZSK5DGE.js +1 -0
- package/dist/esm/chunks/extras-QDCSW6VU.js +1 -0
- package/dist/esm/chunks/markets-ui-HJCVLCKJ.js +1 -0
- package/dist/esm/chunks/search-LN2H6SXS.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/server.js +1 -1
- package/dist/tether.account.js +374 -0
- package/dist/tether.account.min.js +1 -0
- package/dist/tether.analytics.js +259 -0
- package/dist/tether.analytics.min.js +1 -0
- package/dist/tether.diagnose.js +11 -2
- package/dist/tether.diagnose.min.js +1 -1
- package/dist/tether.extras.js +87 -0
- package/dist/tether.extras.min.js +1 -0
- package/dist/tether.js +268 -75
- package/dist/tether.markets.js +3 -3
- package/dist/tether.markets.min.js +1 -1
- package/dist/tether.min.js +3 -3
- package/dist/tether.min.js.map +3 -3
- package/dist/tether.search.js +176 -0
- package/dist/tether.search.min.js +1 -0
- package/package.json +5 -2
- package/src/account.js +313 -0
- package/src/analytics.js +232 -0
- package/src/astro.js +4 -1
- package/src/cart.js +74 -11
- package/src/client.js +8 -3
- package/src/collection.js +15 -10
- package/src/config.js +3 -0
- package/src/diagnose.js +11 -2
- package/src/dom.js +7 -1
- package/src/extras.js +63 -0
- package/src/fragments.js +1 -1
- package/src/index.js +103 -41
- package/src/initial.js +13 -4
- package/src/lazy.js +9 -1
- package/src/loader.js +4 -1
- package/src/markets-ui.js +2 -1
- package/src/mounting.js +27 -2
- package/src/parts/account.js +3 -0
- package/src/parts/analytics.js +3 -0
- package/src/parts/extras.js +3 -0
- package/src/parts/search.js +3 -0
- package/src/product.js +19 -5
- package/src/search.js +153 -0
- package/src/server.js +78 -6
- package/src/status.js +2 -2
- package/types/index.d.ts +56 -3
- package/types/server.d.ts +10 -2
- package/dist/esm/chunks/chunk-HHMOPDZG.js +0 -1
- package/dist/esm/chunks/chunk-HXKV6QGB.js +0 -4
- package/dist/esm/chunks/chunk-RNZMTQTX.js +0 -1
- package/dist/esm/chunks/diagnose-J667GHGS.js +0 -1
- package/dist/esm/chunks/markets-ui-EGWIEUOZ.js +0 -1
package/dist/tether.markets.js
CHANGED
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
|
|
37
37
|
// tether-core:dom.js
|
|
38
38
|
var m6 = window.Tether.__core["dom.js"];
|
|
39
|
-
var { attr, busy, cdnUrl, dataKey, emit, formatDate, formatMoney, get, has, hasTemplate, imageUrl, notifyLayoutChanged, parseJSONAttr, productUrl, qsa, readText, repeat, repeatKeyed, sameImage, scoped, sel, setImage, setSelected, setText, setTextTracked, show, toAttributes, watchImages } = m6;
|
|
39
|
+
var { attr, busy, cdnUrl, dataKey, emit, formatDate, formatMoney, formatPercent, get, has, hasTemplate, imageUrl, notifyLayoutChanged, parseJSONAttr, productUrl, qsa, readText, repeat, repeatKeyed, sameImage, scoped, sel, setImage, setSelected, setText, setTextTracked, show, toAttributes, watchImages } = m6;
|
|
40
40
|
|
|
41
41
|
// tether-core:mounting.js
|
|
42
42
|
var m7 = window.Tether.__core["mounting.js"];
|
|
43
|
-
var { hydrateFromPage, liveLists, liveProducts, mountProduct, mountedLists, mountedProducts, pruneLive, retryFailed, within } = m7;
|
|
43
|
+
var { hydrateFromPage, liveLists, liveProducts, mountProduct, mountedLists, mountedProducts, pruneLive, retryFailed, settleMarket, trackMarket, within } = m7;
|
|
44
44
|
|
|
45
45
|
// src/markets.js
|
|
46
46
|
var COUNTRY = /^[A-Z]{2}$/;
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
const entry = Object.values(cfg.markets?.locales || {}).find((m8) => toCountry(m8?.country) === country);
|
|
182
182
|
const own = locale || entry?.locale;
|
|
183
183
|
const loc = own || cfg.locale;
|
|
184
|
-
const lang = language
|
|
184
|
+
const lang = language !== void 0 ? toLanguage(language) : entry ? entry.language ? toLanguage(entry.language) : void 0 : cfg.language;
|
|
185
185
|
const changed = country !== String(cfg.country || "").toUpperCase() || lang !== cfg.language || loc !== cfg.locale;
|
|
186
186
|
cfg.country = country;
|
|
187
187
|
cfg.language = lang || void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var G=Object.defineProperty;var H=(e,t)=>{for(var r in t)G(e,r,{get:t[r],enumerable:!0})};var P={};H(P,{detectMarket:()
|
|
1
|
+
(()=>{var G=Object.defineProperty;var H=(e,t)=>{for(var r in t)G(e,r,{get:t[r],enumerable:!0})};var P={};H(P,{detectMarket:()=>M,getLocalization:()=>C,renderCountrySelects:()=>x,setCountry:()=>oe});var K=window.Tether.__core["config.js"],{DEFAULTS:ne,cfg:a,configure:ce,isConfigured:ae,log:le,reportError:b,warn:se}=K;var Z=window.Tether.__core["client.js"],{TetherError:E,endpoint:ue,gql:S,request:de,unwrap:me,withContext:fe}=Z;var D=window.Tether.__core["cart.js"],{Cart:f,focusables:pe,toLineInput:ye}=D;var F=window.Tether.__core["collection.js"],{ListScope:we,listSelector:A}=F;var J=window.Tether.__core["loader.js"],{clearProductCache:v,getProduct:be,getProducts:Te,getRecommendations:_e,hydrateProducts:Le,normalizeProductKey:xe,primeProduct:Pe,refreshProducts:Ee,takeStale:Se}=J;var Y=window.Tether.__core["dom.js"],{attr:y,busy:ve,cdnUrl:Ue,dataKey:ke,emit:U,formatDate:Ie,formatMoney:Ne,formatPercent:je,get:k,has:Oe,hasTemplate:ze,imageUrl:Re,notifyLayoutChanged:Me,parseJSONAttr:$e,productUrl:qe,qsa:Be,readText:Ge,repeat:He,repeatKeyed:Ke,sameImage:Ze,scoped:De,sel:T,setImage:Fe,setSelected:Je,setText:Ye,setTextTracked:We,show:Xe,toAttributes:Ve,watchImages:Qe}=Y;var W=window.Tether.__core["mounting.js"],{hydrateFromPage:tt,liveLists:I,liveProducts:N,mountProduct:j,mountedLists:ot,mountedProducts:O,pruneLive:z,retryFailed:rt,settleMarket:nt,trackMarket:ct,within:_}=W;var X=/^[A-Z]{2}$/,V=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),R=()=>`${a.prefix}:market:${a.domain}`,Q=()=>({document:typeof document<"u"?document:null,location:typeof window<"u"?window.location:null,storage:(()=>{try{return window.localStorage}catch{return null}})(),global:typeof window<"u"?window:{}});function h(e){let t=String(e||"").trim().toUpperCase();return X.test(t)&&t!=="XX"&&t!=="T1"?t:null}function w(e){let t=String(e||"").trim().replace("-","_").toUpperCase();if(!t)return null;if(V.has(t))return t;let r=t.split("_")[0];return/^[A-Z]{2,3}$/.test(r)?r:null}function ee(e,t){if(!e||!t)return null;let r=String(e.cookie||"").split(";").map(c=>c.trim()).find(c=>c.startsWith(`${t}=`));return r?decodeURIComponent(r.slice(t.length+1)):null}var L=(e,t)=>{if(!e||!t)return null;let r=String(t).toLowerCase(),c=Object.keys(e).find(o=>o.toLowerCase()===r);return c?e[c]:null},te={saved(e,t){if(e.remember===!1||!t.storage)return null;try{return JSON.parse(t.storage.getItem(R())||"null")}catch{return null}},server(e,t){let r=l=>t.document?.querySelector?.(`meta[name="${l}"]`)?.getAttribute("content"),c=t.global.TETHER_COUNTRY||r("tether-country")||ee(t.document,e.cookie||"tether_country"),o=t.global.TETHER_LANGUAGE||r("tether-language");return{country:c,language:o}},webflow(e,t){let r=(t.location?.pathname||"/").split("/").filter(Boolean)[0],c=L(e.locales,r);if(c)return c;let o=t.document?.documentElement?.getAttribute("lang");if(!o)return null;let l=L(e.locales,o)||L(e.locales,o.split("-")[0]);if(l)return{locale:o,...l};if(e.locales&&e.strict)return null;let s=o.split("-")[1];return{language:o,country:s&&s.length===2?s:null,locale:o}}};function M(e=a.markets,t=Q()){let r=e||{};if(r.detect===!1)return{};let c=r.detect?r.detect===!0?["saved","server","webflow"]:[].concat(r.detect):["saved"];e=r;let o={sources:{}};return c.forEach(l=>{let s=te[l]?.(e,t);if(!s)return;let m={country:h(s.country),language:w(s.language),locale:s.locale||null};Object.entries(m).forEach(([n,i])=>{i&&!o[n]&&(o[n]=i,o.sources[n]=l)})}),o}function $(e){if(a.markets?.remember!==!1)try{localStorage.setItem(R(),JSON.stringify({country:e.country,language:e.language||void 0,locale:e.locale||void 0}))}catch{}}var g=null;function q(){g=null}function C(){return g||(g=S("query TetherLocalization{localization{country{isoCode name currency{isoCode symbol}}language{isoCode name}availableCountries{isoCode name currency{isoCode symbol}availableLanguages{isoCode name}}}}").then(e=>e.localization).catch(e=>{throw g=null,e})),g}function x(e=document){let t=_(e,`select${T("country-select")}`),r=_(e,T("country-bind"));return!t.length&&!r.length?Promise.resolve():C().then(c=>{let o=(a.country||c.country?.isoCode||"").toUpperCase(),l=[...c.availableCountries||[]].sort((n,i)=>n.name.localeCompare(i.name,a.locale||void 0)),s=l.find(n=>n.isoCode===o)||c.country,m=(n,i)=>n.replace(/\{name\}/g,i.name).replace(/\{code\}/g,i.isoCode).replace(/\{currency\}/g,i.currency?.isoCode||"").replace(/\{symbol\}/g,i.currency?.symbol||"");t.forEach(n=>{let i=n.getAttribute(y("country-label"))||"{name} ({currency})",d=(n.getAttribute(y("countries"))||"").toUpperCase().split(/[\s,]+/).filter(Boolean),u=d.length?d.map(p=>l.find(B=>B.isoCode===p)).filter(Boolean):l;n.innerHTML="",u.forEach(p=>n.appendChild(new Option(m(i,p),p.isoCode))),n.value=o,n.value!==o&&(n.selectedIndex=-1),n.disabled=u.length<2&&!n.hasAttribute(y("always-enabled"))}),r.forEach(n=>{let i=k(n,"country-bind")||"name",d={name:s?.name,code:s?.isoCode,currency:s?.currency?.isoCode,symbol:s?.currency?.symbol}[i];n.textContent=d||""})}).catch(c=>b(c,"country select"))}async function oe(e,{language:t,locale:r,remember:c=!0}={}){let o=h(e);if(!o)throw new E(`Not a country code: ${e}`,{code:"INVALID_COUNTRY"});let l=Object.values(a.markets?.locales||{}).find(u=>h(u?.country)===o),s=r||l?.locale,m=s||a.locale,n=t!==void 0?w(t):l?l.language?w(l.language):void 0:a.language,i=o!==String(a.country||"").toUpperCase()||n!==a.language||m!==a.locale;if(a.country=o,a.language=n||void 0,a.locale=m,c&&$({country:o,language:n,locale:s}),!i)return x(),f.state;v();let d=[];return t!==void 0&&q(),f.id()&&d.push(f.setBuyerIdentity({countryCode:o},{create:!1}).catch(u=>b(u,"cart country"))),z(),I.forEach(u=>d.push(u.load())),N.forEach(u=>{u.closest(A())||(O.delete(u),j(u))}),x(),U("country-changed",{country:o,language:a.language}),await Promise.all(d),f.state}window.Tether.__parts.markets=P;})();
|
package/dist/tether.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var hn=Object.defineProperty;var M=(t,e)=>{for(var n in e)hn(t,n,{get:e[n],enumerable:!0})};var Lt={};M(Lt,{DEFAULTS:()=>Xt,cfg:()=>a,configure:()=>Zt,isConfigured:()=>Tt,log:()=>L,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},a={...Xt};function Zt(t={}){return Object.keys(a).forEach(e=>delete a[e]),Object.assign(a,Xt,t),a.domain&&(a.domain=String(a.domain).replace(/^https?:\/\//,"").replace(/\/.*$/,"")),a.storageKey||(a.storageKey=`${a.prefix}:cart:${a.domain}`),a.apiVersion==="unstable"&&U('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),a}var Tt=()=>!!(a.domain&&a.token);function L(...t){a.debug&&console.log(`[${a.prefix}]`,...t)}function U(...t){console.warn(`[${a.prefix}]`,...t)}function P(t,e){if(U(e,t&&t.message?t.message:t),typeof a.onError=="function")try{a.onError(t,e)}catch{}}var ne={};M(ne,{TetherError:()=>E,endpoint:()=>Re,gql:()=>F,request:()=>qt,unwrap:()=>ee,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 Re(t=a){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}function Ot(t,e=a){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));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 o=JSON.stringify({query:i,variables:n}),c=0;for(;;){let u;try{u=await(t.fetch||fetch)(Re(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:o})}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){L("retry",u.status,c),await te(300*2**c);continue}let h;try{h=await u.json()}catch{throw new E(`Invalid response (${u.status})`,{status:u.status})}if(h.errors?.length){if(h.errors.some(y=>/quantityAvailable/.test(y.message||""))&&/\bquantityAvailable\b/.test(o))return L("no inventory permission, retrying without quantityAvailable"),qt(t,e.replace(/\bquantityAvailable\b/g,""),n,{context:r});if(h.errors.some(y=>/'warnings'/.test(y.message||""))&&/warnings \{ code message target \}/.test(e))return qt(t,e.replace(/ warnings \{ code message target \}/g,""),n,{context:r});if(h.errors.some(y=>y.extensions?.code==="THROTTLED")&&c++<t.retries){await te(500*2**c);continue}throw new E(h.errors.map(y=>y.message).join(" | "),{status:u.status,errors:h.errors})}if(!u.ok)throw new E(`HTTP ${u.status}`,{status:u.status});return h.data}}var F=(t,e,n)=>qt(a,t,e,n);function ee(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 Se={};M(Se,{Cart:()=>A,focusables:()=>Rt,toLineInput:()=>Xe});var ie={};M(ie,{ALLOCATION_FIELDS:()=>Qe,SELLING_PLAN_FIELDS:()=>Be,cartFragment:()=>Nt,collectionFields:()=>re,metafieldIdentifiers:()=>Ke,productFragment:()=>gt});var x="amount currencyCode",tt="url altText width height";function Ke(t=a){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 fn(t=a){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 Be=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${x}}}... on SellingPlanFixedPriceAdjustment{price{${x}}}}}`,Qe=` sellingPlan{id}checkoutChargeAmount{${x}}remainingBalanceChargeAmount{${x}}priceAdjustments{price{${x}}compareAtPrice{${x}}perDeliveryPrice{${x}}unitPrice{${x}}}`;function gt(t=a){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}}}${fn(t)} sellingPlanGroups(first:${t.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${t.sellingPlansFirst}){nodes{${Be}}}}}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{${Qe}}}}}}`}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 re(){return`
|
|
2
2
|
id handle title description descriptionHtml
|
|
3
|
-
image { ${
|
|
4
|
-
seo { title description }`}var le={};F(le,{clearProductCache:()=>se,getProduct:()=>U,getProducts:()=>pt,getRecommendations:()=>ht,hydrateProducts:()=>oe,normalizeProductKey:()=>rt,primeProduct:()=>Y,refreshProducts:()=>ce,takeStale:()=>ae});var _=new Map,De=[],re=new Map,ne=!1,dt=0,ie=t=>typeof t=="string"&&t.startsWith("gid://");function rt(t){let e=String(t??"").trim();if(!e)return null;if(ie(e))return e;if(/^\d+$/.test(e))return`gid://shopify/Product/${e}`;let r=e.match(/\/products\/([^/?#]+)/);return r?r[1]:e}function Y(t){if(!t)return;let e=Promise.resolve(t);_.set(t.handle,e),_.set(t.id,e)}function U(t){let e=rt(t);if(!e)return Promise.reject(new I("empty product key",{code:"NOT_FOUND"}));if(_.has(e))return _.get(e);let r=new Promise((n,i)=>{re.set(e,{resolve:n,reject:i}),De.push(e),ne||(ne=!0,setTimeout(ir,0))});return _.set(e,r),r}async function ir(){ne=!1;let t=dt,e=De.splice(0);if(!e.length)return;let r=e.filter(ie),n=e.filter(f=>!ie(f)),i=[],s=[],o={};r.length&&(i.push("$ids: [ID!]!"),o.ids=r,s.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),n.forEach((f,m)=>{i.push(`$h${m}: String!`),o[`h${m}`]=f,s.push(`h${m}: product(handle: $h${m}) { ...TetherProduct }`)});let l=`query TetherProducts(${i.join(",")}){${s.join(" ")}}${ut()}`;T("fetch products",e);let p=(f,m)=>{let h=re.get(f);re.delete(f),h&&m(h)};try{let f=await q(l,o),m=new Map;(f.byId||[]).forEach(h=>{h&&m.set(h.id,h)}),n.forEach((h,C)=>{f[`h${C}`]&&m.set(h,f[`h${C}`])}),e.forEach(h=>p(h,C=>{if(m.has(h)){let A=m.get(h);t===dt&&(Y(A),qt.set(A.handle,Date.now()),qt.set(A.id,Date.now())),C.resolve(A)}else t===dt&&_.delete(h),C.reject(new I(`Product not found: ${h}`,{code:"NOT_FOUND"}))}))}catch(f){e.forEach(m=>p(m,h=>{t===dt&&_.delete(m),h.reject(f)}))}}function se(){_.clear(),dt++,et.clear(),qt.clear()}var et=new Set,qt=new Map,sr=6e4;function oe(t){(t||[]).forEach(e=>{!e?.id||!e.handle||Date.now()-(qt.get(e.handle)||0)<sr&&_.has(e.handle)||(Y(e),et.add(e.handle),et.add(e.id))})}function ae(t){let e=rt(t);if(!et.has(e))return!1;let r=_.get(e);return et.delete(e),r?.then?.(n=>{et.delete(n.handle),et.delete(n.id)}),!0}function ce(t){return t.forEach(e=>_.delete(rt(e))),t.map(e=>U(e))}async function pt({collection:t,query:e,first:r=c.collectionFirst,after:n=null,sortKey:i,reverse:s=!1,filters:o}={}){let l=ut();if(t){let f=await q(`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${te()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}${l}`,{handle:t,first:r,after:n,sortKey:i||void 0,reverse:s,filters:o||void 0});if(!f.collection)throw new I(`Collection not found: ${t}`,{code:"NOT_FOUND"});let{products:m,...h}=f.collection;return m.nodes.forEach(Y),{collection:h,products:m.nodes,pageInfo:m.pageInfo}}let p=await q(`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}}}${l}`,{first:r,after:n,query:e||void 0,sortKey:i||void 0,reverse:s});return p.products.nodes.forEach(Y),{collection:null,products:p.products.nodes,pageInfo:p.products.pageInfo}}async function ht(t,e="RELATED"){let r=rt(typeof t=="object"?t?.id:t),n=r?.startsWith("gid://"),s=(await q(`query TetherRecs(${n?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${n?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}${ut()}`,n?{id:r,intent:e}:{handle:r,intent:e})).productRecommendations||[];return s.forEach(Y),s}var gt={};F(gt,{GID:()=>M,allPlans:()=>K,allocationFor:()=>D,findPlan:()=>mt,hasPlans:()=>or,planAdjustment:()=>de,planCheckoutCharge:()=>ue,planPrice:()=>ft,planSavings:()=>Nt,plansForVariant:()=>ar,toGid:()=>Ot});var M={product:t=>Ot(t,"Product"),variant:t=>Ot(t,"ProductVariant"),sellingPlan:t=>Ot(t,"SellingPlan")};function Ot(t,e){let r=String(t??"").trim();return r?r.startsWith("gid://")?r:/^\d+$/.test(r)?`gid://shopify/${e}/${r}`:r:null}function K(t){return(t?.sellingPlanGroups?.nodes||[]).flatMap(r=>(r.sellingPlans?.nodes||[]).map(n=>({...n,group:r})))}function or(t){return K(t).length>0}function D(t,e){return!t||!e?null:(t.sellingPlanAllocations?.nodes||[]).find(r=>r.sellingPlan?.id===e)||null}function ar(t,e){return K(t).filter(r=>D(e,r.id))}function ft(t,e){let n=D(t,e)?.priceAdjustments?.[0];return n?.perDeliveryPrice||n?.price||t?.price||null}function ue(t,e){let r=D(t,e);return r?.checkoutChargeAmount||r?.priceAdjustments?.[0]?.price||t?.price||null}function Nt(t,e){let r=parseFloat(t?.price?.amount),n=parseFloat(ft(t,e)?.amount);return!Number.isFinite(r)||!Number.isFinite(n)||r<=0||n>=r?{amount:null,percentage:0}:{amount:{amount:(r-n).toFixed(2),currencyCode:t.price.currencyCode},percentage:Math.round((1-n/r)*100)}}function de(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 mt(t,e){if(!e)return null;let r=K(t),n=M.sellingPlan(e),i=String(e).trim().toLowerCase();return r.find(s=>s.id===n)||r.find(s=>s.name.toLowerCase()===i)||r.find(s=>(s.options||[]).some(o=>String(o.value).toLowerCase()===i))||null}var ye={};F(ye,{attr:()=>y,busy:()=>R,cdnUrl:()=>Me,dataKey:()=>Ue,emit:()=>$,formatDate:()=>he,formatMoney:()=>O,get:()=>d,has:()=>X,hasTemplate:()=>fe,imageUrl:()=>_t,notifyLayoutChanged:()=>B,parseJSONAttr:()=>vt,productUrl:()=>yt,qsa:()=>v,readText:()=>pe,repeat:()=>V,repeatKeyed:()=>me,sameImage:()=>Dt,scoped:()=>Z,sel:()=>a,setImage:()=>N,setSelected:()=>bt,setText:()=>E,setTextTracked:()=>tt,show:()=>j,toAttributes:()=>H,watchImages:()=>ge});var y=t=>`${c.prefix}-${t}`,a=(t,e)=>e===void 0?`[${y(t)}]`:`[${y(t)}="${e}"]`,d=(t,e)=>t.getAttribute(y(e)),X=(t,e)=>t.hasAttribute(y(e)),Ue=()=>`data-${c.prefix}-key`;function yt(t,e){let r=c.productPath||"/product";if(!/\{(handle|id)\}/.test(r))return`${r.replace(/\/$/,"")}/${t}`;let n=e?String(e).split("/").pop():"";return r.replace(/\{handle\}/g,encodeURIComponent(t||"")).replace(/\{id\}/g,encodeURIComponent(n))}var v=(t,e)=>t?[...t.querySelectorAll(e)]:[],Z=(t,e,r)=>v(t,e).filter(n=>n.closest(r)===t);function $(t,e,r=document){r.dispatchEvent(new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0}))}function O(t){if(!t)return"";if(typeof c.formatMoney=="function")return c.formatMoney(t,c.locale);let e=parseFloat(t.amount);if(Number.isNaN(e))return"";try{return new Intl.NumberFormat(c.locale||void 0,{style:"currency",currency:t.currencyCode}).format(e)}catch{return`${t.currencyCode} ${e.toFixed(2)}`}}function he(t){if(!t)return"";try{return new Date(t).toLocaleDateString(c.locale||void 0)}catch{return""}}function _t(t,{width:e,height:r,crop:n}={}){if(!t)return t;try{let i=new URL(t);return e&&i.searchParams.set("width",String(e)),r&&i.searchParams.set("height",String(r)),n&&i.searchParams.set("crop",n),i.toString()}catch{return t}}function Me(t,e){if(!t||!e)return t;let r=n=>e.getAttribute(n);return _t(t,{width:r("max-width"),height:r("max-height"),crop:r("max-width")||r("max-height")?r("crop"):null})}var Dt=(t,e)=>!!(t&&e)&&t.split("?")[0]===e.split("?")[0];function N(t,e,r){if(!e)return;let n=Me(e,t);if(t.tagName==="IMG"&&Dt(t.getAttribute("src"),n)){r!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",r);return}t.tagName==="IMG"?(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",n),r!=null&&t.setAttribute("alt",r),t.getAttribute("loading")||t.setAttribute("loading","lazy")):t.style.backgroundImage=`url("${n}")`}function E(t,e){let r=e==null?"":String(e);t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value=r:t.textContent=r}var pe=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.textContent;function tt(t,e){let r=pe(t);E(t,e);let n=pe(t);if(r!==n&&t.dataset.tetherSeen&&typeof c.onValueChange=="function")try{c.onValueChange(t,r)}catch{}t.dataset.tetherSeen="1"}function j(t,e){let r="tetherPrevDisplay";if(e){if(t.dataset.tetherShown!==void 0)return;t.dataset.tetherShown="",t.removeAttribute("hidden"),t.dataset[r]!==void 0?(t.style.display=t.dataset[r],delete t.dataset[r]):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(`${c.prefix}-display`)||"block")}else delete t.dataset.tetherShown,t.dataset[r]===void 0&&t.style.display!=="none"&&(t.dataset[r]=t.style.display||""),t.style.display="none"}function bt(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 r=t.querySelector?.('input[type="radio"],input[type="checkbox"]');r&&(r.checked=e)}var Ft=new WeakMap,fe=t=>!!Ft.get(t);function Ve(t){if(!Ft.has(t)){let e=t.firstElementChild?.cloneNode(!0)??null;Ft.set(t,e),t.innerHTML=""}return Ft.get(t)}function V(t,e,r){let n=Ve(t);if(!n){L("repeater without a template child",t);return}t.innerHTML="",e.forEach((i,s)=>{let o=n.cloneNode(!0);r(o,i,s),t.appendChild(o)})}function me(t,e,r,n,{onEnter:i,onLeave:s}={}){let o=Ve(t);if(!o){L("repeater without a template child",t);return}let l=Ue(),p=`data-${c.prefix}-leaving`,f=()=>[...t.children].filter(b=>b.hasAttribute(l)&&!b.hasAttribute(p)),m=new Map(f().map(b=>[b.getAttribute(l),b])),h=[],C=new Set;e.forEach((b,u)=>{let g=String(r(b,u)),S=m.get(g);S?m.delete(g):(S=o.cloneNode(!0),S.setAttribute(l,g),C.add(S)),n(S,b,u,C.has(S)),h.push(S)});let A=h.filter(b=>!C.has(b)),lt=f().filter(b=>A.includes(b));if(!(lt.length===A.length&<.every((b,u)=>b===A[u]))){m.forEach(b=>b.remove()),h.forEach(b=>t.appendChild(b));return}h.forEach((b,u)=>{if(!C.has(b))return;let g=h[u-1];if(g&&g.parentNode===t?g.after(b):t.prepend(b),i)try{i(b)}catch{}}),m.forEach(b=>{b.setAttribute(p,""),b.removeAttribute(l),b.style.pointerEvents="none",b.inert=!0;let u=()=>b.remove();if(s)try{s(b,u)}catch{u()}else u()})}var je=null;function B(t){clearTimeout(je),je=setTimeout(()=>{typeof c.onLayoutChange=="function"?c.onLayoutChange(t):window.ScrollTrigger?.refresh&&window.ScrollTrigger.refresh(),$("layout-changed",{reason:t})},120)}function ge(t,e){let r=v(t,"img").filter(s=>!s.complete);if(!r.length)return;let n=r.length,i=()=>{--n===0&&B(`${e}:images`)};r.forEach(s=>{s.addEventListener("load",i,{once:!0}),s.addEventListener("error",i,{once:!0})})}function R(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 vt(t,e){let r=t&&d(t,e);if(!r)return null;try{return JSON.parse(r)}catch{return L(`invalid JSON in ${y(e)}`,t),null}}function H(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,r])=>({key:e,value:String(r??"")})):[]}function Ke(t,e=1,r={}){let n=typeof t=="object"&&t!==null?t:{variantId:t,quantity:e,...r},i=M.variant(n.merchandiseId||n.variantId||n.id);if(!i)throw new I("add(): variantId is required");let s={merchandiseId:i,quantity:Math.max(1,parseInt(n.quantity??1,10)||1)},o=n.sellingPlanId||n.sellingPlan;o&&(s.sellingPlanId=M.sellingPlan(o));let l=H(n.attributes);return l.length&&(s.attributes=l),s}function Re(t,e,r){return`mutation Tether_${t}(${e}){${t}(${r}){cart{...TetherCart}userErrors{field message}warnings{code message}}}${Lt()}`}var cr='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',jt=null,Ut=t=>v(t,cr).filter(e=>e.offsetParent!==null||e===document.activeElement);function be(t){v(document,a("cart-open")).forEach(e=>e.setAttribute("aria-expanded",String(t))),v(document,a("cart-drawer")).forEach(e=>{e.hasAttribute("role")||e.setAttribute("role","dialog"),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")&&e.setAttribute("aria-label",d(e,"cart-label")||"Cart"),e.setAttribute("aria-modal",String(t)),e.classList.contains(c.cartDrawerOpenClass)||e.setAttribute("aria-hidden","true")})}var ve=t=>/does not exist|not found|invalid id/i.test(t?.message||""),P={state:null,_chain:Promise.resolve(),id(){try{return localStorage.getItem(c.storageKey)}catch{return null}},_setId(t){try{t?localStorage.setItem(c.storageKey,t):localStorage.removeItem(c.storageKey)}catch{}},get lines(){return this.state?.lines?.nodes||[]},get count(){return this.state?.totalQuantity||0},lastError:null,warnings:[],loaded:!1,_take(t,e){let r=Xt(t,e);return this.warnings=r.warnings||[],this.warnings.length&&$("cart-warning",{warnings:this.warnings}),r.cart},_queue(t){let e=this._chain.then(t,t).then(r=>(this.lastError&&(this.lastError=null,this.render()),r),r=>{throw this.lastError=r,this.render(),$("cart-error",{error:r}),r});return this._chain=e.catch(()=>{}),e},_commit(t,e){return this.state=t,t?.id&&this._setId(t.id),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;try{let e=await q(`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${Lt()}`,{id:t});e.cart?this.state=e.cart:(this._setId(null),this.state=null)}catch(e){x(e,"cart load failed"),this.lastError=e,ve(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=c.country?{countryCode:String(c.country).toUpperCase()}:void 0,r=await q(Re("cartCreate","$input: CartInput!","input: $input"),{input:{buyerIdentity:e,...t}});return this._take(r.cartCreate,"cartCreate")},async _mutate(t,e,r,n,i){let s=this.id();if(!s)return i?this._create(i):null;try{let o=await q(Re(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${r}`),{...n,cartId:s});return this._take(o[t],t)}catch(o){if(i&&ve(o))return T("cart expired, creating a new one"),this._setId(null),this._create(i);throw o}},add(t,e=1,r={}){let n=(Array.isArray(t)?t:[t]).map(i=>Ke(i,e,r));return this._queue(async()=>{let i=await this._mutate("cartLinesAdd","$lines: [CartLineInput!]!","lines: $lines",{lines:n},{lines:n});return this._commit(i,"add"),$("added",{cart:i,lines:n}),c.openCartOnAdd&&this.open(),i})},updateLine(t,e){let r=typeof e=="number"?{quantity:e}:{...e};if(r.quantity!==void 0&&r.quantity<=0)return this.removeLine(t);let n={id:t};return r.quantity!==void 0&&(n.quantity=r.quantity),"sellingPlanId"in r&&(n.sellingPlanId=r.sellingPlanId?M.sellingPlan(r.sellingPlanId):null),r.attributes&&(n.attributes=H(r.attributes)),(r.merchandiseId||r.variantId)&&(n.merchandiseId=M.variant(r.merchandiseId||r.variantId)),this._queue(async()=>this._commit(await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[n]}),"update"))},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(n=>[n.key,n.value]));H(t).forEach(n=>e.set(n.key,n.value));let r=[...e].filter(([,n])=>n!=="").map(([n,i])=>({key:n,value:i}));return this._queue(async()=>this._commit(await this._mutate("cartAttributesUpdate","$attributes: [AttributeInput!]!","attributes: $attributes",{attributes:r},{attributes:r}),"attributes"))},setDiscountCodes(t){let e=(Array.isArray(t)?t:[t]).map(r=>String(r).trim()).filter(Boolean);return this._queue(async()=>this._commit(await this._mutate("cartDiscountCodesUpdate","$discountCodes: [String!]!","discountCodes: $discountCodes",{discountCodes:e},{discountCodes:e}),"discount"))},applyDiscount(t){let e=(this.state?.discountCodes||[]).map(r=>r.code);return this.setDiscountCodes([...new Set([...e,t])])},removeDiscount(t){let e=String(t).toLowerCase();return this.setDiscountCodes((this.state?.discountCodes||[]).map(r=>r.code).filter(r=>r.toLowerCase()!==e))},setBuyerIdentity(t,{create:e=!0}={}){return this._queue(async()=>{let r=await this._mutate("cartBuyerIdentityUpdate","$buyerIdentity: CartBuyerIdentityInput!","buyerIdentity: $buyerIdentity",{buyerIdentity:t},e?{buyerIdentity:t}:null).catch(n=>{if(e||!ve(n))throw n;return this._setId(null),null});return this._commit(r,"buyer-identity")})},async checkout(t=c.checkoutTarget){let e=this.id();if(!e||this.state&&!this.count)return null;let r=t==="_blank"?window.open("","_blank"):null;if(r)try{r.opener=null}catch{}try{let i=(await q("query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }",{id:e})).cart?.checkoutUrl;if(!i)throw new I("No checkoutUrl (cart empty or expired)");return $("checkout",{url:i,cart:this.state}),r&&!r.closed?r.location.href=i:window.location.href=i,i}catch(n){return r&&r.close(),x(n,"checkout failed"),null}},drawers(){return v(document,a("cart-drawer"))},isOpen(){return this.drawers().some(t=>t.classList.contains(c.cartDrawerOpenClass))},open(){if(this.isOpen())return;let t=this.drawers().filter(e=>d(e,"cart-drawer")!=="manual");t.forEach(e=>{e.classList.add(c.cartDrawerOpenClass),e.setAttribute("aria-hidden","false")}),be(!0),c.cartFocus!==!1&&t[0]&&(jt=document.activeElement,setTimeout(()=>{let e=Ut(t[0])[0]||t[0];e===t[0]&&!t[0].hasAttribute("tabindex")&&(t[0].tabIndex=-1),e.focus?.({preventScroll:!0})},60)),typeof c.onCartOpen=="function"&&c.onCartOpen(t),$("cart-toggled",{open:!0})},close(){if(!this.isOpen())return;let t=this.drawers(),e=t.some(r=>r.contains(document.activeElement));t.forEach(r=>{r.classList.remove(c.cartDrawerOpenClass),r.setAttribute("aria-hidden","true")}),be(!1),e&&jt?.isConnected&&jt.focus({preventScroll:!0}),jt=null,typeof c.onCartClose=="function"&&c.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}),r=()=>e();return["cart-updated","cart-toggled"].forEach(n=>document.addEventListener(`${c.prefix}:${n}`,r)),e(),()=>["cart-updated","cart-toggled"].forEach(n=>document.removeEventListener(`${c.prefix}:${n}`,r))},render(){let t=this.state,e=t?t.totalQuantity:0,r=s=>t?O(t.cost?.[s]):"";be(this.isOpen()),v(document,a("cart-count")).forEach(s=>tt(s,e)),v(document,a("cart-subtotal")).forEach(s=>tt(s,r("subtotalAmount"))),v(document,a("cart-total")).forEach(s=>tt(s,r("totalAmount"))),v(document,a("cart-checkout-charge")).forEach(s=>tt(s,r("checkoutChargeAmount")));let n=this.lines.some(s=>s.sellingPlanAllocation),i={"cart-empty":e===0,"cart-filled":e>0,"cart-has-subscription":n,"cart-no-subscription":!n,"cart-has-discount":(t?.discountCodes||[]).some(s=>s.applicable),"cart-error":!!this.lastError,"cart-warning":this.warnings.length>0};v(document,a("cart-warning")).forEach(s=>tt(s,[...new Set(this.warnings.map(o=>o.message))].join(" "))),v(document,a("show")).forEach(s=>{let o=d(s,"show");o in i&&!s.closest(a("product"))&&j(s,i[o])}),v(document,a("checkout")).forEach(s=>{s.classList.toggle("is-disabled",!e),s.setAttribute("aria-disabled",String(!e))}),v(document,`textarea${a("cart-note")},input${a("cart-note")}`).forEach(s=>{document.activeElement!==s&&(s.value=t?.note||"")}),v(document,a("cart-discounts")).forEach(s=>{V(s,t?.discountCodes||[],(o,l)=>{o.setAttribute(y("discount-code"),l.code);let p=o.querySelector(a("discount","code"))||(o.firstElementChild?null:o);p&&E(p,l.code),o.classList.toggle("is-inapplicable",!l.applicable)})}),v(document,a("cart-lines")).forEach(s=>{me(s,this.lines,o=>o.id,(o,l)=>ur(o,l),{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),t&&B("cart")}};function lr(t,e){let r=t.merchandise||{},n=t.sellingPlanAllocation?.sellingPlan;switch(e){case"title":return r.product?.title;case"product-title":return r.product?.title;case"variant-title":return r.title==="Default Title"?"":r.title;case"options":return(r.selectedOptions||[]).filter(i=>i.value!=="Default Title").map(i=>`${i.name}: ${i.value}`).join(", ");case"vendor":return r.product?.vendor;case"sku":return r.sku;case"price":return O(t.cost?.amountPerQuantity||r.price);case"compare-at-price":return O(t.cost?.compareAtAmountPerQuantity||r.compareAtPrice);case"line-total":return O(t.cost?.totalAmount);case"line-subtotal":return O(t.cost?.subtotalAmount);case"quantity":return t.quantity;case"plan":return n?.name||"";case"plan-description":return n?.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 ur(t,e){let r=e.merchandise||{},n=!!e.sellingPlanAllocation;t.setAttribute(y("line-id"),e.id),t.classList.toggle("is-subscription",n),v(t,a("line")).forEach(s=>{let o=d(s,"line");if(o==="image")return N(s,r.image?.url||r.product?.featuredImage?.url,r.product?.title);if(o==="url"){let p=yt(r.product?.handle,r.product?.id),f=new URLSearchParams;r.id&&f.set("variant",String(r.id).split("/").pop());let m=e.sellingPlanAllocation?.sellingPlan?.id;m&&f.set("selling_plan",m.split("/").pop());let h=f.toString();return s.setAttribute("href",h?`${p}${p.includes("?")?"&":"?"}${h}`:p)}let l=lr(e,o);l!==void 0&&tt(s,l)});let i={subscription:n,"one-time":!n,"on-sale":parseFloat(e.cost?.compareAtAmountPerQuantity?.amount)>parseFloat(e.cost?.amountPerQuantity?.amount),"has-components":(e.lineComponents||[]).length>0};v(t,a("line-show")).forEach(s=>{let o=d(s,"line-show");o in i&&j(s,i[o])}),v(t,`select${a("line-plan")}`).forEach(s=>{let o=r.product?.handle;o&&U(o).then(l=>{let p=K(l),m=[...!l.requiresSellingPlan&&d(s,"line-plan")!=="subscription-only"?[{value:"",label:s.getAttribute(y("one-time-label"))||"One-time purchase"}]:[],...p.map(C=>({value:C.id,label:C.name}))],h=m.map(C=>C.value).join("|");s.dataset.tetherSig!==h&&(s.innerHTML="",m.forEach(C=>{let A=document.createElement("option");A.value=C.value,A.textContent=C.label,s.appendChild(A)}),s.dataset.tetherSig=h),s.value=e.sellingPlanAllocation?.sellingPlan?.id||"",j(s,p.length>0)}).catch(l=>x(l,"line plan options"))})}var xe={};F(xe,{ProductScope:()=>wt,rememberOptionNames:()=>Kt,scopes:()=>Q});var Pe={};F(Pe,{STATUS_KEYS:()=>Vt,boundary:()=>Mt,isNotFound:()=>$t,ownedBy:()=>we,resolveProductKey:()=>ot,setScopeStatus:()=>G});function ot(t,e=window.location){let r=(d(t,"product")||"").trim();if(!r.toLowerCase().startsWith("url:"))return{key:r||null,fromUrl:!1,raw:r};let n=r.slice(4).trim(),i=null;if(n.toLowerCase()==="path"){let s=e.pathname.split("/").filter(Boolean);i=s.length?dr(s[s.length-1]):null}else i=new URLSearchParams(e.search).get(n||"handle");return i=i&&i.trim()?i.trim():null,{key:i,fromUrl:!0,raw:r}}function dr(t){try{return decodeURIComponent(t)}catch{return t}}var Vt=["loading","ready","error","not-found"],$t=t=>t?.code==="NOT_FOUND",Mt=()=>["product","collection","products","recommendations"].map(t=>a(t)).join(","),we=(t,e)=>t===e||t.parentElement?.closest(Mt())===e;function G(t,e,r){let n=e==="not-found";t.setAttribute(y("state"),n?"error":e),e==="error"||n?t.setAttribute(y("error"),n?"not-found":r?.code||"error"):t.removeAttribute(y("error")),Z(t,a("show"),Mt()).forEach(i=>{let s=d(i,"show");Vt.includes(s)&&j(i,s===e)}),(e==="error"||n)&&Z(t,a("add-to-cart"),Mt()).forEach(i=>{i.classList.add("is-disabled"),i.setAttribute("aria-disabled","true"),"disabled"in i&&(i.disabled=!0)})}var Q=new WeakMap,Be=()=>a("product");function pr(t,e){let r=e.indexOf("."),n=e.slice(0,r),i=e.slice(r+1);return(t.metafields||[]).find(o=>o&&o.namespace===n&&o.key===i)||null}var Rt=new Map;function Kt(t){(t||[]).forEach(e=>{e?.handle&&!Rt.has(e.handle)&&Rt.set(e.handle,(e.options||[]).map(r=>r.name))})}var wt=class{constructor(e,r){this.root=e,this.product=r,this.selected={},this.variant=null,this.quantity=Math.max(0,parseInt(d(e,"quantity")??"1",10)||(X(e,"quantity")?0:1)),this.plans=K(r),this.purchase="one-time",this.planId=null,Q.set(e,this),e.setAttribute(y("state"),"ready"),e.removeAttribute(y("error")),this.initSelection(),this.initPurchase(),this.renderProduct(),this.bind(),this.renderVariant(),ge(e,"product"),B("product"),$("product-ready",{product:r,scope:this},e)}update(e){let r=this.variant?.id;this.product=e,this.plans=K(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 n=e.variants.nodes.find(i=>i.id===r);n&&(this.selected={},n.selectedOptions.forEach(i=>{this.selected[i.name]=i.value})),this.root.setAttribute(y("state"),"ready"),this.root.removeAttribute(y("error")),this.renderProduct(),this.renderVariant(),B("product"),$("product-updated",{product:e,scope:this},this.root)}$(e){let r=Z(this.root,e,Be());return this.root.matches(e)?[this.root,...r]:r}optName(e){let r=this.product?.options||[];if(!e||r.some(i=>i.name===e))return e;let n=(Rt.get(this.product.handle)||[]).indexOf(e);return n>=0&&r[n]?r[n].name:e}initSelection(){let e=this.product.variants.nodes,r=e.find(i=>i.availableForSale)||e[0];r&&r.selectedOptions.forEach(i=>{this.selected[i.name]=i.value});let n=new URLSearchParams(window.location.search).get("variant")||d(this.root,"variant");if(n){let i=M.variant(n),s=e.find(o=>o.id===i);s&&(this.selected={},s.selectedOptions.forEach(o=>{this.selected[o.name]=o.value}))}}initPurchase(){if(!this.plans.length)return;let e=new URLSearchParams(window.location.search),r=mt(this.product,e.get("selling_plan")),n=mt(this.product,d(this.root,"default-plan"));this.planId=(r||n||this.plans[0]).id;let i=r?"subscription":d(this.root,"default-purchase")||c.defaultPurchase;this.purchase=this.product.requiresSellingPlan||i==="subscription"?"subscription":"one-time"}findVariant(){return this.product.variants.nodes.find(e=>e.selectedOptions.every(r=>this.selected[r.name]===r.value))||null}isValueAvailable(e,r){return this.product.variants.nodes.some(n=>n.availableForSale&&n.selectedOptions.every(i=>i.name===e?i.value===r: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=>D(this.variant,e.id)))}get isSubscription(){return this.purchase==="subscription"&&!!D(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 r=this.collectAttributes();return r.length&&(e.attributes=r),e}collectAttributes(){let e=H(vt(this.root,"line-attributes")),r=this.$(a("line-attribute")).map(n=>{let i=d(n,"line-attribute"),s;return n.type==="checkbox"?s=n.checked?n.value&&n.value!=="on"?n.value:"Yes":"":n.type==="radio"?s=n.checked?n.value:null:s=n.value,s==null||s===""?null:{key:i,value:String(s)}}).filter(Boolean);return[...e,...r]}select(e,r){this.selected[e]!==r&&(this.selected[e]=r,this.renderVariant())}selectVariant(e){let r=this.product.variants.nodes.find(n=>n.id===M.variant(e));r&&(this.selected={},r.selectedOptions.forEach(n=>{this.selected[n.name]=n.value}),this.renderVariant())}setPurchase(e){let r=e==="subscription"?"subscription":"one-time";r==="one-time"&&this.product.requiresSellingPlan||this.purchase!==r&&(this.purchase=r,this.renderVariant())}selectPlan(e){let r=mt(this.product,e);r&&(this.planId=r.id,this.purchase="subscription",this.renderVariant())}setQuantity(e){let r=X(this.root,"quantity")?0:1;this.quantity=Math.max(r,parseInt(e,10)||0),this.$(a("qty")).forEach(n=>E(n,this.quantity)),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let e=this.getLine();if(!e||e.quantity<1)return null;let r=await P.add(e);return $("product-added",{product:this.product,variant:this.variant,line:e},this.root),r}bind(){let e=r=>r&&r.closest(Be())===this.root;this.root.addEventListener("click",r=>{let n=r.target;if(!n?.closest)return;let i=n.closest(a("option-value"));if(e(i)&&i.closest(a("option-list"))){r.preventDefault(),this.select(this.optName(d(i.closest(a("option-list")),"option-list")),d(i,"option-value"));return}let s=n.closest(a("plan-value"));if(e(s)){r.preventDefault(),this.selectPlan(d(s,"plan-value"));return}let o=n.closest(`${a("purchase")}:not(select)`);if(e(o)){o.tagName!=="INPUT"&&r.preventDefault(),this.setPurchase(d(o,"purchase"));return}let l=n.closest(a("qty-plus"));if(e(l)){r.preventDefault(),this.setQuantity(this.quantity+1);return}let p=n.closest(a("qty-minus"));if(e(p)){r.preventDefault(),this.setQuantity(this.quantity-1);return}let f=n.closest(a("add-to-cart"));e(f)&&(r.preventDefault(),this.onAddClick(f))}),this.root.addEventListener("change",r=>{let n=r.target;e(n)&&(n.matches(`select${a("option")}`)?this.select(this.optName(d(n,"option")),n.value):n.matches(`select${a("variant-select")}`)?this.selectVariant(n.value):n.matches(`select${a("plan")}`)?n.value?this.selectPlan(n.value):this.setPurchase("one-time"):n.matches(`select${a("purchase")}`)?this.setPurchase(n.value):n.matches(a("qty"))&&this.setQuantity(n.value))})}onAddClick(e){let r=e.querySelector(a("add-label"))||e,n=d(e,"adding-text"),i=s=>E(r,s);r.dataset.tetherLabel===void 0&&(r.dataset.tetherLabel=r.tagName==="INPUT"?r.value:r.textContent),R(e,async()=>{n&&i(n);try{await this.addToCart()}catch(s){x(s,"add to cart failed"),$("error",{error:s,context:"add-to-cart"},this.root)}finally{n&&i(r.dataset.tetherLabel)}}).then(()=>{this.renderVariant()})}renderProduct(){let e=this.product;Rt.has(e.handle)||this.$(`${a("option-list")},select${a("option")}`).map(i=>d(i,"option-list")||d(i,"option")).some(i=>e.options.some(s=>s.name===i))&&Kt([e]);let r=this.product;this.$(a("bind")).forEach(n=>{let i=d(n,"bind")||"",s={title:r.title,"description-text":r.description,vendor:r.vendor,type:r.productType,handle:r.handle}[i];if(s!==void 0)return E(n,s);switch(i){case"description":n.innerHTML=r.descriptionHtml||"";return;case"published-at":return E(n,he(r.publishedAt));case"min-price":return E(n,O(r.priceRange.minVariantPrice));case"max-price":return E(n,O(r.priceRange.maxVariantPrice));case"featured-image":return N(n,r.featuredImage?.url,r.featuredImage?.altText||r.title);case"url":case"link":n.setAttribute("href",yt(r.handle,r.id)),i==="url"&&!n.firstElementChild&&!n.textContent.trim()&&E(n,r.title);return;case"images":{let o=[...n.children].map(l=>l.tagName==="IMG"?l:l.querySelector("img"));if(!fe(n)&&o.length===r.images.nodes.length&&o.every((l,p)=>Dt(l?.getAttribute("src"),r.images.nodes[p].url)))return}return V(n,r.images.nodes,(o,l)=>{let p=o.matches(`img,${a("bind","image")}`)?o:o.querySelector("img")||o;N(p,l.url,l.altText||r.title)});case"tags":{let o=(n.getAttribute("exclude")||"").split(",").map(l=>l.trim()).filter(Boolean);return V(n,r.tags.filter(l=>!o.includes(l)),(l,p)=>E(l,p))}default:if(/^image:\d+$/.test(i)){let o=r.images.nodes[i.slice(6)-1]||r.featuredImage;return N(n,o?.url,o?.altText||r.title)}if(i.startsWith("metafield:")){let o=pr(r,i.slice(10));return o?o.reference?.image?N(n,o.reference.image.url,o.reference.image.altText):(/^(rich_text|multi_line_text)_field$/.test(o.type)&&(n.style.whiteSpace="pre-line"),E(n,o.value)):E(n,"")}return}}),this.$(a("option-list")).forEach(n=>{let i=this.optName(d(n,"option-list")),s=r.options.find(o=>o.name===i);return!s||s.optionValues.length<=1&&X(n,"hide-single")?j(n,!1):V(n,s.optionValues,(o,l)=>{o.setAttribute(y("option-value"),l.name);let p=o.querySelector(a("bind","option-value"));p?E(p,l.name):o.firstElementChild||E(o,l.name);let f=o.querySelector(a("bind","swatch"));f&&l.swatch?.color&&(f.style.backgroundColor=l.swatch.color),f&&l.swatch?.image?.previewImage&&N(f,l.swatch.image.previewImage.url,l.name)})}),this.$(`select${a("option")}`).forEach(n=>{let i=r.options.find(s=>s.name===this.optName(d(n,"option")));if(!i)return j(n,!1);n.innerHTML="",i.optionValues.forEach(s=>n.appendChild(new Option(s.name,s.name)))}),this.$(`select${a("variant-select")}`).forEach(n=>{n.innerHTML="",r.variants.nodes.forEach(i=>n.appendChild(new Option(i.title,i.id)))}),this.$(a("plan-list")).forEach(n=>{let i=(d(n,"plan-list")||"").trim(),s=["","true","all","*"].includes(i.toLowerCase())?null:i,o=this.plans.filter(l=>!s||l.group.name===s);V(n,o,(l,p)=>{l.setAttribute(y("plan-value"),p.id),!l.firstElementChild&&!l.querySelector(a("plan-bind"))&&E(l,p.name)})}),this.$(`select${a("plan")}`).forEach(n=>{n.innerHTML="",!r.requiresSellingPlan&&d(n,"plan")!=="subscription-only"&&n.appendChild(new Option(n.getAttribute(y("one-time-label"))||"One-time purchase","")),this.plans.forEach(i=>n.appendChild(new Option(i.name,i.id)))})}renderVariant(){let e=this.product,r=this.findVariant();if(r||([r]=e.variants.nodes,r&&(this.selected={},r.selectedOptions.forEach(u=>{this.selected[u.name]=u.value}))),this.variant=r,!r)return;if(this.plans.length&&!D(r,this.planId)){let u=this.plans.find(g=>D(r,g.id));u&&(this.planId=u.id)}let n=this.isSubscription,i=r.price,s=this.planId?ft(r,this.planId):null,o=n?s:i,l=n&&D(r,this.planId)?.priceAdjustments?.[0]?.compareAtPrice||r.compareAtPrice,p=l&&parseFloat(l.amount)>parseFloat(o.amount),f=p?Math.round((1-parseFloat(o.amount)/parseFloat(l.amount))*100):0,m=this.planId?Nt(r,this.planId):{amount:null,percentage:0},h=this.plan,C={amount:(parseFloat(o.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:o.currencyCode},A=O,lt=u=>u?`${u}%`:"",Wt={price:()=>A(o),"total-price":()=>A(C),"one-time-price":()=>A(i),"subscription-price":()=>A(s),"subscription-savings":()=>lt(m.percentage),"subscription-savings-amount":()=>A(m.amount),"checkout-charge":()=>A(n?ue(r,this.planId):o),"plan-name":()=>h?.name,"plan-description":()=>h?.description,"plan-group":()=>h?.group?.name,"compare-at-price":()=>p?A(l):"","unit-price":()=>A(r.unitPrice),"discount-percentage":()=>`${f}%`,"discount-amount":()=>p?A({amount:String(parseFloat(l.amount)-parseFloat(o.amount)),currencyCode:o.currencyCode}):"","variant-title":()=>r.title,"variant-id":()=>r.id,sku:()=>r.sku,barcode:()=>r.barcode,stock:()=>r.quantityAvailable,quantity:()=>this.quantity};this.$(a("bind")).forEach(u=>{let g=d(u,"bind");g==="variant-image"?N(u,r.image?.url||e.featuredImage?.url,r.image?.altText||e.title):Wt[g]&&E(u,Wt[g]())}),this.$(a("option-selected")).forEach(u=>E(u,this.selected[this.optName(d(u,"option-selected"))]||"")),this.$(a("option-list")).forEach(u=>{let g=this.optName(d(u,"option-list"));v(u,a("option-value")).forEach(S=>{let W=d(S,"option-value");bt(S,this.selected[g]===W);let k=!this.isValueAvailable(g,W);S.classList.toggle("is-unavailable",k),S.setAttribute("data-unavailable",k?"true":"false")})}),this.$(`select${a("option")}`).forEach(u=>{u.value=this.selected[this.optName(d(u,"option"))]||""}),this.$(`select${a("variant-select")}`).forEach(u=>{u.value=r.id}),this.$(a("purchase")).forEach(u=>{if(u.tagName==="SELECT"){u.value=this.purchase;return}let g=d(u,"purchase");bt(u,g===this.purchase);let S=g==="subscription"?!this.subscriptionAvailable:e.requiresSellingPlan;u.classList.toggle("is-unavailable",S)}),this.$(a("plan-value")).forEach(u=>{let g=d(u,"plan-value"),S=this.plans.find(k=>k.id===g),W=!!D(r,g);bt(u,n&&g===this.planId),u.classList.toggle("is-unavailable",!W),v(u,a("plan-bind")).forEach(k=>{let J=de(S),Le=Nt(r,g),er=d(k,"plan-bind"),qe={name:()=>S?.name,description:()=>S?.description,price:()=>A(ft(r,g)),savings:()=>lt(Le.percentage),"savings-amount":()=>A(Le.amount),adjustment:()=>J?J.type==="percentage"?`${J.value}%`:A(J.value):""}[er];qe&&E(k,qe())})}),this.$(`select${a("plan")}`).forEach(u=>{u.value=n?this.planId:""});let b={"in-stock":r.availableForSale,"out-of-stock":!r.availableForSale,backorder:r.availableForSale&&r.currentlyNotInStock,"on-sale":!!p,"not-on-sale":!p,"has-variants":e.variants.nodes.length>1,"single-variant":e.variants.nodes.length===1,"low-stock":r.quantityAvailable!=null&&r.quantityAvailable>0&&r.quantityAvailable<=5,"subscription-available":this.subscriptionAvailable,"subscription-unavailable":!this.subscriptionAvailable,"subscription-only":!!e.requiresSellingPlan,"one-time-available":!e.requiresSellingPlan,"subscription-selected":n,"one-time-selected":!n,"has-savings":n?m.percentage>0:!!p,loading:!1,ready:!0,error:!1,"not-found":!1};this.$(a("show")).forEach(u=>{let g=d(u,"show");g in b&&(Vt.includes(g)&&!we(u,this.root)||j(u,b[g]))}),this.root.classList.toggle("is-subscription",n),this.root.setAttribute(y("purchase-mode"),n?"subscription":"one-time"),this.$(a("add-to-cart")).forEach(u=>{let g=!r.availableForSale;u.classList.toggle("is-disabled",g),u.setAttribute("aria-disabled",String(g)),"disabled"in u&&(u.disabled=g);let S=d(u,"soldout-text"),W=d(u,"subscribe-text");if(S||W){let k=u.querySelector(a("add-label"))||u;k.dataset.tetherLabel===void 0&&(k.dataset.tetherLabel=k.tagName==="INPUT"?k.value:k.textContent);let J=k.dataset.tetherLabel;n&&W&&(J=W),g&&S&&(J=S),u.getAttribute("aria-busy")!=="true"&&E(k,J)}}),$("variant-changed",{product:e,variant:r,selected:{...this.selected},purchase:this.purchase,sellingPlanId:n?this.planId:null},this.root)}};var Ae={};F(Ae,{ListScope:()=>Pt,listSelector:()=>nt});var nt=()=>`${a("collection")},${a("products")},${a("recommendations")}`,Pt=class{constructor(e){this.root=e,this.products=[],this.pageInfo=null,this.collection=null,G(e,"loading"),e.addEventListener("click",r=>{let n=r.target.closest?.(a("load-more"));n&&n.closest(nt())===e&&(r.preventDefault(),R(n,()=>this.load(!0)))})}$(e){return Z(this.root,e,nt())}options(){let e=this.root,r={first:parseInt(d(e,"limit")||"",10)||void 0,sortKey:d(e,"sort")||void 0,reverse:d(e,"reverse")==="true"};return X(e,"collection")?r.collection=d(e,"collection"):r.query=d(e,"products")||"",r}async load(e=!1){let r=this.loadToken=(this.loadToken||0)+1,n=()=>r!==this.loadToken;try{if(X(this.root,"recommendations")){let i=d(this.root,"recommendations"),s=await U(i),o=await ht(s.id,d(this.root,"intent")||"RELATED");if(n())return;let l=parseInt(d(this.root,"limit")||"",10);this.products=l?o.slice(0,l):o}else{let i=await pt({...this.options(),after:e?this.pageInfo?.endCursor:null});if(n())return;this.collection=i.collection,this.pageInfo=i.pageInfo,this.products=e?[...this.products,...i.products]:i.products}this.render(),G(this.root,"ready"),$("list-ready",{products:this.products,collection:this.collection},this.root)}catch(i){if(n())return;e||G(this.root,$t(i)?"not-found":"error",i),x(i,"list load failed"),$("error",{error:i,context:"list"},this.root)}}render(){let e=this.collection;this.$(a("collection-bind")).forEach(n=>{switch(d(n,"collection-bind")){case"title":return E(n,e?.title||"");case"description":n.innerHTML=e?.descriptionHtml||"";return;case"image":return N(n,e?.image?.url,e?.image?.altText||e?.title);case"count":return E(n,this.products.length);default:return}}),this.$(a("list")).forEach(n=>{V(n,this.products,(i,s)=>{i.setAttribute(y("product"),s.handle),i.removeAttribute(y("state"))}),$("list-rendered",{container:n},this.root)});let r=this.products.length===0;this.$(a("show")).forEach(n=>{let i=d(n,"show");i==="list-empty"&&(n.style.display=r?"":"none"),i==="list-filled"&&(n.style.display=r?"none":"")}),this.$(a("load-more")).forEach(n=>{n.style.display=this.pageInfo?.hasNextPage?"":"none"}),B("list")}};var Ce={};F(Ce,{hydrateFromPage:()=>Se,liveLists:()=>ct,liveProducts:()=>at,mountProduct:()=>Qt,mountedLists:()=>Ht,mountedProducts:()=>xt,pruneLive:()=>Gt,retryFailed:()=>Ee,within:()=>At});var xt=new WeakSet,Ht=new WeakSet,at=new Set,ct=new Set,He=new WeakMap;function Gt(){at.forEach(t=>{t.isConnected||at.delete(t)}),ct.forEach(t=>{t.root.isConnected||ct.delete(t)})}function At(t,e){return[...t.matches?.(e)?[t]:[],...v(t,e)]}function Qt(t){if(xt.has(t))return!1;let{key:e,fromUrl:r,raw:n}=ot(t);if(!e)return r?(xt.add(t),G(t,"not-found"),$("product-not-found",{key:null,source:n},t)):t.closest(nt())||L(`[${y("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t),!1;xt.add(t),at.add(t);let i={};He.set(t,i);let s=()=>He.get(t)===i;return Q.get(t)?t.setAttribute(y("state"),"updating"):G(t,"loading"),U(e).then(o=>{if(!s())return;let l=Q.get(t);l?l.update(o):new wt(t,o),hr(t,o),c.revalidate!==!1&&ae(e)&&fr(e)}).catch(o=>{if(!s())return;let l=$t(o);G(t,l?"not-found":"error",o),l?($("product-not-found",{key:e,source:n},t),r?T(`product not found: ${e}`):x(o,`product ${e}`)):(x(o,`product ${e}`),$("error",{error:o,context:"product",key:e},t))}),!0}function hr(t,e){let r=d(t,"page-title");!r||typeof document>"u"||(document.title=r.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function Ee(){Gt(),at.forEach(t=>{t.getAttribute(y("state"))!=="error"||t.getAttribute(y("error"))==="not-found"||(xt.delete(t),Qt(t))})}var Bt=new Set;function fr(t){Bt.size||setTimeout(mr,0),Bt.add(t)}function mr(){let t=[...Bt];Bt=new Set,ce(t).forEach((e,r)=>e.then(n=>{at.forEach(i=>{let s=Q.get(i);if(!s||!i.isConnected)return;let o=ot(i).key;o!==t[r]&&o!==n.handle&&o!==n.id||JSON.stringify(s.product)!==JSON.stringify(n)&&s.update(n)})}).catch(n=>x(n,`refresh ${t[r]}`)))}var Ge=new WeakSet;function Se(t=document){v(t.ownerDocument||t,'script[type="application/json"][data-tether-hydrate]').forEach(e=>{if(!Ge.has(e)){Ge.add(e);try{let r=JSON.parse(e.textContent);Kt(r.products);let n=(i,s)=>String(i||"").toUpperCase()===String(s||"").toUpperCase();n(r.country,c.country)&&n(r.language,c.language)?oe(r.products):T("hydration skipped: other market")}catch(r){L("bad data-tether-hydrate",r)}}})}var{cfg:gr}=It,Qe={"config.js":It,"client.js":Zt,"dom.js":ye,"fragments.js":ee,"loader.js":le,"selling-plans.js":gt,"status.js":Pe,"cart.js":$e,"product.js":xe,"collection.js":Ae,"mounting.js":Ce},Ie=typeof document<"u"&&document.currentScript?.src||"",Et={};function it(t){if(Et[t])return Et[t];let e=gr.partsUrl||Ie.replace(/[^/]*$/,""),r=/\.min\.js(\?|$)/.test(Ie)||!Ie?".min":"",n=`${e.replace(/\/?$/,"/")}tether.${t}${r}.js`;return Et[t]=new Promise((i,s)=>{let o=document.createElement("script");o.src=n,o.async=!0,o.onload=()=>window.Tether?.__parts?.[t]?i(window.Tether.__parts[t]):s(new Error(`${n} did not register`)),o.onerror=()=>{delete Et[t],s(new Error(`Could not load ${n}. Host it next to the Tether script, or set partsUrl.`))},document.head.appendChild(o)}),Et[t]}var We="0.5.0",st=null,ke=null;function St(t=document){if(!Ct())return 0;let e=0;return Gt(),Se(t),At(t,nt()).forEach(r=>{if(Ht.has(r))return;Ht.add(r),e++;let n=new Pt(r);ct.add(n),r.addEventListener(`${c.prefix}:list-rendered`,i=>St(i.detail.container)),n.load()}),At(t,a("product")).forEach(r=>{Qt(r)&&e++}),At(t,`${a("country-select")},${a("country-bind")}`).length&&it("markets").then(r=>r.renderCountrySelects(t)).catch(r=>x(r,"markets")),v(t,a("account-link")).forEach(r=>{r.setAttribute("href",`https://${c.domain}/account`)}),P.render(),T(`mounted ${e} scope(s)`,t),e}function Ye(){P.close()}function yr(t){let e=t?.closest?.(a("product"));return e&&Q.get(e)||null}var Je=!1;function br(){Je||(Je=!0,document.addEventListener("click",t=>{let e=t.target;if(!e?.closest)return;if(e.closest(a("cart-open"))){t.preventDefault(),P.toggle();return}if(e.closest(a("cart-close"))){t.preventDefault(),P.close();return}let r=e.closest(a("cart-clear"));if(r){t.preventDefault(),R(r,()=>P.clear().catch(l=>x(l,"cart clear")));return}let n=e.closest(a("checkout"));if(n){t.preventDefault(),R(n,()=>P.checkout());return}let i=e.closest(ze());if(i&&i.closest(a("cart-lines"))){let l=i.getAttribute(`data-${c.prefix}-key`),p=P.lines.find(m=>m.id===l),f=m=>{t.preventDefault(),m().catch(h=>x(h,"cart line"))};if(e.closest(a("line-remove")))return f(()=>P.removeLine(l));if(p&&e.closest(a("line-plus")))return f(()=>P.updateLine(l,p.quantity+1));if(p&&e.closest(a("line-minus")))return f(()=>P.updateLine(l,p.quantity-1))}let s=e.closest(a("discount-remove"));if(s){t.preventDefault();let l=s.closest(a("discount-code"))?.getAttribute(y("discount-code"));l&&P.removeDiscount(l).catch(p=>x(p,"discount"));return}let o=e.closest(a("group-add"));o&&(t.preventDefault(),R(o,()=>Xe(o)))}),document.addEventListener("change",t=>{let e=t.target;if(!e?.closest)return;let n=e.closest(ze())?.getAttribute(`data-${c.prefix}-key`);n&&e.matches(`input${a("line","quantity")}`)?P.updateLine(n,parseInt(e.value,10)||0).catch(i=>x(i,"cart line")):n&&e.matches(`select${a("line-plan")}`)?P.updateLine(n,{sellingPlanId:e.value||null}).catch(i=>x(i,"cart line plan")):e.matches(`select${a("country-select")}`)?e.value&&tr(e.value).catch(i=>x(i,"country")):e.matches(a("cart-note"))&&P.setNote(e.value).catch(i=>x(i,"cart note"))}),document.addEventListener("submit",t=>{let e=t.target.closest?.(a("discount-form"));if(!e)return;t.preventDefault();let r=e.querySelector(a("discount-input"))||e.querySelector("input"),n=r?.value.trim();n&&R(e,async()=>{try{let s=((await P.applyDiscount(n))?.discountCodes||[]).find(o=>o.code.toLowerCase()===n.toLowerCase())?.applicable;s||await P.removeDiscount(n).catch(()=>{}),e.classList.toggle("is-invalid",!s),$(s?"discount-applied":"discount-invalid",{code:n},e),s&&r&&(r.value="")}catch(i){e.classList.add("is-invalid"),x(i,"discount")}})},!0),document.addEventListener("input",t=>{t.target.closest?.(a("discount-form"))?.classList.remove("is-invalid")}),c.astro!==!1&&(document.addEventListener("astro:page-load",()=>St(document)),document.addEventListener("astro:before-swap",()=>Ye())),window.addEventListener("online",()=>{Ee(),ct.forEach(t=>{t.root.getAttribute(y("state"))==="error"&&t.load()})}),document.addEventListener("keydown",t=>{if(!P.isOpen())return;if(t.key==="Escape"){P.close();return}if(t.key!=="Tab"||c.cartFocus===!1)return;let e=P.drawers().find(s=>s.classList.contains(c.cartDrawerOpenClass)),r=e?Ut(e):[];if(!r.length)return;let n=r[0],i=r[r.length-1];(!e.contains(document.activeElement)||t.shiftKey&&document.activeElement===n||!t.shiftKey&&document.activeElement===i)&&(t.preventDefault(),(t.shiftKey?i:n).focus())}))}function ze(){return`[data-${c.prefix}-key]`}async function Xe(t){let e=t.closest(a("group"));if(!e)return null;let r=d(e,"group"),n=H(vt(e,"line-attributes")),i=r?[{key:"_group",value:r},...n]:n,s=v(e,a("product")).map(o=>Q.get(o)).filter(o=>o&&o.variant?.availableForSale&&o.quantity>0).map(o=>{let l=o.getLine();return l.attributes=[...l.attributes||[],...i],l});if(!s.length)return L("group-add: nothing selected"),null;try{let o=await P.add(s);return $("group-added",{group:r,lines:s},e),o}catch(o){return x(o,"group add"),null}}function Ze(t={}){return st&&!Object.keys(t).length?st:(zt({...window.TETHER_CONFIG||{},...t}),Ct()?(br(),c.observe&&$r(),st=vr(t).then(()=>P.init()).then(async e=>{let r=c.country?String(c.country).toUpperCase():null;if(e&&r&&e.buyerIdentity?.countryCode&&e.buyerIdentity.countryCode!==r)try{e=await P.setBuyerIdentity({countryCode:r},{create:!1})}catch(n){x(n,"cart country")}return $("ready",{cart:e}),Te}),st):(L("TETHER_CONFIG is missing domain or token. Tether is idle."),st=Promise.resolve(null),st))}async function vr(t){let e=c.markets||{};if(e.detect===!1)return;let r=null;if(e.detect)try{r=(await it("markets")).detectMarket(e)}catch(n){x(n,"markets");return}else if(e.remember!==!1){try{r=JSON.parse(localStorage.getItem(`${c.prefix}:market:${c.domain}`)||"null")}catch{}r&&!/^[A-Z]{2}$/.test(r.country||"")&&(r=null)}r&&(r.country&&(c.country=r.country),r.language&&(c.language=r.language),r.locale&&!t.locale&&(c.locale=r.locale),T("market",r))}function tr(t,e){return it("markets").then(r=>r.setCountry(t,e))}function $r(){if(ke||typeof MutationObserver>"u")return;let t=null,e=new Set;ke=new MutationObserver(r=>{r.forEach(n=>n.addedNodes.forEach(i=>{i.nodeType===1&&e.add(i)})),clearTimeout(t),t=setTimeout(()=>{e.forEach(n=>{n.isConnected&&St(n)}),e.clear()},50)}),ke.observe(document.body,{childList:!0,subtree:!0})}var Te={VERSION:We,init:Ze,mount:St,unmount:Ye,get config(){return c},get ready(){return st||Promise.resolve(null)},query:q,withContext:Tt,cart:P,getProduct:U,getProducts:pt,getRecommendations:ht,getScope:yr,addGroup:Xe,primeProduct:Y,normalizeProductKey:rt,clearProductCache:se,formatMoney:O,imageUrl:_t,plans:gt,TetherError:I,resolveProductKey:ot,setCountry:tr,detectMarket:t=>it("markets").then(e=>e.detectMarket(t||c.markets)),getLocalization:()=>it("markets").then(t=>t.getLocalization()),diagnose:t=>it("diagnose").then(e=>e.diagnose({...t,version:We})),__core:Qe,__parts:{},on(t,e){let r=n=>e(n.detail,n);return document.addEventListener(`${c.prefix}:${t}`,r),()=>document.removeEventListener(`${c.prefix}:${t}`,r)}},cn=Te;if(typeof window<"u"&&typeof document<"u"&&(window.Tether=Te,window.TETHER_CONFIG&&window.TETHER_CONFIG.autoMount!==!1&&!window.TETHER_INTEGRATION)){let e=()=>Ze().then(()=>St(document));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}})();
|
|
3
|
+
image { ${tt} }
|
|
4
|
+
seo { title description }`}var pe={};M(pe,{clearProductCache:()=>ce,getProduct:()=>nt,getProducts:()=>vt,getRecommendations:()=>bt,hydrateProducts:()=>le,normalizeProductKey:()=>ct,primeProduct:()=>et,refreshProducts:()=>de,takeStale:()=>ue});var _=new Map,Ge=[],se=new Map,ae=!1,yt=0,oe=t=>typeof t=="string"&&t.startsWith("gid://");function ct(t){let e=String(t??"").trim();if(!e)return null;if(oe(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);_.set(t.handle,e),_.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(_.has(e))return _.get(e);let n=new Promise((r,i)=>{se.set(e,{resolve:r,reject:i}),Ge.push(e),ae||(ae=!0,setTimeout(mn,0))});return _.set(e,n),n}async function mn(){ae=!1;let t=yt,e=Ge.splice(0);if(!e.length)return;let n=e.filter(oe),r=e.filter(f=>!oe(f)),i=[],s=[],o={};n.length&&(i.push("$ids: [ID!]!"),o.ids=n,s.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),r.forEach((f,h)=>{i.push(`$h${h}: String!`),o[`h${h}`]=f,s.push(`h${h}: product(handle: $h${h}) { ...TetherProduct }`)});let c=`query TetherProducts(${i.join(",")}){${s.join(" ")}}${gt()}`;L("fetch products",e);let u=(f,h)=>{let m=se.get(f);se.delete(f),m&&h(m)};try{let f=await F(c,o),h=new Map;(f.byId||[]).forEach(m=>{m&&h.set(m.id,m)}),r.forEach((m,C)=>{f[`h${C}`]&&h.set(m,f[`h${C}`])}),e.forEach(m=>u(m,C=>{if(h.has(m)){let y=h.get(m);t===yt&&(et(y),Ft.set(y.handle,Date.now()),Ft.set(y.id,Date.now())),C.resolve(y)}else{let y=_.get(m);t===yt&&setTimeout(()=>{_.get(m)===y&&_.delete(m)},1e4),C.reject(new E(`Product not found: ${m}`,{code:"NOT_FOUND"}))}}))}catch(f){e.forEach(h=>u(h,m=>{t===yt&&_.delete(h),m.reject(f)}))}}function ce(){_.clear(),yt++,ot.clear(),Ft.clear()}var ot=new Set,Ft=new Map,gn=6e4;function le(t){(t||[]).forEach(e=>{!e?.id||!e.handle||Date.now()-(Ft.get(e.handle)||0)<gn&&_.has(e.handle)||(et(e),ot.add(e.handle),ot.add(e.id))})}function ue(t){let e=ct(t);if(!ot.has(e))return!1;let n=_.get(e);return ot.delete(e),n?.then?.(r=>{ot.delete(r.handle),ot.delete(r.id)}),!0}function de(t){return t.forEach(e=>_.delete(ct(e))),t.map(e=>nt(e))}async function vt({collection:t,query:e,first:n=a.collectionFirst,after:r=null,sortKey:i,reverse:s=!1,filters:o}={}){let c=gt();if(t){let f=await F(`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${re()} 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:o||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 F(`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 F(`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:()=>G,allocationFor:()=>V,findPlan:()=>wt,hasPlans:()=>yn,planAdjustment:()=>fe,planCheckoutCharge:()=>he,planPrice:()=>$t,planSavings:()=>Dt,plansForVariant:()=>vn,toGid:()=>_t});var R={product:t=>_t(t,"Product"),variant:t=>_t(t,"ProductVariant"),sellingPlan:t=>_t(t,"SellingPlan")};function _t(t,e){let n=String(t??"").trim();return n?n.startsWith("gid://")?n:/^\d+$/.test(n)?`gid://shopify/${e}/${n}`:n:null}function G(t){return(t?.sellingPlanGroups?.nodes||[]).flatMap(n=>(n.sellingPlans?.nodes||[]).map(r=>({...r,group:n})))}function yn(t){return G(t).length>0}function V(t,e){return!t||!e?null:(t.sellingPlanAllocations?.nodes||[]).find(n=>n.sellingPlan?.id===e)||null}function vn(t,e){return G(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 he(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 fe(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=G(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(o=>String(o.value).toLowerCase()===i))||null}var xe={};M(xe,{attr:()=>g,busy:()=>B,cdnUrl:()=>Je,dataKey:()=>We,emit:()=>$,formatDate:()=>ye,formatMoney:()=>D,formatPercent:()=>ge,get:()=>p,has:()=>H,hasTemplate:()=>ve,imageUrl:()=>jt,notifyLayoutChanged:()=>J,parseJSONAttr:()=>we,productUrl:()=>At,qsa:()=>w,readText:()=>me,repeat:()=>K,repeatKeyed:()=>be,sameImage:()=>Mt,scoped:()=>rt,sel:()=>l,setImage:()=>j,setSelected:()=>Pt,setText:()=>S,setTextTracked:()=>W,show:()=>T,toAttributes:()=>lt,watchImages:()=>$e});var g=t=>`${a.prefix}-${t}`,l=(t,e)=>e===void 0?`[${g(t)}]`:`[${g(t)}="${e}"]`,p=(t,e)=>t.getAttribute(g(e)),H=(t,e)=>t.hasAttribute(g(e)),We=()=>`data-${a.prefix}-key`;function At(t,e){let n=a.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(`${a.prefix}:${t}`,{detail:e,bubbles:!0}))}function ge(t,e=a.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 a.formatMoney=="function")return a.formatMoney(t,a.locale);let e=parseFloat(t.amount);if(Number.isNaN(e))return"";try{return new Intl.NumberFormat(a.locale||void 0,{style:"currency",currency:t.currencyCode}).format(e)}catch{return`${t.currencyCode} ${e.toFixed(2)}`}}function ye(t){if(!t)return"";try{return new Date(t).toLocaleDateString(a.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 Je(t,e){if(!t||!e)return t;let n=r=>e.getAttribute(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=Je(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 me=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.textContent;function W(t,e){let n=me(t);S(t,e);let r=me(t);if(n!==r&&t.dataset.tetherSeen&&typeof a.onValueChange=="function")try{a.onValueChange(t,n)}catch{}t.dataset.tetherSeen="1"}function T(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(`${a.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,ve=t=>!!Ut.get(t);function ze(t){if(!Ut.has(t)){let e=t.firstElementChild?.cloneNode(!0)??null;Ut.set(t,e),t.innerHTML=""}return Ut.get(t)}function K(t,e,n){let r=ze(t);if(!r){e.length&&U("repeater without a template child",t);return}t.innerHTML="",e.forEach((i,s)=>{let o=r.cloneNode(!0);n(o,i,s),t.appendChild(o)})}function be(t,e,n,r,{onEnter:i,onLeave:s}={}){let o=ze(t);if(!o){U("repeater without a template child",t);return}let c=We(),u=`data-${a.prefix}-leaving`,f=()=>[...t.children].filter(b=>b.hasAttribute(c)&&!b.hasAttribute(u)),h=new Map(f().map(b=>[b.getAttribute(c),b])),m=[],C=new Set;e.forEach((b,N)=>{let d=String(n(b,N)),v=h.get(d);v?h.delete(d):(v=o.cloneNode(!0),v.setAttribute(c,d),C.add(v)),r(v,b,N,C.has(v)),m.push(v)});let y=m.filter(b=>!C.has(b)),O=f().filter(b=>y.includes(b));if(!(O.length===y.length&&O.every((b,N)=>b===y[N]))){h.forEach(b=>b.remove()),m.forEach(b=>t.appendChild(b));return}m.forEach((b,N)=>{if(!C.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 He=null;function J(t){clearTimeout(He),He=setTimeout(()=>{typeof a.onLayoutChange=="function"?a.onLayoutChange(t):window.ScrollTrigger?.refresh&&window.ScrollTrigger.refresh(),$("layout-changed",{reason:t})},120)}function $e(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 B(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 we(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 Xe(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)},o=r.sellingPlanId||r.sellingPlan;o&&(s.sellingPlanId=R.sellingPlan(o));let c=lt(r.attributes);return c.length&&(s.attributes=c),s}function Ye(t,e,n){return`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${Nt()}`}var bn='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Vt=null,Rt=t=>w(t,bn).filter(e=>e.offsetParent!==null||e===document.activeElement);function Ae(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(a.cartDrawerOpenClass)||(e.setAttribute("aria-hidden","true"),a.cartFocus!==!1&&(e.inert=!0))})}var Pe=t=>/does not exist|not found|invalid id/i.test(t?.message||""),A={state:null,_chain:Promise.resolve(),id(){try{return localStorage.getItem(a.storageKey)}catch{return null}},_setId(t){try{t?localStorage.setItem(a.storageKey,t):localStorage.removeItem(a.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=ee(t,e);return this.warnings=(n.warnings||[]).filter((r,i,s)=>s.findIndex(o=>o.message===r.message)===i).map(r=>({...r,message:typeof a.warningText=="function"&&a.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(`${a.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(`${a.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 F(`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,Pe(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=a.country||this.customerAccessToken?{...a.country?{countryCode:String(a.country).toUpperCase()}:{},...this.customerAccessToken?{customerAccessToken:this.customerAccessToken}:{}}:void 0,n=await F(Ye("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 o=await F(Ye(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`),{...r,cartId:s});return this._take(o[t],t)}catch(o){if(i&&Pe(o))return L("cart expired, creating a new one"),this._setId(null),this._create(i);throw o}},add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(i=>Xe(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}),a.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(s=>s.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};return this.pendingQty.set(t,i),this.render(),$("cart-updated",{cart:this.state,reason:"pending"}),this.updateLine(t,r).finally(()=>{this.pendingQty.get(t)===i&&(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||!Pe(r))throw r;return this._setId(null),null});return this._commit(n,"buyer-identity")})},async checkout(t=a.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 F("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(a.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(a.cartDrawerOpenClass),e.setAttribute("aria-hidden","false")}),Ae(!0),a.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 a.onCartOpen=="function"&&a.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(a.cartDrawerOpenClass),n.setAttribute("aria-hidden","true"),a.cartFocus!==!1&&(n.inert=!0)}),Ae(!1),e&&Vt?.isConnected&&Vt.focus({preventScroll:!0}),Vt=null,typeof a.onCartClose=="function"&&a.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(`${a.prefix}:${r}`,n)),e(),()=>["cart-updated","cart-toggled"].forEach(r=>document.removeEventListener(`${a.prefix}:${r}`,n))},render(){let t=this.state,e=t?t.totalQuantity:0,n=s=>t?D(t.cost?.[s]):"";Ae(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(o=>o.message))].join(" "))),w(document,l("show")).forEach(s=>{let o=p(s,"show");o in i&&!s.closest(l("product"))&&T(s,i[o])}),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=>{K(s,t?.discountCodes||[],(o,c)=>{o.setAttribute(g("discount-code"),c.code);let u=o.querySelector(l("discount","code"))||(o.firstElementChild?null:o);u&&S(u,c.code),o.classList.toggle("is-inapplicable",!c.applicable)})}),w(document,l("cart-lines")).forEach(s=>{be(s,this.lines,o=>o.id,(o,c)=>wn(o,c),{onEnter:a.onLineEnter,onLeave:a.onLineLeave})}),t&&J("cart")}};function $n(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 wn(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 C=e.sellingPlanAllocation?.sellingPlan?.id;C&&m.set("selling_plan",C.split("/").pop());let y=m.toString();return c.setAttribute("href",y?`${h}${h.includes("?")?"&":"?"}${y}`:h)}let f=$n(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 o={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 o&&T(c,o[u])}),w(t,`select${l("line-plan")}`).forEach(c=>{let u=n.product?.handle;u&&nt(u).then(f=>{let h=G(f),C=[...!f.requiresSellingPlan&&p(c,"line-plan")!=="subscription-only"?[{value:"",label:c.getAttribute(g("one-time-label"))||"One-time purchase"}]:[],...h.map(O=>({value:O.id,label:O.name}))],y=C.map(O=>O.value).join("|");c.dataset.tetherSig!==y&&(c.innerHTML="",C.forEach(O=>{let at=document.createElement("option");at.value=O.value,at.textContent=O.label,c.appendChild(at)}),c.dataset.tetherSig=y),c.value=e.sellingPlanAllocation?.sellingPlan?.id||"",T(c,h.length>0)}).catch(f=>P(f,"line plan options"))})}var ke={};M(ke,{ProductScope:()=>St,rememberOptionNames:()=>Gt,scopes:()=>it});var Ce={};M(Ce,{STATUS_KEYS:()=>Bt,boundary:()=>Kt,isNotFound:()=>ht,ownedBy:()=>Ee,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 o=e.pathname.split("/").filter(Boolean);s=o.length?xn(o[o.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 xn(t){try{return decodeURIComponent(t)}catch{return t}}var Bt=["loading","ready","error","not-found"],ht=t=>t?.code==="NOT_FOUND",Kt=()=>["product","collection","products","recommendations"].map(t=>l(t)).join(","),Ee=(t,e)=>t===e||t.parentElement?.closest(Kt())===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"),Kt()).forEach(i=>{let s=p(i,"show");Bt.includes(s)&&T(i,s===e)}),(e==="error"||r)&&rt(t,l("add-to-cart"),Kt()).forEach(i=>{i.classList.add("is-disabled"),i.setAttribute("aria-disabled","true"),"disabled"in i&&(i.disabled=!0)})}var it=new WeakMap,Ze=()=>l("product");function An(t,e){let n=e.indexOf("."),r=e.slice(0,n),i=e.slice(n+1);return(t.metafields||[]).find(o=>o&&o.namespace===r&&o.key===i)||null}var Qt=new Map;function Gt(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)||(H(e,"quantity")?0:1)),this.plans=G(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(),$e(e,"product"),J("product"),$("product-ready",{product:n,scope:this},e)}update(e){let n=this.variant?.id;this.product=e,this.plans=G(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,Ze());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(o=>o.id===i);s&&(this.selected={},s.selectedOptions.forEach(o=>{this.selected[o.name]=o.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")||a.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(we(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(o=>o.name===e&&o.value===n));if(!r.length)return;let i={...this.selected,[e]:n};if(!r.some(s=>s.selectedOptions.every(o=>i[o.name]===o.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=H(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(Ze())===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 o=r.closest(`${l("purchase")}:not(select)`);if(e(o)){o.tagName!=="INPUT"&&n.preventDefault(),this.setPurchase(p(o,"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),B(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))&&Gt([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,ye(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 o=[...r.children].map(c=>c.tagName==="IMG"?c:c.querySelector("img"));if(!ve(r)&&o.length===n.images.nodes.length&&o.every((c,u)=>Mt(c?.getAttribute("src"),n.images.nodes[u].url)))return}return K(r,n.images.nodes,(o,c)=>{let u=o.matches(`img,${l("bind","image")}`)?o:o.querySelector("img")||o;j(u,c.url,c.altText||n.title)});case"tags":{let o=(r.getAttribute("exclude")||"").split(",").map(c=>c.trim()).filter(Boolean);return K(r,n.tags.filter(c=>!o.includes(c)),(c,u)=>S(c,u))}default:if(/^image:\d+$/.test(i)){let o=n.images.nodes[i.slice(6)-1]||n.featuredImage;return j(r,o?.url,o?.altText||n.title)}if(i.startsWith("metafield:")){let o=An(n,i.slice(10));return o?o.reference?.image?j(r,o.reference.image.url,o.reference.image.altText):(/^(rich_text|multi_line_text)_field$/.test(o.type)&&(r.style.whiteSpace="pre-line"),S(r,o.value)):S(r,"")}return}}),this.$(l("option-list")).forEach(r=>{let i=this.optName(p(r,"option-list")),s=n.options.find(o=>o.name===i);return!s||s.optionValues.length<=1&&H(r,"hide-single")?T(r,!1):K(r,s.optionValues,(o,c)=>{o.setAttribute(g("option-value"),c.name);let u=o.querySelector(l("bind","option-value"));u?S(u,c.name):o.firstElementChild||S(o,c.name);let f=o.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 T(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,o=this.plans.filter(c=>!s||c.group.name===s);K(r,o,(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(v=>V(n,v.id));d&&(this.planId=d.id)}let r=this.isSubscription,i=n.price,s=this.planId?$t(n,this.planId):null,o=r?s:i,c=r&&V(n,this.planId)?.priceAdjustments?.[0]?.compareAtPrice||n.compareAtPrice,u=c&&parseFloat(c.amount)>parseFloat(o.amount),f=u?Math.round((1-parseFloat(o.amount)/parseFloat(c.amount))*100):0,h=this.planId?Dt(n,this.planId):{amount:null,percentage:0},m=this.plan,C={amount:(parseFloat(o.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:o.currencyCode},y=D,O=d=>ge(d),at={price:()=>y(o),"total-price":()=>y(C),"one-time-price":()=>y(i),"subscription-price":()=>y(s),"subscription-savings":()=>O(h.percentage),"subscription-savings-amount":()=>y(h.amount),"checkout-charge":()=>{let d=r?he(n,this.planId):o;return d&&y({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?y(c):"","unit-price":()=>y(n.unitPrice),"discount-percentage":()=>`${f}%`,"discount-amount":()=>u?y({amount:String(parseFloat(c.amount)-parseFloat(o.amount)),currencyCode:o.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 v=p(d,"bind");v==="variant-image"?j(d,n.image?.url||e.featuredImage?.url,n.image?.altText||e.title):at[v]&&S(d,at[v]())}),this.$(l("option-selected")).forEach(d=>S(d,this.selected[this.optName(p(d,"option-selected"))]||"")),this.$(l("option-list")).forEach(d=>{let v=this.optName(p(d,"option-list"));w(d,l("option-value")).forEach(k=>{let X=p(k,"option-value");Pt(k,this.selected[v]===X);let I=!this.isValueAvailable(v,X);k.classList.toggle("is-unavailable",I),k.setAttribute("data-unavailable",I?"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 v=p(d,"purchase");Pt(d,v===this.purchase);let k=v==="subscription"?!this.subscriptionAvailable:e.requiresSellingPlan;d.classList.toggle("is-unavailable",k)}),this.$(l("plan-value")).forEach(d=>{let v=p(d,"plan-value"),k=this.plans.find(I=>I.id===v),X=!!V(n,v);Pt(d,r&&v===this.planId),d.classList.toggle("is-unavailable",!X),w(d,l("plan-bind")).forEach(I=>{let Z=fe(k),Me=Dt(n,v),dn=p(I,"plan-bind"),Ve={name:()=>k?.name,option:()=>(k?.options||[]).map(pn=>pn.value).join(", "),description:()=>k?.description,price:()=>y($t(n,v)),savings:()=>O(Me.percentage),"savings-amount":()=>y(Me.amount),adjustment:()=>Z?Z.type==="percentage"?`${Z.value}%`:y(Z.value):""}[dn];Ve&&S(I,Ve())})}),this.$(`select${l("plan")}`).forEach(d=>{d.value=r?this.planId:""});let b=n.quantityAvailable!=null&&n.quantityAvailable>0&&n.quantityAvailable<=(a.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 v=p(d,"show");v in N&&(Bt.includes(v)&&!Ee(d,this.root)||T(d,N[v]))}),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 v=!n.availableForSale;d.classList.toggle("is-disabled",v),d.setAttribute("aria-disabled",String(v)),"disabled"in d&&(d.disabled=v);let k=p(d,"soldout-text"),X=p(d,"subscribe-text");if(k||X){let I=d.querySelector(l("add-label"))||d;I.dataset.tetherLabel===void 0&&(I.dataset.tetherLabel=I.tagName==="INPUT"?I.value:I.textContent);let Z=I.dataset.tetherLabel;r&&X&&(Z=X),v&&k&&(Z=k),d.getAttribute("aria-busy")!=="true"&&S(I,Z)}}),$("variant-changed",{product:e,variant:n,selected:{...this.selected},purchase:this.purchase,sellingPlanId:r?this.planId:null},this.root)}};var Ie={};M(Ie,{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(),B(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"};return H(e,"collection")?n.collection=p(e,"collection"):n.query=p(e,"products")||"",n}async load(e=!1){let n=this.loadToken=(this.loadToken||0)+1,r=()=>n!==this.loadToken;try{if(H(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 o=await bt(i,p(this.root,"intent")||"RELATED");if(r())return;let c=parseInt(p(this.root,"limit")||"",10);this.products=c?o.slice(0,c):o}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)&&H(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=>{K(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"&&T(r,n),i==="list-filled"&&T(r,!n)}),this.$(l("load-more")).forEach(r=>T(r,!!this.pageInfo?.hasNextPage)),J("list")}};var Oe={};M(Oe,{hydrateFromPage:()=>qe,liveLists:()=>mt,liveProducts:()=>ft,mountProduct:()=>zt,mountedLists:()=>Wt,mountedProducts:()=>Ct,pruneLive:()=>Jt,retryFailed:()=>Te,settleMarket:()=>Yt,trackMarket:()=>Le,within:()=>dt});var Ct=new WeakSet,Wt=new WeakSet,ft=new Set,mt=new Set,tn=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={};tn.set(t,i);let s=()=>tn.get(t)===i;it.get(t)?t.setAttribute(g("state"),"updating"):Y(t,"loading");let o=nt(e);return Q?.add(o),o.then(c=>{if(!s())return;let u=it.get(t);u?u.update(c):new St(t,c),Pn(t,c),a.revalidate!==!1&&ue(e)&&Sn(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?L(`product not found: ${e}`):P(c,`product ${e}`)):(P(c,`product ${e}`),$("error",{error:c,context:"product",key:e},t))}),!0}function Pn(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 Te(){Jt(),ft.forEach(t=>{t.getAttribute(g("state"))!=="error"||t.getAttribute(g("error"))==="not-found"||(Ct.delete(t),zt(t))})}var Ht=new Set;function Sn(t){Ht.size||setTimeout(En,0),Ht.add(t)}function En(){let t=[...Ht];Ht=new Set,de(t).forEach((e,n)=>e.then(r=>{ft.forEach(i=>{let s=it.get(i);if(!s||!i.isConnected)return;let o=z(i).key;o!==t[n]&&o!==r.handle&&o!==r.id||JSON.stringify(s.product)!==JSON.stringify(r)&&s.update(r)})}).catch(r=>P(r,`refresh ${t[n]}`)))}var en=new WeakSet,Q=null,Le=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(`${a.prefix}-market-pending`)):Yt())})}function qe(t=document){w(t.ownerDocument||t,'script[type="application/json"][data-tether-hydrate]').forEach(e=>{if(!en.has(e)){en.add(e);try{let n=JSON.parse(e.textContent);Gt(n.products);let r=(i,s)=>String(i||"").toUpperCase()===String(s||"").toUpperCase();r(n.country,a.country)&&r(n.language,a.language)?le(n.products):(L("hydration skipped: other market"),Q||(Q=new Set,document.documentElement.classList.add(`${a.prefix}-market-pending`)))}catch(n){U("bad data-tether-hydrate",n)}}})}var{cfg:Cn}=Lt,nn={"config.js":Lt,"client.js":ne,"dom.js":xe,"fragments.js":ie,"loader.js":pe,"selling-plans.js":xt,"status.js":Ce,"cart.js":Se,"product.js":ke,"collection.js":Ie,"mounting.js":Oe},Ne=typeof document<"u"&&document.currentScript?.src||"",kt={};function q(t){if(kt[t])return kt[t];let e=Cn.partsUrl||Ne.replace(/[^/]*$/,""),n=/\.min\.js(\?|$)/.test(Ne)||!Ne?".min":"",r=`${e.replace(/\/?$/,"/")}tether.${t}${n}.js`;return kt[t]=new Promise((i,s)=>{let o=document.createElement("script");o.src=r,o.async=!0,o.onload=()=>window.Tether?.__parts?.[t]?i(window.Tether.__parts[t]):s(new Error(`${r} did not register`)),o.onerror=()=>{delete kt[t],s(new Error(`Could not load ${r}. Host it next to the Tether script, or set partsUrl.`))},document.head.appendChild(o)}),kt[t]}var rn="0.6.0",st=null,Fe=null;function pt(t=document){if(!Tt())return 0;let e=0;return Jt(),qe(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(`${a.prefix}:list-rendered`,i=>pt(i.detail.container)),Le(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")),(a.account?.clientId||a.account?.server)&&(dt(t,`[${g("account-login")}],[${g("account-bind")}],[${g("orders")}],[${g("show")}^="logged-"]`).length||/[?&]code=/.test(window.location.search)||Ln())&&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")),w(t,l("account-link")).forEach(n=>{n.setAttribute("href",`https://${a.domain}/account`)}),Yt(),A.render(),L(`mounted ${e} scope(s)`,t),e}function on(){A.close()}function kn(t){let e=t?.closest?.(l("product"));return e&&it.get(e)||null}var sn=!1;function In(){sn||(sn=!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(),B(n,()=>A.clear().catch(c=>P(c,"cart clear")));return}let r=e.closest(l("checkout"));if(r){t.preventDefault(),B(r,()=>A.checkout());return}let i=e.closest(an());if(i&&i.closest(l("cart-lines"))){let c=i.getAttribute(`data-${a.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 o=e.closest(l("group-add"));o&&(t.preventDefault(),B(o,()=>cn(o)))}),document.addEventListener("change",t=>{let e=t.target;if(!e?.closest)return;let n=e.closest(an()),r=n?.getAttribute(`data-${a.prefix}-key`),i=(s,o)=>{n.classList.add("is-busy"),n.setAttribute("aria-busy","true"),s.catch(c=>P(c,o))};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&&Ue(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&&B(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=>{a.domain&&t.key?.startsWith(`${a.prefix}:`)&&q("extras").then(e=>e.onStorage(t)).catch(()=>{})}),document.addEventListener(`${a.prefix}:variant-changed`,t=>{let e=t.target;(a.variantUrl||e.hasAttribute?.(g("variant-url")))&&q("extras").then(n=>n.writeVariantUrl(e,t.detail)).catch(()=>{})}),a.astro!==!1&&(document.addEventListener("astro:page-load",()=>(st||Promise.resolve()).then(()=>{let t=_e();if(!t&&De){try{t=JSON.parse(localStorage.getItem(`${a.prefix}:market:${a.domain}`)||"null")}catch{t=null}t=t?.country?t:un}De=!!_e(),t?.country&&(String(t.country).toUpperCase()!==String(a.country||"").toUpperCase()||String(t.language||"").toUpperCase()!==String(a.language||"").toUpperCase())?Ue(t.country,{language:t.language??null,locale:t.locale,remember:!1}).then(()=>pt(document),()=>pt(document)):pt(document)})),document.addEventListener("astro:before-swap",()=>on())),window.addEventListener("online",()=>{Te(),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"||a.cartFocus===!1)return;let e=A.drawers().find(s=>s.classList.contains(a.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 an(){return`[data-${a.prefix}-key]`}var cn=t=>q("extras").then(e=>e.addGroup(t)),It=null;function ln(t={}){return st&&!Object.keys(t).length?st:(Zt({...window.TETHER_CONFIG||{},...t}),Tt()?(In(),a.observe&&On(),a.analytics&&!It&&(It=[],["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"].forEach(e=>document.addEventListener(`${a.prefix}:${e}`,n=>It.push(n))),document.addEventListener("astro:page-load",()=>It.push(new CustomEvent(`${a.prefix}:page`))),q("analytics").then(e=>e.startAnalytics(It)).catch(e=>P(e,"analytics"))),st=Tn(t).then(()=>A.init()).then(async e=>{let n=a.country?String(a.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}),je}),st):(U("TETHER_CONFIG is missing domain or token. Tether is idle."),st=Promise.resolve(null),st))}function _e(t=document){let e=r=>t.querySelector(`meta[name="${a.prefix}-page-${r}"]`)?.getAttribute("content")||void 0,n=e("country");return n?{country:n.toUpperCase(),language:e("language"),locale:e("locale")}:null}var un=null,De=!1;async function Tn(t){let e=a.markets||{};un={country:a.country,language:a.language,locale:a.locale};let n=_e();if(De=!!n,n){a.country=n.country,a.language=n.language?n.language.toUpperCase():void 0,n.locale&&(a.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(`${a.prefix}:market:${a.domain}`)||"null")}catch{}r&&!/^[A-Z]{2}$/.test(r.country||"")&&(r=null)}r&&(r.country&&(a.country=r.country),r.language&&(a.language=r.language),r.locale&&!t.locale&&(a.locale=r.locale),L("market",r))}function Ln(){try{return!!(sessionStorage[`${a.prefix}:account:${a.domain}`]||localStorage[`${a.prefix}:account:${a.domain}`]||localStorage[`${a.prefix}:account-hint:${a.domain}`])}catch{return!1}}var qn=new Proxy({},{get:(t,e)=>(...n)=>q("account").then(r=>r[e](...n))});function Ue(t,e){return q("markets").then(n=>n.setCountry(t,e))}function On(){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 je={VERSION:rn,init:ln,mount:pt,unmount:on,get config(){return a},get ready(){return st||Promise.resolve(null)},query:F,withContext:Ot,cart:A,getProduct:nt,getProducts:vt,getRecommendations:bt,getScope:kn,addGroup:cn,account:qn,primeProduct:et,normalizeProductKey:ct,clearProductCache:ce,formatMoney:D,imageUrl:jt,plans:xt,TetherError:E,resolveProductKey:z,setCountry:Ue,detectMarket:t=>q("markets").then(e=>e.detectMarket(t||a.markets)),getLocalization:()=>q("markets").then(t=>t.getLocalization()),diagnose:t=>q("diagnose").then(e=>e.diagnose({...t,version:rn})),__core:nn,__parts:{},on(t,e){let n=r=>e(r.detail,r);return document.addEventListener(`${a.prefix}:${t}`,n),()=>document.removeEventListener(`${a.prefix}:${t}`,n)}},Pr=je;if(typeof window<"u"&&typeof document<"u"&&(window.Tether=je,window.TETHER_CONFIG&&window.TETHER_CONFIG.autoMount!==!1&&!window.TETHER_INTEGRATION)){let e=()=>ln().then(()=>pt(document));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}})();
|
|
5
5
|
//# sourceMappingURL=tether.min.js.map
|