@shopify/hydrogen-react 0.0.0-next-781568d → 0.0.0-next-8a75ef6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
- package/dist/browser-dev/CartLineQuantity.mjs +12 -0
- package/dist/browser-dev/CartLineQuantity.mjs.map +1 -0
- package/dist/browser-dev/CartLineQuantityAdjustButton.mjs +48 -0
- package/dist/browser-dev/CartLineQuantityAdjustButton.mjs.map +1 -0
- package/dist/browser-dev/index.mjs +4 -0
- package/dist/browser-dev/index.mjs.map +1 -1
- package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
- package/dist/browser-prod/CartLineQuantity.mjs +12 -0
- package/dist/browser-prod/CartLineQuantity.mjs.map +1 -0
- package/dist/browser-prod/CartLineQuantityAdjustButton.mjs +48 -0
- package/dist/browser-prod/CartLineQuantityAdjustButton.mjs.map +1 -0
- package/dist/browser-prod/index.mjs +4 -0
- package/dist/browser-prod/index.mjs.map +1 -1
- package/dist/node-dev/CartLineProvider.js.map +1 -1
- package/dist/node-dev/CartLineProvider.mjs.map +1 -1
- package/dist/node-dev/CartLineQuantity.js +12 -0
- package/dist/node-dev/CartLineQuantity.js.map +1 -0
- package/dist/node-dev/CartLineQuantity.mjs +12 -0
- package/dist/node-dev/CartLineQuantity.mjs.map +1 -0
- package/dist/node-dev/CartLineQuantityAdjustButton.js +48 -0
- package/dist/node-dev/CartLineQuantityAdjustButton.js.map +1 -0
- package/dist/node-dev/CartLineQuantityAdjustButton.mjs +48 -0
- package/dist/node-dev/CartLineQuantityAdjustButton.mjs.map +1 -0
- package/dist/node-dev/index.js +4 -0
- package/dist/node-dev/index.js.map +1 -1
- package/dist/node-dev/index.mjs +4 -0
- package/dist/node-dev/index.mjs.map +1 -1
- package/dist/node-prod/CartLineProvider.js.map +1 -1
- package/dist/node-prod/CartLineProvider.mjs.map +1 -1
- package/dist/node-prod/CartLineQuantity.js +12 -0
- package/dist/node-prod/CartLineQuantity.js.map +1 -0
- package/dist/node-prod/CartLineQuantity.mjs +12 -0
- package/dist/node-prod/CartLineQuantity.mjs.map +1 -0
- package/dist/node-prod/CartLineQuantityAdjustButton.js +48 -0
- package/dist/node-prod/CartLineQuantityAdjustButton.js.map +1 -0
- package/dist/node-prod/CartLineQuantityAdjustButton.mjs +48 -0
- package/dist/node-prod/CartLineQuantityAdjustButton.mjs.map +1 -0
- package/dist/node-prod/index.js +4 -0
- package/dist/node-prod/index.js.map +1 -1
- package/dist/node-prod/index.mjs +4 -0
- package/dist/node-prod/index.mjs.map +1 -1
- package/dist/types/CartLineProvider.d.ts +9 -3
- package/dist/types/CartLineQuantity.d.ts +13 -0
- package/dist/types/CartLineQuantityAdjustButton.d.ts +13 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/storefront-api-response.types.d.ts +1 -1
- package/dist/umd/hydrogen-react.dev.js +47 -0
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +16 -16
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(v,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(v=typeof globalThis<"u"?globalThis:v||self,s(v.hydrogenreact={},v.React))})(this,function(v,s){"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 Q=bt(s);/*! *****************************************************************************
|
|
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 Le(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,
|
|
14
|
+
***************************************************************************** */function Le(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,o,u=r.call(e),i=[];try{for(;(t===void 0||t-- >0)&&!(n=u.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}return i}var Y;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Y||(Y={}));var Ue={type:"xstate.init"};function _e(e){return e===void 0?[]:[].concat(e)}function J(e){return{type:"xstate.assign",assignment:e}}function ke(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 le(e){return function(t){return e===t}}function Ne(e){return typeof e=="string"?{type:e}:e}function Ve(e,t){return{value:e,context:t,actions:[],changed:!1,matches:le(e)}}function Me(e,t,r){var n=t,o=!1;return[e.filter(function(u){if(u.type==="xstate.assign"){o=!0;var i=Object.assign({},n);return typeof u.assignment=="function"?i=u.assignment(n,r):Object.keys(u.assignment).forEach(function(a){i[a]=typeof u.assignment[a]=="function"?u.assignment[a](n,r):u.assignment[a]}),n=i,!1}return!0}),n,o]}function Re(e,t){t===void 0&&(t={});var r=Le(Me(_e(e.states[e.initial].entry).map(function(i){return ke(i,t.actions)}),e.context,Ue),2),n=r[0],o=r[1],u={config:e,_options:t,initialState:{value:e.initial,actions:n,context:o,matches:le(e.initial)},transition:function(i,a){var y,f,l=typeof i=="string"?{value:i,context:e.context}:i,d=l.value,p=l.context,E=Ne(a),g=e.states[d];if(g.on){var b=_e(g.on[E.type]);try{for(var _=function(O){var K=typeof Symbol=="function"&&Symbol.iterator,L=K&&O[K],pe=0;if(L)return L.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&pe>=O.length&&(O=void 0),{value:O&&O[pe++],done:!O}}};throw new TypeError(K?"Object is not iterable.":"Symbol.iterator is not defined.")}(b),P=_.next();!P.done;P=_.next()){var w=P.value;if(w===void 0)return Ve(d,p);var T=typeof w=="string"?{target:w}:w,c=T.target,h=T.actions,m=h===void 0?[]:h,A=T.cond,I=A===void 0?function(){return!0}:A,S=c===void 0,D=c??d,U=e.states[D];if(I(p,E)){var V=Le(Me((S?_e(m):[].concat(g.exit,m,U.entry).filter(function(O){return O})).map(function(O){return ke(O,u._options.actions)}),p,E),3),$=V[0],G=V[1],re=V[2],F=c??d;return{value:F,context:G,actions:$,changed:c!==d||$.length>0||re,matches:le(F)}}}}catch(O){y={error:O}}finally{try{P&&!P.done&&(f=_.return)&&f.call(_)}finally{if(y)throw y.error}}}return Ve(d,p)}};return u}var $e=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function wt(e){var t=e.initialState,r=Y.NotStarted,n=new Set,o={_machine:e,send:function(u){r===Y.Running&&(t=e.transition(t,u),$e(t,Ne(u)),n.forEach(function(i){return i(t)}))},subscribe:function(u){return n.add(u),u(t),{unsubscribe:function(){return n.delete(u)}}},start:function(u){if(u){var i=typeof u=="object"?u:{context:e.config.context,value:u};t={value:i.value,actions:[],context:i.context,matches:le(i.value)}}else t=e.initialState;return r=Y.Running,$e(t,Ue),o},stop:function(){return r=Y.Stopped,n.clear(),o},get state(){return t},get status(){return r}};return o}var It=s.useLayoutEffect,Se={},Dt={get exports(){return Se},set exports(e){Se=e}},ve={},de={},Ot={get exports(){return de},set exports(e){de=e}},Ce={};/**
|
|
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
|
|
22
|
+
*/var xe;function Pt(){if(xe)return Ce;xe=1;var e=s;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,u=e.useLayoutEffect,i=e.useDebugValue;function a(d,p){var E=p(),g=n({inst:{value:E,getSnapshot:p}}),b=g[0].inst,_=g[1];return u(function(){b.value=E,b.getSnapshot=p,y(b)&&_({inst:b})},[d,E,p]),o(function(){return y(b)&&_({inst:b}),d(function(){y(b)&&_({inst:b})})},[d]),i(E),E}function y(d){var p=d.getSnapshot;d=d.value;try{var E=p();return!r(d,E)}catch{return!0}}function f(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:a;return Ce.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,Ce}var Te={};/**
|
|
23
23
|
* @license React
|
|
24
24
|
* use-sync-external-store-shim.development.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
|
|
30
|
+
*/var qe;function Lt(){return qe||(qe=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=s,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(T){{for(var c=arguments.length,h=new Array(c>1?c-1:0),m=1;m<c;m++)h[m-1]=arguments[m];n("error",T,h)}}function n(T,c,h){{var m=t.ReactDebugCurrentFrame,A=m.getStackAddendum();A!==""&&(c+="%s",h=h.concat([A]));var I=h.map(function(S){return String(S)});I.unshift("Warning: "+c),Function.prototype.apply.call(console[T],console,I)}}function o(T,c){return T===c&&(T!==0||1/T===1/c)||T!==T&&c!==c}var u=typeof Object.is=="function"?Object.is:o,i=e.useState,a=e.useEffect,y=e.useLayoutEffect,f=e.useDebugValue,l=!1,d=!1;function p(T,c,h){l||e.startTransition!==void 0&&(l=!0,r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=c();if(!d){var A=c();u(m,A)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var I=i({inst:{value:m,getSnapshot:c}}),S=I[0].inst,D=I[1];return y(function(){S.value=m,S.getSnapshot=c,E(S)&&D({inst:S})},[T,m,c]),a(function(){E(S)&&D({inst:S});var U=function(){E(S)&&D({inst:S})};return T(U)},[T]),f(m),m}function E(T){var c=T.getSnapshot,h=T.value;try{var m=c();return!u(h,m)}catch{return!0}}function g(T,c,h){return c()}var b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!b,P=_?g:p,w=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:P;Te.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Te}var Fe;function Be(){return Fe||(Fe=1,function(e){process.env.NODE_ENV==="production"?e.exports=Pt():e.exports=Lt()}(Ot)),de}/**
|
|
31
31
|
* @license React
|
|
32
32
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
33
33
|
*
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*
|
|
36
36
|
* This source code is licensed under the MIT license found in the
|
|
37
37
|
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/var
|
|
38
|
+
*/var He;function Ut(){if(He)return ve;He=1;var e=s,t=Be();function r(f,l){return f===l&&(f!==0||1/f===1/l)||f!==f&&l!==l}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,u=e.useRef,i=e.useEffect,a=e.useMemo,y=e.useDebugValue;return ve.useSyncExternalStoreWithSelector=function(f,l,d,p,E){var g=u(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=a(function(){function P(m){if(!w){if(w=!0,T=m,m=p(m),E!==void 0&&b.hasValue){var A=b.value;if(E(A,m))return c=A}return c=m}if(A=c,n(T,m))return A;var I=p(m);return E!==void 0&&E(A,I)?A:(T=m,c=I)}var w=!1,T,c,h=d===void 0?null:d;return[function(){return P(l())},h===null?void 0:function(){return P(h())}]},[l,d,p,E]);var _=o(f,g[0],g[1]);return i(function(){b.hasValue=!0,b.value=_},[_]),y(_),_},ve}var Ae={};/**
|
|
39
39
|
* @license React
|
|
40
40
|
* use-sync-external-store-shim/with-selector.development.js
|
|
41
41
|
*
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the MIT license found in the
|
|
45
45
|
* LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/var
|
|
46
|
+
*/var je;function kt(){return je||(je=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=s,t=Be();function r(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,u=e.useRef,i=e.useEffect,a=e.useMemo,y=e.useDebugValue;function f(l,d,p,E,g){var b=u(null),_;b.current===null?(_={hasValue:!1,value:null},b.current=_):_=b.current;var P=a(function(){var h=!1,m,A,I=function(V){if(!h){h=!0,m=V;var $=E(V);if(g!==void 0&&_.hasValue){var G=_.value;if(g(G,$))return A=G,G}return A=$,$}var re=m,F=A;if(n(re,V))return F;var O=E(V);return g!==void 0&&g(F,O)?F:(m=V,A=O,O)},S=p===void 0?null:p,D=function(){return I(d())},U=S===null?void 0:function(){return I(S())};return[D,U]},[d,p,E,g]),w=P[0],T=P[1],c=o(l,w,T);return i(function(){_.hasValue=!0,_.value=c},[c]),y(c),c}Ae.useSyncExternalStoreWithSelector=f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ae}(function(e){process.env.NODE_ENV==="production"?e.exports=Ut():e.exports=kt()})(Dt);function Nt(e){var t=Q.useRef();return t.current||(t.current={v:e()}),t.current.v}var Ge=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,u=[],i;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)u.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return u};function Vt(e){return e}var Mt=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Rt(e,t){var r=s.useRef();if(process.env.NODE_ENV!=="production"){var n=Ge(s.useState(e),1),o=n[0];e!==o&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var u=Ge(Nt(function(){var f=[],l=wt(Re(e.config,t||e._options)),d=l.send;return l.send=function(p){if(l.status===Y.NotStarted){f.push(p);return}d(p),r.current=l.state},[l,f]}),2),i=u[0],a=u[1];It(function(){t&&(i._machine._options=t)});var y=xt(i);return s.useEffect(function(){return i.start(r.current),a.forEach(i.send),r.current=i.state,function(){i.stop()}},[]),y}var $t=function(e,t){return t.changed===!1};function xt(e){var t=s.useCallback(function(){return Mt(e)},[e]),r=s.useCallback(function(o){var u=e.subscribe(o).unsubscribe;return u},[e]),n=Se.useSyncExternalStoreWithSelector(r,t,t,Vt,$t);return[n,e.send,e]}function H(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 qt=e=>`
|
|
47
47
|
mutation CartLineAdd(
|
|
48
48
|
$cartId: ID!
|
|
49
49
|
$lines: [CartLineInput!]!
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
${e}
|
|
61
|
-
`,
|
|
61
|
+
`,Ft=e=>`
|
|
62
62
|
mutation CartCreate(
|
|
63
63
|
$input: CartInput!
|
|
64
64
|
$numCartLines: Int = 250
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
${e}
|
|
75
|
-
`,
|
|
75
|
+
`,Bt=e=>`
|
|
76
76
|
mutation CartLineRemove(
|
|
77
77
|
$cartId: ID!
|
|
78
78
|
$lines: [ID!]!
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
${e}
|
|
90
|
-
`,
|
|
90
|
+
`,Ht=e=>`
|
|
91
91
|
mutation CartLineUpdate(
|
|
92
92
|
$cartId: ID!
|
|
93
93
|
$lines: [CartLineUpdateInput!]!
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
${e}
|
|
105
|
-
`,
|
|
105
|
+
`,jt=e=>`
|
|
106
106
|
mutation CartNoteUpdate(
|
|
107
107
|
$cartId: ID!
|
|
108
108
|
$note: String
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
${e}
|
|
135
|
-
`,
|
|
135
|
+
`,Yt=e=>`
|
|
136
136
|
mutation CartAttributesUpdate(
|
|
137
137
|
$attributes: [AttributeInput!]!
|
|
138
138
|
$cartId: ID!
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
${e}
|
|
150
|
-
`,
|
|
150
|
+
`,Wt=e=>`
|
|
151
151
|
mutation CartDiscountCodesUpdate(
|
|
152
152
|
$cartId: ID!
|
|
153
153
|
$discountCodes: [String!]
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
${e}
|
|
165
|
-
`,
|
|
165
|
+
`,Zt=e=>`
|
|
166
166
|
query CartQuery(
|
|
167
167
|
$id: ID!
|
|
168
168
|
$numCartLines: Int = 250
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
${e}
|
|
177
|
-
`,
|
|
177
|
+
`,zt=`
|
|
178
178
|
fragment CartFragment on Cart {
|
|
179
179
|
id
|
|
180
180
|
checkoutUrl
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
width
|
|
275
275
|
height
|
|
276
276
|
}
|
|
277
|
-
`,re="2023-01";function zt(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:a,contentType:u}=e;return a!==re&&Kt(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${a}"; expected version "${re}"`),{getShopifyDomain(i){return(i==null?void 0:i.storeDomain)??t},getStorefrontApiUrl(i){const o=(i==null?void 0:i.storeDomain)??t;return`${o}${o.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??a}/graphql.json`},getPrivateTokenHeaders(i){if(!r&&!(i!=null&&i.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((i==null?void 0:i.contentType)??u)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":a,"Shopify-Storefront-Private-Token":(i==null?void 0:i.privateStorefrontToken)??r??"",...i!=null&&i.buyerIp?{"Shopify-Storefront-Buyer-IP":i.buyerIp}:{}}},getPublicTokenHeaders(i){if(!n&&!(i!=null&&i.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const o=(i==null?void 0:i.contentType)??u??"json";return je(o,a,(i==null?void 0:i.publicStorefrontToken)??n??"")}}}function je(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 Ye=new Set,Kt=e=>{Ye.has(e)||(console.warn(e),Ye.add(e))},We=s.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:re,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function Qt({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!==re&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${re}, 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=s.useMemo(()=>{function n(a){return(a==null?void 0:a.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(a){return je(a.contentType,t.storefrontApiVersion,a.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(a){const u=n({storeDomain:(a==null?void 0:a.storeDomain)??t.storeDomain});return`${u}${u.endsWith("/")?"":"/"}api/${(a==null?void 0:a.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return s.createElement(We.Provider,{value:r},e)}function fe(){const e=s.useContext(We);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Ae="shopifyCartId",Jt="Shopify-Storefront-Id",Xt="Shopify-Storefront-Y",er="Shopify-Storefront-S",W="_shopify_y",Z="_shopify_s";var tr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function rr(e){let t={},r,n,a=0,u=e.split(/;\s*/g),i,o;for(;a<u.length;a++)if(n=u[a],r=n.indexOf("="),~r){if(i=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{}tr.has(n=i.toLowerCase())?n==="expires"?t.expires=new Date(o):n==="max-age"?t.maxage=+o:t[n]=o:t[i]=o}else(i=n.trim().toLowerCase())&&(i==="httponly"||i==="secure")&&(t[i]=!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 Ze="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function ye(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Ze.replace(/[x]/g,a=>{const u=r[n]%16,i=a==="x"?u:u&3|8;return n++,i.toString(16)}).toUpperCase()}catch{e=Ze.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${or()}-${e}`}function or(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function he(e){const t=rr(e);return{[W]:t[W]||"",[Z]:t[Z]||""}}function ar(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=fe();return s.useCallback(({query:n,variables:a})=>{const u=t({contentType:"json"});e&&(u[Jt]=e);const i=he(document.cookie);return u[Xt]=i[W],u[er]=i[Z],fetch(r(),{method:"POST",headers:u,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 ir({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=ar(),a=s.useCallback(E=>n({query:Wt(t),variables:{id:E,numCartLines:e,country:r}}),[n,t,e,r]),u=s.useCallback(E=>n({query:qt(t),variables:{input:E,numCartLines:e,country:r}}),[t,r,n,e]),i=s.useCallback((E,g)=>n({query:xt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),o=s.useCallback((E,g)=>n({query:Bt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),h=s.useCallback((E,g)=>n({query:Ft(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),y=s.useCallback((E,g)=>n({query:Ht(t),variables:{cartId:E,note:g,numCartLines:e,country:r}}),[n,t,e,r]),l=s.useCallback((E,g)=>n({query:Gt(t),variables:{cartId:E,buyerIdentity:g,numCartLines:e,country:r}}),[t,r,n,e]),d=s.useCallback((E,g)=>n({query:jt(t),variables:{cartId:E,attributes:g,numCartLines:e,country:r}}),[t,r,n,e]),p=s.useCallback((E,g)=>n({query:Yt(t),variables:{cartId:E,discountCodes:g,numCartLines:e,country:r}}),[t,r,n,e]);return s.useMemo(()=>({cartFetch:a,cartCreate:u,cartLineAdd:i,cartLineUpdate:o,cartLineRemove:h,noteUpdate:y,buyerIdentityUpdate:l,cartAttributesUpdate:d,discountCodesUpdate:p,cartFragment:t}),[a,u,i,o,h,y,l,d,p,t])}function x(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],J({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[J({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:[J({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:J({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ne={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[J({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>be(t.payload.cart)})]}},ze={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 ur(e){return Re({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&be(e)},states:{uninitialized:{on:ne},cartCompleted:{on:ne},initializationError:{on:ne},idle:{on:{...ne,...ze}},error:{on:{...ne,...ze}},cartFetching:x("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:x("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:x("cartLineRemoveAction"),cartLineUpdating:x("cartLineUpdateAction"),cartLineAdding:x("cartLineAddAction"),noteUpdating:x("noteUpdateAction"),buyerIdentityUpdating:x("buyerIdentityUpdateAction"),cartAttributesUpdating:x("cartAttributesUpdateAction"),discountCodesUpdating:x("discountCodesUpdateAction")}})}function sr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:a,cartFragment:u,countryCode:i}){const{cartFetch:o,cartCreate:h,cartLineAdd:y,cartLineUpdate:l,cartLineRemove:d,noteUpdate:p,buyerIdentityUpdate:E,cartAttributesUpdate:g,discountCodesUpdate:b}=ir({numCartLines:e,cartFragment:u,countryCode:i}),_=s.useMemo(()=>ur(a),[a]),[L,w,T]=Rt(_,{actions:{cartFetchAction:async(c,f)=>{var S;if(f.type!=="CART_FETCH")return;const{data:m,errors:C}=await o((S=f==null?void 0:f.payload)==null?void 0:S.cartId),I=q(f,m==null?void 0:m.cart,C);w(I)},cartCreateAction:async(c,f)=>{var S;if(f.type!=="CART_CREATE")return;const{data:m,errors:C}=await h(f==null?void 0:f.payload),I=q(f,(S=m==null?void 0:m.cartCreate)==null?void 0:S.cart,C);w(I)},cartLineAddAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_ADD"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await y(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesAdd)==null?void 0:D.cart,C);w(I)},cartLineUpdateAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await l(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesUpdate)==null?void 0:D.cart,C);w(I)},cartLineRemoveAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_REMOVE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await d(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesRemove)==null?void 0:D.cart,C);w(I)},noteUpdateAction:async(c,f)=>{var S,D;if(f.type!=="NOTE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await p(c.cart.id,f.payload.note),I=q(f,(D=m==null?void 0:m.cartNoteUpdate)==null?void 0:D.cart,C);w(I)},buyerIdentityUpdateAction:async(c,f)=>{var S,D;if(f.type!=="BUYER_IDENTITY_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await E(c.cart.id,f.payload.buyerIdentity),I=q(f,(D=m==null?void 0:m.cartBuyerIdentityUpdate)==null?void 0:D.cart,C);w(I)},cartAttributesUpdateAction:async(c,f)=>{var S,D;if(f.type!=="CART_ATTRIBUTES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await g(c.cart.id,f.payload.attributes),I=q(f,(D=m==null?void 0:m.cartAttributesUpdate)==null?void 0:D.cart,C);w(I)},discountCodesUpdateAction:async(c,f)=>{var S,D;if(f.type!=="DISCOUNT_CODES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:C}=await b(c.cart.id,f.payload.discountCodes),I=q(f,(D=m==null?void 0:m.cartDiscountCodesUpdate)==null?void 0:D.cart,C);w(I)},...t&&{onCartActionEntry:(c,f)=>{cr(f)&&t(c,f)}},...r&&{onCartActionOptimisticUI:J((c,f)=>r(c,f))},...n&&{onCartActionComplete:(c,f)=>{lr(f)&&n(c,f)}}}});return s.useMemo(()=>[L,w,T],[L,w,T])}function be(e){return{...e,lines:H(e==null?void 0:e.lines),note:e.note??void 0}}function q(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:be(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function cr(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 lr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Ke=s.createContext(null);function oe(){const e=s.useContext(Ke);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function dr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:a,onLineUpdate:u,onNoteUpdate:i,onBuyerIdentityUpdate:o,onAttributesUpdate:h,onDiscountCodesUpdate:y,onCreateComplete:l,onLineAddComplete:d,onLineRemoveComplete:p,onLineUpdateComplete:E,onNoteUpdateComplete:g,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:_,onDiscountCodesUpdateComplete:L,data:w,cartFragment:T=Zt,customerAccessToken:c,countryCode:f="US"}){var Et,pt,_t,St,vt,Tt,Ct;f&&(f=f.toUpperCase());const[m,C]=s.useState(f),[I,S]=s.useState(c),D=s.useRef(!1);(m!==f||I!==c)&&(C(f),S(c),D.current=!1);const[U,V]=sr({numCartLines:t,data:w,cartFragment:T,countryCode:f,onCartActionEntry(v,k){try{switch(k.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 u==null?void 0:u();case"NOTE_UPDATE":return i==null?void 0:i();case"BUYER_IDENTITY_UPDATE":return o==null?void 0:o();case"CART_ATTRIBUTES_UPDATE":return h==null?void 0:h();case"DISCOUNT_CODES_UPDATE":return y==null?void 0:y()}}catch(R){console.error("Cart entry action failed",R)}},onCartActionOptimisticUI(v,k){var R,B,N,ce;if(!v.cart)return{...v};switch(k.type){case"CARTLINE_REMOVE":return{...v,cart:{...v.cart,lines:(B=(R=v==null?void 0:v.cart)==null?void 0:R.lines)==null?void 0:B.filter(M=>(M==null?void 0:M.id)&&!k.payload.lines.includes(M==null?void 0:M.id))}};case"CARTLINE_UPDATE":return{...v,cart:{...v.cart,lines:(ce=(N=v==null?void 0:v.cart)==null?void 0:N.lines)==null?void 0:ce.map(M=>{const Oe=k.payload.lines.find(({id:ln})=>ln===(M==null?void 0:M.id));return Oe&&Oe.quantity?{...M,quantity:Oe.quantity}:M})}}}return{...v}},onCartActionComplete(v,k){const R=k.payload.cartActionEvent;try{switch(k.type){case"RESOLVE":switch(R.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return d==null?void 0:d();case"CARTLINE_REMOVE":return p==null?void 0:p();case"CARTLINE_UPDATE":return E==null?void 0:E();case"NOTE_UPDATE":return g==null?void 0:g();case"BUYER_IDENTITY_UPDATE":return hr(v,R)&&(D.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return _==null?void 0:_();case"DISCOUNT_CODES_UPDATE":return L==null?void 0:L()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),$=s.useRef(!1),j=U.matches("cartCompleted"),te=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&f!==((_t=(pt=(Et=U==null?void 0:U.context)==null?void 0:Et.cart)==null?void 0:pt.buyerIdentity)==null?void 0:_t.countryCode)&&!U.context.errors,F=s.useRef(!1);s.useEffect(()=>{if(!$.current&&!F.current){if(!w&&we("localStorage")){F.current=!0;try{const v=window.localStorage.getItem(Ae);v&&V({type:"CART_FETCH",payload:{cartId:v}})}catch(v){console.warn("error fetching cartId"),console.warn(v)}}$.current=!0}},[w,$,V]),s.useEffect(()=>{!te||D.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:c}}})},[f,c,te,D,V]);const O=s.useCallback(v=>{if(!$.current)return console.warn("Cart isn't ready yet");V(v)},[V]);s.useEffect(()=>{var v,k,R;if((k=(v=U==null?void 0:U.context)==null?void 0:v.cart)!=null&&k.id&&we("localStorage"))try{window.localStorage.setItem(Ae,(R=U.context.cart)==null?void 0:R.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(vt=(St=U==null?void 0:U.context)==null?void 0:St.cart)==null?void 0:vt.id]),s.useEffect(()=>{if(j&&we("localStorage"))try{window.localStorage.removeItem(Ae)}catch(v){console.warn("Failed to delete cartId from localStorage",v)}},[j]);const K=s.useCallback(v=>{var k,R;f&&!((k=v.buyerIdentity)!=null&&k.countryCode)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.countryCode=f),c&&!((R=v.buyerIdentity)!=null&&R.customerAccessToken)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.customerAccessToken=c),O({type:"CART_CREATE",payload:v})},[f,c,O]),P=yr(U),Ee=s.useMemo(()=>{var v,k,R,B;return{...((v=P==null?void 0:P.context)==null?void 0:v.cart)??{lines:[],attributes:[]},status:fr(P.value),error:(k=P==null?void 0:P.context)==null?void 0:k.errors,totalQuantity:((B=(R=P==null?void 0:P.context)==null?void 0:R.cart)==null?void 0:B.totalQuantity)??0,cartCreate:K,linesAdd(N){var ce,M;(M=(ce=P==null?void 0:P.context)==null?void 0:ce.cart)!=null&&M.id?O({type:"CARTLINE_ADD",payload:{lines:N}}):K({lines:N})},linesRemove(N){O({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){O({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){O({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){O({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){O({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){O({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:T}},[K,(Tt=P==null?void 0:P.context)==null?void 0:Tt.cart,(Ct=P==null?void 0:P.context)==null?void 0:Ct.errors,P.value,T,O]);return s.createElement(Ke.Provider,{value:Ee},e)}function fr(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]=s.useTransition(),[n,a]=s.useState(e),u=s.useRef(!1);t&&(u.current=!0);const i=s.useRef(!1);return!t&&u.current&&(i.current=!0),s.useEffect(()=>{r(()=>{i.current||a(e)})},[e]),i.current?e:n}function we(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 hr(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 Qe=s.createContext(null);function gr({children:e,data:t,initialVariantId:r}){const n=s.useMemo(()=>H(t.variants??{}),[t.variants]);if(!Er(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const a=s.useMemo(()=>mr(n),[n]),[u,i]=s.useState(()=>et(r,n)),[o,h]=s.useState(()=>tt(u));s.useEffect(()=>{const _=et(r,n);i(_),h(tt(_))},[r,n]);const y=s.useCallback((_,L)=>{h(w=>{const T={...w,[_]:L};return i(Xe(n,T)),T})},[h,n]),l=s.useCallback((_,L)=>{const w=Xe(n,{...o,[_]:L});return(w==null?void 0:w.availableForSale)??!0},[o,n]),d=s.useMemo(()=>H(t.sellingPlanGroups??{}).map(_=>({..._,sellingPlans:H((_==null?void 0:_.sellingPlans)??{})})),[t.sellingPlanGroups]),[p,E]=s.useState(void 0),g=s.useMemo(()=>{var _,L;if(!(!u||!p)){if(!((_=u.sellingPlanAllocations)!=null&&_.nodes)&&!((L=u.sellingPlanAllocations)!=null&&L.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return H(u.sellingPlanAllocations).find(w=>{var T;return((T=w==null?void 0:w.sellingPlan)==null?void 0:T.id)===p.id})}},[u,p]),b=s.useMemo(()=>({variants:n,variantsConnection:t.variants,options:a,selectedVariant:u,setSelectedVariant:i,selectedOptions:o,setSelectedOption:y,setSelectedOptions:h,isOptionInStock:l,selectedSellingPlan:p,setSelectedSellingPlan:E,selectedSellingPlanAllocation:g,sellingPlanGroups:d,sellingPlanGroupsConnection:t.sellingPlanGroups}),[l,a,t.sellingPlanGroups,t.variants,o,p,g,u,d,y,n]);return s.createElement(Qe.Provider,{value:b},e)}function Je(){const e=s.useContext(Qe);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Xe(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(([u,i])=>{var o;return(o=a==null?void 0:a.selectedOptions)==null?void 0:o.some(h=>(h==null?void 0:h.name)===u&&(h==null?void 0:h.value)===i)}))}function mr(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(u=>{r[(u==null?void 0:u.name)??""]=r[(u==null?void 0:u.name)??""]||new Set,r[(u==null?void 0:u.name)??""].add((u==null?void 0:u.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function et(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 tt(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 Er(e){return!(!e||!Array.isArray(e))}function Ie(e){const{as:t,onClick:r,defaultOnClick:n,children:a,buttonRef:u,...i}=e,o=s.useCallback(y=>{if(r){const l=r(y);if(typeof l=="boolean"&&l===!1||y!=null&&y.defaultPrevented)return}n==null||n(y)},[n,r]),h=t||"button";return s.createElement(h,{ref:u,onClick:o,...i},a)}function pr(e){const[t,r]=s.useState(!1),{variantId:n,quantity:a=1,attributes:u,sellingPlanId:i,onClick:o,children:h,accessibleAddingToCartLabel:y,...l}=e,{status:d,linesAdd:p}=oe(),{selectedVariant:E}=Je(),g=n??(E==null?void 0:E.id)??"",b=n===null||g===""||E===null||t||l.disabled;s.useEffect(()=>{t&&d==="idle"&&r(!1)},[d,t]);const _=s.useCallback(()=>{r(!0),p([{quantity:a,merchandiseId:g||"",attributes:u,sellingPlanId:i}])},[p,a,g,u,i]);return Q.createElement(Q.Fragment,null,Q.createElement(Ie,{...l,disabled:b,onClick:o,defaultOnClick:_},h),y?Q.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?y:null):null)}const De={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},ge={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"},rt={hydrogen:"hydrogen",headless:"headless"},nt={hydrogen:"6167201",headless:"12875497473"};function X(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function G(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([a-z0-9]+)/);if(!r||r.length===1)return t;const n=r[2]??null,a=r[1]??null;return{id:n,resource:a}}function z(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function _r(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Sr="trekkie_storefront_page_view/1.4",vr="myshopify.dev";function Tr(e){const t=e,{id:r,resource:n}=G(t.resourceId),a=n?n.toLowerCase():void 0;return[X(Sr,z({pageType:t.pageType,customerId:t.customerId,resourceType:a,resourceId:parseInt(r)},Cr(t)))]}function Cr(e){return{appClientId:e.shopifySalesChannel?nt[e.shopifySalesChannel]:nt.headless,isMerchantRequest:Ar(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:ye(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(G(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function Ar(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(vr)!==-1||t==="localhost"}const ae="custom_storefront_customer_tracking/1.0",br="page_rendered",wr="collection_page_rendered",Ir="product_page_rendered",Dr="product_added_to_cart",Or="search_submitted";function Lr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,a=[];switch(a.push(X(ae,z({event_name:br,...r},ie(t)))),n){case ge.collection:a.push(X(ae,z({event_name:wr,...r,collection_name:t.collectionHandle},ie(t))));break;case ge.product:a.push(X(ae,z({event_name:Ir,...r,products:ot(t.products),total_value:t.totalValue},ie(t))));break;case ge.search:a.push(X(ae,z({event_name:Or,...r,search_string:t.searchString},ie(t))));break}return a}function Pr(e){const t=e,r=G(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[X(ae,z({event_name:Dr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:ot(t.products)},ie(t)))]}function ie(e){return{source:e.shopifySalesChannel||rt.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:ye(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(G(e.shopId).id),currency:e.currency}}function ot(e){return e?e.map(t=>{const r=z({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(G(t.productGid).id),variant_id:parseInt(G(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function Ur(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let a=[];if(r===De.PAGE_VIEW){const u=n;a=a.concat(Tr(u),Lr(u))}else r===De.ADD_TO_CART&&(a=a.concat(Pr(n)));return a.length?kr(a,t):Promise.resolve()}const at="sendShopifyAnalytics request is unsuccessful";function kr(e,t){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(u=>{u.status!==200&&console.error(at,`
|
|
277
|
+
`,ne="2023-01";function Kt(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o,contentType:u}=e;return o!==ne&&Qt(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${o}"; expected version "${ne}"`),{getShopifyDomain(i){return(i==null?void 0:i.storeDomain)??t},getStorefrontApiUrl(i){const a=(i==null?void 0:i.storeDomain)??t;return`${a}${a.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??o}/graphql.json`},getPrivateTokenHeaders(i){if(!r&&!(i!=null&&i.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((i==null?void 0:i.contentType)??u)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":o,"Shopify-Storefront-Private-Token":(i==null?void 0:i.privateStorefrontToken)??r??"",...i!=null&&i.buyerIp?{"Shopify-Storefront-Buyer-IP":i.buyerIp}:{}}},getPublicTokenHeaders(i){if(!n&&!(i!=null&&i.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const a=(i==null?void 0:i.contentType)??u??"json";return Ye(a,o,(i==null?void 0:i.publicStorefrontToken)??n??"")}}}function Ye(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 We=new Set,Qt=e=>{We.has(e)||(console.warn(e),We.add(e))},Ze=s.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ne,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function Jt({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!==ne&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${ne}, 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=s.useMemo(()=>{function n(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return Ye(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const u=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${u}${u.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return s.createElement(Ze.Provider,{value:r},e)}function fe(){const e=s.useContext(Ze);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const be="shopifyCartId",Xt="Shopify-Storefront-Id",er="Shopify-Storefront-Y",tr="Shopify-Storefront-S",W="_shopify_y",Z="_shopify_s";var rr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function nr(e){let t={},r,n,o=0,u=e.split(/;\s*/g),i,a;for(;o<u.length;o++)if(n=u[o],r=n.indexOf("="),~r){if(i=n.substring(0,r++).trim(),a=n.substring(r).trim(),a[0]==='"'&&(a=a.substring(1,a.length-1)),~a.indexOf("%"))try{a=decodeURIComponent(a)}catch{}rr.has(n=i.toLowerCase())?n==="expires"?t.expires=new Date(a):n==="max-age"?t.maxage=+a:t[n]=a:t[i]=a}else(i=n.trim().toLowerCase())&&(i==="httponly"||i==="secure")&&(t[i]=!0);return t}function or(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 ze="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function ye(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=ze.replace(/[x]/g,o=>{const u=r[n]%16,i=o==="x"?u:u&3|8;return n++,i.toString(16)}).toUpperCase()}catch{e=ze.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${ar()}-${e}`}function ar(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function he(e){const t=nr(e);return{[W]:t[W]||"",[Z]:t[Z]||""}}function ir(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=fe();return s.useCallback(({query:n,variables:o})=>{const u=t({contentType:"json"});e&&(u[Xt]=e);const i=he(document.cookie);return u[er]=i[W],u[tr]=i[Z],fetch(r(),{method:"POST",headers:u,body:JSON.stringify({query:n.toString(),variables:o})}).then(a=>a.json()).catch(a=>({data:void 0,errors:a==null?void 0:a.toString()}))},[t,e,r])}function ur({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=ir(),o=s.useCallback(E=>n({query:Zt(t),variables:{id:E,numCartLines:e,country:r}}),[n,t,e,r]),u=s.useCallback(E=>n({query:Ft(t),variables:{input:E,numCartLines:e,country:r}}),[t,r,n,e]),i=s.useCallback((E,g)=>n({query:qt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),a=s.useCallback((E,g)=>n({query:Ht(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),y=s.useCallback((E,g)=>n({query:Bt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),f=s.useCallback((E,g)=>n({query:jt(t),variables:{cartId:E,note:g,numCartLines:e,country:r}}),[n,t,e,r]),l=s.useCallback((E,g)=>n({query:Gt(t),variables:{cartId:E,buyerIdentity:g,numCartLines:e,country:r}}),[t,r,n,e]),d=s.useCallback((E,g)=>n({query:Yt(t),variables:{cartId:E,attributes:g,numCartLines:e,country:r}}),[t,r,n,e]),p=s.useCallback((E,g)=>n({query:Wt(t),variables:{cartId:E,discountCodes:g,numCartLines:e,country:r}}),[t,r,n,e]);return s.useMemo(()=>({cartFetch:o,cartCreate:u,cartLineAdd:i,cartLineUpdate:a,cartLineRemove:y,noteUpdate:f,buyerIdentityUpdate:l,cartAttributesUpdate:d,discountCodesUpdate:p,cartFragment:t}),[o,u,i,a,y,f,l,d,p,t])}function x(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],J({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[J({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.cart},rawCartResult:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[J({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:J({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const oe={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[J({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>we(t.payload.cart)})]}},Ke={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 sr(e){return Re({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&we(e)},states:{uninitialized:{on:oe},cartCompleted:{on:oe},initializationError:{on:oe},idle:{on:{...oe,...Ke}},error:{on:{...oe,...Ke}},cartFetching:x("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:x("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:x("cartLineRemoveAction"),cartLineUpdating:x("cartLineUpdateAction"),cartLineAdding:x("cartLineAddAction"),noteUpdating:x("noteUpdateAction"),buyerIdentityUpdating:x("buyerIdentityUpdateAction"),cartAttributesUpdating:x("cartAttributesUpdateAction"),discountCodesUpdating:x("discountCodesUpdateAction")}})}function cr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:u,countryCode:i}){const{cartFetch:a,cartCreate:y,cartLineAdd:f,cartLineUpdate:l,cartLineRemove:d,noteUpdate:p,buyerIdentityUpdate:E,cartAttributesUpdate:g,discountCodesUpdate:b}=ur({numCartLines:e,cartFragment:u,countryCode:i}),_=s.useMemo(()=>sr(o),[o]),[P,w,T]=Rt(_,{actions:{cartFetchAction:async(c,h)=>{var S;if(h.type!=="CART_FETCH")return;const{data:m,errors:A}=await a((S=h==null?void 0:h.payload)==null?void 0:S.cartId),I=q(h,m==null?void 0:m.cart,A);w(I)},cartCreateAction:async(c,h)=>{var S;if(h.type!=="CART_CREATE")return;const{data:m,errors:A}=await y(h==null?void 0:h.payload),I=q(h,(S=m==null?void 0:m.cartCreate)==null?void 0:S.cart,A);w(I)},cartLineAddAction:async(c,h)=>{var S,D;if(h.type!=="CARTLINE_ADD"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await f(c.cart.id,h.payload.lines),I=q(h,(D=m==null?void 0:m.cartLinesAdd)==null?void 0:D.cart,A);w(I)},cartLineUpdateAction:async(c,h)=>{var S,D;if(h.type!=="CARTLINE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await l(c.cart.id,h.payload.lines),I=q(h,(D=m==null?void 0:m.cartLinesUpdate)==null?void 0:D.cart,A);w(I)},cartLineRemoveAction:async(c,h)=>{var S,D;if(h.type!=="CARTLINE_REMOVE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await d(c.cart.id,h.payload.lines),I=q(h,(D=m==null?void 0:m.cartLinesRemove)==null?void 0:D.cart,A);w(I)},noteUpdateAction:async(c,h)=>{var S,D;if(h.type!=="NOTE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await p(c.cart.id,h.payload.note),I=q(h,(D=m==null?void 0:m.cartNoteUpdate)==null?void 0:D.cart,A);w(I)},buyerIdentityUpdateAction:async(c,h)=>{var S,D;if(h.type!=="BUYER_IDENTITY_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await E(c.cart.id,h.payload.buyerIdentity),I=q(h,(D=m==null?void 0:m.cartBuyerIdentityUpdate)==null?void 0:D.cart,A);w(I)},cartAttributesUpdateAction:async(c,h)=>{var S,D;if(h.type!=="CART_ATTRIBUTES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await g(c.cart.id,h.payload.attributes),I=q(h,(D=m==null?void 0:m.cartAttributesUpdate)==null?void 0:D.cart,A);w(I)},discountCodesUpdateAction:async(c,h)=>{var S,D;if(h.type!=="DISCOUNT_CODES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await b(c.cart.id,h.payload.discountCodes),I=q(h,(D=m==null?void 0:m.cartDiscountCodesUpdate)==null?void 0:D.cart,A);w(I)},...t&&{onCartActionEntry:(c,h)=>{lr(h)&&t(c,h)}},...r&&{onCartActionOptimisticUI:J((c,h)=>r(c,h))},...n&&{onCartActionComplete:(c,h)=>{dr(h)&&n(c,h)}}}});return s.useMemo(()=>[P,w,T],[P,w,T])}function we(e){return{...e,lines:H(e==null?void 0:e.lines),note:e.note??void 0}}function q(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:we(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function lr(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 dr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Qe=s.createContext(null);function X(){const e=s.useContext(Qe);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function fr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:u,onNoteUpdate:i,onBuyerIdentityUpdate:a,onAttributesUpdate:y,onDiscountCodesUpdate:f,onCreateComplete:l,onLineAddComplete:d,onLineRemoveComplete:p,onLineUpdateComplete:E,onNoteUpdateComplete:g,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:_,onDiscountCodesUpdateComplete:P,data:w,cartFragment:T=zt,customerAccessToken:c,countryCode:h="US"}){var pt,_t,St,vt,Ct,Tt,At;h&&(h=h.toUpperCase());const[m,A]=s.useState(h),[I,S]=s.useState(c),D=s.useRef(!1);(m!==h||I!==c)&&(A(h),S(c),D.current=!1);const[U,V]=cr({numCartLines:t,data:w,cartFragment:T,countryCode:h,onCartActionEntry(C,k){try{switch(k.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return u==null?void 0:u();case"NOTE_UPDATE":return i==null?void 0:i();case"BUYER_IDENTITY_UPDATE":return a==null?void 0:a();case"CART_ATTRIBUTES_UPDATE":return y==null?void 0:y();case"DISCOUNT_CODES_UPDATE":return f==null?void 0:f()}}catch(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(C,k){var M,B,N,ce;if(!C.cart)return{...C};switch(k.type){case"CARTLINE_REMOVE":return{...C,cart:{...C.cart,lines:(B=(M=C==null?void 0:C.cart)==null?void 0:M.lines)==null?void 0:B.filter(R=>(R==null?void 0:R.id)&&!k.payload.lines.includes(R==null?void 0:R.id))}};case"CARTLINE_UPDATE":return{...C,cart:{...C.cart,lines:(ce=(N=C==null?void 0:C.cart)==null?void 0:N.lines)==null?void 0:ce.map(R=>{const Pe=k.payload.lines.find(({id:fn})=>fn===(R==null?void 0:R.id));return Pe&&Pe.quantity?{...R,quantity:Pe.quantity}:R})}}}return{...C}},onCartActionComplete(C,k){const M=k.payload.cartActionEvent;try{switch(k.type){case"RESOLVE":switch(M.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return d==null?void 0:d();case"CARTLINE_REMOVE":return p==null?void 0:p();case"CARTLINE_UPDATE":return E==null?void 0:E();case"NOTE_UPDATE":return g==null?void 0:g();case"BUYER_IDENTITY_UPDATE":return gr(C,M)&&(D.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return _==null?void 0:_();case"DISCOUNT_CODES_UPDATE":return P==null?void 0:P()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),$=s.useRef(!1),G=U.matches("cartCompleted"),re=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&h!==((St=(_t=(pt=U==null?void 0:U.context)==null?void 0:pt.cart)==null?void 0:_t.buyerIdentity)==null?void 0:St.countryCode)&&!U.context.errors,F=s.useRef(!1);s.useEffect(()=>{if(!$.current&&!F.current){if(!w&&Ie("localStorage")){F.current=!0;try{const C=window.localStorage.getItem(be);C&&V({type:"CART_FETCH",payload:{cartId:C}})}catch(C){console.warn("error fetching cartId"),console.warn(C)}}$.current=!0}},[w,$,V]),s.useEffect(()=>{!re||D.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:h,customerAccessToken:c}}})},[h,c,re,D,V]);const O=s.useCallback(C=>{if(!$.current)return console.warn("Cart isn't ready yet");V(C)},[V]);s.useEffect(()=>{var C,k,M;if((k=(C=U==null?void 0:U.context)==null?void 0:C.cart)!=null&&k.id&&Ie("localStorage"))try{window.localStorage.setItem(be,(M=U.context.cart)==null?void 0:M.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(Ct=(vt=U==null?void 0:U.context)==null?void 0:vt.cart)==null?void 0:Ct.id]),s.useEffect(()=>{if(G&&Ie("localStorage"))try{window.localStorage.removeItem(be)}catch(C){console.warn("Failed to delete cartId from localStorage",C)}},[G]);const K=s.useCallback(C=>{var k,M;h&&!((k=C.buyerIdentity)!=null&&k.countryCode)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.countryCode=h),c&&!((M=C.buyerIdentity)!=null&&M.customerAccessToken)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.customerAccessToken=c),O({type:"CART_CREATE",payload:C})},[h,c,O]),L=hr(U),pe=s.useMemo(()=>{var C,k,M,B;return{...((C=L==null?void 0:L.context)==null?void 0:C.cart)??{lines:[],attributes:[]},status:yr(L.value),error:(k=L==null?void 0:L.context)==null?void 0:k.errors,totalQuantity:((B=(M=L==null?void 0:L.context)==null?void 0:M.cart)==null?void 0:B.totalQuantity)??0,cartCreate:K,linesAdd(N){var ce,R;(R=(ce=L==null?void 0:L.context)==null?void 0:ce.cart)!=null&&R.id?O({type:"CARTLINE_ADD",payload:{lines:N}}):K({lines:N})},linesRemove(N){O({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){O({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){O({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){O({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){O({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){O({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:T}},[K,(Tt=L==null?void 0:L.context)==null?void 0:Tt.cart,(At=L==null?void 0:L.context)==null?void 0:At.errors,L.value,T,O]);return s.createElement(Qe.Provider,{value:pe},e)}function yr(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 hr(e){const[t,r]=s.useTransition(),[n,o]=s.useState(e),u=s.useRef(!1);t&&(u.current=!0);const i=s.useRef(!1);return!t&&u.current&&(i.current=!0),s.useEffect(()=>{r(()=>{i.current||o(e)})},[e]),i.current?e:n}function Ie(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 gr(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 Je=s.createContext(null);function mr({children:e,data:t,initialVariantId:r}){const n=s.useMemo(()=>H(t.variants??{}),[t.variants]);if(!pr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=s.useMemo(()=>Er(n),[n]),[u,i]=s.useState(()=>tt(r,n)),[a,y]=s.useState(()=>rt(u));s.useEffect(()=>{const _=tt(r,n);i(_),y(rt(_))},[r,n]);const f=s.useCallback((_,P)=>{y(w=>{const T={...w,[_]:P};return i(et(n,T)),T})},[y,n]),l=s.useCallback((_,P)=>{const w=et(n,{...a,[_]:P});return(w==null?void 0:w.availableForSale)??!0},[a,n]),d=s.useMemo(()=>H(t.sellingPlanGroups??{}).map(_=>({..._,sellingPlans:H((_==null?void 0:_.sellingPlans)??{})})),[t.sellingPlanGroups]),[p,E]=s.useState(void 0),g=s.useMemo(()=>{var _,P;if(!(!u||!p)){if(!((_=u.sellingPlanAllocations)!=null&&_.nodes)&&!((P=u.sellingPlanAllocations)!=null&&P.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return H(u.sellingPlanAllocations).find(w=>{var T;return((T=w==null?void 0:w.sellingPlan)==null?void 0:T.id)===p.id})}},[u,p]),b=s.useMemo(()=>({variants:n,variantsConnection:t.variants,options:o,selectedVariant:u,setSelectedVariant:i,selectedOptions:a,setSelectedOption:f,setSelectedOptions:y,isOptionInStock:l,selectedSellingPlan:p,setSelectedSellingPlan:E,selectedSellingPlanAllocation:g,sellingPlanGroups:d,sellingPlanGroupsConnection:t.sellingPlanGroups}),[l,o,t.sellingPlanGroups,t.variants,a,p,g,u,d,f,n]);return s.createElement(Je.Provider,{value:b},e)}function Xe(){const e=s.useContext(Je);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function et(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(o=>Object.entries(t).every(([u,i])=>{var a;return(a=o==null?void 0:o.selectedOptions)==null?void 0:a.some(y=>(y==null?void 0:y.name)===u&&(y==null?void 0:y.value)===i)}))}function Er(e){const t=e.reduce((r,n)=>{var o;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=n==null?void 0:n.selectedOptions)==null||o.forEach(u=>{r[(u==null?void 0:u.name)??""]=r[(u==null?void 0:u.name)??""]||new Set,r[(u==null?void 0:u.name)??""].add((u==null?void 0:u.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function tt(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 rt(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 pr(e){return!(!e||!Array.isArray(e))}function ge(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:u,...i}=e,a=s.useCallback(f=>{if(r){const l=r(f);if(typeof l=="boolean"&&l===!1||f!=null&&f.defaultPrevented)return}n==null||n(f)},[n,r]),y=t||"button";return s.createElement(y,{ref:u,onClick:a,...i},o)}function _r(e){const[t,r]=s.useState(!1),{variantId:n,quantity:o=1,attributes:u,sellingPlanId:i,onClick:a,children:y,accessibleAddingToCartLabel:f,...l}=e,{status:d,linesAdd:p}=X(),{selectedVariant:E}=Xe(),g=n??(E==null?void 0:E.id)??"",b=n===null||g===""||E===null||t||l.disabled;s.useEffect(()=>{t&&d==="idle"&&r(!1)},[d,t]);const _=s.useCallback(()=>{r(!0),p([{quantity:o,merchandiseId:g||"",attributes:u,sellingPlanId:i}])},[p,o,g,u,i]);return Q.createElement(Q.Fragment,null,Q.createElement(ge,{...l,disabled:b,onClick:a,defaultOnClick:_},y),f?Q.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?f:null):null)}const De={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},me={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"},nt={hydrogen:"hydrogen",headless:"headless"},ot={hydrogen:"6167201",headless:"12875497473"};function ee(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function j(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([a-z0-9]+)/);if(!r||r.length===1)return t;const n=r[2]??null,o=r[1]??null;return{id:n,resource:o}}function z(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Sr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const vr="trekkie_storefront_page_view/1.4",Cr="myshopify.dev";function Tr(e){const t=e,{id:r,resource:n}=j(t.resourceId),o=n?n.toLowerCase():void 0;return[ee(vr,z({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},Ar(t)))]}function Ar(e){return{appClientId:e.shopifySalesChannel?ot[e.shopifySalesChannel]:ot.headless,isMerchantRequest:br(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:ye(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(j(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function br(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(Cr)!==-1||t==="localhost"}const ae="custom_storefront_customer_tracking/1.0",wr="page_rendered",Ir="collection_page_rendered",Dr="product_page_rendered",Or="product_added_to_cart",Pr="search_submitted";function Lr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(ee(ae,z({event_name:wr,...r},ie(t)))),n){case me.collection:o.push(ee(ae,z({event_name:Ir,...r,collection_name:t.collectionHandle},ie(t))));break;case me.product:o.push(ee(ae,z({event_name:Dr,...r,products:at(t.products),total_value:t.totalValue},ie(t))));break;case me.search:o.push(ee(ae,z({event_name:Pr,...r,search_string:t.searchString},ie(t))));break}return o}function Ur(e){const t=e,r=j(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[ee(ae,z({event_name:Or,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:at(t.products)},ie(t)))]}function ie(e){return{source:e.shopifySalesChannel||nt.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:ye(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(j(e.shopId).id),currency:e.currency}}function at(e){return e?e.map(t=>{const r=z({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(j(t.productGid).id),variant_id:parseInt(j(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function kr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===De.PAGE_VIEW){const u=n;o=o.concat(Tr(u),Lr(u))}else r===De.ADD_TO_CART&&(o=o.concat(Ur(n)));return o.length?Nr(o,t):Promise.resolve()}const it="sendShopifyAnalytics request is unsuccessful";function Nr(e,t){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(u=>{u.status!==200&&console.error(it,`
|
|
278
278
|
|
|
279
|
-
`,u.message)})}).catch(n=>{console.error(at,n)})}catch{return Promise.resolve()}}function Nr(){if(_r("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=Mr(),r=he(document.cookie);return{uniqueToken:r[W],visitToken:r[Z],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Vr(){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 Rr(){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 Mr(){try{let e="PerformanceNavigationTiming",t=Vr();return t||(t=Rr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function $r(e){const{cartCreate:t,checkoutUrl:r}=oe(),[n,a]=s.useState(!1),{quantity:u,variantId:i,onClick:o,attributes:h,children:y,...l}=e;s.useEffect(()=>{r&&(window.location.href=r)},[r]);const d=s.useCallback(()=>{a(!0),t({lines:[{quantity:u??1,merchandiseId:i,attributes:h}]})},[t,u,i,h]);return s.createElement(Ie,{disabled:n??l.disabled,...l,onClick:o,defaultOnClick:d},y)}function xr(e){const[t,r]=s.useState(!1),{status:n,checkoutUrl:a}=oe(),{children:u,...i}=e;return s.useEffect(()=>{t&&a&&n==="idle"&&(window.location.href=a)},[t,n,a]),s.createElement(Ie,{...i,disabled:t||i.disabled,onClick:()=>r(!0)},u)}function it(e){const{countryIsoCode:t,languageIsoCode:r}=fe(),n=`${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),u=s.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),i=ee(n,u),o=ee(n,{...u,currencyDisplay:"name"}),h=ee(n,{...u,currencyDisplay:"narrowSymbol"}),y=ee(n,{...u,minimumFractionDigits:0,maximumFractionDigits:0}),l=ee(n),d=ee(n,{minimumFractionDigits:0,maximumFractionDigits:0}),p=g=>g.type==="currency",E=s.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(a),parts:()=>i().formatToParts(a),withoutTrailingZeros:()=>a%1===0?y().format(a):i().format(a),withoutTrailingZerosAndCurrency:()=>a%1===0?d().format(a):l().format(a),currencyName:()=>{var g;return((g=o().formatToParts(a).find(p))==null?void 0:g.value)??e.currencyCode},currencySymbol:()=>{var g;return((g=i().formatToParts(a).find(p))==null?void 0:g.value)??e.currencyCode},currencyNarrowSymbol:()=>{var g;return((g=h().formatToParts(a).find(p))==null?void 0:g.value)??""},amount:()=>i().formatToParts(a).filter(g=>["decimal","fraction","group","integer","literal"].includes(g.type)).map(g=>g.value).join("")}),[e,a,o,i,h,l,y,d]);return s.useMemo(()=>new Proxy(E,{get:(g,b)=>{var _;return(_=Reflect.get(g,b))==null?void 0:_.call(null)}}),[E])}function ee(e,t){return s.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ue({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:a,measurementSeparator:u="/",...i}){if(!qr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const o=it(e),h=t??"div";let y=o.localizedString;return(r||n)&&(r&&!n?y=o.amount:!r&&n?y=o.withoutTrailingZeros:y=o.withoutTrailingZerosAndCurrency),s.createElement(h,{...i},y,a&&a.referenceUnit&&s.createElement(s.Fragment,null,u,a.referenceUnit))}function qr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Fr(e){const{cost:t}=oe(),{amountType:r="total",children:n,...a}=e;let u;return r=="total"?u=t==null?void 0:t.totalAmount:r=="subtotal"?u=t==null?void 0:t.subtotalAmount:r=="tax"?u=t==null?void 0:t.totalTaxAmount:r=="duty"&&(u=t==null?void 0:t.totalDutyAmount),u==null?null:s.createElement(ue,{...a,data:u},n)}function Br(e){var u,i;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const a=r==="regular"?(u=t.cost)==null?void 0:u.totalAmount:(i=t.cost)==null?void 0:i.compareAtAmountPerQuantity;return a==null?null:s.createElement(ue,{...n,data:a})}const ut=s.createContext(null);function Hr(){const e=s.useContext(ut);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Gr({children:e,line:t}){return s.createElement(ut.Provider,{value:t},e)}const jr={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function st(e){const{data:t,options:r,id:n=t.id,frameBorder:a="0",allow:u="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:i=!0,loading:o="lazy",...h}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let y=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const d of Object.keys(r))l.searchParams.set(d,r[d]);y=l.toString()}return s.createElement("iframe",{...h,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:a,allow:u,allowFullScreen:i,src:y,loading:o})}const Yr=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],Wr=["spin.dev"],Zr=[...Yr,...Wr],se=[352,832,1200,1920,2560];function ct({src:e,width:t,height:r,crop:n,scale:a}){const u=new URL(e),i=a??1;if(t){let o;typeof t=="string"?o=(se[0]*i).toString():o=(Number(t)*i).toString(),u.searchParams.append("width",o)}return r&&typeof r=="number"&&u.searchParams.append("height",(r*i).toString()),n&&u.searchParams.append("crop",n),u.toString()}function lt(e){const t=new URL(e.src);return!Zr.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:ct(e)}function zr({data:e,loaderOptions:t,elementProps:r}){let n=null;return e!=null&&e.width&&(e!=null&&e.height)&&(n=(e==null?void 0:e.width)/(e==null?void 0:e.height)),t!=null&&t.width||t!=null&&t.height?{width:(t==null?void 0:t.width)??(n&&typeof t.height=="number"?Math.round(n*t.height):null),height:(t==null?void 0:t.height)??(n&&typeof t.width=="number"?Math.round(n*t.width):null)}:r!=null&&r.width||r!=null&&r.height?{width:(r==null?void 0:r.width)??(n&&typeof r.height=="number"?Math.round(n*r.height):null),height:(r==null?void 0:r.height)??(n&&typeof r.width=="number"?Math.round(n*r.width):null)}:e!=null&&e.width||e!=null&&e.height?{width:(e==null?void 0:e.width)??null,height:(e==null?void 0:e.height)??null}:{width:null,height:null}}function dt({data:e,width:t,height:r,loading:n,loader:a=lt,loaderOptions:u,widths:i,decoding:o="async",...h}){if(!e.url){const g=`<Image/>: the 'data' prop requires the 'url' property. Image: ${e.id??"no ID provided"}`;return console.error(g),null}const{width:y,height:l}=zr({data:e,loaderOptions:u,elementProps:{width:t,height:r}});let d=e.url;if(a&&(d=a({...u,src:e.url,width:y,height:l}),typeof d!="string"||!d))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${e.id??e.url}`);const p=t&&y&&t<y?t:y,E=h.srcSet??Kr({...u,widths:i,src:e.url,width:p,height:l,loader:a});return Q.createElement("img",{id:e.id??"",alt:e.altText??h.alt??"",loading:n??"lazy",...h,src:d,width:y??void 0,height:l??void 0,srcSet:E,decoding:o})}function Kr({src:e,width:t,crop:r,scale:n,widths:a,loader:u,height:i}){const o=a&&Array.isArray(a);if(o&&a.some(d=>isNaN(d)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let h=1;t&&i&&(h=Number(i)/Number(t));let y=o?a:se;!o&&t&&t<se[se.length-1]&&(y=se.filter(d=>d<=t));const l=u||ct;return y.map(d=>`${l({src:e,width:d,height:r?Number(d)*h:void 0,crop:r,scale:n})} ${d??""}w`).join(", ")}function ft(e){var y;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:a=!0,controls:u=!0,sourceProps:i={},...o}=e,h=lt({src:((y=t.previewImage)==null?void 0:y.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return s.createElement("video",{...o,id:n,playsInline:a,controls:u,poster:h},t.sources.map(l=>{if(!(l!=null&&l.url&&(l!=null&&l.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return s.createElement("source",{...i,key:l.url,src:l.url,type:l.mimeType})}))}const yt={};function Qr(e,t){const r=yt[e];if(r)return r;const n=new Promise((a,u)=>{const i=document.createElement("script");t!=null&&t.module?i.type="module":i.type="text/javascript",i.src=e,i.onload=()=>{a(!0)},i.onerror=()=>{u(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(i):document.body.appendChild(i)});return yt[e]=n,n}function ht(e,t){const[r,n]=s.useState("loading"),a=JSON.stringify(t);return s.useEffect(()=>{async function u(){try{n("loading"),await Qr(e,t),n("done")}catch{n("error")}}u().catch(()=>{n("error")})},[e,a,t]),r}function gt(e){var y,l,d;const[t,r]=s.useState(void 0),n=s.useCallback(p=>{r(p)},[]),{data:a,children:u,className:i,...o}=e,h=ht("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return s.useEffect(()=>{if(t)return o.onError&&t.addEventListener("error",o.onError),o.onLoad&&t.addEventListener("load",o.onLoad),o.onPreload&&t.addEventListener("preload",o.onPreload),o.onModelVisibility&&t.addEventListener("model-visibility",o.onModelVisibility),o.onProgress&&t.addEventListener("progress",o.onProgress),o.onArStatus&&t.addEventListener("ar-status",o.onArStatus),o.onArTracking&&t.addEventListener("ar-tracking",o.onArTracking),o.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",o.onQuickLookButtonTapped),o.onCameraChange&&t.addEventListener("camera-change",o.onCameraChange),o.onEnvironmentChange&&t.addEventListener("environment-change",o.onEnvironmentChange),o.onPlay&&t.addEventListener("play",o.onPlay),o.onPause&&t.addEventListener("ar-status",o.onPause),o.onSceneGraphReady&&t.addEventListener("scene-graph-ready",o.onSceneGraphReady),()=>{t!=null&&(o.onError&&t.removeEventListener("error",o.onError),o.onLoad&&t.removeEventListener("load",o.onLoad),o.onPreload&&t.removeEventListener("preload",o.onPreload),o.onModelVisibility&&t.removeEventListener("model-visibility",o.onModelVisibility),o.onProgress&&t.removeEventListener("progress",o.onProgress),o.onArStatus&&t.removeEventListener("ar-status",o.onArStatus),o.onArTracking&&t.removeEventListener("ar-tracking",o.onArTracking),o.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",o.onQuickLookButtonTapped),o.onCameraChange&&t.removeEventListener("camera-change",o.onCameraChange),o.onEnvironmentChange&&t.removeEventListener("environment-change",o.onEnvironmentChange),o.onPlay&&t.removeEventListener("play",o.onPlay),o.onPause&&t.removeEventListener("ar-status",o.onPause),o.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",o.onSceneGraphReady))}},[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]),h!=="done"?null:(l=(y=a.sources)==null?void 0:y[0])!=null&&l.url?s.createElement("model-viewer",{ref:n,...o,className:i,id:o.id??a.id,src:a.sources[0].url,alt:a.alt??null,"camera-controls":o.cameraControls??!0,poster:(o.poster||((d=a.previewImage)==null?void 0:d.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},u):(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 Jr({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?s.createElement(dt,{...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 s.createElement(ft,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return s.createElement(st,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return s.createElement(gt,{...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 Xr(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"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=mt(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=mt((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:H(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 mt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function en(e){var y,l,d,p,E,g;const{priceType:t="regular",variantId:r,valueType:n="min",data:a,...u}=e;if(a==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let i,o;const h=r?H((a==null?void 0:a.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&h){if(((y=h.compareAtPriceV2)==null?void 0:y.amount)===((l=h.priceV2)==null?void 0:l.amount))return null;i=h.compareAtPriceV2}else n==="max"?i=(d=a==null?void 0:a.compareAtPriceRange)==null?void 0:d.maxVariantPrice:i=(p=a==null?void 0:a.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&h?(i=h.priceV2,n==="unit"&&(i=h.unitPrice,o=h.unitPriceMeasurement)):n==="max"?i=(E=a.priceRange)==null?void 0:E.maxVariantPrice:i=(g=a.priceRange)==null?void 0:g.minVariantPrice;return i?o?s.createElement(ue,{...u,data:i,measurement:o}):s.createElement(ue,{...u,data:i}):null}const tn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function rn({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:a}=fe(),u=ht(tn);let i=[];if(e&&r)throw new Error(an);if(e)i=e.reduce((h,y)=>{const l=G(y).id;return l&&h.push(l),h},[]);else if(r)i=r.reduce((h,y)=>{const l=G(y==null?void 0:y.id).id;return l&&h.push(`${l}:${(y==null?void 0:y.quantity)??1}`),h},[]);else throw new Error(on);if(i.length===0)throw new Error(nn);const o=n?{"--shop-pay-button-width":n}:void 0;return s.createElement("div",{className:t,style:o},u==="done"&&s.createElement("shop-pay-button",{"store-url":a,variants:i.join(",")}))}const nn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',on='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',an="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",un=60*60*24*360*1,sn=60*30;function cn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};s.useEffect(()=>{const n=he(document.cookie);t?(me(W,n[W]||ye(),un,r),me(Z,n[Z]||ye(),sn,r)):(me(W,"",0,r),me(Z,"",0,r))})}function me(e,t,r,n){document.cookie=nr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}A.AddToCartButton=pr,A.AnalyticsEventName=De,A.AnalyticsPageType=ge,A.BuyNowButton=$r,A.CartCheckoutButton=xr,A.CartCost=Fr,A.CartLinePrice=Br,A.CartLineProvider=Gr,A.CartProvider=dr,A.ExternalVideo=st,A.Image=dt,A.MediaFile=Jr,A.ModelViewer=gt,A.Money=ue,A.ProductPrice=en,A.ProductProvider=gr,A.ShopPayButton=rn,A.ShopifyProvider=Qt,A.ShopifySalesChannel=rt,A.Video=ft,A.createStorefrontClient=zt,A.flattenConnection=H,A.getClientBrowserParameters=Nr,A.getShopifyCookies=he,A.parseMetafield=Xr,A.sendShopifyAnalytics=Ur,A.storefrontApiCustomScalars=jr,A.useCart=oe,A.useCartLine=Hr,A.useMoney=it,A.useProduct=Je,A.useShop=fe,A.useShopifyCookies=cn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
279
|
+
`,u.message)})}).catch(n=>{console.error(it,n)})}catch{return Promise.resolve()}}function Vr(){if(Sr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=$r(),r=he(document.cookie);return{uniqueToken:r[W],visitToken:r[Z],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Mr(){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 Rr(){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 $r(){try{let e="PerformanceNavigationTiming",t=Mr();return t||(t=Rr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function xr(e){const{cartCreate:t,checkoutUrl:r}=X(),[n,o]=s.useState(!1),{quantity:u,variantId:i,onClick:a,attributes:y,children:f,...l}=e;s.useEffect(()=>{r&&(window.location.href=r)},[r]);const d=s.useCallback(()=>{o(!0),t({lines:[{quantity:u??1,merchandiseId:i,attributes:y}]})},[t,u,i,y]);return s.createElement(ge,{disabled:n??l.disabled,...l,onClick:a,defaultOnClick:d},f)}function qr(e){const[t,r]=s.useState(!1),{status:n,checkoutUrl:o}=X(),{children:u,...i}=e;return s.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),s.createElement(ge,{...i,disabled:t||i.disabled,onClick:()=>r(!0)},u)}function ut(e){const{countryIsoCode:t,languageIsoCode:r}=fe(),n=`${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 o=parseFloat(e.amount),u=s.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),i=te(n,u),a=te(n,{...u,currencyDisplay:"name"}),y=te(n,{...u,currencyDisplay:"narrowSymbol"}),f=te(n,{...u,minimumFractionDigits:0,maximumFractionDigits:0}),l=te(n),d=te(n,{minimumFractionDigits:0,maximumFractionDigits:0}),p=g=>g.type==="currency",E=s.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(o),parts:()=>i().formatToParts(o),withoutTrailingZeros:()=>o%1===0?f().format(o):i().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?d().format(o):l().format(o),currencyName:()=>{var g;return((g=a().formatToParts(o).find(p))==null?void 0:g.value)??e.currencyCode},currencySymbol:()=>{var g;return((g=i().formatToParts(o).find(p))==null?void 0:g.value)??e.currencyCode},currencyNarrowSymbol:()=>{var g;return((g=y().formatToParts(o).find(p))==null?void 0:g.value)??""},amount:()=>i().formatToParts(o).filter(g=>["decimal","fraction","group","integer","literal"].includes(g.type)).map(g=>g.value).join("")}),[e,o,a,i,y,l,f,d]);return s.useMemo(()=>new Proxy(E,{get:(g,b)=>{var _;return(_=Reflect.get(g,b))==null?void 0:_.call(null)}}),[E])}function te(e,t){return s.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ue({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:u="/",...i}){if(!Fr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const a=ut(e),y=t??"div";let f=a.localizedString;return(r||n)&&(r&&!n?f=a.amount:!r&&n?f=a.withoutTrailingZeros:f=a.withoutTrailingZerosAndCurrency),s.createElement(y,{...i},f,o&&o.referenceUnit&&s.createElement(s.Fragment,null,u,o.referenceUnit))}function Fr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Br(e){const{cost:t}=X(),{amountType:r="total",children:n,...o}=e;let u;return r=="total"?u=t==null?void 0:t.totalAmount:r=="subtotal"?u=t==null?void 0:t.subtotalAmount:r=="tax"?u=t==null?void 0:t.totalTaxAmount:r=="duty"&&(u=t==null?void 0:t.totalDutyAmount),u==null?null:s.createElement(ue,{...o,data:u},n)}function Hr(e){var u,i;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const o=r==="regular"?(u=t.cost)==null?void 0:u.totalAmount:(i=t.cost)==null?void 0:i.compareAtAmountPerQuantity;return o==null?null:s.createElement(ue,{...n,data:o})}const st=s.createContext(null);function Oe(){const e=s.useContext(st);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function jr({children:e,line:t}){return s.createElement(st.Provider,{value:t},e)}function Gr(e){const t=Oe(),{as:r,...n}=e,o=r||"span";return s.createElement(o,{...n},t.quantity)}function Yr(e){const{status:t,linesRemove:r,linesUpdate:n}=X(),o=Oe(),{children:u,adjust:i,onClick:a,...y}=e,f=s.useCallback(()=>{if(i==="remove"){r([(o==null?void 0:o.id)??""]);return}const l=i==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(l<=0){r([(o==null?void 0:o.id)??""]);return}const d={id:(o==null?void 0:o.id)??"",quantity:l,attributes:(o==null?void 0:o.attributes)??[]};n([d])},[i,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return s.createElement(ge,{onClick:a,defaultOnClick:f,disabled:typeof y.disabled<"u"?y.disabled:t!=="idle",...y},u)}const Wr={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function ct(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:u="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:i=!0,loading:a="lazy",...y}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let f=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const d of Object.keys(r))l.searchParams.set(d,r[d]);f=l.toString()}return s.createElement("iframe",{...y,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:u,allowFullScreen:i,src:f,loading:a})}const Zr=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],zr=["spin.dev"],Kr=[...Zr,...zr],se=[352,832,1200,1920,2560];function lt({src:e,width:t,height:r,crop:n,scale:o}){const u=new URL(e),i=o??1;if(t){let a;typeof t=="string"?a=(se[0]*i).toString():a=(Number(t)*i).toString(),u.searchParams.append("width",a)}return r&&typeof r=="number"&&u.searchParams.append("height",(r*i).toString()),n&&u.searchParams.append("crop",n),u.toString()}function dt(e){const t=new URL(e.src);return!Kr.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:lt(e)}function Qr({data:e,loaderOptions:t,elementProps:r}){let n=null;return e!=null&&e.width&&(e!=null&&e.height)&&(n=(e==null?void 0:e.width)/(e==null?void 0:e.height)),t!=null&&t.width||t!=null&&t.height?{width:(t==null?void 0:t.width)??(n&&typeof t.height=="number"?Math.round(n*t.height):null),height:(t==null?void 0:t.height)??(n&&typeof t.width=="number"?Math.round(n*t.width):null)}:r!=null&&r.width||r!=null&&r.height?{width:(r==null?void 0:r.width)??(n&&typeof r.height=="number"?Math.round(n*r.height):null),height:(r==null?void 0:r.height)??(n&&typeof r.width=="number"?Math.round(n*r.width):null)}:e!=null&&e.width||e!=null&&e.height?{width:(e==null?void 0:e.width)??null,height:(e==null?void 0:e.height)??null}:{width:null,height:null}}function ft({data:e,width:t,height:r,loading:n,loader:o=dt,loaderOptions:u,widths:i,decoding:a="async",...y}){if(!e.url){const g=`<Image/>: the 'data' prop requires the 'url' property. Image: ${e.id??"no ID provided"}`;return console.error(g),null}const{width:f,height:l}=Qr({data:e,loaderOptions:u,elementProps:{width:t,height:r}});let d=e.url;if(o&&(d=o({...u,src:e.url,width:f,height:l}),typeof d!="string"||!d))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${e.id??e.url}`);const p=t&&f&&t<f?t:f,E=y.srcSet??Jr({...u,widths:i,src:e.url,width:p,height:l,loader:o});return Q.createElement("img",{id:e.id??"",alt:e.altText??y.alt??"",loading:n??"lazy",...y,src:d,width:f??void 0,height:l??void 0,srcSet:E,decoding:a})}function Jr({src:e,width:t,crop:r,scale:n,widths:o,loader:u,height:i}){const a=o&&Array.isArray(o);if(a&&o.some(d=>isNaN(d)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let y=1;t&&i&&(y=Number(i)/Number(t));let f=a?o:se;!a&&t&&t<se[se.length-1]&&(f=se.filter(d=>d<=t));const l=u||lt;return f.map(d=>`${l({src:e,width:d,height:r?Number(d)*y:void 0,crop:r,scale:n})} ${d??""}w`).join(", ")}function yt(e){var f;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:o=!0,controls:u=!0,sourceProps:i={},...a}=e,y=dt({src:((f=t.previewImage)==null?void 0:f.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return s.createElement("video",{...a,id:n,playsInline:o,controls:u,poster:y},t.sources.map(l=>{if(!(l!=null&&l.url&&(l!=null&&l.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return s.createElement("source",{...i,key:l.url,src:l.url,type:l.mimeType})}))}const ht={};function Xr(e,t){const r=ht[e];if(r)return r;const n=new Promise((o,u)=>{const i=document.createElement("script");t!=null&&t.module?i.type="module":i.type="text/javascript",i.src=e,i.onload=()=>{o(!0)},i.onerror=()=>{u(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(i):document.body.appendChild(i)});return ht[e]=n,n}function gt(e,t){const[r,n]=s.useState("loading"),o=JSON.stringify(t);return s.useEffect(()=>{async function u(){try{n("loading"),await Xr(e,t),n("done")}catch{n("error")}}u().catch(()=>{n("error")})},[e,o,t]),r}function mt(e){var f,l,d;const[t,r]=s.useState(void 0),n=s.useCallback(p=>{r(p)},[]),{data:o,children:u,className:i,...a}=e,y=gt("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return s.useEffect(()=>{if(t)return a.onError&&t.addEventListener("error",a.onError),a.onLoad&&t.addEventListener("load",a.onLoad),a.onPreload&&t.addEventListener("preload",a.onPreload),a.onModelVisibility&&t.addEventListener("model-visibility",a.onModelVisibility),a.onProgress&&t.addEventListener("progress",a.onProgress),a.onArStatus&&t.addEventListener("ar-status",a.onArStatus),a.onArTracking&&t.addEventListener("ar-tracking",a.onArTracking),a.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",a.onQuickLookButtonTapped),a.onCameraChange&&t.addEventListener("camera-change",a.onCameraChange),a.onEnvironmentChange&&t.addEventListener("environment-change",a.onEnvironmentChange),a.onPlay&&t.addEventListener("play",a.onPlay),a.onPause&&t.addEventListener("ar-status",a.onPause),a.onSceneGraphReady&&t.addEventListener("scene-graph-ready",a.onSceneGraphReady),()=>{t!=null&&(a.onError&&t.removeEventListener("error",a.onError),a.onLoad&&t.removeEventListener("load",a.onLoad),a.onPreload&&t.removeEventListener("preload",a.onPreload),a.onModelVisibility&&t.removeEventListener("model-visibility",a.onModelVisibility),a.onProgress&&t.removeEventListener("progress",a.onProgress),a.onArStatus&&t.removeEventListener("ar-status",a.onArStatus),a.onArTracking&&t.removeEventListener("ar-tracking",a.onArTracking),a.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",a.onQuickLookButtonTapped),a.onCameraChange&&t.removeEventListener("camera-change",a.onCameraChange),a.onEnvironmentChange&&t.removeEventListener("environment-change",a.onEnvironmentChange),a.onPlay&&t.removeEventListener("play",a.onPlay),a.onPause&&t.removeEventListener("ar-status",a.onPause),a.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",a.onSceneGraphReady))}},[t,a.onArStatus,a.onArTracking,a.onCameraChange,a.onEnvironmentChange,a.onError,a.onLoad,a.onModelVisibility,a.onPause,a.onPlay,a.onPreload,a.onProgress,a.onQuickLookButtonTapped,a.onSceneGraphReady]),y!=="done"?null:(l=(f=o.sources)==null?void 0:f[0])!=null&&l.url?s.createElement("model-viewer",{ref:n,...a,className:i,id:a.id??o.id,src:o.sources[0].url,alt:o.alt??null,"camera-controls":a.cameraControls??!0,poster:(a.poster||((d=o.previewImage)==null?void 0:d.url))??null,autoplay:a.autoplay??!0,loading:a.loading,reveal:a.reveal,ar:a.ar,"ar-modes":a.arModes,"ar-scale":a.arScale,"ar-placement":a.arPlacement,"ios-src":a.iosSrc,"touch-action":a.touchAction,"disable-zoom":a.disableZoom,"orbit-sensitivity":a.orbitSensitivity,"auto-rotate":a.autoRotate,"auto-rotate-delay":a.autoRotateDelay,"rotation-per-second":a.rotationPerSecond,"interaction-policy":a.interactionPolicy,"interaction-prompt":a.interactionPrompt,"interaction-prompt-style":a.interactionPromptStyle,"interaction-prompt-threshold":a.interactionPromptThreshold,"camera-orbit":a.cameraOrbit,"camera-target":a.cameraTarget,"field-of-view":a.fieldOfView,"max-camera-orbit":a.maxCameraOrbit,"min-camera-orbit":a.minCameraOrbit,"max-field-of-view":a.maxFieldOfView,"min-field-of-view":a.minFieldOfView,bounds:a.bounds,"interpolation-decay":a.interpolationDecay??100,"skybox-image":a.skyboxImage,"environment-image":a.environmentImage,exposure:a.exposure,"shadow-intensity":a.shadowIntensity??0,"shadow-softness":a.shadowSoftness??0,"animation-name":a.animationName,"animation-crossfade-duration":a.animationCrossfadeDuration,"variant-name":a.variantName,orientation:a.orientation,scale:a.scale},u):(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 en({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?s.createElement(ft,{...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 s.createElement(yt,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return s.createElement(ct,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return s.createElement(mt,{...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 tn(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"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=Et(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=Et((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:H(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 Et(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function rn(e){var f,l,d,p,E,g;const{priceType:t="regular",variantId:r,valueType:n="min",data:o,...u}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let i,a;const y=r?H((o==null?void 0:o.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&y){if(((f=y.compareAtPriceV2)==null?void 0:f.amount)===((l=y.priceV2)==null?void 0:l.amount))return null;i=y.compareAtPriceV2}else n==="max"?i=(d=o==null?void 0:o.compareAtPriceRange)==null?void 0:d.maxVariantPrice:i=(p=o==null?void 0:o.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&y?(i=y.priceV2,n==="unit"&&(i=y.unitPrice,a=y.unitPriceMeasurement)):n==="max"?i=(E=o.priceRange)==null?void 0:E.maxVariantPrice:i=(g=o.priceRange)==null?void 0:g.minVariantPrice;return i?a?s.createElement(ue,{...u,data:i,measurement:a}):s.createElement(ue,{...u,data:i}):null}const nn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function on({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:o}=fe(),u=gt(nn);let i=[];if(e&&r)throw new Error(sn);if(e)i=e.reduce((y,f)=>{const l=j(f).id;return l&&y.push(l),y},[]);else if(r)i=r.reduce((y,f)=>{const l=j(f==null?void 0:f.id).id;return l&&y.push(`${l}:${(f==null?void 0:f.quantity)??1}`),y},[]);else throw new Error(un);if(i.length===0)throw new Error(an);const a=n?{"--shop-pay-button-width":n}:void 0;return s.createElement("div",{className:t,style:a},u==="done"&&s.createElement("shop-pay-button",{"store-url":o,variants:i.join(",")}))}const an='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',un='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',sn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",cn=60*60*24*360*1,ln=60*30;function dn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};s.useEffect(()=>{const n=he(document.cookie);t?(Ee(W,n[W]||ye(),cn,r),Ee(Z,n[Z]||ye(),ln,r)):(Ee(W,"",0,r),Ee(Z,"",0,r))})}function Ee(e,t,r,n){document.cookie=or(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}v.AddToCartButton=_r,v.AnalyticsEventName=De,v.AnalyticsPageType=me,v.BuyNowButton=xr,v.CartCheckoutButton=qr,v.CartCost=Br,v.CartLinePrice=Hr,v.CartLineProvider=jr,v.CartLineQuantity=Gr,v.CartLineQuantityAdjustButton=Yr,v.CartProvider=fr,v.ExternalVideo=ct,v.Image=ft,v.MediaFile=en,v.ModelViewer=mt,v.Money=ue,v.ProductPrice=rn,v.ProductProvider=mr,v.ShopPayButton=on,v.ShopifyProvider=Jt,v.ShopifySalesChannel=nt,v.Video=yt,v.createStorefrontClient=Kt,v.flattenConnection=H,v.getClientBrowserParameters=Vr,v.getShopifyCookies=he,v.parseMetafield=tn,v.sendShopifyAnalytics=kr,v.storefrontApiCustomScalars=Wr,v.useCart=X,v.useCartLine=Oe,v.useMoney=ut,v.useProduct=Xe,v.useShop=fe,v.useShopifyCookies=dn,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
|
280
280
|
//# sourceMappingURL=hydrogen-react.prod.js.map
|