@shopify/hydrogen-react 2024.7.5 → 2024.7.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.
@@ -1,4 +1,4 @@
1
- (function(E,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],c):(E=typeof globalThis<"u"?globalThis:E||self,c(E.hydrogenreact={},E.React))})(this,function(E,c){"use strict";function jt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const N=jt(c);/*! *****************************************************************************
1
+ (function(E,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],c):(E=typeof globalThis<"u"?globalThis:E||self,c(E.hydrogenreact={},E.React))})(this,function(E,c){"use strict";function Bt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const N=Bt(c);/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -11,7 +11,7 @@
11
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */function $e(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),s=[];try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(o){a={error:o}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}var ee;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(ee||(ee={}));var qe={type:"xstate.init"};function ve(e){return e===void 0?[]:[].concat(e)}function re(e){return{type:"xstate.assign",assignment:e}}function He(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function _e(e){return function(t){return e===t}}function je(e){return typeof e=="string"?{type:e}:e}function Be(e,t){return{value:e,context:t,actions:[],changed:!1,matches:_e(e)}}function Ye(e,t,r){var n=t,a=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){a=!0;var s=Object.assign({},n);return typeof i.assignment=="function"?s=i.assignment(n,r):Object.keys(i.assignment).forEach(function(o){s[o]=typeof i.assignment[o]=="function"?i.assignment[o](n,r):i.assignment[o]}),n=s,!1}return!0}),n,a]}function We(e,t){t===void 0&&(t={});var r=$e(Ye(ve(e.states[e.initial].entry).map(function(s){return He(s,t.actions)}),e.context,qe),2),n=r[0],a=r[1],i={config:e,_options:t,initialState:{value:e.initial,actions:n,context:a,matches:_e(e.initial)},transition:function(s,o){var u,d,g=typeof s=="string"?{value:s,context:e.context}:s,f=g.value,y=g.context,l=je(o),h=e.states[f];if(h.on){var C=ve(h.on[l.type]);try{for(var T=function(U){var se=typeof Symbol=="function"&&Symbol.iterator,me=se&&U[se],pe=0;if(me)return me.call(U);if(U&&typeof U.length=="number")return{next:function(){return U&&pe>=U.length&&(U=void 0),{value:U&&U[pe++],done:!U}}};throw new TypeError(se?"Object is not iterable.":"Symbol.iterator is not defined.")}(C),w=T.next();!w.done;w=T.next()){var b=w.value;if(b===void 0)return Be(f,y);var I=typeof b=="string"?{target:b}:b,D=I.target,m=I.actions,p=m===void 0?[]:m,_=I.cond,R=_===void 0?function(){return!0}:_,P=D===void 0,A=D??f,v=e.states[A];if(R(y,l)){var H=$e(Ye((P?ve(p):[].concat(h.exit,p,v.entry).filter(function(U){return U})).map(function(U){return He(U,i._options.actions)}),y,l),3),k=H[0],j=H[1],z=H[2],ye=D??f;return{value:ye,context:j,actions:k,changed:D!==f||k.length>0||z,matches:_e(ye)}}}}catch(U){u={error:U}}finally{try{w&&!w.done&&(d=T.return)&&d.call(T)}finally{if(u)throw u.error}}}return Be(f,y)}};return i}var Ge=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function Bt(e){var t=e.initialState,r=ee.NotStarted,n=new Set,a={_machine:e,send:function(i){r===ee.Running&&(t=e.transition(t,i),Ge(t,je(i)),n.forEach(function(s){return s(t)}))},subscribe:function(i){return n.add(i),i(t),{unsubscribe:function(){return n.delete(i)}}},start:function(i){if(i){var s=typeof i=="object"?i:{context:e.config.context,value:i};t={value:s.value,actions:[],context:s.context,matches:_e(s.value)}}else t=e.initialState;return r=ee.Running,Ge(t,qe),a},stop:function(){return r=ee.Stopped,n.clear(),a},get state(){return t},get status(){return r}};return a}var Yt=c.useLayoutEffect,Ze={exports:{}},Qe={},Je={exports:{}},Ke={};/**
14
+ ***************************************************************************** */function $e(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),s=[];try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(o){a={error:o}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return s}var ee;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(ee||(ee={}));var qe={type:"xstate.init"};function ve(e){return e===void 0?[]:[].concat(e)}function re(e){return{type:"xstate.assign",assignment:e}}function He(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function _e(e){return function(t){return e===t}}function je(e){return typeof e=="string"?{type:e}:e}function Be(e,t){return{value:e,context:t,actions:[],changed:!1,matches:_e(e)}}function Ye(e,t,r){var n=t,a=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){a=!0;var s=Object.assign({},n);return typeof i.assignment=="function"?s=i.assignment(n,r):Object.keys(i.assignment).forEach(function(o){s[o]=typeof i.assignment[o]=="function"?i.assignment[o](n,r):i.assignment[o]}),n=s,!1}return!0}),n,a]}function We(e,t){t===void 0&&(t={});var r=$e(Ye(ve(e.states[e.initial].entry).map(function(s){return He(s,t.actions)}),e.context,qe),2),n=r[0],a=r[1],i={config:e,_options:t,initialState:{value:e.initial,actions:n,context:a,matches:_e(e.initial)},transition:function(s,o){var u,d,g=typeof s=="string"?{value:s,context:e.context}:s,f=g.value,y=g.context,l=je(o),h=e.states[f];if(h.on){var C=ve(h.on[l.type]);try{for(var T=function(U){var se=typeof Symbol=="function"&&Symbol.iterator,me=se&&U[se],pe=0;if(me)return me.call(U);if(U&&typeof U.length=="number")return{next:function(){return U&&pe>=U.length&&(U=void 0),{value:U&&U[pe++],done:!U}}};throw new TypeError(se?"Object is not iterable.":"Symbol.iterator is not defined.")}(C),w=T.next();!w.done;w=T.next()){var b=w.value;if(b===void 0)return Be(f,y);var I=typeof b=="string"?{target:b}:b,D=I.target,m=I.actions,p=m===void 0?[]:m,_=I.cond,R=_===void 0?function(){return!0}:_,P=D===void 0,A=D??f,v=e.states[A];if(R(y,l)){var H=$e(Ye((P?ve(p):[].concat(h.exit,p,v.entry).filter(function(U){return U})).map(function(U){return He(U,i._options.actions)}),y,l),3),k=H[0],j=H[1],z=H[2],ye=D??f;return{value:ye,context:j,actions:k,changed:D!==f||k.length>0||z,matches:_e(ye)}}}}catch(U){u={error:U}}finally{try{w&&!w.done&&(d=T.return)&&d.call(T)}finally{if(u)throw u.error}}}return Be(f,y)}};return i}var Ge=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function Yt(e){var t=e.initialState,r=ee.NotStarted,n=new Set,a={_machine:e,send:function(i){r===ee.Running&&(t=e.transition(t,i),Ge(t,je(i)),n.forEach(function(s){return s(t)}))},subscribe:function(i){return n.add(i),i(t),{unsubscribe:function(){return n.delete(i)}}},start:function(i){if(i){var s=typeof i=="object"?i:{context:e.config.context,value:i};t={value:s.value,actions:[],context:s.context,matches:_e(s.value)}}else t=e.initialState;return r=ee.Running,Ge(t,qe),a},stop:function(){return r=ee.Stopped,n.clear(),a},get state(){return t},get status(){return r}};return a}var Wt=c.useLayoutEffect,Ze={exports:{}},Qe={},Je={exports:{}},Ke={};/**
15
15
  * @license React
16
16
  * use-sync-external-store-shim.production.min.js
17
17
  *
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var ne=c;function Wt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Wt,Zt=ne.useState,Qt=ne.useEffect,Jt=ne.useLayoutEffect,Kt=ne.useDebugValue;function Xt(e,t){var r=t(),n=Zt({inst:{value:r,getSnapshot:t}}),a=n[0].inst,i=n[1];return Jt(function(){a.value=r,a.getSnapshot=t,Pe(a)&&i({inst:a})},[e,r,t]),Qt(function(){return Pe(a)&&i({inst:a}),e(function(){Pe(a)&&i({inst:a})})},[e]),Kt(r),r}function Pe(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Gt(e,r)}catch{return!0}}function zt(e,t){return t()}var er=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zt:Xt;Ke.useSyncExternalStore=ne.useSyncExternalStore!==void 0?ne.useSyncExternalStore:er,Je.exports=Ke;var tr=Je.exports;/**
22
+ */var ne=c;function Gt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Zt=typeof Object.is=="function"?Object.is:Gt,Qt=ne.useState,Jt=ne.useEffect,Kt=ne.useLayoutEffect,Xt=ne.useDebugValue;function zt(e,t){var r=t(),n=Qt({inst:{value:r,getSnapshot:t}}),a=n[0].inst,i=n[1];return Kt(function(){a.value=r,a.getSnapshot=t,Pe(a)&&i({inst:a})},[e,r,t]),Jt(function(){return Pe(a)&&i({inst:a}),e(function(){Pe(a)&&i({inst:a})})},[e]),Xt(r),r}function Pe(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Zt(e,r)}catch{return!0}}function er(e,t){return t()}var tr=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?er:zt;Ke.useSyncExternalStore=ne.useSyncExternalStore!==void 0?ne.useSyncExternalStore:tr,Je.exports=Ke;var rr=Je.exports;/**
23
23
  * @license React
24
24
  * use-sync-external-store-shim/with-selector.production.min.js
25
25
  *
@@ -27,7 +27,7 @@
27
27
  *
28
28
  * This source code is licensed under the MIT license found in the
29
29
  * LICENSE file in the root directory of this source tree.
30
- */var Ce=c,rr=tr;function nr(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ar=typeof Object.is=="function"?Object.is:nr,ir=rr.useSyncExternalStore,or=Ce.useRef,sr=Ce.useEffect,cr=Ce.useMemo,ur=Ce.useDebugValue;Qe.useSyncExternalStoreWithSelector=function(e,t,r,n,a){var i=or(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=cr(function(){function u(l){if(!d){if(d=!0,g=l,l=n(l),a!==void 0&&s.hasValue){var h=s.value;if(a(h,l))return f=h}return f=l}if(h=f,ar(g,l))return h;var C=n(l);return a!==void 0&&a(h,C)?h:(g=l,f=C)}var d=!1,g,f,y=r===void 0?null:r;return[function(){return u(t())},y===null?void 0:function(){return u(y())}]},[t,r,n,a]);var o=ir(e,i[0],i[1]);return sr(function(){s.hasValue=!0,s.value=o},[o]),ur(o),o},Ze.exports=Qe;var lr=Ze.exports;function dr(e){var t=N.useRef();return t.current||(t.current={v:e()}),t.current.v}var fr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,i=[],s;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(o){s={error:o}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i};function hr(e){return e}var gr=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function yr(e,t){var r=c.useRef(),n=fr(dr(function(){var o=[],u=Bt(We(e.config,t||e._options)),d=u.send;return u.send=function(g){if(u.status===ee.NotStarted){o.push(g);return}d(g),r.current=u.state},[u,o]}),2),a=n[0],i=n[1];Yt(function(){t&&(a._machine._options=t)});var s=pr(a);return c.useEffect(function(){return a.start(r.current),i.forEach(a.send),r.current=a.state,function(){a.stop()}},[]),s}var mr=function(e,t){return t.changed===!1};function pr(e){var t=c.useCallback(function(){return gr(e)},[e]),r=c.useCallback(function(a){var i=e.subscribe(a).unsubscribe;return i},[e]),n=lr.useSyncExternalStoreWithSelector(r,t,t,hr,mr);return[n,e.send,e]}function J(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e??""}' instead.`;return console.error(t+" Returning an empty array"),[]}return"nodes"in e?e.nodes:"edges"in e&&Array.isArray(e.edges)?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node}):[]}const Er=e=>`
30
+ */var Ce=c,nr=rr;function ar(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ir=typeof Object.is=="function"?Object.is:ar,or=nr.useSyncExternalStore,sr=Ce.useRef,cr=Ce.useEffect,ur=Ce.useMemo,lr=Ce.useDebugValue;Qe.useSyncExternalStoreWithSelector=function(e,t,r,n,a){var i=sr(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=ur(function(){function u(l){if(!d){if(d=!0,g=l,l=n(l),a!==void 0&&s.hasValue){var h=s.value;if(a(h,l))return f=h}return f=l}if(h=f,ir(g,l))return h;var C=n(l);return a!==void 0&&a(h,C)?h:(g=l,f=C)}var d=!1,g,f,y=r===void 0?null:r;return[function(){return u(t())},y===null?void 0:function(){return u(y())}]},[t,r,n,a]);var o=or(e,i[0],i[1]);return cr(function(){s.hasValue=!0,s.value=o},[o]),lr(o),o},Ze.exports=Qe;var dr=Ze.exports;function fr(e){var t=N.useRef();return t.current||(t.current={v:e()}),t.current.v}var hr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,i=[],s;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(o){s={error:o}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i};function gr(e){return e}var yr=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function mr(e,t){var r=c.useRef(),n=hr(fr(function(){var o=[],u=Yt(We(e.config,t||e._options)),d=u.send;return u.send=function(g){if(u.status===ee.NotStarted){o.push(g);return}d(g),r.current=u.state},[u,o]}),2),a=n[0],i=n[1];Wt(function(){t&&(a._machine._options=t)});var s=Er(a);return c.useEffect(function(){return a.start(r.current),i.forEach(a.send),r.current=a.state,function(){a.stop()}},[]),s}var pr=function(e,t){return t.changed===!1};function Er(e){var t=c.useCallback(function(){return yr(e)},[e]),r=c.useCallback(function(a){var i=e.subscribe(a).unsubscribe;return i},[e]),n=dr.useSyncExternalStoreWithSelector(r,t,t,gr,pr);return[n,e.send,e]}function J(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e??""}' instead.`;return console.error(t+" Returning an empty array"),[]}return"nodes"in e?e.nodes:"edges"in e&&Array.isArray(e.edges)?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node}):[]}const _r=e=>`
31
31
  mutation CartLineAdd(
32
32
  $cartId: ID!
33
33
  $lines: [CartLineInput!]!
@@ -43,7 +43,7 @@
43
43
  }
44
44
 
45
45
  ${e}
46
- `,_r=e=>`
46
+ `,Cr=e=>`
47
47
  mutation CartCreate(
48
48
  $input: CartInput!
49
49
  $numCartLines: Int = 250
@@ -58,7 +58,7 @@
58
58
  }
59
59
 
60
60
  ${e}
61
- `,Cr=e=>`
61
+ `,Sr=e=>`
62
62
  mutation CartLineRemove(
63
63
  $cartId: ID!
64
64
  $lines: [ID!]!
@@ -74,7 +74,7 @@
74
74
  }
75
75
 
76
76
  ${e}
77
- `,Sr=e=>`
77
+ `,Tr=e=>`
78
78
  mutation CartLineUpdate(
79
79
  $cartId: ID!
80
80
  $lines: [CartLineUpdateInput!]!
@@ -90,7 +90,7 @@
90
90
  }
91
91
 
92
92
  ${e}
93
- `,Tr=e=>`
93
+ `,Ar=e=>`
94
94
  mutation CartNoteUpdate(
95
95
  $cartId: ID!
96
96
  $note: String!
@@ -106,7 +106,7 @@
106
106
  }
107
107
 
108
108
  ${e}
109
- `,Ar=e=>`
109
+ `,wr=e=>`
110
110
  mutation CartBuyerIdentityUpdate(
111
111
  $cartId: ID!
112
112
  $buyerIdentity: CartBuyerIdentityInput!
@@ -122,7 +122,7 @@
122
122
  }
123
123
 
124
124
  ${e}
125
- `,wr=e=>`
125
+ `,Ir=e=>`
126
126
  mutation CartAttributesUpdate(
127
127
  $attributes: [AttributeInput!]!
128
128
  $cartId: ID!
@@ -138,7 +138,7 @@
138
138
  }
139
139
 
140
140
  ${e}
141
- `,Ir=e=>`
141
+ `,br=e=>`
142
142
  mutation CartDiscountCodesUpdate(
143
143
  $cartId: ID!
144
144
  $discountCodes: [String!]
@@ -154,7 +154,7 @@
154
154
  }
155
155
 
156
156
  ${e}
157
- `,br=e=>`
157
+ `,vr=e=>`
158
158
  query CartQuery(
159
159
  $id: ID!
160
160
  $numCartLines: Int = 250
@@ -167,7 +167,7 @@
167
167
  }
168
168
 
169
169
  ${e}
170
- `,vr=`
170
+ `,Pr=`
171
171
  fragment CartFragment on Cart {
172
172
  id
173
173
  checkoutUrl
@@ -268,16 +268,16 @@
268
268
  width
269
269
  height
270
270
  }
271
- `,ae="2024-07",Pr="mock.shop",Re=e=>e.includes(Pr);function Rr({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:n=ae,contentType:a}){if(!e)throw new Error(De+"`storeDomain` is required when creating a new Storefront client in production.");n!==ae&&Dr(`The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.
272
- You may run into unexpected errors if these versions don't match. Received version: "${n}"; expected version "${ae}"`);const i=s=>{const o=(s==null?void 0:s.storeDomain)??e;return o.includes("://")?o:`https://${o}`};return{getShopifyDomain:i,getStorefrontApiUrl(s){const o=i(s),u=o+(o.endsWith("/")?"api":"/api");return Re(o)?u:`${u}/${(s==null?void 0:s.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(s){if(!t&&!(s!=null&&s.privateStorefrontToken)&&!Re(e))throw new Error(De+"You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`");return{"content-type":((s==null?void 0:s.contentType)??a)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(s==null?void 0:s.privateStorefrontToken)??t??"",...s!=null&&s.buyerIp?{"Shopify-Storefront-Buyer-IP":s.buyerIp}:{}}},getPublicTokenHeaders(s){if(!r&&!(s!=null&&s.publicStorefrontToken)&&!Re(e))throw new Error(De+"You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`");const o=(s==null?void 0:s.contentType)??a??"json";return Xe(o,n,(s==null?void 0:s.publicStorefrontToken)??r??"")}}}function Xe(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const ze=new Set,De="[h2:error:createStorefrontClient] ",Dr=(e,t="warn")=>{ze.has(e)||(console[t](`[h2:${t}:createStorefrontClient] `+e),ze.add(e))},et={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ae,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},tt=c.createContext(et);function kr({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==ae&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${ae}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=c.useMemo(()=>{function n(a){const i=(a==null?void 0:a.storeDomain)??t.storeDomain;return i.includes("://")?i:`https://${i}`}return{...t,getPublicTokenHeaders(a){return Xe(a.contentType,t.storefrontApiVersion,a.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(a){const i=n({storeDomain:(a==null?void 0:a.storeDomain)??t.storeDomain});return`${i}${i.endsWith("/")?"":"/"}api/${(a==null?void 0:a.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return React.createElement(tt.Provider,{value:r},e)}function ce(){const e=c.useContext(tt);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const ke="shopifyCartId",rt="Shopify-Storefront-Id",nt="Shopify-Storefront-Y",at="Shopify-Storefront-S",K="_shopify_y",X="_shopify_s";var Or=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Ur(e){let t={},r,n,a=0,i=e.split(/;\s*/g),s,o;for(;a<i.length;a++)if(n=i[a],r=n.indexOf("="),~r){if(s=n.substring(0,r++).trim(),o=n.substring(r).trim(),o[0]==='"'&&(o=o.substring(1,o.length-1)),~o.indexOf("%"))try{o=decodeURIComponent(o)}catch{}Or.has(n=s.toLowerCase())?n==="expires"?t.expires=new Date(o):n==="max-age"?t.maxage=+o:t[n]=o:t[s]=o}else(s=n.trim().toLowerCase())&&(s==="httponly"||s==="secure")&&(t[s]=!0);return t}function Nr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const it="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function Se(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=it.replace(/[x]/g,a=>{const i=r[n]%16,s=a==="x"?i:i&3|8;return n++,s.toString(16)}).toUpperCase()}catch{e=it.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${Vr()}-${e}`}function Vr(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}return Math.abs(e+t).toString(16).toLowerCase().padStart(8,"0")}function Te(e){const t=Ur(e);return{[K]:t[K]||"",[X]:t[X]||""}}function Mr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=ce();return c.useCallback(({query:n,variables:a})=>{const i=t({contentType:"json"});e&&(i[rt]=e);const s=Te(document.cookie);return i[nt]=s[K],i[at]=s[X],fetch(r(),{method:"POST",headers:i,body:JSON.stringify({query:n.toString(),variables:a})}).then(o=>o.json()).catch(o=>({data:void 0,errors:o==null?void 0:o.toString()}))},[t,e,r])}function Lr({numCartLines:e,cartFragment:t,countryCode:r="US",languageCode:n="EN"}){const a=Mr(),i=c.useCallback(h=>a({query:br(t),variables:{id:h,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),s=c.useCallback(h=>a({query:_r(t),variables:{input:h,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),o=c.useCallback((h,C)=>a({query:Er(t),variables:{cartId:h,lines:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),u=c.useCallback((h,C)=>a({query:Sr(t),variables:{cartId:h,lines:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),d=c.useCallback((h,C)=>a({query:Cr(t),variables:{cartId:h,lines:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),g=c.useCallback((h,C)=>a({query:Tr(t),variables:{cartId:h,note:C,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),f=c.useCallback((h,C)=>a({query:Ar(t),variables:{cartId:h,buyerIdentity:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),y=c.useCallback((h,C)=>a({query:wr(t),variables:{cartId:h,attributes:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),l=c.useCallback((h,C)=>a({query:Ir(t),variables:{cartId:h,discountCodes:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]);return c.useMemo(()=>({cartFetch:i,cartCreate:s,cartLineAdd:o,cartLineUpdate:u,cartLineRemove:d,noteUpdate:g,buyerIdentityUpdate:f,cartAttributesUpdate:y,discountCodesUpdate:l,cartFragment:t}),[i,s,o,u,d,g,f,y,l,t])}function Y(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],re({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.cart},rawCartResult:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:re({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ue={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[re({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>Oe(t.payload.cart)})]}},ot={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function xr(e){return We({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&Oe(e)},states:{uninitialized:{on:ue},cartCompleted:{on:ue},initializationError:{on:ue},idle:{on:{...ue,...ot}},error:{on:{...ue,...ot}},cartFetching:Y("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:Y("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:Y("cartLineRemoveAction"),cartLineUpdating:Y("cartLineUpdateAction"),cartLineAdding:Y("cartLineAddAction"),noteUpdating:Y("noteUpdateAction"),buyerIdentityUpdating:Y("buyerIdentityUpdateAction"),cartAttributesUpdating:Y("cartAttributesUpdateAction"),discountCodesUpdating:Y("discountCodesUpdateAction")}})}function Fr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:a,cartFragment:i,countryCode:s,languageCode:o}){const{cartFetch:u,cartCreate:d,cartLineAdd:g,cartLineUpdate:f,cartLineRemove:y,noteUpdate:l,buyerIdentityUpdate:h,cartAttributesUpdate:C,discountCodesUpdate:T}=Lr({numCartLines:e,cartFragment:i,countryCode:s,languageCode:o}),w=c.useMemo(()=>xr(a),[a]),[b,I,D]=yr(w,{actions:{cartFetchAction:async(m,p)=>{var A;if(p.type!=="CART_FETCH")return;const{data:_,errors:R}=await u((A=p==null?void 0:p.payload)==null?void 0:A.cartId),P=W(p,_==null?void 0:_.cart,R);I(P)},cartCreateAction:async(m,p)=>{var A;if(p.type!=="CART_CREATE")return;const{data:_,errors:R}=await d(p==null?void 0:p.payload),P=W(p,(A=_==null?void 0:_.cartCreate)==null?void 0:A.cart,R);I(P)},cartLineAddAction:async(m,p)=>{var A,v;if(p.type!=="CARTLINE_ADD"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await g(m.cart.id,p.payload.lines),P=W(p,(v=_==null?void 0:_.cartLinesAdd)==null?void 0:v.cart,R);I(P)},cartLineUpdateAction:async(m,p)=>{var A,v;if(p.type!=="CARTLINE_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await f(m.cart.id,p.payload.lines),P=W(p,(v=_==null?void 0:_.cartLinesUpdate)==null?void 0:v.cart,R);I(P)},cartLineRemoveAction:async(m,p)=>{var A,v;if(p.type!=="CARTLINE_REMOVE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await y(m.cart.id,p.payload.lines),P=W(p,(v=_==null?void 0:_.cartLinesRemove)==null?void 0:v.cart,R);I(P)},noteUpdateAction:async(m,p)=>{var A,v;if(p.type!=="NOTE_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await l(m.cart.id,p.payload.note),P=W(p,(v=_==null?void 0:_.cartNoteUpdate)==null?void 0:v.cart,R);I(P)},buyerIdentityUpdateAction:async(m,p)=>{var A,v;if(p.type!=="BUYER_IDENTITY_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await h(m.cart.id,p.payload.buyerIdentity),P=W(p,(v=_==null?void 0:_.cartBuyerIdentityUpdate)==null?void 0:v.cart,R);I(P)},cartAttributesUpdateAction:async(m,p)=>{var A,v;if(p.type!=="CART_ATTRIBUTES_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await C(m.cart.id,p.payload.attributes),P=W(p,(v=_==null?void 0:_.cartAttributesUpdate)==null?void 0:v.cart,R);I(P)},discountCodesUpdateAction:async(m,p)=>{var A,v;if(p.type!=="DISCOUNT_CODES_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await T(m.cart.id,p.payload.discountCodes),P=W(p,(v=_==null?void 0:_.cartDiscountCodesUpdate)==null?void 0:v.cart,R);I(P)},...t&&{onCartActionEntry:(m,p)=>{$r(p)&&t(m,p)}},...r&&{onCartActionOptimisticUI:re((m,p)=>r(m,p))},...n&&{onCartActionComplete:(m,p)=>{qr(p)&&n(m,p)}}}});return c.useMemo(()=>[b,I,D],[b,I,D])}function Oe(e){return{...e,lines:J(e==null?void 0:e.lines),note:e.note??void 0}}function W(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:Oe(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function $r(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function qr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const st=c.createContext(null);function ie(){const e=c.useContext(st);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Hr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:a,onLineUpdate:i,onNoteUpdate:s,onBuyerIdentityUpdate:o,onAttributesUpdate:u,onDiscountCodesUpdate:d,onCreateComplete:g,onLineAddComplete:f,onLineRemoveComplete:y,onLineUpdateComplete:l,onNoteUpdateComplete:h,onBuyerIdentityUpdateComplete:C,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:w,data:b,cartFragment:I=vr,customerAccessToken:D,countryCode:m,languageCode:p}){var Mt,Lt,xt,Ft,$t,qt,Ht;const _=ce();if(!_)throw new Error("<CartProvider> needs to be a descendant of <ShopifyProvider>");m=(m??_.countryIsoCode??"US").toUpperCase(),p=(p??_.languageIsoCode??"EN").toUpperCase(),m&&(m=m.toUpperCase());const[R,P]=c.useState(m),[A,v]=c.useState(D),H=c.useRef(!1);(R!==m||A!==D)&&(P(m),v(D),H.current=!1);const[k,j]=Fr({numCartLines:t,data:b,cartFragment:I,countryCode:m,languageCode:p,onCartActionEntry(S,V){try{switch(V.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return a==null?void 0:a();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return s==null?void 0:s();case"BUYER_IDENTITY_UPDATE":return o==null?void 0:o();case"CART_ATTRIBUTES_UPDATE":return u==null?void 0:u();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(L){console.error("Cart entry action failed",L)}},onCartActionOptimisticUI(S,V){var L,Q,M,Ee;if(!S.cart)return{...S};switch(V.type){case"CARTLINE_REMOVE":return{...S,cart:{...S.cart,lines:(Q=(L=S==null?void 0:S.cart)==null?void 0:L.lines)==null?void 0:Q.filter(x=>(x==null?void 0:x.id)&&!V.payload.lines.includes(x==null?void 0:x.id))}};case"CARTLINE_UPDATE":return{...S,cart:{...S.cart,lines:(Ee=(M=S==null?void 0:S.cart)==null?void 0:M.lines)==null?void 0:Ee.map(x=>{const Fe=V.payload.lines.find(({id:ea})=>ea===(x==null?void 0:x.id));return Fe&&Fe.quantity?{...x,quantity:Fe.quantity}:x})}}}return{...S}},onCartActionComplete(S,V){const L=V.payload.cartActionEvent;try{switch(V.type){case"RESOLVE":switch(L.type){case"CART_CREATE":return g==null?void 0:g();case"CARTLINE_ADD":return f==null?void 0:f();case"CARTLINE_REMOVE":return y==null?void 0:y();case"CARTLINE_UPDATE":return l==null?void 0:l();case"NOTE_UPDATE":return h==null?void 0:h();case"BUYER_IDENTITY_UPDATE":return Yr(S,L)&&(H.current=!0),C==null?void 0:C();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return w==null?void 0:w()}}}catch(Q){console.error("onCartActionComplete failed",Q)}}}),z=c.useRef(!1),[ye,U]=c.useState(!1),se=k.matches("cartCompleted"),me=(k.value==="idle"||k.value==="error"||k.value==="cartCompleted")&&m!==((xt=(Lt=(Mt=k==null?void 0:k.context)==null?void 0:Mt.cart)==null?void 0:Lt.buyerIdentity)==null?void 0:xt.countryCode)&&!k.context.errors,pe=c.useRef(!1);c.useEffect(()=>{if(!z.current&&!pe.current){if(!b&&Ue("localStorage")){pe.current=!0;try{const S=window.localStorage.getItem(ke);S&&j({type:"CART_FETCH",payload:{cartId:S}})}catch(S){console.warn("error fetching cartId"),console.warn(S)}}z.current=!0,U(!0)}},[b,z,j]),c.useEffect(()=>{!me||H.current||j({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:m,customerAccessToken:D}}})},[m,D,me,H,j]);const B=c.useCallback(S=>{if(!z.current)return console.warn("Cart isn't ready yet");j(S)},[j]);c.useEffect(()=>{var S,V,L;if((V=(S=k==null?void 0:k.context)==null?void 0:S.cart)!=null&&V.id&&Ue("localStorage"))try{window.localStorage.setItem(ke,(L=k.context.cart)==null?void 0:L.id)}catch(Q){console.warn("Failed to save cartId to localStorage",Q)}},[($t=(Ft=k==null?void 0:k.context)==null?void 0:Ft.cart)==null?void 0:$t.id]),c.useEffect(()=>{if(se&&Ue("localStorage"))try{window.localStorage.removeItem(ke)}catch(S){console.warn("Failed to delete cartId from localStorage",S)}},[se]);const xe=c.useCallback(S=>{var V,L;m&&!((V=S.buyerIdentity)!=null&&V.countryCode)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.countryCode=m),D&&!((L=S.buyerIdentity)!=null&&L.customerAccessToken)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.customerAccessToken=D),B({type:"CART_CREATE",payload:S})},[m,D,B]),O=Br(k),zn=c.useMemo(()=>{var S,V,L,Q;return{...((S=O==null?void 0:O.context)==null?void 0:S.cart)??{lines:[],attributes:[]},status:jr(O.value),error:(V=O==null?void 0:O.context)==null?void 0:V.errors,totalQuantity:((Q=(L=O==null?void 0:O.context)==null?void 0:L.cart)==null?void 0:Q.totalQuantity)??0,cartCreate:xe,cartReady:ye,linesAdd(M){var Ee,x;(x=(Ee=O==null?void 0:O.context)==null?void 0:Ee.cart)!=null&&x.id?B({type:"CARTLINE_ADD",payload:{lines:M}}):xe({lines:M})},linesRemove(M){B({type:"CARTLINE_REMOVE",payload:{lines:M}})},linesUpdate(M){B({type:"CARTLINE_UPDATE",payload:{lines:M}})},noteUpdate(M){B({type:"NOTE_UPDATE",payload:{note:M}})},buyerIdentityUpdate(M){B({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:M}})},cartAttributesUpdate(M){B({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:M}})},discountCodesUpdate(M){B({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:M}})},cartFragment:I}},[xe,ye,(qt=O==null?void 0:O.context)==null?void 0:qt.cart,(Ht=O==null?void 0:O.context)==null?void 0:Ht.errors,O.value,I,B]);return React.createElement(st.Provider,{value:zn},e)}function jr(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function Br(e){const[t,r]=c.useTransition(),[n,a]=c.useState(e),i=c.useRef(!1);t&&(i.current=!0);const s=c.useRef(!1);return!t&&i.current&&(s.current=!0),c.useEffect(()=>{r(()=>{s.current||a(e)})},[e]),s.current?e:n}function Ue(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return!!(r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0)}}function Yr(e,t){var r,n;return!!(t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode)}const ct=c.createContext(null);function Wr({children:e,data:t,initialVariantId:r}){const n=c.useMemo(()=>J(t.variants??{}),[t.variants]);if(!Zr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const a=c.useMemo(()=>Gr(n),[n]),[i,s]=c.useState(()=>dt(r,n)),[o,u]=c.useState(()=>ft(i));c.useEffect(()=>{const T=dt(r,n);s(T),u(ft(T))},[r,n]);const d=c.useCallback((T,w)=>{u(b=>{const I={...b,[T]:w};return s(lt(n,I)),I})},[u,n]),g=c.useCallback((T,w)=>{const b=lt(n,{...o,[T]:w});return(b==null?void 0:b.availableForSale)??!0},[o,n]),f=c.useMemo(()=>J(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:J((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[y,l]=c.useState(void 0),h=c.useMemo(()=>{var T,w;if(!(!i||!y)){if(!((T=i.sellingPlanAllocations)!=null&&T.nodes)&&!((w=i.sellingPlanAllocations)!=null&&w.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return J(i.sellingPlanAllocations).find(b=>{var I;return((I=b==null?void 0:b.sellingPlan)==null?void 0:I.id)===y.id})}},[i,y]),C=c.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:a,selectedVariant:i,setSelectedVariant:s,selectedOptions:o,setSelectedOption:d,setSelectedOptions:u,isOptionInStock:g,selectedSellingPlan:y,setSelectedSellingPlan:l,selectedSellingPlanAllocation:h,sellingPlanGroups:f,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,g,a,o,y,h,i,f,d,n]);return React.createElement(ct.Provider,{value:C},e)}function ut(){const e=c.useContext(ct);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function lt(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(a=>Object.entries(t).every(([i,s])=>{var o;return(o=a==null?void 0:a.selectedOptions)==null?void 0:o.some(u=>(u==null?void 0:u.name)===i&&(u==null?void 0:u.value)===s)}))}function Gr(e){const t=e.reduce((r,n)=>{var a;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(a=n==null?void 0:n.selectedOptions)==null||a.forEach(i=>{r[(i==null?void 0:i.name)??""]=r[(i==null?void 0:i.name)??""]||new Set,r[(i==null?void 0:i.name)??""].add((i==null?void 0:i.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function dt(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function ft(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function Zr(e){return!(!e||!Array.isArray(e))}function Ae(e){const{as:t,onClick:r,defaultOnClick:n,children:a,buttonRef:i,...s}=e,o=c.useCallback(d=>{if(r){const g=r(d);if(typeof g=="boolean"&&g===!1||d!=null&&d.defaultPrevented)return}n==null||n(d)},[n,r]),u=t||"button";return React.createElement(u,{ref:i,onClick:o,...s},a)}function Qr(e){const[t,r]=c.useState(!1),{variantId:n,quantity:a=1,attributes:i,sellingPlanId:s,onClick:o,children:u,accessibleAddingToCartLabel:d,...g}=e,{status:f,linesAdd:y}=ie(),{selectedVariant:l}=ut(),h=n??(l==null?void 0:l.id)??"",C=n===null||h===""||l===null||t||g.disabled;c.useEffect(()=>{t&&f==="idle"&&r(!1)},[f,t]);const T=c.useCallback(()=>{r(!0),y([{quantity:a,merchandiseId:h||"",attributes:i,sellingPlanId:s}])},[y,a,h,i,s]);return N.createElement(N.Fragment,null,N.createElement(Ae,{...g,disabled:C,onClick:o,defaultOnClick:T},u),d?N.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?d:null):null)}const te={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART",PAGE_VIEW_2:"PAGE_VIEW_2",COLLECTION_VIEW:"COLLECTION_VIEW",PRODUCT_VIEW:"PRODUCT_VIEW",SEARCH_VIEW:"SEARCH_VIEW"},we={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},ht={hydrogen:"hydrogen",headless:"headless"},gt={hydrogen:"6167201",headless:"12875497473"};function q(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function F(e){const t={id:"",resource:null,resourceId:null,search:"",searchParams:new URLSearchParams,hash:""};if(typeof e!="string")return t;try{const{search:r,searchParams:n,pathname:a,hash:i}=new URL(e),s=a.split("/"),o=s[s.length-1],u=s[s.length-2];return!o||!u?t:{id:`${o}${r}${i}`||"",resource:u??null,resourceId:o||null,search:r,searchParams:n,hash:i}}catch{return t}}function $(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Jr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Kr="trekkie_storefront_page_view/1.4",Xr="myshopify.dev";function yt(e){const t=e,{id:r,resource:n}=F(t.resourceId),a=n?n.toLowerCase():void 0;return[q(Kr,$({pageType:t.pageType,customerId:parseInt(F(t.customerId).id||"0"),resourceType:a,resourceId:parseInt(r)},zr(t)))]}function zr(e){return{appClientId:e.shopifySalesChannel?gt[e.shopifySalesChannel]:gt.headless,isMerchantRequest:en(e.url),hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:Se(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(F(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function en(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(Xr)!==-1||t==="localhost"}const tn="2024.7.5",G="custom_storefront_customer_tracking/1.2",mt="page_rendered",pt="collection_page_rendered",Et="product_page_rendered",rn="product_added_to_cart",_t="search_submitted";function le(e){return{canonical_url:e.canonicalUrl||e.url,customer_id:parseInt(F(e.customerId).id||"0")}}function nn(e){const t=e,r=le(t),n=t.pageType,a=[];switch(a.push(q(G,$({event_name:mt,...r},Z(t)))),n){case we.collection:a.push(q(G,$({event_name:pt,...r,collection_name:t.collectionHandle,collection_id:parseInt(F(t.collectionId).id)},Z(t))));break;case we.product:a.push(q(G,$({event_name:Et,...r,products:Ne(t.products),total_value:t.totalValue},Z(t))));break;case we.search:a.push(q(G,$({event_name:_t,...r,search_string:t.searchString},Z(t))));break}return a}function an(e){const t=e,r=le(t);return[q(G,$({event_name:mt,...r},Z(t)))]}function on(e){const t=e,r=le(t);return[q(G,$({event_name:pt,...r,collection_name:t.collectionHandle,collection_id:parseInt(F(t.collectionId).id)},Z(t)))]}function sn(e){const t=e,r=le(t);return[q(G,$({event_name:Et,...r,products:Ne(t.products),total_value:t.totalValue},Z(t)))]}function cn(e){const t=e,r=le(t);return[q(G,$({event_name:_t,...r,search_string:t.searchString},Z(t)))]}function un(e){const t=e,r=F(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[q(G,$({event_name:rn,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:Ne(t.products),customer_id:parseInt(F(t.customerId).id||"0")},Z(t)))]}function Z(e){return{source:e.shopifySalesChannel||ht.headless,asset_version_id:e.assetVersionId||tn,hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",is_persistent_cookie:e.hasUserConsent,deprecated_visit_token:e.visitToken,unique_token:e.uniqueToken,event_time:Date.now(),event_id:Se(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(F(e.shopId).id),currency:e.currency,ccpa_enforced:e.ccpaEnforced||!1,gdpr_enforced:e.gdprEnforced||!1,gdpr_enforced_as_string:e.gdprEnforced?"true":"false",analytics_allowed:e.analyticsAllowed||!1,marketing_allowed:e.marketingAllowed||!1,sale_of_data_allowed:e.saleOfDataAllowed||!1}}function Ne(e){return e?e.map(t=>{const r=$({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(F(t.productGid).id),variant_id:parseInt(F(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:parseFloat(t.price),quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function ln(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let a=[];const i=n;return r===te.PAGE_VIEW?a=a.concat(yt(i),nn(i)):r===te.ADD_TO_CART?a=a.concat(un(n)):r===te.PAGE_VIEW_2?a=a.concat(yt(i),an(i)):r===te.COLLECTION_VIEW?a=a.concat(on(i)):r===te.PRODUCT_VIEW?a=a.concat(sn(i)):r===te.SEARCH_VIEW&&(a=a.concat(cn(i))),a.length?fn(a,t):Promise.resolve()}function dn(){return typeof window>"u"||!window.navigator?!1:/Chrome-Lighthouse/.test(window.navigator.userAgent)}const Ct="sendShopifyAnalytics request is unsuccessful";function fn(e,t){if(dn())return Promise.resolve();const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(i=>{i.status!==200&&console.error(Ct,`
271
+ `,ae="2024-07",Rr="mock.shop",Re=e=>e.includes(Rr);function Dr({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:n=ae,contentType:a}){if(!e)throw new Error(De+"`storeDomain` is required when creating a new Storefront client in production.");n!==ae&&kr(`The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.
272
+ You may run into unexpected errors if these versions don't match. Received version: "${n}"; expected version "${ae}"`);const i=s=>{const o=(s==null?void 0:s.storeDomain)??e;return o.includes("://")?o:`https://${o}`};return{getShopifyDomain:i,getStorefrontApiUrl(s){const o=i(s),u=o+(o.endsWith("/")?"api":"/api");return Re(o)?u:`${u}/${(s==null?void 0:s.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(s){if(!t&&!(s!=null&&s.privateStorefrontToken)&&!Re(e))throw new Error(De+"You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`");return{"content-type":((s==null?void 0:s.contentType)??a)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(s==null?void 0:s.privateStorefrontToken)??t??"",...s!=null&&s.buyerIp?{"Shopify-Storefront-Buyer-IP":s.buyerIp}:{}}},getPublicTokenHeaders(s){if(!r&&!(s!=null&&s.publicStorefrontToken)&&!Re(e))throw new Error(De+"You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`");const o=(s==null?void 0:s.contentType)??a??"json";return Xe(o,n,(s==null?void 0:s.publicStorefrontToken)??r??"")}}}function Xe(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const ze=new Set,De="[h2:error:createStorefrontClient] ",kr=(e,t="warn")=>{ze.has(e)||(console[t](`[h2:${t}:createStorefrontClient] `+e),ze.add(e))},et={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ae,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},tt=c.createContext(et);function Or({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==ae&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${ae}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=c.useMemo(()=>{function n(a){const i=(a==null?void 0:a.storeDomain)??t.storeDomain;return i.includes("://")?i:`https://${i}`}return{...t,getPublicTokenHeaders(a){return Xe(a.contentType,t.storefrontApiVersion,a.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(a){const i=n({storeDomain:(a==null?void 0:a.storeDomain)??t.storeDomain});return`${i}${i.endsWith("/")?"":"/"}api/${(a==null?void 0:a.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return React.createElement(tt.Provider,{value:r},e)}function ce(){const e=c.useContext(tt);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const ke="shopifyCartId",rt="Shopify-Storefront-Id",nt="Shopify-Storefront-Y",at="Shopify-Storefront-S",K="_shopify_y",X="_shopify_s";var Ur=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Nr(e){let t={},r,n,a=0,i=e.split(/;\s*/g),s,o;for(;a<i.length;a++)if(n=i[a],r=n.indexOf("="),~r){if(s=n.substring(0,r++).trim(),o=n.substring(r).trim(),o[0]==='"'&&(o=o.substring(1,o.length-1)),~o.indexOf("%"))try{o=decodeURIComponent(o)}catch{}Ur.has(n=s.toLowerCase())?n==="expires"?t.expires=new Date(o):n==="max-age"?t.maxage=+o:t[n]=o:t[s]=o}else(s=n.trim().toLowerCase())&&(s==="httponly"||s==="secure")&&(t[s]=!0);return t}function Vr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const it="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function Se(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=it.replace(/[x]/g,a=>{const i=r[n]%16,s=a==="x"?i:i&3|8;return n++,s.toString(16)}).toUpperCase()}catch{e=it.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${Mr()}-${e}`}function Mr(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}return Math.abs(e+t).toString(16).toLowerCase().padStart(8,"0")}function Te(e){const t=Nr(e);return{[K]:t[K]||"",[X]:t[X]||""}}function Lr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=ce();return c.useCallback(({query:n,variables:a})=>{const i=t({contentType:"json"});e&&(i[rt]=e);const s=Te(document.cookie);return i[nt]=s[K],i[at]=s[X],fetch(r(),{method:"POST",headers:i,body:JSON.stringify({query:n.toString(),variables:a})}).then(o=>o.json()).catch(o=>({data:void 0,errors:o==null?void 0:o.toString()}))},[t,e,r])}function xr({numCartLines:e,cartFragment:t,countryCode:r="US",languageCode:n="EN"}){const a=Lr(),i=c.useCallback(h=>a({query:vr(t),variables:{id:h,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),s=c.useCallback(h=>a({query:Cr(t),variables:{input:h,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),o=c.useCallback((h,C)=>a({query:_r(t),variables:{cartId:h,lines:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),u=c.useCallback((h,C)=>a({query:Tr(t),variables:{cartId:h,lines:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),d=c.useCallback((h,C)=>a({query:Sr(t),variables:{cartId:h,lines:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),g=c.useCallback((h,C)=>a({query:Ar(t),variables:{cartId:h,note:C,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),f=c.useCallback((h,C)=>a({query:wr(t),variables:{cartId:h,buyerIdentity:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),y=c.useCallback((h,C)=>a({query:Ir(t),variables:{cartId:h,attributes:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),l=c.useCallback((h,C)=>a({query:br(t),variables:{cartId:h,discountCodes:C,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]);return c.useMemo(()=>({cartFetch:i,cartCreate:s,cartLineAdd:o,cartLineUpdate:u,cartLineRemove:d,noteUpdate:g,buyerIdentityUpdate:f,cartAttributesUpdate:y,discountCodesUpdate:l,cartFragment:t}),[i,s,o,u,d,g,f,y,l,t])}function Y(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],re({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.cart},rawCartResult:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:re({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ue={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[re({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>Oe(t.payload.cart)})]}},ot={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function Fr(e){return We({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&Oe(e)},states:{uninitialized:{on:ue},cartCompleted:{on:ue},initializationError:{on:ue},idle:{on:{...ue,...ot}},error:{on:{...ue,...ot}},cartFetching:Y("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:Y("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:Y("cartLineRemoveAction"),cartLineUpdating:Y("cartLineUpdateAction"),cartLineAdding:Y("cartLineAddAction"),noteUpdating:Y("noteUpdateAction"),buyerIdentityUpdating:Y("buyerIdentityUpdateAction"),cartAttributesUpdating:Y("cartAttributesUpdateAction"),discountCodesUpdating:Y("discountCodesUpdateAction")}})}function $r({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:a,cartFragment:i,countryCode:s,languageCode:o}){const{cartFetch:u,cartCreate:d,cartLineAdd:g,cartLineUpdate:f,cartLineRemove:y,noteUpdate:l,buyerIdentityUpdate:h,cartAttributesUpdate:C,discountCodesUpdate:T}=xr({numCartLines:e,cartFragment:i,countryCode:s,languageCode:o}),w=c.useMemo(()=>Fr(a),[a]),[b,I,D]=mr(w,{actions:{cartFetchAction:async(m,p)=>{var A;if(p.type!=="CART_FETCH")return;const{data:_,errors:R}=await u((A=p==null?void 0:p.payload)==null?void 0:A.cartId),P=W(p,_==null?void 0:_.cart,R);I(P)},cartCreateAction:async(m,p)=>{var A;if(p.type!=="CART_CREATE")return;const{data:_,errors:R}=await d(p==null?void 0:p.payload),P=W(p,(A=_==null?void 0:_.cartCreate)==null?void 0:A.cart,R);I(P)},cartLineAddAction:async(m,p)=>{var A,v;if(p.type!=="CARTLINE_ADD"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await g(m.cart.id,p.payload.lines),P=W(p,(v=_==null?void 0:_.cartLinesAdd)==null?void 0:v.cart,R);I(P)},cartLineUpdateAction:async(m,p)=>{var A,v;if(p.type!=="CARTLINE_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await f(m.cart.id,p.payload.lines),P=W(p,(v=_==null?void 0:_.cartLinesUpdate)==null?void 0:v.cart,R);I(P)},cartLineRemoveAction:async(m,p)=>{var A,v;if(p.type!=="CARTLINE_REMOVE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await y(m.cart.id,p.payload.lines),P=W(p,(v=_==null?void 0:_.cartLinesRemove)==null?void 0:v.cart,R);I(P)},noteUpdateAction:async(m,p)=>{var A,v;if(p.type!=="NOTE_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await l(m.cart.id,p.payload.note),P=W(p,(v=_==null?void 0:_.cartNoteUpdate)==null?void 0:v.cart,R);I(P)},buyerIdentityUpdateAction:async(m,p)=>{var A,v;if(p.type!=="BUYER_IDENTITY_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await h(m.cart.id,p.payload.buyerIdentity),P=W(p,(v=_==null?void 0:_.cartBuyerIdentityUpdate)==null?void 0:v.cart,R);I(P)},cartAttributesUpdateAction:async(m,p)=>{var A,v;if(p.type!=="CART_ATTRIBUTES_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await C(m.cart.id,p.payload.attributes),P=W(p,(v=_==null?void 0:_.cartAttributesUpdate)==null?void 0:v.cart,R);I(P)},discountCodesUpdateAction:async(m,p)=>{var A,v;if(p.type!=="DISCOUNT_CODES_UPDATE"||!((A=m==null?void 0:m.cart)!=null&&A.id))return;const{data:_,errors:R}=await T(m.cart.id,p.payload.discountCodes),P=W(p,(v=_==null?void 0:_.cartDiscountCodesUpdate)==null?void 0:v.cart,R);I(P)},...t&&{onCartActionEntry:(m,p)=>{qr(p)&&t(m,p)}},...r&&{onCartActionOptimisticUI:re((m,p)=>r(m,p))},...n&&{onCartActionComplete:(m,p)=>{Hr(p)&&n(m,p)}}}});return c.useMemo(()=>[b,I,D],[b,I,D])}function Oe(e){return{...e,lines:J(e==null?void 0:e.lines),note:e.note??void 0}}function W(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:Oe(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function qr(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function Hr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const st=c.createContext(null);function ie(){const e=c.useContext(st);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function jr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:a,onLineUpdate:i,onNoteUpdate:s,onBuyerIdentityUpdate:o,onAttributesUpdate:u,onDiscountCodesUpdate:d,onCreateComplete:g,onLineAddComplete:f,onLineRemoveComplete:y,onLineUpdateComplete:l,onNoteUpdateComplete:h,onBuyerIdentityUpdateComplete:C,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:w,data:b,cartFragment:I=Pr,customerAccessToken:D,countryCode:m,languageCode:p}){var Lt,xt,Ft,$t,qt,Ht,jt;const _=ce();if(!_)throw new Error("<CartProvider> needs to be a descendant of <ShopifyProvider>");m=(m??_.countryIsoCode??"US").toUpperCase(),p=(p??_.languageIsoCode??"EN").toUpperCase(),m&&(m=m.toUpperCase());const[R,P]=c.useState(m),[A,v]=c.useState(D),H=c.useRef(!1);(R!==m||A!==D)&&(P(m),v(D),H.current=!1);const[k,j]=$r({numCartLines:t,data:b,cartFragment:I,countryCode:m,languageCode:p,onCartActionEntry(S,V){try{switch(V.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return a==null?void 0:a();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return s==null?void 0:s();case"BUYER_IDENTITY_UPDATE":return o==null?void 0:o();case"CART_ATTRIBUTES_UPDATE":return u==null?void 0:u();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(L){console.error("Cart entry action failed",L)}},onCartActionOptimisticUI(S,V){var L,Q,M,Ee;if(!S.cart)return{...S};switch(V.type){case"CARTLINE_REMOVE":return{...S,cart:{...S.cart,lines:(Q=(L=S==null?void 0:S.cart)==null?void 0:L.lines)==null?void 0:Q.filter(x=>(x==null?void 0:x.id)&&!V.payload.lines.includes(x==null?void 0:x.id))}};case"CARTLINE_UPDATE":return{...S,cart:{...S.cart,lines:(Ee=(M=S==null?void 0:S.cart)==null?void 0:M.lines)==null?void 0:Ee.map(x=>{const Fe=V.payload.lines.find(({id:ta})=>ta===(x==null?void 0:x.id));return Fe&&Fe.quantity?{...x,quantity:Fe.quantity}:x})}}}return{...S}},onCartActionComplete(S,V){const L=V.payload.cartActionEvent;try{switch(V.type){case"RESOLVE":switch(L.type){case"CART_CREATE":return g==null?void 0:g();case"CARTLINE_ADD":return f==null?void 0:f();case"CARTLINE_REMOVE":return y==null?void 0:y();case"CARTLINE_UPDATE":return l==null?void 0:l();case"NOTE_UPDATE":return h==null?void 0:h();case"BUYER_IDENTITY_UPDATE":return Wr(S,L)&&(H.current=!0),C==null?void 0:C();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return w==null?void 0:w()}}}catch(Q){console.error("onCartActionComplete failed",Q)}}}),z=c.useRef(!1),[ye,U]=c.useState(!1),se=k.matches("cartCompleted"),me=(k.value==="idle"||k.value==="error"||k.value==="cartCompleted")&&m!==((Ft=(xt=(Lt=k==null?void 0:k.context)==null?void 0:Lt.cart)==null?void 0:xt.buyerIdentity)==null?void 0:Ft.countryCode)&&!k.context.errors,pe=c.useRef(!1);c.useEffect(()=>{if(!z.current&&!pe.current){if(!b&&Ue("localStorage")){pe.current=!0;try{const S=window.localStorage.getItem(ke);S&&j({type:"CART_FETCH",payload:{cartId:S}})}catch(S){console.warn("error fetching cartId"),console.warn(S)}}z.current=!0,U(!0)}},[b,z,j]),c.useEffect(()=>{!me||H.current||j({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:m,customerAccessToken:D}}})},[m,D,me,H,j]);const B=c.useCallback(S=>{if(!z.current)return console.warn("Cart isn't ready yet");j(S)},[j]);c.useEffect(()=>{var S,V,L;if((V=(S=k==null?void 0:k.context)==null?void 0:S.cart)!=null&&V.id&&Ue("localStorage"))try{window.localStorage.setItem(ke,(L=k.context.cart)==null?void 0:L.id)}catch(Q){console.warn("Failed to save cartId to localStorage",Q)}},[(qt=($t=k==null?void 0:k.context)==null?void 0:$t.cart)==null?void 0:qt.id]),c.useEffect(()=>{if(se&&Ue("localStorage"))try{window.localStorage.removeItem(ke)}catch(S){console.warn("Failed to delete cartId from localStorage",S)}},[se]);const xe=c.useCallback(S=>{var V,L;m&&!((V=S.buyerIdentity)!=null&&V.countryCode)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.countryCode=m),D&&!((L=S.buyerIdentity)!=null&&L.customerAccessToken)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.customerAccessToken=D),B({type:"CART_CREATE",payload:S})},[m,D,B]),O=Yr(k),ea=c.useMemo(()=>{var S,V,L,Q;return{...((S=O==null?void 0:O.context)==null?void 0:S.cart)??{lines:[],attributes:[]},status:Br(O.value),error:(V=O==null?void 0:O.context)==null?void 0:V.errors,totalQuantity:((Q=(L=O==null?void 0:O.context)==null?void 0:L.cart)==null?void 0:Q.totalQuantity)??0,cartCreate:xe,cartReady:ye,linesAdd(M){var Ee,x;(x=(Ee=O==null?void 0:O.context)==null?void 0:Ee.cart)!=null&&x.id?B({type:"CARTLINE_ADD",payload:{lines:M}}):xe({lines:M})},linesRemove(M){B({type:"CARTLINE_REMOVE",payload:{lines:M}})},linesUpdate(M){B({type:"CARTLINE_UPDATE",payload:{lines:M}})},noteUpdate(M){B({type:"NOTE_UPDATE",payload:{note:M}})},buyerIdentityUpdate(M){B({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:M}})},cartAttributesUpdate(M){B({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:M}})},discountCodesUpdate(M){B({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:M}})},cartFragment:I}},[xe,ye,(Ht=O==null?void 0:O.context)==null?void 0:Ht.cart,(jt=O==null?void 0:O.context)==null?void 0:jt.errors,O.value,I,B]);return React.createElement(st.Provider,{value:ea},e)}function Br(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function Yr(e){const[t,r]=c.useTransition(),[n,a]=c.useState(e),i=c.useRef(!1);t&&(i.current=!0);const s=c.useRef(!1);return!t&&i.current&&(s.current=!0),c.useEffect(()=>{r(()=>{s.current||a(e)})},[e]),s.current?e:n}function Ue(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return!!(r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0)}}function Wr(e,t){var r,n;return!!(t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode)}const ct=c.createContext(null);function Gr({children:e,data:t,initialVariantId:r}){const n=c.useMemo(()=>J(t.variants??{}),[t.variants]);if(!Qr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const a=c.useMemo(()=>Zr(n),[n]),[i,s]=c.useState(()=>dt(r,n)),[o,u]=c.useState(()=>ft(i));c.useEffect(()=>{const T=dt(r,n);s(T),u(ft(T))},[r,n]);const d=c.useCallback((T,w)=>{u(b=>{const I={...b,[T]:w};return s(lt(n,I)),I})},[u,n]),g=c.useCallback((T,w)=>{const b=lt(n,{...o,[T]:w});return(b==null?void 0:b.availableForSale)??!0},[o,n]),f=c.useMemo(()=>J(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:J((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[y,l]=c.useState(void 0),h=c.useMemo(()=>{var T,w;if(!(!i||!y)){if(!((T=i.sellingPlanAllocations)!=null&&T.nodes)&&!((w=i.sellingPlanAllocations)!=null&&w.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return J(i.sellingPlanAllocations).find(b=>{var I;return((I=b==null?void 0:b.sellingPlan)==null?void 0:I.id)===y.id})}},[i,y]),C=c.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:a,selectedVariant:i,setSelectedVariant:s,selectedOptions:o,setSelectedOption:d,setSelectedOptions:u,isOptionInStock:g,selectedSellingPlan:y,setSelectedSellingPlan:l,selectedSellingPlanAllocation:h,sellingPlanGroups:f,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,g,a,o,y,h,i,f,d,n]);return React.createElement(ct.Provider,{value:C},e)}function ut(){const e=c.useContext(ct);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function lt(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(a=>Object.entries(t).every(([i,s])=>{var o;return(o=a==null?void 0:a.selectedOptions)==null?void 0:o.some(u=>(u==null?void 0:u.name)===i&&(u==null?void 0:u.value)===s)}))}function Zr(e){const t=e.reduce((r,n)=>{var a;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(a=n==null?void 0:n.selectedOptions)==null||a.forEach(i=>{r[(i==null?void 0:i.name)??""]=r[(i==null?void 0:i.name)??""]||new Set,r[(i==null?void 0:i.name)??""].add((i==null?void 0:i.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function dt(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function ft(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function Qr(e){return!(!e||!Array.isArray(e))}function Ae(e){const{as:t,onClick:r,defaultOnClick:n,children:a,buttonRef:i,...s}=e,o=c.useCallback(d=>{if(r){const g=r(d);if(typeof g=="boolean"&&g===!1||d!=null&&d.defaultPrevented)return}n==null||n(d)},[n,r]),u=t||"button";return React.createElement(u,{ref:i,onClick:o,...s},a)}function Jr(e){const[t,r]=c.useState(!1),{variantId:n,quantity:a=1,attributes:i,sellingPlanId:s,onClick:o,children:u,accessibleAddingToCartLabel:d,...g}=e,{status:f,linesAdd:y}=ie(),{selectedVariant:l}=ut(),h=n??(l==null?void 0:l.id)??"",C=n===null||h===""||l===null||t||g.disabled;c.useEffect(()=>{t&&f==="idle"&&r(!1)},[f,t]);const T=c.useCallback(()=>{r(!0),y([{quantity:a,merchandiseId:h||"",attributes:i,sellingPlanId:s}])},[y,a,h,i,s]);return N.createElement(N.Fragment,null,N.createElement(Ae,{...g,disabled:C,onClick:o,defaultOnClick:T},u),d?N.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?d:null):null)}const te={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART",PAGE_VIEW_2:"PAGE_VIEW_2",COLLECTION_VIEW:"COLLECTION_VIEW",PRODUCT_VIEW:"PRODUCT_VIEW",SEARCH_VIEW:"SEARCH_VIEW"},we={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},ht={hydrogen:"hydrogen",headless:"headless"},gt={hydrogen:"6167201",headless:"12875497473"};function q(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function F(e){const t={id:"",resource:null,resourceId:null,search:"",searchParams:new URLSearchParams,hash:""};if(typeof e!="string")return t;try{const{search:r,searchParams:n,pathname:a,hash:i}=new URL(e),s=a.split("/"),o=s[s.length-1],u=s[s.length-2];return!o||!u?t:{id:`${o}${r}${i}`||"",resource:u??null,resourceId:o||null,search:r,searchParams:n,hash:i}}catch{return t}}function $(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Kr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Xr="trekkie_storefront_page_view/1.4",zr="myshopify.dev";function yt(e){const t=e,{id:r,resource:n}=F(t.resourceId),a=n?n.toLowerCase():void 0;return[q(Xr,$({pageType:t.pageType,customerId:parseInt(F(t.customerId).id||"0"),resourceType:a,resourceId:parseInt(r)},en(t)))]}function en(e){return{appClientId:e.shopifySalesChannel?gt[e.shopifySalesChannel]:gt.headless,isMerchantRequest:tn(e.url),hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:Se(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(F(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function tn(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(zr)!==-1||t==="localhost"}const rn="2024.7.6",G="custom_storefront_customer_tracking/1.2",mt="page_rendered",pt="collection_page_rendered",Et="product_page_rendered",nn="product_added_to_cart",_t="search_submitted";function le(e){return{canonical_url:e.canonicalUrl||e.url,customer_id:parseInt(F(e.customerId).id||"0")}}function an(e){const t=e,r=le(t),n=t.pageType,a=[];switch(a.push(q(G,$({event_name:mt,...r},Z(t)))),n){case we.collection:a.push(q(G,$({event_name:pt,...r,collection_name:t.collectionHandle,collection_id:parseInt(F(t.collectionId).id)},Z(t))));break;case we.product:a.push(q(G,$({event_name:Et,...r,products:Ne(t.products),total_value:t.totalValue},Z(t))));break;case we.search:a.push(q(G,$({event_name:_t,...r,search_string:t.searchString},Z(t))));break}return a}function on(e){const t=e,r=le(t);return[q(G,$({event_name:mt,...r},Z(t)))]}function sn(e){const t=e,r=le(t);return[q(G,$({event_name:pt,...r,collection_name:t.collectionHandle,collection_id:parseInt(F(t.collectionId).id)},Z(t)))]}function cn(e){const t=e,r=le(t);return[q(G,$({event_name:Et,...r,products:Ne(t.products),total_value:t.totalValue},Z(t)))]}function un(e){const t=e,r=le(t);return[q(G,$({event_name:_t,...r,search_string:t.searchString},Z(t)))]}function ln(e){const t=e,r=F(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[q(G,$({event_name:nn,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:Ne(t.products),customer_id:parseInt(F(t.customerId).id||"0")},Z(t)))]}function Z(e){return{source:e.shopifySalesChannel||ht.headless,asset_version_id:e.assetVersionId||rn,hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",is_persistent_cookie:e.hasUserConsent,deprecated_visit_token:e.visitToken,unique_token:e.uniqueToken,event_time:Date.now(),event_id:Se(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(F(e.shopId).id),currency:e.currency,ccpa_enforced:e.ccpaEnforced||!1,gdpr_enforced:e.gdprEnforced||!1,gdpr_enforced_as_string:e.gdprEnforced?"true":"false",analytics_allowed:e.analyticsAllowed||!1,marketing_allowed:e.marketingAllowed||!1,sale_of_data_allowed:e.saleOfDataAllowed||!1}}function Ne(e){return e?e.map(t=>{const r=$({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(F(t.productGid).id),variant_id:parseInt(F(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:parseFloat(t.price),quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function dn(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let a=[];const i=n;return r===te.PAGE_VIEW?a=a.concat(yt(i),an(i)):r===te.ADD_TO_CART?a=a.concat(ln(n)):r===te.PAGE_VIEW_2?a=a.concat(yt(i),on(i)):r===te.COLLECTION_VIEW?a=a.concat(sn(i)):r===te.PRODUCT_VIEW?a=a.concat(cn(i)):r===te.SEARCH_VIEW&&(a=a.concat(un(i))),a.length?hn(a,t):Promise.resolve()}function fn(){return typeof window>"u"||!window.navigator?!1:/Chrome-Lighthouse/.test(window.navigator.userAgent)}const Ct="sendShopifyAnalytics request is unsuccessful";function hn(e,t){if(fn())return Promise.resolve();const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(i=>{i.status!==200&&console.error(Ct,`
273
273
 
274
- `,i.message)})}).catch(n=>{console.error(Ct,n)})}catch{return Promise.resolve()}}function hn(){if(Jr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=mn(),r=Te(document.cookie);return{uniqueToken:r[K],visitToken:r[X],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function gn(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function yn(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function mn(){try{let e="PerformanceNavigationTiming",t=gn();return t||(t=yn(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function pn(e){const{cartCreate:t,checkoutUrl:r}=ie(),[n,a]=c.useState(!1),{quantity:i,variantId:s,sellingPlanId:o,onClick:u,attributes:d,children:g,...f}=e;c.useEffect(()=>{n&&r&&(window.location.href=r)},[n,r]);const y=c.useCallback(()=>{a(!0),t({lines:[{quantity:i??1,merchandiseId:s,attributes:d,sellingPlanId:o}]})},[t,i,s,d,o]);return React.createElement(Ae,{disabled:n??f.disabled,...f,onClick:u,defaultOnClick:y},g)}function En(e){const[t,r]=c.useState(!1),{status:n,checkoutUrl:a}=ie(),{children:i,...s}=e;return c.useEffect(()=>{t&&a&&n==="idle"&&(window.location.href=a)},[t,n,a]),React.createElement(Ae,{...s,disabled:t||s.disabled,onClick:()=>r(!0)},i)}function St(e){const{countryIsoCode:t,languageIsoCode:r}=ce(),n=r.includes("_")?r.replace("_","-"):`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const a=parseFloat(e.amount),{defaultFormatter:i,nameFormatter:s,narrowSymbolFormatter:o,withoutTrailingZerosFormatter:u,withoutCurrencyFormatter:d,withoutTrailingZerosOrCurrencyFormatter:g}=c.useMemo(()=>{const l={style:"currency",currency:e.currencyCode};return{defaultFormatter:oe(n,l),nameFormatter:oe(n,{...l,currencyDisplay:"name"}),narrowSymbolFormatter:oe(n,{...l,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:oe(n,{...l,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:oe(n),withoutTrailingZerosOrCurrencyFormatter:oe(n,{minimumFractionDigits:0,maximumFractionDigits:0})}},[e.currencyCode,n]),f=l=>l.type==="currency",y=c.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(a),parts:()=>i().formatToParts(a),withoutTrailingZeros:()=>a%1===0?u().format(a):i().format(a),withoutTrailingZerosAndCurrency:()=>a%1===0?g().format(a):d().format(a),currencyName:()=>{var l;return((l=s().formatToParts(a).find(f))==null?void 0:l.value)??e.currencyCode},currencySymbol:()=>{var l;return((l=i().formatToParts(a).find(f))==null?void 0:l.value)??e.currencyCode},currencyNarrowSymbol:()=>{var l;return((l=o().formatToParts(a).find(f))==null?void 0:l.value)??""},amount:()=>i().formatToParts(a).filter(l=>["decimal","fraction","group","integer","literal"].includes(l.type)).map(l=>l.value).join("")}),[e,a,s,i,o,d,u,g]);return c.useMemo(()=>new Proxy(y,{get:(l,h)=>{var C;return(C=Reflect.get(l,h))==null?void 0:C.call(null)}}),[y])}const Tt=new Map;function oe(e,t){const r=JSON.stringify([e,t]);return function(){let n=Tt.get(r);return n||(n=new Intl.NumberFormat(e,t),Tt.set(r,n)),n}}function Ie({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:a,measurementSeparator:i="/",...s}){if(!_n(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const o=St(e),u=t??"div";let d=o.localizedString;return(r||n)&&(r&&!n?d=o.amount:!r&&n?d=o.withoutTrailingZeros:d=o.withoutTrailingZerosAndCurrency),React.createElement(u,{...s},d,a&&a.referenceUnit&&React.createElement(React.Fragment,null,i,a.referenceUnit))}function _n(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Cn(e){const{cost:t}=ie(),{amountType:r="total",children:n,...a}=e;let i;return r=="total"?i=t==null?void 0:t.totalAmount:r=="subtotal"?i=t==null?void 0:t.subtotalAmount:r=="tax"?i=t==null?void 0:t.totalTaxAmount:r=="duty"&&(i=t==null?void 0:t.totalDutyAmount),i==null?null:React.createElement(Ie,{...a,data:i},n)}const At=c.createContext(null);function Ve(){const e=c.useContext(At);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Sn({children:e,line:t}){return React.createElement(At.Provider,{value:t},e)}function Tn(e){const t=Ve(),{as:r,...n}=e,a=r||"span";return React.createElement(a,{...n},t.quantity)}function An(e){const{status:t,linesRemove:r,linesUpdate:n}=ie(),a=Ve(),{children:i,adjust:s,onClick:o,...u}=e,d=c.useCallback(()=>{if(s==="remove"){r([(a==null?void 0:a.id)??""]);return}const f=s==="decrease"?((a==null?void 0:a.quantity)??0)-1:((a==null?void 0:a.quantity)??0)+1;if(f<=0){r([(a==null?void 0:a.id)??""]);return}const y={id:(a==null?void 0:a.id)??"",quantity:f,attributes:(a==null?void 0:a.attributes)??[]};n([y])},[s,a==null?void 0:a.attributes,a==null?void 0:a.id,a==null?void 0:a.quantity,r,n]),g=u.disabled;return React.createElement(Ae,{...u,onClick:o,defaultOnClick:d,disabled:typeof g<"u"?g:t!=="idle"},i)}const wn={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"},In={DateTime:"string",Decimal:"string",HTML:"string",ISO8601DateTime:"string",URL:"string",UnsignedInt64:"string"},wt=c.forwardRef((e,t)=>{const{data:r,options:n,id:a=r.id,frameBorder:i="0",allow:s="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:o=!0,loading:u="lazy",...d}=e;if(!r.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let g=r.embedUrl;if(n){const f=new URL(r.embedUrl);for(const[y,l]of Object.entries(n))typeof l>"u"||f.searchParams.set(y,l.toString());g=f.toString()}return React.createElement("iframe",{...d,id:a??r.embedUrl,title:r.alt??r.id??"external video",frameBorder:i,allow:s,allowFullScreen:o,src:g,loading:u,ref:t})}),bn=`#graphql
274
+ `,i.message)})}).catch(n=>{console.error(Ct,n)})}catch{return Promise.resolve()}}function gn(){if(Kr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=pn(),r=Te(document.cookie);return{uniqueToken:r[K],visitToken:r[X],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function yn(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function mn(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function pn(){try{let e="PerformanceNavigationTiming",t=yn();return t||(t=mn(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function En(e){const{cartCreate:t,checkoutUrl:r}=ie(),[n,a]=c.useState(!1),{quantity:i,variantId:s,sellingPlanId:o,onClick:u,attributes:d,children:g,...f}=e;c.useEffect(()=>{n&&r&&(window.location.href=r)},[n,r]);const y=c.useCallback(()=>{a(!0),t({lines:[{quantity:i??1,merchandiseId:s,attributes:d,sellingPlanId:o}]})},[t,i,s,d,o]);return React.createElement(Ae,{disabled:n??f.disabled,...f,onClick:u,defaultOnClick:y},g)}function _n(e){const[t,r]=c.useState(!1),{status:n,checkoutUrl:a}=ie(),{children:i,...s}=e;return c.useEffect(()=>{t&&a&&n==="idle"&&(window.location.href=a)},[t,n,a]),React.createElement(Ae,{...s,disabled:t||s.disabled,onClick:()=>r(!0)},i)}function St(e){const{countryIsoCode:t,languageIsoCode:r}=ce(),n=r.includes("_")?r.replace("_","-"):`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const a=parseFloat(e.amount),{defaultFormatter:i,nameFormatter:s,narrowSymbolFormatter:o,withoutTrailingZerosFormatter:u,withoutCurrencyFormatter:d,withoutTrailingZerosOrCurrencyFormatter:g}=c.useMemo(()=>{const l={style:"currency",currency:e.currencyCode};return{defaultFormatter:oe(n,l),nameFormatter:oe(n,{...l,currencyDisplay:"name"}),narrowSymbolFormatter:oe(n,{...l,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:oe(n,{...l,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:oe(n),withoutTrailingZerosOrCurrencyFormatter:oe(n,{minimumFractionDigits:0,maximumFractionDigits:0})}},[e.currencyCode,n]),f=l=>l.type==="currency",y=c.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(a),parts:()=>i().formatToParts(a),withoutTrailingZeros:()=>a%1===0?u().format(a):i().format(a),withoutTrailingZerosAndCurrency:()=>a%1===0?g().format(a):d().format(a),currencyName:()=>{var l;return((l=s().formatToParts(a).find(f))==null?void 0:l.value)??e.currencyCode},currencySymbol:()=>{var l;return((l=i().formatToParts(a).find(f))==null?void 0:l.value)??e.currencyCode},currencyNarrowSymbol:()=>{var l;return((l=o().formatToParts(a).find(f))==null?void 0:l.value)??""},amount:()=>i().formatToParts(a).filter(l=>["decimal","fraction","group","integer","literal"].includes(l.type)).map(l=>l.value).join("")}),[e,a,s,i,o,d,u,g]);return c.useMemo(()=>new Proxy(y,{get:(l,h)=>{var C;return(C=Reflect.get(l,h))==null?void 0:C.call(null)}}),[y])}const Tt=new Map;function oe(e,t){const r=JSON.stringify([e,t]);return function(){let n=Tt.get(r);return n||(n=new Intl.NumberFormat(e,t),Tt.set(r,n)),n}}function Ie({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:a,measurementSeparator:i="/",...s}){if(!Cn(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const o=St(e),u=t??"div";let d=o.localizedString;return(r||n)&&(r&&!n?d=o.amount:!r&&n?d=o.withoutTrailingZeros:d=o.withoutTrailingZerosAndCurrency),React.createElement(u,{...s},d,a&&a.referenceUnit&&React.createElement(React.Fragment,null,i,a.referenceUnit))}function Cn(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Sn(e){const{cost:t}=ie(),{amountType:r="total",children:n,...a}=e;let i;return r=="total"?i=t==null?void 0:t.totalAmount:r=="subtotal"?i=t==null?void 0:t.subtotalAmount:r=="tax"?i=t==null?void 0:t.totalTaxAmount:r=="duty"&&(i=t==null?void 0:t.totalDutyAmount),i==null?null:React.createElement(Ie,{...a,data:i},n)}const At=c.createContext(null);function Ve(){const e=c.useContext(At);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Tn({children:e,line:t}){return React.createElement(At.Provider,{value:t},e)}function An(e){const t=Ve(),{as:r,...n}=e,a=r||"span";return React.createElement(a,{...n},t.quantity)}function wn(e){const{status:t,linesRemove:r,linesUpdate:n}=ie(),a=Ve(),{children:i,adjust:s,onClick:o,...u}=e,d=c.useCallback(()=>{if(s==="remove"){r([(a==null?void 0:a.id)??""]);return}const f=s==="decrease"?((a==null?void 0:a.quantity)??0)-1:((a==null?void 0:a.quantity)??0)+1;if(f<=0){r([(a==null?void 0:a.id)??""]);return}const y={id:(a==null?void 0:a.id)??"",quantity:f,attributes:(a==null?void 0:a.attributes)??[]};n([y])},[s,a==null?void 0:a.attributes,a==null?void 0:a.id,a==null?void 0:a.quantity,r,n]),g=u.disabled;return React.createElement(Ae,{...u,onClick:o,defaultOnClick:d,disabled:typeof g<"u"?g:t!=="idle"},i)}const In={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"},bn={DateTime:"string",Decimal:"string",HTML:"string",ISO8601DateTime:"string",URL:"string",UnsignedInt64:"string"},wt=c.forwardRef((e,t)=>{const{data:r,options:n,id:a=r.id,frameBorder:i="0",allow:s="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:o=!0,loading:u="lazy",...d}=e;if(!r.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let g=r.embedUrl;if(n){const f=new URL(r.embedUrl);for(const[y,l]of Object.entries(n))typeof l>"u"||f.searchParams.set(y,l.toString());g=f.toString()}return React.createElement("iframe",{...d,id:a??r.embedUrl,title:r.alt??r.id??"external video",frameBorder:i,allow:s,allowFullScreen:o,src:g,loading:u,ref:t})}),vn=`#graphql
275
275
  fragment Image on Image {
276
276
  altText
277
277
  url
278
278
  width
279
279
  height
280
280
  }
281
- `,It=N.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:a="async",height:i="auto",loader:s=de,loading:o="lazy",sizes:u,src:d,srcSetOptions:g={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:f="100%",...y},l)=>{const h=N.useMemo(()=>{const p=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,_=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:p,height:_,unitsMatch:!!bt(p,_)}},[n]),C=N.useMemo(()=>{const _=fe((f||"100%").toString()),R=`${_.number}${_.unit}`,P=i==null,A=P?null:fe(i.toString()),v=A?`${A.number}${A.unit}`:"",H=P?"auto":v,k=d||(n==null?void 0:n.url),j=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",z=t||(h.unitsMatch?[he(h.width),he(h.height)].join("/"):void 0);return{width:R,height:H,src:k,alt:j,aspectRatio:z}},[f,i,d,n,e,t,h,y==null?void 0:y.key]),{intervals:T,startingWidth:w,incrementSize:b,placeholderWidth:I}=g,D=N.useMemo(()=>Rn(f,T,w,b),[f,T,w,b]);return vt(C.width)?N.createElement(vn,{aspectRatio:t,crop:r,decoding:a,height:i,imageWidths:D,loader:s,loading:o,normalizedProps:C,passthroughProps:y,ref:l,width:f,data:n}):N.createElement(Pn,{aspectRatio:t,crop:r,decoding:a,imageWidths:D,loader:s,loading:o,normalizedProps:C,passthroughProps:y,placeholderWidth:I,ref:l,sizes:u,data:n})}),vn=N.forwardRef(({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:a,loader:i=de,loading:s,normalizedProps:o,passthroughProps:u,width:d,data:g},f)=>{const y=N.useMemo(()=>{const l=he(d),h=he(n),C=e||(bt(o.width,o.height)?[l,h].join("/"):o.aspectRatio?o.aspectRatio:void 0),T=a===void 0?void 0:Rt(a,C,t,{width:(g==null?void 0:g.width)??void 0,height:(g==null?void 0:g.height)??void 0}),w=h||(C&&l?l*(Me(C)??1):void 0),b=Pt(o.src,T,i),I=i({src:o.src,width:l,height:w,crop:o.height==="auto"?void 0:t});return{width:l,aspectRatio:C,height:w,srcSet:b,src:I}},[e,t,g,n,a,i,o,d]);return N.createElement("img",{ref:f,alt:o.alt,decoding:r,height:y.height,loading:s,src:y.src,srcSet:y.srcSet,width:y.width,style:{aspectRatio:y.aspectRatio,...u.style},...u})}),Pn=N.forwardRef(({crop:e,decoding:t,imageWidths:r,loader:n=de,loading:a,normalizedProps:i,passthroughProps:s,placeholderWidth:o,sizes:u,data:d},g)=>{const f=N.useMemo(()=>{const y=r===void 0?void 0:Rt(r,i.aspectRatio,e,{width:(d==null?void 0:d.width)??void 0,height:(d==null?void 0:d.height)??void 0}),l=i.aspectRatio&&o?o*(Me(i.aspectRatio)??1):void 0,h=Pt(i.src,y,n),C=n({src:i.src,width:o,height:l,crop:e});return{placeholderHeight:l,srcSet:h,src:C}},[e,d,r,n,i,o]);return N.createElement("img",{ref:g,alt:i.alt,decoding:t,height:f.placeholderHeight,loading:a,sizes:u,src:f.src,srcSet:f.srcSet,width:o,...s,style:{width:i.width,aspectRatio:i.aspectRatio,...s.style}})});function de({src:e,width:t,height:r,crop:n}){if(!e)return"";const a=new URL(e);return t&&a.searchParams.append("width",Math.round(t).toString()),r&&a.searchParams.append("height",Math.round(r).toString()),n&&a.searchParams.append("crop",n),a.href}function bt(e="100%",t="auto"){return fe(e.toString()).unit===fe(t.toString()).unit}function fe(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function he(e){if(e===void 0)return;const{unit:t,number:r}=fe(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function vt(e){return typeof e=="number"||/\d(px|em|rem)$/.test(e)}function Pt(e,t,r=de){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,a)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${a+1}x`:`${n.width??0}w`}`).join(", "):""}function Rn(e="100%",t,r,n){const a=Array.from({length:t},(s,o)=>o*n+r),i=Array.from({length:3},(s,o)=>(o+1)*(he(e)??0));return vt(e)?i:a}function Me(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function Rt(e,t,r="center",n){if(e)return e.map(a=>({width:a,height:t?a*(Me(t)??1):void 0,crop:r})).filter(({width:a,height:i})=>!(n!=null&&n.width&&a>n.width||n!=null&&n.height&&i&&i>n.height))}const Dt={};function Dn(e,t){const r=Dt[e];if(r)return r;const n=new Promise((a,i)=>{const s=document.createElement("script");t!=null&&t.module?s.type="module":s.type="text/javascript",s.src=e,s.onload=()=>{a(!0)},s.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(s):document.body.appendChild(s);const o=t==null?void 0:t.attributes;o&&Object.keys(o).forEach(u=>{s.setAttribute(u,o[u])})});return Dt[e]=n,n}function Le(e,t){const[r,n]=c.useState("loading");return c.useEffect(()=>{Dn(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}const kt=c.forwardRef((e,t)=>{var g;const{data:r,previewImageOptions:n,id:a=r.id,playsInline:i=!0,controls:s=!0,sourceProps:o={},...u}=e,d=de({src:((g=r.previewImage)==null?void 0:g.url)??"",...n});if(!r.sources)throw new Error("<Video/> requires a 'data.sources' array");return React.createElement("video",{...u,id:a,playsInline:i,controls:s,poster:d,ref:t},r.sources.map(f=>{if(!(f!=null&&f.url&&(f!=null&&f.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return React.createElement("source",{...o,key:f.url,src:f.url,type:f.mimeType})}))});function Ot(e){var d,g,f;const[t,r]=c.useState(void 0),n=c.useCallback(y=>{r(y)},[]),{data:a,children:i,className:s,...o}=e,u=Le("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return c.useEffect(()=>{const y={error:o.onError,load:o.onLoad,preload:o.onPreload,"model-visibility":o.onModelVisibility,progress:o.onProgress,"ar-status":o.onArStatus,"ar-tracking":o.onArTracking,"quick-look-button-tapped":o.onQuickLookButtonTapped,"camera-change":o.onCameraChange,"environment-change":o.onEnvironmentChange,play:o.onPlay,pause:o.onPause,"scene-graph-ready":o.onSceneGraphReady};if(t)return Object.entries(y).forEach(([l,h])=>{h&&t.addEventListener(l,h)}),()=>{t!=null&&Object.entries(y).forEach(([l,h])=>{h&&t.removeEventListener(l,h)})}},[t,o.onArStatus,o.onArTracking,o.onCameraChange,o.onEnvironmentChange,o.onError,o.onLoad,o.onModelVisibility,o.onPause,o.onPlay,o.onPreload,o.onProgress,o.onQuickLookButtonTapped,o.onSceneGraphReady]),u!=="done"?null:(g=(d=a.sources)==null?void 0:d[0])!=null&&g.url?React.createElement("model-viewer",{ref:n,...o,class:s,id:o.id??a.id,src:a.sources[0].url,alt:a.alt??null,"camera-controls":o.cameraControls??!0,poster:(o.poster||((f=a.previewImage)==null?void 0:f.url))??null,autoplay:o.autoplay??!0,loading:o.loading,reveal:o.reveal,ar:o.ar,"ar-modes":o.arModes,"ar-scale":o.arScale,"ar-placement":o.arPlacement,"ios-src":o.iosSrc,"touch-action":o.touchAction,"disable-zoom":o.disableZoom,"orbit-sensitivity":o.orbitSensitivity,"auto-rotate":o.autoRotate,"auto-rotate-delay":o.autoRotateDelay,"rotation-per-second":o.rotationPerSecond,"interaction-policy":o.interactionPolicy,"interaction-prompt":o.interactionPrompt,"interaction-prompt-style":o.interactionPromptStyle,"interaction-prompt-threshold":o.interactionPromptThreshold,"camera-orbit":o.cameraOrbit,"camera-target":o.cameraTarget,"field-of-view":o.fieldOfView,"max-camera-orbit":o.maxCameraOrbit,"min-camera-orbit":o.minCameraOrbit,"max-field-of-view":o.maxFieldOfView,"min-field-of-view":o.minFieldOfView,bounds:o.bounds,"interpolation-decay":o.interpolationDecay??100,"skybox-image":o.skyboxImage,"environment-image":o.environmentImage,exposure:o.exposure,"shadow-intensity":o.shadowIntensity??0,"shadow-softness":o.shadowSoftness??0,"animation-name":o.animationName,"animation-crossfade-duration":o.animationCrossfadeDuration,"variant-name":o.variantName,orientation:o.orientation,scale:o.scale},i):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}function kn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?React.createElement(It,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return React.createElement(kt,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return React.createElement(wt,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return React.createElement(Ot,{...r,...t==null?void 0:t.modelViewer,data:e});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media. Rendering 'null' by default"),null}}function On(e){if(!e.type)return console.error("parseMetafield(): The 'type' field is required in order to parse the Metafield. Returning 'parsedValue' of 'null'"),{...e,parsedValue:null};switch(e.type){case"boolean":return{...e,parsedValue:e.value==="true"};case"collection_reference":case"file_reference":case"page_reference":case"product_reference":case"variant_reference":return{...e,parsedValue:e.reference};case"color":case"multi_line_text_field":case"single_line_text_field":case"url":return{...e,parsedValue:e.value};case"dimension":case"money":case"json":case"rating":case"volume":case"weight":case"rich_text_field":case"list.color":case"list.dimension":case"list.number_integer":case"list.number_decimal":case"list.rating":case"list.single_line_text_field":case"list.url":case"list.volume":case"list.weight":{let t=null;try{t=Ut(e.value??"")}catch{console.error("parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed. Returning 'null' for 'parsedValue'"),t=null}return{...e,parsedValue:t}}case"date":case"date_time":return{...e,parsedValue:new Date(e.value??"")};case"list.date":case"list.date_time":{const t=Ut((e==null?void 0:e.value)??"");return{...e,parsedValue:t.map(r=>new Date(r))}}case"number_decimal":case"number_integer":return{...e,parsedValue:Number(e.value)};case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:J(e.references??void 0)};default:{const t=`parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: "${e.type}". If you believe this is an error, please open an issue on GitHub.`;return console.error(`${t} Returning 'parsedValue' of 'null'`),{...e,parsedValue:null}}}}function Ut(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function Un(e){var g,f,y,l,h,C,T;const{priceType:t="regular",variantId:r,valueType:n="min",data:a,...i}=e;if(a==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let s,o;const u=r?J((a==null?void 0:a.variants)??{}).find(w=>(w==null?void 0:w.id)===r)??null:null,d=n==="max"?"maxVariantPrice":"minVariantPrice";if(t==="compareAt"){r&&u?(u.compareAtPriceV2&&console.error("<ProductPrice> `compareAtPriceV2` is deprecated. Use `compareAtPrice` instead."),s=u.compareAtPrice??u.compareAtPriceV2):s=(g=a==null?void 0:a.compareAtPriceRange)==null?void 0:g[d];let w;r&&u?w=parseFloat(((f=u.price)==null?void 0:f.amount)??((y=u.priceV2)==null?void 0:y.amount)??"0"):w=parseFloat(((h=(l=a==null?void 0:a.priceRange)==null?void 0:l[d])==null?void 0:h.amount)??"0");const b=parseFloat((s==null?void 0:s.amount)??"0");if(w>=b)return null}else r&&u?(u.priceV2&&console.error("<ProductPrice> `priceV2` is deprecated. Use `price` instead."),s=u.price??u.priceV2,n==="unit"&&(s=u.unitPrice,o=u.unitPriceMeasurement)):n==="max"?s=(C=a.priceRange)==null?void 0:C.maxVariantPrice:s=(T=a.priceRange)==null?void 0:T.minVariantPrice;return s?o?React.createElement(Ie,{...i,data:s,measurement:o}):React.createElement(Ie,{...i,data:s}):null}const Nn={root:Vn,heading:Mn,paragraph:Ln,text:xn,link:Fn,list:$n,"list-item":qn};function Vn({node:e}){return React.createElement("div",null,e.children)}function Mn({node:e}){return c.createElement(`h${e.level??"1"}`,null,e.children)}function Ln({node:e}){return React.createElement("p",null,e.children)}function xn({node:e}){return e.bold&&e.italic?React.createElement("em",null,React.createElement("strong",null,e.value)):e.bold?React.createElement("strong",null,e.value):e.italic?React.createElement("em",null,e.value):e.value}function Fn({node:e}){return React.createElement("a",{href:e.url,title:e.title,target:e.target},e.children)}function $n({node:e}){const t=e.listType==="unordered"?"ul":"ol";return React.createElement(t,null,e.children)}function qn({node:e}){return React.createElement("li",null,e.children)}function Hn({as:e,data:t,plain:r,components:n,...a}){try{const i=e??"div",s=c.useMemo(()=>JSON.parse(t),[t]);return React.createElement(i,{...a},r?ge(s):Nt(n,s))}catch(i){throw new Error("[h2:error:RichText] Parsing error. Make sure to pass a JSON string of rich text metafield",{cause:i})}}function Nt(e={},t,r=0){let n;"children"in t&&(n=t.children.map((i,s)=>Nt(e,i,s)));const a=e[t.type==="list-item"?"listItem":t.type]??Nn[t.type];switch(t.type){case"root":return c.createElement(a,{key:r,node:{type:"root",children:n}});case"heading":return c.createElement(a,{key:r,node:{type:"heading",level:t.level,children:n}});case"paragraph":return c.createElement(a,{key:r,node:{type:"paragraph",children:n}});case"text":{const i=(t.value??"").split(`
282
- `).flatMap((s,o)=>{const u=`${r}-${s}-${o}`,d=c.createElement(a,{key:u,node:{type:"text",italic:t.italic,bold:t.bold,value:s}});return o===0?d:[c.createElement("br",{key:`${u}-br`}),d]});return i.length>1?c.createElement(c.Fragment,{key:r},i):i[0]}case"link":return c.createElement(a,{key:r,node:{type:"link",url:t.url,title:t.title,target:t.target,children:n}});case"list":return c.createElement(a,{key:r,node:{type:"list",listType:t.listType,children:n}});case"list-item":return c.createElement(a,{key:r,node:{type:"list-item",children:n}})}}function ge(e,t=[]){switch(e.type){case"root":e.children.forEach(r=>ge(r,t));break;case"heading":case"paragraph":e.children.forEach(r=>ge(r,t)),t.push(" ");break;case"text":t.push(e.value||"");break;case"link":e.children.forEach(r=>ge(r,t));break;case"list":e.children.forEach(r=>{r.children&&r.children.forEach(n=>ge(n,t)),t.push(" ")});break;default:throw new Error(`Unknown node encountered ${e.type}`)}return t.join("").trim()}const jn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function Bn(e){return e==="headless"||e==="hydrogen"}function Yn({channel:e,variantIds:t,className:r,variantIdsAndQuantities:n,width:a,storeDomain:i}){const s=ce(),o=i||(s==null?void 0:s.storeDomain),u=Le(jn);let d=[],g;if(!o||o===et.storeDomain)throw new Error(Wn);if(t&&n)throw new Error(Zn);if(!t&&!n)throw new Error(Vt);if(e)if(Bn(e))g=e;else throw new Error(Qn);if(t)d=t.reduce((y,l)=>{const h=F(l).id;return h&&y.push(h),y},[]);else if(n)d=n.reduce((y,l)=>{const h=F(l==null?void 0:l.id).id;return h&&y.push(`${h}:${(l==null?void 0:l.quantity)??1}`),y},[]);else throw new Error(Vt);if(d.length===0)throw new Error(Gn);const f=a?{"--shop-pay-button-width":a}:void 0;return React.createElement("div",{className:r,style:f},u==="done"&&React.createElement("shop-pay-button",{...g?{channel:g}:{},"store-url":o,variants:d.join(",")}))}const Wn='You must pass a "storeDomain" prop to the "ShopPayButton" component, or wrap it in a "ShopifyProvider" component.',Gn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',Vt='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',Zn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",Qn='Invalid channel attribution value. Must be either "headless" or "hydrogen"',Jn=60*60*24*360*1,Kn=60*30;function Xn(e){const{hasUserConsent:t=!1,domain:r="",checkoutDomain:n=""}=e||{};c.useEffect(()=>{const a=Te(document.cookie);let i=r||window.document.location.host;if(n){const o=n.split(".").reverse(),u=i.split(".").reverse(),d=[];o.forEach((g,f)=>{g===u[f]&&d.push(g)}),i=d.reverse().join(".")}/^localhost/.test(i)&&(i="");const s=i?/^\./.test(i)?i:`.${i}`:"";t?(be(K,a[K]||Se(),Jn,s),be(X,a[X]||Se(),Kn,s)):(be(K,"",0,s),be(X,"",0,s))},[e,t,r,n])}function be(e,t,r,n){document.cookie=Nr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}E.AddToCartButton=Qr,E.AnalyticsEventName=te,E.AnalyticsPageType=we,E.BuyNowButton=pn,E.CartCheckoutButton=En,E.CartCost=Cn,E.CartLineProvider=Sn,E.CartLineQuantity=Tn,E.CartLineQuantityAdjustButton=An,E.CartProvider=Hr,E.ExternalVideo=wt,E.IMAGE_FRAGMENT=bn,E.Image=It,E.MediaFile=kn,E.ModelViewer=Ot,E.Money=Ie,E.ProductPrice=Un,E.ProductProvider=Wr,E.RichText=Hn,E.SHOPIFY_S=X,E.SHOPIFY_STOREFRONT_ID_HEADER=rt,E.SHOPIFY_STOREFRONT_S_HEADER=at,E.SHOPIFY_STOREFRONT_Y_HEADER=nt,E.SHOPIFY_Y=K,E.ShopPayButton=Yn,E.ShopifyProvider=kr,E.ShopifySalesChannel=ht,E.Video=kt,E.createStorefrontClient=Rr,E.customerAccountApiCustomScalars=In,E.flattenConnection=J,E.getClientBrowserParameters=hn,E.getShopifyCookies=Te,E.parseGid=F,E.parseMetafield=On,E.sendShopifyAnalytics=ln,E.storefrontApiCustomScalars=wn,E.useCart=ie,E.useCartLine=Ve,E.useLoadScript=Le,E.useMoney=St,E.useProduct=ut,E.useShop=ce,E.useShopifyCookies=Xn,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
281
+ `,It=N.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:a="async",height:i="auto",loader:s=de,loading:o="lazy",sizes:u,src:d,srcSetOptions:g={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:f="100%",...y},l)=>{const h=N.useMemo(()=>{const p=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,_=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:p,height:_,unitsMatch:!!vt(p,_)}},[n]),C=N.useMemo(()=>{const _=fe((f||"100%").toString()),R=`${_.number}${_.unit}`,P=i==null,A=P?null:fe(i.toString()),v=A?`${A.number}${A.unit}`:"",H=P?"auto":v,k=d||(n==null?void 0:n.url),j=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",z=t||(h.unitsMatch?[he(h.width),he(h.height)].join("/"):void 0);return{width:R,height:H,src:k,alt:j,aspectRatio:z}},[f,i,d,n,e,t,h,y==null?void 0:y.key]),{intervals:T,startingWidth:w,incrementSize:b,placeholderWidth:I}=g,D=N.useMemo(()=>Dn(f,T,w,b),[f,T,w,b]);return Pt(C.width)?N.createElement(Pn,{aspectRatio:t,crop:r,decoding:a,height:i,imageWidths:D,loader:s,loading:o,normalizedProps:C,passthroughProps:y,ref:l,width:f,data:n}):N.createElement(Rn,{aspectRatio:t,crop:r,decoding:a,imageWidths:D,loader:s,loading:o,normalizedProps:C,passthroughProps:y,placeholderWidth:I,ref:l,sizes:u,data:n})}),Pn=N.forwardRef(({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:a,loader:i=de,loading:s,normalizedProps:o,passthroughProps:u,width:d,data:g},f)=>{const y=N.useMemo(()=>{const l=he(d),h=he(n),C=e||(vt(o.width,o.height)?[l,h].join("/"):o.aspectRatio?o.aspectRatio:void 0),T=a===void 0?void 0:Dt(a,C,t,{width:(g==null?void 0:g.width)??void 0,height:(g==null?void 0:g.height)??void 0}),w=h||(C&&l?l*(Me(C)??1):void 0),b=Rt(o.src,T,i),I=i({src:o.src,width:l,height:w,crop:o.height==="auto"?void 0:t});return{width:l,aspectRatio:C,height:w,srcSet:b,src:I}},[e,t,g,n,a,i,o,d]);return N.createElement("img",{ref:f,alt:o.alt,decoding:r,height:y.height,loading:s,src:y.src,srcSet:y.srcSet,width:y.width,style:{aspectRatio:y.aspectRatio,...u.style},...u})}),Rn=N.forwardRef(({crop:e,decoding:t,imageWidths:r,loader:n=de,loading:a,normalizedProps:i,passthroughProps:s,placeholderWidth:o,sizes:u,data:d},g)=>{const f=N.useMemo(()=>{const y=r===void 0?void 0:Dt(r,i.aspectRatio,e,{width:(d==null?void 0:d.width)??void 0,height:(d==null?void 0:d.height)??void 0}),l=i.aspectRatio&&o?o*(Me(i.aspectRatio)??1):void 0,h=Rt(i.src,y,n),C=n({src:i.src,width:o,height:l,crop:e});return{placeholderHeight:l,srcSet:h,src:C}},[e,d,r,n,i,o]);return N.createElement("img",{ref:g,alt:i.alt,decoding:t,height:f.placeholderHeight,loading:a,sizes:u,src:f.src,srcSet:f.srcSet,width:o,...s,style:{width:i.width,aspectRatio:i.aspectRatio,...s.style}})}),bt="https://placeholder.shopify.com";function de({src:e,width:t,height:r,crop:n}){if(!e)return"";const a=new URL(e,bt);return t&&a.searchParams.append("width",Math.round(t).toString()),r&&a.searchParams.append("height",Math.round(r).toString()),n&&a.searchParams.append("crop",n),a.href.replace(bt,"")}function vt(e="100%",t="auto"){return fe(e.toString()).unit===fe(t.toString()).unit}function fe(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function he(e){if(e===void 0)return;const{unit:t,number:r}=fe(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function Pt(e){return typeof e=="number"||/\d(px|em|rem)$/.test(e)}function Rt(e,t,r=de){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,a)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${a+1}x`:`${n.width??0}w`}`).join(", "):""}function Dn(e="100%",t,r,n){const a=Array.from({length:t},(s,o)=>o*n+r),i=Array.from({length:3},(s,o)=>(o+1)*(he(e)??0));return Pt(e)?i:a}function Me(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function Dt(e,t,r="center",n){if(e)return e.map(a=>({width:a,height:t?a*(Me(t)??1):void 0,crop:r})).filter(({width:a,height:i})=>!(n!=null&&n.width&&a>n.width||n!=null&&n.height&&i&&i>n.height))}const kt={};function kn(e,t){const r=kt[e];if(r)return r;const n=new Promise((a,i)=>{const s=document.createElement("script");t!=null&&t.module?s.type="module":s.type="text/javascript",s.src=e,s.onload=()=>{a(!0)},s.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(s):document.body.appendChild(s);const o=t==null?void 0:t.attributes;o&&Object.keys(o).forEach(u=>{s.setAttribute(u,o[u])})});return kt[e]=n,n}function Le(e,t){const[r,n]=c.useState("loading");return c.useEffect(()=>{kn(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}const Ot=c.forwardRef((e,t)=>{var g;const{data:r,previewImageOptions:n,id:a=r.id,playsInline:i=!0,controls:s=!0,sourceProps:o={},...u}=e,d=de({src:((g=r.previewImage)==null?void 0:g.url)??"",...n});if(!r.sources)throw new Error("<Video/> requires a 'data.sources' array");return React.createElement("video",{...u,id:a,playsInline:i,controls:s,poster:d,ref:t},r.sources.map(f=>{if(!(f!=null&&f.url&&(f!=null&&f.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return React.createElement("source",{...o,key:f.url,src:f.url,type:f.mimeType})}))});function Ut(e){var d,g,f;const[t,r]=c.useState(void 0),n=c.useCallback(y=>{r(y)},[]),{data:a,children:i,className:s,...o}=e,u=Le("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return c.useEffect(()=>{const y={error:o.onError,load:o.onLoad,preload:o.onPreload,"model-visibility":o.onModelVisibility,progress:o.onProgress,"ar-status":o.onArStatus,"ar-tracking":o.onArTracking,"quick-look-button-tapped":o.onQuickLookButtonTapped,"camera-change":o.onCameraChange,"environment-change":o.onEnvironmentChange,play:o.onPlay,pause:o.onPause,"scene-graph-ready":o.onSceneGraphReady};if(t)return Object.entries(y).forEach(([l,h])=>{h&&t.addEventListener(l,h)}),()=>{t!=null&&Object.entries(y).forEach(([l,h])=>{h&&t.removeEventListener(l,h)})}},[t,o.onArStatus,o.onArTracking,o.onCameraChange,o.onEnvironmentChange,o.onError,o.onLoad,o.onModelVisibility,o.onPause,o.onPlay,o.onPreload,o.onProgress,o.onQuickLookButtonTapped,o.onSceneGraphReady]),u!=="done"?null:(g=(d=a.sources)==null?void 0:d[0])!=null&&g.url?React.createElement("model-viewer",{ref:n,...o,class:s,id:o.id??a.id,src:a.sources[0].url,alt:a.alt??null,"camera-controls":o.cameraControls??!0,poster:(o.poster||((f=a.previewImage)==null?void 0:f.url))??null,autoplay:o.autoplay??!0,loading:o.loading,reveal:o.reveal,ar:o.ar,"ar-modes":o.arModes,"ar-scale":o.arScale,"ar-placement":o.arPlacement,"ios-src":o.iosSrc,"touch-action":o.touchAction,"disable-zoom":o.disableZoom,"orbit-sensitivity":o.orbitSensitivity,"auto-rotate":o.autoRotate,"auto-rotate-delay":o.autoRotateDelay,"rotation-per-second":o.rotationPerSecond,"interaction-policy":o.interactionPolicy,"interaction-prompt":o.interactionPrompt,"interaction-prompt-style":o.interactionPromptStyle,"interaction-prompt-threshold":o.interactionPromptThreshold,"camera-orbit":o.cameraOrbit,"camera-target":o.cameraTarget,"field-of-view":o.fieldOfView,"max-camera-orbit":o.maxCameraOrbit,"min-camera-orbit":o.minCameraOrbit,"max-field-of-view":o.maxFieldOfView,"min-field-of-view":o.minFieldOfView,bounds:o.bounds,"interpolation-decay":o.interpolationDecay??100,"skybox-image":o.skyboxImage,"environment-image":o.environmentImage,exposure:o.exposure,"shadow-intensity":o.shadowIntensity??0,"shadow-softness":o.shadowSoftness??0,"animation-name":o.animationName,"animation-crossfade-duration":o.animationCrossfadeDuration,"variant-name":o.variantName,orientation:o.orientation,scale:o.scale},i):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}function On({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?React.createElement(It,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return React.createElement(Ot,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return React.createElement(wt,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return React.createElement(Ut,{...r,...t==null?void 0:t.modelViewer,data:e});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media. Rendering 'null' by default"),null}}function Un(e){if(!e.type)return console.error("parseMetafield(): The 'type' field is required in order to parse the Metafield. Returning 'parsedValue' of 'null'"),{...e,parsedValue:null};switch(e.type){case"boolean":return{...e,parsedValue:e.value==="true"};case"collection_reference":case"file_reference":case"page_reference":case"product_reference":case"variant_reference":return{...e,parsedValue:e.reference};case"color":case"multi_line_text_field":case"single_line_text_field":case"url":return{...e,parsedValue:e.value};case"dimension":case"money":case"json":case"rating":case"volume":case"weight":case"rich_text_field":case"list.color":case"list.dimension":case"list.number_integer":case"list.number_decimal":case"list.rating":case"list.single_line_text_field":case"list.url":case"list.volume":case"list.weight":{let t=null;try{t=Nt(e.value??"")}catch{console.error("parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed. Returning 'null' for 'parsedValue'"),t=null}return{...e,parsedValue:t}}case"date":case"date_time":return{...e,parsedValue:new Date(e.value??"")};case"list.date":case"list.date_time":{const t=Nt((e==null?void 0:e.value)??"");return{...e,parsedValue:t.map(r=>new Date(r))}}case"number_decimal":case"number_integer":return{...e,parsedValue:Number(e.value)};case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:J(e.references??void 0)};default:{const t=`parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: "${e.type}". If you believe this is an error, please open an issue on GitHub.`;return console.error(`${t} Returning 'parsedValue' of 'null'`),{...e,parsedValue:null}}}}function Nt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function Nn(e){var g,f,y,l,h,C,T;const{priceType:t="regular",variantId:r,valueType:n="min",data:a,...i}=e;if(a==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let s,o;const u=r?J((a==null?void 0:a.variants)??{}).find(w=>(w==null?void 0:w.id)===r)??null:null,d=n==="max"?"maxVariantPrice":"minVariantPrice";if(t==="compareAt"){r&&u?(u.compareAtPriceV2&&console.error("<ProductPrice> `compareAtPriceV2` is deprecated. Use `compareAtPrice` instead."),s=u.compareAtPrice??u.compareAtPriceV2):s=(g=a==null?void 0:a.compareAtPriceRange)==null?void 0:g[d];let w;r&&u?w=parseFloat(((f=u.price)==null?void 0:f.amount)??((y=u.priceV2)==null?void 0:y.amount)??"0"):w=parseFloat(((h=(l=a==null?void 0:a.priceRange)==null?void 0:l[d])==null?void 0:h.amount)??"0");const b=parseFloat((s==null?void 0:s.amount)??"0");if(w>=b)return null}else r&&u?(u.priceV2&&console.error("<ProductPrice> `priceV2` is deprecated. Use `price` instead."),s=u.price??u.priceV2,n==="unit"&&(s=u.unitPrice,o=u.unitPriceMeasurement)):n==="max"?s=(C=a.priceRange)==null?void 0:C.maxVariantPrice:s=(T=a.priceRange)==null?void 0:T.minVariantPrice;return s?o?React.createElement(Ie,{...i,data:s,measurement:o}):React.createElement(Ie,{...i,data:s}):null}const Vn={root:Mn,heading:Ln,paragraph:xn,text:Fn,link:$n,list:qn,"list-item":Hn};function Mn({node:e}){return React.createElement("div",null,e.children)}function Ln({node:e}){return c.createElement(`h${e.level??"1"}`,null,e.children)}function xn({node:e}){return React.createElement("p",null,e.children)}function Fn({node:e}){return e.bold&&e.italic?React.createElement("em",null,React.createElement("strong",null,e.value)):e.bold?React.createElement("strong",null,e.value):e.italic?React.createElement("em",null,e.value):e.value}function $n({node:e}){return React.createElement("a",{href:e.url,title:e.title,target:e.target},e.children)}function qn({node:e}){const t=e.listType==="unordered"?"ul":"ol";return React.createElement(t,null,e.children)}function Hn({node:e}){return React.createElement("li",null,e.children)}function jn({as:e,data:t,plain:r,components:n,...a}){try{const i=e??"div",s=c.useMemo(()=>JSON.parse(t),[t]);return React.createElement(i,{...a},r?ge(s):Vt(n,s))}catch(i){throw new Error("[h2:error:RichText] Parsing error. Make sure to pass a JSON string of rich text metafield",{cause:i})}}function Vt(e={},t,r=0){let n;"children"in t&&(n=t.children.map((i,s)=>Vt(e,i,s)));const a=e[t.type==="list-item"?"listItem":t.type]??Vn[t.type];switch(t.type){case"root":return c.createElement(a,{key:r,node:{type:"root",children:n}});case"heading":return c.createElement(a,{key:r,node:{type:"heading",level:t.level,children:n}});case"paragraph":return c.createElement(a,{key:r,node:{type:"paragraph",children:n}});case"text":{const i=(t.value??"").split(`
282
+ `).flatMap((s,o)=>{const u=`${r}-${s}-${o}`,d=c.createElement(a,{key:u,node:{type:"text",italic:t.italic,bold:t.bold,value:s}});return o===0?d:[c.createElement("br",{key:`${u}-br`}),d]});return i.length>1?c.createElement(c.Fragment,{key:r},i):i[0]}case"link":return c.createElement(a,{key:r,node:{type:"link",url:t.url,title:t.title,target:t.target,children:n}});case"list":return c.createElement(a,{key:r,node:{type:"list",listType:t.listType,children:n}});case"list-item":return c.createElement(a,{key:r,node:{type:"list-item",children:n}})}}function ge(e,t=[]){switch(e.type){case"root":e.children.forEach(r=>ge(r,t));break;case"heading":case"paragraph":e.children.forEach(r=>ge(r,t)),t.push(" ");break;case"text":t.push(e.value||"");break;case"link":e.children.forEach(r=>ge(r,t));break;case"list":e.children.forEach(r=>{r.children&&r.children.forEach(n=>ge(n,t)),t.push(" ")});break;default:throw new Error(`Unknown node encountered ${e.type}`)}return t.join("").trim()}const Bn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function Yn(e){return e==="headless"||e==="hydrogen"}function Wn({channel:e,variantIds:t,className:r,variantIdsAndQuantities:n,width:a,storeDomain:i}){const s=ce(),o=i||(s==null?void 0:s.storeDomain),u=Le(Bn);let d=[],g;if(!o||o===et.storeDomain)throw new Error(Gn);if(t&&n)throw new Error(Qn);if(!t&&!n)throw new Error(Mt);if(e)if(Yn(e))g=e;else throw new Error(Jn);if(t)d=t.reduce((y,l)=>{const h=F(l).id;return h&&y.push(h),y},[]);else if(n)d=n.reduce((y,l)=>{const h=F(l==null?void 0:l.id).id;return h&&y.push(`${h}:${(l==null?void 0:l.quantity)??1}`),y},[]);else throw new Error(Mt);if(d.length===0)throw new Error(Zn);const f=a?{"--shop-pay-button-width":a}:void 0;return React.createElement("div",{className:r,style:f},u==="done"&&React.createElement("shop-pay-button",{...g?{channel:g}:{},"store-url":o,variants:d.join(",")}))}const Gn='You must pass a "storeDomain" prop to the "ShopPayButton" component, or wrap it in a "ShopifyProvider" component.',Zn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',Mt='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',Qn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",Jn='Invalid channel attribution value. Must be either "headless" or "hydrogen"',Kn=60*60*24*360*1,Xn=60*30;function zn(e){const{hasUserConsent:t=!1,domain:r="",checkoutDomain:n=""}=e||{};c.useEffect(()=>{const a=Te(document.cookie);let i=r||window.document.location.host;if(n){const o=n.split(".").reverse(),u=i.split(".").reverse(),d=[];o.forEach((g,f)=>{g===u[f]&&d.push(g)}),i=d.reverse().join(".")}/^localhost/.test(i)&&(i="");const s=i?/^\./.test(i)?i:`.${i}`:"";t?(be(K,a[K]||Se(),Kn,s),be(X,a[X]||Se(),Xn,s)):(be(K,"",0,s),be(X,"",0,s))},[e,t,r,n])}function be(e,t,r,n){document.cookie=Vr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}E.AddToCartButton=Jr,E.AnalyticsEventName=te,E.AnalyticsPageType=we,E.BuyNowButton=En,E.CartCheckoutButton=_n,E.CartCost=Sn,E.CartLineProvider=Tn,E.CartLineQuantity=An,E.CartLineQuantityAdjustButton=wn,E.CartProvider=jr,E.ExternalVideo=wt,E.IMAGE_FRAGMENT=vn,E.Image=It,E.MediaFile=On,E.ModelViewer=Ut,E.Money=Ie,E.ProductPrice=Nn,E.ProductProvider=Gr,E.RichText=jn,E.SHOPIFY_S=X,E.SHOPIFY_STOREFRONT_ID_HEADER=rt,E.SHOPIFY_STOREFRONT_S_HEADER=at,E.SHOPIFY_STOREFRONT_Y_HEADER=nt,E.SHOPIFY_Y=K,E.ShopPayButton=Wn,E.ShopifyProvider=Or,E.ShopifySalesChannel=ht,E.Video=Ot,E.createStorefrontClient=Dr,E.customerAccountApiCustomScalars=bn,E.flattenConnection=J,E.getClientBrowserParameters=gn,E.getShopifyCookies=Te,E.parseGid=F,E.parseMetafield=Un,E.sendShopifyAnalytics=dn,E.storefrontApiCustomScalars=In,E.useCart=ie,E.useCartLine=Ve,E.useLoadScript=Le,E.useMoney=St,E.useProduct=ut,E.useShop=ce,E.useShopifyCookies=zn,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
283
283
  //# sourceMappingURL=hydrogen-react.prod.js.map