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