@occluze/tether 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/esm/astro.js +1 -1
- package/dist/esm/chunks/{account-2467DHLU.js → account-GZLRHV5Z.js} +1 -1
- package/dist/esm/chunks/{account-pages-X7U3E7D7.js → account-pages-32IFOHYU.js} +1 -1
- package/dist/esm/chunks/{analytics-TF7M4KI2.js → analytics-OIQ4TFGM.js} +1 -1
- package/dist/esm/chunks/chunk-33IQL4XN.js +1 -0
- package/dist/esm/chunks/{chunk-I7XE7GQR.js → chunk-AMCCY6T4.js} +1 -1
- package/dist/esm/chunks/chunk-COXH5OXQ.js +1 -0
- package/dist/esm/chunks/{chunk-646NGAEM.js → chunk-DQJRQBJG.js} +1 -1
- package/dist/esm/chunks/chunk-ESYKAFMU.js +1 -0
- package/dist/esm/chunks/chunk-HO6SNO3A.js +1 -0
- package/dist/esm/chunks/{chunk-UM37ZVSP.js → chunk-HZYW2TS3.js} +1 -1
- package/dist/esm/chunks/{chunk-EYVBEFKK.js → chunk-JJVUNGJZ.js} +1 -1
- package/dist/esm/chunks/{chunk-F3OXGENC.js → chunk-KW7UPDXI.js} +1 -1
- package/dist/esm/chunks/chunk-LZINCBME.js +1 -0
- package/dist/esm/chunks/{chunk-6FWNC7QH.js → chunk-NOTL72DB.js} +1 -1
- package/dist/esm/chunks/{chunk-4QINHHE4.js → chunk-TES2AUFT.js} +1 -1
- package/dist/esm/chunks/{chunk-HEK66LYK.js → chunk-TUVLYVMF.js} +1 -1
- package/dist/esm/chunks/{chunk-AHYDU7Z6.js → chunk-U5BYAOTP.js} +1 -1
- package/dist/esm/chunks/{chunk-B2X6ZOKA.js → chunk-UDJ62MPR.js} +1 -1
- package/dist/esm/chunks/chunk-UU2VVXU2.js +1 -0
- package/dist/esm/chunks/{diagnose-AOSBLXOJ.js → diagnose-QTIUBMXT.js} +1 -1
- package/dist/esm/chunks/extras-56DC6CHI.js +1 -0
- package/dist/esm/chunks/{lists-UJMD7BCQ.js → lists-SE5VBQ4K.js} +1 -1
- package/dist/esm/chunks/{markets-ui-PTAY3FHU.js → markets-ui-GQOUGLUL.js} +1 -1
- package/dist/esm/chunks/{search-G2SRQXDG.js → search-ZAB5GJOK.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/server.js +1 -1
- package/dist/tether.extras.js +32 -10
- package/dist/tether.extras.min.js +1 -1
- package/dist/tether.js +72 -38
- package/dist/tether.min.js +1 -1
- package/dist/tether.min.js.map +3 -3
- package/dist/types/src/cart/store.d.ts +1 -1
- package/dist/types/src/cart.d.ts +1 -1
- package/dist/types/src/dom.d.ts +7 -5
- package/dist/types/src/extras.d.ts +2 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/chunks/chunk-5TS6IBBB.js +0 -1
- package/dist/esm/chunks/chunk-67MCLHFS.js +0 -1
- package/dist/esm/chunks/chunk-C2GKO34C.js +0 -1
- package/dist/esm/chunks/chunk-KIZBET7N.js +0 -1
- package/dist/esm/chunks/chunk-UJYL5G7T.js +0 -1
- package/dist/esm/chunks/chunk-YW3ZIFWB.js +0 -1
- package/dist/esm/chunks/extras-THTXX76O.js +0 -1
|
@@ -175,7 +175,7 @@ export declare function showLastKnownCount(): void;
|
|
|
175
175
|
export declare function setWarnings(notes: readonly CartWarning[]): void;
|
|
176
176
|
/** @returns A runner that starts each task once the one before has settled, whether it succeeded or failed. */
|
|
177
177
|
export declare function serial(): <T>(task: () => Promise<T>) => Promise<T>;
|
|
178
|
-
/** The one queue every cart change runs through;
|
|
178
|
+
/** The one queue every cart change runs through; checkout waits for the changes in it. */
|
|
179
179
|
export declare const runInOrder: <T>(task: () => Promise<T>) => Promise<T>;
|
|
180
180
|
/**
|
|
181
181
|
* Runs a cart change after the ones before it, so quick clicks never race. A failure sets the `error` status (shown by
|
package/dist/types/src/cart.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export declare const Cart: {
|
|
|
82
82
|
/**
|
|
83
83
|
* Adds a code. A code Shopify doesn't accept is removed again, so it doesn't warn on every later change.
|
|
84
84
|
*
|
|
85
|
-
* @throws {TetherError} `INVALID_DISCOUNT` (rejected) when Shopify doesn't accept the code.
|
|
85
|
+
* @throws {TetherError} `INVALID_DISCOUNT` (rejected) when Shopify doesn't accept the code, or it is blank.
|
|
86
86
|
*/
|
|
87
87
|
applyDiscount(typed: string): Promise<ShopifyCart | null>;
|
|
88
88
|
removeDiscount(code: string): Promise<ShopifyCart | null>;
|
package/dist/types/src/dom.d.ts
CHANGED
|
@@ -36,15 +36,17 @@ export declare function show(el: HTMLElement, visible: boolean): void;
|
|
|
36
36
|
/**
|
|
37
37
|
* Marks an option element as chosen: `is-selected`, the ARIA state its role takes (`chosenState`), and its own or
|
|
38
38
|
* inner radio/checkbox. An element that is no button and has no role of its own (a Webflow button is a link) gets
|
|
39
|
-
* `role="button"`, where `aria-pressed` is valid
|
|
39
|
+
* `role="button"`, where `aria-pressed` is valid, and a place in the Tab order unless it has its own `tabindex`; the
|
|
40
|
+
* product's events press it with Enter and Space.
|
|
40
41
|
*/
|
|
41
42
|
export declare function setSelected(el: Element, selected: boolean): void;
|
|
42
43
|
/**
|
|
43
|
-
* Marks an option element the visitor can't buy: `is-unavailable`, and
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* Marks an option element the visitor can't buy: `is-unavailable`, and the state assistive technology reads on the
|
|
45
|
+
* control, the element itself or the radio/checkbox inside it. A plan or purchase toggle the variant can't use does
|
|
46
|
+
* nothing when chosen, so it is `aria-disabled`. An option value still works, choosing it picks the closest variant
|
|
47
|
+
* that has it, so it isn't disabled: it is described as unavailable (`describeUnavailable`).
|
|
46
48
|
*/
|
|
47
|
-
export declare function setUnavailable(el: Element, unavailable: boolean): void;
|
|
49
|
+
export declare function setUnavailable(el: Element, unavailable: boolean, choosing: 'does-nothing' | 'picks-closest'): void;
|
|
48
50
|
/**
|
|
49
51
|
* A global the page's own scripts set on `window`: `TETHER_CONFIG`, the site's config, `TETHER_INTEGRATION`, set by a
|
|
50
52
|
* framework integration (Astro) that starts Tether itself, and GSAP's `ScrollTrigger`. Another script wrote it, so it
|
|
@@ -6,6 +6,8 @@ import type { ShopifyCart } from './cart/store.js';
|
|
|
6
6
|
* @returns The cart, `null` with nothing to add or after a reported failure.
|
|
7
7
|
*/
|
|
8
8
|
export declare function addGroup(button: Element): Promise<ShopifyCart | null>;
|
|
9
|
+
/** Applies the code a `tether-discount-form` submitted; one Shopify refuses marks the form `is-invalid`. */
|
|
10
|
+
export declare function applyDiscountCode(form: Element, input: HTMLInputElement | null, code: string): Promise<void>;
|
|
9
11
|
/** Another tab changed the cart (it is loaded again here) or the visitor's market (this tab follows it). */
|
|
10
12
|
export declare function onStorage(event: StorageEvent): void;
|
|
11
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.9.
|
|
1
|
+
export declare const VERSION = "0.9.6";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@occluze/tether",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Free, open-source alternative to Smootify and Storesynk (Shopyflow): Shopify products, cart and subscriptions in Webflow with HTML attributes. Optional Shopify to Webflow CMS sync.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as j,c as T,d as J,h as K}from"./chunk-KIZBET7N.js";import{a as S,b as W,c as M,d as N,e as X,f as Y,g as _,h as z,i as Z}from"./chunk-F3OXGENC.js";import{d as G,e as A,f as y,k as Q}from"./chunk-646NGAEM.js";import{c as q,f as tt}from"./chunk-UM37ZVSP.js";import{C as H,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 B,S as D,m,n as s,o as l,p as k,q as b,r as $,u as f,x as C}from"./chunk-67MCLHFS.js";import{F as L,b as p,x}from"./chunk-YW3ZIFWB.js";var et={money:O,percent:H},ct=e=>e.tagName==="INPUT";function w(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),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(j(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)}),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));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));q.forEach(i=>n.set(i,i==="ready")),e.$(s("show")).forEach(i=>{let r=l(i,"show")??"",a=n.get(r);a!==void 0&&(q.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}=w(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"){C(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}=w(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))}var at=e=>e==="subscription"?"subscription":"one-time";function gt(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("change",t=>{let{target:n}=t;it(n)&&n.closest(rt())===e.root&>(e,n)})}var bt=new WeakMap,Pt=()=>s("product"),I=new Map;function Et(e){e.forEach(t=>{I.has(t.handle)||I.set(t.handle,t.options.map(n=>n.name))})}var ot=e=>e.tagName==="INPUT",yt=e=>e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA";function Tt(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:yt(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=A(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")||x.defaultPurchase});this.selected=r.selected,this.purchase=r.purchase,this.variant=null,this.quantity=k(t,"quantity")?Math.max(0,parseInt(l(t,"quantity")??"",10)||0):1,bt.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=A(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=$(this.root,t,Pt());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=(I.get(this.product.handle)??[]).indexOf(t);return n[i]?.name??t}get plan(){let t=M(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 N(this.purchase,this.variant).kind==="subscription"}getLine(){if(!this.variant)return null;let t={merchandiseId:this.variant.id,quantity:this.quantity},n=N(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=D(B(this.root,"line-attributes")),n=this.$(s("line-attribute")).flatMap(i=>{let r=Tt(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,M(this.purchase));n.kind!==this.purchase.kind&&(this.purchase=n,this.renderVariant())}selectPlan(t){let n=Q(this.product,t);n&&(this.purchase={kind:"subscription",planId:n.id},this.renderVariant())}setQuantity(t){let n=k(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 K.add(t);return f("product-added",{product:this.product,variant:this.variant,line:t},this.root),n}renderProduct(){let{product:t}=this;I.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))&&Et([t]),J(this)}renderVariant(){let t=_(this.product,{selected:this.selected,purchase:this.purchase,quantity:this.quantity},x.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{bt as a,Et as b,lt as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as L,E as b,F as w,G as W,b as T,d as E,e as v,o as j,p as q,t as B,u as Q,x as c}from"./chunk-YW3ZIFWB.js";var g=class extends Error{constructor(r,{status:n,errors:o,userErrors:i,code:s}={}){super(r);T(this,"name","TetherError");T(this,"code");T(this,"status");T(this,"errors");T(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:St(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 St=t=>Array.isArray(t),qe=t=>e=>e===null||k(e,t),Be=t=>e=>k(e,t);function At(t=c){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var X=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,xt=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function vt(t){return/\bmutation\b/.test(t.replace(X,""))?"mutation":"query"}function Z(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(X,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=xt.exec(i);if(!a)return t;let l=a[0].length;return`${t.slice(0,l).trimEnd()} ${o} ${t.slice(l).trimStart()}`}function Qe(t,e=c){let r=j(e.country)??void 0,n=q(e.language)??void 0;return Z(t,{country:r,language:n})}var _=300,kt=500,Rt=3e4,K=430,Ot=1e3,P="quantityAvailable",z=new Set,Nt=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function Ct(t,e,r,{context:n,operation:o}){let i=typeof e=="string"?e:e(r),s=n?Z(i,t):i;return t.maxAge<=0||o==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*Ot))}`}var Lt=t=>new Promise(e=>setTimeout(e,t));function M(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 It(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 Pt(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(It)}:null}function I(t,e){return t.ok?new g(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new g(M(t.status,e),{status:t.status})}function Y(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?M(t.status,r):o),new g(i,{status:t.status,errors:e,code:n})}function J(t,e){if(e==="any")return{kind:"retry",backoffMs:_};throw new g(`Network error: ${W(t)}`,{code:"NETWORK"})}function _t(t,e,r,n,o,i,s){if(r.includes(P)&&n.some(d=>d.message.includes(P)))return{kind:"inventory-refused",error:Y(t,n,e)};let a=n.map(d=>d.extensions?.code);if(i!=="none"&&a.includes("THROTTLED"))return{kind:"retry",backoffMs:kt};let l=a.includes("INTERNAL_SERVER_ERROR");if(i==="any"&&l)return{kind:"retry",backoffMs:_};let p=t.ok&&(l||s==="mutation"&&o==null);throw Y(t,n,e,p?"SERVER_ERROR":void 0)}async function Mt(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 Ut(t,e,r,n,o,i,s){let a;try{a=await(t.fetch??fetch)(At(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 J(f,o)}if(a.status===K)throw new g("Shopify security rejection (430)",{status:K});if(o!=="none"&&a.status===429||o==="any"&&a.status>=500)return{kind:"retry",backoffMs:_};let l;try{l=await a.json()}catch(f){if(f instanceof SyntaxError)throw I(a,t);return J(f,o)}let p=Pt(l);if(!p)throw I(a,t);let{data:d,errors:h=[]}=p;if(h.length)return _t(a,t,e,h,d,o,i);if(!a.ok)throw new g(M(a.status,t),{status:a.status});if(!n(d))throw I(a,t);return{kind:"data",data:d}}async function tt(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=Nt(t),a=i==="mutation"?"not-run":"any",l=0;for(;;){let p={inventory:!z.has(s)},d=Ct(t,e,p,{context:o,operation:i}),h=l<t.retries?a:"none",f=await Mt(t.requestTimeout,S=>Ut(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;L(`the token can't read inventory: ${P} is left out from now on`),z.add(s);break;case"retry":await Lt(Math.min(f.backoffMs*2**l,Rt)),l+=1,L("retry",l);break}}}function We(t,e,r,n){return tt(c,t,e,r,n)}var Ht=t=>typeof t=="object"&&t!==null;function $t(t,e,r={},n){return tt(t,e,r,Ht,{...n,operation:vt(e)})}function Ke(t,e,r){return $t(c,t,e,r)}function ze(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}`,Dt=(t,e)=>e===void 0?`[${m(t)}]`:`[${m(t)}="${e}"]`,R=(t,e)=>t.getAttribute(m(e)),Ft=(t,e)=>t.hasAttribute(m(e));function et(t,e){return t?[...t.querySelectorAll(e)]:[]}var Vt=(t,e,r)=>et(t,e).filter(n=>n.closest(r)===t),Gt=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],rt=new WeakMap;function nt(t,e){let r=new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0});return rt.set(r,t),r}function jt(t,e){return rt.get(t)===e}function U(t,e,r=document){r.dispatchEvent(nt(t,e))}function it(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 H(t,e){return t.getAttribute(e)??t.getAttribute(m(e))??t.getAttribute(`data-${e}`)}function st(t,e){if(!t||!e)return t;let r=H(e,"max-width"),n=H(e,"max-height");return it(t,{width:r,height:n,crop:r||n?H(e,"crop"):null})}var ot=t=>t.replace(/\?.*$/,"");function at(t,e){return!t||!e?!1:ot(t)===ot(e)}function qt(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 Bt(t,e,r){if(!e)return;let n=st(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=qt(n);return}if(at(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 $=new WeakMap,Qt=t=>!!$.get(t),D=t=>t.cloneNode(!0);function ut(t){let e=$.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?D(r):null;return $.set(t,n),t.replaceChildren(),n}function Wt(t,e,r){let n=ut(t);if(!n){e.length&&b("repeater without a template child",t);return}t.replaceChildren(),e.forEach((o,i)=>{let s=D(n);r(s,o,i),t.appendChild(s)})}function Kt(t,e){let r=()=>{t.remove()};if(!e){r();return}try{e(t,r)}catch(n){w(n,"repeater onLeave"),r()}}function zt(t,e,r,n){e.forEach((o,i)=>{if(!r.has(o))return;let s=e[i-1];if(s?.parentNode===t?s.after(o):t.prepend(o),!!n)try{n(o)}catch(a){w(a,"repeater onEnter")}})}function Yt(t,e,r,n,{onEnter:o,onLeave:i}={}){let s=ut(t);if(!s){b("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 C=String(r(u,x)),y=d.get(C);y?d.delete(C):(y=D(s),y.setAttribute(a,C),f.add(y)),n(y,u,x,f.has(y)),h.push(y)});let S=h.filter(u=>!f.has(u)),G=p().filter(u=>S.includes(u));if(!(G.length===S.length&&G.every((u,x)=>u===S[x]))){d.forEach(u=>{u.remove()}),h.forEach(u=>t.appendChild(u));return}zt(t,h,f,o),d.forEach(u=>{u.setAttribute(l,""),u.removeAttribute(a),u.style.pointerEvents="none",u.inert=!0,Kt(u,i)})}var Jt="http://www.w3.org/1999/xhtml",Xt=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"]),Zt=new Set(["script","style","template","noscript","textarea","select","title"]),te=new Set(["style","title","lang","dir","role","align","width","height"]),ee=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"])]]),re=new Set(["href","src","poster","cite"]),ne=/^(javascript|vbscript|data):/i,oe=/^data:image\/(png|gif|jpeg|webp|avif);/i,ie=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),se=["inset","transform","translate","rotate","scale","offset"],ae=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,ue=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,ct=40,ce=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:ct}]]),lt=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,le=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,dt=/(?:var|calc|min|max|clamp|env|attr)\(/i,de=/url\(|expression\(|@import/i,fe=/[\u0000- ]/g,pe="allow-scripts allow-same-origin allow-popups allow-presentation",ge=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),me="strict-origin-when-cross-origin",he=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function ye(t,e){return te.has(e)||e.startsWith("aria-")||(ee.get(t)?.has(e)??!1)}function Ee(t,e,r){let n=r.replace(fe,"");return ne.test(n)?t==="img"&&e==="src"&&oe.test(n):!0}function ft(t,e){try{return new URL(t,e)}catch{return null}}function Te(t,e,r){let n=t.baseURI,o=ft(n)?.origin??"null";return{origin:o==="null"?null:o,baseUrl:n,styleParser:e,embedOrigins:new Set([...he,...r])}}function be(t,e){let r=ft(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function we(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>ge.has(r)))].join("; ")}function Se(t,e){if(ie.has(t)||se.some(n=>t.startsWith(n))||ae.test(e))return!0;let r=ce.get(t);return r?dt.test(e)||Ae(e,r):t.startsWith("margin")&&e.includes("-")}function Ae(t,e){return[...t.matchAll(lt)].some(([r="",n=""])=>{let o=parseFloat(r);if(o>=0)return!1;let i=e[n.toLowerCase()];return i===void 0||-o>i})}function xe(t,e){return ue.test(t.replace(/^-webkit-/,""))?dt.test(e)?!0:[...e.replace(le,"").matchAll(lt)].some(([r="",n=""])=>{let o=Math.abs(parseFloat(r));return o!==0&&(n.toLowerCase()!=="px"||o>ct)}):!1}function ve(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);(Se(i,s)||xe(i,s)||de.test(s))&&r.removeProperty(i)}let o=r.cssText;return e.removeAttribute("style"),o}function ke(t,e){let r=t.localName;for(let i of[...t.attributes]){let s=i.name.toLowerCase(),a=re.has(s);ye(r,s)&&(!a||Ee(r,s,i.value))||t.removeAttribute(i.name)}let n=t.getAttribute("style");if(n===null)return;let o=ve(n,e.styleParser);o===""?t.removeAttribute("style"):t.setAttribute("style",o)}var Re=new Set(["","_self","_parent","_top"]);function Oe(t){if(t.localName==="iframe"){let n=we(t.getAttribute("allow")??"");n===""?t.removeAttribute("allow"):t.setAttribute("allow",n),t.setAttribute("sandbox",pe),t.setAttribute("referrerpolicy",me);return}if(t.localName!=="a")return;let e=t.getAttribute("target");if(e===null||Re.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 Ne(t,e){let r=t.localName,n=t.namespaceURI===Jt;if(n&&Zt.has(r)){t.remove();return}if(!n||!Xt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!be(t.getAttribute("src")??"",e)){t.remove();return}ke(t,e),Oe(t)}function pt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let o=Te(e,n,r);for(let i of[...n.content.querySelectorAll("*")])Ne(i,o);return n.content}var gt="data-tether-seen",V="data-tether-shown",O="data-tether-prev-display",Ce=120;function lr(t,e){return Q(c.productPath||"/product",t,e)}function Tt(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function dr(t,e=c.locale){return t?Tt(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function fr(t){return t?c.formatMoney?c.formatMoney(t,c.locale):B(t,c.locale):""}function pr(t){return t?Tt(()=>new Date(t).toLocaleDateString(c.locale||void 0),""):""}function gr(t,e){t.replaceChildren(pt(e,t.ownerDocument,c.embedOrigins))}var bt=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",A=t=>t.tagName==="INPUT";function Le(t,e){let r=e==null?"":String(e);bt(t)?t.value=r:t.textContent=r}var mt=t=>bt(t)?t.value:t.textContent;function mr(t,e){let r=mt(t);if(Le(t,e),r!==mt(t)&&t.hasAttribute(gt)&&c.onValueChange)try{c.onValueChange(t,r)}catch(n){w(n,"onValueChange")}t.setAttribute(gt,"1")}function Ie(t){if(t.hasAttribute(V))return;t.setAttribute(V,""),t.removeAttribute("hidden");let e=t.getAttribute(O);e!==null?(t.style.display=e,t.removeAttribute(O)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(m("display"))||"block")}function hr(t,e){if(e){Ie(t);return}t.removeAttribute(V),!t.hasAttribute(O)&&t.style.display!=="none"&&t.setAttribute(O,t.style.display),t.style.display="none"}var N='input[type="radio"],input[type="checkbox"]',Pe=["radio","checkbox","switch","menuitemradio","menuitemcheckbox"],_e=["button","submit","reset"];function wt(t){let e=t.getAttribute("role");return e==="button"?"aria-pressed":e&&Pe.includes(e)?"aria-checked":e==="option"||e==="tab"?"aria-selected":e?null:A(t)?_e.includes(t.type)?"aria-pressed":null:t.querySelector(N)?null:"aria-pressed"}function yr(t,e){t.classList.toggle("is-selected",e);let r=wt(t);r==="aria-pressed"&&t.tagName!=="BUTTON"&&!A(t)&&t.setAttribute("role","button"),r&&t.setAttribute(r,String(e)),A(t)&&t.matches(N)&&(t.checked=e);let n=t.querySelector(N);n&&A(n)&&(n.checked=e)}function Er(t,e){t.classList.toggle("is-unavailable",e),(wt(t)!==null||A(t)?t:t.querySelector(N))?.setAttribute("aria-disabled",String(e))}var ht,Me=t=>Reflect.get(window,t);function Ue(){let t=Me("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function He(t){clearTimeout(ht),ht=setTimeout(()=>{try{c.onLayoutChange?c.onLayoutChange(t):Ue()}catch(e){w(e,"layout-changed")}U("layout-changed",{reason:t})},Ce)}function Tr(t,e){let r=[...t.querySelectorAll("img")].filter(i=>!i.complete),n=r.length,o=()=>{n-=1,n===0&&He(`${e}:images`)};r.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function br(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 wr(t,e){let r=t?R(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return b(`invalid JSON in ${m(e)}`,t),null}}var $e=/^-?\d+$/,yt=new WeakMap;function Et(t,e,r){let n=yt.get(t)??new Set;yt.set(t,n),!n.has(e)&&(n.add(e),b(`${m(e)} ${r}`,t))}function Sr(t,e,{min:r,max:n,fallback:o}){let i=R(t,e)?.trim();if(!i)return o;let s=$e.test(i)?Number(i):Number.NaN;return Number.isNaN(s)||s<r?(Et(t,e,`${JSON.stringify(i)} is not a whole number from ${String(r)}: using ${String(o)}`),o):n===void 0||s<=n?s:(Et(t,e,`${i} is more than its maximum: using ${String(n)}`),n)}function F(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function Ar(t){return Array.isArray(t)?t.filter(E).map(r=>({key:F(r.key),value:F(r.value)})):E(t)?Object.entries(t).map(([e,r])=>({key:e,value:F(r)})):[]}function xr(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,Be as d,At as e,Qe as f,Mt as g,tt as h,We as i,$t as j,Ke as k,ze as l,m,Dt as n,R as o,Ft as p,et as q,Vt as r,Gt as s,jt as t,U as u,it as v,at as w,Bt as x,Qt as y,Wt as z,Yt as A,lr as B,dr as C,fr as D,pr as E,gr as F,Le as G,mr as H,hr as I,yr as J,Er as K,Me as L,He as M,Tr as N,br as O,wr as P,$e as Q,Sr as R,Ar as S,xr as T};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-UJYL5G7T.js";import{g as r}from"./chunk-UM37ZVSP.js";import{n as e}from"./chunk-67MCLHFS.js";import{F as i}from"./chunk-YW3ZIFWB.js";var d=()=>`${e("collection")},${e("products")},${e("recommendations")}`;function a(t){return r(t,"loading"),{root:t,load:()=>n("lists").then(o=>o.loadList(t)).catch(o=>{r(t,"error",o),i(o,"lists")})}}export{d as a,a as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as kt,d as Q,e as It}from"./chunk-646NGAEM.js";import{c as xt}from"./chunk-I7XE7GQR.js";import{b as tt,d as R}from"./chunk-6FWNC7QH.js";import{A as Lt,B as V,D as v,E as At,F as Pt,G as g,H as E,I as $,M as Et,T as D,a as b,c as q,d as F,i as W,l as bt,m as A,n as s,o as f,p as wt,q as d,u as y,w as St,x as P,y as vt,z as M}from"./chunk-67MCLHFS.js";import{D as Ct,F as S,r as yt,x as c}from"./chunk-YW3ZIFWB.js";var le={id:"string",quantity:"number",attributes:["object"],cost:{totalAmount:R,subtotalAmount:R,amountPerQuantity:R},merchandise:{id:"string",selectedOptions:["object"],product:"object"}},et={id:"string",checkoutUrl:"string",totalQuantity:"number",attributes:["object"],discountCodes:["object"],cost:{totalAmount:R,subtotalAmount:R},lines:{nodes:[le]}};var ce='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',de=60,nt=!1,rt=!1,K=null,Tt=null,me=t=>t!==null&&"focus"in t,Mt=t=>d(t,ce).filter(e=>e.offsetParent!==null||e===document.activeElement),k=()=>d(document,s("cart-drawer")),j=t=>t.classList.contains(c.cartDrawerOpenClass),$t=t=>t.some(e=>e.contains(document.activeElement)),pe=t=>f(t,"cart-drawer")==="manual";function w(){let t=k();return t.length?t.some(j):nt}function fe(t){Tt??(Tt=new MutationObserver(()=>{let e=w();if(e===rt)return;let n=k();e?Ot(n.filter(j)):Rt(n,$t(n))})),Tt.observe(t,{attributes:!0,attributeFilter:["class"]})}function B(){d(document,s("cart-open")).forEach(t=>{t.setAttribute("aria-expanded",String(w()))}),k().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=j(t);t.setAttribute("aria-modal",String(e)),t.setAttribute("aria-hidden",String(!e)),t.inert=!e,fe(t)})}function ge(t){let e=Mt(t)[0]??t;e===t&&!t.hasAttribute("tabindex")&&(t.tabIndex=-1),e.focus({preventScroll:!0})}function Ot(t){rt=!0,B();let[e]=t;c.cartFocus&&e&&(K=me(document.activeElement)?document.activeElement:null,setTimeout(()=>{ge(e)},de)),c.onCartOpen?.(t),y("cart-toggled",{open:!0})}function Rt(t,e){rt=!1,B(),e&&K?.isConnected&&K.focus({preventScroll:!0}),K=null,c.onCartClose?.(t),y("cart-toggled",{open:!1})}function G(){if(w())return;let t=k(),e=t.filter(n=>!pe(n));t.length&&!e.length||(nt=!0,e.forEach(n=>{n.classList.add(c.cartDrawerOpenClass)}),Ot(e))}function it(){if(!w())return;nt=!1;let t=k(),e=$t(t);t.forEach(n=>{n.classList.remove(c.cartDrawerOpenClass)}),Rt(t,e)}function Ut(){w()?it():G()}function he(t){if(t.key!=="Tab"||!c.cartFocus||!w())return;let e=k().find(j);if(!e)return;let n=Mt(e),r=n[0],i=n.at(-1);if(!r||!i)return;let o=document.activeElement,a=t.shiftKey?o===r:o===i;e.contains(o)&&!a||(t.preventDefault(),(t.shiftKey?i:r).focus())}var ye=/^image:(\d+)$/,qt="metafield:",Ce=/^(rich_text|multi_line_text)_field$/,be=["","true","all","*"],at=t=>t.tagName==="SELECT",ot=(t,e)=>t.$(`select${e}`).filter(at);function we(t,e){let n=e.images.nodes,r=[...t.children].map(o=>o.tagName==="IMG"?o:o.querySelector("img"));!vt(t)&&r.length===n.length&&r.every((o,a)=>St(o?.getAttribute("src"),n[a]?.url))||M(t,n,(o,a)=>{let u=o.matches(`img,${s("bind","image")}`)?o:d(o,"img")[0]??o;P(u,a.url,a.altText||e.title)})}function Se(t,e,n){let r=n.indexOf("."),i=n.slice(0,r),o=n.slice(r+1),a=(e.metafields??[]).find(l=>l?.namespace===i&&l.key===o);if(!a){g(t,"");return}let u=a.reference?.image;if(u){P(t,u.url,u.altText);return}Ce.test(a.type)&&(t.style.whiteSpace="pre-line"),g(t,a.value)}var ve=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=>At(t.publishedAt),"min-price":t=>v(t.priceRange.minVariantPrice),"max-price":t=>v(t.priceRange.maxVariantPrice)}));function Le(t,e){let n=(t.getAttribute("exclude")??"").split(",").map(i=>i.trim()).filter(Boolean),r=e.tags.filter(i=>!n.includes(i));M(t,r,(i,o)=>{g(i,o)})}function Ae(t,e,n){let r=ve.get(e);if(r){g(t,r(n));return}switch(e){case"description":Pt(t,n.descriptionHtml);break;case"featured-image":P(t,n.featuredImage?.url,n.featuredImage?.altText||n.title);break;case"url":case"link":{let i=V(n.handle,n.id);i&&t.setAttribute("href",i),e==="url"&&!t.firstElementChild&&!t.textContent.trim()&&g(t,n.title);break}case"images":we(t,n);break;case"tags":Le(t,n);break;default:Pe(t,e,n)}}function Pe(t,e,n){let r=ye.exec(e);if(r){let i=n.images.nodes[Number(r[1])-1]??n.featuredImage;P(t,i?.url,i?.altText||n.title)}else e.startsWith(qt)&&Se(t,n,e.slice(qt.length))}function Ee(t){let{product:e}=t;t.$(s("option-list")).forEach(n=>{let r=t.optName(f(n,"option-list")),i=e.options.find(o=>o.name===r);if(!i||i.optionValues.length<=1&&wt(n,"hide-single")){$(n,!1);return}M(n,i.optionValues,(o,a)=>{o.setAttribute(A("option-value"),a.name);let u=d(o,s("bind","option-value"))[0];u?g(u,a.name):o.firstElementChild||g(o,a.name);let l=d(o,s("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 ke(t){let{product:e}=t;ot(t,s("option")).forEach(n=>{let r=e.options.find(i=>i.name===t.optName(f(n,"option")));if(!r){$(n,!1);return}n.replaceChildren(...r.optionValues.map(i=>new Option(i.name,i.name)))}),ot(t,s("variant-select")).forEach(n=>{n.replaceChildren(...e.variants.nodes.map(r=>new Option(r.title,r.id)))}),ot(t,s("plan")).forEach(n=>{let r=t.plans.map(a=>new Option(a.name,a.id)),i=!e.requiresSellingPlan&&f(n,"plan")!=="subscription-only",o=n.getAttribute(A("one-time-label"))||"One-time purchase";n.replaceChildren(...i?[new Option(o,"")]:[],...r)})}function Ie(t){t.$(s("plan-list")).forEach(e=>{let n=(f(e,"plan-list")??"").trim(),r=be.includes(n.toLowerCase())?null:n,i=t.plans.filter(o=>!r||o.group.name===r);M(e,i,(o,a)=>{o.setAttribute(A("plan-value"),a.id),!o.firstElementChild&&!o.querySelector(s("plan-bind"))&&g(o,a.name)})})}function rn(t){t.$(s("bind")).forEach(e=>{Ae(e,f(e,"bind")??"",t.product)}),Ee(t),ke(t),Ie(t)}var Dt="Default Title",st=(t,e)=>e.get(t.id)?.quantity??t.quantity,Qt=t=>t.split("/").pop()??t;function xe(t){let e=t.merchandise,n=V(e.product.handle,e.product.id);if(!n)return null;let r=new URLSearchParams;r.set("variant",Qt(e.id));let i=t.sellingPlanAllocation?.sellingPlan.id;return i&&r.set("selling_plan",Qt(i)),`${n}${n.includes("?")?"&":"?"}${r.toString()}`}var Nt=t=>t.merchandise.product.title,_t={title:Nt,"product-title":Nt,"variant-title":t=>t.merchandise.title===Dt?"":t.merchandise.title,options:t=>t.merchandise.selectedOptions.filter(e=>e.value!==Dt).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)=>st(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(", ")},Ht="attribute:";function Te(t,e,n){if(Object.hasOwn(_t,e))return _t[e]?.(t,n);if(!e.startsWith(Ht))return;let r=e.slice(Ht.length);return t.attributes.find(i=>i.key===r)?.value??""}function Me(t,e,n){let r=It(n),i=!n.requiresSellingPlan&&f(t,"line-plan")!=="subscription-only",o={value:"",label:t.getAttribute(A("one-time-label"))||"One-time purchase"},a=[...i?[o]:[],...r.map(l=>({value:l.id,label:l.name}))],u=a.map(l=>l.value).join("|");t.dataset.tetherSig!==u&&(t.replaceChildren(...a.map(l=>{let p=document.createElement("option");return p.value=l.value,p.textContent=l.label,p})),t.dataset.tetherSig=u),t.value=e.sellingPlanAllocation?.sellingPlan.id??"",$(t,r.length>0)}function $e(t,e,n){let r=!!e.sellingPlanAllocation;t.classList.toggle("is-subscription",r);let i=n.warnings.find(u=>u.target===e.id);t.classList.toggle("is-warning",!!i);let o=n.pending.has(e.id);t.classList.toggle("is-busy",o),o?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),d(t,s("line","warning")).forEach(u=>{E(u,i?.message??"")});let a=new Map([["subscription",r],["one-time",!r],["on-sale",kt(e.cost.compareAtAmountPerQuantity?.amount,e.cost.amountPerQuantity.amount)],["has-components",(e.lineComponents??[]).length>0],["warning",!!i]]);d(t,s("line-show")).forEach(u=>{let l=f(u,"line-show"),p=l===null?void 0:a.get(l);p!==void 0&&$(u,p)})}function Oe(t,e,n){let r=e.merchandise;t.setAttribute(A("line-id"),e.id),d(t,s("line")).forEach(o=>{let a=f(o,"line")??"";if(a==="image"){P(o,r.image?.url??r.product.featuredImage?.url,r.product.title);return}if(a==="url"){let l=xe(e);l&&o.setAttribute("href",l);return}let u=Te(e,a,n);u!==void 0&&E(o,u)}),$e(t,e,n),d(t,s("line-plan")).filter(at).forEach(o=>{xt(r.product.handle).then(a=>{Me(o,e,a)}).catch(a=>{S(a,"line plan options")})})}function Re(t,e){let n=t?.totalQuantity??0,r=(t?.lines.nodes??[]).some(o=>o.sellingPlanAllocation),i=new Map([["cart-empty",n===0],["cart-filled",n>0],["cart-has-subscription",r],["cart-no-subscription",!r],["cart-has-discount",(t?.discountCodes??[]).some(o=>o.applicable)],["cart-error",e.failed],["cart-warning",e.warnings.length>0]]);d(document,s("show")).forEach(o=>{let a=f(o,"show"),u=a===null?void 0:i.get(a);u===void 0||o.closest(s("product"))||$(o,u)}),d(document,s("checkout")).forEach(o=>{o.classList.toggle("is-disabled",!n),o.setAttribute("aria-disabled",String(!n))})}function Ue(t){d(document,`textarea${s("cart-note")},input${s("cart-note")}`).forEach(e=>{document.activeElement!==e&&g(e,t?.note??"")}),d(document,s("cart-discounts")).forEach(e=>{M(e,t?.discountCodes??[],(n,r)=>{n.setAttribute(A("discount-code"),r.code);let i=n.querySelector(s("discount","code"))??(n.firstElementChild?null:n);i&&g(i,r.code),n.classList.toggle("is-inapplicable",!r.applicable)})})}function Ft(t){let{cart:e}=t,n=r=>e?v(e.cost[r]):"";B(),d(document,s("cart-count")).forEach(r=>{E(r,e?.totalQuantity??0)}),d(document,s("cart-subtotal")).forEach(r=>{E(r,n("subtotalAmount"))}),d(document,s("cart-total")).forEach(r=>{E(r,n("totalAmount"))}),d(document,s("cart-checkout-charge")).forEach(r=>{E(r,n("checkoutChargeAmount"))}),Re(e,t),d(document,s("cart-warning")).forEach(r=>{E(r,[...new Set(t.warnings.map(i=>i.message))].join(" "))}),Ue(e),d(document,s("cart-lines")).forEach(r=>{Lt(r,e?.lines.nodes??[],i=>i.id,(i,o)=>{Oe(i,o,t)},{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),e&&Et("cart")}function Wt(t){d(document,s("cart-count")).forEach(e=>{/^\s*0?\s*$/.test(e.textContent)&&(e.textContent=String(t))})}function ut(t,e="localStorage"){try{return window[e].getItem(t)}catch{return null}}function lt(t,e,n="localStorage"){try{window[n].setItem(t,e)}catch{}}function Vt(t,e="localStorage"){try{window[e].removeItem(t)}catch{}}var Kt=/^gid:\/\/shopify\/Cart\/[\w-]+(\?key=[\w-]+)?$/;var h={kind:"unknown"},U=[],O=new Map,X=()=>h;function m(){switch(h.kind){case"ready":case"error":return h.cart;case"unknown":case"empty":return null}}var Bt=()=>U,ct=t=>t?{kind:"ready",cart:t}:{kind:"empty"},Gt=()=>`${c.storageKey}:seen`;function I(){let t=ut(c.storageKey);return t?Kt.test(t)?t:(x(),null):null}function x(){Vt(c.storageKey)}function dt(t){h=ct(t),t&<(c.storageKey,t.id)}function N(){Ft({cart:m(),warnings:U,pending:O,failed:h.kind==="error"})}function _(t){N(),y("cart-updated",{cart:m(),reason:t})}function C(t,e){return dt(t),lt(Gt(),`${Date.now()}|${t?.totalQuantity??0}`),_(e),t}function H(t){h=t.kind==="loaded"?ct(t.cart):{kind:"error",error:t.error,cart:null},_("load")}function qe(){let t=ut(Gt())?.split("|")[1]??"",e=Number(t);return/^\d+$/.test(t)&&Number.isSafeInteger(e)?e:null}function Xt(){if(h.kind!=="unknown")return;let t=qe();t!==null&&Wt(t)}function Yt(t){U=t.filter((e,n)=>t.findIndex(r=>r.message===e.message)===n).map(e=>({...e,message:c.warningText?.(e)||e.message})),U.length&&y("cart-warning",{warnings:U})}var jt=()=>{};function De(){let t=Promise.resolve();return e=>{let n=t.then(e);return t=n.then(jt,jt),n}}var mt=De();function zt(t){return mt(t).then(e=>(h.kind==="error"&&(h=ct(h.cart),N()),e),e=>{throw h={kind:"error",error:e,cart:m()},N(),y("cart-error",{error:e}),e})}var pt=t=>st(t,O),Qe=()=>({open:w(),count:m()?.totalQuantity??0,loaded:h.kind!=="unknown",warnings:[...U]});function Jt(t){let e=["cart-updated","cart-toggled"].map(r=>`${c.prefix}:${r}`),n=()=>{t(m(),Qe())};return e.forEach(r=>{document.addEventListener(r,n)}),n(),()=>{e.forEach(r=>{document.removeEventListener(r,n)})}}var Ne=/does not exist|not found|invalid id/i,_e=t=>F({[t]:q({cart:q(et)})});function Y(t){return t instanceof b?t.userErrors?.some(e=>e.field?.[0]==="cartId")?!0:(t.errors??[]).some(e=>Ne.test(e.message)):!1}function te(t){if(!(t instanceof b))return!1;let{code:e,status:n=0}=t;return e==="NETWORK"||e==="INVALID_RESPONSE"||e==="SERVER_ERROR"||n>=500}function ee(t,e=1,n={}){let r=typeof t=="object"&&t!==null?t:{...n,quantity:e,...t==null?{}:{variantId:t}},i=Q.variant(r.merchandiseId||r.variantId||r.id);if(!i)throw new b("add(): variantId is required");let o=parseInt(String(r.quantity??1),10),a={merchandiseId:i,quantity:Math.max(1,o||1)},u=Q.sellingPlan(r.sellingPlanId||r.sellingPlan);u&&(a.sellingPlanId=u);let l=D(r.attributes);return l.length&&(a.attributes=l),a}function He(t,e,n){return r=>`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${tt(r)}`}async function ne(t,e,n,r){let i=await W(He(t,e,n),r,_e(t),{operation:"mutation"}),o=bt(i[t],t);return Yt(o.warnings??[]),o.cart}function Zt(t){let e=c.country?{buyerIdentity:{countryCode:c.country},...t}:t;return ne("cartCreate","$input: CartInput!","input: $input",{input:e})}async function T({name:t,args:e,inner:n,variables:r,createInput:i}){let o=I();if(!o)return i?Zt(i):null;try{return await ne(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`,{...r,cartId:o})}catch(a){if(!Y(a)||(x(),!i))throw a;return Ct("cart expired, creating a new one"),Zt(i)}}async function ft(t){return(await W(n=>`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${tt(n)}`,{id:t},F({cart:q(et)}))).cart}async function re(t){return(await W("query TetherCheckout($id:ID!){cart(id:$id){checkoutUrl}}",{id:t},F({cart:q({checkoutUrl:"string"})}))).cart?.checkoutUrl??null}function ie(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?Q.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=D(n.attributes));let i=n.merchandiseId||n.variantId;return i&&(r.merchandiseId=Q.variant(i)),r}var gt=t=>T({name:"cartLinesUpdate",args:"$lines: [CartLineUpdateInput!]!",inner:"lines: $lines",variables:{lines:t},createInput:null}),z=t=>T({name:"cartLinesRemove",args:"$lineIds: [ID!]!",inner:"lineIds: $lineIds",variables:{lineIds:t},createInput:null}),oe=(t,e)=>e>0?gt([{id:t,quantity:e}]):z([t]);var ht=null;function se(t){ht=t}var Fe=t=>re(t).then(e=>({kind:"url",url:e}),e=>({kind:"failed",error:e}));async function We(){if(!ht)return null;try{let t=await ht();return t&&`${t}${t.includes("?")?"&":"?"}logged_in=true`}catch(t){return S(t,"account checkout"),null}}async function Ve(t){let e=Fe(t),n=await We();if(n)return n;let r=await e;if(r.kind==="failed")throw r.error;if(!r.url)throw new b("No checkoutUrl (cart empty or expired)");return r.url}function Ke(t){try{t.opener=null}catch{}}function ae(){let t=m();return t&&!t.totalQuantity?null:I()}async function ue(t=c.checkoutTarget){if(!ae())return null;let e=t==="_blank"?window.open("","_blank"):null;e&&Ke(e);try{let n=await mt(async()=>{let r=ae();return r&&Ve(r)});if(!n)return e?.close(),null;if(!yt(n))throw new b("The checkout URL is not https: not opened");return y("checkout",{url:n,cart:m()}),e&&!e.closed?e.location.href=n:window.location.href=n,n}catch(n){return e?.close(),S(n,"checkout failed"),null}}var Z=()=>m()?.lines.nodes??[];async function je(){let t=I();if(t)try{let e=await ft(t);e||x(),C(e,"load")}catch(e){S(e,"cart reload after a failed change")}}function L(t){return zt(()=>t().catch(async e=>{throw te(e)&&await je(),e}))}function Be(t,e){let n=Z().find(u=>u.id===t);if(!n)return Promise.resolve(m());let r=Math.max(0,pt(n)+e),i={quantity:r};O.set(t,i),_("pending");let o=()=>O.get(t)===i;return L(async()=>{if(!o())return m();if(Z().find(p=>p.id===t)?.quantity===r)return m();let l=await oe(t,r);return o()?C(l,r>0?"update":"remove"):(dt(l),l)}).finally(()=>{o()&&(O.delete(t),_("settled"))})}function Ge(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 Xe(t){let e=new Map((m()?.attributes??[]).map(n=>[n.key,n.value]));return D(t).forEach(n=>e.set(n.key,n.value)),[...e].filter(([,n])=>n!=="").map(([n,r])=>({key:n,value:r}))}async function Ye(){let t=I();if(!t)return H({kind:"loaded",cart:null}),null;Xt();try{let e=await ft(t);e||x(),H({kind:"loaded",cart:e})}catch(e){S(e,"cart load failed"),Y(e)&&x(),H({kind:"failed",error:e})}return m()}var J={init:Ye,id:I,get status(){return X()},get state(){return m()},get lines(){return[...Z()]},get count(){return m()?.totalQuantity??0},get loaded(){return X().kind!=="unknown"},get lastError(){let t=X();return t.kind!=="error"?null:t.error instanceof Error?t.error:new Error(String(t.error))},get warnings(){return[...Bt()]},get pendingQty(){return O},setCheckoutResolver:se,forgetSaved(){x(),H({kind:"loaded",cart:null})},render:N,subscribe:Jt,add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(i=>ee(i,e,n));return L(async()=>{let i=await T({name:"cartLinesAdd",args:"$lines: [CartLineInput!]!",inner:"lines: $lines",variables:{lines:r},createInput:{lines:r}});if(!i)throw new b("Shopify answered the add without a cart");return C(i,"add"),y("added",{cart:i,lines:r}),c.openCartOnAdd&&G(),i})},updateLine(t,e){let n=typeof e=="number"?e:e.quantity;if(n!==void 0&&n<=0)return J.removeLine(t);let r=ie(t,e);return L(async()=>C(await gt([r]),"update"))},changeQuantity:Be,quantityOf:pt,removeLine(t){let e=Array.isArray(t)?t:[t];return L(async()=>C(await z(e),"remove"))},clear(){return L(async()=>{let t=Z().map(e=>e.id);return t.length?C(await z(t),"remove"):m()})},setNote(t){let e={note:t??""};return L(async()=>C(await T({name:"cartNoteUpdate",args:"$note: String!",inner:"note: $note",variables:e,createInput:e}),"note"))},setAttributes(t){return L(async()=>{let e={attributes:Xe(t)},n=await T({name:"cartAttributesUpdate",args:"$attributes: [AttributeInput!]!",inner:"attributes: $attributes",variables:e,createInput:e});return C(n,"attributes")})},setDiscountCodes(t){return L(async()=>{let e={discountCodes:Ge(t)},n=await T({name:"cartDiscountCodesUpdate",args:"$discountCodes: [String!]!",inner:"discountCodes: $discountCodes",variables:e,createInput:e});return C(n,"discount")})},async applyDiscount(t){let e=t.trim(),n=await J.setDiscountCodes(o=>[...new Set([...o,e])]),r=e.toLowerCase();if((n?.discountCodes??[]).find(o=>o.code.toLowerCase()===r)?.applicable)return n;try{await J.removeDiscount(e)}catch(o){S(o,"removing a discount code Shopify refused")}throw new b(`Discount code not valid: ${e}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let e=t.trim().toLowerCase();return J.setDiscountCodes(n=>n.filter(r=>r.toLowerCase()!==e))},setBuyerIdentity(t,{create:e=!0}={}){return L(async()=>{let n=await T({name:"cartBuyerIdentityUpdate",args:"$buyerIdentity: CartBuyerIdentityInput!",inner:"buyerIdentity: $buyerIdentity",variables:{buyerIdentity:t},createInput:e?{buyerIdentity:t}:null}).catch(r=>{if(e||!Y(r))throw r;return null});return C(n,"buyer-identity")})},checkout:ue,drawers:k,isOpen:w,open:G,close:it,toggle:Ut};export{he as a,at as b,ot as c,rn as d,ut as e,lt as f,Vt as g,J as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={diagnose:()=>import("./diagnose-AOSBLXOJ.js"),markets:()=>import("./markets-ui-PTAY3FHU.js"),search:()=>import("./search-G2SRQXDG.js"),lists:()=>import("./lists-UJMD7BCQ.js"),extras:()=>import("./extras-THTXX76O.js"),account:()=>import("./account-2467DHLU.js"),"account-pages":()=>import("./account-pages-X7U3E7D7.js"),analytics:()=>import("./analytics-TF7M4KI2.js")},a=t=>e[t](),o=void 0;export{a,o as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var A=Object.defineProperty;var v=(n,e,t)=>e in n?A(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var zn=(n,e)=>{for(var t in e)A(n,t,{get:e[t],enumerable:!0})};var Zn=(n,e,t)=>v(n,typeof e!="symbol"?e+"":e,t);var B=/^(\d{4})-(01|04|07|10)$/;function T(n){let e=B.exec(typeof n=="string"?n:"");return e?{year:Number(e[1]),month:Number(e[2])}:null}var R=n=>T(n)!==null,W=(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 W(Math.floor(o/4),o%4*3+1)}function vn(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 C(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function q(n,e){return C(n)?n[e]:void 0}function X(n){return Array.isArray(n)?n:[]}function J(n){return typeof n=="string"&&n!==""?n:null}var nn=n=>typeof n=="number"&&Number.isFinite(n)?n:null,Wn=n=>nn(n)??0,_=(n,e)=>X(n).map(t=>e(t)),qn=(n,e)=>({nodes:_(q(n,"nodes"),e)}),Xn=n=>_(n,J).filter(e=>e!==null);var en=/^[A-Z]{2}$/,tn=new Set(["XX","T1"]),on=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),rn=/^[A-Z]{2,3}$/;function h(n){let e=(typeof n=="string"?n:"").trim().toUpperCase();return!en.test(e)||tn.has(e)?null:e}function w(n){let e=(typeof n=="string"?n:"").trim().replace("-","_").toUpperCase();if(on.has(e))return e;let t=e.split("_")[0]??"";return rn.test(t)?t:null}var oe={domain:["PUBLIC_SHOPIFY_DOMAIN","PUBLIC_SHOPIFY_STORE_DOMAIN","SHOPIFY_DOMAIN"],token:["PUBLIC_SHOPIFY_STOREFRONT_TOKEN","PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN","SHOPIFY_STOREFRONT_TOKEN"]};function re(n){if(typeof n!="string")return!1;try{return new URL(n).protocol==="https:"}catch{return!1}}function ie(n){return/^shp[a-z]{2}_/.test(n.trim())}function se(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 ae(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 ue(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 sn=/^[A-Za-z0-9_.-]+$/,an=/^(\$app(:[A-Za-z0-9_-]+)?|[A-Za-z0-9_.-]+)$/,b=(n,e)=>an.test(n)&&sn.test(e);function M(n){let e=n.indexOf(".");if(e<=0)return null;let t=n.slice(0,e),o=n.slice(e+1);return b(t,o)?{namespace:t,key:o}:null}var un=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,cn=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ln=/^[A-Za-z_$][\w$]*$/,P="https://site.invalid",fn=new Set(["localhost","127.0.0.1","[::1]"]),L=["saved","server","webflow"],dn=["no-banner","default-banner","custom-banner"],y=n=>typeof n=="string"&&n!=="",pn=n=>typeof n=="function";function U(n,e){if(typeof n!="string"||!n)return"";let t=n.replace(/^https?:\/\//,"").replace(/\/.*$/,"");return On(t)?t:(e("domain",n),"")}function F(n){if(!y(n))return!1;try{let e=new URL(n,`${P}/`);return e.origin===P?!0:e.protocol==="https:"||e.protocol==="http:"&&fn.has(e.hostname)}catch{return!1}}function $(n,e){return n==null||n===""?null:typeof n=="string"&&(F(n)||gn(n))?n:(e("partsUrl",n),null)}function gn(n){if(typeof location>"u")return!1;try{return new URL(n).origin===location.origin}catch{return!1}}function yn(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=yn(r);i?t.push(i):e("embedOrigin",r)}return t}function mn(n){if(typeof n=="string")return M(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:b(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=mn(r);i?t.push(typeof r=="string"?r:i):e("metafield",r)}return t}var p=n=>e=>n(e)?e:void 0,On=n=>y(n)&&un.test(n),Cn=n=>y(n)&&cn.test(n),kn=n=>typeof n=="boolean"||y(n)&&ln.test(n),g=p(F),k=p(y),I=p(n=>typeof n=="boolean"),H=p(pn);function m(n,e,t,o){if(e==null)return null;if(!C(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 Tn={server:g,orderUrl:g,subscriptionsUrl:g,paymentUrl:g,logoutUrl:g,locale:k,navigate:H},hn="customer accounts need the Worker since 0.7.0: set account.server",wn={country:k,language:k,locale:k},bn={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(!C(n))return;let e={};for(let[t,o]of Object.entries(n)){let r=m(`markets.locales.${t}`,o,wn,()=>{});r&&(e[t]=r)}return e},cookie:p(Cn),remember:I,strict:I},xn={consent:n=>dn.find(e=>e===n),proxy:n=>n!==void 0&&!!n},Sn={dataLayer:p(kn),shopify:n=>typeof n=="boolean"?n:m("analytics.shopify",n,xn,()=>{})??void 0,onEvent:H};function K(n,e,t){let o=m("account",n,Tn,e);if(o===null)return null;let{server:r}=o;return r===void 0?(t(hn),null):{...o,server:r}}var x=(n,e)=>m("markets",n,bn,e),Y=(n,e)=>m("analytics",n,Sn,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,Q={get(n,e){let t=Reflect.get(n,e);return typeof t=="object"&&t!==null?En(t):t},set:(n,e)=>S(e),deleteProperty:(n,e)=>S(e),defineProperty:(n,e)=>S(e)};function En(n){let e=G.get(n);return e||(e=new Proxy(n,Q),G.set(n,e)),e}var Te=new Proxy(a,Q),Rn=/^[a-z][a-z0-9-]*$/,_n=["revalidate","openCartOnAdd","cartFocus","variantUrl","autoMount","observe","astro","debug"],Nn=["token","productPath","collectionPath"],Mn=["imagesFirst","variantsFirst","sellingPlanGroupsFirst","sellingPlansFirst","collectionFirst","retries","requestTimeout","maxAge","lowStock","searchDelay"],Pn=["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 In(n){for(let e of Object.keys(n))Object.hasOwn(u,e)||c(`unknown option ${JSON.stringify(e)}: ignored`)}function Ln(n,e,t){typeof t=="function"?n[e]=t:t!=null&&s(e,t)}var j=2147483647,Un=10,O={min:1,max:250},Fn={imagesFirst:O,variantsFirst:O,sellingPlanGroupsFirst:O,sellingPlansFirst:O,collectionFirst:O,requestTimeout:{max:j},searchDelay:{max:j},retries:{max:Un}};function $n(n,e){let{min:t=0,max:o}=Fn[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 Vn(n,e){return typeof e=="boolean"?e:f(n,e,u[n])}function Dn(n,e){return typeof e=="string"?e:f(n,e,u[n])}var Hn=/^\S+$/;function Kn(n,e){return typeof e=="string"&&Hn.test(e)?e:f(n,e,u[n])}function Yn(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 Gn(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 Z(n,e,t){if(e==null||e==="")return;let o=t(e);if(o!==null)return o;s(n,e)}function jn(n){In(n);let e=U(n.domain,s),t=typeof n.prefix=="string"&&Rn.test(n.prefix)?n.prefix:f("prefix",n.prefix,u.prefix),o={...u,domain:e,apiVersion:Gn(n.apiVersion),country:Z("country",n.country,h),locale:Yn(n.locale),partsUrl:$(n.partsUrl,s),language:Z("language",n.language,w),markets:x(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:Kn("cartDrawerOpenClass",n.cartDrawerOpenClass)};for(let r of Mn)o[r]=$n(r,n[r]);for(let r of _n)o[r]=Vn(r,n[r]);for(let r of Nn)o[r]=Dn(r,n[r]);for(let r of Pn)Ln(o,r,n[r]);return o}var he=n=>x(n,s);function we(n={}){let e=jn(n);for(let t of Object.keys(a))t in e||Reflect.deleteProperty(a,t);return Object.assign(a,e)}var be=()=>!!(a.domain&&a.token);function xe(...n){a.debug&&console.log(`[${a.prefix}]`,...n)}function c(...n){console.warn(`[${a.prefix}]`,...n)}function Se(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)}}function Re(n){return n instanceof Error?n.message:String(n)}export{zn as a,Zn as b,vn as c,C as d,q as e,X as f,J as g,nn as h,Wn as i,_ as j,qn as k,Xn as l,L as m,mn as n,h as o,w as p,oe as q,re as r,ie as s,se as t,ae as u,ue as v,u as w,a as x,Te as y,jn as z,he as A,we as B,be as C,xe as D,c as E,Se as F,Re as G};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v}from"./chunk-B2X6ZOKA.js";import{a as b,b as S}from"./chunk-HEK66LYK.js";import{a as k}from"./chunk-5TS6IBBB.js";import{h as p}from"./chunk-KIZBET7N.js";import"./chunk-F3OXGENC.js";import"./chunk-646NGAEM.js";import"./chunk-UJYL5G7T.js";import"./chunk-UM37ZVSP.js";import"./chunk-I7XE7GQR.js";import"./chunk-6FWNC7QH.js";import{P as h,S as w,n as l,o as f,p as g,q as d,u as y}from"./chunk-67MCLHFS.js";import{E as m,F as u,x as s}from"./chunk-YW3ZIFWB.js";function U(t,r){let e=w(h(t,"line-attributes"));return r?[{key:"_group",value:r},...e]:e}async function V(t){let r=t.closest(l("group"));if(!r)return null;let e=f(r,"group"),n=U(r,e),i=d(r,l("product")).flatMap(a=>{let o=k.get(a);if(!o?.variant?.availableForSale||o.quantity<=0)return[];let c=o.getLine();return c?[{...c,attributes:[...c.attributes??[],...n]}]:[]});if(!i.length)return m("group-add: nothing selected"),null;try{let a=await p.add(i);return y("group-added",{group:e,lines:i},r),a}catch(a){return u(a,"group add"),null}}function _(t){if(t.key===s.storageKey||t.key===`${s.storageKey}:seen`){p.init().catch(n=>{u(n,"cart from another tab")});return}if(t.key!==b()||!t.newValue)return;let r=S(t.newValue);if(!r)return;let e={language:r.language??null,locale:r.locale,remember:!1};v(r.country,e).catch(n=>{u(n,"market from another tab")})}var E=new WeakMap,K=t=>t.split("/").pop()??t;function x(t){try{window.history.replaceState(window.history.state,"",t)}catch{}}function $(t,{variant:r,sellingPlanId:e}){let n=`${r.id}|${e??""}`,i=E.get(t);if(E.set(t,n),!i||i===n)return;let a=s.variantUrl&&document.querySelector(l("product"))===t;if(!g(t,"variant-url")&&!a)return;let o=new URL(window.location.href);o.searchParams.set("variant",K(r.id)),e?o.searchParams.set("selling_plan",K(e)):o.searchParams.delete("selling_plan"),x(o)}export{V as addGroup,_ as onStorage,$ as writeVariantUrl};
|