@occluze/tether 0.9.7 → 0.9.8

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 (56) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/astro.js +1 -1
  3. package/dist/esm/chunks/account-QFGF5FKX.js +1 -0
  4. package/dist/esm/chunks/{account-pages-LKNIXA6Q.js → account-pages-LMGIPFB7.js} +1 -1
  5. package/dist/esm/chunks/{analytics-TEU7HS7C.js → analytics-YSTR6H2W.js} +1 -1
  6. package/dist/esm/chunks/{chunk-YZC4KFT3.js → chunk-4BZ4X2Z6.js} +1 -1
  7. package/dist/esm/chunks/{chunk-47OLTPHV.js → chunk-ADA2ZGPO.js} +1 -1
  8. package/dist/esm/chunks/{chunk-BRI56DD5.js → chunk-B7SC7UOJ.js} +1 -1
  9. package/dist/esm/chunks/{chunk-SVJWBCRY.js → chunk-BGUUUMJO.js} +1 -1
  10. package/dist/esm/chunks/{chunk-KJLA4CVH.js → chunk-GOGPMJ2U.js} +1 -1
  11. package/dist/esm/chunks/{chunk-JJRRVUDP.js → chunk-HGNFQHEU.js} +1 -1
  12. package/dist/esm/chunks/{chunk-HRRJ7KUG.js → chunk-I54NQEVK.js} +1 -1
  13. package/dist/esm/chunks/{chunk-QPSIX4DK.js → chunk-IBOX3YGQ.js} +1 -1
  14. package/dist/esm/chunks/chunk-KF76466X.js +1 -0
  15. package/dist/esm/chunks/chunk-KH7NEM4B.js +1 -0
  16. package/dist/esm/chunks/{chunk-74HC6MR2.js → chunk-PHTINCRN.js} +1 -1
  17. package/dist/esm/chunks/chunk-QUBBZNJ7.js +1 -0
  18. package/dist/esm/chunks/chunk-R3UWDQL5.js +1 -0
  19. package/dist/esm/chunks/{chunk-Y5LISDPZ.js → chunk-SA5G3AUJ.js} +1 -1
  20. package/dist/esm/chunks/{chunk-O6Z6O5NW.js → chunk-UJH5ZECZ.js} +1 -1
  21. package/dist/esm/chunks/chunk-XQCBGVU2.js +1 -0
  22. package/dist/esm/chunks/{diagnose-YNVDJDSH.js → diagnose-IOC3BCP5.js} +1 -1
  23. package/dist/esm/chunks/{extras-BUH3OWBN.js → extras-5E72QFSJ.js} +1 -1
  24. package/dist/esm/chunks/{lists-6KQIGAO6.js → lists-35SUHUOX.js} +1 -1
  25. package/dist/esm/chunks/markets-ui-B3ILTPN7.js +1 -0
  26. package/dist/esm/chunks/{search-NPGWPFMA.js → search-QN457Q2G.js} +1 -1
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/server.js +2 -2
  29. package/dist/tether.account.js +12 -11
  30. package/dist/tether.account.min.js +1 -1
  31. package/dist/tether.js +119 -113
  32. package/dist/tether.lists.js +13 -11
  33. package/dist/tether.lists.min.js +1 -1
  34. package/dist/tether.markets.js +12 -0
  35. package/dist/tether.markets.min.js +1 -1
  36. package/dist/tether.min.js +1 -1
  37. package/dist/tether.min.js.map +4 -4
  38. package/dist/types/server/src/shared/serial.d.ts +2 -6
  39. package/dist/types/src/cart/checkout.d.ts +2 -1
  40. package/dist/types/src/cart/drawer.d.ts +5 -1
  41. package/dist/types/src/cart/mutations.d.ts +13 -13
  42. package/dist/types/src/cart/store.d.ts +4 -0
  43. package/dist/types/src/cart.d.ts +7 -2
  44. package/dist/types/src/config.d.ts +3 -1
  45. package/dist/types/src/fragments.d.ts +0 -2
  46. package/dist/types/src/part-use.d.ts +3 -0
  47. package/dist/types/src/shopify-fields.d.ts +8 -0
  48. package/dist/types/src/version.d.ts +1 -1
  49. package/package.json +5 -2
  50. package/dist/esm/chunks/account-53WAVEJF.js +0 -1
  51. package/dist/esm/chunks/chunk-EIPYBAVZ.js +0 -1
  52. package/dist/esm/chunks/chunk-FYGRVUVB.js +0 -1
  53. package/dist/esm/chunks/chunk-IG23NTJK.js +0 -1
  54. package/dist/esm/chunks/chunk-NXDME6AM.js +0 -1
  55. package/dist/esm/chunks/chunk-X2HBGPFB.js +0 -1
  56. package/dist/esm/chunks/markets-ui-YAEXVFRK.js +0 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ Script tag, for Webflow or any page without a build step:
17
17
  <script src="https://cdn.jsdelivr.net/gh/ravi-klaassens/tether@0.9/dist/tether.min.js" defer></script>
18
18
  ```
19
19
 
20
- `@0.9` gets every 0.9.x fix automatically (recommended), `@v0.9.7` pins one release, `@latest`
20
+ `@0.9` gets every 0.9.x fix automatically (recommended), `@v0.9.8` pins one release, `@latest`
21
21
  always takes the newest ([versions and self-hosting](docs/webflow.md#versions-and-self-hosting)).
22
22
 
23
23
  npm, for Astro, Vite or another bundler or framework (TypeScript types included):
package/dist/esm/astro.js CHANGED
@@ -1,2 +1,2 @@
1
- import{H as h,q as g,s as u,w as d}from"./chunks/chunk-X2HBGPFB.js";var w=["src/shop.config.js","src/shop.config.mjs","src/shop.config.ts"],O=new Set(["siteUrl","pageSize"]),y="astro/config",E=/^\s*(?:export\s+)?([\w.-]+)\s*=\s*(.*?)\s*$/,S=/^(["'])(.*?)\1/;function T(n,t=process.argv){let e=n==="dev"?"development":"production",o=t.findIndex(r=>r==="--mode"||r.startsWith("--mode="));if(o<0)return e;let i=t[o]??"";return(i.includes("=")?i.split("=")[1]:t[o+1])??e}var v=n=>n instanceof Error&&"code"in n&&n.code==="ENOENT";async function k(n){let{readFile:t}=await import("node:fs/promises");try{return await t(n,"utf8")}catch(e){if(v(e))return null;throw e}}function _(n,t){for(let e of n.split(/\r?\n/)){let o=E.exec(e);if(!o||e.trim().startsWith("#"))continue;let[,i="",s=""]=o,r=S.exec(s);t[i]=r?r[2]??"":s.replace(/\s+#.*$/,"")}}async function C(n,t){let e=await import("node:path"),o=T(n),i={};for(let s of[".env",".env.local",`.env.${o}`,`.env.${o}.local`]){let r=await k(e.join(t,s));r!==null&&_(r,i)}return{...i,...process.env}}function P(n,t,e){for(let o of["domain","token"]){if(n[o])continue;let i=g[o].find(s=>t[s]);i&&(n[o]=t[i],i.startsWith("PUBLIC_")||e.warn(`${i} is written into every page as Tether's ${o}. Name it PUBLIC_${i} to say so.`))}if(typeof n.token=="string"&&u(n.token))throw new Error("The Shopify token for Tether is a secret token (shpat_/shpss_/\u2026), which would be published in every page. Use the public Storefront API token from the Headless channel.")}async function F(n,t,e){let{existsSync:o}=await import("node:fs"),i=await import("node:path");for(let s of t){let r=i.resolve(n,s);o(r)&&e(r)}}async function I(n){try{return await import(n)}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ERR_MODULE_NOT_FOUND")return null;throw t}}var A=n=>typeof n=="object"&&n!==null&&"string"in n&&typeof n.string=="function";async function N(n){if(!n.updateConfig)return;let t=await I(y),e=typeof t=="object"&&t!==null&&"envField"in t?t.envField:null;if(!A(e))return;let o=()=>e.string({context:"client",access:"public",optional:!0});try{n.updateConfig({env:{schema:{PUBLIC_SHOPIFY_DOMAIN:o(),PUBLIC_SHOPIFY_STOREFRONT_TOKEN:o()}}})}catch(i){n.logger.warn(`.env variables not declared in astro:env: ${h(i)}`)}}function R(n,t){let e=Object.keys(n).filter(o=>typeof n[o]=="function");for(let o of e)Reflect.deleteProperty(n,o);e.length&&t.warn(`${e.join(", ")}: functions can't be passed here. Set them in window.TETHER_CONFIG in your layout.`)}function b(n,t){for(let e of Object.keys(n))Object.hasOwn(d,e)||(Reflect.deleteProperty(n,e),O.has(e)||t.warn(`${e} is not a Tether option: left out of the page.`))}function L(n,t){n("head-inline",'window.TETHER_INTEGRATION="astro";'),n("page",["import Tether from '@occluze/tether';",`window.TETHER_CONFIG = { ...${JSON.stringify({autoMount:!1,...t})}, ...(window.TETHER_CONFIG || {}) };`,"Tether.init().then(() => Tether.mount(document));"].join(`
1
+ import{H as h,q as g,s as u,w as d}from"./chunks/chunk-QUBBZNJ7.js";var w=["src/shop.config.js","src/shop.config.mjs","src/shop.config.ts"],O=new Set(["siteUrl","pageSize"]),y="astro/config",E=/^\s*(?:export\s+)?([\w.-]+)\s*=\s*(.*?)\s*$/,S=/^(["'])(.*?)\1/;function T(n,t=process.argv){let e=n==="dev"?"development":"production",o=t.findIndex(r=>r==="--mode"||r.startsWith("--mode="));if(o<0)return e;let i=t[o]??"";return(i.includes("=")?i.split("=")[1]:t[o+1])??e}var v=n=>n instanceof Error&&"code"in n&&n.code==="ENOENT";async function k(n){let{readFile:t}=await import("node:fs/promises");try{return await t(n,"utf8")}catch(e){if(v(e))return null;throw e}}function _(n,t){for(let e of n.split(/\r?\n/)){let o=E.exec(e);if(!o||e.trim().startsWith("#"))continue;let[,i="",s=""]=o,r=S.exec(s);t[i]=r?r[2]??"":s.replace(/\s+#.*$/,"")}}async function C(n,t){let e=await import("node:path"),o=T(n),i={};for(let s of[".env",".env.local",`.env.${o}`,`.env.${o}.local`]){let r=await k(e.join(t,s));r!==null&&_(r,i)}return{...i,...process.env}}function P(n,t,e){for(let o of["domain","token"]){if(n[o])continue;let i=g[o].find(s=>t[s]);i&&(n[o]=t[i],i.startsWith("PUBLIC_")||e.warn(`${i} is written into every page as Tether's ${o}. Name it PUBLIC_${i} to say so.`))}if(typeof n.token=="string"&&u(n.token))throw new Error("The Shopify token for Tether is a secret token (shpat_/shpss_/\u2026), which would be published in every page. Use the public Storefront API token from the Headless channel.")}async function F(n,t,e){let{existsSync:o}=await import("node:fs"),i=await import("node:path");for(let s of t){let r=i.resolve(n,s);o(r)&&e(r)}}async function I(n){try{return await import(n)}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ERR_MODULE_NOT_FOUND")return null;throw t}}var A=n=>typeof n=="object"&&n!==null&&"string"in n&&typeof n.string=="function";async function N(n){if(!n.updateConfig)return;let t=await I(y),e=typeof t=="object"&&t!==null&&"envField"in t?t.envField:null;if(!A(e))return;let o=()=>e.string({context:"client",access:"public",optional:!0});try{n.updateConfig({env:{schema:{PUBLIC_SHOPIFY_DOMAIN:o(),PUBLIC_SHOPIFY_STOREFRONT_TOKEN:o()}}})}catch(i){n.logger.warn(`.env variables not declared in astro:env: ${h(i)}`)}}function R(n,t){let e=Object.keys(n).filter(o=>typeof n[o]=="function");for(let o of e)Reflect.deleteProperty(n,o);e.length&&t.warn(`${e.join(", ")}: functions can't be passed here. Set them in window.TETHER_CONFIG in your layout.`)}function b(n,t){for(let e of Object.keys(n))Object.hasOwn(d,e)||(Reflect.deleteProperty(n,e),O.has(e)||t.warn(`${e} is not a Tether option: left out of the page.`))}function L(n,t){n("head-inline",'window.TETHER_INTEGRATION="astro";'),n("page",["import Tether from '@occluze/tether';",`window.TETHER_CONFIG = { ...${JSON.stringify({autoMount:!1,...t})}, ...(window.TETHER_CONFIG || {}) };`,"Tether.init().then(() => Tether.mount(document));"].join(`
2
2
  `))}function U(n={}){let{inject:t=!0,watch:e=w,...o}=n;return{name:"@occluze/tether",hooks:{"astro:config:setup":async i=>{let{injectScript:s,command:r,config:f,logger:a,addWatchFile:p}=i,{fileURLToPath:m}=await import("node:url"),l=f.root?m(f.root):process.cwd();r==="dev"&&p&&await F(l,e??[],p),await N(i);let c={...o};P(c,await C(r,l),a),R(c,a),b(c,a),(!c.domain||!c.token)&&a.warn("No Shopify store configured: set PUBLIC_SHOPIFY_DOMAIN and PUBLIC_SHOPIFY_STOREFRONT_TOKEN in .env (the public Storefront API token)."),t&&L(s,c)}}}}export{U as default};
@@ -0,0 +1 @@
1
+ import{f as W,g as H,h as X,i as O,m as A,n as B}from"./chunk-PHTINCRN.js";import{a as x,c as G}from"./chunk-SA5G3AUJ.js";import{f as M,g as V,h as k}from"./chunk-KF76466X.js";import"./chunk-BGUUUMJO.js";import{a as J}from"./chunk-KH7NEM4B.js";import"./chunk-I54NQEVK.js";import"./chunk-R3UWDQL5.js";import{D as _,E as F,G as v,I as L,R as j,a as f,g as D,n as a,o as g,q as l,u as h,x as q,z as $}from"./chunk-B7SC7UOJ.js";import{D as U,F as m,H as N,d as E,g as y,r as T,x as i}from"./chunk-QUBBZNJ7.js";var c={kind:"unknown"};function K(){let e=i.account?.server;if(!e)throw new f("Customer accounts need the Worker: set account.server",{code:"NOT_CONFIGURED"});return new URL(e,window.location.href).href.replace(/\/$/,"")}function z(e){e?M(x(),"1"):V(x())}async function de(e){let t;try{t=await e.json()}catch(r){if(r instanceof SyntaxError)return{};throw r}return E(t)?t:{}}async function le(e,t){try{return await D(i.requestTimeout,async r=>{let n=await fetch(e,{...t,signal:r});return{response:n,data:await de(n)}})}catch(r){throw new f(`Network error: ${N(r)}`,{code:"NETWORK"})}}async function p(e,{method:t="GET",body:r}={}){let n={method:t,credentials:"include"};t==="POST"&&(n.headers={"Content-Type":"application/json","X-Tether-Account":"1"}),r&&(n.body=JSON.stringify(r));let{response:s,data:o}=await le(`${K()}${e}`,n);if(s.status===401)return{kind:"logged-out"};if(!s.ok){let d=y(o.error)??String(s.status),w=X(o.userErrors);throw new f(`Customer accounts: ${d}`,{status:s.status,...w.length>0&&{userErrors:w},...o.code==="INVALID"&&{code:"INVALID"}})}return{kind:"answer",data:o}}async function me(){let e=await p("/me");return e.kind==="answer"&&e.data.loggedIn===!0?{loggedIn:!0,customer:W(e.data.customer)}:{loggedIn:!1}}async function P(){if(c.kind==="known")return c.login;c.kind==="unknown"&&(c={kind:"asking",request:me()});let{request:e}=c,t=()=>c.kind==="asking"&&c.request===e,r;try{r=await e}catch(n){throw t()&&(c={kind:"unknown"}),n}return t()?(c={kind:"known",login:r},z(r.loggedIn),r):P()}var Q=()=>c.kind==="known"&&c.login.loggedIn;function R(){c={kind:"unknown"}}function Y(e){let t=i.account?.navigate;t?t(e):window.location.assign(e)}var ge=e=>e||i.account?.locale||(i.locale||"").split("-")[0]||"";function Z({returnTo:e,locale:t}){let r=new URL(`${K()}/login`);r.searchParams.set("returnTo",e);let n=ge(t);n&&r.searchParams.set("locale",n),i.country&&r.searchParams.set("country",i.country.toUpperCase()),Y(r.toString())}async function ee(){let e=k.id();if(!(await P()).loggedIn||!e)return null;let t=await p("/cart",{method:"POST",body:{cartId:e}});return t.kind==="logged-out"?null:y(t.data.checkoutUrl)}async function te(e){let t=await p("/logout",{method:"POST",body:{returnTo:e,cartId:k.id()}});R(),z(!1),h("account-logout",{});let r=t.kind==="answer"?y(t.data.logoutUrl):null;return r?(Y(r),"redirected"):"stayed"}var C=10,b=50,re=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=b,fe=e=>j(e,"limit",{min:1,max:b,fallback:C}),pe=e=>e.replace(/\?.*$/,"").replace(/^.*\//,"");function we(e){let t=i.account?.orderUrl;if(t)return t.replaceAll("{id}",encodeURIComponent(pe(e.id)));let r=e.statusPageUrl;return r!==null&&T(r)?r:null}var he=e=>({name:e.name??"",date:F(e.processedAt),total:_(e.totalPrice),status:e.financialStatus?.toLowerCase(),fulfillment:e.fulfillmentStatus?.toLowerCase(),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title??""}`).join(", ")});function ke(e,t){let r=t.lineItems.nodes,n=we(t),s=he(t);l(e,a("order-bind")).forEach(o=>{let d=g(o,"order-bind")??"";if(d==="url"){n&&o.setAttribute("href",n);return}if(d==="image"){let S=r.find(ue=>ue.image)?.image;S&&q(o,S.url,S.altText||r[0]?.title||"");return}let w=A(s,d);w!==void 0&&v(o,w)}),l(e,a("order-lines")).forEach(o=>{B(o,r,null)}),g(e,"order-bind")==="url"&&n&&e.setAttribute("href",n)}async function ne(e,t){let r=l(e,a("orders")),n=r[0];if(!n)return;O(e,"show",{"orders-loading":!0,"orders-empty":!1});let s=fe(n),o;try{o=await t(s)}catch(d){m(d,"orders"),o=null}O(e,"show",{"orders-loading":!1,"orders-empty":o?.length===0}),r.forEach(d=>{$(d,o??[],ke)})}var Pe=["order","addresses","subscriptions","profile-form","address-form"],ye=Q;function ve({returnTo:e=window.location.href,locale:t}={}){return new Promise(r=>{Z({returnTo:e,locale:t}),r()})}async function ce(){let e=await P();return e.loggedIn?e.customer:null}async function Ae({first:e=C}={}){if(!re(e))throw new f(`Customer accounts: orders() takes first from 1 to ${String(b)}`,{code:"INVALID"});let t=await p(`/orders?${new URLSearchParams({first:String(e)}).toString()}`);return t.kind==="logged-out"?[]:H(t.data.orders)}async function be({returnTo:e=i.account?.logoutUrl||`${window.location.origin}/`}={}){await te(e)==="stayed"&&await I(document)}async function Se(){try{return(await P()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(e){return{kind:"unknown",error:e}}}var oe=e=>Pe.some(t=>l(e,a(t)).length>0);function Le(e){l(e,a("account-link")).forEach(t=>{t.setAttribute("href",xe(g(t,"account-link")))})}function xe(e){let t=i.account,r=`https://${i.domain}/account`;return e==="payment"?t?.paymentUrl||t?.subscriptionsUrl||r:e==="subscriptions"&&t?.subscriptionsUrl||r}async function I(e=document){let t=await Se();t.kind==="unknown"&&m(t.error,"account");let r=t.kind==="logged-in";if(l(e,a("show")).forEach(n=>{let s=g(n,"show");s==="logged-in"&&L(n,r),s==="logged-out"&&L(n,!r)}),Le(e),t.kind==="unknown"&&oe(e)){(await u()).showUnavailable(e);return}r&&(await ae(e),await Promise.all([ne(e,n=>Ae({first:n})),oe(e)?u().then(n=>n.renderPages(e)):null]))}async function ae(e){let t=l(e,a("account-bind"));if(!t.length)return;let r;try{r=await ce()}catch(s){m(s,"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(", ")};t.forEach(s=>{let o=A(n,g(s,"account-bind")??"");o!=null&&v(s,o)})}var se=null;function u(){return se??(se=J("account-pages").then(e=>(e.setup({serverFetch:p,customer:ce,bindCustomer:ae,reset:R}),e))),se}var tt=e=>u().then(t=>t.order(e)),rt=e=>u().then(t=>t.updateProfile(e)),nt=()=>u().then(e=>e.addresses()),ot=(e,t)=>u().then(r=>r.saveAddress(e,t)),st=e=>u().then(t=>t.deleteAddress(e)),it=()=>u().then(e=>e.subscriptions()),ct=(e,t)=>u().then(r=>r.subscriptionAction(e,t)),at=(e,t)=>u().then(r=>r.requestReturn(e,t));function Oe(e){let t=e.target;t instanceof window.Element&&(t.closest(a("account-login"))?(e.preventDefault(),ve().catch(r=>{m(r,"login")})):t.closest(a("account-logout"))&&(e.preventDefault(),be().catch(r=>{m(r,"logout")})))}function Re(){let e=new URL(window.location.href),t=e.searchParams.get("account");if(G(t))switch(e.searchParams.delete("account"),window.history.replaceState(window.history.state,"",e),t){case"in":h("account-login",{});break;case"expired":case"error":h("account-error",{error:t});break}}var ie=!1;async function ut(e=document){if(ie){await I(e);return}ie=!0,document.addEventListener("click",Oe),Re(),k.setCheckoutResolver(ee),await I(e),U("account",ye()?"logged in":"logged out")}export{nt as addresses,ce as customer,st as deleteAddress,ye as isLoggedIn,ve as login,be as logout,ut as mountAccount,tt as order,Ae as orders,I as render,at as requestReturn,ot as saveAddress,ct as subscriptionAction,it as subscriptions,rt as updateProfile};
@@ -1 +1 @@
1
- import{a as O,b as ie,c as oe,d as ae,e as S,i as m,j as L,k as E,l as k,m as h,n as de}from"./chunk-74HC6MR2.js";import{D as y,E as C,G as g,I as se,a as H,m as f,n as a,o as p,q as l,u as ne,x as re,z as P}from"./chunk-BRI56DD5.js";import{F as x,d as A,e as i,g as d,h as z,i as M,j as q,k as w,l as te,r as G}from"./chunk-X2HBGPFB.js";var ue={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}}},it=new Map(Object.values(ue).map(e=>[`${e.method} ${e.path}`,{...e,fields:Object.keys(e.fields)}]));function le(e,t){let n=ue[e];if(n.method==="POST")return{method:"POST",path:n.path};let r=t,s=new URLSearchParams;for(let u of Object.keys(n.fields)){let c=r[u];(typeof c=="string"||typeof c=="number")&&s.set(u,String(c))}let o=s.toString();return{method:"GET",path:o?`${n.path}?${o}`:n.path}}function me(e){let t=n=>d(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:te(i(e,"formatted"))}}var ce=e=>A(e)?me(e):null,j=e=>({...me(e),id:S(i(e,"id"),"address id")}),pe=e=>q(e,t=>({...j(t),isDefault:i(t,"isDefault")===!0})),Le=e=>({...oe(e),id:S(i(e,"id"),"line item id"),name:d(i(e,"name")),sku:d(i(e,"sku")),price:O(i(e,"price")),totalPrice:O(i(e,"totalPrice")),suggestedReturnReasonDefinitions:w(i(e,"suggestedReturnReasonDefinitions"),t=>({id:S(i(t,"id"),"return reason id"),name:d(i(t,"name")),handle:d(i(t,"handle"))}))}),Ie=e=>({id:d(i(e,"id")),status:d(i(e,"status")),createdAt:d(i(e,"createdAt")),estimatedDeliveryAt:d(i(e,"estimatedDeliveryAt")),latestShipmentStatus:d(i(e,"latestShipmentStatus")),trackingInformation:q(i(e,"trackingInformation"),t=>({company:d(i(t,"company")),number:d(i(t,"number")),url:d(i(t,"url"))}))});function Re(e){let t=d(i(i(e,"lineItem"),"id"));return{quantity:M(i(e,"quantity")),lineItem:t===null?null:{id:t}}}function Ne(e){return A(e)?{returnableLineItems:w(e.returnableLineItems,Re)}:null}function fe(e){if(!A(e))return null;let t=s=>d(e[s]),n=s=>O(e[s]),r=e.requiresShipping;return{id:S(e.id,"order id"),name:t("name"),number:z(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:ce(e.shippingAddress),billingAddress:ce(e.billingAddress),lineItems:w(e.lineItems,Le),fulfillments:w(e.fulfillments,Ie),returnInformation:Ne(e.returnInformation),returns:w(e.returns,_)}}var ke=e=>({id:d(i(e,"id")),name:d(i(e,"name")),title:d(i(e,"title")),variantTitle:d(i(e,"variantTitle")),quantity:M(i(e,"quantity")),sku:d(i(e,"sku")),currentPrice:O(i(e,"currentPrice")),lineDiscountedPrice:O(i(e,"lineDiscountedPrice")),image:ie(i(e,"image"))}),ge=e=>({cycleIndex:z(i(e,"cycleIndex")),skipped:i(e,"skipped")===!0,billingAttemptExpectedDate:d(i(e,"billingAttemptExpectedDate"))});function De(e){if(!A(e))return null;let t=e.intervalCount;return{interval:d(e.interval),intervalCount:A(t)?{count:M(t.count)}:null}}var ve=e=>({id:S(i(e,"id"),"subscription id"),status:d(i(e,"status")),nextBillingDate:d(i(e,"nextBillingDate")),currencyCode:d(i(e,"currencyCode")),deliveryPrice:O(i(e,"deliveryPrice")),deliveryPolicy:De(i(e,"deliveryPolicy")),lines:w(i(e,"lines"),ke),upcomingBillingCycles:w(i(e,"upcomingBillingCycles"),ge)}),be=e=>q(e,ve);function ye(e){let{contract:t,billingCycle:n}=e;if(A(t))return{contract:{id:d(t.id),status:d(t.status)}};if(A(n)){let{cycleIndex:r,skipped:s}=ge(n);return{billingCycle:{cycleIndex:r,skipped:s}}}throw ae("changed subscription")}function _(e){return{id:S(i(e,"id"),"return id"),status:d(i(e,"status"))}}var he=e=>S(e,"deleted address id"),Ae=e=>({firstName:d(i(e,"firstName")),lastName:d(i(e,"lastName"))});var V=null;function Me(e){V=e}function I(){if(!V)throw new Error("account-pages: loaded without the account part");return V}async function T(e,t){let{serverFetch:n}=I(),{method:r,path:s}=le(e,t),o=await n(s,r==="POST"?{method:r,body:t}:{});if(o.kind==="logged-out")throw new H("Not logged in",{code:"NOT_LOGGED_IN",status:401});return o.data}function D(e){I().reset(),ne("account-updated",{what:e})}async function K(e){let t=await T("order",{id:e});return fe(t.order)}async function Q({firstName:e,lastName:t}={}){let n=await T("profile",{firstName:e,lastName:t});return D("profile"),Ae(n.customer)}async function W(){let e=await T("addresses",{});return pe(e.addresses)}async function F(e,{id:t,isDefault:n}={}){let r=await T("saveAddress",{id:t,address:e,isDefault:n});return D("addresses"),j(r.address)}async function X(e){let t=await T("deleteAddress",{id:e});return D("addresses"),he(t.deleted)}async function Y(){let e=await T("subscriptions",{});return be(e.subscriptions)}async function Z(e,t){let n=await T("subscription",{id:e,action:t});return D("subscriptions"),ye(n)}async function J(e,t){let n=await T("requestReturn",{orderId:e,lines:t});return D("orders"),_(n.return)}function qe(e){let t=p(e,"order")||"";return t.startsWith("url:")?new URL(window.location.href).searchParams.get(t.slice(4)||"id"):t}function v(e,t){e.setAttribute(f("order-state"),t),m(e,"order-show",{loading:t==="loading",ready:!1,"not-found":t==="not-found",error:t==="error"})}var He=e=>({name:e.name??"",date:C(e.processedAt),total:y(e.totalPrice),subtotal:y(e.subtotal),shipping:y(e.totalShipping),tax:y(e.totalTax),status:E(e.financialStatus),fulfillment:E(e.fulfillmentStatus),"shipping-address":k(e.shippingAddress),"billing-address":k(e.billingAddress),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title||t.name||""}`).join(", "),cancelled:C(e.cancelledAt)});function Fe(e,t){let n=t.trackingInformation[0],r={status:E(t.latestShipmentStatus||t.status),date:C(t.createdAt),eta:C(t.estimatedDeliveryAt),company:n?.company||"",number:n?.number||""};L(e,"fulfillment-bind").forEach(s=>{let o=p(s,"fulfillment-bind")??"";if(o==="url"){let c=n?.url??null,b=c!==null&&G(c);b&&s.setAttribute("href",c),se(s,b);return}let u=h(r,o);u!==void 0&&g(s,u)})}function Be(e,t){let n=new Map((t.returnInformation?.returnableLineItems.nodes??[]).map(u=>[u.lineItem?.id??"",u.quantity])),r=t.fulfillments.nodes,s=He(t);l(e,a("order-bind")).forEach(u=>{let c=p(u,"order-bind")??"";if(c==="url"){let $=t.statusPageUrl;$!==null&&G($)&&u.setAttribute("href",$);return}let b=h(s,c);b!==void 0&&g(u,b)}),l(e,a("order-lines")).forEach(u=>{de(u,t.lineItems.nodes,n)}),l(e,a("order-fulfillments")).forEach(u=>{P(u,r,Fe)});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(u=>u>0),"has-returns":!o&&t.returns.nodes.length>0,"return-requested":o}),e.setAttribute(f("order-state"),"ready")}async function B(e){let t=qe(e);if(!t){e.setAttribute(f("order-state"),"not-found"),m(e,"order-show",{"not-found":!0});return}v(e,"loading");let n;try{n=await K(t)}catch(r){x(r,"order"),v(e,"error");return}if(!n){v(e,"not-found");return}e.dataset.tetherOrderId=n.id,Be(e,n)}var we=[],xe=e=>we.find(t=>t.id===e),Ue=e=>({formatted:k(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 $e(e,t){e.dataset.tetherAddress=t.id;let n=Ue(t);L(e,"address-bind").forEach(r=>{let s=h(n,p(r,"address-bind")??"");s!==void 0&&g(r,s)}),m(e,"address-show",{default:t.isDefault,"not-default":!t.isDefault})}async function R(e){let t=l(e,a("addresses"));if(!t.length)return;m(e,"show",{"addresses-loading":!0,"addresses-empty":!1});let n;try{n=await W()}catch(r){x(r,"addresses"),m(e,"show",{"addresses-loading":!1,"addresses-error":!0});return}we=n,m(e,"show",{"addresses-loading":!1,"addresses-empty":n.length===0,"addresses-error":!1}),t.forEach(r=>{P(r,n,$e)})}function ze(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 Ge(e){let t=E(e.deliveryPolicy?.interval);if(!t)return"";let n=e.deliveryPolicy?.intervalCount?.count??1;return n<=1?t:`${String(n)} ${t}s`}function je(e){let t=e.lines.nodes,n=t.reduce((r,s)=>r+Number.parseFloat(s.lineDiscountedPrice?.amount??"0"),0);return{status:E(e.status),next:C(e.nextBillingDate),interval:Ge(e),products:t.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", "),total:y(t.length&&e.currencyCode?{amount:String(n),currencyCode:e.currencyCode}:null),delivery:y(e.deliveryPrice)}}function _e(e,t){let n={title:t.title??"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:y(t.currentPrice)};L(e,"subscription-line").forEach(r=>{let s=p(r,"subscription-line")??"";if(s==="image"){t.image&&re(r,t.image.url,t.image.altText||t.title||"");return}let o=h(n,s);o!==void 0&&g(r,o)})}function Ve(e,t){e.dataset.tetherSubscription=t.id,e.setAttribute(f("subscription-status"),E(t.status));let n=je(t);l(e,a("subscription-bind")).forEach(s=>{let o=h(n,p(s,"subscription-bind")??"");o!==void 0&&g(s,o)}),l(e,a("subscription-lines")).forEach(s=>{P(s,t.lines.nodes,_e)});let r=ze(t);m(e,"subscription-show",r),l(e,a("subscription-action")).forEach(s=>{let o=h(r,`can-${p(s,"subscription-action")??""}`)===!0;"disabled"in s&&(s.disabled=!o),s.classList.toggle("is-disabled",!o)})}async function U(e){let t=l(e,a("subscriptions"));if(!t.length)return;m(e,"show",{"subscriptions-loading":!0,"subscriptions-empty":!1});let n;try{n=await Y()}catch(r){x(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=>{P(r,n,Ve)})}var Ke=["pause","resume","skip","unskip","cancel"],Qe=e=>Ke.some(t=>t===e),Ee=e=>e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement,Te=e=>e instanceof window.HTMLFormElement;function Se(e){let t={};for(let n of e.elements)Ee(n)&&(!n.name||n.type==="submit"||n.type==="button"||n.type==="checkbox"||(t[n.name]=n.value));return t}function We(e){let n=(e instanceof H?e.userErrors??[]:[]).map(s=>s.message).join(" ");return n||(e instanceof Error&&e.message?e.message:"Something went wrong").replace(/^Customer accounts: /,"")}async function N(e,t){if(e.getAttribute("aria-busy")==="true")return"busy";e.classList.add("is-busy"),e.setAttribute("aria-busy","true"),e.setAttribute(f("form-state"),"pending");let n=l(e,a("form-error"));n.forEach(r=>{g(r,"")});try{return await t(),e.setAttribute(f("form-state"),"saved"),"saved"}catch(r){return e.setAttribute(f("form-state"),"error"),n.forEach(s=>{g(s,We(r))}),"error"}finally{e.classList.remove("is-busy"),e.removeAttribute("aria-busy")}}var ee=e=>{let t=p(e,"confirm");return!t||window.confirm(t)},Pe=e=>{e.reset(),delete e.dataset.tetherAddressId};function Xe(e){let t=e.target;if(t instanceof window.HTMLFormElement){if(t.matches(a("profile-form")))e.preventDefault(),N(t,async()=>{await Q(Se(t)),await I().bindCustomer(document)});else if(t.matches(a("address-form"))){e.preventDefault();let n=t.dataset.tetherAddressId,r=t.elements.namedItem("isDefault"),s=r instanceof window.HTMLInputElement&&r.checked;N(t,async()=>{await F(Se(t),{id:n,isDefault:s}),Pe(t),await R(document)})}}}function Ye(e){let t=xe(e),n=document.querySelector(a("address-form"));if(!t||!n||!Te(n))return;n.dataset.tetherAddressId=t.id;let r={...t};for(let s of n.elements)if(Ee(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 Ze(e,t){let n=t.closest("[data-tether-address]"),r=n instanceof window.HTMLElement?n.dataset.tetherAddress:void 0;if(t.closest(a("address-new"))){let o=document.querySelector(a("address-form"));return o&&Te(o)&&Pe(o),!0}if(!(n instanceof window.HTMLElement)||!r)return!1;let s=t.closest(a("address-delete"));if(s){if(e.preventDefault(),!ee(s))return!0;N(n,async()=>{await X(r),await R(document)})}else if(t.closest(a("address-default")))e.preventDefault(),N(n,async()=>{await F(null,{id:r,isDefault:!0}),await R(document)});else if(t.closest(a("address-edit")))e.preventDefault(),Ye(r);else return!1;return!0}function Je(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)||!Qe(n)||r||!ee(e))return;let s=t.dataset.tetherSubscription??"";t.setAttribute(f("subscription-state"),"pending"),N(t,async()=>{await Z(s,n),await U(document)}).then(o=>{let u=o==="error"?"error":"done";l(document,"[data-tether-subscription]").filter(c=>c===t||c.dataset.tetherSubscription===s).forEach(c=>{c.setAttribute(f("subscription-state"),u)})})}function et(e){let t=e.querySelector(a("return-quantity")),n=e.querySelector(a("return-reason")),r=e.querySelector(a("return-note")),s=b=>b&&"value"in b&&typeof b.value=="string"?b.value:"",o={lineItemId:e.dataset.tetherLine??"",quantity:Number.parseInt(s(t)||"0",10)},u=s(n);u&&(o.reasonId=u);let c=s(r);return c&&(o.note=c),o}function tt(e){let t=e.closest(a("order"));if(!(t instanceof window.HTMLElement))return;let n=t.dataset.tetherOrderId;if(!n)return;let r=l(t,"[data-tether-line]").map(et).filter(s=>s.quantity>0);!r.length||!ee(e)||N(t,async()=>{await J(n,r),t.dataset.tetherReturned="1",await B(t)})}function nt(e){let t=e.target;if(!(t instanceof window.Element)||Ze(e,t))return;let n=t.closest(a("subscription-action"));if(n instanceof window.HTMLElement){e.preventDefault(),Je(n);return}let r=t.closest(a("order-return"));r instanceof window.HTMLElement&&(e.preventDefault(),tt(r))}function Ce(){document.addEventListener("submit",Xe,!0),document.addEventListener("input",e=>{let t=e.target;t instanceof window.HTMLElement&&t.closest(a("profile-form"))&&(t.dataset.tetherTouched="1")}),document.addEventListener("click",nt)}var rt=["firstName","lastName"];async function st(e){if(!(e instanceof window.HTMLFormElement))return;let t;try{t=await I().customer()}catch(r){x(r,"account");return}if(!t)return;let n=e.elements;rt.forEach(r=>{let s=n.namedItem(r);(s instanceof window.HTMLInputElement||s instanceof window.HTMLTextAreaElement)&&!s.dataset.tetherTouched&&(s.value=t[r]??"")})}var Oe=!1;async function Qt(e=document){Oe||(Oe=!0,Ce()),await Promise.all([...l(e,a("order")).map(t=>B(t)),...l(e,a("profile-form")).map(t=>st(t)),R(e),U(e)])}function Wt(e){l(e,a("order")).forEach(t=>{v(t,"error")}),m(e,"show",{"addresses-loading":!1,"addresses-error":!0,"subscriptions-loading":!1,"subscriptions-error":!0})}export{W as addresses,X as deleteAddress,K as order,Qt as renderPages,J as requestReturn,F as saveAddress,Me as setup,Wt as showUnavailable,Z as subscriptionAction,Y as subscriptions,Q as updateProfile};
1
+ import{a as O,b as ie,c as oe,d as ae,e as S,i as m,j as L,k as E,l as k,m as h,n as de}from"./chunk-PHTINCRN.js";import{D as y,E as C,G as g,I as se,a as H,m as f,n as a,o as p,q as l,u as ne,x as re,z as P}from"./chunk-B7SC7UOJ.js";import{F as x,d as A,e as i,g as d,h as z,i as M,j as q,k as w,l as te,r as G}from"./chunk-QUBBZNJ7.js";var ue={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}}},it=new Map(Object.values(ue).map(e=>[`${e.method} ${e.path}`,{...e,fields:Object.keys(e.fields)}]));function le(e,t){let n=ue[e];if(n.method==="POST")return{method:"POST",path:n.path};let r=t,s=new URLSearchParams;for(let u of Object.keys(n.fields)){let c=r[u];(typeof c=="string"||typeof c=="number")&&s.set(u,String(c))}let o=s.toString();return{method:"GET",path:o?`${n.path}?${o}`:n.path}}function me(e){let t=n=>d(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:te(i(e,"formatted"))}}var ce=e=>A(e)?me(e):null,j=e=>({...me(e),id:S(i(e,"id"),"address id")}),pe=e=>q(e,t=>({...j(t),isDefault:i(t,"isDefault")===!0})),Le=e=>({...oe(e),id:S(i(e,"id"),"line item id"),name:d(i(e,"name")),sku:d(i(e,"sku")),price:O(i(e,"price")),totalPrice:O(i(e,"totalPrice")),suggestedReturnReasonDefinitions:w(i(e,"suggestedReturnReasonDefinitions"),t=>({id:S(i(t,"id"),"return reason id"),name:d(i(t,"name")),handle:d(i(t,"handle"))}))}),Ie=e=>({id:d(i(e,"id")),status:d(i(e,"status")),createdAt:d(i(e,"createdAt")),estimatedDeliveryAt:d(i(e,"estimatedDeliveryAt")),latestShipmentStatus:d(i(e,"latestShipmentStatus")),trackingInformation:q(i(e,"trackingInformation"),t=>({company:d(i(t,"company")),number:d(i(t,"number")),url:d(i(t,"url"))}))});function Re(e){let t=d(i(i(e,"lineItem"),"id"));return{quantity:M(i(e,"quantity")),lineItem:t===null?null:{id:t}}}function Ne(e){return A(e)?{returnableLineItems:w(e.returnableLineItems,Re)}:null}function fe(e){if(!A(e))return null;let t=s=>d(e[s]),n=s=>O(e[s]),r=e.requiresShipping;return{id:S(e.id,"order id"),name:t("name"),number:z(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:ce(e.shippingAddress),billingAddress:ce(e.billingAddress),lineItems:w(e.lineItems,Le),fulfillments:w(e.fulfillments,Ie),returnInformation:Ne(e.returnInformation),returns:w(e.returns,_)}}var ke=e=>({id:d(i(e,"id")),name:d(i(e,"name")),title:d(i(e,"title")),variantTitle:d(i(e,"variantTitle")),quantity:M(i(e,"quantity")),sku:d(i(e,"sku")),currentPrice:O(i(e,"currentPrice")),lineDiscountedPrice:O(i(e,"lineDiscountedPrice")),image:ie(i(e,"image"))}),ge=e=>({cycleIndex:z(i(e,"cycleIndex")),skipped:i(e,"skipped")===!0,billingAttemptExpectedDate:d(i(e,"billingAttemptExpectedDate"))});function De(e){if(!A(e))return null;let t=e.intervalCount;return{interval:d(e.interval),intervalCount:A(t)?{count:M(t.count)}:null}}var ve=e=>({id:S(i(e,"id"),"subscription id"),status:d(i(e,"status")),nextBillingDate:d(i(e,"nextBillingDate")),currencyCode:d(i(e,"currencyCode")),deliveryPrice:O(i(e,"deliveryPrice")),deliveryPolicy:De(i(e,"deliveryPolicy")),lines:w(i(e,"lines"),ke),upcomingBillingCycles:w(i(e,"upcomingBillingCycles"),ge)}),be=e=>q(e,ve);function ye(e){let{contract:t,billingCycle:n}=e;if(A(t))return{contract:{id:d(t.id),status:d(t.status)}};if(A(n)){let{cycleIndex:r,skipped:s}=ge(n);return{billingCycle:{cycleIndex:r,skipped:s}}}throw ae("changed subscription")}function _(e){return{id:S(i(e,"id"),"return id"),status:d(i(e,"status"))}}var he=e=>S(e,"deleted address id"),Ae=e=>({firstName:d(i(e,"firstName")),lastName:d(i(e,"lastName"))});var V=null;function Me(e){V=e}function I(){if(!V)throw new Error("account-pages: loaded without the account part");return V}async function T(e,t){let{serverFetch:n}=I(),{method:r,path:s}=le(e,t),o=await n(s,r==="POST"?{method:r,body:t}:{});if(o.kind==="logged-out")throw new H("Not logged in",{code:"NOT_LOGGED_IN",status:401});return o.data}function D(e){I().reset(),ne("account-updated",{what:e})}async function K(e){let t=await T("order",{id:e});return fe(t.order)}async function Q({firstName:e,lastName:t}={}){let n=await T("profile",{firstName:e,lastName:t});return D("profile"),Ae(n.customer)}async function W(){let e=await T("addresses",{});return pe(e.addresses)}async function F(e,{id:t,isDefault:n}={}){let r=await T("saveAddress",{id:t,address:e,isDefault:n});return D("addresses"),j(r.address)}async function X(e){let t=await T("deleteAddress",{id:e});return D("addresses"),he(t.deleted)}async function Y(){let e=await T("subscriptions",{});return be(e.subscriptions)}async function Z(e,t){let n=await T("subscription",{id:e,action:t});return D("subscriptions"),ye(n)}async function J(e,t){let n=await T("requestReturn",{orderId:e,lines:t});return D("orders"),_(n.return)}function qe(e){let t=p(e,"order")||"";return t.startsWith("url:")?new URL(window.location.href).searchParams.get(t.slice(4)||"id"):t}function v(e,t){e.setAttribute(f("order-state"),t),m(e,"order-show",{loading:t==="loading",ready:!1,"not-found":t==="not-found",error:t==="error"})}var He=e=>({name:e.name??"",date:C(e.processedAt),total:y(e.totalPrice),subtotal:y(e.subtotal),shipping:y(e.totalShipping),tax:y(e.totalTax),status:E(e.financialStatus),fulfillment:E(e.fulfillmentStatus),"shipping-address":k(e.shippingAddress),"billing-address":k(e.billingAddress),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title||t.name||""}`).join(", "),cancelled:C(e.cancelledAt)});function Fe(e,t){let n=t.trackingInformation[0],r={status:E(t.latestShipmentStatus||t.status),date:C(t.createdAt),eta:C(t.estimatedDeliveryAt),company:n?.company||"",number:n?.number||""};L(e,"fulfillment-bind").forEach(s=>{let o=p(s,"fulfillment-bind")??"";if(o==="url"){let c=n?.url??null,b=c!==null&&G(c);b&&s.setAttribute("href",c),se(s,b);return}let u=h(r,o);u!==void 0&&g(s,u)})}function Be(e,t){let n=new Map((t.returnInformation?.returnableLineItems.nodes??[]).map(u=>[u.lineItem?.id??"",u.quantity])),r=t.fulfillments.nodes,s=He(t);l(e,a("order-bind")).forEach(u=>{let c=p(u,"order-bind")??"";if(c==="url"){let $=t.statusPageUrl;$!==null&&G($)&&u.setAttribute("href",$);return}let b=h(s,c);b!==void 0&&g(u,b)}),l(e,a("order-lines")).forEach(u=>{de(u,t.lineItems.nodes,n)}),l(e,a("order-fulfillments")).forEach(u=>{P(u,r,Fe)});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(u=>u>0),"has-returns":!o&&t.returns.nodes.length>0,"return-requested":o}),e.setAttribute(f("order-state"),"ready")}async function B(e){let t=qe(e);if(!t){e.setAttribute(f("order-state"),"not-found"),m(e,"order-show",{"not-found":!0});return}v(e,"loading");let n;try{n=await K(t)}catch(r){x(r,"order"),v(e,"error");return}if(!n){v(e,"not-found");return}e.dataset.tetherOrderId=n.id,Be(e,n)}var we=[],xe=e=>we.find(t=>t.id===e),Ue=e=>({formatted:k(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 $e(e,t){e.dataset.tetherAddress=t.id;let n=Ue(t);L(e,"address-bind").forEach(r=>{let s=h(n,p(r,"address-bind")??"");s!==void 0&&g(r,s)}),m(e,"address-show",{default:t.isDefault,"not-default":!t.isDefault})}async function R(e){let t=l(e,a("addresses"));if(!t.length)return;m(e,"show",{"addresses-loading":!0,"addresses-empty":!1});let n;try{n=await W()}catch(r){x(r,"addresses"),m(e,"show",{"addresses-loading":!1,"addresses-error":!0});return}we=n,m(e,"show",{"addresses-loading":!1,"addresses-empty":n.length===0,"addresses-error":!1}),t.forEach(r=>{P(r,n,$e)})}function ze(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 Ge(e){let t=E(e.deliveryPolicy?.interval);if(!t)return"";let n=e.deliveryPolicy?.intervalCount?.count??1;return n<=1?t:`${String(n)} ${t}s`}function je(e){let t=e.lines.nodes,n=t.reduce((r,s)=>r+Number.parseFloat(s.lineDiscountedPrice?.amount??"0"),0);return{status:E(e.status),next:C(e.nextBillingDate),interval:Ge(e),products:t.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", "),total:y(t.length&&e.currencyCode?{amount:String(n),currencyCode:e.currencyCode}:null),delivery:y(e.deliveryPrice)}}function _e(e,t){let n={title:t.title??"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:y(t.currentPrice)};L(e,"subscription-line").forEach(r=>{let s=p(r,"subscription-line")??"";if(s==="image"){t.image&&re(r,t.image.url,t.image.altText||t.title||"");return}let o=h(n,s);o!==void 0&&g(r,o)})}function Ve(e,t){e.dataset.tetherSubscription=t.id,e.setAttribute(f("subscription-status"),E(t.status));let n=je(t);l(e,a("subscription-bind")).forEach(s=>{let o=h(n,p(s,"subscription-bind")??"");o!==void 0&&g(s,o)}),l(e,a("subscription-lines")).forEach(s=>{P(s,t.lines.nodes,_e)});let r=ze(t);m(e,"subscription-show",r),l(e,a("subscription-action")).forEach(s=>{let o=h(r,`can-${p(s,"subscription-action")??""}`)===!0;"disabled"in s&&(s.disabled=!o),s.classList.toggle("is-disabled",!o)})}async function U(e){let t=l(e,a("subscriptions"));if(!t.length)return;m(e,"show",{"subscriptions-loading":!0,"subscriptions-empty":!1});let n;try{n=await Y()}catch(r){x(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=>{P(r,n,Ve)})}var Ke=["pause","resume","skip","unskip","cancel"],Qe=e=>Ke.some(t=>t===e),Ee=e=>e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement,Te=e=>e instanceof window.HTMLFormElement;function Se(e){let t={};for(let n of e.elements)Ee(n)&&(!n.name||n.type==="submit"||n.type==="button"||n.type==="checkbox"||(t[n.name]=n.value));return t}function We(e){let n=(e instanceof H?e.userErrors??[]:[]).map(s=>s.message).join(" ");return n||(e instanceof Error&&e.message?e.message:"Something went wrong").replace(/^Customer accounts: /,"")}async function N(e,t){if(e.getAttribute("aria-busy")==="true")return"busy";e.classList.add("is-busy"),e.setAttribute("aria-busy","true"),e.setAttribute(f("form-state"),"pending");let n=l(e,a("form-error"));n.forEach(r=>{g(r,"")});try{return await t(),e.setAttribute(f("form-state"),"saved"),"saved"}catch(r){return e.setAttribute(f("form-state"),"error"),n.forEach(s=>{g(s,We(r))}),"error"}finally{e.classList.remove("is-busy"),e.removeAttribute("aria-busy")}}var ee=e=>{let t=p(e,"confirm");return!t||window.confirm(t)},Pe=e=>{e.reset(),delete e.dataset.tetherAddressId};function Xe(e){let t=e.target;if(t instanceof window.HTMLFormElement){if(t.matches(a("profile-form")))e.preventDefault(),N(t,async()=>{await Q(Se(t)),await I().bindCustomer(document)});else if(t.matches(a("address-form"))){e.preventDefault();let n=t.dataset.tetherAddressId,r=t.elements.namedItem("isDefault"),s=r instanceof window.HTMLInputElement&&r.checked;N(t,async()=>{await F(Se(t),{id:n,isDefault:s}),Pe(t),await R(document)})}}}function Ye(e){let t=xe(e),n=document.querySelector(a("address-form"));if(!t||!n||!Te(n))return;n.dataset.tetherAddressId=t.id;let r={...t};for(let s of n.elements)if(Ee(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 Ze(e,t){let n=t.closest("[data-tether-address]"),r=n instanceof window.HTMLElement?n.dataset.tetherAddress:void 0;if(t.closest(a("address-new"))){let o=document.querySelector(a("address-form"));return o&&Te(o)&&Pe(o),!0}if(!(n instanceof window.HTMLElement)||!r)return!1;let s=t.closest(a("address-delete"));if(s){if(e.preventDefault(),!ee(s))return!0;N(n,async()=>{await X(r),await R(document)})}else if(t.closest(a("address-default")))e.preventDefault(),N(n,async()=>{await F(null,{id:r,isDefault:!0}),await R(document)});else if(t.closest(a("address-edit")))e.preventDefault(),Ye(r);else return!1;return!0}function Je(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)||!Qe(n)||r||!ee(e))return;let s=t.dataset.tetherSubscription??"";t.setAttribute(f("subscription-state"),"pending"),N(t,async()=>{await Z(s,n),await U(document)}).then(o=>{let u=o==="error"?"error":"done";l(document,"[data-tether-subscription]").filter(c=>c===t||c.dataset.tetherSubscription===s).forEach(c=>{c.setAttribute(f("subscription-state"),u)})})}function et(e){let t=e.querySelector(a("return-quantity")),n=e.querySelector(a("return-reason")),r=e.querySelector(a("return-note")),s=b=>b&&"value"in b&&typeof b.value=="string"?b.value:"",o={lineItemId:e.dataset.tetherLine??"",quantity:Number.parseInt(s(t)||"0",10)},u=s(n);u&&(o.reasonId=u);let c=s(r);return c&&(o.note=c),o}function tt(e){let t=e.closest(a("order"));if(!(t instanceof window.HTMLElement))return;let n=t.dataset.tetherOrderId;if(!n)return;let r=l(t,"[data-tether-line]").map(et).filter(s=>s.quantity>0);!r.length||!ee(e)||N(t,async()=>{await J(n,r),t.dataset.tetherReturned="1",await B(t)})}function nt(e){let t=e.target;if(!(t instanceof window.Element)||Ze(e,t))return;let n=t.closest(a("subscription-action"));if(n instanceof window.HTMLElement){e.preventDefault(),Je(n);return}let r=t.closest(a("order-return"));r instanceof window.HTMLElement&&(e.preventDefault(),tt(r))}function Ce(){document.addEventListener("submit",Xe,!0),document.addEventListener("input",e=>{let t=e.target;t instanceof window.HTMLElement&&t.closest(a("profile-form"))&&(t.dataset.tetherTouched="1")}),document.addEventListener("click",nt)}var rt=["firstName","lastName"];async function st(e){if(!(e instanceof window.HTMLFormElement))return;let t;try{t=await I().customer()}catch(r){x(r,"account");return}if(!t)return;let n=e.elements;rt.forEach(r=>{let s=n.namedItem(r);(s instanceof window.HTMLInputElement||s instanceof window.HTMLTextAreaElement)&&!s.dataset.tetherTouched&&(s.value=t[r]??"")})}var Oe=!1;async function Qt(e=document){Oe||(Oe=!0,Ce()),await Promise.all([...l(e,a("order")).map(t=>B(t)),...l(e,a("profile-form")).map(t=>st(t)),R(e),U(e)])}function Wt(e){l(e,a("order")).forEach(t=>{v(t,"error")}),m(e,"show",{"addresses-loading":!1,"addresses-error":!0,"subscriptions-loading":!1,"subscriptions-error":!0})}export{W as addresses,X as deleteAddress,K as order,Qt as renderPages,J as requestReturn,F as saveAddress,Me as setup,Wt as showUnavailable,Z as subscriptionAction,Y as subscriptions,Q as updateProfile};
@@ -1 +1 @@
1
- import{a as A}from"./chunk-JJRRVUDP.js";import{h}from"./chunk-NXDME6AM.js";import"./chunk-YZC4KFT3.js";import"./chunk-SVJWBCRY.js";import"./chunk-47OLTPHV.js";import"./chunk-HRRJ7KUG.js";import"./chunk-IG23NTJK.js";import{d as k,i as E,n as p,s as _,t as w}from"./chunk-BRI56DD5.js";import{D as T,F as l,x as a}from"./chunk-X2HBGPFB.js";var F=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"},O="https://cdn.shopify.com/storefront/analytics/shopify.js",x=()=>window,m=()=>x().Shopify;function L(){let t=a.analytics?.shopify;return typeof t=="object"?t:{}}function I(){try{let t=m()?.customerPrivacy;return t?.consentStatus==="loaded"&&t.currentVisitorConsent?.()?.analytics!=="no"&&!!t.analyticsProcessingAllowed?.()}catch{return!1}}function j(t){let e=`hydrogen:${t}`;return{getTrackingValues:()=>{let n=I()?m()?.customerPrivacy?.__internal:void 0;return{uniqueToken:n?.uniqueToken?.({generateFallback:!0,tag:e})??"",visitToken:n?.visitToken?.({generateFallback:!0,tag:e})??""}}}}var $=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 U(t){let e=[],n=[],i={shop:{shopId:t,channel:"headless"},consent:{mode:L().consent||"no-banner"}},o=()=>{if(I())for(let r of e)for(;r.next<n.length;r.next+=1){let s=n[r.next];s&&G(r,s)}},c={getConfig:()=>i,publish(r,s={}){if(n.push({event:r,payload:{shop:i.shop,url:window.location.href,...s}}),n.length>F){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:j(r.name)};return Promise.resolve(r.setup?.({subscribe:$(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 G(t,{event:e,payload:n}){t.subscribers.get(e)?.forEach(i=>{try{i(n,t.context)}catch(o){l(o,`analytics ${t.name}`)}})}function P(t){let e=document.createElement("script");e.src=t,e.async=!0,document.head.appendChild(e)}async function R(t){let e=m();if(e?.analytics)return e.analytics;let n=await E("query TetherShopId { shop { id } }",{},k({shop:{id:"string"}}),{context:!1}),i=m()??{};x().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}=L();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=U(n.shop.id);return i.analytics=s,P(r==="default-banner"?S["default-banner"]:S.other),P(O),T("shopify analytics ready",n.shop.id),s}var W="Default Title",V=100,H=200,Y=t=>t?parseFloat(t.amount):0,N=t=>(t??"").split("/").pop()??"";function C(t,e,n=1,i){let o={item_id:e?.sku||N(e?.id)||N(t.id),item_name:t.title,item_variant:e?.title===W?void 0:e?.title,item_brand:t.vendor||void 0,item_category:t.productType||void 0,price:Y(e?.price??t.priceRange?.minVariantPrice),quantity:n};return i!=null&&(o.index=i),o}var g=(t,e=t.quantity)=>C(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 X=(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}),D=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 Z(){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 z(t,e){let n=Z();if(!e){n.push({event:t});return}n.push({ecommerce:null}),n.push({event:t,ecommerce:e})}var y=null,v=null,q=null,b=new WeakSet;function u(t,e,n,i){a.analytics?.dataLayer&&z(t,e),y&&n&&y.publish(n,i);try{a.analytics?.onEvent?.(t,e)}catch(o){l(o,"analytics onEvent")}}function M(){let t=document.querySelector(p("product"));return!t||t.closest(`${p("collection")},${p("products")},${p("recommendations")}`)?null:A.get(t)??null}function J({product:t,scope:e}){if(b.has(e.root)||M()!==e)return;b.add(e.root);let n=e.variant??t.variants.nodes[0],i=[C(t,n)],o=n?[X(t,n)]:[];u("view_item",{currency:n?.price.currencyCode,value:f(i),items:i},"product_viewed",{products:o})}function K({products:t,collection:e}){let n=t.slice(0,H).map((o,c)=>C(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 Q(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=[g(o,s)];u("add_to_cart",{currency:i,value:f(d),items:d},"product_added_to_cart",{cart:t,prevCart:q,currentLine:D(o),prevLine:r?D(r):void 0})}),n.forEach((o,c)=>{let r=o.quantity-(e.get(c)?.quantity??0);if(r<=0)return;let s=[g(o,r)];u("remove_from_cart",{currency:i,value:f(s),items:s})})}function tt({cart:t,reason:e}){let n=new Map((t?.lines.nodes??[]).map(i=>[i.merchandise.id,i]));v&&e!=="load"&&e!=="pending"&&Q(t,n,v),v=n,q=t}function et(){let t=h.lines.map(e=>g(e));u("view_cart",{currency:h.state?.cost.totalAmount.currencyCode,value:f(t),items:t})}function nt({cart:t}){if(!t)return;let e=t.lines.nodes.map(i=>g(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 it={"product-ready":J,"list-ready":K,"cart-updated":tt,"cart-toggled":({open:t})=>{t&&et()},checkout:nt,search:({term:t})=>{t&&u("search",{search_term:t},"search_viewed",{searchTerm:t})}};function ot(t,e){it[e](t.detail)}function B(t){if(t.type==="astro:page-load"){b=new WeakSet,y?.publish("page_viewed",{});return}_.forEach(e=>{w(t,e)&&ot(t,e)})}async function ft(t){a.analytics?.shopify&&(y=await R(()=>M()!=null).catch(e=>(l(e,"shopify analytics"),null))),y?.publish("page_viewed",{}),t.splice(0).forEach(B),t.push=(...e)=>(e.forEach(B),t.length)}export{ft as startAnalytics};
1
+ import{a as A}from"./chunk-HGNFQHEU.js";import{h}from"./chunk-KF76466X.js";import"./chunk-4BZ4X2Z6.js";import"./chunk-BGUUUMJO.js";import"./chunk-ADA2ZGPO.js";import"./chunk-I54NQEVK.js";import"./chunk-R3UWDQL5.js";import{d as k,i as E,n as p,s as _,t as w}from"./chunk-B7SC7UOJ.js";import{D as T,F as l,x as a}from"./chunk-QUBBZNJ7.js";var F=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"},O="https://cdn.shopify.com/storefront/analytics/shopify.js",x=()=>window,m=()=>x().Shopify;function L(){let t=a.analytics?.shopify;return typeof t=="object"?t:{}}function I(){try{let t=m()?.customerPrivacy;return t?.consentStatus==="loaded"&&t.currentVisitorConsent?.()?.analytics!=="no"&&!!t.analyticsProcessingAllowed?.()}catch{return!1}}function j(t){let e=`hydrogen:${t}`;return{getTrackingValues:()=>{let n=I()?m()?.customerPrivacy?.__internal:void 0;return{uniqueToken:n?.uniqueToken?.({generateFallback:!0,tag:e})??"",visitToken:n?.visitToken?.({generateFallback:!0,tag:e})??""}}}}var $=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 U(t){let e=[],n=[],i={shop:{shopId:t,channel:"headless"},consent:{mode:L().consent||"no-banner"}},o=()=>{if(I())for(let r of e)for(;r.next<n.length;r.next+=1){let s=n[r.next];s&&G(r,s)}},c={getConfig:()=>i,publish(r,s={}){if(n.push({event:r,payload:{shop:i.shop,url:window.location.href,...s}}),n.length>F){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:j(r.name)};return Promise.resolve(r.setup?.({subscribe:$(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 G(t,{event:e,payload:n}){t.subscribers.get(e)?.forEach(i=>{try{i(n,t.context)}catch(o){l(o,`analytics ${t.name}`)}})}function P(t){let e=document.createElement("script");e.src=t,e.async=!0,document.head.appendChild(e)}async function R(t){let e=m();if(e?.analytics)return e.analytics;let n=await E("query TetherShopId { shop { id } }",{},k({shop:{id:"string"}}),{context:!1}),i=m()??{};x().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}=L();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=U(n.shop.id);return i.analytics=s,P(r==="default-banner"?S["default-banner"]:S.other),P(O),T("shopify analytics ready",n.shop.id),s}var W="Default Title",V=100,H=200,Y=t=>t?parseFloat(t.amount):0,N=t=>(t??"").split("/").pop()??"";function C(t,e,n=1,i){let o={item_id:e?.sku||N(e?.id)||N(t.id),item_name:t.title,item_variant:e?.title===W?void 0:e?.title,item_brand:t.vendor||void 0,item_category:t.productType||void 0,price:Y(e?.price??t.priceRange?.minVariantPrice),quantity:n};return i!=null&&(o.index=i),o}var g=(t,e=t.quantity)=>C(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 X=(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}),D=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 Z(){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 z(t,e){let n=Z();if(!e){n.push({event:t});return}n.push({ecommerce:null}),n.push({event:t,ecommerce:e})}var y=null,v=null,q=null,b=new WeakSet;function u(t,e,n,i){a.analytics?.dataLayer&&z(t,e),y&&n&&y.publish(n,i);try{a.analytics?.onEvent?.(t,e)}catch(o){l(o,"analytics onEvent")}}function M(){let t=document.querySelector(p("product"));return!t||t.closest(`${p("collection")},${p("products")},${p("recommendations")}`)?null:A.get(t)??null}function J({product:t,scope:e}){if(b.has(e.root)||M()!==e)return;b.add(e.root);let n=e.variant??t.variants.nodes[0],i=[C(t,n)],o=n?[X(t,n)]:[];u("view_item",{currency:n?.price.currencyCode,value:f(i),items:i},"product_viewed",{products:o})}function K({products:t,collection:e}){let n=t.slice(0,H).map((o,c)=>C(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 Q(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=[g(o,s)];u("add_to_cart",{currency:i,value:f(d),items:d},"product_added_to_cart",{cart:t,prevCart:q,currentLine:D(o),prevLine:r?D(r):void 0})}),n.forEach((o,c)=>{let r=o.quantity-(e.get(c)?.quantity??0);if(r<=0)return;let s=[g(o,r)];u("remove_from_cart",{currency:i,value:f(s),items:s})})}function tt({cart:t,reason:e}){let n=new Map((t?.lines.nodes??[]).map(i=>[i.merchandise.id,i]));v&&e!=="load"&&e!=="pending"&&Q(t,n,v),v=n,q=t}function et(){let t=h.lines.map(e=>g(e));u("view_cart",{currency:h.state?.cost.totalAmount.currencyCode,value:f(t),items:t})}function nt({cart:t}){if(!t)return;let e=t.lines.nodes.map(i=>g(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 it={"product-ready":J,"list-ready":K,"cart-updated":tt,"cart-toggled":({open:t})=>{t&&et()},checkout:nt,search:({term:t})=>{t&&u("search",{search_term:t},"search_viewed",{searchTerm:t})}};function ot(t,e){it[e](t.detail)}function B(t){if(t.type==="astro:page-load"){b=new WeakSet,y?.publish("page_viewed",{});return}_.forEach(e=>{w(t,e)&&ot(t,e)})}async function ft(t){a.analytics?.shopify&&(y=await R(()=>M()!=null).catch(e=>(l(e,"shopify analytics"),null))),y?.publish("page_viewed",{}),t.splice(0).forEach(B),t.push=(...e)=>(e.forEach(B),t.length)}export{ft as startAnalytics};
@@ -1 +1 @@
1
- import{b as P,c as f,d as x,e as v,f as d,g,h as A,i as y,j as I,k as h}from"./chunk-SVJWBCRY.js";var M=100,V=(n,e)=>f(P(n)*e,n.currencyCode),S=n=>Object.fromEntries(n.selectedOptions.map(e=>[e.name,e.value]));function w(n,e){return n.variants.nodes.find(o=>o.selectedOptions.every(r=>e[r.name]===r.value))??null}function T(n,e,o,r){return n.variants.nodes.some(t=>t.availableForSale&&t.selectedOptions.every(i=>i.name===o?i.value===r:e[i.name]===i.value))}var k=n=>n.kind==="subscription"?n.planId:n.offeredPlanId;function F(n,e){return n.kind==="subscription"&&d(e,n.planId)?n:{kind:"one-time"}}function C(n,e,o,r){let t=v(n),i=t.find(s=>s.id===r)??t[0];if(!i)return{kind:"one-time",offeredPlanId:null};let a=d(e,i.id)?i:t.find(s=>d(e,s.id))??i;return n.requiresSellingPlan||o==="subscription"?{kind:"subscription",planId:a.id}:{kind:"one-time",offeredPlanId:a.id}}function B(n,{variant:e,sellingPlan:o,defaultPlan:r,defaultPurchase:t}){let i=n.variants.nodes,a=x.variant(e),s=i.find(l=>l.id===a)??i.find(l=>l.availableForSale)??i[0]??null,c=h(n,o),p=c??h(n,r),m=c||t==="subscription"?"subscription":"one-time";return{selected:s?S(s):{},purchase:C(n,s,m,p?.id??null)}}function j(n,e,o,r,t){let i=n.quantityAvailable,a=i!=null&&i>0&&i<=e,s=r.compareAtPrice!==null,c=r.line.kind==="subscription";return{"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":s,"not-on-sale":!s,"has-variants":o>1,"single-variant":o===1,"low-stock":a,"plenty-in-stock":n.availableForSale&&!a,"subscription-available":r.subscriptionAvailable,"subscription-unavailable":!r.subscriptionAvailable,"subscription-only":t,"one-time-available":!t,"subscription-selected":c,"one-time-selected":!c,"has-savings":c?r.savings.percentage>0:s}}function R(n,e,o){let r=w(n,e.selected),t=r??n.variants.nodes[0];if(!t)return null;let i=C(n,t,e.purchase.kind,k(e.purchase)),a=k(i),s=v(n),c=F(i,t),p=c.kind==="subscription"?d(t,c.planId):null,m=p?g(t,a)??t.price:t.price,l=p?.priceAdjustments[0]?.compareAtPrice??t.compareAtPrice,b={line:c,subscriptionAvailable:s.some(u=>d(t,u.id)),compareAtPrice:l&&parseFloat(l.amount)>parseFloat(m.amount)?l:null,savings:y(t,a)};return{...b,variant:t,selected:r?e.selected:S(t),purchase:i,plan:s.find(u=>u.id===a)??null,quantity:e.quantity,price:m,show:j(t,o,n.variants.nodes.length,b,n.requiresSellingPlan)}}function G(n,e){let{variant:o,plan:r,price:t,compareAtPrice:i,quantity:a}=n,s=k(n.purchase),c=u=>V(u,Math.max(1,a)),b={price:()=>e.money(t),"total-price":()=>e.money(c(t)),"one-time-price":()=>e.money(o.price),"subscription-price":()=>e.money(s?g(o,s):null),"subscription-savings":()=>e.percent(n.savings.percentage),"subscription-savings-amount":()=>e.money(n.savings.amount),"checkout-charge":()=>{let u=n.line.kind==="subscription"?A(o,s)??t:t;return e.money(c(u))},"plan-name":()=>r?.name,"plan-description":()=>r?.description,"plan-group":()=>r?.group.name,"compare-at-price":()=>e.money(i),"unit-price":()=>e.money(o.unitPrice),"discount-percentage":()=>i?`${Math.round((1-parseFloat(t.amount)/parseFloat(i.amount))*M)}%`:"0%","discount-amount":()=>i?e.money(f(P(i)-P(t),t.currencyCode)):"","variant-title":()=>o.title,"variant-id":()=>o.id,sku:()=>o.sku,barcode:()=>o.barcode,stock:()=>o.quantityAvailable,quantity:()=>a};return new Map(Object.entries(b))}function E(n,e,o,r){let i={name:()=>o?.name,option:()=>(o?.options??[]).map(a=>a.value).join(", "),description:()=>o?.description,price:()=>r.money(g(n,e)),savings:()=>r.percent(y(n,e).percentage),"savings-amount":()=>r.money(y(n,e).amount),adjustment:()=>{let a=I(o);return a?a.type==="percentage"?`${a.value}%`:r.money(a.value):""}};return new Map(Object.entries(i))}export{S as a,T as b,k as c,F as d,C as e,B as f,R as g,G as h,E as i};
1
+ import{b as P,c as f,d as x,e as v,f as d,g,h as A,i as y,j as I,k as h}from"./chunk-BGUUUMJO.js";var M=100,V=(n,e)=>f(P(n)*e,n.currencyCode),S=n=>Object.fromEntries(n.selectedOptions.map(e=>[e.name,e.value]));function w(n,e){return n.variants.nodes.find(o=>o.selectedOptions.every(r=>e[r.name]===r.value))??null}function T(n,e,o,r){return n.variants.nodes.some(t=>t.availableForSale&&t.selectedOptions.every(i=>i.name===o?i.value===r:e[i.name]===i.value))}var k=n=>n.kind==="subscription"?n.planId:n.offeredPlanId;function F(n,e){return n.kind==="subscription"&&d(e,n.planId)?n:{kind:"one-time"}}function C(n,e,o,r){let t=v(n),i=t.find(s=>s.id===r)??t[0];if(!i)return{kind:"one-time",offeredPlanId:null};let a=d(e,i.id)?i:t.find(s=>d(e,s.id))??i;return n.requiresSellingPlan||o==="subscription"?{kind:"subscription",planId:a.id}:{kind:"one-time",offeredPlanId:a.id}}function B(n,{variant:e,sellingPlan:o,defaultPlan:r,defaultPurchase:t}){let i=n.variants.nodes,a=x.variant(e),s=i.find(l=>l.id===a)??i.find(l=>l.availableForSale)??i[0]??null,c=h(n,o),p=c??h(n,r),m=c||t==="subscription"?"subscription":"one-time";return{selected:s?S(s):{},purchase:C(n,s,m,p?.id??null)}}function j(n,e,o,r,t){let i=n.quantityAvailable,a=i!=null&&i>0&&i<=e,s=r.compareAtPrice!==null,c=r.line.kind==="subscription";return{"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":s,"not-on-sale":!s,"has-variants":o>1,"single-variant":o===1,"low-stock":a,"plenty-in-stock":n.availableForSale&&!a,"subscription-available":r.subscriptionAvailable,"subscription-unavailable":!r.subscriptionAvailable,"subscription-only":t,"one-time-available":!t,"subscription-selected":c,"one-time-selected":!c,"has-savings":c?r.savings.percentage>0:s}}function R(n,e,o){let r=w(n,e.selected),t=r??n.variants.nodes[0];if(!t)return null;let i=C(n,t,e.purchase.kind,k(e.purchase)),a=k(i),s=v(n),c=F(i,t),p=c.kind==="subscription"?d(t,c.planId):null,m=p?g(t,a)??t.price:t.price,l=p?.priceAdjustments[0]?.compareAtPrice??t.compareAtPrice,b={line:c,subscriptionAvailable:s.some(u=>d(t,u.id)),compareAtPrice:l&&parseFloat(l.amount)>parseFloat(m.amount)?l:null,savings:y(t,a)};return{...b,variant:t,selected:r?e.selected:S(t),purchase:i,plan:s.find(u=>u.id===a)??null,quantity:e.quantity,price:m,show:j(t,o,n.variants.nodes.length,b,n.requiresSellingPlan)}}function G(n,e){let{variant:o,plan:r,price:t,compareAtPrice:i,quantity:a}=n,s=k(n.purchase),c=u=>V(u,Math.max(1,a)),b={price:()=>e.money(t),"total-price":()=>e.money(c(t)),"one-time-price":()=>e.money(o.price),"subscription-price":()=>e.money(s?g(o,s):null),"subscription-savings":()=>e.percent(n.savings.percentage),"subscription-savings-amount":()=>e.money(n.savings.amount),"checkout-charge":()=>{let u=n.line.kind==="subscription"?A(o,s)??t:t;return e.money(c(u))},"plan-name":()=>r?.name,"plan-description":()=>r?.description,"plan-group":()=>r?.group.name,"compare-at-price":()=>e.money(i),"unit-price":()=>e.money(o.unitPrice),"discount-percentage":()=>i?`${Math.round((1-parseFloat(t.amount)/parseFloat(i.amount))*M)}%`:"0%","discount-amount":()=>i?e.money(f(P(i)-P(t),t.currencyCode)):"","variant-title":()=>o.title,"variant-id":()=>o.id,sku:()=>o.sku,barcode:()=>o.barcode,stock:()=>o.quantityAvailable,quantity:()=>a};return new Map(Object.entries(b))}function E(n,e,o,r){let i={name:()=>o?.name,option:()=>(o?.options??[]).map(a=>a.value).join(", "),description:()=>o?.description,price:()=>r.money(g(n,e)),savings:()=>r.percent(y(n,e).percentage),"savings-amount":()=>r.money(y(n,e).amount),adjustment:()=>{let a=I(o);return a?a.type==="percentage"?`${a.value}%`:r.money(a.value):""}};return new Map(Object.entries(i))}export{S as a,T as b,k as c,F as d,C as e,B as f,R as g,G as h,E as i};
@@ -1 +1 @@
1
- import{I as p,m as c,n as i,o as d,r as u}from"./chunk-BRI56DD5.js";function m(e){try{return decodeURIComponent(e)}catch(o){if(o instanceof URIError)return e;throw o}}var w="url:";function U(e,o=window.location,a="product"){let n=(d(e,a)??"").trim();if(!n.toLowerCase().startsWith(w))return{key:n||null,fromUrl:!1,raw:n};let r=n.slice(w.length).trim(),t;if(r.toLowerCase()==="path"){let s=o.pathname.split("/").filter(Boolean),f=s[s.length-1];t=f===void 0?null:m(f)}else t=new URLSearchParams(o.search).get(r||"handle");return{key:t?.trim()||null,fromUrl:!0,raw:n}}var h=["loading","ready","error","not-found"],y=e=>h.some(o=>o===e),S=e=>typeof e=="object"&&e!==null&&"code"in e?e.code:void 0,x=e=>S(e)==="NOT_FOUND",l=()=>["product","collection","products","recommendations"].map(e=>i(e)).join(","),K=(e,o)=>e===o||e.parentElement?.closest(l())===o;function g(e){let o=S(e);return typeof o=="string"&&o?o:"error"}function L(e,o,a){let n=o==="not-found",r=o==="error"||n;e.setAttribute(c("state"),n?"error":o),r?e.setAttribute(c("error"),n?"not-found":g(a)):e.removeAttribute(c("error")),u(e,i("show"),l()).forEach(t=>{let s=d(t,"show");y(s)&&p(t,s===o)}),r&&u(e,i("add-to-cart"),l()).forEach(t=>{t.classList.add("is-disabled"),t.setAttribute("aria-disabled","true"),"disabled"in t&&(t.disabled=!0)})}export{m as a,U as b,h as c,x as d,l as e,K as f,L as g};
1
+ import{I as p,m as c,n as i,o as d,r as u}from"./chunk-B7SC7UOJ.js";function m(e){try{return decodeURIComponent(e)}catch(o){if(o instanceof URIError)return e;throw o}}var w="url:";function U(e,o=window.location,a="product"){let n=(d(e,a)??"").trim();if(!n.toLowerCase().startsWith(w))return{key:n||null,fromUrl:!1,raw:n};let r=n.slice(w.length).trim(),t;if(r.toLowerCase()==="path"){let s=o.pathname.split("/").filter(Boolean),f=s[s.length-1];t=f===void 0?null:m(f)}else t=new URLSearchParams(o.search).get(r||"handle");return{key:t?.trim()||null,fromUrl:!0,raw:n}}var h=["loading","ready","error","not-found"],y=e=>h.some(o=>o===e),S=e=>typeof e=="object"&&e!==null&&"code"in e?e.code:void 0,x=e=>S(e)==="NOT_FOUND",l=()=>["product","collection","products","recommendations"].map(e=>i(e)).join(","),K=(e,o)=>e===o||e.parentElement?.closest(l())===o;function g(e){let o=S(e);return typeof o=="string"&&o?o:"error"}function L(e,o,a){let n=o==="not-found",r=o==="error"||n;e.setAttribute(c("state"),n?"error":o),r?e.setAttribute(c("error"),n?"not-found":g(a)):e.removeAttribute(c("error")),u(e,i("show"),l()).forEach(t=>{let s=d(t,"show");y(s)&&p(t,s===o)}),r&&u(e,i("add-to-cart"),l()).forEach(t=>{t.classList.add("is-disabled"),t.setAttribute("aria-disabled","true"),"disabled"in t&&(t.disabled=!0)})}export{m as a,U as b,h as c,x as d,l as e,K as f,L as g};
@@ -1 +1 @@
1
- import{D as I,E as w,G as T,H as K,b,d as E,e as v,o as q,p as B,t as Q,u as W,x as c}from"./chunk-X2HBGPFB.js";var g=class extends Error{constructor(r,{status:n,errors:o,userErrors:i,code:s}={}){super(r);b(this,"name","TetherError");b(this,"code");b(this,"status");b(this,"errors");b(this,"userErrors");this.code=s??(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=o,this.userErrors=i}};function k(t,e){return typeof e=="function"?e(t):typeof e=="string"?e==="object"?E(t):typeof t===e:At(e)?Array.isArray(t)&&t.every(r=>k(r,e[0])):E(t)&&Object.entries(e).every(([r,n])=>n===void 0||k(t[r],n))}var At=t=>Array.isArray(t),Qe=t=>e=>e===null||k(e,t),We=t=>e=>k(e,t);function xt(t=c){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var Z=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,vt=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function kt(t){return/\bmutation\b/.test(t.replace(Z,""))?"mutation":"query"}function tt(t,{country:e,language:r}){let n=[];if(e&&n.push(`country: ${e}`),r&&n.push(`language: ${r}`),!n.length)return t;let o=`@inContext(${n.join(", ")})`,i=t.replace(Z,p=>" ".repeat(p.length)),s=i.indexOf("{");if(i.slice(0,s).includes("@inContext"))return t;if(i.trimStart().startsWith("{"))return`query ${o} ${t.slice(s)}`;let a=vt.exec(i);if(!a)return t;let l=a[0].length;return`${t.slice(0,l).trimEnd()} ${o} ${t.slice(l).trimStart()}`}function Ke(t,e=c){let r=q(e.country)??void 0,n=B(e.language)??void 0;return tt(t,{country:r,language:n})}var M=300,Rt=500,Ot=3e4,z=430,Nt=1e3,_="quantityAvailable",Y=new Set,Ct=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function Lt(t,e,r,{context:n,operation:o}){let i=typeof e=="string"?e:e(r),s=n?tt(i,t):i;return t.maxAge<=0||o==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*Nt))}`}var It=t=>new Promise(e=>setTimeout(e,t));function U(t,e){if(t===401||t===403){let r=e.token.startsWith("shpat_")?", not an Admin API token (shpat_\u2026)":"";return`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${r}`}return t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}function Pt(t){let e=v(t,"message"),r=v(v(t,"extensions"),"code"),n=typeof e=="string"?e:"";return typeof r=="string"?{message:n,extensions:{code:r}}:{message:n}}function _t(t){if(!E(t))return null;let{data:e,errors:r}=t;return r==null?{data:e}:Array.isArray(r)?{data:e,errors:r.map(Pt)}:null}function P(t,e){return t.ok?new g(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new g(U(t.status,e),{status:t.status})}function J(t,e,r,n){let o=e.map(s=>s.message).filter(Boolean).join(" | "),i=o||"Storefront API error";return t.ok||(i=t.status===401||t.status===403||!o?U(t.status,r):o),new g(i,{status:t.status,errors:e,code:n})}function X(t,e){if(e==="any")return{kind:"retry",backoffMs:M};throw new g(`Network error: ${K(t)}`,{code:"NETWORK"})}function Mt(t,e,r,n,o,i,s){if(r.includes(_)&&n.some(d=>d.message.includes(_)))return{kind:"inventory-refused",error:J(t,n,e)};let a=n.map(d=>d.extensions?.code);if(i!=="none"&&a.includes("THROTTLED"))return{kind:"retry",backoffMs:Rt};let l=a.includes("INTERNAL_SERVER_ERROR");if(i==="any"&&l)return{kind:"retry",backoffMs:M};let p=t.ok&&(l||s==="mutation"&&o==null);throw J(t,n,e,p?"SERVER_ERROR":void 0)}async function Ut(t,e){if(!t)return e(null);let r=new AbortController,n=setTimeout(()=>{r.abort(new DOMException("signal timed out","TimeoutError"))},t);try{return await e(r.signal)}finally{clearTimeout(n)}}async function Ht(t,e,r,n,o,i,s){let a;try{a=await(t.fetch??fetch)(xt(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:JSON.stringify({query:e,variables:r}),signal:s})}catch(f){return X(f,o)}if(a.status===z)throw new g("Shopify security rejection (430)",{status:z});if(o!=="none"&&a.status===429||o==="any"&&a.status>=500)return{kind:"retry",backoffMs:M};let l;try{l=await a.json()}catch(f){if(f instanceof SyntaxError)throw P(a,t);return X(f,o)}let p=_t(l);if(!p)throw P(a,t);let{data:d,errors:h=[]}=p;if(h.length)return Mt(a,t,e,h,d,o,i);if(!a.ok)throw new g(U(a.status,t),{status:a.status});if(!n(d))throw P(a,t);return{kind:"data",data:d}}async function et(t,e,r,n,{context:o=!0,operation:i="query"}={}){if(!t.domain||!t.token)throw new g("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let s=Ct(t),a=i==="mutation"?"not-run":"any",l=0;for(;;){let p={inventory:!Y.has(s)},d=Lt(t,e,p,{context:o,operation:i}),h=l<t.retries?a:"none",f=await Ut(t.requestTimeout,S=>Ht(t,d,r,n,h,i,S));switch(f.kind){case"data":return f.data;case"inventory-refused":if(typeof e=="string"||!p.inventory)throw f.error;I(`the token can't read inventory: ${_} is left out from now on`),Y.add(s);break;case"retry":await It(Math.min(f.backoffMs*2**l,Ot)),l+=1,I("retry",l);break}}}function ze(t,e,r,n){return et(c,t,e,r,n)}var $t=t=>typeof t=="object"&&t!==null;function Dt(t,e,r={},n){return et(t,e,r,$t,{...n,operation:kt(e)})}function Ye(t,e,r){return Dt(c,t,e,r)}function Je(t,e){if(!t)throw new g(`${e}: empty response`);let r=t.userErrors??[];if(r.length)throw new g(r.map(n=>n.message).join(" | "),{userErrors:r});return t}var m=t=>`${c.prefix}-${t}`,Ft=(t,e)=>e===void 0?`[${m(t)}]`:`[${m(t)}="${e}"]`,R=(t,e)=>t.getAttribute(m(e)),Vt=(t,e)=>t.hasAttribute(m(e));function rt(t,e){return t?[...t.querySelectorAll(e)]:[]}var Gt=(t,e,r)=>rt(t,e).filter(n=>n.closest(r)===t),jt=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],nt=new WeakMap;function ot(t,e){let r=new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0});return nt.set(r,t),r}function qt(t,e){return nt.get(t)===e}function H(t,e,r=document){r.dispatchEvent(ot(t,e))}function st(t,{width:e,height:r,crop:n}={}){if(!t)return t;let o;try{o=new URL(t)}catch(i){if(i instanceof TypeError)return t;throw i}return e&&o.searchParams.set("width",String(e)),r&&o.searchParams.set("height",String(r)),n&&o.searchParams.set("crop",n),o.toString()}function $(t,e){return t.getAttribute(e)??t.getAttribute(m(e))??t.getAttribute(`data-${e}`)}function at(t,e){if(!t||!e)return t;let r=$(e,"max-width"),n=$(e,"max-height");return st(t,{width:r,height:n,crop:r||n?$(e,"crop"):null})}var it=t=>t.replace(/\?.*$/,"");function ut(t,e){return!t||!e?!1:it(t)===it(e)}function Bt(t){return/^\s*[a-z][a-z0-9+.-]*:/i.test(t)&&!/^\s*(https?:|data:image\/)/i.test(t)?"none":`url("${t.replace(/["\\\n\r\f]/g,n=>`\\${n.charCodeAt(0).toString(16)} `)}")`}function Qt(t,e,r){if(!e)return;let n=at(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=Bt(n);return}if(ut(t.getAttribute("src"),n)){r!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",r);return}t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",n),r!=null&&t.setAttribute("alt",r),t.getAttribute("loading")||t.setAttribute("loading","lazy")}var D=new WeakMap,Wt=t=>!!D.get(t),F=t=>t.cloneNode(!0);function ct(t){let e=D.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?F(r):null;return D.set(t,n),t.replaceChildren(),n}function Kt(t,e,r){let n=ct(t);if(!n){e.length&&w("repeater without a template child",t);return}t.replaceChildren(),e.forEach((o,i)=>{let s=F(n);r(s,o,i),t.appendChild(s)})}function zt(t,e){let r=()=>{t.remove()};if(!e){r();return}T("repeater onLeave",()=>{e(t,r)},r)}function Yt(t,e,r,n){e.forEach((o,i)=>{if(!r.has(o))return;let s=e[i-1];s?.parentNode===t?s.after(o):t.prepend(o),n&&T("repeater onEnter",()=>{n(o)})})}function Jt(t,e,r,n,{onEnter:o,onLeave:i}={}){let s=ct(t);if(!s){w("repeater without a template child",t);return}let a=`data-${c.prefix}-key`,l=`data-${c.prefix}-leaving`,p=()=>[...t.children].filter(u=>u.hasAttribute(a)&&!u.hasAttribute(l)),d=new Map(p().map(u=>[u.getAttribute(a),u])),h=[],f=new Set;e.forEach((u,x)=>{let L=String(r(u,x)),y=d.get(L);y?d.delete(L):(y=F(s),y.setAttribute(a,L),f.add(y)),n(y,u,x,f.has(y)),h.push(y)});let S=h.filter(u=>!f.has(u)),j=p().filter(u=>S.includes(u));if(!(j.length===S.length&&j.every((u,x)=>u===S[x]))){d.forEach(u=>{u.remove()}),h.forEach(u=>t.appendChild(u));return}Yt(t,h,f,o),d.forEach(u=>{u.setAttribute(l,""),u.removeAttribute(a),u.style.pointerEvents="none",u.inert=!0,zt(u,i)})}var Xt="http://www.w3.org/1999/xhtml",Zt=new Set(["h1","h2","h3","h4","h5","h6","p","span","div","br","hr","blockquote","code","pre","strong","em","b","i","u","s","small","sub","sup","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","a","img","picture","source","video","figure","figcaption","iframe"]),te=new Set(["script","style","template","noscript","textarea","select","title"]),ee=new Set(["style","title","lang","dir","role","align","width","height"]),re=new Map([["a",new Set(["href","target","rel","hreflang"])],["img",new Set(["src","srcset","sizes","alt","loading","decoding"])],["source",new Set(["src","srcset","sizes","type","media"])],["video",new Set(["src","poster","controls","autoplay","muted","loop","playsinline","preload"])],["iframe",new Set(["src","allow","allowfullscreen","frameborder","loading"])],["blockquote",new Set(["cite"])],["ol",new Set(["start","type","reversed"])],["li",new Set(["value"])],["table",new Set(["border","cellpadding","cellspacing","summary"])],["col",new Set(["span"])],["colgroup",new Set(["span"])],["th",new Set(["colspan","rowspan","headers","scope","valign"])],["td",new Set(["colspan","rowspan","headers","valign"])]]),ne=new Set(["href","src","poster","cite"]),oe=/^(javascript|vbscript|data):/i,ie=/^data:image\/(png|gif|jpeg|webp|avif);/i,se=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),ae=["inset","transform","translate","rotate","scale","offset"],ue=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,ce=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,lt=40,le=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:lt}]]),dt=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,de=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,ft=/(?:var|calc|min|max|clamp|env|attr)\(/i,fe=/url\(|expression\(|@import/i,pe=/[\u0000- ]/g,ge="allow-scripts allow-same-origin allow-popups allow-presentation",me=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),he="strict-origin-when-cross-origin",ye=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function Ee(t,e){return ee.has(e)||e.startsWith("aria-")||(re.get(t)?.has(e)??!1)}function Te(t,e,r){let n=r.replace(pe,"");return oe.test(n)?t==="img"&&e==="src"&&ie.test(n):!0}function pt(t,e){try{return new URL(t,e)}catch{return null}}function be(t,e,r){let n=t.baseURI,o=pt(n)?.origin??"null";return{origin:o==="null"?null:o,baseUrl:n,styleParser:e,embedOrigins:new Set([...ye,...r])}}function we(t,e){let r=pt(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function Se(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>me.has(r)))].join("; ")}function Ae(t,e){if(se.has(t)||ae.some(n=>t.startsWith(n))||ue.test(e))return!0;let r=le.get(t);return r?ft.test(e)||xe(e,r):t.startsWith("margin")&&e.includes("-")}function xe(t,e){return[...t.matchAll(dt)].some(([r="",n=""])=>{let o=parseFloat(r);if(o>=0)return!1;let i=e[n.toLowerCase()];return i===void 0||-o>i})}function ve(t,e){return ce.test(t.replace(/^-webkit-/,""))?ft.test(e)?!0:[...e.replace(de,"").matchAll(dt)].some(([r="",n=""])=>{let o=Math.abs(parseFloat(r));return o!==0&&(n.toLowerCase()!=="px"||o>lt)}):!1}function ke(t,e){let r=e.style;r.cssText=t;let n=Array.from({length:r.length},(i,s)=>r.item(s));for(let i of n){let s=r.getPropertyValue(i);(Ae(i,s)||ve(i,s)||fe.test(s))&&r.removeProperty(i)}let o=r.cssText;return e.removeAttribute("style"),o}function Re(t,e){let r=t.localName;for(let i of[...t.attributes]){let s=i.name.toLowerCase(),a=ne.has(s);Ee(r,s)&&(!a||Te(r,s,i.value))||t.removeAttribute(i.name)}let n=t.getAttribute("style");if(n===null)return;let o=ke(n,e.styleParser);o===""?t.removeAttribute("style"):t.setAttribute("style",o)}var Oe=new Set(["","_self","_parent","_top"]);function Ne(t){if(t.localName==="iframe"){let n=Se(t.getAttribute("allow")??"");n===""?t.removeAttribute("allow"):t.setAttribute("allow",n),t.setAttribute("sandbox",ge),t.setAttribute("referrerpolicy",he);return}if(t.localName!=="a")return;let e=t.getAttribute("target");if(e===null||Oe.has(e.toLowerCase()))return;let r=new Set((t.getAttribute("rel")??"").split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),t.setAttribute("rel",[...r].join(" "))}function Ce(t,e){let r=t.localName,n=t.namespaceURI===Xt;if(n&&te.has(r)){t.remove();return}if(!n||!Zt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!we(t.getAttribute("src")??"",e)){t.remove();return}Re(t,e),Ne(t)}function gt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let o=be(e,n,r);for(let i of[...n.content.querySelectorAll("*")])Ce(i,o);return n.content}var mt="data-tether-seen",G="data-tether-shown",N="data-tether-prev-display",Le=120;function fr(t,e){return W(c.productPath||"/product",t,e)}function bt(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function pr(t,e=c.locale){return t?bt(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function gr(t){if(!t)return"";let{formatMoney:e,locale:r}=c,n=()=>Q(t,r);return e?T("formatMoney",()=>e(t,r),n):n()}function mr(t){return t?bt(()=>new Date(t).toLocaleDateString(c.locale||void 0),""):""}function hr(t,e){t.replaceChildren(gt(e,t.ownerDocument,c.embedOrigins))}var wt=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",A=t=>t.tagName==="INPUT";function Ie(t,e){let r=e==null?"":String(e);wt(t)?t.value=r:t.textContent=r}var ht=t=>wt(t)?t.value:t.textContent;function yr(t,e){let r=ht(t);Ie(t,e),r!==ht(t)&&t.hasAttribute(mt)&&T("onValueChange",()=>c.onValueChange?.(t,r)),t.setAttribute(mt,"1")}function Pe(t){if(t.hasAttribute(G))return;t.setAttribute(G,""),t.removeAttribute("hidden");let e=t.getAttribute(N);e!==null?(t.style.display=e,t.removeAttribute(N)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(m("display"))||"block")}function Er(t,e){if(e){Pe(t);return}t.removeAttribute(G),!t.hasAttribute(N)&&t.style.display!=="none"&&t.setAttribute(N,t.style.display),t.style.display="none"}var C='input[type="radio"],input[type="checkbox"]',_e=["radio","checkbox","switch","menuitemradio","menuitemcheckbox"],Me=["button","submit","reset"];function St(t){let e=t.getAttribute("role");return e==="button"?"aria-pressed":e&&_e.includes(e)?"aria-checked":e==="option"||e==="tab"?"aria-selected":e?null:A(t)?Me.includes(t.type)?"aria-pressed":null:t.querySelector(C)?null:"aria-pressed"}function Tr(t,e){t.classList.toggle("is-selected",e);let r=St(t);r==="aria-pressed"&&t.tagName!=="BUTTON"&&!A(t)&&(t.setAttribute("role","button"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")),r&&t.setAttribute(r,String(e)),A(t)&&t.matches(C)&&(t.checked=e);let n=t.querySelector(C);n&&A(n)&&(n.checked=e)}var O="tether-unavailable";function Ue(t,e){if(e&&!document.getElementById(O)){let n=document.createElement("span");n.id=O,n.hidden=!0,n.textContent="Unavailable",document.body.append(n)}let r=(t.getAttribute("aria-describedby")??"").split(" ").filter(n=>n&&n!==O);e&&r.push(O),r.length?t.setAttribute("aria-describedby",r.join(" ")):t.removeAttribute("aria-describedby")}function br(t,e,r){t.classList.toggle("is-unavailable",e);let o=St(t)!==null||A(t)?t:t.querySelector(C);o&&(r==="picks-closest"?Ue(o,e):o.setAttribute("aria-disabled",String(e)))}var yt,He=t=>Reflect.get(window,t);function $e(){let t=He("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function De(t){clearTimeout(yt),yt=setTimeout(()=>{T("layout-changed",()=>{c.onLayoutChange?c.onLayoutChange(t):$e()}),H("layout-changed",{reason:t})},Le)}function wr(t,e){let r=[...t.querySelectorAll("img")].filter(i=>!i.complete),n=r.length,o=()=>{n-=1,n===0&&De(`${e}:images`)};r.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function Sr(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve(void 0):(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>{t.removeAttribute("aria-busy")}))}function Ar(t,e){let r=t?R(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return w(`invalid JSON in ${m(e)}`,t),null}}var Fe=/^-?\d+$/,Et=new WeakMap;function Tt(t,e,r){let n=Et.get(t)??new Set;Et.set(t,n),!n.has(e)&&(n.add(e),w(`${m(e)} ${r}`,t))}function xr(t,e,{min:r,max:n,fallback:o}){let i=R(t,e)?.trim();if(!i)return o;let s=Fe.test(i)?Number(i):Number.NaN;return Number.isNaN(s)||s<r?(Tt(t,e,`${JSON.stringify(i)} is not a whole number from ${String(r)}: using ${String(o)}`),o):n===void 0||s<=n?s:(Tt(t,e,`${i} is more than its maximum: using ${String(n)}`),n)}function V(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function vr(t){return Array.isArray(t)?t.filter(E).map(r=>({key:V(r.key),value:V(r.value)})):E(t)?Object.entries(t).map(([e,r])=>({key:e,value:V(r)})):[]}function kr(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,r])=>({key:e,value:String(r??"")})):[]}export{g as a,k as b,Qe as c,We as d,xt as e,Ke as f,Ut as g,et as h,ze as i,Dt as j,Ye as k,Je as l,m,Ft as n,R as o,Vt as p,rt as q,Gt as r,jt as s,qt as t,H as u,st as v,ut as w,Qt as x,Wt as y,Kt as z,Jt as A,fr as B,pr as C,gr as D,mr as E,hr as F,Ie as G,yr as H,Er as I,Tr as J,br as K,He as L,De as M,wr as N,Sr as O,Ar as P,Fe as Q,xr as R,vr as S,kr as T};
1
+ import{D as I,E as w,G as T,H as K,b,d as E,e as v,o as q,p as B,t as Q,u as W,x as c}from"./chunk-QUBBZNJ7.js";var g=class extends Error{constructor(r,{status:n,errors:o,userErrors:i,code:s}={}){super(r);b(this,"name","TetherError");b(this,"code");b(this,"status");b(this,"errors");b(this,"userErrors");this.code=s??(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=o,this.userErrors=i}};function k(t,e){return typeof e=="function"?e(t):typeof e=="string"?e==="object"?E(t):typeof t===e:At(e)?Array.isArray(t)&&t.every(r=>k(r,e[0])):E(t)&&Object.entries(e).every(([r,n])=>n===void 0||k(t[r],n))}var At=t=>Array.isArray(t),Qe=t=>e=>e===null||k(e,t),We=t=>e=>k(e,t);function xt(t=c){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var Z=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,vt=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function kt(t){return/\bmutation\b/.test(t.replace(Z,""))?"mutation":"query"}function tt(t,{country:e,language:r}){let n=[];if(e&&n.push(`country: ${e}`),r&&n.push(`language: ${r}`),!n.length)return t;let o=`@inContext(${n.join(", ")})`,i=t.replace(Z,p=>" ".repeat(p.length)),s=i.indexOf("{");if(i.slice(0,s).includes("@inContext"))return t;if(i.trimStart().startsWith("{"))return`query ${o} ${t.slice(s)}`;let a=vt.exec(i);if(!a)return t;let l=a[0].length;return`${t.slice(0,l).trimEnd()} ${o} ${t.slice(l).trimStart()}`}function Ke(t,e=c){let r=q(e.country)??void 0,n=B(e.language)??void 0;return tt(t,{country:r,language:n})}var M=300,Rt=500,Ot=3e4,z=430,Nt=1e3,_="quantityAvailable",Y=new Set,Ct=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function Lt(t,e,r,{context:n,operation:o}){let i=typeof e=="string"?e:e(r),s=n?tt(i,t):i;return t.maxAge<=0||o==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*Nt))}`}var It=t=>new Promise(e=>setTimeout(e,t));function U(t,e){if(t===401||t===403){let r=e.token.startsWith("shpat_")?", not an Admin API token (shpat_\u2026)":"";return`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${r}`}return t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}function Pt(t){let e=v(t,"message"),r=v(v(t,"extensions"),"code"),n=typeof e=="string"?e:"";return typeof r=="string"?{message:n,extensions:{code:r}}:{message:n}}function _t(t){if(!E(t))return null;let{data:e,errors:r}=t;return r==null?{data:e}:Array.isArray(r)?{data:e,errors:r.map(Pt)}:null}function P(t,e){return t.ok?new g(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new g(U(t.status,e),{status:t.status})}function J(t,e,r,n){let o=e.map(s=>s.message).filter(Boolean).join(" | "),i=o||"Storefront API error";return t.ok||(i=t.status===401||t.status===403||!o?U(t.status,r):o),new g(i,{status:t.status,errors:e,code:n})}function X(t,e){if(e==="any")return{kind:"retry",backoffMs:M};throw new g(`Network error: ${K(t)}`,{code:"NETWORK"})}function Mt(t,e,r,n,o,i,s){if(r.includes(_)&&n.some(d=>d.message.includes(_)))return{kind:"inventory-refused",error:J(t,n,e)};let a=n.map(d=>d.extensions?.code);if(i!=="none"&&a.includes("THROTTLED"))return{kind:"retry",backoffMs:Rt};let l=a.includes("INTERNAL_SERVER_ERROR");if(i==="any"&&l)return{kind:"retry",backoffMs:M};let p=t.ok&&(l||s==="mutation"&&o==null);throw J(t,n,e,p?"SERVER_ERROR":void 0)}async function Ut(t,e){if(!t)return e(null);let r=new AbortController,n=setTimeout(()=>{r.abort(new DOMException("signal timed out","TimeoutError"))},t);try{return await e(r.signal)}finally{clearTimeout(n)}}async function Ht(t,e,r,n,o,i,s){let a;try{a=await(t.fetch??fetch)(xt(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:JSON.stringify({query:e,variables:r}),signal:s})}catch(f){return X(f,o)}if(a.status===z)throw new g("Shopify security rejection (430)",{status:z});if(o!=="none"&&a.status===429||o==="any"&&a.status>=500)return{kind:"retry",backoffMs:M};let l;try{l=await a.json()}catch(f){if(f instanceof SyntaxError)throw P(a,t);return X(f,o)}let p=_t(l);if(!p)throw P(a,t);let{data:d,errors:h=[]}=p;if(h.length)return Mt(a,t,e,h,d,o,i);if(!a.ok)throw new g(U(a.status,t),{status:a.status});if(!n(d))throw P(a,t);return{kind:"data",data:d}}async function et(t,e,r,n,{context:o=!0,operation:i="query"}={}){if(!t.domain||!t.token)throw new g("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let s=Ct(t),a=i==="mutation"?"not-run":"any",l=0;for(;;){let p={inventory:!Y.has(s)},d=Lt(t,e,p,{context:o,operation:i}),h=l<t.retries?a:"none",f=await Ut(t.requestTimeout,S=>Ht(t,d,r,n,h,i,S));switch(f.kind){case"data":return f.data;case"inventory-refused":if(typeof e=="string"||!p.inventory)throw f.error;I(`the token can't read inventory: ${_} is left out from now on`),Y.add(s);break;case"retry":await It(Math.min(f.backoffMs*2**l,Ot)),l+=1,I("retry",l);break}}}function ze(t,e,r,n){return et(c,t,e,r,n)}var $t=t=>typeof t=="object"&&t!==null;function Dt(t,e,r={},n){return et(t,e,r,$t,{...n,operation:kt(e)})}function Ye(t,e,r){return Dt(c,t,e,r)}function Je(t,e){if(!t)throw new g(`${e}: empty response`);let r=t.userErrors??[];if(r.length)throw new g(r.map(n=>n.message).join(" | "),{userErrors:r});return t}var m=t=>`${c.prefix}-${t}`,Ft=(t,e)=>e===void 0?`[${m(t)}]`:`[${m(t)}="${e}"]`,R=(t,e)=>t.getAttribute(m(e)),Vt=(t,e)=>t.hasAttribute(m(e));function rt(t,e){return t?[...t.querySelectorAll(e)]:[]}var Gt=(t,e,r)=>rt(t,e).filter(n=>n.closest(r)===t),jt=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],nt=new WeakMap;function ot(t,e){let r=new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0});return nt.set(r,t),r}function qt(t,e){return nt.get(t)===e}function H(t,e,r=document){r.dispatchEvent(ot(t,e))}function st(t,{width:e,height:r,crop:n}={}){if(!t)return t;let o;try{o=new URL(t)}catch(i){if(i instanceof TypeError)return t;throw i}return e&&o.searchParams.set("width",String(e)),r&&o.searchParams.set("height",String(r)),n&&o.searchParams.set("crop",n),o.toString()}function $(t,e){return t.getAttribute(e)??t.getAttribute(m(e))??t.getAttribute(`data-${e}`)}function at(t,e){if(!t||!e)return t;let r=$(e,"max-width"),n=$(e,"max-height");return st(t,{width:r,height:n,crop:r||n?$(e,"crop"):null})}var it=t=>t.replace(/\?.*$/,"");function ut(t,e){return!t||!e?!1:it(t)===it(e)}function Bt(t){return/^\s*[a-z][a-z0-9+.-]*:/i.test(t)&&!/^\s*(https?:|data:image\/)/i.test(t)?"none":`url("${t.replace(/["\\\n\r\f]/g,n=>`\\${n.charCodeAt(0).toString(16)} `)}")`}function Qt(t,e,r){if(!e)return;let n=at(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=Bt(n);return}if(ut(t.getAttribute("src"),n)){r!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",r);return}t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",n),r!=null&&t.setAttribute("alt",r),t.getAttribute("loading")||t.setAttribute("loading","lazy")}var D=new WeakMap,Wt=t=>!!D.get(t),F=t=>t.cloneNode(!0);function ct(t){let e=D.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?F(r):null;return D.set(t,n),t.replaceChildren(),n}function Kt(t,e,r){let n=ct(t);if(!n){e.length&&w("repeater without a template child",t);return}t.replaceChildren(),e.forEach((o,i)=>{let s=F(n);r(s,o,i),t.appendChild(s)})}function zt(t,e){let r=()=>{t.remove()};if(!e){r();return}T("repeater onLeave",()=>{e(t,r)},r)}function Yt(t,e,r,n){e.forEach((o,i)=>{if(!r.has(o))return;let s=e[i-1];s?.parentNode===t?s.after(o):t.prepend(o),n&&T("repeater onEnter",()=>{n(o)})})}function Jt(t,e,r,n,{onEnter:o,onLeave:i}={}){let s=ct(t);if(!s){w("repeater without a template child",t);return}let a=`data-${c.prefix}-key`,l=`data-${c.prefix}-leaving`,p=()=>[...t.children].filter(u=>u.hasAttribute(a)&&!u.hasAttribute(l)),d=new Map(p().map(u=>[u.getAttribute(a),u])),h=[],f=new Set;e.forEach((u,x)=>{let L=String(r(u,x)),y=d.get(L);y?d.delete(L):(y=F(s),y.setAttribute(a,L),f.add(y)),n(y,u,x,f.has(y)),h.push(y)});let S=h.filter(u=>!f.has(u)),j=p().filter(u=>S.includes(u));if(!(j.length===S.length&&j.every((u,x)=>u===S[x]))){d.forEach(u=>{u.remove()}),h.forEach(u=>t.appendChild(u));return}Yt(t,h,f,o),d.forEach(u=>{u.setAttribute(l,""),u.removeAttribute(a),u.style.pointerEvents="none",u.inert=!0,zt(u,i)})}var Xt="http://www.w3.org/1999/xhtml",Zt=new Set(["h1","h2","h3","h4","h5","h6","p","span","div","br","hr","blockquote","code","pre","strong","em","b","i","u","s","small","sub","sup","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","a","img","picture","source","video","figure","figcaption","iframe"]),te=new Set(["script","style","template","noscript","textarea","select","title"]),ee=new Set(["style","title","lang","dir","role","align","width","height"]),re=new Map([["a",new Set(["href","target","rel","hreflang"])],["img",new Set(["src","srcset","sizes","alt","loading","decoding"])],["source",new Set(["src","srcset","sizes","type","media"])],["video",new Set(["src","poster","controls","autoplay","muted","loop","playsinline","preload"])],["iframe",new Set(["src","allow","allowfullscreen","frameborder","loading"])],["blockquote",new Set(["cite"])],["ol",new Set(["start","type","reversed"])],["li",new Set(["value"])],["table",new Set(["border","cellpadding","cellspacing","summary"])],["col",new Set(["span"])],["colgroup",new Set(["span"])],["th",new Set(["colspan","rowspan","headers","scope","valign"])],["td",new Set(["colspan","rowspan","headers","valign"])]]),ne=new Set(["href","src","poster","cite"]),oe=/^(javascript|vbscript|data):/i,ie=/^data:image\/(png|gif|jpeg|webp|avif);/i,se=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),ae=["inset","transform","translate","rotate","scale","offset"],ue=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,ce=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,lt=40,le=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:lt}]]),dt=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,de=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,ft=/(?:var|calc|min|max|clamp|env|attr)\(/i,fe=/url\(|expression\(|@import/i,pe=/[\u0000- ]/g,ge="allow-scripts allow-same-origin allow-popups allow-presentation",me=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),he="strict-origin-when-cross-origin",ye=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function Ee(t,e){return ee.has(e)||e.startsWith("aria-")||(re.get(t)?.has(e)??!1)}function Te(t,e,r){let n=r.replace(pe,"");return oe.test(n)?t==="img"&&e==="src"&&ie.test(n):!0}function pt(t,e){try{return new URL(t,e)}catch{return null}}function be(t,e,r){let n=t.baseURI,o=pt(n)?.origin??"null";return{origin:o==="null"?null:o,baseUrl:n,styleParser:e,embedOrigins:new Set([...ye,...r])}}function we(t,e){let r=pt(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function Se(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>me.has(r)))].join("; ")}function Ae(t,e){if(se.has(t)||ae.some(n=>t.startsWith(n))||ue.test(e))return!0;let r=le.get(t);return r?ft.test(e)||xe(e,r):t.startsWith("margin")&&e.includes("-")}function xe(t,e){return[...t.matchAll(dt)].some(([r="",n=""])=>{let o=parseFloat(r);if(o>=0)return!1;let i=e[n.toLowerCase()];return i===void 0||-o>i})}function ve(t,e){return ce.test(t.replace(/^-webkit-/,""))?ft.test(e)?!0:[...e.replace(de,"").matchAll(dt)].some(([r="",n=""])=>{let o=Math.abs(parseFloat(r));return o!==0&&(n.toLowerCase()!=="px"||o>lt)}):!1}function ke(t,e){let r=e.style;r.cssText=t;let n=Array.from({length:r.length},(i,s)=>r.item(s));for(let i of n){let s=r.getPropertyValue(i);(Ae(i,s)||ve(i,s)||fe.test(s))&&r.removeProperty(i)}let o=r.cssText;return e.removeAttribute("style"),o}function Re(t,e){let r=t.localName;for(let i of[...t.attributes]){let s=i.name.toLowerCase(),a=ne.has(s);Ee(r,s)&&(!a||Te(r,s,i.value))||t.removeAttribute(i.name)}let n=t.getAttribute("style");if(n===null)return;let o=ke(n,e.styleParser);o===""?t.removeAttribute("style"):t.setAttribute("style",o)}var Oe=new Set(["","_self","_parent","_top"]);function Ne(t){if(t.localName==="iframe"){let n=Se(t.getAttribute("allow")??"");n===""?t.removeAttribute("allow"):t.setAttribute("allow",n),t.setAttribute("sandbox",ge),t.setAttribute("referrerpolicy",he);return}if(t.localName!=="a")return;let e=t.getAttribute("target");if(e===null||Oe.has(e.toLowerCase()))return;let r=new Set((t.getAttribute("rel")??"").split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),t.setAttribute("rel",[...r].join(" "))}function Ce(t,e){let r=t.localName,n=t.namespaceURI===Xt;if(n&&te.has(r)){t.remove();return}if(!n||!Zt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!we(t.getAttribute("src")??"",e)){t.remove();return}Re(t,e),Ne(t)}function gt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let o=be(e,n,r);for(let i of[...n.content.querySelectorAll("*")])Ce(i,o);return n.content}var mt="data-tether-seen",G="data-tether-shown",N="data-tether-prev-display",Le=120;function fr(t,e){return W(c.productPath||"/product",t,e)}function bt(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function pr(t,e=c.locale){return t?bt(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function gr(t){if(!t)return"";let{formatMoney:e,locale:r}=c,n=()=>Q(t,r);return e?T("formatMoney",()=>e(t,r),n):n()}function mr(t){return t?bt(()=>new Date(t).toLocaleDateString(c.locale||void 0),""):""}function hr(t,e){t.replaceChildren(gt(e,t.ownerDocument,c.embedOrigins))}var wt=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",A=t=>t.tagName==="INPUT";function Ie(t,e){let r=e==null?"":String(e);wt(t)?t.value=r:t.textContent=r}var ht=t=>wt(t)?t.value:t.textContent;function yr(t,e){let r=ht(t);Ie(t,e),r!==ht(t)&&t.hasAttribute(mt)&&T("onValueChange",()=>c.onValueChange?.(t,r)),t.setAttribute(mt,"1")}function Pe(t){if(t.hasAttribute(G))return;t.setAttribute(G,""),t.removeAttribute("hidden");let e=t.getAttribute(N);e!==null?(t.style.display=e,t.removeAttribute(N)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(m("display"))||"block")}function Er(t,e){if(e){Pe(t);return}t.removeAttribute(G),!t.hasAttribute(N)&&t.style.display!=="none"&&t.setAttribute(N,t.style.display),t.style.display="none"}var C='input[type="radio"],input[type="checkbox"]',_e=["radio","checkbox","switch","menuitemradio","menuitemcheckbox"],Me=["button","submit","reset"];function St(t){let e=t.getAttribute("role");return e==="button"?"aria-pressed":e&&_e.includes(e)?"aria-checked":e==="option"||e==="tab"?"aria-selected":e?null:A(t)?Me.includes(t.type)?"aria-pressed":null:t.querySelector(C)?null:"aria-pressed"}function Tr(t,e){t.classList.toggle("is-selected",e);let r=St(t);r==="aria-pressed"&&t.tagName!=="BUTTON"&&!A(t)&&(t.setAttribute("role","button"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")),r&&t.setAttribute(r,String(e)),A(t)&&t.matches(C)&&(t.checked=e);let n=t.querySelector(C);n&&A(n)&&(n.checked=e)}var O="tether-unavailable";function Ue(t,e){if(e&&!document.getElementById(O)){let n=document.createElement("span");n.id=O,n.hidden=!0,n.textContent="Unavailable",document.body.append(n)}let r=(t.getAttribute("aria-describedby")??"").split(" ").filter(n=>n&&n!==O);e&&r.push(O),r.length?t.setAttribute("aria-describedby",r.join(" ")):t.removeAttribute("aria-describedby")}function br(t,e,r){t.classList.toggle("is-unavailable",e);let o=St(t)!==null||A(t)?t:t.querySelector(C);o&&(r==="picks-closest"?Ue(o,e):o.setAttribute("aria-disabled",String(e)))}var yt,He=t=>Reflect.get(window,t);function $e(){let t=He("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function De(t){clearTimeout(yt),yt=setTimeout(()=>{T("layout-changed",()=>{c.onLayoutChange?c.onLayoutChange(t):$e()}),H("layout-changed",{reason:t})},Le)}function wr(t,e){let r=[...t.querySelectorAll("img")].filter(i=>!i.complete),n=r.length,o=()=>{n-=1,n===0&&De(`${e}:images`)};r.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function Sr(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve(void 0):(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>{t.removeAttribute("aria-busy")}))}function Ar(t,e){let r=t?R(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return w(`invalid JSON in ${m(e)}`,t),null}}var Fe=/^-?\d+$/,Et=new WeakMap;function Tt(t,e,r){let n=Et.get(t)??new Set;Et.set(t,n),!n.has(e)&&(n.add(e),w(`${m(e)} ${r}`,t))}function xr(t,e,{min:r,max:n,fallback:o}){let i=R(t,e)?.trim();if(!i)return o;let s=Fe.test(i)?Number(i):Number.NaN;return Number.isNaN(s)||s<r?(Tt(t,e,`${JSON.stringify(i)} is not a whole number from ${String(r)}: using ${String(o)}`),o):n===void 0||s<=n?s:(Tt(t,e,`${i} is more than its maximum: using ${String(n)}`),n)}function V(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function vr(t){return Array.isArray(t)?t.filter(E).map(r=>({key:V(r.key),value:V(r.value)})):E(t)?Object.entries(t).map(([e,r])=>({key:e,value:V(r)})):[]}function kr(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,r])=>({key:e,value:String(r??"")})):[]}export{g as a,k as b,Qe as c,We as d,xt as e,Ke as f,Ut as g,et as h,ze as i,Dt as j,Ye as k,Je as l,m,Ft as n,R as o,Vt as p,rt as q,Gt as r,jt as s,qt as t,H as u,st as v,ut as w,Qt as x,Wt as y,Kt as z,Jt as A,fr as B,pr as C,gr as D,mr as E,hr as F,Ie as G,yr as H,Er as I,Tr as J,br as K,He as L,De as M,wr as N,Sr as O,Ar as P,Fe as Q,xr as R,vr as S,kr as T};
@@ -1 +1 @@
1
- import{a as x}from"./chunk-X2HBGPFB.js";var W={};x(W,{GID:()=>y,allPlans:()=>s,allocationFor:()=>a,findPlan:()=>w,hasPlans:()=>S,planAdjustment:()=>G,planCheckoutCharge:()=>b,planPrice:()=>h,planSavings:()=>j,plansForVariant:()=>F,toGid:()=>u});var A=/^(-?)(\d+)(?:\.(\d+))?$/;function d(n,e){let t=A.exec(n.trim());if(!t)return null;let[,l="",r="0",i=""]=t,o=BigInt(`${r}${i.padEnd(e,"0")}`);return l==="-"?-o:o}var p=n=>n.split(".")[1]?.length??0;function I(n,e){if(n==null||e==null)return!1;let t=Math.max(p(n.trim()),p(e.trim())),l=d(n,t),r=d(e,t);return l===null||r===null?!1:l>r}var f=2,g=new Map;function m(n){let e=g.get(n);if(e!==void 0)return e;let t=f;try{t=new Intl.NumberFormat("en",{style:"currency",currency:n}).resolvedOptions().maximumFractionDigits??f}catch{}return g.set(n,t),t}function c(n){return Math.round(parseFloat(n.amount)*10**m(n.currencyCode))}function P(n,e){let t=m(e);return{amount:(n/10**t).toFixed(t),currencyCode:e}}var M=100;function u(n,e){let t=typeof n=="string"||typeof n=="number"?String(n).trim():"";return t?t.startsWith("gid://")?t:/^\d+$/.test(t)?`gid://shopify/${e}/${t}`:t:null}var y={product:n=>u(n,"Product"),variant:n=>u(n,"ProductVariant"),sellingPlan:n=>u(n,"SellingPlan")};function s(n){return(n?.sellingPlanGroups?.nodes??[]).flatMap(t=>t.sellingPlans.nodes.map(l=>({...l,group:t})))}function S(n){return s(n).length>0}function a(n,e){return!n||!e?null:(n.sellingPlanAllocations?.nodes??[]).find(l=>l.sellingPlan.id===e)??null}function F(n,e){return s(n).filter(t=>a(e,t.id))}function h(n,e){let t=a(n,e)?.priceAdjustments[0];return t?.perDeliveryPrice??t?.price??n?.price??null}function b(n,e){let t=a(n,e);return t?.checkoutChargeAmount??t?.priceAdjustments[0]?.price??n?.price??null}function j(n,e){let t=h(n,e);if(!n||!t)return{amount:null,percentage:0};let l=parseFloat(n.price.amount),r=parseFloat(t.amount);if(!Number.isFinite(l)||!Number.isFinite(r)||l<=0||r>=l)return{amount:null,percentage:0};let i=c(n.price)-c(t);return{amount:P(i,n.price.currencyCode),percentage:Math.round((1-r/l)*M)}}function G(n){let e=n?.priceAdjustments[0]?.adjustmentValue;if(!e)return null;switch(e.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:e.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:e.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:e.price};default:return null}}function w(n,e){if(!e)return null;let t=s(n),l=y.sellingPlan(e),r=e.trim().toLowerCase();return t.find(i=>i.id===l)??t.find(i=>i.name.toLowerCase()===r)??t.find(i=>i.options.some(o=>o.value.toLowerCase()===r))??null}export{I as a,c as b,P as c,y as d,s as e,a as f,h as g,b as h,j as i,G as j,w as k,W as l};
1
+ import{a as x}from"./chunk-QUBBZNJ7.js";var W={};x(W,{GID:()=>y,allPlans:()=>s,allocationFor:()=>a,findPlan:()=>w,hasPlans:()=>S,planAdjustment:()=>G,planCheckoutCharge:()=>b,planPrice:()=>h,planSavings:()=>j,plansForVariant:()=>F,toGid:()=>u});var A=/^(-?)(\d+)(?:\.(\d+))?$/;function d(n,e){let t=A.exec(n.trim());if(!t)return null;let[,l="",r="0",i=""]=t,o=BigInt(`${r}${i.padEnd(e,"0")}`);return l==="-"?-o:o}var p=n=>n.split(".")[1]?.length??0;function I(n,e){if(n==null||e==null)return!1;let t=Math.max(p(n.trim()),p(e.trim())),l=d(n,t),r=d(e,t);return l===null||r===null?!1:l>r}var f=2,g=new Map;function m(n){let e=g.get(n);if(e!==void 0)return e;let t=f;try{t=new Intl.NumberFormat("en",{style:"currency",currency:n}).resolvedOptions().maximumFractionDigits??f}catch{}return g.set(n,t),t}function c(n){return Math.round(parseFloat(n.amount)*10**m(n.currencyCode))}function P(n,e){let t=m(e);return{amount:(n/10**t).toFixed(t),currencyCode:e}}var M=100;function u(n,e){let t=typeof n=="string"||typeof n=="number"?String(n).trim():"";return t?t.startsWith("gid://")?t:/^\d+$/.test(t)?`gid://shopify/${e}/${t}`:t:null}var y={product:n=>u(n,"Product"),variant:n=>u(n,"ProductVariant"),sellingPlan:n=>u(n,"SellingPlan")};function s(n){return(n?.sellingPlanGroups?.nodes??[]).flatMap(t=>t.sellingPlans.nodes.map(l=>({...l,group:t})))}function S(n){return s(n).length>0}function a(n,e){return!n||!e?null:(n.sellingPlanAllocations?.nodes??[]).find(l=>l.sellingPlan.id===e)??null}function F(n,e){return s(n).filter(t=>a(e,t.id))}function h(n,e){let t=a(n,e)?.priceAdjustments[0];return t?.perDeliveryPrice??t?.price??n?.price??null}function b(n,e){let t=a(n,e);return t?.checkoutChargeAmount??t?.priceAdjustments[0]?.price??n?.price??null}function j(n,e){let t=h(n,e);if(!n||!t)return{amount:null,percentage:0};let l=parseFloat(n.price.amount),r=parseFloat(t.amount);if(!Number.isFinite(l)||!Number.isFinite(r)||l<=0||r>=l)return{amount:null,percentage:0};let i=c(n.price)-c(t);return{amount:P(i,n.price.currencyCode),percentage:Math.round((1-r/l)*M)}}function G(n){let e=n?.priceAdjustments[0]?.adjustmentValue;if(!e)return null;switch(e.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:e.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:e.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:e.price};default:return null}}function w(n,e){if(!e)return null;let t=s(n),l=y.sellingPlan(e),r=e.trim().toLowerCase();return t.find(i=>i.id===l)??t.find(i=>i.name.toLowerCase()===r)??t.find(i=>i.options.some(o=>o.value.toLowerCase()===r))??null}export{I as a,c as b,P as c,y as d,s as e,a as f,h as g,b as h,j as i,G as j,w as k,W as l};
@@ -1 +1 @@
1
- import{a as A}from"./chunk-FYGRVUVB.js";import{a as l,b as K,c as $}from"./chunk-JJRRVUDP.js";import{b as w,d as b,g as p}from"./chunk-47OLTPHV.js";import{c as C,f as M,g as H,h as R}from"./chunk-HRRJ7KUG.js";import{f as T}from"./chunk-IG23NTJK.js";import{m as s,o as L,q as x,u as m}from"./chunk-BRI56DD5.js";import{D as h,E as P,F as f,d as S,o as k,p as v,x as a}from"./chunk-X2HBGPFB.js";var W='script[type="application/json"][data-tether-hydrate]',g=new WeakSet,ut=new WeakSet,c=new Set,N=new Set,F=new WeakMap;function q(){c.forEach(t=>{t.isConnected||c.delete(t)}),N.forEach(t=>{t.root.isConnected||N.delete(t)})}function J(t,e){return[...t.matches?.(e)?[t]:[],...x(t,e)]}function z(t,e){let n=L(t,"page-title");if(!n||typeof document>"u")return;let r=new Map([["title",e.title],["vendor",e.vendor||""],["type",e.productType||""]]);document.title=n.replace(/\{(\w+)\}/g,(o,u)=>r.get(u)??o)}function D(t,{fromUrl:e,raw:n}){e?(g.add(t),p(t,"not-found"),m("product-not-found",{key:null,source:n},t)):t.closest(A())||P(`[${s("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t)}function B(t,e,{fromUrl:n,raw:r},o){let u=b(o);if(p(t,u?"not-found":"error",o),!u){f(o,`product ${e}`),m("error",{error:o,context:"product",key:e},t);return}m("product-not-found",{key:e,source:r},t),n?h(`product not found: ${e}`):f(o,`product ${e}`)}function Q(t){if(g.has(t))return!1;let{key:e,...n}=w(t);if(!e)return D(t,n),!1;g.add(t),c.add(t);let r={};F.set(t,r);let o=()=>F.get(t)===r;return l.get(t)?t.setAttribute(s("state"),"updating"):p(t,"loading"),j(C(e)).then(d=>{if(!o())return;let E=l.get(t);E?E.update(d):new $(t,d),z(t,d),a.revalidate&&H(e)&&U(e)}).catch(d=>{o()&&B(t,e,n,d)}),!0}function dt(){q(),c.forEach(t=>{t.getAttribute(s("state"))!=="error"||t.getAttribute(s("error"))==="not-found"||(g.delete(t),Q(t))})}var y=new Set;function U(t){y.size||setTimeout(_,0),y.add(t)}function Y(t,e){c.forEach(n=>{let r=l.get(n);if(!r||!n.isConnected)return;let o=w(n).key;o!==t&&o!==e.handle&&o!==e.id||JSON.stringify(r.product)!==JSON.stringify(e)&&r.update(e)})}function _(){let t=[...y];y=new Set,t.forEach(e=>{R(e).then(n=>{Y(e,n)}).catch(n=>{f(n,`refresh ${e}`)})})}var i=null,j=t=>(i?.add(t),t);function G(){if(!i)return;let t=[...i];Promise.allSettled(t).then(()=>{if(!(!i||t.some(e=>!i?.has(e)))){if(t.length!==i.size){G();return}i=null,document.documentElement.classList.remove(`${a.prefix}-market-pending`)}})}function I(t){if(!S(t))return{country:void 0,language:void 0,products:[]};let{products:e}=t,n=Array.isArray(e)?e:[];return{country:k(t.country)??void 0,language:v(t.language)??void 0,products:n.filter(T)}}var O=new WeakSet;function at(t=document){J(t,W).forEach(e=>{if(O.has(e))return;O.add(e);let n;try{n=JSON.parse(e.textContent)}catch(d){P("bad data-tether-hydrate",d);return}let{country:r,language:o,products:u}=I(n);if(K(u),r===a.country&&o===a.language){M(u);return}h("hydration skipped: other market"),i||(i=new Set,document.documentElement.classList.add(`${a.prefix}-market-pending`))})}export{g as a,ut as b,c,N as d,q as e,J as f,Q as g,dt as h,j as i,G as j,at as k};
1
+ import{a as A}from"./chunk-XQCBGVU2.js";import{a as l,b as K,c as $}from"./chunk-HGNFQHEU.js";import{b as w,d as b,g as p}from"./chunk-ADA2ZGPO.js";import{c as C,f as M,g as H,h as R}from"./chunk-I54NQEVK.js";import{f as T}from"./chunk-R3UWDQL5.js";import{m as s,o as L,q as x,u as m}from"./chunk-B7SC7UOJ.js";import{D as h,E as P,F as f,d as S,o as k,p as v,x as a}from"./chunk-QUBBZNJ7.js";var W='script[type="application/json"][data-tether-hydrate]',g=new WeakSet,ut=new WeakSet,c=new Set,N=new Set,F=new WeakMap;function q(){c.forEach(t=>{t.isConnected||c.delete(t)}),N.forEach(t=>{t.root.isConnected||N.delete(t)})}function J(t,e){return[...t.matches?.(e)?[t]:[],...x(t,e)]}function z(t,e){let n=L(t,"page-title");if(!n||typeof document>"u")return;let r=new Map([["title",e.title],["vendor",e.vendor||""],["type",e.productType||""]]);document.title=n.replace(/\{(\w+)\}/g,(o,u)=>r.get(u)??o)}function D(t,{fromUrl:e,raw:n}){e?(g.add(t),p(t,"not-found"),m("product-not-found",{key:null,source:n},t)):t.closest(A())||P(`[${s("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t)}function B(t,e,{fromUrl:n,raw:r},o){let u=b(o);if(p(t,u?"not-found":"error",o),!u){f(o,`product ${e}`),m("error",{error:o,context:"product",key:e},t);return}m("product-not-found",{key:e,source:r},t),n?h(`product not found: ${e}`):f(o,`product ${e}`)}function Q(t){if(g.has(t))return!1;let{key:e,...n}=w(t);if(!e)return D(t,n),!1;g.add(t),c.add(t);let r={};F.set(t,r);let o=()=>F.get(t)===r;return l.get(t)?t.setAttribute(s("state"),"updating"):p(t,"loading"),j(C(e)).then(d=>{if(!o())return;let E=l.get(t);E?E.update(d):new $(t,d),z(t,d),a.revalidate&&H(e)&&U(e)}).catch(d=>{o()&&B(t,e,n,d)}),!0}function dt(){q(),c.forEach(t=>{t.getAttribute(s("state"))!=="error"||t.getAttribute(s("error"))==="not-found"||(g.delete(t),Q(t))})}var y=new Set;function U(t){y.size||setTimeout(_,0),y.add(t)}function Y(t,e){c.forEach(n=>{let r=l.get(n);if(!r||!n.isConnected)return;let o=w(n).key;o!==t&&o!==e.handle&&o!==e.id||JSON.stringify(r.product)!==JSON.stringify(e)&&r.update(e)})}function _(){let t=[...y];y=new Set,t.forEach(e=>{R(e).then(n=>{Y(e,n)}).catch(n=>{f(n,`refresh ${e}`)})})}var i=null,j=t=>(i?.add(t),t);function G(){if(!i)return;let t=[...i];Promise.allSettled(t).then(()=>{if(!(!i||t.some(e=>!i?.has(e)))){if(t.length!==i.size){G();return}i=null,document.documentElement.classList.remove(`${a.prefix}-market-pending`)}})}function I(t){if(!S(t))return{country:void 0,language:void 0,products:[]};let{products:e}=t,n=Array.isArray(e)?e:[];return{country:k(t.country)??void 0,language:v(t.language)??void 0,products:n.filter(T)}}var O=new WeakSet;function at(t=document){J(t,W).forEach(e=>{if(O.has(e))return;O.add(e);let n;try{n=JSON.parse(e.textContent)}catch(d){P("bad data-tether-hydrate",d);return}let{country:r,language:o,products:u}=I(n);if(K(u),r===a.country&&o===a.language){M(u);return}h("hydration skipped: other market"),i||(i=new Set,document.documentElement.classList.add(`${a.prefix}-market-pending`))})}export{g as a,ut as b,c,N as d,q as e,J as f,Q as g,dt as h,j as i,G as j,at as k};
@@ -1 +1 @@
1
- import{b as Q,c as T,d as j,h as J}from"./chunk-NXDME6AM.js";import{a as S,b as W,c as A,d as w,e as X,f as Y,g as _,h as z,i as Z}from"./chunk-YZC4KFT3.js";import{d as G,e as M,f as y,k as K}from"./chunk-SVJWBCRY.js";import{c as N,f as tt}from"./chunk-47OLTPHV.js";import{C,D as O,G as h,I as F,J as P,K as E,M as V,N as R,O as U,P as D,S as B,m,n as s,o as l,p as x,q as b,r as q,u as f,x as H}from"./chunk-BRI56DD5.js";import{F as L,b as p,x as I}from"./chunk-X2HBGPFB.js";var et={money:O,percent:C},ct=e=>e.tagName==="INPUT";function $(e){let t=b(e,s("add-label"))[0]??e,n=t.dataset.tetherLabel??(ct(t)?t.value:t.textContent);return t.dataset.tetherLabel=n,{label:t,original:n}}function ut(e,t){let{product:n}=e,i=r=>t.selected[e.optName(r)]??"";e.$(s("option-selected")).forEach(r=>{h(r,i(l(r,"option-selected")))}),e.$(s("option-list")).forEach(r=>{let a=e.optName(l(r,"option-list"));b(r,s("option-value")).forEach(o=>{let c=l(o,"option-value")??"";P(o,t.selected[a]===c);let u=!W(n,t.selected,a,c);E(o,u,"picks-closest"),o.setAttribute("data-unavailable",u?"true":"false")})}),T(e,s("option")).forEach(r=>{r.value=i(l(r,"option"))}),T(e,s("variant-select")).forEach(r=>{r.value=t.variant.id})}function dt(e,t){let{variant:n,purchase:i,line:r}=t;e.$(s("purchase")).forEach(a=>{if(Q(a)){a.value=i.kind;return}let o=l(a,"purchase");P(a,o===i.kind),E(a,o==="subscription"?!t.subscriptionAvailable:e.product.requiresSellingPlan,"does-nothing")}),e.$(s("plan-value")).forEach(a=>{let o=l(a,"plan-value")??"";P(a,r.kind==="subscription"&&o===r.planId),E(a,!y(n,o),"does-nothing");let c=e.plans.find(d=>d.id===o),u=Z(n,o,c,et);b(a,s("plan-bind")).forEach(d=>{let v=u.get(l(d,"plan-bind")??"");v&&h(d,v())})}),T(e,s("plan")).forEach(a=>{a.value=r.kind==="subscription"?r.planId:""})}function ht(e,t){let n=new Map(Object.entries(t.show));N.forEach(i=>n.set(i,i==="ready")),e.$(s("show")).forEach(i=>{let r=l(i,"show")??"",a=n.get(r);a!==void 0&&(N.some(o=>o===r)&&!tt(i,e.root)||F(i,a))})}function pt(e,t){let n=!t.variant.availableForSale;e.$(s("add-to-cart")).forEach(i=>{i.classList.toggle("is-disabled",n),i.setAttribute("aria-disabled",String(n)),"disabled"in i&&(i.disabled=n);let r=l(i,"soldout-text"),a=l(i,"subscribe-text");if(!r&&!a)return;let{label:o,original:c}=$(i),u=c;t.line.kind==="subscription"&&a&&(u=a),n&&r&&(u=r),i.getAttribute("aria-busy")!=="true"&&h(o,u)})}function nt(e,t){let{variant:n}=t,{product:i}=e,r=z(t,et);e.$(s("bind")).forEach(a=>{let o=l(a,"bind")??"";if(o==="variant-image"){H(a,n.image?.url||i.featuredImage?.url,n.image?.altText||i.title);return}let c=r.get(o);c&&h(a,c())}),ut(e,t),dt(e,t),ht(e,t),e.root.classList.toggle("is-subscription",t.line.kind==="subscription"),e.root.setAttribute(m("purchase-mode"),t.line.kind),pt(e,t)}var rt=()=>s("product"),mt=e=>e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA",it=e=>e instanceof window.Element;function g(e,t,n){let i=t.closest(n);return i?.closest(rt())===e.root?i:null}function ft(e,t){let{label:n,original:i}=$(t),r=l(t,"adding-text");U(t,async()=>{r&&h(n,r);try{await e.addToCart()}catch(a){L(a,"add to cart failed"),f("error",{error:a,context:"add-to-cart"},e.root)}finally{r&&h(n,i)}}).then(()=>{e.renderVariant()}).catch(a=>{L(a,"add to cart render")})}function vt(e,t,n){let i=g(e,n,s("option-value")),r=i?.closest(s("option-list"));if(i&&r){t.preventDefault(),e.select(e.optName(l(r,"option-list")),l(i,"option-value")??"");return}let a=g(e,n,s("plan-value"));if(a){t.preventDefault(),e.selectPlan(l(a,"plan-value"));return}let o=g(e,n,`${s("purchase")}:not(select)`);if(o){o.tagName!=="INPUT"&&t.preventDefault(),e.setPurchase(at(l(o,"purchase")));return}let c=g(e,n,s("qty-plus")),u=c?null:g(e,n,s("qty-minus"));if(c||u){t.preventDefault(),e.setQuantity(e.quantity+(c?1:-1));return}let d=g(e,n,s("add-to-cart"));d&&(t.preventDefault(),ft(e,d))}function gt(e,t){let{key:n}=e,i=n===" "||n==="Enter"&&!t.matches("a[href]"),r=`:is(${s("option-value")},${s("plan-value")},${s("purchase")})[role=button]:not(button,input)`;!i||e.defaultPrevented||!t.matches(r)||(e.preventDefault(),t.click())}var at=e=>e==="subscription"?"subscription":"one-time";function bt(e,t){let n=mt(t)?t.value:"";t.matches(`select${s("option")}`)?e.select(e.optName(l(t,"option")),n):t.matches(`select${s("variant-select")}`)?e.selectVariant(n):t.matches(`select${s("plan")}`)?n?e.selectPlan(n):e.setPurchase("one-time"):t.matches(`select${s("purchase")}`)?e.setPurchase(at(n)):t.matches(s("qty"))&&e.setQuantity(n)}function st(e){e.root.addEventListener("click",t=>{it(t.target)&&vt(e,t,t.target)}),e.root.addEventListener("keydown",t=>{t.target instanceof window.HTMLElement&&gt(t,t.target)}),e.root.addEventListener("change",t=>{let{target:n}=t;it(n)&&n.closest(rt())===e.root&&bt(e,n)})}var Pt=new WeakMap,Et=()=>s("product"),k=new Map;function yt(e){e.forEach(t=>{k.has(t.handle)||k.set(t.handle,t.options.map(n=>n.name))})}var ot=e=>e.tagName==="INPUT",Tt=e=>e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA";function St(e){return ot(e)&&e.type==="checkbox"?e.checked?e.value&&e.value!=="on"?e.value:"Yes":null:ot(e)&&e.type==="radio"?e.checked?e.value:null:Tt(e)&&e.value||null}var lt=class{constructor(t,n){p(this,"root");p(this,"product");p(this,"plans");p(this,"selected");p(this,"purchase");p(this,"variant");p(this,"quantity");this.root=t,this.product=n,this.plans=M(n);let i=new URLSearchParams(window.location.search),r=Y(n,{variant:i.get("variant")||l(t,"variant"),sellingPlan:i.get("selling_plan"),defaultPlan:l(t,"default-plan"),defaultPurchase:l(t,"default-purchase")||I.defaultPurchase});this.selected=r.selected,this.purchase=r.purchase,this.variant=null,this.quantity=x(t,"quantity")?Math.max(0,parseInt(l(t,"quantity")??"",10)||0):1,Pt.set(t,this),t.setAttribute(m("state"),"ready"),t.removeAttribute(m("error")),this.renderProduct(),st(this),this.renderVariant(),R(t,"product"),V("product"),f("product-ready",{product:n,scope:this},t)}update(t){let n=this.variant?.id;this.product=t,this.plans=M(t);let i=t.variants.nodes.find(r=>r.id===n);i&&(this.selected=S(i)),this.root.setAttribute(m("state"),"ready"),this.root.removeAttribute(m("error")),this.renderProduct(),this.renderVariant(),V("product"),f("product-updated",{product:t,scope:this},this.root)}$(t){let n=q(this.root,t,Et());return this.root.matches(t)?[this.root,...n]:n}optName(t){if(!t)return"";let{options:n}=this.product;if(n.some(r=>r.name===t))return t;let i=(k.get(this.product.handle)??[]).indexOf(t);return n[i]?.name??t}get plan(){let t=A(this.purchase);return this.plans.find(n=>n.id===t)??null}get subscriptionAvailable(){return this.plans.some(t=>y(this.variant,t.id))}get isSubscription(){return w(this.purchase,this.variant).kind==="subscription"}getLine(){if(!this.variant)return null;let t={merchandiseId:this.variant.id,quantity:this.quantity},n=w(this.purchase,this.variant);n.kind==="subscription"&&(t.sellingPlanId=n.planId);let i=this.collectAttributes();return i.length&&(t.attributes=i),t}collectAttributes(){let t=B(D(this.root,"line-attributes")),n=this.$(s("line-attribute")).flatMap(i=>{let r=St(i);return r===null?[]:[{key:l(i,"line-attribute")??"",value:r}]});return[...t,...n]}select(t,n){if(this.selected[t]===n)return;let i=this.product.variants.nodes.filter(o=>o.selectedOptions.some(c=>c.name===t&&c.value===n)),[r]=i;if(!r)return;let a={...this.selected,[t]:n};if(!i.some(o=>o.selectedOptions.every(c=>a[c.name]===c.value))){let o=u=>u.selectedOptions.filter(v=>v.name!==t&&this.selected[v.name]===v.value).length*2+(u.availableForSale?1:0),c=i.reduce((u,d)=>o(d)>o(u)?d:u,r);Object.assign(a,S(c))}this.selected=a,this.renderVariant()}selectVariant(t){let n=this.product.variants.nodes.find(i=>i.id===G.variant(t));n&&(this.selected=S(n),this.renderVariant())}setPurchase(t){let n=X(this.product,this.variant,t,A(this.purchase));n.kind!==this.purchase.kind&&(this.purchase=n,this.renderVariant())}selectPlan(t){let n=K(this.product,t);n&&(this.purchase={kind:"subscription",planId:n.id},this.renderVariant())}setQuantity(t){let n=x(this.root,"quantity")?0:1;this.quantity=Math.max(n,parseInt(String(t),10)||0),this.$(s("qty")).forEach(i=>{h(i,this.quantity)}),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let t=this.getLine();if(!t||t.quantity<1)return null;let n=await J.add(t);return f("product-added",{product:this.product,variant:this.variant,line:t},this.root),n}renderProduct(){let{product:t}=this;k.has(t.handle)||this.$(`${s("option-list")},select${s("option")}`).map(i=>l(i,"option-list")||l(i,"option")).some(i=>t.options.some(r=>r.name===i))&&yt([t]),j(this)}renderVariant(){let t=_(this.product,{selected:this.selected,purchase:this.purchase,quantity:this.quantity},I.lowStock);if(!t){this.variant=null;return}this.variant=t.variant,this.selected=t.selected,this.purchase=t.purchase,nt(this,t),f("variant-changed",{product:this.product,variant:t.variant,selected:{...t.selected},purchase:t.purchase.kind,sellingPlanId:t.line.kind==="subscription"?t.line.planId:null},this.root)}};export{Pt as a,yt as b,lt as c};
1
+ import{b as Q,c as T,d as j,h as J}from"./chunk-KF76466X.js";import{a as S,b as W,c as A,d as w,e as X,f as Y,g as _,h as z,i as Z}from"./chunk-4BZ4X2Z6.js";import{d as G,e as M,f as y,k as K}from"./chunk-BGUUUMJO.js";import{c as N,f as tt}from"./chunk-ADA2ZGPO.js";import{C,D as O,G as h,I as F,J as P,K as E,M as V,N as R,O as U,P as D,S as B,m,n as s,o as l,p as x,q as b,r as q,u as f,x as H}from"./chunk-B7SC7UOJ.js";import{F as L,b as p,x as I}from"./chunk-QUBBZNJ7.js";var et={money:O,percent:C},ct=e=>e.tagName==="INPUT";function $(e){let t=b(e,s("add-label"))[0]??e,n=t.dataset.tetherLabel??(ct(t)?t.value:t.textContent);return t.dataset.tetherLabel=n,{label:t,original:n}}function ut(e,t){let{product:n}=e,i=r=>t.selected[e.optName(r)]??"";e.$(s("option-selected")).forEach(r=>{h(r,i(l(r,"option-selected")))}),e.$(s("option-list")).forEach(r=>{let a=e.optName(l(r,"option-list"));b(r,s("option-value")).forEach(o=>{let c=l(o,"option-value")??"";P(o,t.selected[a]===c);let u=!W(n,t.selected,a,c);E(o,u,"picks-closest"),o.setAttribute("data-unavailable",u?"true":"false")})}),T(e,s("option")).forEach(r=>{r.value=i(l(r,"option"))}),T(e,s("variant-select")).forEach(r=>{r.value=t.variant.id})}function dt(e,t){let{variant:n,purchase:i,line:r}=t;e.$(s("purchase")).forEach(a=>{if(Q(a)){a.value=i.kind;return}let o=l(a,"purchase");P(a,o===i.kind),E(a,o==="subscription"?!t.subscriptionAvailable:e.product.requiresSellingPlan,"does-nothing")}),e.$(s("plan-value")).forEach(a=>{let o=l(a,"plan-value")??"";P(a,r.kind==="subscription"&&o===r.planId),E(a,!y(n,o),"does-nothing");let c=e.plans.find(d=>d.id===o),u=Z(n,o,c,et);b(a,s("plan-bind")).forEach(d=>{let v=u.get(l(d,"plan-bind")??"");v&&h(d,v())})}),T(e,s("plan")).forEach(a=>{a.value=r.kind==="subscription"?r.planId:""})}function ht(e,t){let n=new Map(Object.entries(t.show));N.forEach(i=>n.set(i,i==="ready")),e.$(s("show")).forEach(i=>{let r=l(i,"show")??"",a=n.get(r);a!==void 0&&(N.some(o=>o===r)&&!tt(i,e.root)||F(i,a))})}function pt(e,t){let n=!t.variant.availableForSale;e.$(s("add-to-cart")).forEach(i=>{i.classList.toggle("is-disabled",n),i.setAttribute("aria-disabled",String(n)),"disabled"in i&&(i.disabled=n);let r=l(i,"soldout-text"),a=l(i,"subscribe-text");if(!r&&!a)return;let{label:o,original:c}=$(i),u=c;t.line.kind==="subscription"&&a&&(u=a),n&&r&&(u=r),i.getAttribute("aria-busy")!=="true"&&h(o,u)})}function nt(e,t){let{variant:n}=t,{product:i}=e,r=z(t,et);e.$(s("bind")).forEach(a=>{let o=l(a,"bind")??"";if(o==="variant-image"){H(a,n.image?.url||i.featuredImage?.url,n.image?.altText||i.title);return}let c=r.get(o);c&&h(a,c())}),ut(e,t),dt(e,t),ht(e,t),e.root.classList.toggle("is-subscription",t.line.kind==="subscription"),e.root.setAttribute(m("purchase-mode"),t.line.kind),pt(e,t)}var rt=()=>s("product"),mt=e=>e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA",it=e=>e instanceof window.Element;function g(e,t,n){let i=t.closest(n);return i?.closest(rt())===e.root?i:null}function ft(e,t){let{label:n,original:i}=$(t),r=l(t,"adding-text");U(t,async()=>{r&&h(n,r);try{await e.addToCart()}catch(a){L(a,"add to cart failed"),f("error",{error:a,context:"add-to-cart"},e.root)}finally{r&&h(n,i)}}).then(()=>{e.renderVariant()}).catch(a=>{L(a,"add to cart render")})}function vt(e,t,n){let i=g(e,n,s("option-value")),r=i?.closest(s("option-list"));if(i&&r){t.preventDefault(),e.select(e.optName(l(r,"option-list")),l(i,"option-value")??"");return}let a=g(e,n,s("plan-value"));if(a){t.preventDefault(),e.selectPlan(l(a,"plan-value"));return}let o=g(e,n,`${s("purchase")}:not(select)`);if(o){o.tagName!=="INPUT"&&t.preventDefault(),e.setPurchase(at(l(o,"purchase")));return}let c=g(e,n,s("qty-plus")),u=c?null:g(e,n,s("qty-minus"));if(c||u){t.preventDefault(),e.setQuantity(e.quantity+(c?1:-1));return}let d=g(e,n,s("add-to-cart"));d&&(t.preventDefault(),ft(e,d))}function gt(e,t){let{key:n}=e,i=n===" "||n==="Enter"&&!t.matches("a[href]"),r=`:is(${s("option-value")},${s("plan-value")},${s("purchase")})[role=button]:not(button,input)`;!i||e.defaultPrevented||!t.matches(r)||(e.preventDefault(),t.click())}var at=e=>e==="subscription"?"subscription":"one-time";function bt(e,t){let n=mt(t)?t.value:"";t.matches(`select${s("option")}`)?e.select(e.optName(l(t,"option")),n):t.matches(`select${s("variant-select")}`)?e.selectVariant(n):t.matches(`select${s("plan")}`)?n?e.selectPlan(n):e.setPurchase("one-time"):t.matches(`select${s("purchase")}`)?e.setPurchase(at(n)):t.matches(s("qty"))&&e.setQuantity(n)}function st(e){e.root.addEventListener("click",t=>{it(t.target)&&vt(e,t,t.target)}),e.root.addEventListener("keydown",t=>{t.target instanceof window.HTMLElement&&gt(t,t.target)}),e.root.addEventListener("change",t=>{let{target:n}=t;it(n)&&n.closest(rt())===e.root&&bt(e,n)})}var Pt=new WeakMap,Et=()=>s("product"),k=new Map;function yt(e){e.forEach(t=>{k.has(t.handle)||k.set(t.handle,t.options.map(n=>n.name))})}var ot=e=>e.tagName==="INPUT",Tt=e=>e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA";function St(e){return ot(e)&&e.type==="checkbox"?e.checked?e.value&&e.value!=="on"?e.value:"Yes":null:ot(e)&&e.type==="radio"?e.checked?e.value:null:Tt(e)&&e.value||null}var lt=class{constructor(t,n){p(this,"root");p(this,"product");p(this,"plans");p(this,"selected");p(this,"purchase");p(this,"variant");p(this,"quantity");this.root=t,this.product=n,this.plans=M(n);let i=new URLSearchParams(window.location.search),r=Y(n,{variant:i.get("variant")||l(t,"variant"),sellingPlan:i.get("selling_plan"),defaultPlan:l(t,"default-plan"),defaultPurchase:l(t,"default-purchase")||I.defaultPurchase});this.selected=r.selected,this.purchase=r.purchase,this.variant=null,this.quantity=x(t,"quantity")?Math.max(0,parseInt(l(t,"quantity")??"",10)||0):1,Pt.set(t,this),t.setAttribute(m("state"),"ready"),t.removeAttribute(m("error")),this.renderProduct(),st(this),this.renderVariant(),R(t,"product"),V("product"),f("product-ready",{product:n,scope:this},t)}update(t){let n=this.variant?.id;this.product=t,this.plans=M(t);let i=t.variants.nodes.find(r=>r.id===n);i&&(this.selected=S(i)),this.root.setAttribute(m("state"),"ready"),this.root.removeAttribute(m("error")),this.renderProduct(),this.renderVariant(),V("product"),f("product-updated",{product:t,scope:this},this.root)}$(t){let n=q(this.root,t,Et());return this.root.matches(t)?[this.root,...n]:n}optName(t){if(!t)return"";let{options:n}=this.product;if(n.some(r=>r.name===t))return t;let i=(k.get(this.product.handle)??[]).indexOf(t);return n[i]?.name??t}get plan(){let t=A(this.purchase);return this.plans.find(n=>n.id===t)??null}get subscriptionAvailable(){return this.plans.some(t=>y(this.variant,t.id))}get isSubscription(){return w(this.purchase,this.variant).kind==="subscription"}getLine(){if(!this.variant)return null;let t={merchandiseId:this.variant.id,quantity:this.quantity},n=w(this.purchase,this.variant);n.kind==="subscription"&&(t.sellingPlanId=n.planId);let i=this.collectAttributes();return i.length&&(t.attributes=i),t}collectAttributes(){let t=B(D(this.root,"line-attributes")),n=this.$(s("line-attribute")).flatMap(i=>{let r=St(i);return r===null?[]:[{key:l(i,"line-attribute")??"",value:r}]});return[...t,...n]}select(t,n){if(this.selected[t]===n)return;let i=this.product.variants.nodes.filter(o=>o.selectedOptions.some(c=>c.name===t&&c.value===n)),[r]=i;if(!r)return;let a={...this.selected,[t]:n};if(!i.some(o=>o.selectedOptions.every(c=>a[c.name]===c.value))){let o=u=>u.selectedOptions.filter(v=>v.name!==t&&this.selected[v.name]===v.value).length*2+(u.availableForSale?1:0),c=i.reduce((u,d)=>o(d)>o(u)?d:u,r);Object.assign(a,S(c))}this.selected=a,this.renderVariant()}selectVariant(t){let n=this.product.variants.nodes.find(i=>i.id===G.variant(t));n&&(this.selected=S(n),this.renderVariant())}setPurchase(t){let n=X(this.product,this.variant,t,A(this.purchase));n.kind!==this.purchase.kind&&(this.purchase=n,this.renderVariant())}selectPlan(t){let n=K(this.product,t);n&&(this.purchase={kind:"subscription",planId:n.id},this.renderVariant())}setQuantity(t){let n=x(this.root,"quantity")?0:1;this.quantity=Math.max(n,parseInt(String(t),10)||0),this.$(s("qty")).forEach(i=>{h(i,this.quantity)}),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let t=this.getLine();if(!t||t.quantity<1)return null;let n=await J.add(t);return f("product-added",{product:this.product,variant:this.variant,line:t},this.root),n}renderProduct(){let{product:t}=this;k.has(t.handle)||this.$(`${s("option-list")},select${s("option")}`).map(i=>l(i,"option-list")||l(i,"option")).some(i=>t.options.some(r=>r.name===i))&&yt([t]),j(this)}renderVariant(){let t=_(this.product,{selected:this.selected,purchase:this.purchase,quantity:this.quantity},I.lowStock);if(!t){this.variant=null;return}this.variant=t.variant,this.selected=t.selected,this.purchase=t.purchase,nt(this,t),f("variant-changed",{product:this.product,variant:t.variant,selected:{...t.selected},purchase:t.purchase.kind,sellingPlanId:t.line.kind==="subscription"?t.line.planId:null},this.root)}};export{Pt as a,yt as b,lt as c};
@@ -1 +1 @@
1
- import{a as D,e as O,g as C}from"./chunk-IG23NTJK.js";import{a as p,b as x,c as m,i as I}from"./chunk-BRI56DD5.js";import{D as T,d as w,v,x as $}from"./chunk-X2HBGPFB.js";var M=1e4,_=6e4,o=new Map,P=new Map,a=new Set,h=new Map,S=[],y=!1,f=0,N=t=>t.startsWith("gid://"),b=v;function E(t){if(!t)return;let e=Promise.resolve(t);o.set(t.handle,e),o.set(t.id,e)}function j(t){let e=b(t);if(!e)return Promise.reject(new p("empty product key",{code:"NOT_FOUND"}));let r=o.get(e);if(r)return r;let c=new Promise((d,s)=>{P.set(e,{resolve:d,reject:s}),S.push(e),y||(y=!0,setTimeout(()=>void A(),0))});return o.set(e,c),c}var q=t=>e=>`${t}${D($,e)}`;function F(t){let e=t.filter(N),r=t.filter(l=>!N(l)),c=[],d=[],s={};return e.length&&(c.push("$ids: [ID!]!"),s.ids=e,d.push("byId:nodes(ids:$ids){... on Product{...TetherProduct}}")),r.forEach((l,n)=>{c.push(`$h${n}: String!`),s[`h${n}`]=l,d.push(`h${n}:product(handle:$h${n}){...TetherProduct}`)}),{query:q(`query TetherProducts(${c.join(",")}){${d.join(" ")}}`),variables:s,handles:r}}function R(t,e){let r=P.get(t);P.delete(t),r&&e(r)}function Q(t,e){if(e!==f)return;let r=o.get(t);setTimeout(()=>{o.get(t)===r&&o.delete(t)},M)}function W(t){if(!w(t))return!1;let{byId:e=[],...r}=t;return x(e,[m(C)])&&Object.values(r).every(m(O))}async function A(){y=!1;let t=f,e=S.splice(0);if(!e.length)return;let{query:r,variables:c,handles:d}=F(e);T("fetch products",e);let s;try{s=await I(r,c,W)}catch(n){e.forEach(u=>{R(u,i=>{t===f&&o.delete(u),i.reject(n)})});return}let g=new Map;for(let n of s.byId??[])n?.id&&g.set(n.id,n);d.forEach((n,u)=>{let i=s[`h${u}`];i&&g.set(n,i)});let l=Date.now();e.forEach(n=>{R(n,u=>{let i=g.get(n);if(!i){Q(n,t),u.reject(new p(`Product not found: ${n}`,{code:"NOT_FOUND"}));return}t===f&&(E(i),h.set(i.handle,l),h.set(i.id,l)),u.resolve(i)})})}function L(){o.clear(),f+=1,a.clear(),h.clear()}function J(t){for(let e of t??[])!e.id||!e.handle||Date.now()-(h.get(e.handle)??0)<_&&o.has(e.handle)||(E(e),a.add(e.handle),a.add(e.id))}function V(t){let e=b(t);return!e||!a.has(e)?!1:(a.delete(e),o.get(e)?.then(r=>{a.delete(r.handle),a.delete(r.id)},B),!0)}function B(){}function X(t){let e=b(t);return e&&o.delete(e),j(t)}export{b as a,E as b,j as c,q as d,L as e,J as f,V as g,X as h};
1
+ import{b as D,e as O,g as C}from"./chunk-R3UWDQL5.js";import{a as p,b as x,c as m,i as I}from"./chunk-B7SC7UOJ.js";import{D as T,d as w,v,x as $}from"./chunk-QUBBZNJ7.js";var M=1e4,_=6e4,o=new Map,P=new Map,a=new Set,h=new Map,S=[],y=!1,f=0,N=t=>t.startsWith("gid://"),b=v;function E(t){if(!t)return;let e=Promise.resolve(t);o.set(t.handle,e),o.set(t.id,e)}function j(t){let e=b(t);if(!e)return Promise.reject(new p("empty product key",{code:"NOT_FOUND"}));let r=o.get(e);if(r)return r;let c=new Promise((d,s)=>{P.set(e,{resolve:d,reject:s}),S.push(e),y||(y=!0,setTimeout(()=>void A(),0))});return o.set(e,c),c}var q=t=>e=>`${t}${D($,e)}`;function F(t){let e=t.filter(N),r=t.filter(l=>!N(l)),c=[],d=[],s={};return e.length&&(c.push("$ids: [ID!]!"),s.ids=e,d.push("byId:nodes(ids:$ids){... on Product{...TetherProduct}}")),r.forEach((l,n)=>{c.push(`$h${n}: String!`),s[`h${n}`]=l,d.push(`h${n}:product(handle:$h${n}){...TetherProduct}`)}),{query:q(`query TetherProducts(${c.join(",")}){${d.join(" ")}}`),variables:s,handles:r}}function R(t,e){let r=P.get(t);P.delete(t),r&&e(r)}function Q(t,e){if(e!==f)return;let r=o.get(t);setTimeout(()=>{o.get(t)===r&&o.delete(t)},M)}function W(t){if(!w(t))return!1;let{byId:e=[],...r}=t;return x(e,[m(C)])&&Object.values(r).every(m(O))}async function A(){y=!1;let t=f,e=S.splice(0);if(!e.length)return;let{query:r,variables:c,handles:d}=F(e);T("fetch products",e);let s;try{s=await I(r,c,W)}catch(n){e.forEach(u=>{R(u,i=>{t===f&&o.delete(u),i.reject(n)})});return}let g=new Map;for(let n of s.byId??[])n?.id&&g.set(n.id,n);d.forEach((n,u)=>{let i=s[`h${u}`];i&&g.set(n,i)});let l=Date.now();e.forEach(n=>{R(n,u=>{let i=g.get(n);if(!i){Q(n,t),u.reject(new p(`Product not found: ${n}`,{code:"NOT_FOUND"}));return}t===f&&(E(i),h.set(i.handle,l),h.set(i.id,l)),u.resolve(i)})})}function L(){o.clear(),f+=1,a.clear(),h.clear()}function J(t){for(let e of t??[])!e.id||!e.handle||Date.now()-(h.get(e.handle)??0)<_&&o.has(e.handle)||(E(e),a.add(e.handle),a.add(e.id))}function V(t){let e=b(t);return!e||!a.has(e)?!1:(a.delete(e),o.get(e)?.then(r=>{a.delete(r.handle),a.delete(r.id)},B),!0)}function B(){}function X(t){let e=b(t);return e&&o.delete(e),j(t)}export{b as a,E as b,j as c,q as d,L as e,J as f,V as g,X as h};
@@ -1 +1 @@
1
- import{c as a}from"./chunk-O6Z6O5NW.js";import{a as o}from"./chunk-EIPYBAVZ.js";import{D as c,F as g,o as u,p as i,x as n}from"./chunk-X2HBGPFB.js";var f={country:void 0,language:void 0,locale:void 0},l=!1;function d(){let t=e=>document.querySelector(`meta[name="${n.prefix}-page-${e}"]`)?.getAttribute("content")||void 0,r=u(t("country"));return r?{country:r,language:i(t("language"))??void 0,locale:t("locale")}:null}async function m(){let t=n.markets??{};if(t.detect===!1)return null;if(!t.detect)return t.remember===!1?null:a();try{return(await o("markets")).detectMarket(t)}catch(r){return g(r,"markets"),null}}async function C(t){f={country:n.country,language:n.language,locale:n.locale};let r=d();if(l=r!==null,r){n.country=r.country,n.language=r.language,r.locale&&(n.locale=r.locale);return}let e=await m();e&&(e.country&&(n.country=e.country),e.language&&(n.language=e.language),e.locale&&!t.locale&&(n.locale=e.locale),c("market",e))}var s=(t,r)=>(t??"").toUpperCase()===(r??"").toUpperCase();function P(){let t=d(),r=t===null&&l;l=t!==null;let e=t??(r?a()??f:null);return!e?.country||s(e.country,n.country)&&s(e.language,n.language)?null:{country:e.country,language:e.language,locale:e.locale}}function S(t,r){return o("markets").then(e=>e.setCountry(t,r))}export{C as a,P as b,S as c};
1
+ import{c as a}from"./chunk-UJH5ZECZ.js";import{a as o}from"./chunk-KH7NEM4B.js";import{D as c,F as g,o as u,p as i,x as n}from"./chunk-QUBBZNJ7.js";var f={country:void 0,language:void 0,locale:void 0},l=!1;function d(){let t=e=>document.querySelector(`meta[name="${n.prefix}-page-${e}"]`)?.getAttribute("content")||void 0,r=u(t("country"));return r?{country:r,language:i(t("language"))??void 0,locale:t("locale")}:null}async function m(){let t=n.markets??{};if(t.detect===!1)return null;if(!t.detect)return t.remember===!1?null:a();try{return(await o("markets")).detectMarket(t)}catch(r){return g(r,"markets"),null}}async function C(t){f={country:n.country,language:n.language,locale:n.locale};let r=d();if(l=r!==null,r){n.country=r.country,n.language=r.language,r.locale&&(n.locale=r.locale);return}let e=await m();e&&(e.country&&(n.country=e.country),e.language&&(n.language=e.language),e.locale&&!t.locale&&(n.locale=e.locale),c("market",e))}var s=(t,r)=>(t??"").toUpperCase()===(r??"").toUpperCase();function P(){let t=d(),r=t===null&&l;l=t!==null;let e=t??(r?a()??f:null);return!e?.country||s(e.country,n.country)&&s(e.language,n.language)?null:{country:e.country,language:e.language,locale:e.locale}}function S(t,r){return o("markets").then(e=>e.setCountry(t,r))}export{C as a,P as b,S as c};
@@ -0,0 +1 @@
1
+ import{a as Ot,d as N,e as $t}from"./chunk-BGUUUMJO.js";import{c as qt}from"./chunk-I54NQEVK.js";import{c as nt,d as q}from"./chunk-R3UWDQL5.js";import{A as xt,B as K,D as v,E as It,F as Tt,G as g,H as k,I as O,M as Mt,T as Q,a as h,c as D,d as V,i as B,l as At,m as A,n as u,o as f,p as Pt,q as d,u as C,w as kt,x as P,y as Et,z as M}from"./chunk-B7SC7UOJ.js";import{D as Lt,F as w,G as R,r as vt,x as c}from"./chunk-QUBBZNJ7.js";var ge={id:"string",quantity:"number",attributes:["object"],cost:{totalAmount:q,subtotalAmount:q,amountPerQuantity:q},merchandise:{id:"string",selectedOptions:["object"],product:"object"}},rt={id:"string",checkoutUrl:"string",totalQuantity:"number",attributes:["object"],discountCodes:["object"],cost:{totalAmount:q,subtotalAmount:q},lines:{nodes:[ge]}};var ye='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',he=60,ot=!1,at=!1,j=null,it=null,Ce=t=>t!==null&&"focus"in t,Ut=t=>d(t,ye).filter(e=>e.offsetParent!==null||e===document.activeElement),E=()=>d(document,u("cart-drawer")),st=t=>t.classList.contains(c.cartDrawerOpenClass),Rt=t=>t.some(e=>e.contains(document.activeElement)),be=t=>f(t,"cart-drawer")==="manual";function S(){return[...document.getElementsByClassName(c.cartDrawerOpenClass)].some(e=>e.matches(u("cart-drawer")))||ot&&!E().length}function Se(){let t=S();if(t===at)return;let e=E();t?Dt(e.filter(st)):Qt(e,Rt(e))}function G(){d(document,u("cart-open")).forEach(t=>{t.setAttribute("aria-expanded",String(S()))}),E().forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","dialog"),!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-label",f(t,"cart-label")||"Cart");let e=st(t);t.setAttribute("aria-modal",String(e)),t.setAttribute("aria-hidden",String(!e)),t.inert=!e}),!it&&(it=new MutationObserver(Se),it.observe(document.documentElement,{attributes:!0,attributeFilter:["class"],childList:!0,subtree:!0}))}function we(t){let e=Ut(t)[0]??t;e===t&&!t.hasAttribute("tabindex")&&(t.tabIndex=-1),e.focus({preventScroll:!0})}function Dt(t){at=!0,G();let[e]=t;c.cartFocus&&e&&(j=Ce(document.activeElement)?document.activeElement:null,setTimeout(()=>{we(e)},he)),R("onCartOpen",()=>c.onCartOpen?.(t)),C("cart-toggled",{open:!0})}function Qt(t,e){at=!1,ot=!1,G(),e&&j?.isConnected&&j.focus({preventScroll:!0}),j=null,R("onCartClose",()=>c.onCartClose?.(t)),C("cart-toggled",{open:!1})}function X(){if(S())return;let t=E(),e=t.filter(n=>!be(n));t.length&&!e.length||(ot=!t.length,e.forEach(n=>{n.classList.add(c.cartDrawerOpenClass)}),Dt(e))}function ut(){if(!S())return;let t=E(),e=Rt(t);t.forEach(n=>{n.classList.remove(c.cartDrawerOpenClass)}),Qt(t,e)}function Nt(){S()?ut():X()}function ve(t){if(t.key!=="Tab"||!c.cartFocus||!S())return;let e=E().find(st);if(!e)return;let n=Ut(e),r=n[0],o=n.at(-1);if(!r||!o)return;let i=document.activeElement,a=t.shiftKey?i===r:i===o;e.contains(i)&&!a||(t.preventDefault(),(t.shiftKey?o:r).focus())}var Le=/^image:(\d+)$/,_t="metafield:",Ae=/^(rich_text|multi_line_text)_field$/,Pe=["","true","all","*"],ct=t=>t.tagName==="SELECT",lt=(t,e)=>t.$(`select${e}`).filter(ct);function ke(t,e){let n=e.images.nodes,r=[...t.children].map(i=>i.tagName==="IMG"?i:i.querySelector("img"));!Et(t)&&r.length===n.length&&r.every((i,a)=>kt(i?.getAttribute("src"),n[a]?.url))||M(t,n,(i,a)=>{let s=i.matches(`img,${u("bind","image")}`)?i:d(i,"img")[0]??i;P(s,a.url,a.altText||e.title)})}function Ee(t,e,n){let r=n.indexOf("."),o=n.slice(0,r),i=n.slice(r+1),a=(e.metafields??[]).find(l=>l?.namespace===o&&l.key===i);if(!a){g(t,"");return}let s=a.reference?.image;if(s){P(t,s.url,s.altText);return}Ae.test(a.type)&&(t.style.whiteSpace="pre-line"),g(t,a.value)}var xe=new Map(Object.entries({title:t=>t.title,"description-text":t=>t.description,vendor:t=>t.vendor,type:t=>t.productType,handle:t=>t.handle,"published-at":t=>It(t.publishedAt),"min-price":t=>v(t.priceRange.minVariantPrice),"max-price":t=>v(t.priceRange.maxVariantPrice)}));function Ie(t,e){let n=(t.getAttribute("exclude")??"").split(",").map(o=>o.trim()).filter(Boolean),r=e.tags.filter(o=>!n.includes(o));M(t,r,(o,i)=>{g(o,i)})}function Te(t,e,n){let r=xe.get(e);if(r){g(t,r(n));return}switch(e){case"description":Tt(t,n.descriptionHtml);break;case"featured-image":P(t,n.featuredImage?.url,n.featuredImage?.altText||n.title);break;case"url":case"link":{let o=K(n.handle,n.id);o&&t.setAttribute("href",o),e==="url"&&!t.firstElementChild&&!t.textContent.trim()&&g(t,n.title);break}case"images":ke(t,n);break;case"tags":Ie(t,n);break;default:Me(t,e,n)}}function Me(t,e,n){let r=Le.exec(e);if(r){let o=n.images.nodes[Number(r[1])-1]??n.featuredImage;P(t,o?.url,o?.altText||n.title)}else e.startsWith(_t)&&Ee(t,n,e.slice(_t.length))}function Oe(t){let{product:e}=t;t.$(u("option-list")).forEach(n=>{let r=t.optName(f(n,"option-list")),o=e.options.find(i=>i.name===r);if(!o||o.optionValues.length<=1&&Pt(n,"hide-single")){O(n,!1);return}M(n,o.optionValues,(i,a)=>{i.setAttribute(A("option-value"),a.name);let s=d(i,u("bind","option-value"))[0];s?g(s,a.name):i.firstElementChild||g(i,a.name);let l=d(i,u("bind","swatch"))[0],{swatch:p}=a;!l||!p||(p.color&&(l.style.backgroundColor=p.color),p.image?.previewImage&&P(l,p.image.previewImage.url,a.name))})})}function $e(t){let{product:e}=t;lt(t,u("option")).forEach(n=>{let r=e.options.find(o=>o.name===t.optName(f(n,"option")));if(!r){O(n,!1);return}n.replaceChildren(...r.optionValues.map(o=>new Option(o.name,o.name)))}),lt(t,u("variant-select")).forEach(n=>{n.replaceChildren(...e.variants.nodes.map(r=>new Option(r.title,r.id)))}),lt(t,u("plan")).forEach(n=>{let r=t.plans.map(a=>new Option(a.name,a.id)),o=!e.requiresSellingPlan&&f(n,"plan")!=="subscription-only",i=n.getAttribute(A("one-time-label"))||"One-time purchase";n.replaceChildren(...o?[new Option(i,"")]:[],...r)})}function qe(t){t.$(u("plan-list")).forEach(e=>{let n=(f(e,"plan-list")??"").trim(),r=Pe.includes(n.toLowerCase())?null:n,o=t.plans.filter(i=>!r||i.group.name===r);M(e,o,(i,a)=>{i.setAttribute(A("plan-value"),a.id),!i.firstElementChild&&!i.querySelector(u("plan-bind"))&&g(i,a.name)})})}function cn(t){t.$(u("bind")).forEach(e=>{Te(e,f(e,"bind")??"",t.product)}),Oe(t),$e(t),qe(t)}var Ht="Default Title",dt=(t,e)=>e.get(t.id)?.quantity??t.quantity,Ft=t=>t.split("/").pop()??t;function Ue(t){let e=t.merchandise,n=K(e.product.handle,e.product.id);if(!n)return null;let r=new URLSearchParams;r.set("variant",Ft(e.id));let o=t.sellingPlanAllocation?.sellingPlan.id;return o&&r.set("selling_plan",Ft(o)),`${n}${n.includes("?")?"&":"?"}${r.toString()}`}var Wt=t=>t.merchandise.product.title,Vt={title:Wt,"product-title":Wt,"variant-title":t=>t.merchandise.title===Ht?"":t.merchandise.title,options:t=>t.merchandise.selectedOptions.filter(e=>e.value!==Ht).map(e=>`${e.name}: ${e.value}`).join(", "),vendor:t=>t.merchandise.product.vendor,sku:t=>t.merchandise.sku??"",price:t=>v(t.cost.amountPerQuantity),"compare-at-price":t=>v(t.cost.compareAtAmountPerQuantity??t.merchandise.compareAtPrice),"line-total":t=>v(t.cost.totalAmount),"line-subtotal":t=>v(t.cost.subtotalAmount),quantity:(t,e)=>dt(t,e.pending),plan:t=>t.sellingPlanAllocation?.sellingPlan.name??"","plan-description":t=>t.sellingPlanAllocation?.sellingPlan.description??"",components:t=>(t.lineComponents??[]).map(e=>`${e.quantity} \xD7 ${e.merchandise.product.title}`).join(", ")},Bt="attribute:";function Re(t,e,n){if(Object.hasOwn(Vt,e))return Vt[e]?.(t,n);if(!e.startsWith(Bt))return;let r=e.slice(Bt.length);return t.attributes.find(o=>o.key===r)?.value??""}function De(t,e,n){let r=$t(n),o=!n.requiresSellingPlan&&f(t,"line-plan")!=="subscription-only",i={value:"",label:t.getAttribute(A("one-time-label"))||"One-time purchase"},a=[...o?[i]:[],...r.map(l=>({value:l.id,label:l.name}))],s=a.map(l=>l.value).join("|");t.dataset.tetherSig!==s&&(t.replaceChildren(...a.map(l=>{let p=document.createElement("option");return p.value=l.value,p.textContent=l.label,p})),t.dataset.tetherSig=s),t.value=e.sellingPlanAllocation?.sellingPlan.id??"",O(t,r.length>0)}function Qe(t,e,n){let r=!!e.sellingPlanAllocation;t.classList.toggle("is-subscription",r);let o=n.warnings.find(s=>s.target===e.id);t.classList.toggle("is-warning",!!o);let i=n.pending.has(e.id);t.classList.toggle("is-busy",i),i?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),d(t,u("line","warning")).forEach(s=>{k(s,o?.message??"")});let a=new Map([["subscription",r],["one-time",!r],["on-sale",Ot(e.cost.compareAtAmountPerQuantity?.amount,e.cost.amountPerQuantity.amount)],["has-components",(e.lineComponents??[]).length>0],["warning",!!o]]);d(t,u("line-show")).forEach(s=>{let l=f(s,"line-show"),p=l===null?void 0:a.get(l);p!==void 0&&O(s,p)})}function Ne(t,e,n){let r=e.merchandise;t.setAttribute(A("line-id"),e.id),d(t,u("line")).forEach(i=>{let a=f(i,"line")??"";if(a==="image"){P(i,r.image?.url??r.product.featuredImage?.url,r.product.title);return}if(a==="url"){let l=Ue(e);l&&i.setAttribute("href",l);return}let s=Re(e,a,n);s!==void 0&&k(i,s)}),Qe(t,e,n),d(t,u("line-plan")).filter(ct).forEach(i=>{qt(r.product.handle).then(a=>{De(i,e,a)}).catch(a=>{w(a,"line plan options")})})}function _e(t,e){let n=t?.totalQuantity??0,r=(t?.lines.nodes??[]).some(i=>i.sellingPlanAllocation),o=new Map([["cart-empty",n===0],["cart-filled",n>0],["cart-has-subscription",r],["cart-no-subscription",!r],["cart-has-discount",(t?.discountCodes??[]).some(i=>i.applicable)],["cart-error",e.failed],["cart-warning",e.warnings.length>0]]);d(document,u("show")).forEach(i=>{let a=f(i,"show"),s=a===null?void 0:o.get(a);s===void 0||i.closest(u("product"))||O(i,s)}),d(document,u("checkout")).forEach(i=>{i.classList.toggle("is-disabled",!n),i.setAttribute("aria-disabled",String(!n))})}function He(t){d(document,`textarea${u("cart-note")},input${u("cart-note")}`).forEach(e=>{document.activeElement!==e&&g(e,t?.note??"")}),d(document,u("cart-discounts")).forEach(e=>{M(e,t?.discountCodes??[],(n,r)=>{n.setAttribute(A("discount-code"),r.code);let o=n.querySelector(u("discount","code"))??(n.firstElementChild?null:n);o&&g(o,r.code),n.classList.toggle("is-inapplicable",!r.applicable)})})}function Kt(t){let{cart:e}=t,n=r=>e?v(e.cost[r]):"";G(),d(document,u("cart-count")).forEach(r=>{k(r,e?.totalQuantity??0)}),d(document,u("cart-subtotal")).forEach(r=>{k(r,n("subtotalAmount"))}),d(document,u("cart-total")).forEach(r=>{k(r,n("totalAmount"))}),d(document,u("cart-checkout-charge")).forEach(r=>{k(r,n("checkoutChargeAmount"))}),_e(e,t),d(document,u("cart-warning")).forEach(r=>{k(r,[...new Set(t.warnings.map(o=>o.message))].join(" "))}),He(e),d(document,u("cart-lines")).forEach(r=>{xt(r,e?.lines.nodes??[],o=>o.id,(o,i)=>{Ne(o,i,t)},{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),e&&Mt("cart")}function jt(t){d(document,u("cart-count")).forEach(e=>{/^\s*0?\s*$/.test(e.textContent)&&(e.textContent=String(t))})}function mt(t,e="localStorage"){try{return window[e].getItem(t)}catch{return null}}function pt(t,e,n="localStorage"){try{window[n].setItem(t,e)}catch{}}function Gt(t,e="localStorage"){try{window[e].removeItem(t)}catch{}}var Xt=/^gid:\/\/shopify\/Cart\/[\w-]+(\?key=[\w-]+)?$/;var Yt=()=>{};function zt(){let t=Promise.resolve();return e=>{let n=t.then(e);return t=n.then(Yt,Yt),n}}var y={kind:"unknown"},U=[],$=new Map,Y=()=>y;function m(){switch(y.kind){case"ready":case"error":return y.cart;case"unknown":case"empty":return null}}var Jt=()=>U,gt=t=>t?{kind:"ready",cart:t}:{kind:"empty"},Zt=()=>`${c.storageKey}:seen`;function x(){let t=mt(c.storageKey);return t?Xt.test(t)?t:(I(),null):null}function I(){Gt(c.storageKey)}function yt(t){y=gt(t),t&&pt(c.storageKey,t.id)}function _(){Kt({cart:m(),warnings:U,pending:$,failed:y.kind==="error"})}function H(t){_(),C("cart-updated",{cart:m(),reason:t})}function b(t,e){return yt(t),pt(Zt(),`${Date.now()}|${t?.totalQuantity??0}`),H(e),t}function F(t){y=t.kind==="loaded"?gt(t.cart):{kind:"error",error:t.error,cart:null},H("load")}function Fe(){let t=mt(Zt())?.split("|")[1]??"",e=Number(t);return/^\d+$/.test(t)&&Number.isSafeInteger(e)?e:null}function te(){if(y.kind!=="unknown")return;let t=Fe();t!==null&&jt(t)}function ee(t){let e=n=>R("warningText",()=>c.warningText?.(n),()=>null);U=t.filter((n,r)=>t.findIndex(o=>o.message===n.message)===r).map(n=>({...n,message:e(n)||n.message})),U.length&&C("cart-warning",{warnings:U})}var W=zt(),ft=0;function ht(t){return ft++,t().finally(()=>{ft--})}var ne=()=>ft>0;function re(t){return W(t).then(e=>(y.kind==="error"&&(y=gt(y.cart),_()),e),e=>{throw y={kind:"error",error:e,cart:m()},_(),C("cart-error",{error:e}),e})}var Ct=t=>dt(t,$),We=()=>({open:S(),count:m()?.totalQuantity??0,loaded:y.kind!=="unknown",warnings:[...U]});function ie(t){let e=["cart-updated","cart-toggled"].map(r=>`${c.prefix}:${r}`),n=()=>{t(m(),We())};return e.forEach(r=>{document.addEventListener(r,n)}),n(),()=>{e.forEach(r=>{document.removeEventListener(r,n)})}}var Ve=/does not exist|not found|invalid id/i,Be=t=>V({[t]:D({cart:D(rt)})});function z(t){return t instanceof h?t.userErrors?.some(e=>e.field?.[0]==="cartId")?!0:(t.errors??[]).some(e=>Ve.test(e.message)):!1}function ae(t){if(!(t instanceof h))return!1;let{code:e,status:n=0}=t;return e==="NETWORK"||e==="INVALID_RESPONSE"||e==="SERVER_ERROR"||n>=500}function se(t,e=1,n={}){let r=typeof t=="object"&&t!==null?t:{...n,quantity:e,...t==null?{}:{variantId:t}},o=N.variant(r.merchandiseId||r.variantId||r.id);if(!o)throw new h("add(): variantId is required");let i=parseInt(String(r.quantity??1),10),a={merchandiseId:o,quantity:Math.max(1,i||1)},s=N.sellingPlan(r.sellingPlanId||r.sellingPlan);s&&(a.sellingPlanId=s);let l=Q(r.attributes);return l.length&&(a.attributes=l),a}function Ke(t,e,n){return r=>`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${nt(r)}`}async function ue(t,e,n,r){let o=await B(Ke(t,e,n),r,Be(t),{operation:"mutation"}),i=At(o[t],t);return ee(i.warnings??[]),i.cart}function oe(t){let e=c.country?{buyerIdentity:{countryCode:c.country},...t}:t;return ue("cartCreate","$input: CartInput!","input: $input",{input:e})}async function T({name:t,variable:e,type:n,value:r,create:o}){let i=o?{[e]:r}:null,a=x();if(!a)return i?oe(i):null;try{return await ue(t,`$cartId: ID!, $${e}: ${n}`,`cartId: $cartId, ${e}: $${e}`,{[e]:r,cartId:a})}catch(s){if(!z(s)||(I(),!i))throw s;return Lt("cart expired, creating a new one"),oe(i)}}async function bt(t){return(await B(n=>`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${nt(n)}`,{id:t},V({cart:D(rt)}))).cart}async function le(t){return(await B("query TetherCheckout($id:ID!){cart(id:$id){checkoutUrl}}",{id:t},V({cart:D({checkoutUrl:"string"})}))).cart?.checkoutUrl??null}function ce(t,e){let n=typeof e=="number"?{quantity:e}:e,r={id:t};n.quantity!==void 0&&(r.quantity=n.quantity),"sellingPlanId"in n&&(r.sellingPlanId=n.sellingPlanId?N.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=Q(n.attributes));let o=n.merchandiseId||n.variantId;return o&&(r.merchandiseId=N.variant(o)),r}var St=t=>T({name:"cartLinesUpdate",variable:"lines",type:"[CartLineUpdateInput!]!",value:t,create:!1}),J=t=>T({name:"cartLinesRemove",variable:"lineIds",type:"[ID!]!",value:t,create:!1}),de=(t,e)=>e>0?St([{id:t,quantity:e}]):J([t]);var wt=null;function pe(t){wt=t}var je=t=>le(t).then(e=>({kind:"url",url:e}),e=>({kind:"failed",error:e}));async function Ge(){if(!wt)return null;try{let t=await wt();return t&&`${t}${t.includes("?")?"&":"?"}logged_in=true`}catch(t){return w(t,"account checkout"),null}}async function Xe(t){let e=je(t),n=await Ge();if(n)return n;let r=await e;if(r.kind==="failed")throw r.error;if(!r.url)throw new h("No checkoutUrl (cart empty or expired)");return r.url}function Ye(t){try{t.opener=null}catch{}}function me(){let t=m();return t&&!t.totalQuantity?null:x()}async function fe(t=c.checkoutTarget){if(!me()&&!ne())return null;let e=t==="_blank"?window.open("","_blank"):null;e&&Ye(e);try{await W(()=>Promise.resolve());let n=me(),r=n&&await Xe(n);if(!r)return e?.close(),null;if(!vt(r))throw new h("The checkout URL is not https: not opened");return C("checkout",{url:r,cart:m()}),e&&!e.closed?e.location.href=r:window.location.href=r,r}catch(n){return e?.close(),w(n,"checkout failed"),null}}var et=()=>m()?.lines.nodes??[];async function ze(){let t=x();if(t)try{let e=await bt(t);e||I(),b(e,"load")}catch(e){w(e,"cart reload after a failed change")}}var tt=null;function L(t){return tt=null,re(()=>t().catch(async e=>{throw ae(e)&&await ze(),e}))}function Je(t,e){let n=et().find(s=>s.id===t);if(!n)return Promise.resolve(m());let r=Math.max(0,Ct(n)+e),o={quantity:r};$.set(t,o),H("pending");let i=()=>$.get(t)===o;return L(async()=>{if(!i())return m();if(et().find(p=>p.id===t)?.quantity===r)return m();let l=await de(t,r);return i()?b(l,r>0?"update":"remove"):(yt(l),l)}).finally(()=>{i()&&($.delete(t),H("settled"))})}function Ze(t){let e=(m()?.discountCodes??[]).map(r=>r.code),n=typeof t=="function"?t(e):t;return(Array.isArray(n)?n:[n]).map(r=>r.trim()).filter(Boolean)}function tn(t){let e=new Map((m()?.attributes??[]).map(n=>[n.key,n.value]));return Q(t).forEach(n=>e.set(n.key,n.value)),[...e].filter(([,n])=>n!=="").map(([n,r])=>({key:n,value:r}))}async function en(){let t=x();if(!t)return F({kind:"loaded",cart:null}),null;te();try{let e=await bt(t);e||I(),F({kind:"loaded",cart:e})}catch(e){w(e,"cart load failed"),z(e)&&I(),F({kind:"failed",error:e})}return m()}function nn(){return tt??(tt=ht(()=>W(()=>(tt=null,en())))),tt}var Z={init:nn,id:x,get status(){return Y()},get state(){return m()},get lines(){return[...et()]},get count(){return m()?.totalQuantity??0},get loaded(){return Y().kind!=="unknown"},get lastError(){let t=Y();return t.kind!=="error"?null:t.error instanceof Error?t.error:new Error(String(t.error))},get warnings(){return[...Jt()]},get pendingQty(){return $},setCheckoutResolver:pe,forgetSaved(){I(),F({kind:"loaded",cart:null})},render:_,subscribe:ie,add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(o=>se(o,e,n));return ht(()=>L(async()=>{let o=await T({name:"cartLinesAdd",variable:"lines",type:"[CartLineInput!]!",value:r,create:!0});if(!o)throw new h("Shopify answered the add without a cart");return b(o,"add"),C("added",{cart:o,lines:r}),c.openCartOnAdd&&X(),o}))},updateLine(t,e){let n=typeof e=="number"?e:e.quantity;if(n!==void 0&&n<=0)return Z.removeLine(t);let r=ce(t,e);return L(async()=>b(await St([r]),"update"))},changeQuantity:Je,quantityOf:Ct,removeLine(t){let e=Array.isArray(t)?t:[t];return L(async()=>b(await J(e),"remove"))},clear(){return L(async()=>{let t=et().map(e=>e.id);return t.length?b(await J(t),"remove"):m()})},setNote(t){return L(async()=>b(await T({name:"cartNoteUpdate",variable:"note",type:"String!",value:t??"",create:!0}),"note"))},setAttributes(t){return L(async()=>{let e=await T({name:"cartAttributesUpdate",variable:"attributes",type:"[AttributeInput!]!",value:tn(t),create:!0});return b(e,"attributes")})},setDiscountCodes(t){return L(async()=>{let e=await T({name:"cartDiscountCodesUpdate",variable:"discountCodes",type:"[String!]!",value:Ze(t),create:!0});return b(e,"discount")})},async applyDiscount(t){let e=t.trim();if(!e)throw new h("No discount code",{code:"INVALID_DISCOUNT"});let n=await Z.setDiscountCodes(i=>[...new Set([...i,e])]),r=e.toLowerCase();if((n?.discountCodes??[]).find(i=>i.code.toLowerCase()===r)?.applicable)return n;try{await Z.removeDiscount(e)}catch(i){w(i,"removing a discount code Shopify refused")}throw new h(`Discount code not valid: ${e}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let e=t.trim().toLowerCase();return Z.setDiscountCodes(n=>n.filter(r=>r.toLowerCase()!==e))},setBuyerIdentity(t,{create:e=!0}={}){return L(async()=>{let n=await T({name:"cartBuyerIdentityUpdate",variable:"buyerIdentity",type:"CartBuyerIdentityInput!",value:t,create:e}).catch(r=>{if(e||!z(r))throw r;return null});return b(n,"buyer-identity")})},checkout:fe,drawers:E,isOpen:S,open:X,close:ut,toggle:Nt};export{ve as a,ct as b,lt as c,cn as d,mt as e,pt as f,Gt as g,Z as h};
@@ -0,0 +1 @@
1
+ var e={diagnose:()=>import("./diagnose-IOC3BCP5.js"),markets:()=>import("./markets-ui-B3ILTPN7.js"),search:()=>import("./search-QN457Q2G.js"),lists:()=>import("./lists-35SUHUOX.js"),extras:()=>import("./extras-5E72QFSJ.js"),account:()=>import("./account-QFGF5FKX.js"),"account-pages":()=>import("./account-pages-LMGIPFB7.js"),analytics:()=>import("./analytics-YSTR6H2W.js")},a=t=>e[t](),o=void 0;export{a,o as b};
@@ -1 +1 @@
1
- import{D as g,G as E,I as N,a as L,n as l,o as u,q as d,x as k,z as w}from"./chunk-BRI56DD5.js";import{d as x,e as o,f as y,g as i,i as A,j as h,k as T,l as f}from"./chunk-X2HBGPFB.js";function q(t){let e=i(o(t,"amount")),n=i(o(t,"currencyCode"));return e===null||n===null?null:{amount:e,currencyCode:n}}function S(t){let e=i(o(t,"url"));return e===null?null:{url:e,altText:i(o(t,"altText"))}}var U=t=>({title:i(o(t,"title")),variantTitle:i(o(t,"variantTitle")),quantity:A(o(t,"quantity")),image:S(o(t,"image"))}),H=(t,e)=>({id:e,name:i(o(t,"name")),processedAt:i(o(t,"processedAt")),financialStatus:i(o(t,"financialStatus")),fulfillmentStatus:i(o(t,"fulfillmentStatus")),statusPageUrl:i(o(t,"statusPageUrl")),totalPrice:q(o(t,"totalPrice")),lineItems:T(o(t,"lineItems"),U)});function R(t){let e=[];for(let n of y(t)){let r=i(o(n,"id"));if(r===null)return{kind:"missing-id"};e.push(H(n,r))}return{kind:"read",orders:e}}var I=t=>new L(`Customer accounts: the answer has no ${t}`);function G(t,e){let n=i(t);if(!n)throw I(e);return n}function J(t){let e=x(t)?t:{},n=i(e.id),r=i(e.email),s=e.address;return{...n===null?{}:{id:n},firstName:i(e.firstName),lastName:i(e.lastName),displayName:i(e.displayName),emailAddress:r===null?null:{emailAddress:r},defaultAddress:Array.isArray(s)?{formatted:f(s)}:null}}function K(t){let e=R(t);if(e.kind==="missing-id")throw I("order id");return e.orders}function D(t){let e=i(o(t,"message"));if(e===null)return null;let n=o(t,"field");return{message:e,field:Array.isArray(n)?f(n):null,code:i(o(t,"code"))}}var Q=t=>h(t,D).filter(e=>e!==null);function P(t,e,n){d(t,l(e)).forEach(r=>{let s=u(r,e)??"";Object.hasOwn(n,s)&&N(r,n[s]===!0)})}var b=(t,e)=>d(t,l(e)).concat(t.matches(l(e))?[t]:[]),Y=t=>t?t.toLowerCase().replace(/_/g," "):"",v=t=>(t?.formatted??[]).join(", "),M=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0;var j=(t,e)=>({title:t.title||t.name||"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:g(t.price),total:g(t.totalPrice),sku:t.sku||"",returnable:e===null?void 0:String(e)}),F=t=>t.tagName==="INPUT";function V(t,e,n){P(t,"order-line-show",{returnable:n>0}),d(t,l("return-quantity")).forEach(r=>{F(r)&&(r.max=String(n),r.min="0",r.value||(r.value="0"),r.disabled=n<1)}),d(t,`select${l("return-reason")}`).forEach(r=>{r.dataset.tetherFilled!==e.id&&(r.dataset.tetherFilled=e.id,(e.suggestedReturnReasonDefinitions?.nodes??[]).forEach(s=>{r.appendChild(new Option(s.name??"",s.id))}))})}function rt(t,e,n){w(t,e,(r,s)=>{let a=s.id,c=n&&a?n.get(a)??0:null;a&&(r.dataset.tetherLine=a);let C=j(s,c);b(r,"order-line").forEach(m=>{let p=u(m,"order-line")??"";if(p==="image"){s.image&&k(m,s.image.url,s.image.altText||s.title||"");return}let O=M(C,p);O!==void 0&&E(m,O)}),a&&c!==null&&V(r,{...s,id:a},c)})}export{q as a,S as b,U as c,I as d,G as e,J as f,K as g,Q as h,P as i,b as j,Y as k,v as l,M as m,rt as n};
1
+ import{D as g,G as E,I as N,a as L,n as l,o as u,q as d,x as k,z as w}from"./chunk-B7SC7UOJ.js";import{d as x,e as o,f as y,g as i,i as A,j as h,k as T,l as f}from"./chunk-QUBBZNJ7.js";function q(t){let e=i(o(t,"amount")),n=i(o(t,"currencyCode"));return e===null||n===null?null:{amount:e,currencyCode:n}}function S(t){let e=i(o(t,"url"));return e===null?null:{url:e,altText:i(o(t,"altText"))}}var U=t=>({title:i(o(t,"title")),variantTitle:i(o(t,"variantTitle")),quantity:A(o(t,"quantity")),image:S(o(t,"image"))}),H=(t,e)=>({id:e,name:i(o(t,"name")),processedAt:i(o(t,"processedAt")),financialStatus:i(o(t,"financialStatus")),fulfillmentStatus:i(o(t,"fulfillmentStatus")),statusPageUrl:i(o(t,"statusPageUrl")),totalPrice:q(o(t,"totalPrice")),lineItems:T(o(t,"lineItems"),U)});function R(t){let e=[];for(let n of y(t)){let r=i(o(n,"id"));if(r===null)return{kind:"missing-id"};e.push(H(n,r))}return{kind:"read",orders:e}}var I=t=>new L(`Customer accounts: the answer has no ${t}`);function G(t,e){let n=i(t);if(!n)throw I(e);return n}function J(t){let e=x(t)?t:{},n=i(e.id),r=i(e.email),s=e.address;return{...n===null?{}:{id:n},firstName:i(e.firstName),lastName:i(e.lastName),displayName:i(e.displayName),emailAddress:r===null?null:{emailAddress:r},defaultAddress:Array.isArray(s)?{formatted:f(s)}:null}}function K(t){let e=R(t);if(e.kind==="missing-id")throw I("order id");return e.orders}function D(t){let e=i(o(t,"message"));if(e===null)return null;let n=o(t,"field");return{message:e,field:Array.isArray(n)?f(n):null,code:i(o(t,"code"))}}var Q=t=>h(t,D).filter(e=>e!==null);function P(t,e,n){d(t,l(e)).forEach(r=>{let s=u(r,e)??"";Object.hasOwn(n,s)&&N(r,n[s]===!0)})}var b=(t,e)=>d(t,l(e)).concat(t.matches(l(e))?[t]:[]),Y=t=>t?t.toLowerCase().replace(/_/g," "):"",v=t=>(t?.formatted??[]).join(", "),M=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0;var j=(t,e)=>({title:t.title||t.name||"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:g(t.price),total:g(t.totalPrice),sku:t.sku||"",returnable:e===null?void 0:String(e)}),F=t=>t.tagName==="INPUT";function V(t,e,n){P(t,"order-line-show",{returnable:n>0}),d(t,l("return-quantity")).forEach(r=>{F(r)&&(r.max=String(n),r.min="0",r.value||(r.value="0"),r.disabled=n<1)}),d(t,`select${l("return-reason")}`).forEach(r=>{r.dataset.tetherFilled!==e.id&&(r.dataset.tetherFilled=e.id,(e.suggestedReturnReasonDefinitions?.nodes??[]).forEach(s=>{r.appendChild(new Option(s.name??"",s.id))}))})}function rt(t,e,n){w(t,e,(r,s)=>{let a=s.id,c=n&&a?n.get(a)??0:null;a&&(r.dataset.tetherLine=a);let C=j(s,c);b(r,"order-line").forEach(m=>{let p=u(m,"order-line")??"";if(p==="image"){s.image&&k(m,s.image.url,s.image.altText||s.title||"");return}let O=M(C,p);O!==void 0&&E(m,O)}),a&&c!==null&&V(r,{...s,id:a},c)})}export{q as a,S as b,U as c,I as d,G as e,J as f,K as g,Q as h,P as i,b as j,Y as k,v as l,M as m,rt as n};
@@ -0,0 +1 @@
1
+ var A=Object.defineProperty;var W=(n,e,t)=>e in n?A(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var vn=(n,e)=>{for(var t in e)A(n,t,{get:e[t],enumerable:!0})};var Bn=(n,e,t)=>W(n,typeof e!="symbol"?e+"":e,t);var q=/^(\d{4})-(01|04|07|10)$/;function T(n){let e=q.exec(typeof n=="string"?n:"");return e?{year:Number(e[1]),month:Number(e[2])}:null}var R=n=>T(n)!==null,X=(n,e)=>`${n}-${String(e).padStart(2,"0")}`;function E(n,e=1){let t=T(n);if(!t)throw new Error(`not a quarterly Shopify API version: ${n}`);let o=t.year*4+(t.month-1)/3+e;return X(Math.floor(o/4),o%4*3+1)}function qn(n,e=new Date){if(n==="unstable")return{version:n,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let t=T(n);if(!t)return{version:n,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let o=new Date(Date.UTC(t.year,t.month-1,1)),r=new Date(Date.UTC(t.year,t.month-1+12,1)),i=(r.getTime()-e.getTime())/2630016e3,d=o<=e,l=`supported until about ${r.toISOString().slice(0,7)}`;return d?i<=0?l="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see docs/reference.md)":i<3&&(l=`${l}: plan the upgrade to ${E(n)} or later (see docs/reference.md)`):l="not released yet (release candidate at best)",{version:n,ok:d&&i>0,monthsLeft:Math.round(i),next:E(n),note:l}}function k(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function J(n,e){return k(n)?n[e]:void 0}function nn(n){return Array.isArray(n)?n:[]}function en(n){return typeof n=="string"&&n!==""?n:null}var tn=n=>typeof n=="number"&&Number.isFinite(n)?n:null,Jn=n=>tn(n)??0,_=(n,e)=>nn(n).map(t=>e(t)),ne=(n,e)=>({nodes:_(J(n,"nodes"),e)}),ee=n=>_(n,en).filter(e=>e!==null);var on=/^[A-Z]{2}$/,rn=new Set(["XX","T1"]),sn=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),an=/^[A-Z]{2,3}$/;function h(n){let e=(typeof n=="string"?n:"").trim().toUpperCase();return!on.test(e)||rn.has(e)?null:e}function w(n){let e=(typeof n=="string"?n:"").trim().replace("-","_").toUpperCase();if(sn.has(e))return e;let t=e.split("_")[0]??"";return an.test(t)?t:null}var se={domain:["PUBLIC_SHOPIFY_DOMAIN","PUBLIC_SHOPIFY_STORE_DOMAIN","SHOPIFY_DOMAIN"],token:["PUBLIC_SHOPIFY_STOREFRONT_TOKEN","PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN","SHOPIFY_STOREFRONT_TOKEN"]};function ae(n){if(typeof n!="string")return!1;try{return new URL(n).protocol==="https:"}catch{return!1}}function ue(n){return/^shp[a-z]{2}_/.test(n.trim())}function ce(n,e){if(!n)return"";let t=parseFloat(n.amount);if(Number.isNaN(t))return"";try{return new Intl.NumberFormat(e||void 0,{style:"currency",currency:n.currencyCode}).format(t)}catch{return`${n.currencyCode} ${t.toFixed(2)}`}}function le(n,e,t){if(!/\{(handle|id)\}/.test(n))return e?`${n.replace(/\/$/,"")}/${encodeURIComponent(e)}`:null;let o=t?t.split("/").at(-1)??"":"";return n.includes("{handle}")&&!e||n.includes("{id}")&&!o?null:n.replace(/\{handle\}/g,encodeURIComponent(e??"")).replace(/\{id\}/g,encodeURIComponent(o))}function fe(n){let e=String(n??"").trim();return e?e.startsWith("gid://")?e:/^\d+$/.test(e)?`gid://shopify/Product/${e}`:/\/products\/([^/?#]+)/.exec(e)?.[1]??e:null}var N="2026-07";var un=/^[A-Za-z0-9_.-]+$/,cn=/^(\$app(:[A-Za-z0-9_-]+)?|[A-Za-z0-9_.-]+)$/,x=(n,e)=>cn.test(n)&&un.test(e);function P(n){let e=n.indexOf(".");if(e<=0)return null;let t=n.slice(0,e),o=n.slice(e+1);return x(t,o)?{namespace:t,key:o}:null}var ln=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,fn=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,dn=/^[A-Za-z_$][\w$]*$/,M="https://site.invalid",pn=new Set(["localhost","127.0.0.1","[::1]"]),L=["saved","server","webflow"],gn=["no-banner","default-banner","custom-banner"],y=n=>typeof n=="string"&&n!=="",yn=n=>typeof n=="function";function U(n,e){if(typeof n!="string"||!n)return"";let t=n.replace(/^https?:\/\//,"").replace(/\/.*$/,"");return Cn(t)?t:(e("domain",n),"")}function F(n){if(!y(n))return!1;try{let e=new URL(n,`${M}/`);return e.origin===M?!0:e.protocol==="https:"||e.protocol==="http:"&&pn.has(e.hostname)}catch{return!1}}function $(n,e){return n==null||n===""?null:typeof n=="string"&&(F(n)||mn(n))?n:(e("partsUrl",n),null)}function mn(n){if(typeof location>"u")return!1;try{return new URL(n).origin===location.origin}catch{return!1}}function On(n){if(typeof n!="string")return null;try{let e=new URL(n);return e.protocol==="https:"&&e.href===new URL(e.origin).href?e.origin:null}catch{return null}}function V(n,e){if(!Array.isArray(n))return e("embedOrigins",n),[];let t=[],o=n;for(let r of o){let i=On(r);i?t.push(i):e("embedOrigin",r)}return t}function kn(n){if(typeof n=="string")return P(n);if(typeof n!="object"||n===null)return null;let e=Reflect.get(n,"namespace"),t=Reflect.get(n,"key");return typeof e!="string"||typeof t!="string"?null:x(e,t)?{namespace:e,key:t}:null}function D(n,e){if(!Array.isArray(n))return e("metafields",n),[];let t=[],o=n;for(let r of o){let i=kn(r);i?t.push(typeof r=="string"?r:i):e("metafield",r)}return t}var p=n=>e=>n(e)?e:void 0,Cn=n=>y(n)&&ln.test(n),Tn=n=>y(n)&&fn.test(n),hn=n=>typeof n=="boolean"||y(n)&&dn.test(n),g=p(F),C=p(y),I=p(n=>typeof n=="boolean"),H=p(yn);function m(n,e,t,o){if(e==null)return null;if(!k(e))return o(n,e),null;let r={};for(let i in t){let d=e[i];if(d===void 0)continue;let l=t[i](d);l===void 0?o(`${n}.${i}`,d):r[i]=l}return r}var wn={server:g,orderUrl:g,subscriptionsUrl:g,paymentUrl:g,logoutUrl:g,locale:C,navigate:H},xn="customer accounts need the Worker since 0.7.0: set account.server",bn={country:C,language:C,locale:C},Sn={detect:n=>{if(typeof n=="boolean")return n;let e=Array.isArray(n)?n:[n];return typeof n=="string"||Array.isArray(n)?L.filter(t=>e.includes(t)):void 0},locales:n=>{if(!k(n))return;let e={};for(let[t,o]of Object.entries(n)){let r=m(`markets.locales.${t}`,o,bn,()=>{});r&&(e[t]=r)}return e},cookie:p(Tn),remember:I,strict:I},An={consent:n=>gn.find(e=>e===n),proxy:n=>n!==void 0&&!!n},En={dataLayer:p(hn),shopify:n=>typeof n=="boolean"?n:m("analytics.shopify",n,An,()=>{})??void 0,onEvent:H};function K(n,e,t){let o=m("account",n,wn,e);if(o===null)return null;let{server:r}=o;return r===void 0?(t(xn),null):{...o,server:r}}var b=(n,e)=>m("markets",n,Sn,e),Y=(n,e)=>m("analytics",n,En,e);var u={domain:"",token:"",apiVersion:N,country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],embedOrigins:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,requestTimeout:15e3,revalidate:!0,storageKey:"",cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",variantUrl:!1,maxAge:60,lowStock:5,searchDelay:150,autoMount:!0,observe:!1,astro:!0,partsUrl:null,analytics:null,account:null,warningText:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},a={...u};function S(n){return c(`Tether.config is read-only (${String(n)}): pass options to Tether.init() instead`),!1}var G=new WeakMap,B={get:(n,e)=>j(Reflect.get(n,e)),getOwnPropertyDescriptor(n,e){let t=Reflect.getOwnPropertyDescriptor(n,e);return t&&(t.value=j(t.value)),t},set:(n,e)=>S(e),deleteProperty:(n,e)=>S(e),defineProperty:(n,e)=>S(e)};function j(n){return typeof n=="object"&&n!==null?_n(n):n}function _n(n){let e=G.get(n);return e||(e=new Proxy(n,B),G.set(n,e)),e}var xe=new Proxy(a,B),Nn=/^[a-z][a-z0-9-]*$/,Pn=["revalidate","openCartOnAdd","cartFocus","variantUrl","autoMount","observe","astro","debug"],Mn=["token","productPath","collectionPath"],In=["imagesFirst","variantsFirst","sellingPlanGroupsFirst","sellingPlansFirst","collectionFirst","retries","requestTimeout","maxAge","lowStock","searchDelay"],Ln=["warningText","formatMoney","onLayoutChange","onCartOpen","onCartClose","onLineEnter","onLineLeave","onValueChange","onError"];function f(n,e,t){return e!==void 0&&c(`invalid ${n} ${JSON.stringify(e)}: using ${JSON.stringify(t)}`),t}function s(n,e){c(`invalid ${n} ${JSON.stringify(e)}: ignored`)}function Un(n){for(let e of Object.keys(n))Object.hasOwn(u,e)||c(`unknown option ${JSON.stringify(e)}: ignored`)}function Fn(n,e,t){typeof t=="function"?n[e]=t:t!=null&&s(e,t)}var z=2147483647,$n=10,O={min:1,max:250},Vn={imagesFirst:O,variantsFirst:O,sellingPlanGroupsFirst:O,sellingPlansFirst:O,collectionFirst:O,requestTimeout:{max:z},searchDelay:{max:z},retries:{max:$n}};function Dn(n,e){let{min:t=0,max:o}=Vn[n]??{};return typeof e!="number"||!Number.isInteger(e)||e<t?f(n,e,u[n]):o===void 0||e<=o?e:(c(`${n} ${String(e)} is more than its maximum: using ${String(o)}`),o)}function Hn(n,e){return typeof e=="boolean"?e:f(n,e,u[n])}function Kn(n,e){return typeof e=="string"?e:f(n,e,u[n])}var Yn=/^\S+$/;function Gn(n,e){return typeof e=="string"&&Yn.test(e)?e:f(n,e,u[n])}function jn(n){if(!(n==null||n==="")){try{if(typeof n=="string"&&Intl.getCanonicalLocales(n).length)return n}catch{}s("locale",n)}}function Z(n,e,t){return t.find(o=>o===e)??f(n,e,t[0])}function zn(n){return n==="unstable"?(c('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),n):R(n)?n:f("apiVersion",n,u.apiVersion)}function Q(n,e,t){if(e==null||e==="")return;let o=t(e);if(o!==null)return o;s(n,e)}function Zn(n){Un(n);let e=U(n.domain,s),t=typeof n.prefix=="string"&&Nn.test(n.prefix)?n.prefix:f("prefix",n.prefix,u.prefix),o={...u,domain:e,apiVersion:zn(n.apiVersion),country:Q("country",n.country,h),locale:jn(n.locale),partsUrl:$(n.partsUrl,s),language:Q("language",n.language,w),markets:b(n.markets,s),analytics:Y(n.analytics,s),account:K(n.account,s,c),prefix:t,storageKey:typeof n.storageKey=="string"&&n.storageKey?n.storageKey:`${t}:cart:${e}`,metafields:D(n.metafields??[],s),embedOrigins:V(n.embedOrigins??[],s),checkoutTarget:Z("checkoutTarget",n.checkoutTarget,["_self","_blank"]),defaultPurchase:Z("defaultPurchase",n.defaultPurchase,["one-time","subscription"]),cartDrawerOpenClass:Gn("cartDrawerOpenClass",n.cartDrawerOpenClass)};for(let r of In)o[r]=Dn(r,n[r]);for(let r of Pn)o[r]=Hn(r,n[r]);for(let r of Mn)o[r]=Kn(r,n[r]);for(let r of Ln)Fn(o,r,n[r]);return o}var be=n=>b(n,s);function Se(n={}){let e=Zn(n);for(let t of Object.keys(a))t in e||Reflect.deleteProperty(a,t);return Object.assign(a,e)}var Ae=()=>!!(a.domain&&a.token);function Ee(...n){a.debug&&console.log(`[${a.prefix}]`,...n)}function c(...n){console.warn(`[${a.prefix}]`,...n)}function Qn(n,e){if(c(e,n instanceof Error&&n.message?n.message:n),!!a.onError)try{a.onError(n,e)}catch(t){c("onError threw",t)}}var v=new Set;function Re(n,e,t){try{return e()}catch(o){let r=o instanceof Error&&`${n}: ${o.message}`;return(!r||!v.has(r))&&(r&&v.add(r),Qn(o,n)),t?.()}}function Pe(n){return n instanceof Error?n.message:String(n)}export{vn as a,Bn as b,qn as c,k as d,J as e,nn as f,en as g,tn as h,Jn as i,_ as j,ne as k,ee as l,L as m,kn as n,h as o,w as p,se as q,ae as r,ue as s,ce as t,le as u,fe as v,u as w,a as x,xe as y,Zn as z,be as A,Se as B,Ae as C,Ee as D,c as E,Qn as F,Re as G,Pe as H};
@@ -0,0 +1 @@
1
+ import{b as c,c as u,d as o}from"./chunk-B7SC7UOJ.js";import{d as m,e as s,n as g,x as p}from"./chunk-QUBBZNJ7.js";var n="url altText width height";function v(){return` id handle title description descriptionHtml image{${n}}seo{title description}`}var d={amount:"string",currencyCode:"string"},a={id:"string",handle:"string",title:"string",options:["object"],images:{nodes:["object"]},priceRange:{minVariantPrice:d,maxVariantPrice:d},variants:{nodes:[{id:"string",price:d,selectedOptions:["object"]}]}},P={nodes:[a],pageInfo:{hasNextPage:"boolean"}},F=t=>s(t,"id")!==""&&s(t,"handle")!==""&&c(t,a),I=t=>m(t)&&(t.id===void 0||c(t,a)),M=o({collection:u({handle:"string",products:P})}),j=o({products:P}),O=o({productRecommendations:u([a])});var e="amount currencyCode",f={inventory:!0},y=t=>t.inventory?"quantityAvailable":"";function A(t){let i=[];for(let l of t){let r=g(l);r&&i.push(r)}return i.length?`metafields(identifiers:[${i.map(({namespace:l,key:r})=>`{namespace: ${JSON.stringify(l)}, key: ${JSON.stringify(r)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${n}}}}}`:""}var h=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${e}}}... on SellingPlanFixedPriceAdjustment{price{${e}}}}}`,$=` sellingPlan{id}checkoutChargeAmount{${e}}remainingBalanceChargeAmount{${e}}priceAdjustments{price{${e}}compareAtPrice{${e}}perDeliveryPrice{${e}}unitPrice{${e}}}`;function D(t=p,i=f){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${n}}images(first:${t.imagesFirst}){nodes{${n}}}options{name optionValues{name swatch{color image{previewImage{${n}}}}}}priceRange{minVariantPrice{${e}}maxVariantPrice{${e}}}compareAtPriceRange{minVariantPrice{${e}}maxVariantPrice{${e}}}${A(t.metafields)} sellingPlanGroups(first:${t.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${t.sellingPlansFirst}){nodes{${h}}}}}variants(first:${t.variantsFirst}){nodes{id title availableForSale currentlyNotInStock ${y(i)} sku barcode selectedOptions{name value}image{${n}}price{${e}}compareAtPrice{${e}}unitPrice{${e}}sellingPlanAllocations(first:${t.sellingPlansFirst}){nodes{${$}}}}}}`}function w(t=f){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${e}}totalAmount{${e}}checkoutChargeAmount{${e}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${e}}subtotalAmount{${e}}amountPerQuantity{${e}}compareAtAmountPerQuantity{${e}}}discountAllocations{discountedAmount{${e}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${e}}priceAdjustments{price{${e}}compareAtPrice{${e}}perDeliveryPrice{${e}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping ${y(t)} image{${n}}price{${e}}compareAtPrice{${e}}selectedOptions{name value}product{id title handle vendor featuredImage{${n}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}export{v as a,D as b,w as c,d,a as e,F as f,I as g,M as h,j as i,O as j};