@occluze/tether 0.7.0 → 0.7.1

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 (132) hide show
  1. package/README.md +21 -21
  2. package/dist/esm/chunks/{account-UIPWJQ3Y.js → account-CXMA5RPZ.js} +1 -1
  3. package/dist/esm/chunks/{account-pages-6ROA6Y4V.js → account-pages-IZO7FEOZ.js} +1 -1
  4. package/dist/esm/chunks/{analytics-2V632IRV.js → analytics-PG5FPRDN.js} +1 -1
  5. package/dist/esm/chunks/{chunk-4GCXM764.js → chunk-4HD4J5JC.js} +1 -1
  6. package/dist/esm/chunks/{chunk-BFTZR4OB.js → chunk-6TFMLT4A.js} +2 -2
  7. package/dist/esm/chunks/{chunk-T44MUL4Y.js → chunk-BBVUVPMO.js} +1 -1
  8. package/dist/esm/chunks/chunk-EW5SYO6L.js +1 -0
  9. package/dist/esm/chunks/chunk-HJY2JSNB.js +1 -0
  10. package/dist/esm/chunks/chunk-MQYB6BH4.js +1 -0
  11. package/dist/esm/chunks/{chunk-5Z5O3767.js → chunk-N3V45JPS.js} +1 -1
  12. package/dist/esm/chunks/{chunk-YLUULATY.js → chunk-RPMBCAGS.js} +1 -1
  13. package/dist/esm/chunks/{chunk-MPDWM2NN.js → chunk-VFNHIGCS.js} +1 -1
  14. package/dist/esm/chunks/{chunk-6OZJCAGZ.js → chunk-WT7RGGJU.js} +1 -1
  15. package/dist/esm/chunks/chunk-YN6LEBEN.js +1 -0
  16. package/dist/esm/chunks/chunk-Z6HS3H7K.js +1 -0
  17. package/dist/esm/chunks/{diagnose-3FEKRIEK.js → diagnose-XCEBQKBO.js} +1 -1
  18. package/dist/esm/chunks/extras-4HU3VSBQ.js +1 -0
  19. package/dist/esm/chunks/{markets-ui-FD6NI2OG.js → markets-ui-M4IQ62CT.js} +1 -1
  20. package/dist/esm/chunks/search-A5DS2IOS.js +1 -0
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/server.js +2 -2
  23. package/dist/tether.account-pages.js +13 -3
  24. package/dist/tether.account-pages.min.js +1 -1
  25. package/dist/tether.account.js +13 -3
  26. package/dist/tether.account.min.js +1 -1
  27. package/dist/tether.analytics.js +18 -3
  28. package/dist/tether.analytics.min.js +1 -1
  29. package/dist/tether.diagnose.js +18 -3
  30. package/dist/tether.diagnose.min.js +2 -2
  31. package/dist/tether.extras.js +19 -6
  32. package/dist/tether.extras.min.js +1 -1
  33. package/dist/tether.js +162 -112
  34. package/dist/tether.markets.js +18 -3
  35. package/dist/tether.markets.min.js +1 -1
  36. package/dist/tether.min.js +3 -3
  37. package/dist/tether.min.js.map +4 -4
  38. package/dist/tether.search.js +18 -3
  39. package/dist/tether.search.min.js +1 -1
  40. package/dist/types/server/src/shared/cart-id.d.ts +2 -0
  41. package/dist/types/src/cart/mutations.d.ts +6 -0
  42. package/dist/types/src/cart/store.d.ts +5 -2
  43. package/dist/types/src/cart.d.ts +2 -2
  44. package/dist/types/src/client.d.ts +53 -19
  45. package/dist/types/src/config.d.ts +6 -1
  46. package/dist/types/src/index.d.ts +2 -2
  47. package/dist/types/src/product-shape.d.ts +3 -1
  48. package/package.json +1 -2
  49. package/dist/esm/chunks/chunk-56FCLJJD.js +0 -1
  50. package/dist/esm/chunks/chunk-A5SYCVQM.js +0 -1
  51. package/dist/esm/chunks/chunk-BA4LQJJQ.js +0 -1
  52. package/dist/esm/chunks/chunk-C5JYQCWH.js +0 -1
  53. package/dist/esm/chunks/extras-6POFBNOP.js +0 -1
  54. package/dist/esm/chunks/search-UJ73YBQ5.js +0 -1
  55. package/src/account/addresses-view.ts +0 -58
  56. package/src/account/answers.ts +0 -79
  57. package/src/account/markup.ts +0 -36
  58. package/src/account/operations.ts +0 -145
  59. package/src/account/order-lines.ts +0 -75
  60. package/src/account/order-list.ts +0 -107
  61. package/src/account/order-page.ts +0 -137
  62. package/src/account/page-answers.ts +0 -317
  63. package/src/account/page-events.ts +0 -253
  64. package/src/account/server-client.ts +0 -183
  65. package/src/account/subscriptions-view.ts +0 -115
  66. package/src/account-api.ts +0 -98
  67. package/src/account-marks.ts +0 -35
  68. package/src/account-pages.ts +0 -81
  69. package/src/account.ts +0 -284
  70. package/src/amounts.ts +0 -64
  71. package/src/analytics-shopify.ts +0 -246
  72. package/src/analytics.ts +0 -315
  73. package/src/api-version.ts +0 -79
  74. package/src/astro.ts +0 -272
  75. package/src/cart/cart-shape.ts +0 -25
  76. package/src/cart/checkout.ts +0 -101
  77. package/src/cart/drawer.ts +0 -125
  78. package/src/cart/mutations.ts +0 -237
  79. package/src/cart/render.ts +0 -266
  80. package/src/cart/store.ts +0 -279
  81. package/src/cart.ts +0 -345
  82. package/src/client.ts +0 -391
  83. package/src/collection.ts +0 -175
  84. package/src/config-sections.ts +0 -284
  85. package/src/config.ts +0 -480
  86. package/src/controls/cart-controls.ts +0 -123
  87. package/src/controls/discount.ts +0 -75
  88. package/src/controls/extras.ts +0 -54
  89. package/src/controls/navigation.ts +0 -77
  90. package/src/diagnose-markup.ts +0 -298
  91. package/src/diagnose.ts +0 -294
  92. package/src/dom.ts +0 -268
  93. package/src/extras.ts +0 -136
  94. package/src/fragments.ts +0 -261
  95. package/src/globals.d.ts +0 -15
  96. package/src/images.ts +0 -91
  97. package/src/index.ts +0 -415
  98. package/src/initial.ts +0 -101
  99. package/src/lazy-iife.ts +0 -197
  100. package/src/lazy.ts +0 -42
  101. package/src/loader.ts +0 -363
  102. package/src/market-codes.ts +0 -6
  103. package/src/markets-ui.ts +0 -227
  104. package/src/markets.ts +0 -246
  105. package/src/markup.ts +0 -127
  106. package/src/mounting.ts +0 -264
  107. package/src/page-market.ts +0 -110
  108. package/src/part-integrity.ts +0 -7
  109. package/src/parts/account-pages.ts +0 -7
  110. package/src/parts/account.ts +0 -7
  111. package/src/parts/analytics.ts +0 -7
  112. package/src/parts/diagnose.ts +0 -7
  113. package/src/parts/extras.ts +0 -7
  114. package/src/parts/markets.ts +0 -7
  115. package/src/parts/search.ts +0 -7
  116. package/src/presets/barba.ts +0 -194
  117. package/src/product-events.ts +0 -115
  118. package/src/product-render.ts +0 -218
  119. package/src/product-shape.ts +0 -49
  120. package/src/product-state.ts +0 -318
  121. package/src/product.ts +0 -308
  122. package/src/repeaters.ts +0 -161
  123. package/src/search.ts +0 -305
  124. package/src/selling-plans.ts +0 -145
  125. package/src/server.ts +0 -211
  126. package/src/shopify-values.ts +0 -91
  127. package/src/status.ts +0 -106
  128. package/src/storage.ts +0 -34
  129. package/src/store-html.ts +0 -359
  130. package/src/storefront/catalog.ts +0 -196
  131. package/src/storefront/json-ld.ts +0 -144
  132. package/src/variant-render.ts +0 -139
@@ -0,0 +1 @@
1
+ import{c as b}from"./chunk-EW5SYO6L.js";import"./chunk-RPMBCAGS.js";import{a as S}from"./chunk-YN6LEBEN.js";import"./chunk-BBVUVPMO.js";import"./chunk-VFNHIGCS.js";import"./chunk-Z6HS3H7K.js";import{e as p}from"./chunk-HJY2JSNB.js";import"./chunk-6TFMLT4A.js";import{O as w,P as k,n as s,o as d,p as m,q as y,u as h}from"./chunk-MQYB6BH4.js";import{d as f,r as u,y as g,z as l}from"./chunk-E5YO6274.js";function M(t,r){let e=k(w(t,"line-attributes"));return r?[{key:"_group",value:r},...e]:e}async function K(t){let r=t.closest(s("group"));if(!r)return null;let e=d(r,"group"),n=M(r,e),o=y(r,s("product")).flatMap(i=>{let a=S.get(i);if(!a?.variant?.availableForSale||a.quantity<=0)return[];let c=a.getLine();return c?[{...c,attributes:[...c.attributes??[],...n]}]:[]});if(!o.length)return g("group-add: nothing selected"),null;try{let i=await p.add(o);return h("group-added",{group:e,lines:o},r),i}catch(i){return l(i,"group add"),null}}function x(t){let r;try{r=JSON.parse(t)}catch{return null}if(!f(r))return null;let{country:e,language:n,locale:o}=r;return typeof e!="string"||!e?null:{country:e,language:typeof n=="string"?n:null,locale:typeof o=="string"?o:void 0}}function L(t){if(t.key===u.storageKey||t.key===`${u.storageKey}:seen`){p.init().catch(n=>{l(n,"cart from another tab")});return}if(t.key!==`${u.prefix}:market:${u.domain}`||!t.newValue)return;let r=x(t.newValue);if(!r)return;let e={language:r.language,locale:r.locale,remember:!1};b(r.country,e).catch(n=>{l(n,"market from another tab")})}var v=new WeakMap,E=t=>t.split("/").pop()??t;function U(t){try{window.history.replaceState(window.history.state,"",t)}catch{}}function R(t,{variant:r,sellingPlanId:e}){let n=`${r.id}|${e??""}`,o=v.get(t);if(v.set(t,n),!o||o===n)return;let i=u.variantUrl&&document.querySelector(s("product"))===t;if(!m(t,"variant-url")&&!i)return;let a=new URL(window.location.href);a.searchParams.set("variant",E(r.id)),e?a.searchParams.set("selling_plan",E(e)):a.searchParams.delete("selling_plan"),U(a)}export{K as addGroup,L as onStorage,R as writeVariantUrl};
@@ -1 +1 @@
1
- import{b as F,c as I}from"./chunk-YLUULATY.js";import{a as E,c as P,e as k,f as T,g as A,h as p,i as x}from"./chunk-4GCXM764.js";import"./chunk-56FCLJJD.js";import"./chunk-T44MUL4Y.js";import"./chunk-MPDWM2NN.js";import{e as u}from"./chunk-A5SYCVQM.js";import{w}from"./chunk-BFTZR4OB.js";import{a as L,d as h,h as b,l as s,m as C,n as v,t as z}from"./chunk-BA4LQJJQ.js";import{o as f,p as g,r as a,z as y}from"./chunk-E5YO6274.js";var _="{name} ({currency})",j="name",d=null;function B(){d=null}var D="query TetherLocalization{localization{country{isoCode name currency{isoCode symbol}}language{isoCode name}availableCountries{isoCode name currency{isoCode symbol}availableLanguages{isoCode name}}}}",O={isoCode:"string",name:"string",currency:"object"},H=h({localization:{country:O,availableCountries:[O]}});function R(){return d??(d=b(D,{},H).then(e=>e.localization,e=>{throw d=null,e})),d}function U(e,n){switch(n){case"name":return e.name;case"code":return e.isoCode;case"currency":return e.currency.isoCode;case"symbol":return e.currency.symbol;default:return""}}var Y=(e,n)=>e.replace(/\{(name|code|currency|symbol)\}/g,(o,i)=>U(n,i));function q(e,n,o){let i=e.getAttribute(s("country-label"))||_,r=(e.getAttribute(s("countries"))||"").toUpperCase().split(/[\s,]+/).filter(Boolean),c=r.length?r.map(t=>n.find(l=>l.isoCode===t)).filter(t=>t!==void 0):n;e.replaceChildren(...c.map(t=>new Option(Y(i,t),t.isoCode))),e.value=o,e.value!==o&&(e.selectedIndex=-1),e.disabled=c.length<2&&!e.hasAttribute(s("always-enabled"))}function $(e,n,o){let i=(a.country||o.country.isoCode).toUpperCase(),r=[...o.availableCountries].sort((t,l)=>t.name.localeCompare(l.name,a.locale||void 0)),c=r.find(t=>t.isoCode===i)??o.country;e.forEach(t=>{q(t,r,i)}),n.forEach(t=>{t.textContent=U(c,v(t,"country-bind")||j)})}function S(e=document){let n=p(e,`select${C("country-select")}`),o=p(e,C("country-bind"));return!n.length&&!o.length?Promise.resolve():R().then(i=>{$(n,o,i)}).catch(i=>{y(i,"country select")})}var Q=e=>Object.values(a.markets?.locales??{}).find(n=>f(n.country)===e);function V(e,n){return e!==void 0?g(e):n?n.language?g(n.language):void 0:a.language}function Z(e){w();let n=[];return u.id()&&n.push(u.setBuyerIdentity({countryCode:e},{create:!1}).catch(o=>{y(o,"cart country")})),A(),T.forEach(o=>n.push(o.load())),k.forEach(o=>{o.closest(E())||(P.delete(o),x(o))}),n}async function re(e,{language:n,locale:o,remember:i=!0}={}){let r=f(e);if(!r)throw new L(`Not a country code: ${e}`,{code:"INVALID_COUNTRY"});let c=Q(r),t=o||c?.locale,l=t||a.locale,m=V(n,c),M=r!==a.country||m!==a.language||l!==a.locale;if(a.country=r,a.language=m||void 0,a.locale=l,i&&I({country:r,language:m,locale:t}),!M)return S(),u.state;n!==void 0&&B();let N=Z(r);return S(),z("country-changed",{country:r,language:a.language}),await Promise.all(N),u.state}export{F as detectMarket,R as getLocalization,S as renderCountrySelects,re as setCountry};
1
+ import{a as E,c as P,e as k,f as T,g as A,h as p,i as x}from"./chunk-4HD4J5JC.js";import{b as F,c as I}from"./chunk-RPMBCAGS.js";import"./chunk-YN6LEBEN.js";import"./chunk-BBVUVPMO.js";import"./chunk-VFNHIGCS.js";import{e as u}from"./chunk-HJY2JSNB.js";import{w}from"./chunk-6TFMLT4A.js";import{a as L,d as h,i as b,m as s,n as C,o as v,u as z}from"./chunk-MQYB6BH4.js";import{o as f,p as g,r as a,z as y}from"./chunk-E5YO6274.js";var _="{name} ({currency})",j="name",d=null;function B(){d=null}var D="query TetherLocalization{localization{country{isoCode name currency{isoCode symbol}}language{isoCode name}availableCountries{isoCode name currency{isoCode symbol}availableLanguages{isoCode name}}}}",O={isoCode:"string",name:"string",currency:"object"},H=h({localization:{country:O,availableCountries:[O]}});function R(){return d??(d=b(D,{},H).then(e=>e.localization,e=>{throw d=null,e})),d}function U(e,n){switch(n){case"name":return e.name;case"code":return e.isoCode;case"currency":return e.currency.isoCode;case"symbol":return e.currency.symbol;default:return""}}var Y=(e,n)=>e.replace(/\{(name|code|currency|symbol)\}/g,(o,i)=>U(n,i));function q(e,n,o){let i=e.getAttribute(s("country-label"))||_,r=(e.getAttribute(s("countries"))||"").toUpperCase().split(/[\s,]+/).filter(Boolean),c=r.length?r.map(t=>n.find(l=>l.isoCode===t)).filter(t=>t!==void 0):n;e.replaceChildren(...c.map(t=>new Option(Y(i,t),t.isoCode))),e.value=o,e.value!==o&&(e.selectedIndex=-1),e.disabled=c.length<2&&!e.hasAttribute(s("always-enabled"))}function $(e,n,o){let i=(a.country||o.country.isoCode).toUpperCase(),r=[...o.availableCountries].sort((t,l)=>t.name.localeCompare(l.name,a.locale||void 0)),c=r.find(t=>t.isoCode===i)??o.country;e.forEach(t=>{q(t,r,i)}),n.forEach(t=>{t.textContent=U(c,v(t,"country-bind")||j)})}function S(e=document){let n=p(e,`select${C("country-select")}`),o=p(e,C("country-bind"));return!n.length&&!o.length?Promise.resolve():R().then(i=>{$(n,o,i)}).catch(i=>{y(i,"country select")})}var Q=e=>Object.values(a.markets?.locales??{}).find(n=>f(n.country)===e);function V(e,n){return e!==void 0?g(e):n?n.language?g(n.language):void 0:a.language}function Z(e){w();let n=[];return u.id()&&n.push(u.setBuyerIdentity({countryCode:e},{create:!1}).catch(o=>{y(o,"cart country")})),A(),T.forEach(o=>n.push(o.load())),k.forEach(o=>{o.closest(E())||(P.delete(o),x(o))}),n}async function re(e,{language:n,locale:o,remember:i=!0}={}){let r=f(e);if(!r)throw new L(`Not a country code: ${e}`,{code:"INVALID_COUNTRY"});let c=Q(r),t=o||c?.locale,l=t||a.locale,m=V(n,c),M=r!==a.country||m!==a.language||l!==a.locale;if(a.country=r,a.language=m||void 0,a.locale=l,i&&I({country:r,language:m,locale:t}),!M)return S(),u.state;n!==void 0&&B();let N=Z(r);return S(),z("country-changed",{country:r,language:a.language}),await Promise.all(N),u.state}export{F as detectMarket,R as getLocalization,S as renderCountrySelects,re as setCountry};
@@ -0,0 +1 @@
1
+ import{h as M}from"./chunk-4HD4J5JC.js";import"./chunk-YN6LEBEN.js";import"./chunk-BBVUVPMO.js";import"./chunk-VFNHIGCS.js";import"./chunk-HJY2JSNB.js";import"./chunk-6TFMLT4A.js";import{B as x,D as C,G as q,I as d,c as S,d as E,i as T,m as A,n as o,o as m,q as h,u as I,x as L,z as w}from"./chunk-MQYB6BH4.js";import{b as a,r as u,x as b,z as y}from"./chunk-E5YO6274.js";var N=E({predictiveSearch:S({products:[{priceRange:"object"}],collections:["object"],queries:[{text:"string"}]})}),U="query TetherPredictive($q:String!,$limit:Int!){predictiveSearch(query:$q,limit:$limit,limitScope:EACH,types:[PRODUCT,COLLECTION,QUERY]){products{id handle title availableForSale featuredImage{url altText}priceRange{minVariantPrice{amount currencyCode}}}collections{handle title image{url altText}}queries{text}}}",D=6,V=2,F="/search",R=new WeakSet,v=0;function $(s,t,e){return parseInt(m(s,t)||"",10)||e}var H=s=>s.tagName==="A"?s:s.querySelector("a");function p(s,t){h(s,o("search-bind")).forEach(e=>{let i=m(e,"search-bind");i==="image"?L(e,t.image?.url,t.image?.altText||t.title):(i==="title"||i==="price"||i==="text")&&t[i]!=null&&q(e,t[i])})}function k(s,t){let e=H(s);e&&(t&&e.setAttribute("href",t),e.setAttribute("role","option"))}var f=class{constructor(t,e,i){a(this,"root");a(this,"input");a(this,"results");a(this,"limit");a(this,"minCharacters");a(this,"resultsId");a(this,"searchNumber",0);a(this,"timer");a(this,"lastTerm","");a(this,"cache",new Map);this.root=t,this.input=e,this.results=i,this.limit=$(t,"search-limit",D),this.minCharacters=$(t,"search-min",V),i.id||(v+=1,i.id=`${u.prefix}-search-${v}`),this.resultsId=i.id,this.setUpAria(),this.listen()}setUpAria(){this.input.setAttribute("role","combobox"),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("aria-controls",this.resultsId),this.input.setAttribute("aria-expanded","false"),this.input.setAttribute("autocomplete","off"),this.results.hasAttribute("role")||this.results.setAttribute("role","listbox"),this.results.hidden=!0}listen(){this.input.addEventListener("input",()=>{let t=this.input.value.trim();t!==this.lastTerm&&(this.lastTerm=t,clearTimeout(this.timer),this.timer=setTimeout(()=>void this.search(t),u.searchDelay))}),this.input.addEventListener("focus",()=>{this.input.value.trim().length>=this.minCharacters&&this.options().length&&this.open(!0)}),this.input.addEventListener("keydown",t=>{this.onKeydown(t)}),document.addEventListener("click",t=>{this.root.contains(t.target)||this.open(!1)})}setState(t){this.root.setAttribute(A("search-state"),t)}open(t){this.root.classList.toggle("is-open",t),this.results.hidden=!t,this.input.setAttribute("aria-expanded",String(t)),t||this.input.removeAttribute("aria-activedescendant")}options(){return h(this.results,'[role="option"]')}async fetchResults(t){let e=this.cache.get(t);if(e)return e;let i=await T(U,{q:t,limit:this.limit},N);return this.cache.set(t,i.predictiveSearch),i.predictiveSearch}async search(t){this.searchNumber+=1;let e=this.searchNumber;if(t.length<this.minCharacters){this.open(!1),this.setState("idle");return}this.setState("loading");try{let i=await this.fetchResults(t);e===this.searchNumber&&this.render(i,t)}catch(i){if(e!==this.searchNumber){b("a superseded search failed",i);return}this.setState("error"),y(i,"search")}}fillList(t,e,i){h(this.results,o(t)).forEach(l=>{w(l,e,i),d(l,e.length>0)})}queryUrl(t){let e=this.root.getAttribute("action")||F,i=e.includes("?")?"&":"?";return`${e}${i}${this.input.name||"q"}=${encodeURIComponent(t)}`}render(t,e){let i=t?.products??[],l=t?.collections??[],c=(t?.queries??[]).filter(n=>n.text.toLowerCase()!==e.toLowerCase());this.fillList("search-products",i,(n,r)=>{let P=C(r.priceRange.minVariantPrice);p(n,{title:r.title,price:P,image:r.featuredImage}),k(n,x(r.handle,r.id)),n.classList.toggle("is-sold-out",!r.availableForSale)}),this.fillList("search-collections",l,(n,r)=>{p(n,{title:r.title,image:r.image}),k(n,`${(u.collectionPath||"/collection").replace(/\/$/,"")}/${r.handle}`)}),this.fillList("search-queries",c,(n,r)=>{p(n,{text:r.text}),H(n)?.setAttribute("href",this.queryUrl(r.text))});let g=i.length+l.length+c.length;this.showCount(g),this.setState(g?"ready":"empty"),this.open(!0),I("search",{term:e,products:i,collections:l,queries:c},this.root)}showCount(t){h(this.root,o("show")).forEach(e=>{let i=m(e,"show");i==="search-empty"&&d(e,t===0),i==="search-results"&&d(e,t>0)}),this.options().forEach((e,i)=>{e.id||(e.id=`${this.resultsId}-${i}`),e.setAttribute("aria-selected","false")})}highlight(t,e){t.forEach((l,c)=>{l.setAttribute("aria-selected",String(c===e))});let i=t[e];i&&(this.input.setAttribute("aria-activedescendant",i.id),i.scrollIntoView?.({block:"nearest"}))}onKeydown(t){let e=this.options(),i=e.findIndex(l=>l.getAttribute("aria-selected")==="true");t.key==="ArrowDown"&&e.length?(t.preventDefault(),this.open(!0),this.highlight(e,(i+1)%e.length)):t.key==="ArrowUp"&&e.length?(t.preventDefault(),this.highlight(e,i<=0?e.length-1:i-1)):t.key==="Enter"&&i>=0?(t.preventDefault(),e[i]?.click()):t.key==="Escape"&&this.open(!1)}};function j(s=document){for(let t of M(s,o("search"))){if(R.has(t))continue;R.add(t);let e=t.querySelector(o("search-input"))??t.querySelector("input"),i=t.querySelector(o("search-results"));e&&i&&new f(t,e,i)}}export{j as mountSearch};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as x}from"./chunks/chunk-YLUULATY.js";import{a as at,b as st,d as b,f as w,g as S,h as p,i as ut,j as ct,k as lt,l as L,m as T}from"./chunks/chunk-4GCXM764.js";import{a as it}from"./chunks/chunk-56FCLJJD.js";import"./chunks/chunk-T44MUL4Y.js";import{a as ot}from"./chunks/chunk-MPDWM2NN.js";import{a as dt,b as mt,c as ft}from"./chunks/chunk-6OZJCAGZ.js";import{a as c,b as pt}from"./chunks/chunk-C5JYQCWH.js";import{a as Y,b as rt,e as s}from"./chunks/chunk-A5SYCVQM.js";import{D as et,E as nt,o as W,t as J,u as X,v as Z,w as tt}from"./chunks/chunk-BFTZR4OB.js";import{C as Q,J as P,M as f,a as k,f as B,j,l as d,m as i,r as z,s as y,t as h,u as K}from"./chunks/chunk-BA4LQJJQ.js";import{e as F,o as V,p as U,r as o,s as _,v as G,w as v,x as g,y as q,z as u}from"./chunks/chunk-E5YO6274.js";var yt={country:void 0,language:void 0,locale:void 0},M=!1;function ht(){let t=n=>document.querySelector(`meta[name="${o.prefix}-page-${n}"]`)?.getAttribute("content")||void 0,e=V(t("country"));return e?{country:e,language:U(t("language"))??void 0,locale:t("locale")}:null}async function Vt(){let t=o.markets??{};if(t.detect===!1)return null;if(!t.detect)return t.remember===!1?null:x();try{return(await c("markets")).detectMarket(t)}catch(e){return u(e,"markets"),null}}async function Et(t){yt={country:o.country,language:o.language,locale:o.locale};let e=ht();if(M=e!==null,e){o.country=e.country,o.language=e.language,e.locale&&(o.locale=e.locale);return}let n=await Vt();n&&(n.country&&(o.country=n.country),n.language&&(o.language=n.language),n.locale&&!t.locale&&(o.locale=n.locale),g("market",n))}var gt=(t,e)=>(t??"").toUpperCase()===(e??"").toUpperCase();function vt(){let t=ht(),e=t===null&&M;M=t!==null;let n=t??(e?x()??yt:null);return!n?.country||gt(n.country,o.country)&&gt(n.language,o.language)?null:{country:n.country,language:n.language,locale:n.locale}}function E(t,e){return c("markets").then(n=>n.setCountry(t,e))}var Ut=["account-login","account-bind","account-link","orders","order","addresses","subscriptions","profile-form","address-form"],_t=()=>[...Ut.map(t=>`[${d(t)}]`),`[${d("show")}^="logged-"]`].join(",");function Gt(){return!!rt(dt())}function kt(t){!o.account||!(p(t,_t()).length>0||ft(new URLSearchParams(window.location.search).get("account"))||Gt())||c("account").then(n=>n.mountAccount(t)).catch(n=>{u(n,"account")})}function l(t){return(...e)=>c("account").then(n=>{let r=n[t];return r(...e)})}var Pt={login:l("login"),logout:l("logout"),isLoggedIn:l("isLoggedIn"),customer:l("customer"),orders:l("orders"),order:l("order"),updateProfile:l("updateProfile"),addresses:l("addresses"),saveAddress:l("saveAddress"),deleteAddress:l("deleteAddress"),subscriptions:l("subscriptions"),subscriptionAction:l("subscriptionAction"),requestReturn:l("requestReturn"),render:l("render"),mountAccount:l("mountAccount")};var wt=()=>`data-${o.prefix}-key`,At=t=>t instanceof window.Element;function bt(t){let e=t.closest(`[${wt()}]`),n=e?.getAttribute(wt());return e&&n?{line:e,id:n}:null}function C(t,e){t.catch(n=>{u(n,e)})}function qt(t,e){let n=bt(e);if(!n?.line.closest(i("cart-lines")))return;let{line:r,id:a}=n;if(e.closest(i("line-remove"))){t.preventDefault(),r.classList.add("is-busy"),C(s.removeLine(a),"cart line");return}let $=Bt(e);!$||!s.lines.some(Ft=>Ft.id===a)||(t.preventDefault(),C(s.changeQuantity(a,$),"cart line"))}function Bt(t){return t.closest(i("line-plus"))?1:t.closest(i("line-minus"))?-1:0}function jt(t){let{target:e}=t;if(!At(e))return;if(e.closest(i("cart-open"))){t.preventDefault(),s.toggle();return}if(e.closest(i("cart-close"))){t.preventDefault(),s.close();return}let n=e.closest(i("cart-clear"));if(n){t.preventDefault(),f(n,()=>s.clear().catch(a=>{u(a,"cart clear")}));return}let r=e.closest(i("checkout"));if(r){t.preventDefault(),f(r,()=>s.checkout());return}qt(t,e)}function Ct(t,e,n){t.classList.add("is-busy"),t.setAttribute("aria-busy","true"),C(e,n)}function zt(t){let{target:e}=t;if(!At(e))return;let n=bt(e);n&&e instanceof window.HTMLInputElement&&e.matches(i("line","quantity"))?Ct(n.line,s.updateLine(n.id,parseInt(e.value,10)||0),"cart line"):n&&e instanceof window.HTMLSelectElement&&e.matches(i("line-plan"))?Ct(n.line,s.updateLine(n.id,{sellingPlanId:e.value||null}),"cart line plan"):Kt(e)&&e.matches(i("cart-note"))&&C(s.setNote(e.value),"cart note")}var Kt=t=>t instanceof window.HTMLInputElement||t instanceof window.HTMLTextAreaElement||t instanceof window.HTMLSelectElement;function Qt(t){if(s.isOpen()){if(t.key==="Escape"){s.close();return}Y(t)}}function St(){document.addEventListener("click",jt),document.addEventListener("change",zt),document.addEventListener("keydown",Qt)}var O=t=>t instanceof window.Element;function Wt(t){let e=t.querySelector(i("discount-input"))??t.querySelector("input");return e instanceof window.HTMLInputElement?e:null}function Lt(t,e,n){t.classList.toggle("is-invalid",n),n?e?.setAttribute("aria-invalid","true"):e?.removeAttribute("aria-invalid")}async function Yt(t,e,n){try{await s.applyDiscount(n),Lt(t,e,!1),h("discount-applied",{code:n},t),e&&(e.value="")}catch(r){Lt(t,e,!0),r instanceof k&&r.code==="INVALID_DISCOUNT"?h("discount-invalid",{code:n},t):u(r,"discount")}}function Jt(t){let{target:e}=t,n=O(e)?e.closest(i("discount-form")):null;if(!n)return;t.preventDefault();let r=Wt(n),a=r?.value.trim();a&&f(n,()=>Yt(n,r,a))}function Xt(t){let{target:e}=t;if(!O(e))return;let n=e.closest(i("discount-form"));n&&(n.classList.remove("is-invalid"),e.removeAttribute("aria-invalid"))}function Zt(t){let{target:e}=t,n=O(e)?e.closest(i("discount-remove")):null;if(!n)return;t.preventDefault();let r=n.closest(i("discount-code"))?.getAttribute(d("discount-code"));r&&s.removeDiscount(r).catch(a=>{u(a,"discount")})}function Tt(){document.addEventListener("submit",Jt,!0),document.addEventListener("input",Xt),document.addEventListener("click",Zt)}var I=t=>c("extras").then(e=>e.addGroup(t)),N=t=>{u(t,"extras")};function te(t){let{target:e}=t,n=e instanceof window.Element?e.closest(i("group-add")):null;n&&(t.preventDefault(),f(n,()=>I(n)).catch(N))}function ee(t){!o.domain||!t.key?.startsWith(`${o.prefix}:`)||c("extras").then(e=>{e.onStorage(t)}).catch(N)}function ne(t){if(!y(t,"variant-changed"))return;let{target:e}=t;e instanceof window.Element&&(!o.variantUrl&&!e.hasAttribute(d("variant-url"))||c("extras").then(n=>{n.writeVariantUrl(e,t.detail)}).catch(N))}function xt(){document.addEventListener("click",te),window.addEventListener("storage",ee),document.addEventListener(`${o.prefix}:variant-changed`,ne)}var D=null;function Mt(){D=document.body}async function re(t){await t.ready();let e=vt();if(!e){D!==document.body&&t.mount(document);return}try{await E(e.country,{language:e.language??null,locale:e.locale,remember:!1})}catch(n){u(n,"country")}t.mount(document)}function oe(t){document.addEventListener("astro:page-load",()=>{re(t).catch(e=>{u(e,"page mount")})}),document.addEventListener("astro:before-swap",()=>{D=null,t.unmount()})}function ie(t){let{target:e}=t;!(e instanceof window.HTMLSelectElement)||!e.matches(i("country-select"))||e.value&&E(e.value).catch(n=>{u(n,"country")})}function ae(){ct(),w.forEach(t=>{t.root.getAttribute(d("state"))==="error"&&t.load()})}function Ot(t){o.astro&&oe(t),document.addEventListener("change",ie),window.addEventListener("online",ae)}var Nt="0.7.0",se=50;function ue(){let t=P("TETHER_CONFIG");return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}var m=null,R=null,Dt=null,It=!1;function ce(t){let e=0;return p(t,at()).forEach(n=>{if(b.has(n))return;b.add(n),e++;let r=new st(n);w.add(r),n.addEventListener(`${o.prefix}:list-rendered`,a=>{y(a,"list-rendered")&&A(a.detail.container)}),lt(r.load())}),e}function le(t){p(t,`${i("country-select")},${i("country-bind")}`).length&&c("markets").then(e=>e.renderCountrySelects(t)).catch(e=>{u(e,"markets")}),kt(t),p(t,i("search")).length&&c("search").then(e=>{e.mountSearch(t)}).catch(e=>{u(e,"search")})}function Rt(t){let e=ce(t);return p(t,i("product")).forEach(n=>{ut(n)&&e++}),le(t),e}function A(t=document){if(!v())return 0;t===document&&Mt(),S(),T(t.ownerDocument??document);let e=Rt(t);return L(),s.render(),g(`mounted ${e} scope(s)`,t),e}function de(t){let e=t.filter(r=>r.isConnected&&!t.some(a=>a!==r&&a.contains(r)));if(!e.length||!v())return;S(),e.forEach(r=>{T(r)});let n=e.reduce((r,a)=>r+Rt(a),0);L(),s.render(),g(`mounted ${n} scope(s) in ${e.length} added element(s)`)}function Ht(){s.close()}function me(t){let e=t?.closest(i("product"));return e?it.get(e)??null:null}function fe(){It||(It=!0,St(),Tt(),xt(),Ot({ready:()=>m??Promise.resolve(null),mount:A,unmount:Ht}))}function pe(){let t=[];Dt=t,z.forEach(e=>{document.addEventListener(`${o.prefix}:${e}`,n=>t.push(n))}),document.addEventListener("astro:page-load",e=>t.push(e)),c("analytics").then(e=>e.startAnalytics(t)).catch(e=>{u(e,"analytics")})}async function ge(t){let e=o.country,n=t?.buyerIdentity.countryCode;if(!t||!e||!n||n===e)return t;try{return await s.setBuyerIdentity({countryCode:e},{create:!1})}catch(r){return u(r,"cart country"),t}}function $t(t={}){return m&&!Object.keys(t).length?m:(G({...ue(),...t}),v()?(mt(),fe(),o.observe&&ye(),o.analytics&&!Dt&&pe(),m=Et(t).then(()=>s.init()).then(ge).then(e=>(h("ready",{cart:e}),H)),m):(q("TETHER_CONFIG is missing domain or token. Tether is idle."),m=Promise.resolve(null),m))}function ye(){if(R||typeof MutationObserver>"u")return;let t,e=new Set;R=new MutationObserver(n=>{n.forEach(r=>{r.addedNodes.forEach(a=>{a instanceof window.Element&&e.add(a)})}),clearTimeout(t),t=setTimeout(()=>{let r=[...e];e.clear(),de(r)},se)}),R.observe(document.body,{childList:!0,subtree:!0})}var he=t=>c("markets").then(e=>e.detectMarket(t??o.markets)),Ee=()=>c("markets").then(t=>t.getLocalization()),ve=t=>c("diagnose").then(e=>e.diagnose({...t,version:Nt}));function ke(t,e){let n=`${o.prefix}:${t}`,r=a=>{y(a,t)&&e(a.detail,a)};return document.addEventListener(n,r),()=>{document.removeEventListener(n,r)}}var Pe={VERSION:Nt,init:$t,mount:A,unmount:Ht,get config(){return _},get ready(){return m??Promise.resolve(null)},query:j,withContext:B,cart:s,getProduct:Z,getProducts:et,getRecommendations:nt,getScope:me,addGroup:I,account:Pt,primeProduct:X,normalizeProductKey:J,clearProductCache:tt,formatMoney:Q,imageUrl:K,plans:W,TetherError:k,resolveProductKey:ot,setCountry:E,detectMarket:he,getLocalization:Ee,diagnose:ve,on:ke},we={__core:pt,__parts:{}},H=Object.assign(Pe,we),vn=H;function Ce(){Reflect.set(window,"Tether",H);let t=P("TETHER_CONFIG");if(!t||F(t,"autoMount")===!1||P("TETHER_INTEGRATION"))return;let e=()=>{$t().then(()=>A(document)).catch(n=>{u(n,"init")})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}typeof window<"u"&&typeof document<"u"&&Ce();export{Nt as VERSION,I as addGroup,H as api,vn as default,me as getScope,$t as init,A as mount,E as setCountry,Ht as unmount};
1
+ import{a as nt,b as ot,d as T,f as w,g as C,h as p,i as rt,j as it,k as st,l as k,m as S}from"./chunks/chunk-4HD4J5JC.js";import{a as at,b as ct,c as h}from"./chunks/chunk-EW5SYO6L.js";import"./chunks/chunk-RPMBCAGS.js";import{a as et}from"./chunks/chunk-YN6LEBEN.js";import"./chunks/chunk-BBVUVPMO.js";import{a as tt}from"./chunks/chunk-VFNHIGCS.js";import{a as ut,b as lt,c as dt}from"./chunks/chunk-WT7RGGJU.js";import{a as l,b as mt}from"./chunks/chunk-Z6HS3H7K.js";import{a as z,b as Z,e as s}from"./chunks/chunk-HJY2JSNB.js";import{D as J,E as X,o as q,t as K,u as Q,v as W,w as Y}from"./chunks/chunk-6TFMLT4A.js";import{D as j,K as P,N as f,a as v,g as _,k as G,m as d,n as r,s as U,t as g,u as y,v as B}from"./chunks/chunk-MQYB6BH4.js";import{e as H,r as c,s as $,v as V,w as E,x as L,y as F,z as a}from"./chunks/chunk-E5YO6274.js";var Nt=["account-login","account-bind","account-link","orders","order","addresses","subscriptions","profile-form","address-form"],Ot=()=>[...Nt.map(t=>`[${d(t)}]`),`[${d("show")}^="logged-"]`].join(",");function Dt(){return!!Z(ut())}function ft(t){!c.account||!(p(t,Ot()).length>0||dt(new URLSearchParams(window.location.search).get("account"))||Dt())||l("account").then(n=>n.mountAccount(t)).catch(n=>{a(n,"account")})}function u(t){return(...e)=>l("account").then(n=>{let o=n[t];return o(...e)})}var pt={login:u("login"),logout:u("logout"),isLoggedIn:u("isLoggedIn"),customer:u("customer"),orders:u("orders"),order:u("order"),updateProfile:u("updateProfile"),addresses:u("addresses"),saveAddress:u("saveAddress"),deleteAddress:u("deleteAddress"),subscriptions:u("subscriptions"),subscriptionAction:u("subscriptionAction"),requestReturn:u("requestReturn"),render:u("render"),mountAccount:u("mountAccount")};var gt=()=>`data-${c.prefix}-key`,ht=t=>t instanceof window.Element;function Et(t){let e=t.closest(`[${gt()}]`),n=e?.getAttribute(gt());return e&&n?{line:e,id:n}:null}function A(t,e){t.catch(n=>{a(n,e)})}function Rt(t,e){let n=Et(e);if(!n?.line.closest(r("cart-lines")))return;let{line:o,id:i}=n;if(e.closest(r("line-remove"))){t.preventDefault(),o.classList.add("is-busy"),A(s.removeLine(i),"cart line");return}let R=Ht(e);!R||!s.lines.some(It=>It.id===i)||(t.preventDefault(),A(s.changeQuantity(i,R),"cart line"))}function Ht(t){return t.closest(r("line-plus"))?1:t.closest(r("line-minus"))?-1:0}function $t(t){let{target:e}=t;if(!ht(e))return;if(e.closest(r("cart-open"))){t.preventDefault(),s.toggle();return}if(e.closest(r("cart-close"))){t.preventDefault(),s.close();return}let n=e.closest(r("cart-clear"));if(n){t.preventDefault(),f(n,()=>s.clear().catch(i=>{a(i,"cart clear")}));return}let o=e.closest(r("checkout"));if(o){t.preventDefault(),f(o,()=>s.checkout());return}Rt(t,e)}function yt(t,e,n){t.classList.add("is-busy"),t.setAttribute("aria-busy","true"),A(e,n)}function Vt(t){let{target:e}=t;if(!ht(e))return;let n=Et(e);n&&e instanceof window.HTMLInputElement&&e.matches(r("line","quantity"))?yt(n.line,s.updateLine(n.id,parseInt(e.value,10)||0),"cart line"):n&&e instanceof window.HTMLSelectElement&&e.matches(r("line-plan"))?yt(n.line,s.updateLine(n.id,{sellingPlanId:e.value||null}),"cart line plan"):Ft(e)&&e.matches(r("cart-note"))&&A(s.setNote(e.value),"cart note")}var Ft=t=>t instanceof window.HTMLInputElement||t instanceof window.HTMLTextAreaElement||t instanceof window.HTMLSelectElement;function _t(t){if(s.isOpen()){if(t.key==="Escape"){s.close();return}z(t)}}function vt(){document.addEventListener("click",$t),document.addEventListener("change",Vt),document.addEventListener("keydown",_t)}var x=t=>t instanceof window.Element;function Gt(t){let e=t.querySelector(r("discount-input"))??t.querySelector("input");return e instanceof window.HTMLInputElement?e:null}function Pt(t,e,n){t.classList.toggle("is-invalid",n),n?e?.setAttribute("aria-invalid","true"):e?.removeAttribute("aria-invalid")}async function Ut(t,e,n){try{await s.applyDiscount(n),Pt(t,e,!1),y("discount-applied",{code:n},t),e&&(e.value="")}catch(o){Pt(t,e,!0),o instanceof v&&o.code==="INVALID_DISCOUNT"?y("discount-invalid",{code:n},t):a(o,"discount")}}function Bt(t){let{target:e}=t,n=x(e)?e.closest(r("discount-form")):null;if(!n)return;t.preventDefault();let o=Gt(n),i=o?.value.trim();i&&f(n,()=>Ut(n,o,i))}function jt(t){let{target:e}=t;if(!x(e))return;let n=e.closest(r("discount-form"));n&&(n.classList.remove("is-invalid"),e.removeAttribute("aria-invalid"))}function qt(t){let{target:e}=t,n=x(e)?e.closest(r("discount-remove")):null;if(!n)return;t.preventDefault();let o=n.closest(r("discount-code"))?.getAttribute(d("discount-code"));o&&s.removeDiscount(o).catch(i=>{a(i,"discount")})}function wt(){document.addEventListener("submit",Bt,!0),document.addEventListener("input",jt),document.addEventListener("click",qt)}var M=t=>l("extras").then(e=>e.addGroup(t)),I=t=>{a(t,"extras")};function zt(t){let{target:e}=t,n=e instanceof window.Element?e.closest(r("group-add")):null;n&&(t.preventDefault(),f(n,()=>M(n)).catch(I))}function Kt(t){!c.domain||!t.key?.startsWith(`${c.prefix}:`)||l("extras").then(e=>{e.onStorage(t)}).catch(I)}function Qt(t){if(!g(t,"variant-changed"))return;let{target:e}=t;e instanceof window.Element&&(!c.variantUrl&&!e.hasAttribute(d("variant-url"))||l("extras").then(n=>{n.writeVariantUrl(e,t.detail)}).catch(I))}function At(){document.addEventListener("click",zt),window.addEventListener("storage",Kt),document.addEventListener(`${c.prefix}:variant-changed`,Qt)}var N=null;function bt(){N=document.body}async function Wt(t){await t.ready();let e=ct();if(!e){N!==document.body&&t.mount(document);return}try{await h(e.country,{language:e.language??null,locale:e.locale,remember:!1})}catch(n){a(n,"country")}t.mount(document)}function Yt(t){document.addEventListener("astro:page-load",()=>{Wt(t).catch(e=>{a(e,"page mount")})}),document.addEventListener("astro:before-swap",()=>{N=null,t.unmount()})}function Jt(t){let{target:e}=t;!(e instanceof window.HTMLSelectElement)||!e.matches(r("country-select"))||e.value&&h(e.value).catch(n=>{a(n,"country")})}function Xt(){it(),w.forEach(t=>{t.root.getAttribute(d("state"))==="error"&&t.load()})}function Lt(t){c.astro&&Yt(t),document.addEventListener("change",Jt),window.addEventListener("online",Xt)}var Ct="0.7.1",Zt=50;function te(){let t=P("TETHER_CONFIG");return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}var m=null,O=null,kt=null,Tt=!1;function ee(t){let e=0;return p(t,nt()).forEach(n=>{if(T.has(n))return;T.add(n),e++;let o=new ot(n);w.add(o),n.addEventListener(`${c.prefix}:list-rendered`,i=>{g(i,"list-rendered")&&b(i.detail.container)}),st(o.load())}),e}function ne(t){p(t,`${r("country-select")},${r("country-bind")}`).length&&l("markets").then(e=>e.renderCountrySelects(t)).catch(e=>{a(e,"markets")}),ft(t),p(t,r("search")).length&&l("search").then(e=>{e.mountSearch(t)}).catch(e=>{a(e,"search")})}function St(t){let e=ee(t);return p(t,r("product")).forEach(n=>{rt(n)&&e++}),ne(t),e}function b(t=document){if(!E())return 0;t===document&&bt(),C(),S(t.ownerDocument??document);let e=St(t);return k(),s.render(),L(`mounted ${e} scope(s)`,t),e}function oe(t){let e=t.filter(o=>o.isConnected&&!t.some(i=>i!==o&&i.contains(o)));if(!e.length||!E())return;C(),e.forEach(o=>{S(o)});let n=e.reduce((o,i)=>o+St(i),0);k(),s.render(),L(`mounted ${n} scope(s) in ${e.length} added element(s)`)}function xt(){s.close()}function re(t){let e=t?.closest(r("product"));return e?et.get(e)??null:null}function ie(){Tt||(Tt=!0,vt(),wt(),At(),Lt({ready:()=>m??Promise.resolve(null),mount:b,unmount:xt}))}function se(){let t=[];kt=t,U.forEach(e=>{document.addEventListener(`${c.prefix}:${e}`,n=>t.push(n))}),document.addEventListener("astro:page-load",e=>t.push(e)),l("analytics").then(e=>e.startAnalytics(t)).catch(e=>{a(e,"analytics")})}async function ae(t){let e=c.country,n=t?.buyerIdentity.countryCode;if(!t||!e||!n||n===e)return t;try{return await s.setBuyerIdentity({countryCode:e},{create:!1})}catch(o){return a(o,"cart country"),t}}function Mt(t={}){return m&&!Object.keys(t).length?m:(V({...te(),...t}),E()?(lt(),ie(),c.observe&&ce(),c.analytics&&!kt&&se(),m=at(t).then(()=>s.init()).then(ae).then(e=>(y("ready",{cart:e}),D)),m):(F("TETHER_CONFIG is missing domain or token. Tether is idle."),m=Promise.resolve(null),m))}function ce(){if(O||typeof MutationObserver>"u")return;let t,e=new Set;O=new MutationObserver(n=>{n.forEach(o=>{o.addedNodes.forEach(i=>{i instanceof window.Element&&e.add(i)})}),clearTimeout(t),t=setTimeout(()=>{let o=[...e];e.clear(),oe(o)},Zt)}),O.observe(document.body,{childList:!0,subtree:!0})}var ue=t=>l("markets").then(e=>e.detectMarket(t??c.markets)),le=()=>l("markets").then(t=>t.getLocalization()),de=t=>l("diagnose").then(e=>e.diagnose({...t,version:Ct}));function me(t,e){let n=`${c.prefix}:${t}`,o=i=>{g(i,t)&&e(i.detail,i)};return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}}var fe={VERSION:Ct,init:Mt,mount:b,unmount:xt,get config(){return $},get ready(){return m??Promise.resolve(null)},query:G,withContext:_,cart:s,getProduct:W,getProducts:J,getRecommendations:X,getScope:re,addGroup:M,account:pt,primeProduct:Q,normalizeProductKey:K,clearProductCache:Y,formatMoney:j,imageUrl:B,plans:q,TetherError:v,resolveProductKey:tt,setCountry:h,detectMarket:ue,getLocalization:le,diagnose:de,on:me},pe={__core:mt,__parts:{}},D=Object.assign(fe,pe),sn=D;function ge(){Reflect.set(window,"Tether",D);let t=P("TETHER_CONFIG");if(!t||H(t,"autoMount")===!1||P("TETHER_INTEGRATION"))return;let e=()=>{Mt().then(()=>b(document)).catch(n=>{a(n,"init")})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}typeof window<"u"&&typeof document<"u"&&ge();export{Ct as VERSION,M as addGroup,D as api,sn as default,re as getScope,Mt as init,b as mount,h as setCountry,xt as unmount};
@@ -1,2 +1,2 @@
1
- import{b as j,f as G,g as H}from"./chunks/chunk-T44MUL4Y.js";import{A as B,B as J,C as K,a as _,c as T,h as v,i as b,j as $,l as M,o as q,q as F,s as V}from"./chunks/chunk-BFTZR4OB.js";import{B as D,a as S,c as k,d as C,f as nt,g as P,i as L,u as U}from"./chunks/chunk-BA4LQJJQ.js";import{B as E,E as N,F as I,G as O,q as g,t as A}from"./chunks/chunk-E5YO6274.js";function Q(t,e={}){if(!t)return null;let{variant:r,sellingPlan:a,defaultPurchase:c=g.defaultPurchase,lowStock:u=g.lowStock}=e,d=G(t,{variant:r,sellingPlan:a,defaultPurchase:c}),n=H(t,{...d,quantity:1},u);if(!n)throw new S(`Product ${t.handle} has no variants`);let{selected:l,line:p}=n,i=(o,s)=>!j(t,l,o,s);return{variant:n.variant,selected:l,purchase:n.purchase.kind,plan:p.kind==="subscription"?n.plan:null,plans:v(t).map(o=>({id:o.id,name:o.name,price:$(n.variant,o.id),savings:M(n.variant,o.id).percentage,selected:p.kind==="subscription"&&o.id===p.planId,available:!!b(n.variant,o.id)})),savings:n.savings.percentage,price:n.price,compareAtPrice:n.compareAtPrice,available:n.variant.availableForSale,show:n.show,unavailable:Object.fromEntries(t.options.map(o=>[o.name,o.optionValues.map(s=>s.name).filter(s=>i(o.name,s))])),isUnavailable:i}}var rt=500,ot=100,it=100,at="query TetherServerProductById($id:ID!){node(id:$id){... on Product{...TetherProduct}}}",st="query TetherServerProduct($handle:String!){product(handle:$handle){...TetherProduct}}",lt=()=>`query TetherServerCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${T()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,ct="query TetherServerProducts($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}}}",ut=()=>`query TetherServerCollections($first:Int!,$after:String){collections(first:$first,after:$after){nodes{${T()}}pageInfo{hasNextPage endCursor}}}`,dt=t=>`query TetherServerRecs(${t?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${t?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`,ft=C({product:k(F)}),pt=C({node:k(V)}),mt=C({collections:{nodes:[{handle:"string"}],pageInfo:{hasNextPage:"boolean"}}});async function gt(t){let e=[],r=null;for(let a=0;a<it;a++){let c=await P(t,ut(),{first:ot,after:r},mt);if(e.push(...c.collections.nodes),!c.collections.pageInfo.hasNextPage)break;r=c.collections.pageInfo.endCursor}return e}function Y(t,e){let r=(i,o,s)=>P(t,f=>`${i}
2
- ${_(t,f)}`,o,s);async function a(i){let o=O(i);if(!o)return null;if(o.startsWith("gid://")){let{node:f}=await r(at,{id:o},pt);return f?.id?f:null}return(await r(st,{handle:o},ft)).product}async function c(i,{first:o=e,after:s=null,sortKey:f,reverse:m=!1,filters:w}){let h=await r(lt(),{handle:i,first:o,after:s,sortKey:f||void 0,reverse:m,filters:w??void 0},B);if(!h.collection)return{collection:null,products:[],pageInfo:{hasNextPage:!1,endCursor:null}};let{products:y,...et}=h.collection;return{collection:et,products:y.nodes,pageInfo:y.pageInfo}}async function u(i={}){let{collection:o,query:s,first:f=e,after:m=null,sortKey:w,reverse:h=!1}=i;if(o)return c(o,i);let y=await r(ct,{first:f,after:m,query:s||void 0,sortKey:w||void 0,reverse:h},J);return{collection:null,products:y.products.nodes,pageInfo:y.products.pageInfo}}async function d(i={}){let o=[],s=null;for(let f=0;f<rt;f++){let m=await u({...i,first:e,after:s});if(o.push(...m.products),!m.pageInfo.hasNextPage)break;s=m.pageInfo.endCursor}return o}async function n(i,o={}){let s=await u({...o,collection:i});return s.collection?{...s.collection,products:s.products,pageInfo:s.pageInfo}:null}async function l(i,o="RELATED"){let s=O(typeof i=="object"?i?.id:i),f=s?.startsWith("gid://")??!1;return(await r(dt(f),f?{id:s,intent:o}:{handle:s,intent:o},K)).productRecommendations??[]}return{getProduct:a,getProducts:u,allProducts:d,getCollection:n,allCollections:()=>gt(t),getRecommendations:l}}var W={size:"https://schema.org/size",color:"https://schema.org/color",colour:"https://schema.org/color",material:"https://schema.org/material"},R=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");function z(t){return JSON.parse(JSON.stringify(t))}var X=t=>t.split("/").pop()??t;function yt(t){return t.availableForSale?t.currentlyNotInStock?"https://schema.org/BackOrder":"https://schema.org/InStock":"https://schema.org/OutOfStock"}function Pt(t,e){if(!t.requiresSellingPlan)return e.price;let r=v(t).find(a=>b(e,a.id));return(r&&$(e,r.id))??e.price}function Z(t,e,r){let a=Pt(t,e),c=r?.includes("?")?"&":"?";return{"@type":"Offer",price:a.amount,priceCurrency:a.currencyCode,availability:yt(e),url:r?`${r}${c}variant=${X(e.id)}`:void 0}}function ht(t,e,r,a){let c=e.selectedOptions.flatMap(u=>{let d=W[u.name.toLowerCase()];return d?[[d.split("/").pop()??d,u.value]]:[]});return{"@type":"Product",name:`${t.title} - ${e.title}`,sku:e.sku||void 0,image:e.image?.url||a[0],...Object.fromEntries(c),offers:Z(t,e,r)}}function St(t,{url:e},r){if(e)return e;let a=I(r.productPath,t.handle,t.id);if(!(!r.siteUrl||!a))return new URL(a,r.siteUrl).toString()}function x(t,e,r){if(!t)return null;let a=St(t,e,r),c=t.images.nodes.map(i=>i.url).filter(Boolean),u=e.brand||t.vendor,d=u?{"@type":"Brand",name:u}:void 0,n=t.description.trim()||void 0,l=t.variants.nodes;if(l.length<=1){let[i]=l;return z({"@context":"https://schema.org","@type":"Product",name:t.title,description:n,url:a,image:c,sku:i?.sku||void 0,brand:d,offers:i?Z(t,i,a):void 0})}let p=t.options.map(i=>W[i.name.toLowerCase()]).filter(Boolean);return z({"@context":"https://schema.org","@type":"ProductGroup",name:t.title,description:n,url:a,productGroupID:X(t.id),image:c,brand:d,variesBy:[...new Set(p)],hasVariant:l.map(i=>ht(t,i,a,c))})}var Ct=25,It=2,Ot=1;function vt(t,{productPath:e=g.productPath,id:r}={}){return I(e,t,r)}function tt(t,e){for(let r of e){let a=t[r];if(typeof a=="string"&&a)return a}return""}function bt(t){let e={};for(let[u,d]of Object.entries(t))u in g&&(e[u]=d);let r=typeof t.domain=="string"&&t.domain?t.domain:"",a=typeof t.token=="string"&&t.token?t.token:"",c=A({...e,domain:r||tt(t,E.domain),token:a||tt(t,E.token)});return t.fetch&&(c.fetch=t.fetch),t.pageSize!==void 0&&(c.pageSize=t.pageSize),t.siteUrl!==void 0&&(c.siteUrl=t.siteUrl),c}var $t=t=>typeof t=="number"&&Number.isInteger(t)&&t>0?t:Ct;function wt(t,e){return{...t,description:"",descriptionHtml:"",images:{nodes:t.images.nodes.slice(0,Math.max(1,e))},variants:{nodes:t.variants.nodes.map(r=>({...r,image:null}))}}}function Qt(t={}){let e=bt(t);if(!e.domain||!e.token)throw new S("createStorefront needs domain and token: pass them, or import.meta.env with PUBLIC_SHOPIFY_DOMAIN and PUBLIC_SHOPIFY_STOREFRONT_TOKEN",{code:"NOT_CONFIGURED"});let r=Y(e,$t(e.pageSize)),a={productPath:e.productPath,siteUrl:e.siteUrl};function c(n,{card:l=!1,images:p=It}={}){let i=(Array.isArray(n)?n:[n]).filter(s=>s!=null),o={v:Ot,at:new Date().toISOString(),country:e.country||null,language:e.language||null,products:l?i.map(s=>wt(s,p)):i};return`<script type="application/json" data-tether-hydrate>${R(o)}<\/script>`}function u(n,l={}){return n?`<script type="application/ld+json">${R(x(n,l,a))}<\/script>`:""}function d(n,l={}){return Q(n,{defaultPurchase:e.defaultPurchase,lowStock:e.lowStock,...l})}return{config:e,query:(n,l,p)=>P(e,n,l??{},L,p),...r,hydrate:c,formatMoney:(n,l=e.locale)=>N(n,l),formatPercent:(n,l=e.locale)=>D(n,l),imageUrl:U,jsonLd:u,jsonLdData:(n,l={})=>x(n,l,a),initialState:d,productUrl:(n,l={})=>vt(n,{productPath:e.productPath,...l}),plans:q}}export{S as TetherError,Qt as createStorefront,N as formatMoney,D as formatPercent,U as imageUrl,Q as initialState,q as plans,O as productKey,vt as productUrl,nt as withContext};
1
+ import{b as G,f as H,g as Q}from"./chunks/chunk-BBVUVPMO.js";import{A as J,B as K,C as j,a as M,c as T,h as v,i as b,j as $,l as F,o as q,q as V,s as B}from"./chunks/chunk-6TFMLT4A.js";import{C as _,a as S,c as k,d as C,f as L,g as rt,h as P,j as N,v as D}from"./chunks/chunk-MQYB6BH4.js";import{B as E,E as U,F as I,G as O,q as g,t as A}from"./chunks/chunk-E5YO6274.js";function Y(t,e={}){if(!t)return null;let{variant:r,sellingPlan:a,defaultPurchase:c=g.defaultPurchase,lowStock:u=g.lowStock}=e,d=H(t,{variant:r,sellingPlan:a,defaultPurchase:c}),n=Q(t,{...d,quantity:1},u);if(!n)throw new S(`Product ${t.handle} has no variants`);let{selected:l,line:p}=n,i=(o,s)=>!G(t,l,o,s);return{variant:n.variant,selected:l,purchase:n.purchase.kind,plan:p.kind==="subscription"?n.plan:null,plans:v(t).map(o=>({id:o.id,name:o.name,price:$(n.variant,o.id),savings:F(n.variant,o.id).percentage,selected:p.kind==="subscription"&&o.id===p.planId,available:!!b(n.variant,o.id)})),savings:n.savings.percentage,price:n.price,compareAtPrice:n.compareAtPrice,available:n.variant.availableForSale,show:n.show,unavailable:Object.fromEntries(t.options.map(o=>[o.name,o.optionValues.map(s=>s.name).filter(s=>i(o.name,s))])),isUnavailable:i}}var ot=500,it=100,at=100,st="query TetherServerProductById($id:ID!){node(id:$id){... on Product{...TetherProduct}}}",lt="query TetherServerProduct($handle:String!){product(handle:$handle){...TetherProduct}}",ct=()=>`query TetherServerCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${T()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,ut="query TetherServerProducts($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}}}",dt=()=>`query TetherServerCollections($first:Int!,$after:String){collections(first:$first,after:$after){nodes{${T()}}pageInfo{hasNextPage endCursor}}}`,ft=t=>`query TetherServerRecs(${t?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${t?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`,pt=C({product:k(V)}),mt=C({node:k(B)}),gt=C({collections:{nodes:[{handle:"string"}],pageInfo:{hasNextPage:"boolean"}}});async function yt(t){let e=[],r=null;for(let a=0;a<at;a++){let c=await P(t,dt(),{first:it,after:r},gt);if(e.push(...c.collections.nodes),!c.collections.pageInfo.hasNextPage)break;r=c.collections.pageInfo.endCursor}return e}function z(t,e){let r=(i,o,s)=>P(t,f=>`${i}
2
+ ${M(t,f)}`,o,s);async function a(i){let o=O(i);if(!o)return null;if(o.startsWith("gid://")){let{node:f}=await r(st,{id:o},mt);return f?.id?f:null}return(await r(lt,{handle:o},pt)).product}async function c(i,{first:o=e,after:s=null,sortKey:f,reverse:m=!1,filters:w}){let h=await r(ct(),{handle:i,first:o,after:s,sortKey:f||void 0,reverse:m,filters:w??void 0},J);if(!h.collection)return{collection:null,products:[],pageInfo:{hasNextPage:!1,endCursor:null}};let{products:y,...nt}=h.collection;return{collection:nt,products:y.nodes,pageInfo:y.pageInfo}}async function u(i={}){let{collection:o,query:s,first:f=e,after:m=null,sortKey:w,reverse:h=!1}=i;if(o)return c(o,i);let y=await r(ut,{first:f,after:m,query:s||void 0,sortKey:w||void 0,reverse:h},K);return{collection:null,products:y.products.nodes,pageInfo:y.products.pageInfo}}async function d(i={}){let o=[],s=null;for(let f=0;f<ot;f++){let m=await u({...i,first:e,after:s});if(o.push(...m.products),!m.pageInfo.hasNextPage)break;s=m.pageInfo.endCursor}return o}async function n(i,o={}){let s=await u({...o,collection:i});return s.collection?{...s.collection,products:s.products,pageInfo:s.pageInfo}:null}async function l(i,o="RELATED"){let s=O(typeof i=="object"?i?.id:i),f=s?.startsWith("gid://")??!1;return(await r(ft(f),f?{id:s,intent:o}:{handle:s,intent:o},j)).productRecommendations??[]}return{getProduct:a,getProducts:u,allProducts:d,getCollection:n,allCollections:()=>yt(t),getRecommendations:l}}var X={size:"https://schema.org/size",color:"https://schema.org/color",colour:"https://schema.org/color",material:"https://schema.org/material"},R=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");function W(t){return JSON.parse(JSON.stringify(t))}var Z=t=>t.split("/").pop()??t;function Pt(t){return t.availableForSale?t.currentlyNotInStock?"https://schema.org/BackOrder":"https://schema.org/InStock":"https://schema.org/OutOfStock"}function ht(t,e){if(!t.requiresSellingPlan)return e.price;let r=v(t).find(a=>b(e,a.id));return(r&&$(e,r.id))??e.price}function tt(t,e,r){let a=ht(t,e),c=r?.includes("?")?"&":"?";return{"@type":"Offer",price:a.amount,priceCurrency:a.currencyCode,availability:Pt(e),url:r?`${r}${c}variant=${Z(e.id)}`:void 0}}function St(t,e,r,a){let c=e.selectedOptions.flatMap(u=>{let d=X[u.name.toLowerCase()];return d?[[d.split("/").pop()??d,u.value]]:[]});return{"@type":"Product",name:`${t.title} - ${e.title}`,sku:e.sku||void 0,image:e.image?.url||a[0],...Object.fromEntries(c),offers:tt(t,e,r)}}function Ct(t,{url:e},r){if(e)return e;let a=I(r.productPath,t.handle,t.id);if(!(!r.siteUrl||!a))return new URL(a,r.siteUrl).toString()}function x(t,e,r){if(!t)return null;let a=Ct(t,e,r),c=t.images.nodes.map(i=>i.url).filter(Boolean),u=e.brand||t.vendor,d=u?{"@type":"Brand",name:u}:void 0,n=t.description.trim()||void 0,l=t.variants.nodes;if(l.length<=1){let[i]=l;return W({"@context":"https://schema.org","@type":"Product",name:t.title,description:n,url:a,image:c,sku:i?.sku||void 0,brand:d,offers:i?tt(t,i,a):void 0})}let p=t.options.map(i=>X[i.name.toLowerCase()]).filter(Boolean);return W({"@context":"https://schema.org","@type":"ProductGroup",name:t.title,description:n,url:a,productGroupID:Z(t.id),image:c,brand:d,variesBy:[...new Set(p)],hasVariant:l.map(i=>St(t,i,a,c))})}var It=25,Ot=2,vt=1;function bt(t,{productPath:e=g.productPath,id:r}={}){return I(e,t,r)}function et(t,e){for(let r of e){let a=t[r];if(typeof a=="string"&&a)return a}return""}function $t(t){let e={};for(let[u,d]of Object.entries(t))u in g&&(e[u]=d);let r=typeof t.domain=="string"&&t.domain?t.domain:"",a=typeof t.token=="string"&&t.token?t.token:"",c=A({...e,domain:r||et(t,E.domain),token:a||et(t,E.token)});return t.fetch&&(c.fetch=t.fetch),t.pageSize!==void 0&&(c.pageSize=t.pageSize),t.siteUrl!==void 0&&(c.siteUrl=t.siteUrl),c}var wt=t=>typeof t=="number"&&Number.isInteger(t)&&t>0?t:It;function kt(t,e){return{...t,description:"",descriptionHtml:"",images:{nodes:t.images.nodes.slice(0,Math.max(1,e))},variants:{nodes:t.variants.nodes.map(r=>({...r,image:null}))}}}function Yt(t={}){let e=$t(t);if(!e.domain||!e.token)throw new S("createStorefront needs domain and token: pass them, or import.meta.env with PUBLIC_SHOPIFY_DOMAIN and PUBLIC_SHOPIFY_STOREFRONT_TOKEN",{code:"NOT_CONFIGURED"});let r=z(e,wt(e.pageSize)),a={productPath:e.productPath,siteUrl:e.siteUrl};function c(n,{card:l=!1,images:p=Ot}={}){let i=(Array.isArray(n)?n:[n]).filter(s=>s!=null),o={v:vt,at:new Date().toISOString(),country:e.country||null,language:e.language||null,products:l?i.map(s=>kt(s,p)):i};return`<script type="application/json" data-tether-hydrate>${R(o)}<\/script>`}function u(n,l={}){return n?`<script type="application/ld+json">${R(x(n,l,a))}<\/script>`:""}function d(n,l={}){return Y(n,{defaultPurchase:e.defaultPurchase,lowStock:e.lowStock,...l})}return{config:e,query:(n,l,p)=>P(e,n,l??{},N,{...p,operation:L(n)}),...r,hydrate:c,formatMoney:(n,l=e.locale)=>U(n,l),formatPercent:(n,l=e.locale)=>_(n,l),imageUrl:D,jsonLd:u,jsonLdData:(n,l={})=>x(n,l,a),initialState:d,productUrl:(n,l={})=>bt(n,{productPath:e.productPath,...l}),plans:q}}export{S as TetherError,Yt as createStorefront,U as formatMoney,_ as formatPercent,D as imageUrl,Y as initialState,q as plans,O as productKey,bt as productUrl,rt as withContext};
@@ -871,8 +871,18 @@
871
871
  });
872
872
  }
873
873
 
874
+ // src/part-registry.ts
875
+ function isTetherInternals(value) {
876
+ return isRecord(value) && isRecord(value["__core"]) && isRecord(value["__parts"]);
877
+ }
878
+ function registerPart(name, part) {
879
+ const tether = Reflect.get(window, "Tether");
880
+ if (!isTetherInternals(tether)) {
881
+ throw new Error(`tether.${name}.js runs after the Tether script, which loads it, and needs its window.Tether`);
882
+ }
883
+ tether.__parts[name] = part;
884
+ }
885
+
874
886
  // src/parts/account-pages.ts
875
- var { Tether } = window;
876
- if (!Tether) throw new Error("tether.account-pages.js runs after the Tether script, which loads it");
877
- Tether.__parts["account-pages"] = account_pages_exports;
887
+ registerPart("account-pages", account_pages_exports);
878
888
  })();
@@ -1 +1 @@
1
- (()=>{var De=Object.defineProperty;var Me=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})};var oe={};Me(oe,{addresses:()=>G,deleteAddress:()=>V,order:()=>j,renderPages:()=>bt,requestReturn:()=>K,saveAddress:()=>H,setup:()=>Te,showUnavailable:()=>wt,subscriptionAction:()=>J,subscriptions:()=>Z,updateProfile:()=>z});var qe=window.Tether.__core["config.ts"],[xt,Tt,Ot,Et,St,T,Lt]=qe;var ve=window.Tether.__core["dom.ts"],[kt,y,It,ue,P,h,p,Ct,Rt,Nt,Dt,Mt,l,A,u,B,g,_]=ve;var He=window.Tether.__core["client.ts"],[vt,Ht,Ft,Ut,R]=He;var de={order:{name:"order",method:"GET",path:"/order",fields:{id:!0}},addresses:{name:"addresses",method:"GET",path:"/addresses",fields:{}},subscriptions:{name:"subscriptions",method:"GET",path:"/subscriptions",fields:{}},profile:{name:"profile",method:"POST",path:"/profile",fields:{firstName:!0,lastName:!0}},saveAddress:{name:"saveAddress",method:"POST",path:"/address",fields:{id:!0,address:!0,isDefault:!0}},deleteAddress:{name:"deleteAddress",method:"POST",path:"/address/delete",fields:{id:!0}},subscription:{name:"subscription",method:"POST",path:"/subscription",fields:{id:!0,action:!0}},requestReturn:{name:"requestReturn",method:"POST",path:"/return",fields:{orderId:!0,lines:!0}}},_t=new Map(Object.values(de).map(e=>[`${e.method} ${e.path}`,{...e,fields:Object.keys(e.fields)}]));function le(e,t){let n=de[e];if(n.method==="POST")return{method:"POST",path:n.path};let r=t,s=new URLSearchParams;for(let d of Object.keys(n.fields)){let c=r[d];(typeof c=="string"||typeof c=="number")&&s.set(d,String(c))}let o=s.toString();return{method:"GET",path:o?`${n.path}?${o}`:n.path}}function w(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function i(e,t){return w(e)?e[t]:void 0}function ce(e){return Array.isArray(e)?e:[]}function a(e){return typeof e=="string"&&e!==""?e:null}var $=e=>typeof e=="number"&&Number.isFinite(e)?e:null,N=e=>$(e)??0,k=(e,t)=>ce(e).map(n=>t(n)),x=(e,t)=>({nodes:k(i(e,"nodes"),t)}),W=e=>k(e,a).filter(t=>t!==null);function I(e){let t=a(i(e,"amount")),n=a(i(e,"currencyCode"));return t===null||n===null?null:{amount:t,currencyCode:n}}function X(e){let t=a(i(e,"url"));return t===null?null:{url:t,altText:a(i(e,"altText"))}}var me=e=>({title:a(i(e,"title")),variantTitle:a(i(e,"variantTitle")),quantity:N(i(e,"quantity")),image:X(i(e,"image"))});var ee=e=>new R(`Customer accounts: the answer has no ${e}`);function O(e,t){let n=a(e);if(!n)throw ee(t);return n}function fe(e){let t=n=>a(i(e,n));return{id:t("id"),firstName:t("firstName"),lastName:t("lastName"),company:t("company"),address1:t("address1"),address2:t("address2"),city:t("city"),province:t("province"),zoneCode:t("zoneCode"),zip:t("zip"),country:t("country"),countryCode:t("countryCode"),phoneNumber:t("phoneNumber"),formatted:W(i(e,"formatted"))}}var pe=e=>w(e)?fe(e):null,te=e=>({...fe(e),id:O(i(e,"id"),"address id")}),ge=e=>k(e,t=>({...te(t),isDefault:i(t,"isDefault")===!0})),Fe=e=>({...me(e),id:O(i(e,"id"),"line item id"),name:a(i(e,"name")),sku:a(i(e,"sku")),price:I(i(e,"price")),totalPrice:I(i(e,"totalPrice")),suggestedReturnReasonDefinitions:x(i(e,"suggestedReturnReasonDefinitions"),t=>({id:O(i(t,"id"),"return reason id"),name:a(i(t,"name")),handle:a(i(t,"handle"))}))}),Ue=e=>({id:a(i(e,"id")),status:a(i(e,"status")),createdAt:a(i(e,"createdAt")),estimatedDeliveryAt:a(i(e,"estimatedDeliveryAt")),latestShipmentStatus:a(i(e,"latestShipmentStatus")),trackingInformation:k(i(e,"trackingInformation"),t=>({company:a(i(t,"company")),number:a(i(t,"number")),url:a(i(t,"url"))}))});function Be(e){let t=a(i(i(e,"lineItem"),"id"));return{quantity:N(i(e,"quantity")),lineItem:t===null?null:{id:t}}}function _e(e){return w(e)?{returnableLineItems:x(e.returnableLineItems,Be)}:null}function ye(e){if(!w(e))return null;let t=s=>a(e[s]),n=s=>I(e[s]),r=e.requiresShipping;return{id:O(e.id,"order id"),name:t("name"),number:$(e.number),processedAt:t("processedAt"),cancelledAt:t("cancelledAt"),financialStatus:t("financialStatus"),fulfillmentStatus:t("fulfillmentStatus"),statusPageUrl:t("statusPageUrl"),requiresShipping:typeof r=="boolean"?r:null,totalPrice:n("totalPrice"),subtotal:n("subtotal"),totalShipping:n("totalShipping"),totalTax:n("totalTax"),shippingAddress:pe(e.shippingAddress),billingAddress:pe(e.billingAddress),lineItems:x(e.lineItems,Fe),fulfillments:x(e.fulfillments,Ue),returnInformation:_e(e.returnInformation),returns:x(e.returns,ne)}}var $e=e=>({id:a(i(e,"id")),name:a(i(e,"name")),title:a(i(e,"title")),variantTitle:a(i(e,"variantTitle")),quantity:N(i(e,"quantity")),sku:a(i(e,"sku")),currentPrice:I(i(e,"currentPrice")),lineDiscountedPrice:I(i(e,"lineDiscountedPrice")),image:X(i(e,"image"))}),he=e=>({cycleIndex:$(i(e,"cycleIndex")),skipped:i(e,"skipped")===!0,billingAttemptExpectedDate:a(i(e,"billingAttemptExpectedDate"))});function je(e){if(!w(e))return null;let t=e.intervalCount;return{interval:a(e.interval),intervalCount:w(t)?{count:N(t.count)}:null}}var ze=e=>({id:O(i(e,"id"),"subscription id"),status:a(i(e,"status")),nextBillingDate:a(i(e,"nextBillingDate")),currencyCode:a(i(e,"currencyCode")),deliveryPrice:I(i(e,"deliveryPrice")),deliveryPolicy:je(i(e,"deliveryPolicy")),lines:x(i(e,"lines"),$e),upcomingBillingCycles:x(i(e,"upcomingBillingCycles"),he)}),be=e=>k(e,ze);function we(e){let{contract:t,billingCycle:n}=e;if(w(t))return{contract:{id:a(t.id),status:a(t.status)}};if(w(n)){let{cycleIndex:r,skipped:s}=he(n);return{billingCycle:{cycleIndex:r,skipped:s}}}throw ee("changed subscription")}function ne(e){return{id:O(i(e,"id"),"return id"),status:a(i(e,"status"))}}var Ae=e=>O(e,"deleted address id"),xe=e=>({firstName:a(i(e,"firstName")),lastName:a(i(e,"lastName"))});var re=null;function Te(e){re=e}function D(){if(!re)throw new Error("account-pages: loaded without the account part");return re}async function E(e,t){let{serverFetch:n}=D(),{method:r,path:s}=le(e,t),o=await n(s,r==="POST"?{method:r,body:t}:{});if(o.kind==="logged-out")throw new R("Not logged in",{code:"NOT_LOGGED_IN",status:401});return o.data}function v(e){D().reset(),ue("account-updated",{what:e})}async function j(e){let t=await E("order",{id:e});return ye(t.order)}async function z({firstName:e,lastName:t}={}){let n=await E("profile",{firstName:e,lastName:t});return v("profile"),xe(n.customer)}async function G(){let e=await E("addresses",{});return ge(e.addresses)}async function H(e,{id:t,isDefault:n}={}){let r=await E("saveAddress",{id:t,address:e,isDefault:n});return v("addresses"),te(r.address)}async function V(e){let t=await E("deleteAddress",{id:e});return v("addresses"),Ae(t.deleted)}async function Z(){let e=await E("subscriptions",{});return be(e.subscriptions)}async function J(e,t){let n=await E("subscription",{id:e,action:t});return v("subscriptions"),we(n)}async function K(e,t){let n=await E("requestReturn",{orderId:e,lines:t});return v("orders"),ne(n.return)}var Ge=window.Tether.__core["shopify-values.ts"],[se]=Ge;function m(e,t,n){l(e,u(t)).forEach(r=>{let s=p(r,t)??"";Object.hasOwn(n,s)&&_(r,n[s]===!0)})}var S=(e,t)=>l(e,u(t)).concat(e.matches(u(t))?[e]:[]),L=e=>e?e.toLowerCase().replace(/_/g," "):"",F=e=>(e?.formatted??[]).join(", "),b=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0;var Ve=(e,t)=>({title:e.title||e.name||"","variant-title":e.variantTitle||"",quantity:String(e.quantity),price:h(e.price),total:h(e.totalPrice),sku:e.sku||"",returnable:t===null?void 0:String(t)}),Ze=e=>e.tagName==="INPUT";function Je(e,t,n){m(e,"order-line-show",{returnable:n>0}),l(e,u("return-quantity")).forEach(r=>{Ze(r)&&(r.max=String(n),r.min="0",r.value||(r.value="0"),r.disabled=n<1)}),l(e,`select${u("return-reason")}`).forEach(r=>{r.dataset.tetherFilled!==t.id&&(r.dataset.tetherFilled=t.id,(t.suggestedReturnReasonDefinitions?.nodes??[]).forEach(s=>{r.appendChild(new Option(s.name??"",s.id))}))})}function Oe(e,t,n){A(e,t,(r,s)=>{let o=s.id,d=n&&o?n.get(o)??0:null;o&&(r.dataset.tetherLine=o);let c=Ve(s,d);S(r,"order-line").forEach(f=>{let C=p(f,"order-line")??"";if(C==="image"){s.image&&B(f,s.image.url,s.image.altText||s.title||"");return}let ae=b(c,C);ae!==void 0&&g(f,ae)}),o&&d!==null&&Je(r,{...s,id:o},d)})}function Ke(e){let t=p(e,"order")||"";return t.startsWith("url:")?new URL(window.location.href).searchParams.get(t.slice(4)||"id"):t}function U(e,t){e.setAttribute(y("order-state"),t),m(e,"order-show",{loading:t==="loading",ready:!1,"not-found":t==="not-found",error:t==="error"})}var Ye=e=>({name:e.name??"",date:P(e.processedAt),total:h(e.totalPrice),subtotal:h(e.subtotal),shipping:h(e.totalShipping),tax:h(e.totalTax),status:L(e.financialStatus),fulfillment:L(e.fulfillmentStatus),"shipping-address":F(e.shippingAddress),"billing-address":F(e.billingAddress),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title||t.name||""}`).join(", "),cancelled:P(e.cancelledAt)});function Qe(e,t){let n=t.trackingInformation[0],r={status:L(t.latestShipmentStatus||t.status),date:P(t.createdAt),eta:P(t.estimatedDeliveryAt),company:n?.company||"",number:n?.number||""};S(e,"fulfillment-bind").forEach(s=>{let o=p(s,"fulfillment-bind")??"";if(o==="url"){let c=n?.url??null,f=c!==null&&se(c);f&&s.setAttribute("href",c),_(s,f);return}let d=b(r,o);d!==void 0&&g(s,d)})}function We(e,t){let n=new Map((t.returnInformation?.returnableLineItems.nodes??[]).map(d=>[d.lineItem?.id??"",d.quantity])),r=t.fulfillments.nodes,s=Ye(t);l(e,u("order-bind")).forEach(d=>{let c=p(d,"order-bind")??"";if(c==="url"){let C=t.statusPageUrl;C!==null&&se(C)&&d.setAttribute("href",C);return}let f=b(s,c);f!==void 0&&g(d,f)}),l(e,u("order-lines")).forEach(d=>{Oe(d,t.lineItems.nodes,n)}),l(e,u("order-fulfillments")).forEach(d=>{A(d,r,Qe)});let o=e.dataset.tetherReturned==="1";m(e,"order-show",{loading:!1,ready:!0,error:!1,"not-found":!1,cancelled:!!t.cancelledAt,shipped:r.length>0,returnable:[...n.values()].some(d=>d>0),"has-returns":!o&&t.returns.nodes.length>0,"return-requested":o}),e.setAttribute(y("order-state"),"ready")}async function Y(e){let t=Ke(e);if(!t){e.setAttribute(y("order-state"),"not-found"),m(e,"order-show",{"not-found":!0});return}U(e,"loading");let n;try{n=await j(t)}catch(r){T(r,"order"),U(e,"error");return}if(!n){U(e,"not-found");return}e.dataset.tetherOrderId=n.id,We(e,n)}var Ee=[],Se=e=>Ee.find(t=>t.id===e),Xe=e=>({formatted:F(e),name:[e.firstName,e.lastName].filter(Boolean).join(" "),company:e.company||"",address1:e.address1||"",address2:e.address2||"",city:e.city||"",zip:e.zip||"",province:e.province||"",country:e.country||"",phone:e.phoneNumber||""});function et(e,t){e.dataset.tetherAddress=t.id;let n=Xe(t);S(e,"address-bind").forEach(r=>{let s=b(n,p(r,"address-bind")??"");s!==void 0&&g(r,s)}),m(e,"address-show",{default:t.isDefault,"not-default":!t.isDefault})}async function M(e){let t=l(e,u("addresses"));if(!t.length)return;m(e,"show",{"addresses-loading":!0,"addresses-empty":!1});let n;try{n=await G()}catch(r){T(r,"addresses"),m(e,"show",{"addresses-loading":!1,"addresses-error":!0});return}Ee=n,m(e,"show",{"addresses-loading":!1,"addresses-empty":n.length===0,"addresses-error":!1}),t.forEach(r=>{A(r,n,et)})}function tt(e){let t=e.upcomingBillingCycles.nodes[0],n=e.status,r=n==="ACTIVE";return{active:r,paused:n==="PAUSED",cancelled:n==="CANCELLED",expired:n==="EXPIRED",failed:n==="FAILED",skipped:!!t?.skipped,"can-pause":r,"can-resume":n==="PAUSED"||n==="FAILED","can-skip":r&&t!==void 0&&!t.skipped,"can-unskip":r&&!!t?.skipped,"can-cancel":r||n==="PAUSED"||n==="FAILED"}}function nt(e){let t=L(e.deliveryPolicy?.interval);if(!t)return"";let n=e.deliveryPolicy?.intervalCount?.count??1;return n<=1?t:`${String(n)} ${t}s`}function rt(e){let t=e.lines.nodes,n=t.reduce((r,s)=>r+Number.parseFloat(s.lineDiscountedPrice?.amount??"0"),0);return{status:L(e.status),next:P(e.nextBillingDate),interval:nt(e),products:t.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", "),total:h(t.length&&e.currencyCode?{amount:String(n),currencyCode:e.currencyCode}:null),delivery:h(e.deliveryPrice)}}function st(e,t){let n={title:t.title??"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:h(t.currentPrice)};S(e,"subscription-line").forEach(r=>{let s=p(r,"subscription-line")??"";if(s==="image"){t.image&&B(r,t.image.url,t.image.altText||t.title||"");return}let o=b(n,s);o!==void 0&&g(r,o)})}function it(e,t){e.dataset.tetherSubscription=t.id,e.setAttribute(y("subscription-status"),L(t.status));let n=rt(t);l(e,u("subscription-bind")).forEach(s=>{let o=b(n,p(s,"subscription-bind")??"");o!==void 0&&g(s,o)}),l(e,u("subscription-lines")).forEach(s=>{A(s,t.lines.nodes,st)});let r=tt(t);m(e,"subscription-show",r),l(e,u("subscription-action")).forEach(s=>{let o=b(r,`can-${p(s,"subscription-action")??""}`)===!0;"disabled"in s&&(s.disabled=!o),s.classList.toggle("is-disabled",!o)})}async function Q(e){let t=l(e,u("subscriptions"));if(!t.length)return;m(e,"show",{"subscriptions-loading":!0,"subscriptions-empty":!1});let n;try{n=await Z()}catch(r){T(r,"subscriptions"),m(e,"show",{"subscriptions-loading":!1,"subscriptions-error":!0});return}m(e,"show",{"subscriptions-loading":!1,"subscriptions-empty":n.length===0,"subscriptions-error":!1}),t.forEach(r=>{A(r,n,it)})}var ot=["pause","resume","skip","unskip","cancel"],at=e=>ot.some(t=>t===e),Pe=e=>e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement,ke=e=>e instanceof window.HTMLFormElement;function Le(e){let t={};for(let n of e.elements)Pe(n)&&(!n.name||n.type==="submit"||n.type==="button"||n.type==="checkbox"||(t[n.name]=n.value));return t}function ut(e){let n=(e instanceof R?e.userErrors??[]:[]).map(s=>s.message).join(" ");return n||(e instanceof Error&&e.message?e.message:"Something went wrong").replace(/^Customer accounts: /,"")}async function q(e,t){if(e.getAttribute("aria-busy")==="true")return"busy";e.classList.add("is-busy"),e.setAttribute("aria-busy","true"),e.setAttribute(y("form-state"),"pending");let n=l(e,u("form-error"));n.forEach(r=>{g(r,"")});try{return await t(),e.setAttribute(y("form-state"),"saved"),"saved"}catch(r){return e.setAttribute(y("form-state"),"error"),n.forEach(s=>{g(s,ut(r))}),"error"}finally{e.classList.remove("is-busy"),e.removeAttribute("aria-busy")}}var ie=e=>{let t=p(e,"confirm");return!t||window.confirm(t)},Ie=e=>{e.reset(),delete e.dataset.tetherAddressId};function dt(e){let t=e.target;if(t instanceof window.HTMLFormElement){if(t.matches(u("profile-form")))e.preventDefault(),q(t,async()=>{await z(Le(t)),await D().bindCustomer(document)});else if(t.matches(u("address-form"))){e.preventDefault();let n=t.dataset.tetherAddressId,r=t.elements.namedItem("isDefault"),s=r instanceof window.HTMLInputElement&&r.checked;q(t,async()=>{await H(Le(t),{id:n,isDefault:s}),Ie(t),await M(document)})}}}function lt(e){let t=Se(e),n=document.querySelector(u("address-form"));if(!t||!n||!ke(n))return;n.dataset.tetherAddressId=t.id;let r={...t};for(let s of n.elements)if(Pe(s)){if(s.name==="isDefault")s instanceof window.HTMLInputElement&&(s.checked=t.isDefault);else if(s.name&&Object.hasOwn(r,s.name)){let o=r[s.name];s.value=typeof o=="string"?o:""}}n.scrollIntoView({block:"nearest"})}function ct(e,t){let n=t.closest("[data-tether-address]"),r=n instanceof window.HTMLElement?n.dataset.tetherAddress:void 0;if(t.closest(u("address-new"))){let o=document.querySelector(u("address-form"));return o&&ke(o)&&Ie(o),!0}if(!(n instanceof window.HTMLElement)||!r)return!1;let s=t.closest(u("address-delete"));if(s){if(e.preventDefault(),!ie(s))return!0;q(n,async()=>{await V(r),await M(document)})}else if(t.closest(u("address-default")))e.preventDefault(),q(n,async()=>{await H(null,{id:r,isDefault:!0}),await M(document)});else if(t.closest(u("address-edit")))e.preventDefault(),lt(r);else return!1;return!0}function mt(e){let t=e.closest("[data-tether-subscription]"),n=p(e,"subscription-action"),r="disabled"in e&&e.disabled===!0||e.classList.contains("is-disabled");if(!(t instanceof window.HTMLElement)||!at(n)||r||!ie(e))return;let s=t.dataset.tetherSubscription??"";t.setAttribute(y("subscription-state"),"pending"),q(t,async()=>{await J(s,n),await Q(document)}).then(o=>{let d=o==="error"?"error":"done";l(document,"[data-tether-subscription]").filter(c=>c===t||c.dataset.tetherSubscription===s).forEach(c=>{c.setAttribute(y("subscription-state"),d)})})}function pt(e){let t=e.querySelector(u("return-quantity")),n=e.querySelector(u("return-reason")),r=e.querySelector(u("return-note")),s=f=>f&&"value"in f&&typeof f.value=="string"?f.value:"",o={lineItemId:e.dataset.tetherLine??"",quantity:Number.parseInt(s(t)||"0",10)},d=s(n);d&&(o.reasonId=d);let c=s(r);return c&&(o.note=c),o}function ft(e){let t=e.closest(u("order"));if(!(t instanceof window.HTMLElement))return;let n=t.dataset.tetherOrderId;if(!n)return;let r=l(t,"[data-tether-line]").map(pt).filter(s=>s.quantity>0);!r.length||!ie(e)||q(t,async()=>{await K(n,r),t.dataset.tetherReturned="1",await Y(t)})}function gt(e){let t=e.target;if(!(t instanceof window.Element)||ct(e,t))return;let n=t.closest(u("subscription-action"));if(n instanceof window.HTMLElement){e.preventDefault(),mt(n);return}let r=t.closest(u("order-return"));r instanceof window.HTMLElement&&(e.preventDefault(),ft(r))}function Ce(){document.addEventListener("submit",dt,!0),document.addEventListener("input",e=>{let t=e.target;t instanceof window.HTMLElement&&t.closest(u("profile-form"))&&(t.dataset.tetherTouched="1")}),document.addEventListener("click",gt)}var yt=["firstName","lastName"];async function ht(e){if(!(e instanceof window.HTMLFormElement))return;let t;try{t=await D().customer()}catch(r){T(r,"account");return}if(!t)return;let n=e.elements;yt.forEach(r=>{let s=n.namedItem(r);(s instanceof window.HTMLInputElement||s instanceof window.HTMLTextAreaElement)&&!s.dataset.tetherTouched&&(s.value=t[r]??"")})}var Re=!1;async function bt(e=document){Re||(Re=!0,Ce()),await Promise.all([...l(e,u("order")).map(t=>Y(t)),...l(e,u("profile-form")).map(t=>ht(t)),M(e),Q(e)])}function wt(e){l(e,u("order")).forEach(t=>{U(t,"error")}),m(e,"show",{"addresses-loading":!1,"addresses-error":!0,"subscriptions-loading":!1,"subscriptions-error":!0})}var{Tether:Ne}=window;if(!Ne)throw new Error("tether.account-pages.js runs after the Tether script, which loads it");Ne.__parts["account-pages"]=oe;})();
1
+ (()=>{var De=Object.defineProperty;var Me=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})};var oe={};Me(oe,{addresses:()=>G,deleteAddress:()=>V,order:()=>j,renderPages:()=>bt,requestReturn:()=>K,saveAddress:()=>H,setup:()=>Te,showUnavailable:()=>wt,subscriptionAction:()=>J,subscriptions:()=>Z,updateProfile:()=>z});var qe=window.Tether.__core["config.ts"],[Tt,Ot,Et,St,Lt,T,Pt]=qe;var ve=window.Tether.__core["dom.ts"],[It,h,Rt,ue,P,b,p,Ct,Nt,Dt,Mt,qt,l,A,u,_,y,B]=ve;var He=window.Tether.__core["client.ts"],[Ht,Ft,Ut,_t,C]=He;var de={order:{name:"order",method:"GET",path:"/order",fields:{id:!0}},addresses:{name:"addresses",method:"GET",path:"/addresses",fields:{}},subscriptions:{name:"subscriptions",method:"GET",path:"/subscriptions",fields:{}},profile:{name:"profile",method:"POST",path:"/profile",fields:{firstName:!0,lastName:!0}},saveAddress:{name:"saveAddress",method:"POST",path:"/address",fields:{id:!0,address:!0,isDefault:!0}},deleteAddress:{name:"deleteAddress",method:"POST",path:"/address/delete",fields:{id:!0}},subscription:{name:"subscription",method:"POST",path:"/subscription",fields:{id:!0,action:!0}},requestReturn:{name:"requestReturn",method:"POST",path:"/return",fields:{orderId:!0,lines:!0}}},$t=new Map(Object.values(de).map(e=>[`${e.method} ${e.path}`,{...e,fields:Object.keys(e.fields)}]));function le(e,t){let n=de[e];if(n.method==="POST")return{method:"POST",path:n.path};let r=t,s=new URLSearchParams;for(let d of Object.keys(n.fields)){let c=r[d];(typeof c=="string"||typeof c=="number")&&s.set(d,String(c))}let o=s.toString();return{method:"GET",path:o?`${n.path}?${o}`:n.path}}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function i(e,t){return g(e)?e[t]:void 0}function ce(e){return Array.isArray(e)?e:[]}function a(e){return typeof e=="string"&&e!==""?e:null}var $=e=>typeof e=="number"&&Number.isFinite(e)?e:null,N=e=>$(e)??0,k=(e,t)=>ce(e).map(n=>t(n)),x=(e,t)=>({nodes:k(i(e,"nodes"),t)}),W=e=>k(e,a).filter(t=>t!==null);function I(e){let t=a(i(e,"amount")),n=a(i(e,"currencyCode"));return t===null||n===null?null:{amount:t,currencyCode:n}}function X(e){let t=a(i(e,"url"));return t===null?null:{url:t,altText:a(i(e,"altText"))}}var me=e=>({title:a(i(e,"title")),variantTitle:a(i(e,"variantTitle")),quantity:N(i(e,"quantity")),image:X(i(e,"image"))});var ee=e=>new C(`Customer accounts: the answer has no ${e}`);function O(e,t){let n=a(e);if(!n)throw ee(t);return n}function fe(e){let t=n=>a(i(e,n));return{id:t("id"),firstName:t("firstName"),lastName:t("lastName"),company:t("company"),address1:t("address1"),address2:t("address2"),city:t("city"),province:t("province"),zoneCode:t("zoneCode"),zip:t("zip"),country:t("country"),countryCode:t("countryCode"),phoneNumber:t("phoneNumber"),formatted:W(i(e,"formatted"))}}var pe=e=>g(e)?fe(e):null,te=e=>({...fe(e),id:O(i(e,"id"),"address id")}),ge=e=>k(e,t=>({...te(t),isDefault:i(t,"isDefault")===!0})),Fe=e=>({...me(e),id:O(i(e,"id"),"line item id"),name:a(i(e,"name")),sku:a(i(e,"sku")),price:I(i(e,"price")),totalPrice:I(i(e,"totalPrice")),suggestedReturnReasonDefinitions:x(i(e,"suggestedReturnReasonDefinitions"),t=>({id:O(i(t,"id"),"return reason id"),name:a(i(t,"name")),handle:a(i(t,"handle"))}))}),Ue=e=>({id:a(i(e,"id")),status:a(i(e,"status")),createdAt:a(i(e,"createdAt")),estimatedDeliveryAt:a(i(e,"estimatedDeliveryAt")),latestShipmentStatus:a(i(e,"latestShipmentStatus")),trackingInformation:k(i(e,"trackingInformation"),t=>({company:a(i(t,"company")),number:a(i(t,"number")),url:a(i(t,"url"))}))});function _e(e){let t=a(i(i(e,"lineItem"),"id"));return{quantity:N(i(e,"quantity")),lineItem:t===null?null:{id:t}}}function Be(e){return g(e)?{returnableLineItems:x(e.returnableLineItems,_e)}:null}function ye(e){if(!g(e))return null;let t=s=>a(e[s]),n=s=>I(e[s]),r=e.requiresShipping;return{id:O(e.id,"order id"),name:t("name"),number:$(e.number),processedAt:t("processedAt"),cancelledAt:t("cancelledAt"),financialStatus:t("financialStatus"),fulfillmentStatus:t("fulfillmentStatus"),statusPageUrl:t("statusPageUrl"),requiresShipping:typeof r=="boolean"?r:null,totalPrice:n("totalPrice"),subtotal:n("subtotal"),totalShipping:n("totalShipping"),totalTax:n("totalTax"),shippingAddress:pe(e.shippingAddress),billingAddress:pe(e.billingAddress),lineItems:x(e.lineItems,Fe),fulfillments:x(e.fulfillments,Ue),returnInformation:Be(e.returnInformation),returns:x(e.returns,ne)}}var $e=e=>({id:a(i(e,"id")),name:a(i(e,"name")),title:a(i(e,"title")),variantTitle:a(i(e,"variantTitle")),quantity:N(i(e,"quantity")),sku:a(i(e,"sku")),currentPrice:I(i(e,"currentPrice")),lineDiscountedPrice:I(i(e,"lineDiscountedPrice")),image:X(i(e,"image"))}),he=e=>({cycleIndex:$(i(e,"cycleIndex")),skipped:i(e,"skipped")===!0,billingAttemptExpectedDate:a(i(e,"billingAttemptExpectedDate"))});function je(e){if(!g(e))return null;let t=e.intervalCount;return{interval:a(e.interval),intervalCount:g(t)?{count:N(t.count)}:null}}var ze=e=>({id:O(i(e,"id"),"subscription id"),status:a(i(e,"status")),nextBillingDate:a(i(e,"nextBillingDate")),currencyCode:a(i(e,"currencyCode")),deliveryPrice:I(i(e,"deliveryPrice")),deliveryPolicy:je(i(e,"deliveryPolicy")),lines:x(i(e,"lines"),$e),upcomingBillingCycles:x(i(e,"upcomingBillingCycles"),he)}),be=e=>k(e,ze);function we(e){let{contract:t,billingCycle:n}=e;if(g(t))return{contract:{id:a(t.id),status:a(t.status)}};if(g(n)){let{cycleIndex:r,skipped:s}=he(n);return{billingCycle:{cycleIndex:r,skipped:s}}}throw ee("changed subscription")}function ne(e){return{id:O(i(e,"id"),"return id"),status:a(i(e,"status"))}}var Ae=e=>O(e,"deleted address id"),xe=e=>({firstName:a(i(e,"firstName")),lastName:a(i(e,"lastName"))});var re=null;function Te(e){re=e}function D(){if(!re)throw new Error("account-pages: loaded without the account part");return re}async function E(e,t){let{serverFetch:n}=D(),{method:r,path:s}=le(e,t),o=await n(s,r==="POST"?{method:r,body:t}:{});if(o.kind==="logged-out")throw new C("Not logged in",{code:"NOT_LOGGED_IN",status:401});return o.data}function v(e){D().reset(),ue("account-updated",{what:e})}async function j(e){let t=await E("order",{id:e});return ye(t.order)}async function z({firstName:e,lastName:t}={}){let n=await E("profile",{firstName:e,lastName:t});return v("profile"),xe(n.customer)}async function G(){let e=await E("addresses",{});return ge(e.addresses)}async function H(e,{id:t,isDefault:n}={}){let r=await E("saveAddress",{id:t,address:e,isDefault:n});return v("addresses"),te(r.address)}async function V(e){let t=await E("deleteAddress",{id:e});return v("addresses"),Ae(t.deleted)}async function Z(){let e=await E("subscriptions",{});return be(e.subscriptions)}async function J(e,t){let n=await E("subscription",{id:e,action:t});return v("subscriptions"),we(n)}async function K(e,t){let n=await E("requestReturn",{orderId:e,lines:t});return v("orders"),ne(n.return)}var Ge=window.Tether.__core["shopify-values.ts"],[se]=Ge;function m(e,t,n){l(e,u(t)).forEach(r=>{let s=p(r,t)??"";Object.hasOwn(n,s)&&B(r,n[s]===!0)})}var S=(e,t)=>l(e,u(t)).concat(e.matches(u(t))?[e]:[]),L=e=>e?e.toLowerCase().replace(/_/g," "):"",F=e=>(e?.formatted??[]).join(", "),w=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0;var Ve=(e,t)=>({title:e.title||e.name||"","variant-title":e.variantTitle||"",quantity:String(e.quantity),price:b(e.price),total:b(e.totalPrice),sku:e.sku||"",returnable:t===null?void 0:String(t)}),Ze=e=>e.tagName==="INPUT";function Je(e,t,n){m(e,"order-line-show",{returnable:n>0}),l(e,u("return-quantity")).forEach(r=>{Ze(r)&&(r.max=String(n),r.min="0",r.value||(r.value="0"),r.disabled=n<1)}),l(e,`select${u("return-reason")}`).forEach(r=>{r.dataset.tetherFilled!==t.id&&(r.dataset.tetherFilled=t.id,(t.suggestedReturnReasonDefinitions?.nodes??[]).forEach(s=>{r.appendChild(new Option(s.name??"",s.id))}))})}function Oe(e,t,n){A(e,t,(r,s)=>{let o=s.id,d=n&&o?n.get(o)??0:null;o&&(r.dataset.tetherLine=o);let c=Ve(s,d);S(r,"order-line").forEach(f=>{let R=p(f,"order-line")??"";if(R==="image"){s.image&&_(f,s.image.url,s.image.altText||s.title||"");return}let ae=w(c,R);ae!==void 0&&y(f,ae)}),o&&d!==null&&Je(r,{...s,id:o},d)})}function Ke(e){let t=p(e,"order")||"";return t.startsWith("url:")?new URL(window.location.href).searchParams.get(t.slice(4)||"id"):t}function U(e,t){e.setAttribute(h("order-state"),t),m(e,"order-show",{loading:t==="loading",ready:!1,"not-found":t==="not-found",error:t==="error"})}var Ye=e=>({name:e.name??"",date:P(e.processedAt),total:b(e.totalPrice),subtotal:b(e.subtotal),shipping:b(e.totalShipping),tax:b(e.totalTax),status:L(e.financialStatus),fulfillment:L(e.fulfillmentStatus),"shipping-address":F(e.shippingAddress),"billing-address":F(e.billingAddress),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title||t.name||""}`).join(", "),cancelled:P(e.cancelledAt)});function Qe(e,t){let n=t.trackingInformation[0],r={status:L(t.latestShipmentStatus||t.status),date:P(t.createdAt),eta:P(t.estimatedDeliveryAt),company:n?.company||"",number:n?.number||""};S(e,"fulfillment-bind").forEach(s=>{let o=p(s,"fulfillment-bind")??"";if(o==="url"){let c=n?.url??null,f=c!==null&&se(c);f&&s.setAttribute("href",c),B(s,f);return}let d=w(r,o);d!==void 0&&y(s,d)})}function We(e,t){let n=new Map((t.returnInformation?.returnableLineItems.nodes??[]).map(d=>[d.lineItem?.id??"",d.quantity])),r=t.fulfillments.nodes,s=Ye(t);l(e,u("order-bind")).forEach(d=>{let c=p(d,"order-bind")??"";if(c==="url"){let R=t.statusPageUrl;R!==null&&se(R)&&d.setAttribute("href",R);return}let f=w(s,c);f!==void 0&&y(d,f)}),l(e,u("order-lines")).forEach(d=>{Oe(d,t.lineItems.nodes,n)}),l(e,u("order-fulfillments")).forEach(d=>{A(d,r,Qe)});let o=e.dataset.tetherReturned==="1";m(e,"order-show",{loading:!1,ready:!0,error:!1,"not-found":!1,cancelled:!!t.cancelledAt,shipped:r.length>0,returnable:[...n.values()].some(d=>d>0),"has-returns":!o&&t.returns.nodes.length>0,"return-requested":o}),e.setAttribute(h("order-state"),"ready")}async function Y(e){let t=Ke(e);if(!t){e.setAttribute(h("order-state"),"not-found"),m(e,"order-show",{"not-found":!0});return}U(e,"loading");let n;try{n=await j(t)}catch(r){T(r,"order"),U(e,"error");return}if(!n){U(e,"not-found");return}e.dataset.tetherOrderId=n.id,We(e,n)}var Ee=[],Se=e=>Ee.find(t=>t.id===e),Xe=e=>({formatted:F(e),name:[e.firstName,e.lastName].filter(Boolean).join(" "),company:e.company||"",address1:e.address1||"",address2:e.address2||"",city:e.city||"",zip:e.zip||"",province:e.province||"",country:e.country||"",phone:e.phoneNumber||""});function et(e,t){e.dataset.tetherAddress=t.id;let n=Xe(t);S(e,"address-bind").forEach(r=>{let s=w(n,p(r,"address-bind")??"");s!==void 0&&y(r,s)}),m(e,"address-show",{default:t.isDefault,"not-default":!t.isDefault})}async function M(e){let t=l(e,u("addresses"));if(!t.length)return;m(e,"show",{"addresses-loading":!0,"addresses-empty":!1});let n;try{n=await G()}catch(r){T(r,"addresses"),m(e,"show",{"addresses-loading":!1,"addresses-error":!0});return}Ee=n,m(e,"show",{"addresses-loading":!1,"addresses-empty":n.length===0,"addresses-error":!1}),t.forEach(r=>{A(r,n,et)})}function tt(e){let t=e.upcomingBillingCycles.nodes[0],n=e.status,r=n==="ACTIVE";return{active:r,paused:n==="PAUSED",cancelled:n==="CANCELLED",expired:n==="EXPIRED",failed:n==="FAILED",skipped:!!t?.skipped,"can-pause":r,"can-resume":n==="PAUSED"||n==="FAILED","can-skip":r&&t!==void 0&&!t.skipped,"can-unskip":r&&!!t?.skipped,"can-cancel":r||n==="PAUSED"||n==="FAILED"}}function nt(e){let t=L(e.deliveryPolicy?.interval);if(!t)return"";let n=e.deliveryPolicy?.intervalCount?.count??1;return n<=1?t:`${String(n)} ${t}s`}function rt(e){let t=e.lines.nodes,n=t.reduce((r,s)=>r+Number.parseFloat(s.lineDiscountedPrice?.amount??"0"),0);return{status:L(e.status),next:P(e.nextBillingDate),interval:nt(e),products:t.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", "),total:b(t.length&&e.currencyCode?{amount:String(n),currencyCode:e.currencyCode}:null),delivery:b(e.deliveryPrice)}}function st(e,t){let n={title:t.title??"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:b(t.currentPrice)};S(e,"subscription-line").forEach(r=>{let s=p(r,"subscription-line")??"";if(s==="image"){t.image&&_(r,t.image.url,t.image.altText||t.title||"");return}let o=w(n,s);o!==void 0&&y(r,o)})}function it(e,t){e.dataset.tetherSubscription=t.id,e.setAttribute(h("subscription-status"),L(t.status));let n=rt(t);l(e,u("subscription-bind")).forEach(s=>{let o=w(n,p(s,"subscription-bind")??"");o!==void 0&&y(s,o)}),l(e,u("subscription-lines")).forEach(s=>{A(s,t.lines.nodes,st)});let r=tt(t);m(e,"subscription-show",r),l(e,u("subscription-action")).forEach(s=>{let o=w(r,`can-${p(s,"subscription-action")??""}`)===!0;"disabled"in s&&(s.disabled=!o),s.classList.toggle("is-disabled",!o)})}async function Q(e){let t=l(e,u("subscriptions"));if(!t.length)return;m(e,"show",{"subscriptions-loading":!0,"subscriptions-empty":!1});let n;try{n=await Z()}catch(r){T(r,"subscriptions"),m(e,"show",{"subscriptions-loading":!1,"subscriptions-error":!0});return}m(e,"show",{"subscriptions-loading":!1,"subscriptions-empty":n.length===0,"subscriptions-error":!1}),t.forEach(r=>{A(r,n,it)})}var ot=["pause","resume","skip","unskip","cancel"],at=e=>ot.some(t=>t===e),Pe=e=>e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement,ke=e=>e instanceof window.HTMLFormElement;function Le(e){let t={};for(let n of e.elements)Pe(n)&&(!n.name||n.type==="submit"||n.type==="button"||n.type==="checkbox"||(t[n.name]=n.value));return t}function ut(e){let n=(e instanceof C?e.userErrors??[]:[]).map(s=>s.message).join(" ");return n||(e instanceof Error&&e.message?e.message:"Something went wrong").replace(/^Customer accounts: /,"")}async function q(e,t){if(e.getAttribute("aria-busy")==="true")return"busy";e.classList.add("is-busy"),e.setAttribute("aria-busy","true"),e.setAttribute(h("form-state"),"pending");let n=l(e,u("form-error"));n.forEach(r=>{y(r,"")});try{return await t(),e.setAttribute(h("form-state"),"saved"),"saved"}catch(r){return e.setAttribute(h("form-state"),"error"),n.forEach(s=>{y(s,ut(r))}),"error"}finally{e.classList.remove("is-busy"),e.removeAttribute("aria-busy")}}var ie=e=>{let t=p(e,"confirm");return!t||window.confirm(t)},Ie=e=>{e.reset(),delete e.dataset.tetherAddressId};function dt(e){let t=e.target;if(t instanceof window.HTMLFormElement){if(t.matches(u("profile-form")))e.preventDefault(),q(t,async()=>{await z(Le(t)),await D().bindCustomer(document)});else if(t.matches(u("address-form"))){e.preventDefault();let n=t.dataset.tetherAddressId,r=t.elements.namedItem("isDefault"),s=r instanceof window.HTMLInputElement&&r.checked;q(t,async()=>{await H(Le(t),{id:n,isDefault:s}),Ie(t),await M(document)})}}}function lt(e){let t=Se(e),n=document.querySelector(u("address-form"));if(!t||!n||!ke(n))return;n.dataset.tetherAddressId=t.id;let r={...t};for(let s of n.elements)if(Pe(s)){if(s.name==="isDefault")s instanceof window.HTMLInputElement&&(s.checked=t.isDefault);else if(s.name&&Object.hasOwn(r,s.name)){let o=r[s.name];s.value=typeof o=="string"?o:""}}n.scrollIntoView({block:"nearest"})}function ct(e,t){let n=t.closest("[data-tether-address]"),r=n instanceof window.HTMLElement?n.dataset.tetherAddress:void 0;if(t.closest(u("address-new"))){let o=document.querySelector(u("address-form"));return o&&ke(o)&&Ie(o),!0}if(!(n instanceof window.HTMLElement)||!r)return!1;let s=t.closest(u("address-delete"));if(s){if(e.preventDefault(),!ie(s))return!0;q(n,async()=>{await V(r),await M(document)})}else if(t.closest(u("address-default")))e.preventDefault(),q(n,async()=>{await H(null,{id:r,isDefault:!0}),await M(document)});else if(t.closest(u("address-edit")))e.preventDefault(),lt(r);else return!1;return!0}function mt(e){let t=e.closest("[data-tether-subscription]"),n=p(e,"subscription-action"),r="disabled"in e&&e.disabled===!0||e.classList.contains("is-disabled");if(!(t instanceof window.HTMLElement)||!at(n)||r||!ie(e))return;let s=t.dataset.tetherSubscription??"";t.setAttribute(h("subscription-state"),"pending"),q(t,async()=>{await J(s,n),await Q(document)}).then(o=>{let d=o==="error"?"error":"done";l(document,"[data-tether-subscription]").filter(c=>c===t||c.dataset.tetherSubscription===s).forEach(c=>{c.setAttribute(h("subscription-state"),d)})})}function pt(e){let t=e.querySelector(u("return-quantity")),n=e.querySelector(u("return-reason")),r=e.querySelector(u("return-note")),s=f=>f&&"value"in f&&typeof f.value=="string"?f.value:"",o={lineItemId:e.dataset.tetherLine??"",quantity:Number.parseInt(s(t)||"0",10)},d=s(n);d&&(o.reasonId=d);let c=s(r);return c&&(o.note=c),o}function ft(e){let t=e.closest(u("order"));if(!(t instanceof window.HTMLElement))return;let n=t.dataset.tetherOrderId;if(!n)return;let r=l(t,"[data-tether-line]").map(pt).filter(s=>s.quantity>0);!r.length||!ie(e)||q(t,async()=>{await K(n,r),t.dataset.tetherReturned="1",await Y(t)})}function gt(e){let t=e.target;if(!(t instanceof window.Element)||ct(e,t))return;let n=t.closest(u("subscription-action"));if(n instanceof window.HTMLElement){e.preventDefault(),mt(n);return}let r=t.closest(u("order-return"));r instanceof window.HTMLElement&&(e.preventDefault(),ft(r))}function Re(){document.addEventListener("submit",dt,!0),document.addEventListener("input",e=>{let t=e.target;t instanceof window.HTMLElement&&t.closest(u("profile-form"))&&(t.dataset.tetherTouched="1")}),document.addEventListener("click",gt)}var yt=["firstName","lastName"];async function ht(e){if(!(e instanceof window.HTMLFormElement))return;let t;try{t=await D().customer()}catch(r){T(r,"account");return}if(!t)return;let n=e.elements;yt.forEach(r=>{let s=n.namedItem(r);(s instanceof window.HTMLInputElement||s instanceof window.HTMLTextAreaElement)&&!s.dataset.tetherTouched&&(s.value=t[r]??"")})}var Ce=!1;async function bt(e=document){Ce||(Ce=!0,Re()),await Promise.all([...l(e,u("order")).map(t=>Y(t)),...l(e,u("profile-form")).map(t=>ht(t)),M(e),Q(e)])}function wt(e){l(e,u("order")).forEach(t=>{U(t,"error")}),m(e,"show",{"addresses-loading":!1,"addresses-error":!0,"subscriptions-loading":!1,"subscriptions-error":!0})}function At(e){return g(e)&&g(e.__core)&&g(e.__parts)}function Ne(e,t){let n=Reflect.get(window,"Tether");if(!At(n))throw new Error(`tether.${e}.js runs after the Tether script, which loads it, and needs its window.Tether`);n.__parts[e]=t}Ne("account-pages",oe);})();
@@ -533,8 +533,18 @@
533
533
  log("account", isLoggedIn() ? "logged in" : "logged out");
534
534
  }
535
535
 
536
+ // src/part-registry.ts
537
+ function isTetherInternals(value) {
538
+ return isRecord(value) && isRecord(value["__core"]) && isRecord(value["__parts"]);
539
+ }
540
+ function registerPart(name, part) {
541
+ const tether = Reflect.get(window, "Tether");
542
+ if (!isTetherInternals(tether)) {
543
+ throw new Error(`tether.${name}.js runs after the Tether script, which loads it, and needs its window.Tether`);
544
+ }
545
+ tether.__parts[name] = part;
546
+ }
547
+
536
548
  // src/parts/account.ts
537
- var { Tether } = window;
538
- if (!Tether) throw new Error("tether.account.js runs after the Tether script, which loads it");
539
- Tether.__parts.account = account_exports;
549
+ registerPart("account", account_exports);
540
550
  })();
@@ -1 +1 @@
1
- (()=>{var Tt=Object.defineProperty;var Pt=(t,e)=>{for(var r in e)Tt(t,r,{get:e[r],enumerable:!0})};var j={};Pt(j,{addresses:()=>ee,customer:()=>F,deleteAddress:()=>ne,isLoggedIn:()=>ht,login:()=>yt,logout:()=>At,mountAccount:()=>ue,order:()=>Qt,orders:()=>xt,render:()=>_,requestReturn:()=>ie,saveAddress:()=>re,subscriptionAction:()=>se,subscriptions:()=>oe,updateProfile:()=>te});var St=window.Tether.__core["config.ts"],[u,de,V,me,fe,h,ge]=St;var Lt=window.Tether.__core["client.ts"],[we,he,ye,xe,g]=Lt;var bt=window.Tether.__core["dom.ts"],[Oe,ke,Te,k,B,T,m,Pe,Se,Le,be,Ee,l,R,c,I,x,P]=bt;var Et=window.Tether.__core["cart.ts"],[S]=Et;var Rt=window.Tether.__core["lazy.ts"],[G]=Rt;function L(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function a(t,e){return L(t)?t[e]:void 0}function M(t){return Array.isArray(t)?t:[]}function i(t){return typeof t=="string"&&t!==""?t:null}var It=t=>typeof t=="number"&&Number.isFinite(t)?t:null,J=t=>It(t)??0,N=(t,e)=>M(t).map(r=>e(r)),K=(t,e)=>({nodes:N(a(t,"nodes"),e)}),D=t=>N(t,i).filter(e=>e!==null);function z(t){return t instanceof Error?t.message:String(t)}function W(t,e,r="localStorage"){try{window[r].setItem(t,e)}catch{}}function $(t,e="localStorage"){try{window[e].removeItem(t)}catch{}}var q=()=>`${u.prefix}:account-hint:${u.domain}`;var X=t=>t==="in"||t==="expired"||t==="error";function Nt(t){let e=i(a(t,"amount")),r=i(a(t,"currencyCode"));return e===null||r===null?null:{amount:e,currencyCode:r}}function vt(t){let e=i(a(t,"url"));return e===null?null:{url:e,altText:i(a(t,"altText"))}}var Ct=t=>({title:i(a(t,"title")),variantTitle:i(a(t,"variantTitle")),quantity:J(a(t,"quantity")),image:vt(a(t,"image"))}),Ut=(t,e)=>({id:e,name:i(a(t,"name")),processedAt:i(a(t,"processedAt")),financialStatus:i(a(t,"financialStatus")),fulfillmentStatus:i(a(t,"fulfillmentStatus")),statusPageUrl:i(a(t,"statusPageUrl")),totalPrice:Nt(a(t,"totalPrice")),lineItems:K(a(t,"lineItems"),Ct)});function Z(t){let e=[];for(let r of M(t)){let n=i(a(r,"id"));if(n===null)return{kind:"missing-id"};e.push(Ut(r,n))}return{kind:"read",orders:e}}var _t=t=>new g(`Customer accounts: the answer has no ${t}`);function Y(t){let e=L(t)?t:{},r=i(e.id),n=i(e.email),o=e.address;return{...r===null?{}:{id:r},firstName:i(e.firstName),lastName:i(e.lastName),displayName:i(e.displayName),emailAddress:n===null?null:{emailAddress:n},defaultAddress:Array.isArray(o)?{formatted:D(o)}:null}}function Q(t){let e=Z(t);if(e.kind==="missing-id")throw _t("order id");return e.orders}function Mt(t){let e=i(a(t,"message"));if(e===null)return null;let r=a(t,"field");return{message:e,field:Array.isArray(r)?D(r):null,code:i(a(t,"code"))}}var tt=t=>N(t,Mt).filter(e=>e!==null);var y=null;function et(){let t=u.account?.server;if(!t)throw new g("Customer accounts need the Worker: set account.server",{code:"NOT_CONFIGURED"});return new URL(t,window.location.href).href.replace(/\/$/,"")}function rt(t){t?W(q(),"1"):$(q())}async function Dt(t,e){try{return await fetch(t,e)}catch(r){throw new g(`Network error: ${z(r)}`,{code:"NETWORK"})}}async function $t(t){let e;try{e=await t.json()}catch{return{}}return L(e)?e:{}}async function A(t,{method:e="GET",body:r}={}){let n={method:e,credentials:"include"};e==="POST"&&(n.headers={"Content-Type":"application/json","X-Tether-Account":"1"}),r&&(n.body=JSON.stringify(r));let o=await Dt(`${et()}${t}`,n);if(o.status===401)return{kind:"logged-out"};let s=await $t(o);if(!o.ok){let d=i(s.error)??String(o.status),p=tt(s.userErrors);throw new g(`Customer accounts: ${d}`,{status:o.status,...p.length>0&&{userErrors:p},...s.code==="INVALID"&&{code:"INVALID"}})}return{kind:"answer",data:s}}async function v(){if(!y){let t=await A("/me");y=t.kind==="answer"&&t.data.loggedIn===!0?{loggedIn:!0,customer:Y(t.data.customer)}:{loggedIn:!1}}return rt(y.loggedIn),y}var nt=()=>y?.loggedIn===!0;function ot(){y=null}function st(t){let e=u.account?.navigate;e?e(t):window.location.assign(t)}var qt=t=>t||u.account?.locale||(u.locale||"").split("-")[0]||"";function it({returnTo:t,locale:e}){let r=new URL(`${et()}/login`);r.searchParams.set("returnTo",t);let n=qt(e);n&&r.searchParams.set("locale",n),u.country&&r.searchParams.set("country",u.country.toUpperCase()),st(r.toString())}async function at(){let t=S.id();if(!(await v()).loggedIn||!t)return null;let e=await A("/cart",{method:"POST",body:{cartId:t}});return e.kind==="logged-out"?null:i(e.data.checkoutUrl)}async function ct(t){let e=await A("/logout",{method:"POST",body:{returnTo:t,cartId:S.id()}});y=null,rt(!1),k("account-logout",{});let r=e.kind==="answer"?i(e.data.logoutUrl):null;return r?(st(r),"redirected"):"stayed"}var Ft=window.Tether.__core["shopify-values.ts"],[ut]=Ft;function b(t,e,r){l(t,c(e)).forEach(n=>{let o=m(n,e)??"";Object.hasOwn(r,o)&&P(n,r[o]===!0)})}var lt=(t,e)=>l(t,c(e)).concat(t.matches(c(e))?[t]:[]);var O=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0;var jt=(t,e)=>({title:t.title||t.name||"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:T(t.price),total:T(t.totalPrice),sku:t.sku||"",returnable:e===null?void 0:String(e)}),Ht=t=>t.tagName==="INPUT";function Vt(t,e,r){b(t,"order-line-show",{returnable:r>0}),l(t,c("return-quantity")).forEach(n=>{Ht(n)&&(n.max=String(r),n.min="0",n.value||(n.value="0"),n.disabled=r<1)}),l(t,`select${c("return-reason")}`).forEach(n=>{n.dataset.tetherFilled!==e.id&&(n.dataset.tetherFilled=e.id,(e.suggestedReturnReasonDefinitions?.nodes??[]).forEach(o=>{n.appendChild(new Option(o.name??"",o.id))}))})}function dt(t,e,r){R(t,e,(n,o)=>{let s=o.id,d=r&&s?r.get(s)??0:null;s&&(n.dataset.tetherLine=s);let p=jt(o,d);lt(n,"order-line").forEach(w=>{let E=m(w,"order-line")??"";if(E==="image"){o.image&&I(w,o.image.url,o.image.altText||o.title||"");return}let H=O(p,E);H!==void 0&&x(w,H)}),s&&d!==null&&Vt(n,{...o,id:s},d)})}var C=10,U=50,mt=t=>typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=U;function Bt(t){let e=Number.parseInt(t||String(C),10)||C;return Math.min(Math.max(e,1),U)}var Gt=t=>t.replace(/\?.*$/,"").replace(/^.*\//,"");function Jt(t){let e=u.account?.orderUrl;if(e)return e.replaceAll("{id}",encodeURIComponent(Gt(t.id)));let r=t.statusPageUrl;return r!==null&&ut(r)?r:null}var Kt=t=>({name:t.name??"",date:B(t.processedAt),total:T(t.totalPrice),status:t.financialStatus?.toLowerCase(),fulfillment:t.fulfillmentStatus?.toLowerCase(),items:t.lineItems.nodes.map(e=>`${String(e.quantity)}\xD7 ${e.title??""}`).join(", ")});function zt(t,e){let r=e.lineItems.nodes,n=Jt(e),o=Kt(e);l(t,c("order-bind")).forEach(s=>{let d=m(s,"order-bind")??"";if(d==="url"){n&&s.setAttribute("href",n);return}if(d==="image"){let w=r.find(E=>E.image)?.image;w&&I(s,w.url,w.altText||r[0]?.title||"");return}let p=O(o,d);p!==void 0&&x(s,p)}),l(t,c("order-lines")).forEach(s=>{dt(s,r,null)}),m(t,"order-bind")==="url"&&n&&t.setAttribute("href",n)}async function ft(t,e){let r=l(t,c("orders")),n=r[0];if(!n)return;b(t,"show",{"orders-loading":!0,"orders-empty":!1});let o=Bt(m(n,"limit")),s;try{s=await e(o)}catch(d){h(d,"orders"),s=null}b(t,"show",{"orders-loading":!1,"orders-empty":s?.length===0}),r.forEach(d=>{R(d,s??[],zt)})}var Wt=["order","addresses","subscriptions","profile-form","address-form"],ht=nt;function yt({returnTo:t=window.location.href,locale:e}={}){return new Promise(r=>{it({returnTo:t,locale:e}),r()})}async function F(){let t=await v();return t.loggedIn?t.customer:null}async function xt({first:t=C}={}){if(!mt(t))throw new g(`Customer accounts: orders() takes first from 1 to ${String(U)}`,{code:"INVALID"});let e=await A(`/orders?${new URLSearchParams({first:String(t)}).toString()}`);return e.kind==="logged-out"?[]:Q(e.data.orders)}async function At({returnTo:t=u.account?.logoutUrl||`${window.location.origin}/`}={}){await ct(t)==="stayed"&&await _(document)}async function Xt(){try{return(await v()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(t){return{kind:"unknown",error:t}}}var gt=t=>Wt.some(e=>l(t,c(e)).length>0);function Zt(t){l(t,c("account-link")).forEach(e=>{e.setAttribute("href",Yt(m(e,"account-link")))})}function Yt(t){let e=u.account,r=`https://${u.domain}/account`;return t==="payment"?e?.paymentUrl||e?.subscriptionsUrl||r:t==="subscriptions"&&e?.subscriptionsUrl||r}async function _(t=document){let e=await Xt();e.kind==="unknown"&&h(e.error,"account");let r=e.kind==="logged-in";if(l(t,c("show")).forEach(n=>{let o=m(n,"show");o==="logged-in"&&P(n,r),o==="logged-out"&&P(n,!r)}),Zt(t),e.kind==="unknown"&&gt(t)){(await f()).showUnavailable(t);return}r&&(await Ot(t),await Promise.all([ft(t,n=>xt({first:n})),gt(t)?f().then(n=>n.renderPages(t)):null]))}async function Ot(t){let e=l(t,c("account-bind"));if(!e.length)return;let r;try{r=await F()}catch(o){h(o,"account");return}if(!r)return;let n={"first-name":r.firstName,"last-name":r.lastName,name:r.displayName,email:r.emailAddress?.emailAddress,address:r.defaultAddress?.formatted.join(", ")};e.forEach(o=>{let s=O(n,m(o,"account-bind")??"");s!=null&&x(o,s)})}var pt=null;function f(){return pt??(pt=G("account-pages").then(t=>(t.setup({serverFetch:A,customer:F,bindCustomer:Ot,reset:ot}),t))),pt}var Qt=t=>f().then(e=>e.order(t)),te=t=>f().then(e=>e.updateProfile(t)),ee=()=>f().then(t=>t.addresses()),re=(t,e)=>f().then(r=>r.saveAddress(t,e)),ne=t=>f().then(e=>e.deleteAddress(t)),oe=()=>f().then(t=>t.subscriptions()),se=(t,e)=>f().then(r=>r.subscriptionAction(t,e)),ie=(t,e)=>f().then(r=>r.requestReturn(t,e));function ae(t){let e=t.target;e instanceof window.Element&&(e.closest(c("account-login"))?(t.preventDefault(),yt().catch(r=>{h(r,"login")})):e.closest(c("account-logout"))&&(t.preventDefault(),At().catch(r=>{h(r,"logout")})))}function ce(){let t=new URL(window.location.href),e=t.searchParams.get("account");if(X(e))switch(t.searchParams.delete("account"),window.history.replaceState(window.history.state,"",t),e){case"in":k("account-login",{});break;case"expired":case"error":k("account-error",{error:e});break}}var wt=!1;async function ue(t=document){if(wt){await _(t);return}wt=!0,document.addEventListener("click",ae),ce(),S.setCheckoutResolver(at),await _(t),V("account",ht()?"logged in":"logged out")}var{Tether:kt}=window;if(!kt)throw new Error("tether.account.js runs after the Tether script, which loads it");kt.__parts.account=j;})();
1
+ (()=>{var Pt=Object.defineProperty;var Tt=(t,e)=>{for(var r in e)Pt(t,r,{get:e[r],enumerable:!0})};var j={};Tt(j,{addresses:()=>ee,customer:()=>F,deleteAddress:()=>ne,isLoggedIn:()=>ht,login:()=>yt,logout:()=>At,mountAccount:()=>ue,order:()=>Qt,orders:()=>xt,render:()=>_,requestReturn:()=>ie,saveAddress:()=>re,subscriptionAction:()=>se,subscriptions:()=>oe,updateProfile:()=>te});var St=window.Tether.__core["config.ts"],[u,me,V,fe,ge,y,pe]=St;var Lt=window.Tether.__core["client.ts"],[he,ye,xe,Ae,p]=Lt;var bt=window.Tether.__core["dom.ts"],[ke,Pe,Te,P,B,T,m,Se,Le,be,Re,Ee,d,E,c,I,A,S]=bt;var Rt=window.Tether.__core["cart.ts"],[L]=Rt;var Et=window.Tether.__core["lazy.ts"],[G]=Et;function g(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function a(t,e){return g(t)?t[e]:void 0}function M(t){return Array.isArray(t)?t:[]}function i(t){return typeof t=="string"&&t!==""?t:null}var It=t=>typeof t=="number"&&Number.isFinite(t)?t:null,J=t=>It(t)??0,N=(t,e)=>M(t).map(r=>e(r)),K=(t,e)=>({nodes:N(a(t,"nodes"),e)}),$=t=>N(t,i).filter(e=>e!==null);function z(t){return t instanceof Error?t.message:String(t)}function W(t,e,r="localStorage"){try{window[r].setItem(t,e)}catch{}}function D(t,e="localStorage"){try{window[e].removeItem(t)}catch{}}var q=()=>`${u.prefix}:account-hint:${u.domain}`;var X=t=>t==="in"||t==="expired"||t==="error";function Nt(t){let e=i(a(t,"amount")),r=i(a(t,"currencyCode"));return e===null||r===null?null:{amount:e,currencyCode:r}}function vt(t){let e=i(a(t,"url"));return e===null?null:{url:e,altText:i(a(t,"altText"))}}var Ct=t=>({title:i(a(t,"title")),variantTitle:i(a(t,"variantTitle")),quantity:J(a(t,"quantity")),image:vt(a(t,"image"))}),Ut=(t,e)=>({id:e,name:i(a(t,"name")),processedAt:i(a(t,"processedAt")),financialStatus:i(a(t,"financialStatus")),fulfillmentStatus:i(a(t,"fulfillmentStatus")),statusPageUrl:i(a(t,"statusPageUrl")),totalPrice:Nt(a(t,"totalPrice")),lineItems:K(a(t,"lineItems"),Ct)});function Z(t){let e=[];for(let r of M(t)){let n=i(a(r,"id"));if(n===null)return{kind:"missing-id"};e.push(Ut(r,n))}return{kind:"read",orders:e}}var _t=t=>new p(`Customer accounts: the answer has no ${t}`);function Y(t){let e=g(t)?t:{},r=i(e.id),n=i(e.email),o=e.address;return{...r===null?{}:{id:r},firstName:i(e.firstName),lastName:i(e.lastName),displayName:i(e.displayName),emailAddress:n===null?null:{emailAddress:n},defaultAddress:Array.isArray(o)?{formatted:$(o)}:null}}function Q(t){let e=Z(t);if(e.kind==="missing-id")throw _t("order id");return e.orders}function Mt(t){let e=i(a(t,"message"));if(e===null)return null;let r=a(t,"field");return{message:e,field:Array.isArray(r)?$(r):null,code:i(a(t,"code"))}}var tt=t=>N(t,Mt).filter(e=>e!==null);var x=null;function et(){let t=u.account?.server;if(!t)throw new p("Customer accounts need the Worker: set account.server",{code:"NOT_CONFIGURED"});return new URL(t,window.location.href).href.replace(/\/$/,"")}function rt(t){t?W(q(),"1"):D(q())}async function $t(t,e){try{return await fetch(t,e)}catch(r){throw new p(`Network error: ${z(r)}`,{code:"NETWORK"})}}async function Dt(t){let e;try{e=await t.json()}catch{return{}}return g(e)?e:{}}async function O(t,{method:e="GET",body:r}={}){let n={method:e,credentials:"include"};e==="POST"&&(n.headers={"Content-Type":"application/json","X-Tether-Account":"1"}),r&&(n.body=JSON.stringify(r));let o=await $t(`${et()}${t}`,n);if(o.status===401)return{kind:"logged-out"};let s=await Dt(o);if(!o.ok){let l=i(s.error)??String(o.status),w=tt(s.userErrors);throw new p(`Customer accounts: ${l}`,{status:o.status,...w.length>0&&{userErrors:w},...s.code==="INVALID"&&{code:"INVALID"}})}return{kind:"answer",data:s}}async function v(){if(!x){let t=await O("/me");x=t.kind==="answer"&&t.data.loggedIn===!0?{loggedIn:!0,customer:Y(t.data.customer)}:{loggedIn:!1}}return rt(x.loggedIn),x}var nt=()=>x?.loggedIn===!0;function ot(){x=null}function st(t){let e=u.account?.navigate;e?e(t):window.location.assign(t)}var qt=t=>t||u.account?.locale||(u.locale||"").split("-")[0]||"";function it({returnTo:t,locale:e}){let r=new URL(`${et()}/login`);r.searchParams.set("returnTo",t);let n=qt(e);n&&r.searchParams.set("locale",n),u.country&&r.searchParams.set("country",u.country.toUpperCase()),st(r.toString())}async function at(){let t=L.id();if(!(await v()).loggedIn||!t)return null;let e=await O("/cart",{method:"POST",body:{cartId:t}});return e.kind==="logged-out"?null:i(e.data.checkoutUrl)}async function ct(t){let e=await O("/logout",{method:"POST",body:{returnTo:t,cartId:L.id()}});x=null,rt(!1),P("account-logout",{});let r=e.kind==="answer"?i(e.data.logoutUrl):null;return r?(st(r),"redirected"):"stayed"}var Ft=window.Tether.__core["shopify-values.ts"],[ut]=Ft;function b(t,e,r){d(t,c(e)).forEach(n=>{let o=m(n,e)??"";Object.hasOwn(r,o)&&S(n,r[o]===!0)})}var dt=(t,e)=>d(t,c(e)).concat(t.matches(c(e))?[t]:[]);var k=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0;var jt=(t,e)=>({title:t.title||t.name||"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:T(t.price),total:T(t.totalPrice),sku:t.sku||"",returnable:e===null?void 0:String(e)}),Ht=t=>t.tagName==="INPUT";function Vt(t,e,r){b(t,"order-line-show",{returnable:r>0}),d(t,c("return-quantity")).forEach(n=>{Ht(n)&&(n.max=String(r),n.min="0",n.value||(n.value="0"),n.disabled=r<1)}),d(t,`select${c("return-reason")}`).forEach(n=>{n.dataset.tetherFilled!==e.id&&(n.dataset.tetherFilled=e.id,(e.suggestedReturnReasonDefinitions?.nodes??[]).forEach(o=>{n.appendChild(new Option(o.name??"",o.id))}))})}function lt(t,e,r){E(t,e,(n,o)=>{let s=o.id,l=r&&s?r.get(s)??0:null;s&&(n.dataset.tetherLine=s);let w=jt(o,l);dt(n,"order-line").forEach(h=>{let R=m(h,"order-line")??"";if(R==="image"){o.image&&I(h,o.image.url,o.image.altText||o.title||"");return}let H=k(w,R);H!==void 0&&A(h,H)}),s&&l!==null&&Vt(n,{...o,id:s},l)})}var C=10,U=50,mt=t=>typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=U;function Bt(t){let e=Number.parseInt(t||String(C),10)||C;return Math.min(Math.max(e,1),U)}var Gt=t=>t.replace(/\?.*$/,"").replace(/^.*\//,"");function Jt(t){let e=u.account?.orderUrl;if(e)return e.replaceAll("{id}",encodeURIComponent(Gt(t.id)));let r=t.statusPageUrl;return r!==null&&ut(r)?r:null}var Kt=t=>({name:t.name??"",date:B(t.processedAt),total:T(t.totalPrice),status:t.financialStatus?.toLowerCase(),fulfillment:t.fulfillmentStatus?.toLowerCase(),items:t.lineItems.nodes.map(e=>`${String(e.quantity)}\xD7 ${e.title??""}`).join(", ")});function zt(t,e){let r=e.lineItems.nodes,n=Jt(e),o=Kt(e);d(t,c("order-bind")).forEach(s=>{let l=m(s,"order-bind")??"";if(l==="url"){n&&s.setAttribute("href",n);return}if(l==="image"){let h=r.find(R=>R.image)?.image;h&&I(s,h.url,h.altText||r[0]?.title||"");return}let w=k(o,l);w!==void 0&&A(s,w)}),d(t,c("order-lines")).forEach(s=>{lt(s,r,null)}),m(t,"order-bind")==="url"&&n&&t.setAttribute("href",n)}async function ft(t,e){let r=d(t,c("orders")),n=r[0];if(!n)return;b(t,"show",{"orders-loading":!0,"orders-empty":!1});let o=Bt(m(n,"limit")),s;try{s=await e(o)}catch(l){y(l,"orders"),s=null}b(t,"show",{"orders-loading":!1,"orders-empty":s?.length===0}),r.forEach(l=>{E(l,s??[],zt)})}var Wt=["order","addresses","subscriptions","profile-form","address-form"],ht=nt;function yt({returnTo:t=window.location.href,locale:e}={}){return new Promise(r=>{it({returnTo:t,locale:e}),r()})}async function F(){let t=await v();return t.loggedIn?t.customer:null}async function xt({first:t=C}={}){if(!mt(t))throw new p(`Customer accounts: orders() takes first from 1 to ${String(U)}`,{code:"INVALID"});let e=await O(`/orders?${new URLSearchParams({first:String(t)}).toString()}`);return e.kind==="logged-out"?[]:Q(e.data.orders)}async function At({returnTo:t=u.account?.logoutUrl||`${window.location.origin}/`}={}){await ct(t)==="stayed"&&await _(document)}async function Xt(){try{return(await v()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(t){return{kind:"unknown",error:t}}}var gt=t=>Wt.some(e=>d(t,c(e)).length>0);function Zt(t){d(t,c("account-link")).forEach(e=>{e.setAttribute("href",Yt(m(e,"account-link")))})}function Yt(t){let e=u.account,r=`https://${u.domain}/account`;return t==="payment"?e?.paymentUrl||e?.subscriptionsUrl||r:t==="subscriptions"&&e?.subscriptionsUrl||r}async function _(t=document){let e=await Xt();e.kind==="unknown"&&y(e.error,"account");let r=e.kind==="logged-in";if(d(t,c("show")).forEach(n=>{let o=m(n,"show");o==="logged-in"&&S(n,r),o==="logged-out"&&S(n,!r)}),Zt(t),e.kind==="unknown"&&gt(t)){(await f()).showUnavailable(t);return}r&&(await Ot(t),await Promise.all([ft(t,n=>xt({first:n})),gt(t)?f().then(n=>n.renderPages(t)):null]))}async function Ot(t){let e=d(t,c("account-bind"));if(!e.length)return;let r;try{r=await F()}catch(o){y(o,"account");return}if(!r)return;let n={"first-name":r.firstName,"last-name":r.lastName,name:r.displayName,email:r.emailAddress?.emailAddress,address:r.defaultAddress?.formatted.join(", ")};e.forEach(o=>{let s=k(n,m(o,"account-bind")??"");s!=null&&A(o,s)})}var pt=null;function f(){return pt??(pt=G("account-pages").then(t=>(t.setup({serverFetch:O,customer:F,bindCustomer:Ot,reset:ot}),t))),pt}var Qt=t=>f().then(e=>e.order(t)),te=t=>f().then(e=>e.updateProfile(t)),ee=()=>f().then(t=>t.addresses()),re=(t,e)=>f().then(r=>r.saveAddress(t,e)),ne=t=>f().then(e=>e.deleteAddress(t)),oe=()=>f().then(t=>t.subscriptions()),se=(t,e)=>f().then(r=>r.subscriptionAction(t,e)),ie=(t,e)=>f().then(r=>r.requestReturn(t,e));function ae(t){let e=t.target;e instanceof window.Element&&(e.closest(c("account-login"))?(t.preventDefault(),yt().catch(r=>{y(r,"login")})):e.closest(c("account-logout"))&&(t.preventDefault(),At().catch(r=>{y(r,"logout")})))}function ce(){let t=new URL(window.location.href),e=t.searchParams.get("account");if(X(e))switch(t.searchParams.delete("account"),window.history.replaceState(window.history.state,"",t),e){case"in":P("account-login",{});break;case"expired":case"error":P("account-error",{error:e});break}}var wt=!1;async function ue(t=document){if(wt){await _(t);return}wt=!0,document.addEventListener("click",ae),ce(),L.setCheckoutResolver(at),await _(t),V("account",ht()?"logged in":"logged out")}function de(t){return g(t)&&g(t.__core)&&g(t.__parts)}function kt(t,e){let r=Reflect.get(window,"Tether");if(!de(r))throw new Error(`tether.${t}.js runs after the Tether script, which loads it, and needs its window.Tether`);r.__parts[t]=e}kt("account",j);})();
@@ -357,8 +357,23 @@
357
357
  };
358
358
  }
359
359
 
360
+ // server/src/shared/json.ts
361
+ function isRecord(value) {
362
+ return value !== null && typeof value === "object" && !Array.isArray(value);
363
+ }
364
+
365
+ // src/part-registry.ts
366
+ function isTetherInternals(value) {
367
+ return isRecord(value) && isRecord(value["__core"]) && isRecord(value["__parts"]);
368
+ }
369
+ function registerPart(name, part) {
370
+ const tether = Reflect.get(window, "Tether");
371
+ if (!isTetherInternals(tether)) {
372
+ throw new Error(`tether.${name}.js runs after the Tether script, which loads it, and needs its window.Tether`);
373
+ }
374
+ tether.__parts[name] = part;
375
+ }
376
+
360
377
  // src/parts/analytics.ts
361
- var { Tether } = window;
362
- if (!Tether) throw new Error("tether.analytics.js runs after the Tether script, which loads it");
363
- Tether.__parts.analytics = analytics_exports;
378
+ registerPart("analytics", analytics_exports);
364
379
  })();
@@ -1 +1 @@
1
- (()=>{var j=Object.defineProperty;var U=(t,e)=>{for(var n in e)j(t,n,{get:e[n],enumerable:!0})};var _={};U(_,{startAnalytics:()=>mt});var $=window.Tether.__core["config.ts"],[a,ht,w,gt,vt,l,bt]=$;var G=window.Tether.__core["dom.ts"],[C,_t,wt,Ct,Et,kt,St,At,Pt,E,xt,Lt,It,Nt,p,Rt,Vt,Dt]=G;var W=window.Tether.__core["cart.ts"],[g]=W;var Y=window.Tether.__core["product.ts"],[k]=Y;var H=window.Tether.__core["client.ts"],[Ot,S,Ft,A,jt]=H;var J=500,P={"default-banner":"https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js",other:"https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js"},z="https://cdn.shopify.com/storefront/analytics/shopify.js",L=()=>window,y=()=>L().Shopify;function I(){let t=a.analytics?.shopify;return typeof t=="object"?t:{}}function N(){try{let t=y()?.customerPrivacy;return t?.consentStatus==="loaded"&&t.currentVisitorConsent?.()?.analytics!=="no"&&!!t.analyticsProcessingAllowed?.()}catch{return!1}}function K(t){let e=`hydrogen:${t}`;return{getTrackingValues:()=>{let n=N()?y()?.customerPrivacy?.__internal:void 0;return{uniqueToken:n?.uniqueToken?.({generateFallback:!0,tag:e})??"",visitToken:n?.visitToken?.({generateFallback:!0,tag:e})??""}}}}var X=t=>(e,n)=>{let i=t.subscribers.get(e)??new Set;return t.subscribers.set(e,i),i.add(n),()=>t.subscribers.get(e)?.delete(n)};function Z(t){let e=[],n=[],i={shop:{shopId:t,channel:"headless"},consent:{mode:I().consent||"no-banner"}},o=()=>{if(N())for(let r of e)for(;r.next<n.length;r.next+=1){let s=n[r.next];s&&Q(r,s)}},c={getConfig:()=>i,publish(r,s={}){if(n.push({event:r,payload:{shop:i.shop,url:window.location.href,...s}}),n.length>J){n.shift();for(let d of e)d.next=Math.max(0,d.next-1)}o()},addDestination(r){let s={name:r.name,next:0,subscribers:new Map,context:K(r.name)};return Promise.resolve(r.setup?.({subscribe:X(s),getConfig:c.getConfig})).then(()=>{e.push(s),o()}).catch(d=>{l(d,`analytics ${r.name}`)}),()=>{let d=e.indexOf(s);d>=0&&e.splice(d,1)}}};return document.addEventListener("consentTrackingApiLoaded",o),document.addEventListener("visitorConsentCollected",o),c}function Q(t,{event:e,payload:n}){t.subscribers.get(e)?.forEach(i=>{try{i(n,t.context)}catch(o){l(o,`analytics ${t.name}`)}})}function x(t){let e=document.createElement("script");e.src=t,e.async=!0,document.head.appendChild(e)}async function R(t){let e=y();if(e?.analytics)return e.analytics;let n=await S("query TetherShopId { shop { id } }",{},A({shop:{id:"string"}}),{context:!1}),i=y()??{};L().Shopify=i,i.country=a.country??"US";let[o="en"]=(a.locale||"en").split("-");i.locale=o.toLowerCase(),i.shop=a.domain,i.routes={root:"/",match:()=>({pageTemplateName:t()?"product":"page"}),...i.routes};let{proxy:c,consent:r}=I();i.customerPrivacy={...i.customerPrivacy,config:c?{isHeadless:!0,asyncConsent:!0,asyncVisitorState:!0,consentDomain:window.location.host}:{isHeadless:!0,storefrontAccessToken:a.token,checkoutRootDomain:a.domain}};let s=Z(n.shop.id);return i.analytics=s,x(r==="default-banner"?P["default-banner"]:P.other),x(z),w("shopify analytics ready",n.shop.id),s}var tt="Default Title",V=100,et=200,nt=t=>t?parseFloat(t.amount):0,D=t=>(t??"").split("/").pop()??"";function T(t,e,n=1,i){let o={item_id:e?.sku||D(e?.id)||D(t.id),item_name:t.title,item_variant:e?.title===tt?void 0:e?.title,item_brand:t.vendor||void 0,item_category:t.productType||void 0,price:nt(e?.price??t.priceRange?.minVariantPrice),quantity:n};return i!=null&&(o.index=i),o}var h=(t,e=t.quantity)=>T(t.merchandise.product,t.merchandise,e);function f(t){let e=t.reduce((n,i)=>n+i.price*(i.quantity||1),0);return Math.round(e*V)/V}var it=(t,e,n=1)=>({id:t.id,title:t.title,price:e.price,vendor:t.vendor||"",variantId:e.id,variantTitle:e.title,quantity:n,sku:e.sku||void 0,productType:t.productType||void 0}),M=t=>({id:t.id,quantity:t.quantity,merchandise:{id:t.merchandise.id,title:t.merchandise.title,price:t.merchandise.price,sku:t.merchandise.sku,product:{id:t.merchandise.product.id,title:t.merchandise.product.title,vendor:t.merchandise.product.vendor||"",handle:t.merchandise.product.handle}}});function ot(){let{dataLayer:t}=a.analytics??{},e=typeof t=="string"?t:"dataLayer",n=Reflect.get(window,e);if(Array.isArray(n))return n;let i=[];return Reflect.set(window,e,i),i}function rt(t,e){let n=ot();if(!e){n.push({event:t});return}n.push({ecommerce:null}),n.push({event:t,ecommerce:e})}var m=null,v=null,B=null,b=new WeakSet;function u(t,e,n,i){a.analytics?.dataLayer&&rt(t,e),m&&n&&m.publish(n,i);try{a.analytics?.onEvent?.(t,e)}catch(o){l(o,"analytics onEvent")}}function O(){let t=document.querySelector(p("product"));return!t||t.closest(`${p("collection")},${p("products")},${p("recommendations")}`)?null:k.get(t)??null}function st({product:t,scope:e}){if(b.has(e.root)||O()!==e)return;b.add(e.root);let n=e.variant??t.variants.nodes[0],i=[T(t,n)],o=n?[it(t,n)]:[];u("view_item",{currency:n?.price.currencyCode,value:f(i),items:i},"product_viewed",{products:o})}function at({products:t,collection:e}){let n=t.slice(0,et).map((o,c)=>T(o,o.variants.nodes[0],1,c)),i={item_list_id:e?.handle||"products",item_list_name:e?.title||"Products"};if(!e){u("view_item_list",{...i,items:n});return}u("view_item_list",{...i,items:n},"collection_viewed",{collection:{id:e.id,handle:e.handle}})}function ct(t,e,n){let i=t?.cost.totalAmount.currencyCode;e.forEach((o,c)=>{let r=n.get(c),s=o.quantity-(r?.quantity??0);if(s<=0)return;let d=[h(o,s)];u("add_to_cart",{currency:i,value:f(d),items:d},"product_added_to_cart",{cart:t,prevCart:B,currentLine:M(o),prevLine:r?M(r):void 0})}),n.forEach((o,c)=>{let r=o.quantity-(e.get(c)?.quantity??0);if(r<=0)return;let s=[h(o,r)];u("remove_from_cart",{currency:i,value:f(s),items:s})})}function dt({cart:t,reason:e}){let n=new Map((t?.lines.nodes??[]).map(i=>[i.merchandise.id,i]));v&&e!=="load"&&e!=="pending"&&ct(t,n,v),v=n,B=t}function ut(){let t=g.lines.map(e=>h(e));u("view_cart",{currency:g.state?.cost.totalAmount.currencyCode,value:f(t),items:t})}function lt({cart:t}){if(!t)return;let e=t.lines.nodes.map(i=>h(i)),n=t.discountCodes.filter(i=>i.applicable).map(i=>i.code);u("begin_checkout",{currency:t.cost.totalAmount.currencyCode,value:f(e),coupon:n.join(",")||void 0,items:e})}var pt={"product-ready":st,"list-ready":at,"cart-updated":dt,"cart-toggled":({open:t})=>{t&&ut()},checkout:lt,search:({term:t})=>{t&&u("search",{search_term:t},"search_viewed",{searchTerm:t})}};function ft(t,e){pt[e](t.detail)}function q(t){if(t.type==="astro:page-load"){b=new WeakSet,m?.publish("page_viewed",{});return}C.forEach(e=>{E(t,e)&&ft(t,e)})}async function mt(t){a.analytics?.shopify&&(m=await R(()=>O()!=null).catch(e=>(l(e,"shopify analytics"),null))),m?.publish("page_viewed",{}),t.splice(0).forEach(q),t.push=(...e)=>(e.forEach(q),t.length)}var{Tether:F}=window;if(!F)throw new Error("tether.analytics.js runs after the Tether script, which loads it");F.__parts.analytics=_;})();
1
+ (()=>{var U=Object.defineProperty;var $=(t,n)=>{for(var e in n)U(t,e,{get:n[e],enumerable:!0})};var k={};$(k,{startAnalytics:()=>yt});var G=window.Tether.__core["config.ts"],[a,bt,_,vt,wt,l,Tt]=G;var W=window.Tether.__core["dom.ts"],[C,_t,Ct,Et,xt,At,Pt,St,Lt,E,Nt,It,Rt,Vt,p,Dt,Mt,qt]=W;var Y=window.Tether.__core["cart.ts"],[b]=Y;var H=window.Tether.__core["product.ts"],[x]=H;var J=window.Tether.__core["client.ts"],[jt,A,Ut,P,$t]=J;var Z=500,S={"default-banner":"https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js",other:"https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js"},z="https://cdn.shopify.com/storefront/analytics/shopify.js",N=()=>window,y=()=>N().Shopify;function I(){let t=a.analytics?.shopify;return typeof t=="object"?t:{}}function R(){try{let t=y()?.customerPrivacy;return t?.consentStatus==="loaded"&&t.currentVisitorConsent?.()?.analytics!=="no"&&!!t.analyticsProcessingAllowed?.()}catch{return!1}}function K(t){let n=`hydrogen:${t}`;return{getTrackingValues:()=>{let e=R()?y()?.customerPrivacy?.__internal:void 0;return{uniqueToken:e?.uniqueToken?.({generateFallback:!0,tag:n})??"",visitToken:e?.visitToken?.({generateFallback:!0,tag:n})??""}}}}var X=t=>(n,e)=>{let r=t.subscribers.get(n)??new Set;return t.subscribers.set(n,r),r.add(e),()=>t.subscribers.get(n)?.delete(e)};function Q(t){let n=[],e=[],r={shop:{shopId:t,channel:"headless"},consent:{mode:I().consent||"no-banner"}},o=()=>{if(R())for(let i of n)for(;i.next<e.length;i.next+=1){let s=e[i.next];s&&tt(i,s)}},c={getConfig:()=>r,publish(i,s={}){if(e.push({event:i,payload:{shop:r.shop,url:window.location.href,...s}}),e.length>Z){e.shift();for(let u of n)u.next=Math.max(0,u.next-1)}o()},addDestination(i){let s={name:i.name,next:0,subscribers:new Map,context:K(i.name)};return Promise.resolve(i.setup?.({subscribe:X(s),getConfig:c.getConfig})).then(()=>{n.push(s),o()}).catch(u=>{l(u,`analytics ${i.name}`)}),()=>{let u=n.indexOf(s);u>=0&&n.splice(u,1)}}};return document.addEventListener("consentTrackingApiLoaded",o),document.addEventListener("visitorConsentCollected",o),c}function tt(t,{event:n,payload:e}){t.subscribers.get(n)?.forEach(r=>{try{r(e,t.context)}catch(o){l(o,`analytics ${t.name}`)}})}function L(t){let n=document.createElement("script");n.src=t,n.async=!0,document.head.appendChild(n)}async function V(t){let n=y();if(n?.analytics)return n.analytics;let e=await A("query TetherShopId { shop { id } }",{},P({shop:{id:"string"}}),{context:!1}),r=y()??{};N().Shopify=r,r.country=a.country??"US";let[o="en"]=(a.locale||"en").split("-");r.locale=o.toLowerCase(),r.shop=a.domain,r.routes={root:"/",match:()=>({pageTemplateName:t()?"product":"page"}),...r.routes};let{proxy:c,consent:i}=I();r.customerPrivacy={...r.customerPrivacy,config:c?{isHeadless:!0,asyncConsent:!0,asyncVisitorState:!0,consentDomain:window.location.host}:{isHeadless:!0,storefrontAccessToken:a.token,checkoutRootDomain:a.domain}};let s=Q(e.shop.id);return r.analytics=s,L(i==="default-banner"?S["default-banner"]:S.other),L(z),_("shopify analytics ready",e.shop.id),s}var nt="Default Title",D=100,et=200,rt=t=>t?parseFloat(t.amount):0,M=t=>(t??"").split("/").pop()??"";function T(t,n,e=1,r){let o={item_id:n?.sku||M(n?.id)||M(t.id),item_name:t.title,item_variant:n?.title===nt?void 0:n?.title,item_brand:t.vendor||void 0,item_category:t.productType||void 0,price:rt(n?.price??t.priceRange?.minVariantPrice),quantity:e};return r!=null&&(o.index=r),o}var h=(t,n=t.quantity)=>T(t.merchandise.product,t.merchandise,n);function f(t){let n=t.reduce((e,r)=>e+r.price*(r.quantity||1),0);return Math.round(n*D)/D}var ot=(t,n,e=1)=>({id:t.id,title:t.title,price:n.price,vendor:t.vendor||"",variantId:n.id,variantTitle:n.title,quantity:e,sku:n.sku||void 0,productType:t.productType||void 0}),q=t=>({id:t.id,quantity:t.quantity,merchandise:{id:t.merchandise.id,title:t.merchandise.title,price:t.merchandise.price,sku:t.merchandise.sku,product:{id:t.merchandise.product.id,title:t.merchandise.product.title,vendor:t.merchandise.product.vendor||"",handle:t.merchandise.product.handle}}});function it(){let{dataLayer:t}=a.analytics??{},n=typeof t=="string"?t:"dataLayer",e=Reflect.get(window,n);if(Array.isArray(e))return e;let r=[];return Reflect.set(window,n,r),r}function st(t,n){let e=it();if(!n){e.push({event:t});return}e.push({ecommerce:null}),e.push({event:t,ecommerce:n})}var m=null,v=null,O=null,w=new WeakSet;function d(t,n,e,r){a.analytics?.dataLayer&&st(t,n),m&&e&&m.publish(e,r);try{a.analytics?.onEvent?.(t,n)}catch(o){l(o,"analytics onEvent")}}function F(){let t=document.querySelector(p("product"));return!t||t.closest(`${p("collection")},${p("products")},${p("recommendations")}`)?null:x.get(t)??null}function at({product:t,scope:n}){if(w.has(n.root)||F()!==n)return;w.add(n.root);let e=n.variant??t.variants.nodes[0],r=[T(t,e)],o=e?[ot(t,e)]:[];d("view_item",{currency:e?.price.currencyCode,value:f(r),items:r},"product_viewed",{products:o})}function ct({products:t,collection:n}){let e=t.slice(0,et).map((o,c)=>T(o,o.variants.nodes[0],1,c)),r={item_list_id:n?.handle||"products",item_list_name:n?.title||"Products"};if(!n){d("view_item_list",{...r,items:e});return}d("view_item_list",{...r,items:e},"collection_viewed",{collection:{id:n.id,handle:n.handle}})}function ut(t,n,e){let r=t?.cost.totalAmount.currencyCode;n.forEach((o,c)=>{let i=e.get(c),s=o.quantity-(i?.quantity??0);if(s<=0)return;let u=[h(o,s)];d("add_to_cart",{currency:r,value:f(u),items:u},"product_added_to_cart",{cart:t,prevCart:O,currentLine:q(o),prevLine:i?q(i):void 0})}),e.forEach((o,c)=>{let i=o.quantity-(n.get(c)?.quantity??0);if(i<=0)return;let s=[h(o,i)];d("remove_from_cart",{currency:r,value:f(s),items:s})})}function dt({cart:t,reason:n}){let e=new Map((t?.lines.nodes??[]).map(r=>[r.merchandise.id,r]));v&&n!=="load"&&n!=="pending"&&ut(t,e,v),v=e,O=t}function lt(){let t=b.lines.map(n=>h(n));d("view_cart",{currency:b.state?.cost.totalAmount.currencyCode,value:f(t),items:t})}function pt({cart:t}){if(!t)return;let n=t.lines.nodes.map(r=>h(r)),e=t.discountCodes.filter(r=>r.applicable).map(r=>r.code);d("begin_checkout",{currency:t.cost.totalAmount.currencyCode,value:f(n),coupon:e.join(",")||void 0,items:n})}var ft={"product-ready":at,"list-ready":ct,"cart-updated":dt,"cart-toggled":({open:t})=>{t&&lt()},checkout:pt,search:({term:t})=>{t&&d("search",{search_term:t},"search_viewed",{searchTerm:t})}};function mt(t,n){ft[n](t.detail)}function B(t){if(t.type==="astro:page-load"){w=new WeakSet,m?.publish("page_viewed",{});return}C.forEach(n=>{E(t,n)&&mt(t,n)})}async function yt(t){a.analytics?.shopify&&(m=await V(()=>F()!=null).catch(n=>(l(n,"shopify analytics"),null))),m?.publish("page_viewed",{}),t.splice(0).forEach(B),t.push=(...n)=>(n.forEach(B),t.length)}function g(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ht(t){return g(t)&&g(t.__core)&&g(t.__parts)}function j(t,n){let e=Reflect.get(window,"Tether");if(!ht(e))throw new Error(`tether.${t}.js runs after the Tether script, which loads it, and needs its window.Tether`);e.__parts[t]=n}j("analytics",k);})();
@@ -522,8 +522,23 @@
522
522
  console.groupEnd();
523
523
  }
524
524
 
525
+ // server/src/shared/json.ts
526
+ function isRecord(value) {
527
+ return value !== null && typeof value === "object" && !Array.isArray(value);
528
+ }
529
+
530
+ // src/part-registry.ts
531
+ function isTetherInternals(value) {
532
+ return isRecord(value) && isRecord(value["__core"]) && isRecord(value["__parts"]);
533
+ }
534
+ function registerPart(name, part) {
535
+ const tether = Reflect.get(window, "Tether");
536
+ if (!isTetherInternals(tether)) {
537
+ throw new Error(`tether.${name}.js runs after the Tether script, which loads it, and needs its window.Tether`);
538
+ }
539
+ tether.__parts[name] = part;
540
+ }
541
+
525
542
  // src/parts/diagnose.ts
526
- var { Tether } = window;
527
- if (!Tether) throw new Error("tether.diagnose.js runs after the Tether script, which loads it");
528
- Tether.__parts.diagnose = diagnose_exports;
543
+ registerPart("diagnose", diagnose_exports);
529
544
  })();
@@ -1,4 +1,4 @@
1
- (()=>{var H=Object.defineProperty;var L=(e,n)=>{for(var t in n)H(e,t,{get:n[t],enumerable:!0})};var P={};L(P,{apiVersionStatus:()=>b,checkMarkup:()=>w,diagnose:()=>we,didYouMean:()=>h});var Y=window.Tether.__core["config.ts"],[a,E,Ee,Se,$e,Re,ve]=Y;var G=window.Tether.__core["client.ts"],[S,$,Te,R,_e]=G;var B=window.Tether.__core["dom.ts"],[Ne,p,De,xe,Ve,Oe,m,Ue,v,Ce,Ie,qe,d,He,l,Le,Ye,Ge]=B;var Q=window.Tether.__core["loader.ts"],[Qe,A]=Q;var K=window.Tether.__core["selling-plans.ts"],[T]=K;var j=window.Tether.__core["status.ts"],[_,f]=j;var W=/^(\d{4})-(01|04|07|10)$/;function N(e){let n=W.exec(typeof e=="string"?e:"");return n?{year:Number(n[1]),month:Number(n[2])}:null}var z=(e,n)=>`${e}-${String(n).padStart(2,"0")}`;function M(e,n=1){let t=N(e);if(!t)throw new Error(`not a quarterly Shopify API version: ${e}`);let r=t.year*4+(t.month-1)/3+n;return z(Math.floor(r/4),r%4*3+1)}function b(e,n=new Date){if(e==="unstable")return{version:e,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let t=N(e);if(!t)return{version:e,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let r=new Date(Date.UTC(t.year,t.month-1,1)),s=new Date(Date.UTC(t.year,t.month-1+12,1)),o=(s.getTime()-n.getTime())/2630016e3,i=r<=n,c=`supported until about ${s.toISOString().slice(0,7)}`;return i?o<=0?c="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see README)":o<3&&(c=`${c}: plan the upgrade to ${M(e)} or later (see README)`):c="not released yet (release candidate at best)",{version:e,ok:i&&o>0,monthsLeft:Math.round(o),next:M(e),note:c}}var F=window.Tether.__core["lazy.ts"],[D]=F;var x=new Set(["in-stock","out-of-stock","backorder","low-stock","plenty-in-stock","on-sale","not-on-sale","has-variants","single-variant","subscription-available","subscription-unavailable","subscription-only","one-time-available","subscription-selected","one-time-selected","has-savings","loading","ready","error","not-found","cart-empty","cart-filled","cart-has-subscription","cart-no-subscription","cart-has-discount","cart-error","cart-warning","list-empty","list-filled","search-empty","search-results","logged-in","logged-out","orders-empty","orders-loading","addresses-loading","addresses-empty","addresses-error","subscriptions-loading","subscriptions-empty","subscriptions-error"]),V=new Set(["title","description","description-text","vendor","type","handle","published-at","price","total-price","compare-at-price","unit-price","min-price","max-price","discount-percentage","discount-amount","variant-title","variant-id","sku","barcode","stock","quantity","featured-image","variant-image","images","tags","link","url","one-time-price","subscription-price","subscription-savings","subscription-savings-amount","checkout-charge","plan-name","plan-description","plan-group","option-value","swatch","image"]),O=new Set(`account account-bind account-link account-login account-logout add-label add-to-cart adding-text
1
+ (()=>{var L=Object.defineProperty;var Y=(e,n)=>{for(var t in n)L(e,t,{get:n[t],enumerable:!0})};var P={};Y(P,{apiVersionStatus:()=>y,checkMarkup:()=>k,diagnose:()=>ke,didYouMean:()=>f});var G=window.Tether.__core["config.ts"],[a,S,Re,$e,Ae,Te,_e]=G;var B=window.Tether.__core["client.ts"],[R,$,Ne,A,xe]=B;var Q=window.Tether.__core["dom.ts"],[De,p,Oe,Ve,Ue,Ie,m,Ce,T,qe,He,Le,d,Ye,l,Ge,Be,Qe]=Q;var j=window.Tether.__core["loader.ts"],[Ke,_]=j;var K=window.Tether.__core["selling-plans.ts"],[v]=K;var W=window.Tether.__core["status.ts"],[N,h]=W;var F=/^(\d{4})-(01|04|07|10)$/;function M(e){let n=F.exec(typeof e=="string"?e:"");return n?{year:Number(n[1]),month:Number(n[2])}:null}var z=(e,n)=>`${e}-${String(n).padStart(2,"0")}`;function x(e,n=1){let t=M(e);if(!t)throw new Error(`not a quarterly Shopify API version: ${e}`);let r=t.year*4+(t.month-1)/3+n;return z(Math.floor(r/4),r%4*3+1)}function y(e,n=new Date){if(e==="unstable")return{version:e,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let t=M(e);if(!t)return{version:e,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let r=new Date(Date.UTC(t.year,t.month-1,1)),s=new Date(Date.UTC(t.year,t.month-1+12,1)),o=(s.getTime()-n.getTime())/2630016e3,i=r<=n,c=`supported until about ${s.toISOString().slice(0,7)}`;return i?o<=0?c="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see README)":o<3&&(c=`${c}: plan the upgrade to ${x(e)} or later (see README)`):c="not released yet (release candidate at best)",{version:e,ok:i&&o>0,monthsLeft:Math.round(o),next:x(e),note:c}}var J=window.Tether.__core["lazy.ts"],[D]=J;var O=new Set(["in-stock","out-of-stock","backorder","low-stock","plenty-in-stock","on-sale","not-on-sale","has-variants","single-variant","subscription-available","subscription-unavailable","subscription-only","one-time-available","subscription-selected","one-time-selected","has-savings","loading","ready","error","not-found","cart-empty","cart-filled","cart-has-subscription","cart-no-subscription","cart-has-discount","cart-error","cart-warning","list-empty","list-filled","search-empty","search-results","logged-in","logged-out","orders-empty","orders-loading","addresses-loading","addresses-empty","addresses-error","subscriptions-loading","subscriptions-empty","subscriptions-error"]),V=new Set(["title","description","description-text","vendor","type","handle","published-at","price","total-price","compare-at-price","unit-price","min-price","max-price","discount-percentage","discount-amount","variant-title","variant-id","sku","barcode","stock","quantity","featured-image","variant-image","images","tags","link","url","one-time-price","subscription-price","subscription-savings","subscription-savings-amount","checkout-charge","plan-name","plan-description","plan-group","option-value","swatch","image"]),U=new Set(`account account-bind account-link account-login account-logout add-label add-to-cart adding-text
2
2
  always-enabled bind cart-checkout-charge cart-clear cart-close cart-count cart-discounts cart-drawer cart-label cart-lines
3
3
  cart-note cart-open cart-subtotal cart-total cart-warning checkout code collection collection-bind countries country
4
4
  country-bind country-label country-select default-plan default-purchase discount discount-code discount-form discount-input
@@ -11,4 +11,4 @@
11
11
  plan-value product products purchase purchase-mode qty qty-minus qty-plus quantity recommendations reverse search
12
12
  search-bind search-collections search-input search-limit search-min search-products search-queries search-results
13
13
  search-state show soldout-text sort state subscribe-text variant variant-select variant-url max-width max-height crop
14
- sig label hydrated busy`.split(/\s+/).filter(Boolean)),J=["bind","option-list","option","variant-select","add-to-cart","purchase","plan-list","plan","qty","line-attribute"],X=["option-list","plan-list","cart-lines","list"],y="metafield:",Z=/^image:\d+$/,ee=2;function te(e,n){let t=Array.from({length:n.length+1},(r,s)=>s);for(let r=1;r<=e.length;r++){let s=[r];for(let o=1;o<=n.length;o++){let i=(t[o-1]??0)+(e[r-1]===n[o-1]?0:1);s.push(Math.min((t[o]??0)+1,(s[o-1]??0)+1,i))}t=s}return t[n.length]??0}function h(e,n,t=""){let r=null,s=1/0;for(let i of n){let c=te(e,i);c<s&&(s=c,r=i)}let o=Math.max(2,Math.floor(e.length/4));return r!==null&&s<=o?` Did you mean "${t}${r}"?`:""}function ne(e){let n=e.id?`#${e.id}`:"",t=e.className&&typeof e.className=="string"?e.className.trim().split(/\s+/):[],r=t.length?`.${t.slice(0,ee).join(".")}`:"";return`<${e.tagName.toLowerCase()}${n}${r}>`}var U=()=>`${l("collection")},${l("products")},${l("recommendations")}`;function re(e,n){d(e,l("product")).forEach(t=>{if(t.closest(U())&&t.closest(l("list")))return;let{key:r,fromUrl:s,raw:o}=f(t);o?s&&!r&&n("warn",`${p("product")}="${o}" but this URL has no value for it (e.g. ?handle=my-product).`,t):n("error",`${p("product")} has no value. Bind it to the Shopify handle (CMS field), or use "url:handle".`,t)})}function oe(e,n){for(let t of J)d(e,l(t)).forEach(r=>{r.closest(l("product"))||t==="line-attribute"&&r.closest(l("group"))||n("warn",`${p(t)} outside any ${p("product")}: it does nothing here.`,r)});d(e,l("group-add")).forEach(t=>{t.closest(l("group"))||n("warn",`${p("group-add")} outside a ${p("group")}.`,t)});for(let t of X)d(e,l(t)).forEach(r=>{!r.firstElementChild&&!v(r)&&n("warn",`${p(t)} without a template child: put one example element inside it.`,r)});d(e,U()).forEach(t=>{d(t,l("list")).length||n("error",`List without a ${p("list")} child: products have nowhere to render.`,t)})}function se(e,n){d(e,l("show")).forEach(t=>{let r=m(t,"show")??"";x.has(r)||n("warn",`Unknown ${p("show")}="${r}".${h(r,x)}`,t)}),d(e,l("bind")).forEach(t=>{let r=m(t,"bind")||"";!r||V.has(r)||Z.test(r)||r.startsWith(y)||n("warn",`Unknown ${p("bind")}="${r}": it stays empty.${h(r,V)}`,t)})}function ie(e,n){d(e,l("bind")).forEach(t=>{let r=m(t,"bind")||"";if(!r.startsWith(y))return;let s=r.slice(y.length);a.metafields.some(i=>(typeof i=="string"?i:`${i.namespace}.${i.key}`)===s)||n("error",`${p("bind")}="${r}" but "${s}" is not in config.metafields, so it stays empty.`,t)})}function ae(e,n){let t=`${a.prefix}-`,r=new Set;d(e,"*").forEach(s=>{for(let{name:o}of s.attributes){if(!o.startsWith(t))continue;let i=o.slice(t.length);O.has(i)||r.has(i)||(r.add(i),n("warn",`Unknown attribute ${o}: Tether ignores it.${h(i,O,t)}`,s))}})}function ce(e,n){let t=d(e,l("cart-drawer")).length;d(e,l("cart-open")).length&&!t&&n("warn",`${p("cart-open")} exists but there is no ${p("cart-drawer")} on this page.`),t>1&&n("warn",`More than one ${p("cart-drawer")}.`),d(e,`[${p("state")}="error"]`).forEach(r=>{r.matches(_())&&n("error",`Scope failed to load (${m(r,"error")||"error"}).`,r)})}function w(e=document){let n=[],t=(r,s,o)=>{n.push(o?{level:r,message:s,element:ne(o),el:o}:{level:r,message:s})};return re(e,t),oe(e,t),se(e,t),ae(e,t),ie(e,t),ce(e,t),n}var le=20,ue=3,C=4;function de(e){return e?`${e.slice(0,C)}\u2026${e.slice(-C)} (${e.length} chars)`:"(missing)"}function I(e,n){if(e instanceof Error&&e.message)return e.message;let t=typeof e=="object"&&e!==null?Reflect.get(e,"code"):void 0;return typeof t=="string"&&t?t:n}function pe(){return{domain:a.domain||"(missing)",token:de(a.token),apiVersion:a.apiVersion,endpoint:a.domain?S():null,country:a.country,language:a.language,locale:a.locale,markets:a.markets,prefix:a.prefix,productPath:a.productPath,metafields:a.metafields,autoMount:a.autoMount,observe:a.observe,onError:typeof a.onError=="function"}}async function me(){return{country:a.country||null,language:a.language||null,locale:a.locale||null,detected:a.markets?.detect?(await D("markets")).detectMarket(a.markets):null}}function he({ok:e,monthsLeft:n,note:t}){return e&&(n===void 0||n>=ue)?null:{level:e?"warn":"error",message:`apiVersion ${a.apiVersion}: ${t}`}}var ge=R({shop:{name:"string",primaryDomain:{url:"string"},paymentSettings:{currencyCode:"string"}}});async function fe(){if(!E())return{kind:"not-configured"};let e=Date.now();try{let n=await $("query TetherDiagnose { shop { name primaryDomain { url } paymentSettings { currencyCode } } }",{},ge,{context:!1});return{kind:"reachable",shop:{name:n.shop.name,url:n.shop.primaryDomain.url,currency:n.shop.paymentSettings.currencyCode},latencyMs:Date.now()-e}}catch(n){return{kind:"unreachable",error:n,latencyMs:Date.now()-e}}}function be(e,n,t){let r=[],s=t.options.map(i=>i.name),o=d(e,l("product")).filter(i=>f(i).key===n&&i.querySelector(l("add-to-cart")));for(let i of o){let c=new Set(d(i,`${l("option-list")},select${l("option")}`).map(u=>m(u,"option-list")||m(u,"option")));if(!(!c.size&&d(i,`select${l("variant-select")}`).length)){if(!a.language)for(let u of c)!u||s.includes(u)||r.push({level:"warn",message:`Product "${t.handle}" has no option "${u}" (its options: ${s.join(", ")||"none"}).${h(u,s)}`});for(let u of t.options)u.optionValues.length<=1||c.has(u.name)||r.push({level:"warn",message:`Product "${t.handle}": option "${u.name}" (${u.optionValues.length} values) has no tether-option-list, so visitors can't choose it.`})}}return r}async function ye(e,n){let t=d(e,l("product")).map(o=>f(o).key),r=[...new Set(t.filter(o=>o!==null&&o!==""))].slice(0,le);(await Promise.allSettled(r.map(o=>A(o)))).forEach((o,i)=>{let c=r[i]??"";if(o.status==="rejected"){let g=I(o.reason,"not loaded");n.products.push({key:c,error:o.reason instanceof Error?o.reason.message:void 0}),n.problems.push({level:"error",message:`Product "${c}": ${g}. Is it published to the Headless channel?`});return}let u=o.value,k=T(u);n.products.push({key:c,handle:u.handle,title:u.title,plans:k.length,requiresSellingPlan:u.requiresSellingPlan});for(let g of k)n.sellingPlans.push({product:u.handle,group:g.group.name,plan:g.name,id:g.id});n.problems.push(...be(e,c,u))})}async function we({root:e=document,silent:n=!1,version:t="",now:r=new Date}={}){let s=await fe(),o={version:t,config:pe(),apiVersion:b(a.apiVersion,r),market:await me(),reachable:s.kind==="reachable",shop:s.kind==="reachable"?s.shop:null,latencyMs:s.kind==="not-configured"?null:s.latencyMs,products:[],sellingPlans:[],problems:[]};switch(s.kind){case"not-configured":o.problems.push({level:"error",message:"TETHER_CONFIG needs domain and token."});break;case"unreachable":o.problems.push({level:"error",message:`Storefront API not reachable: ${I(s.error,"unknown error")}`});break;case"reachable":await ye(e,o);break}let i=he(o.apiVersion);return i&&o.problems.push(i),typeof document<"u"&&o.problems.push(...w(e)),n||Pe(o),o}function Pe(e){let n=e.problems.filter(c=>c.level==="error").length,t=e.problems.length-n;console.group(`[${a.prefix}] diagnose: ${n?`${n} error(s)`:"no errors"}, ${t} warning(s)`),console.log("version",e.version,"| API",e.apiVersion.version,`(${e.apiVersion.note})`),console.log("config",e.config);let{country:r,language:s,detected:o}=e.market,i=[r,s].filter(Boolean).join(" / ")||"the store default";console.log("market",`in use: ${i}`,o?`(detection picks ${JSON.stringify(o)})`:""),console.log(e.shop?`Storefront API reachable: ${e.shop.name} (${e.latencyMs??0} ms)`:"Storefront API NOT reachable"),e.products.length&&console.table(e.products),e.sellingPlans.length?console.table(e.sellingPlans):e.reachable&&console.log("No selling plans on the products of this page.");for(let c of e.problems)c.level==="error"?console.error(c.message,c.el??""):console.warn(c.message,c.el??"");console.groupEnd()}var{Tether:q}=window;if(!q)throw new Error("tether.diagnose.js runs after the Tether script, which loads it");q.__parts.diagnose=P;})();
14
+ sig label hydrated busy`.split(/\s+/).filter(Boolean)),X=["bind","option-list","option","variant-select","add-to-cart","purchase","plan-list","plan","qty","line-attribute"],Z=["option-list","plan-list","cart-lines","list"],w="metafield:",ee=/^image:\d+$/,te=2;function ne(e,n){let t=Array.from({length:n.length+1},(r,s)=>s);for(let r=1;r<=e.length;r++){let s=[r];for(let o=1;o<=n.length;o++){let i=(t[o-1]??0)+(e[r-1]===n[o-1]?0:1);s.push(Math.min((t[o]??0)+1,(s[o-1]??0)+1,i))}t=s}return t[n.length]??0}function f(e,n,t=""){let r=null,s=1/0;for(let i of n){let c=ne(e,i);c<s&&(s=c,r=i)}let o=Math.max(2,Math.floor(e.length/4));return r!==null&&s<=o?` Did you mean "${t}${r}"?`:""}function re(e){let n=e.id?`#${e.id}`:"",t=e.className&&typeof e.className=="string"?e.className.trim().split(/\s+/):[],r=t.length?`.${t.slice(0,te).join(".")}`:"";return`<${e.tagName.toLowerCase()}${n}${r}>`}var I=()=>`${l("collection")},${l("products")},${l("recommendations")}`;function oe(e,n){d(e,l("product")).forEach(t=>{if(t.closest(I())&&t.closest(l("list")))return;let{key:r,fromUrl:s,raw:o}=h(t);o?s&&!r&&n("warn",`${p("product")}="${o}" but this URL has no value for it (e.g. ?handle=my-product).`,t):n("error",`${p("product")} has no value. Bind it to the Shopify handle (CMS field), or use "url:handle".`,t)})}function se(e,n){for(let t of X)d(e,l(t)).forEach(r=>{r.closest(l("product"))||t==="line-attribute"&&r.closest(l("group"))||n("warn",`${p(t)} outside any ${p("product")}: it does nothing here.`,r)});d(e,l("group-add")).forEach(t=>{t.closest(l("group"))||n("warn",`${p("group-add")} outside a ${p("group")}.`,t)});for(let t of Z)d(e,l(t)).forEach(r=>{!r.firstElementChild&&!T(r)&&n("warn",`${p(t)} without a template child: put one example element inside it.`,r)});d(e,I()).forEach(t=>{d(t,l("list")).length||n("error",`List without a ${p("list")} child: products have nowhere to render.`,t)})}function ie(e,n){d(e,l("show")).forEach(t=>{let r=m(t,"show")??"";O.has(r)||n("warn",`Unknown ${p("show")}="${r}".${f(r,O)}`,t)}),d(e,l("bind")).forEach(t=>{let r=m(t,"bind")||"";!r||V.has(r)||ee.test(r)||r.startsWith(w)||n("warn",`Unknown ${p("bind")}="${r}": it stays empty.${f(r,V)}`,t)})}function ae(e,n){d(e,l("bind")).forEach(t=>{let r=m(t,"bind")||"";if(!r.startsWith(w))return;let s=r.slice(w.length);a.metafields.some(i=>(typeof i=="string"?i:`${i.namespace}.${i.key}`)===s)||n("error",`${p("bind")}="${r}" but "${s}" is not in config.metafields, so it stays empty.`,t)})}function ce(e,n){let t=`${a.prefix}-`,r=new Set;d(e,"*").forEach(s=>{for(let{name:o}of s.attributes){if(!o.startsWith(t))continue;let i=o.slice(t.length);U.has(i)||r.has(i)||(r.add(i),n("warn",`Unknown attribute ${o}: Tether ignores it.${f(i,U,t)}`,s))}})}function le(e,n){let t=d(e,l("cart-drawer")).length;d(e,l("cart-open")).length&&!t&&n("warn",`${p("cart-open")} exists but there is no ${p("cart-drawer")} on this page.`),t>1&&n("warn",`More than one ${p("cart-drawer")}.`),d(e,`[${p("state")}="error"]`).forEach(r=>{r.matches(N())&&n("error",`Scope failed to load (${m(r,"error")||"error"}).`,r)})}function k(e=document){let n=[],t=(r,s,o)=>{n.push(o?{level:r,message:s,element:re(o),el:o}:{level:r,message:s})};return oe(e,t),se(e,t),ie(e,t),ce(e,t),ae(e,t),le(e,t),n}var ue=20,de=3,C=4;function pe(e){return e?`${e.slice(0,C)}\u2026${e.slice(-C)} (${e.length} chars)`:"(missing)"}function q(e,n){if(e instanceof Error&&e.message)return e.message;let t=typeof e=="object"&&e!==null?Reflect.get(e,"code"):void 0;return typeof t=="string"&&t?t:n}function me(){return{domain:a.domain||"(missing)",token:pe(a.token),apiVersion:a.apiVersion,endpoint:a.domain?R():null,country:a.country,language:a.language,locale:a.locale,markets:a.markets,prefix:a.prefix,productPath:a.productPath,metafields:a.metafields,autoMount:a.autoMount,observe:a.observe,onError:typeof a.onError=="function"}}async function fe(){return{country:a.country||null,language:a.language||null,locale:a.locale||null,detected:a.markets?.detect?(await D("markets")).detectMarket(a.markets):null}}function ge({ok:e,monthsLeft:n,note:t}){return e&&(n===void 0||n>=de)?null:{level:e?"warn":"error",message:`apiVersion ${a.apiVersion}: ${t}`}}var he=A({shop:{name:"string",primaryDomain:{url:"string"},paymentSettings:{currencyCode:"string"}}});async function be(){if(!S())return{kind:"not-configured"};let e=Date.now();try{let n=await $("query TetherDiagnose { shop { name primaryDomain { url } paymentSettings { currencyCode } } }",{},he,{context:!1});return{kind:"reachable",shop:{name:n.shop.name,url:n.shop.primaryDomain.url,currency:n.shop.paymentSettings.currencyCode},latencyMs:Date.now()-e}}catch(n){return{kind:"unreachable",error:n,latencyMs:Date.now()-e}}}function ye(e,n,t){let r=[],s=t.options.map(i=>i.name),o=d(e,l("product")).filter(i=>h(i).key===n&&i.querySelector(l("add-to-cart")));for(let i of o){let c=new Set(d(i,`${l("option-list")},select${l("option")}`).map(u=>m(u,"option-list")||m(u,"option")));if(!(!c.size&&d(i,`select${l("variant-select")}`).length)){if(!a.language)for(let u of c)!u||s.includes(u)||r.push({level:"warn",message:`Product "${t.handle}" has no option "${u}" (its options: ${s.join(", ")||"none"}).${f(u,s)}`});for(let u of t.options)u.optionValues.length<=1||c.has(u.name)||r.push({level:"warn",message:`Product "${t.handle}": option "${u.name}" (${u.optionValues.length} values) has no tether-option-list, so visitors can't choose it.`})}}return r}async function we(e,n){let t=d(e,l("product")).map(o=>h(o).key),r=[...new Set(t.filter(o=>o!==null&&o!==""))].slice(0,ue);(await Promise.allSettled(r.map(o=>_(o)))).forEach((o,i)=>{let c=r[i]??"";if(o.status==="rejected"){let g=q(o.reason,"not loaded");n.products.push({key:c,error:o.reason instanceof Error?o.reason.message:void 0}),n.problems.push({level:"error",message:`Product "${c}": ${g}. Is it published to the Headless channel?`});return}let u=o.value,E=v(u);n.products.push({key:c,handle:u.handle,title:u.title,plans:E.length,requiresSellingPlan:u.requiresSellingPlan});for(let g of E)n.sellingPlans.push({product:u.handle,group:g.group.name,plan:g.name,id:g.id});n.problems.push(...ye(e,c,u))})}async function ke({root:e=document,silent:n=!1,version:t="",now:r=new Date}={}){let s=await be(),o={version:t,config:me(),apiVersion:y(a.apiVersion,r),market:await fe(),reachable:s.kind==="reachable",shop:s.kind==="reachable"?s.shop:null,latencyMs:s.kind==="not-configured"?null:s.latencyMs,products:[],sellingPlans:[],problems:[]};switch(s.kind){case"not-configured":o.problems.push({level:"error",message:"TETHER_CONFIG needs domain and token."});break;case"unreachable":o.problems.push({level:"error",message:`Storefront API not reachable: ${q(s.error,"unknown error")}`});break;case"reachable":await we(e,o);break}let i=ge(o.apiVersion);return i&&o.problems.push(i),typeof document<"u"&&o.problems.push(...k(e)),n||Pe(o),o}function Pe(e){let n=e.problems.filter(c=>c.level==="error").length,t=e.problems.length-n;console.group(`[${a.prefix}] diagnose: ${n?`${n} error(s)`:"no errors"}, ${t} warning(s)`),console.log("version",e.version,"| API",e.apiVersion.version,`(${e.apiVersion.note})`),console.log("config",e.config);let{country:r,language:s,detected:o}=e.market,i=[r,s].filter(Boolean).join(" / ")||"the store default";console.log("market",`in use: ${i}`,o?`(detection picks ${JSON.stringify(o)})`:""),console.log(e.shop?`Storefront API reachable: ${e.shop.name} (${e.latencyMs??0} ms)`:"Storefront API NOT reachable"),e.products.length&&console.table(e.products),e.sellingPlans.length?console.table(e.sellingPlans):e.reachable&&console.log("No selling plans on the products of this page.");for(let c of e.problems)c.level==="error"?console.error(c.message,c.el??""):console.warn(c.message,c.el??"");console.groupEnd()}function b(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ee(e){return b(e)&&b(e.__core)&&b(e.__parts)}function H(e,n){let t=Reflect.get(window,"Tether");if(!Ee(t))throw new Error(`tether.${e}.js runs after the Tether script, which loads it, and needs its window.Tether`);t.__parts[e]=n}H("diagnose",P);})();