@shopify/hydrogen-react 2023.1.4 → 2023.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/README.md +19 -201
  2. package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
  3. package/dist/browser-dev/BaseButton.mjs.map +1 -1
  4. package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
  5. package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
  6. package/dist/browser-dev/CartCost.mjs.map +1 -1
  7. package/dist/browser-dev/CartLinePrice.mjs +3 -0
  8. package/dist/browser-dev/CartLinePrice.mjs.map +1 -1
  9. package/dist/browser-dev/CartLineProvider.mjs +4 -1
  10. package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
  11. package/dist/browser-dev/CartLineQuantity.mjs +12 -0
  12. package/dist/browser-dev/CartLineQuantity.mjs.map +1 -0
  13. package/dist/browser-dev/CartLineQuantityAdjustButton.mjs +48 -0
  14. package/dist/browser-dev/CartLineQuantityAdjustButton.mjs.map +1 -0
  15. package/dist/browser-dev/CartProvider.mjs +3 -3
  16. package/dist/browser-dev/CartProvider.mjs.map +1 -1
  17. package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
  18. package/dist/browser-dev/Image.mjs +1 -1
  19. package/dist/browser-dev/Image.mjs.map +1 -1
  20. package/dist/browser-dev/MediaFile.mjs.map +1 -1
  21. package/dist/browser-dev/ModelViewer.mjs.map +1 -1
  22. package/dist/browser-dev/Money.mjs.map +1 -1
  23. package/dist/browser-dev/ProductPrice.mjs.map +1 -1
  24. package/dist/browser-dev/ProductProvider.mjs.map +1 -1
  25. package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
  26. package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
  27. package/dist/browser-dev/Video.mjs.map +1 -1
  28. package/dist/browser-dev/analytics.mjs.map +1 -1
  29. package/dist/browser-dev/cart-hooks.mjs +5 -2
  30. package/dist/browser-dev/cart-hooks.mjs.map +1 -1
  31. package/dist/browser-dev/cart-queries.mjs.map +1 -1
  32. package/dist/browser-dev/flatten-connection.mjs +1 -1
  33. package/dist/browser-dev/flatten-connection.mjs.map +1 -1
  34. package/dist/browser-dev/image-size.mjs.map +1 -1
  35. package/dist/browser-dev/index.mjs +4 -0
  36. package/dist/browser-dev/index.mjs.map +1 -1
  37. package/dist/browser-dev/load-script.mjs +3 -1
  38. package/dist/browser-dev/load-script.mjs.map +1 -1
  39. package/dist/browser-dev/parse-metafield.mjs.map +1 -1
  40. package/dist/browser-dev/storefront-client.mjs +9 -8
  41. package/dist/browser-dev/storefront-client.mjs.map +1 -1
  42. package/dist/browser-dev/useCartAPIStateMachine.mjs +9 -0
  43. package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
  44. package/dist/browser-dev/useCartActions.mjs.map +1 -1
  45. package/dist/browser-dev/useMoney.mjs +1 -0
  46. package/dist/browser-dev/useMoney.mjs.map +1 -1
  47. package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
  48. package/dist/browser-prod/BaseButton.mjs.map +1 -1
  49. package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
  50. package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
  51. package/dist/browser-prod/CartCost.mjs.map +1 -1
  52. package/dist/browser-prod/CartLinePrice.mjs.map +1 -1
  53. package/dist/browser-prod/CartLineProvider.mjs +4 -1
  54. package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
  55. package/dist/browser-prod/CartLineQuantity.mjs +12 -0
  56. package/dist/browser-prod/CartLineQuantity.mjs.map +1 -0
  57. package/dist/browser-prod/CartLineQuantityAdjustButton.mjs +48 -0
  58. package/dist/browser-prod/CartLineQuantityAdjustButton.mjs.map +1 -0
  59. package/dist/browser-prod/CartProvider.mjs +3 -3
  60. package/dist/browser-prod/CartProvider.mjs.map +1 -1
  61. package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
  62. package/dist/browser-prod/Image.mjs +1 -1
  63. package/dist/browser-prod/Image.mjs.map +1 -1
  64. package/dist/browser-prod/MediaFile.mjs.map +1 -1
  65. package/dist/browser-prod/ModelViewer.mjs.map +1 -1
  66. package/dist/browser-prod/Money.mjs.map +1 -1
  67. package/dist/browser-prod/ProductPrice.mjs.map +1 -1
  68. package/dist/browser-prod/ProductProvider.mjs.map +1 -1
  69. package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
  70. package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
  71. package/dist/browser-prod/Video.mjs.map +1 -1
  72. package/dist/browser-prod/analytics.mjs.map +1 -1
  73. package/dist/browser-prod/cart-hooks.mjs +5 -2
  74. package/dist/browser-prod/cart-hooks.mjs.map +1 -1
  75. package/dist/browser-prod/cart-queries.mjs.map +1 -1
  76. package/dist/browser-prod/flatten-connection.mjs +1 -1
  77. package/dist/browser-prod/flatten-connection.mjs.map +1 -1
  78. package/dist/browser-prod/image-size.mjs.map +1 -1
  79. package/dist/browser-prod/index.mjs +4 -0
  80. package/dist/browser-prod/index.mjs.map +1 -1
  81. package/dist/browser-prod/load-script.mjs +3 -1
  82. package/dist/browser-prod/load-script.mjs.map +1 -1
  83. package/dist/browser-prod/parse-metafield.mjs.map +1 -1
  84. package/dist/browser-prod/storefront-client.mjs +8 -7
  85. package/dist/browser-prod/storefront-client.mjs.map +1 -1
  86. package/dist/browser-prod/useCartAPIStateMachine.mjs +9 -0
  87. package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
  88. package/dist/browser-prod/useCartActions.mjs.map +1 -1
  89. package/dist/browser-prod/useMoney.mjs +1 -0
  90. package/dist/browser-prod/useMoney.mjs.map +1 -1
  91. package/dist/node-dev/AddToCartButton.js.map +1 -1
  92. package/dist/node-dev/AddToCartButton.mjs.map +1 -1
  93. package/dist/node-dev/BaseButton.js.map +1 -1
  94. package/dist/node-dev/BaseButton.mjs.map +1 -1
  95. package/dist/node-dev/BuyNowButton.js.map +1 -1
  96. package/dist/node-dev/BuyNowButton.mjs.map +1 -1
  97. package/dist/node-dev/CartCheckoutButton.js.map +1 -1
  98. package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
  99. package/dist/node-dev/CartCost.js.map +1 -1
  100. package/dist/node-dev/CartCost.mjs.map +1 -1
  101. package/dist/node-dev/CartLinePrice.js +3 -0
  102. package/dist/node-dev/CartLinePrice.js.map +1 -1
  103. package/dist/node-dev/CartLinePrice.mjs +3 -0
  104. package/dist/node-dev/CartLinePrice.mjs.map +1 -1
  105. package/dist/node-dev/CartLineProvider.js +4 -1
  106. package/dist/node-dev/CartLineProvider.js.map +1 -1
  107. package/dist/node-dev/CartLineProvider.mjs +4 -1
  108. package/dist/node-dev/CartLineProvider.mjs.map +1 -1
  109. package/dist/node-dev/CartLineQuantity.js +12 -0
  110. package/dist/node-dev/CartLineQuantity.js.map +1 -0
  111. package/dist/node-dev/CartLineQuantity.mjs +12 -0
  112. package/dist/node-dev/CartLineQuantity.mjs.map +1 -0
  113. package/dist/node-dev/CartLineQuantityAdjustButton.js +48 -0
  114. package/dist/node-dev/CartLineQuantityAdjustButton.js.map +1 -0
  115. package/dist/node-dev/CartLineQuantityAdjustButton.mjs +48 -0
  116. package/dist/node-dev/CartLineQuantityAdjustButton.mjs.map +1 -0
  117. package/dist/node-dev/CartProvider.js +3 -3
  118. package/dist/node-dev/CartProvider.js.map +1 -1
  119. package/dist/node-dev/CartProvider.mjs +3 -3
  120. package/dist/node-dev/CartProvider.mjs.map +1 -1
  121. package/dist/node-dev/ExternalVideo.js.map +1 -1
  122. package/dist/node-dev/ExternalVideo.mjs.map +1 -1
  123. package/dist/node-dev/Image.js +1 -1
  124. package/dist/node-dev/Image.js.map +1 -1
  125. package/dist/node-dev/Image.mjs +1 -1
  126. package/dist/node-dev/Image.mjs.map +1 -1
  127. package/dist/node-dev/MediaFile.js.map +1 -1
  128. package/dist/node-dev/MediaFile.mjs.map +1 -1
  129. package/dist/node-dev/ModelViewer.js.map +1 -1
  130. package/dist/node-dev/ModelViewer.mjs.map +1 -1
  131. package/dist/node-dev/Money.js.map +1 -1
  132. package/dist/node-dev/Money.mjs.map +1 -1
  133. package/dist/node-dev/ProductPrice.js.map +1 -1
  134. package/dist/node-dev/ProductPrice.mjs.map +1 -1
  135. package/dist/node-dev/ProductProvider.js.map +1 -1
  136. package/dist/node-dev/ProductProvider.mjs.map +1 -1
  137. package/dist/node-dev/ShopPayButton.js.map +1 -1
  138. package/dist/node-dev/ShopPayButton.mjs.map +1 -1
  139. package/dist/node-dev/ShopifyProvider.js.map +1 -1
  140. package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
  141. package/dist/node-dev/Video.js.map +1 -1
  142. package/dist/node-dev/Video.mjs.map +1 -1
  143. package/dist/node-dev/analytics.js.map +1 -1
  144. package/dist/node-dev/analytics.mjs.map +1 -1
  145. package/dist/node-dev/cart-hooks.js +5 -2
  146. package/dist/node-dev/cart-hooks.js.map +1 -1
  147. package/dist/node-dev/cart-hooks.mjs +5 -2
  148. package/dist/node-dev/cart-hooks.mjs.map +1 -1
  149. package/dist/node-dev/cart-queries.js.map +1 -1
  150. package/dist/node-dev/cart-queries.mjs.map +1 -1
  151. package/dist/node-dev/flatten-connection.js +1 -1
  152. package/dist/node-dev/flatten-connection.js.map +1 -1
  153. package/dist/node-dev/flatten-connection.mjs +1 -1
  154. package/dist/node-dev/flatten-connection.mjs.map +1 -1
  155. package/dist/node-dev/image-size.js.map +1 -1
  156. package/dist/node-dev/image-size.mjs.map +1 -1
  157. package/dist/node-dev/index.js +4 -0
  158. package/dist/node-dev/index.js.map +1 -1
  159. package/dist/node-dev/index.mjs +4 -0
  160. package/dist/node-dev/index.mjs.map +1 -1
  161. package/dist/node-dev/load-script.js +3 -1
  162. package/dist/node-dev/load-script.js.map +1 -1
  163. package/dist/node-dev/load-script.mjs +3 -1
  164. package/dist/node-dev/load-script.mjs.map +1 -1
  165. package/dist/node-dev/parse-metafield.js.map +1 -1
  166. package/dist/node-dev/parse-metafield.mjs.map +1 -1
  167. package/dist/node-dev/storefront-client.js +9 -8
  168. package/dist/node-dev/storefront-client.js.map +1 -1
  169. package/dist/node-dev/storefront-client.mjs +9 -8
  170. package/dist/node-dev/storefront-client.mjs.map +1 -1
  171. package/dist/node-dev/useCartAPIStateMachine.js +9 -0
  172. package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
  173. package/dist/node-dev/useCartAPIStateMachine.mjs +9 -0
  174. package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
  175. package/dist/node-dev/useCartActions.js.map +1 -1
  176. package/dist/node-dev/useCartActions.mjs.map +1 -1
  177. package/dist/node-dev/useMoney.js +1 -0
  178. package/dist/node-dev/useMoney.js.map +1 -1
  179. package/dist/node-dev/useMoney.mjs +1 -0
  180. package/dist/node-dev/useMoney.mjs.map +1 -1
  181. package/dist/node-prod/AddToCartButton.js.map +1 -1
  182. package/dist/node-prod/AddToCartButton.mjs.map +1 -1
  183. package/dist/node-prod/BaseButton.js.map +1 -1
  184. package/dist/node-prod/BaseButton.mjs.map +1 -1
  185. package/dist/node-prod/BuyNowButton.js.map +1 -1
  186. package/dist/node-prod/BuyNowButton.mjs.map +1 -1
  187. package/dist/node-prod/CartCheckoutButton.js.map +1 -1
  188. package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
  189. package/dist/node-prod/CartCost.js.map +1 -1
  190. package/dist/node-prod/CartCost.mjs.map +1 -1
  191. package/dist/node-prod/CartLinePrice.js.map +1 -1
  192. package/dist/node-prod/CartLinePrice.mjs.map +1 -1
  193. package/dist/node-prod/CartLineProvider.js +4 -1
  194. package/dist/node-prod/CartLineProvider.js.map +1 -1
  195. package/dist/node-prod/CartLineProvider.mjs +4 -1
  196. package/dist/node-prod/CartLineProvider.mjs.map +1 -1
  197. package/dist/node-prod/CartLineQuantity.js +12 -0
  198. package/dist/node-prod/CartLineQuantity.js.map +1 -0
  199. package/dist/node-prod/CartLineQuantity.mjs +12 -0
  200. package/dist/node-prod/CartLineQuantity.mjs.map +1 -0
  201. package/dist/node-prod/CartLineQuantityAdjustButton.js +48 -0
  202. package/dist/node-prod/CartLineQuantityAdjustButton.js.map +1 -0
  203. package/dist/node-prod/CartLineQuantityAdjustButton.mjs +48 -0
  204. package/dist/node-prod/CartLineQuantityAdjustButton.mjs.map +1 -0
  205. package/dist/node-prod/CartProvider.js +3 -3
  206. package/dist/node-prod/CartProvider.js.map +1 -1
  207. package/dist/node-prod/CartProvider.mjs +3 -3
  208. package/dist/node-prod/CartProvider.mjs.map +1 -1
  209. package/dist/node-prod/ExternalVideo.js.map +1 -1
  210. package/dist/node-prod/ExternalVideo.mjs.map +1 -1
  211. package/dist/node-prod/Image.js +1 -1
  212. package/dist/node-prod/Image.js.map +1 -1
  213. package/dist/node-prod/Image.mjs +1 -1
  214. package/dist/node-prod/Image.mjs.map +1 -1
  215. package/dist/node-prod/MediaFile.js.map +1 -1
  216. package/dist/node-prod/MediaFile.mjs.map +1 -1
  217. package/dist/node-prod/ModelViewer.js.map +1 -1
  218. package/dist/node-prod/ModelViewer.mjs.map +1 -1
  219. package/dist/node-prod/Money.js.map +1 -1
  220. package/dist/node-prod/Money.mjs.map +1 -1
  221. package/dist/node-prod/ProductPrice.js.map +1 -1
  222. package/dist/node-prod/ProductPrice.mjs.map +1 -1
  223. package/dist/node-prod/ProductProvider.js.map +1 -1
  224. package/dist/node-prod/ProductProvider.mjs.map +1 -1
  225. package/dist/node-prod/ShopPayButton.js.map +1 -1
  226. package/dist/node-prod/ShopPayButton.mjs.map +1 -1
  227. package/dist/node-prod/ShopifyProvider.js.map +1 -1
  228. package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
  229. package/dist/node-prod/Video.js.map +1 -1
  230. package/dist/node-prod/Video.mjs.map +1 -1
  231. package/dist/node-prod/analytics.js.map +1 -1
  232. package/dist/node-prod/analytics.mjs.map +1 -1
  233. package/dist/node-prod/cart-hooks.js +5 -2
  234. package/dist/node-prod/cart-hooks.js.map +1 -1
  235. package/dist/node-prod/cart-hooks.mjs +5 -2
  236. package/dist/node-prod/cart-hooks.mjs.map +1 -1
  237. package/dist/node-prod/cart-queries.js.map +1 -1
  238. package/dist/node-prod/cart-queries.mjs.map +1 -1
  239. package/dist/node-prod/flatten-connection.js +1 -1
  240. package/dist/node-prod/flatten-connection.js.map +1 -1
  241. package/dist/node-prod/flatten-connection.mjs +1 -1
  242. package/dist/node-prod/flatten-connection.mjs.map +1 -1
  243. package/dist/node-prod/image-size.js.map +1 -1
  244. package/dist/node-prod/image-size.mjs.map +1 -1
  245. package/dist/node-prod/index.js +4 -0
  246. package/dist/node-prod/index.js.map +1 -1
  247. package/dist/node-prod/index.mjs +4 -0
  248. package/dist/node-prod/index.mjs.map +1 -1
  249. package/dist/node-prod/load-script.js +3 -1
  250. package/dist/node-prod/load-script.js.map +1 -1
  251. package/dist/node-prod/load-script.mjs +3 -1
  252. package/dist/node-prod/load-script.mjs.map +1 -1
  253. package/dist/node-prod/parse-metafield.js.map +1 -1
  254. package/dist/node-prod/parse-metafield.mjs.map +1 -1
  255. package/dist/node-prod/storefront-client.js +8 -7
  256. package/dist/node-prod/storefront-client.js.map +1 -1
  257. package/dist/node-prod/storefront-client.mjs +8 -7
  258. package/dist/node-prod/storefront-client.mjs.map +1 -1
  259. package/dist/node-prod/useCartAPIStateMachine.js +9 -0
  260. package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
  261. package/dist/node-prod/useCartAPIStateMachine.mjs +9 -0
  262. package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
  263. package/dist/node-prod/useCartActions.js.map +1 -1
  264. package/dist/node-prod/useCartActions.mjs.map +1 -1
  265. package/dist/node-prod/useMoney.js +1 -0
  266. package/dist/node-prod/useMoney.js.map +1 -1
  267. package/dist/node-prod/useMoney.mjs +1 -0
  268. package/dist/node-prod/useMoney.mjs.map +1 -1
  269. package/dist/types/AddToCartButton.d.ts +4 -1
  270. package/dist/types/BaseButton.d.ts +2 -2
  271. package/dist/types/BuyNowButton.d.ts +3 -1
  272. package/dist/types/CartCheckoutButton.d.ts +3 -1
  273. package/dist/types/CartCost.d.ts +3 -1
  274. package/dist/types/CartLinePrice.d.ts +15 -1
  275. package/dist/types/CartLineProvider.d.ts +11 -5
  276. package/dist/types/CartLineQuantity.d.ts +13 -0
  277. package/dist/types/CartLineQuantityAdjustButton.d.ts +13 -0
  278. package/dist/types/CartProvider.d.ts +1 -1
  279. package/dist/types/ExternalVideo.d.ts +2 -2
  280. package/dist/types/Money.d.ts +2 -3
  281. package/dist/types/ProductPrice.d.ts +3 -1
  282. package/dist/types/ShopifyProvider.d.ts +9 -6
  283. package/dist/types/analytics-types.d.ts +60 -11
  284. package/dist/types/flatten-connection.d.ts +4 -0
  285. package/dist/types/image-size.d.ts +1 -1
  286. package/dist/types/index.d.cts +2 -0
  287. package/dist/types/index.d.ts +2 -0
  288. package/dist/types/parse-metafield.d.ts +1 -1
  289. package/dist/types/storefront-api-response.types.d.ts +1 -1
  290. package/dist/types/storefront-api-types.d.ts +2 -1
  291. package/dist/types/storefront-client.d.ts +1 -1
  292. package/dist/umd/hydrogen-react.dev.js +271 -346
  293. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  294. package/dist/umd/hydrogen-react.prod.js +15 -31
  295. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  296. package/package.json +32 -22
  297. package/storefront.schema.json +1 -1
@@ -1,4 +1,4 @@
1
- (function(A,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(A=typeof globalThis<"u"?globalThis:A||self,s(A.storefrontkitreact={},A.React))})(this,function(A,s){"use strict";function At(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 Oe=At(s);/*! *****************************************************************************
1
+ (function(E,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(E=typeof globalThis<"u"?globalThis:E||self,u(E.hydrogenreact={},E.React))})(this,function(E,u){"use strict";function Ct(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 W=Ct(u);/*! *****************************************************************************
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,i,a=r.call(e),u=[];try{for(;(t===void 0||t-- >0)&&!(n=a.next()).done;)u.push(n.value)}catch(o){i={error:o}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return u}var Y;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Y||(Y={}));var Pe={type:"xstate.init"};function Ee(e){return e===void 0?[]:[].concat(e)}function Q(e){return{type:"xstate.assign",assignment:e}}function Ue(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 ce(e){return function(t){return e===t}}function ke(e){return typeof e=="string"?{type:e}:e}function Ne(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ce(e)}}function Ve(e,t,r){var n=t,i=!1;return[e.filter(function(a){if(a.type==="xstate.assign"){i=!0;var u=Object.assign({},n);return typeof a.assignment=="function"?u=a.assignment(n,r):Object.keys(a.assignment).forEach(function(o){u[o]=typeof a.assignment[o]=="function"?a.assignment[o](n,r):a.assignment[o]}),n=u,!1}return!0}),n,i]}function Me(e,t){t===void 0&&(t={});var r=Le(Ve(Ee(e.states[e.initial].entry).map(function(u){return Ue(u,t.actions)}),e.context,Pe),2),n=r[0],i=r[1],a={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:ce(e.initial)},transition:function(u,o){var h,y,l=typeof u=="string"?{value:u,context:e.context}:u,d=l.value,p=l.context,E=ke(o),g=e.states[d];if(g.on){var b=Ee(g.on[E.type]);try{for(var _=function(O){var K=typeof Symbol=="function"&&Symbol.iterator,P=K&&O[K],me=0;if(P)return P.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&me>=O.length&&(O=void 0),{value:O&&O[me++],done:!O}}};throw new TypeError(K?"Object is not iterable.":"Symbol.iterator is not defined.")}(b),L=_.next();!L.done;L=_.next()){var w=L.value;if(w===void 0)return Ne(d,p);var C=typeof w=="string"?{target:w}:w,c=C.target,f=C.actions,m=f===void 0?[]:f,T=C.cond,I=T===void 0?function(){return!0}:T,S=c===void 0,D=c??d,U=e.states[D];if(I(p,E)){var V=Le(Ve((S?Ee(m):[].concat(g.exit,m,U.entry).filter(function(O){return O})).map(function(O){return Ue(O,a._options.actions)}),p,E),3),$=V[0],j=V[1],ee=V[2],F=c??d;return{value:F,context:j,actions:$,changed:c!==d||$.length>0||ee,matches:ce(F)}}}}catch(O){h={error:O}}finally{try{L&&!L.done&&(y=_.return)&&y.call(_)}finally{if(h)throw h.error}}}return Ne(d,p)}};return a}var Re=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function bt(e){var t=e.initialState,r=Y.NotStarted,n=new Set,i={_machine:e,send:function(a){r===Y.Running&&(t=e.transition(t,a),Re(t,ke(a)),n.forEach(function(u){return u(t)}))},subscribe:function(a){return n.add(a),a(t),{unsubscribe:function(){return n.delete(a)}}},start:function(a){if(a){var u=typeof a=="object"?a:{context:e.config.context,value:a};t={value:u.value,actions:[],context:u.context,matches:ce(u.value)}}else t=e.initialState;return r=Y.Running,Re(t,Pe),i},stop:function(){return r=Y.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}var wt=s.useLayoutEffect,pe={},It={get exports(){return pe},set exports(e){pe=e}},_e={},le={},Dt={get exports(){return le},set exports(e){le=e}},Se={};/**
14
+ ***************************************************************************** */function ke(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(t===void 0||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}var j;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(j||(j={}));var Ue={type:"xstate.init"};function Se(e){return e===void 0?[]:[].concat(e)}function z(e){return{type:"xstate.assign",assignment:e}}function Ne(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 ce(e){return function(t){return e===t}}function $e(e){return typeof e=="string"?{type:e}:e}function Ve(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ce(e)}}function Le(e,t,r){var n=t,o=!1;return[e.filter(function(s){if(s.type==="xstate.assign"){o=!0;var i=Object.assign({},n);return typeof s.assignment=="function"?i=s.assignment(n,r):Object.keys(s.assignment).forEach(function(a){i[a]=typeof s.assignment[a]=="function"?s.assignment[a](n,r):s.assignment[a]}),n=i,!1}return!0}),n,o]}function Me(e,t){t===void 0&&(t={});var r=ke(Le(Se(e.states[e.initial].entry).map(function(i){return Ne(i,t.actions)}),e.context,Ue),2),n=r[0],o=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:n,context:o,matches:ce(e.initial)},transition:function(i,a){var c,l,d=typeof i=="string"?{value:i,context:e.context}:i,g=d.value,S=d.context,m=$e(a),y=e.states[g];if(y.on){var P=Se(y.on[m.type]);try{for(var T=function(b){var Q=typeof Symbol=="function"&&Symbol.iterator,w=Q&&b[Q],Ce=0;if(w)return w.call(b);if(b&&typeof b.length=="number")return{next:function(){return b&&Ce>=b.length&&(b=void 0),{value:b&&b[Ce++],done:!b}}};throw new TypeError(Q?"Object is not iterable.":"Symbol.iterator is not defined.")}(P),k=T.next();!k.done;k=T.next()){var _=k.value;if(_===void 0)return Ve(g,S);var V=typeof _=="string"?{target:_}:_,h=V.target,f=V.actions,C=f===void 0?[]:f,I=V.cond,D=I===void 0?function(){return!0}:I,A=h===void 0,v=h??g,U=e.states[v];if(D(S,m)){var O=ke(Le((A?Se(C):[].concat(y.exit,C,U.entry).filter(function(b){return b})).map(function(b){return Ne(b,s._options.actions)}),S,m),3),Z=O[0],Ee=O[1],pe=O[2],se=h??g;return{value:se,context:Ee,actions:Z,changed:h!==g||Z.length>0||pe,matches:ce(se)}}}}catch(b){c={error:b}}finally{try{k&&!k.done&&(l=T.return)&&l.call(T)}finally{if(c)throw c.error}}}return Ve(g,S)}};return s}var Oe=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function St(e){var t=e.initialState,r=j.NotStarted,n=new Set,o={_machine:e,send:function(s){r===j.Running&&(t=e.transition(t,s),Oe(t,$e(s)),n.forEach(function(i){return i(t)}))},subscribe:function(s){return n.add(s),s(t),{unsubscribe:function(){return n.delete(s)}}},start:function(s){if(s){var i=typeof s=="object"?s:{context:e.config.context,value:s};t={value:i.value,actions:[],context:i.context,matches:ce(i.value)}}else t=e.initialState;return r=j.Running,Oe(t,Ue),o},stop:function(){return r=j.Stopped,n.clear(),o},get state(){return t},get status(){return r}};return o}var Tt=u.useLayoutEffect,Te={},_t={get exports(){return Te},set exports(e){Te=e}},Re={},_e={},At={get exports(){return _e},set exports(e){_e=e}},xe={};/**
15
15
  * @license React
16
16
  * use-sync-external-store-shim.production.min.js
17
17
  *
@@ -19,15 +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 $e;function Ot(){if($e)return Se;$e=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,i=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function o(d,p){var E=p(),g=n({inst:{value:E,getSnapshot:p}}),b=g[0].inst,_=g[1];return a(function(){b.value=E,b.getSnapshot=p,h(b)&&_({inst:b})},[d,E,p]),i(function(){return h(b)&&_({inst:b}),d(function(){h(b)&&_({inst:b})})},[d]),u(E),E}function h(d){var p=d.getSnapshot;d=d.value;try{var E=p();return!r(d,E)}catch{return!0}}function y(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:o;return Se.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,Se}var ve={};/**
23
- * @license React
24
- * use-sync-external-store-shim.development.js
25
- *
26
- * Copyright (c) Facebook, Inc. and its affiliates.
27
- *
28
- * This source code is licensed under the MIT license found in the
29
- * LICENSE file in the root directory of this source tree.
30
- */var xe;function Lt(){return xe||(xe=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(C){{for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];n("error",C,f)}}function n(C,c,f){{var m=t.ReactDebugCurrentFrame,T=m.getStackAddendum();T!==""&&(c+="%s",f=f.concat([T]));var I=f.map(function(S){return String(S)});I.unshift("Warning: "+c),Function.prototype.apply.call(console[C],console,I)}}function i(C,c){return C===c&&(C!==0||1/C===1/c)||C!==C&&c!==c}var a=typeof Object.is=="function"?Object.is:i,u=e.useState,o=e.useEffect,h=e.useLayoutEffect,y=e.useDebugValue,l=!1,d=!1;function p(C,c,f){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 T=c();a(m,T)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var I=u({inst:{value:m,getSnapshot:c}}),S=I[0].inst,D=I[1];return h(function(){S.value=m,S.getSnapshot=c,E(S)&&D({inst:S})},[C,m,c]),o(function(){E(S)&&D({inst:S});var U=function(){E(S)&&D({inst:S})};return C(U)},[C]),y(m),m}function E(C){var c=C.getSnapshot,f=C.value;try{var m=c();return!a(f,m)}catch{return!0}}function g(C,c,f){return c()}var b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!b,L=_?g:p,w=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:L;ve.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ve}var qe;function Fe(){return qe||(qe=1,function(e){process.env.NODE_ENV==="production"?e.exports=Ot():e.exports=Lt()}(Dt)),le}/**
22
+ */var J=u;function vt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bt=typeof Object.is=="function"?Object.is:vt,wt=J.useState,It=J.useEffect,Dt=J.useLayoutEffect,Pt=J.useDebugValue;function kt(e,t){var r=t(),n=wt({inst:{value:r,getSnapshot:t}}),o=n[0].inst,s=n[1];return Dt(function(){o.value=r,o.getSnapshot=t,Ae(o)&&s({inst:o})},[e,r,t]),It(function(){return Ae(o)&&s({inst:o}),e(function(){Ae(o)&&s({inst:o})})},[e]),Pt(r),r}function Ae(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!bt(e,r)}catch{return!0}}function Ut(e,t){return t()}var Nt=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Ut:kt;xe.useSyncExternalStore=J.useSyncExternalStore!==void 0?J.useSyncExternalStore:Nt,function(e){e.exports=xe}(At);/**
31
23
  * @license React
32
24
  * use-sync-external-store-shim/with-selector.production.min.js
33
25
  *
@@ -35,15 +27,7 @@
35
27
  *
36
28
  * This source code is licensed under the MIT license found in the
37
29
  * LICENSE file in the root directory of this source tree.
38
- */var Be;function Pt(){if(Be)return _e;Be=1;var e=s,t=Fe();function r(y,l){return y===l&&(y!==0||1/y===1/l)||y!==y&&l!==l}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,o=e.useMemo,h=e.useDebugValue;return _e.useSyncExternalStoreWithSelector=function(y,l,d,p,E){var g=a(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=o(function(){function L(m){if(!w){if(w=!0,C=m,m=p(m),E!==void 0&&b.hasValue){var T=b.value;if(E(T,m))return c=T}return c=m}if(T=c,n(C,m))return T;var I=p(m);return E!==void 0&&E(T,I)?T:(C=m,c=I)}var w=!1,C,c,f=d===void 0?null:d;return[function(){return L(l())},f===null?void 0:function(){return L(f())}]},[l,d,p,E]);var _=i(y,g[0],g[1]);return u(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},_e}var Ce={};/**
39
- * @license React
40
- * use-sync-external-store-shim/with-selector.development.js
41
- *
42
- * Copyright (c) Facebook, Inc. and its affiliates.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */var He;function Ut(){return He||(He=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=Fe();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,i=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,o=e.useMemo,h=e.useDebugValue;function y(l,d,p,E,g){var b=a(null),_;b.current===null?(_={hasValue:!1,value:null},b.current=_):_=b.current;var L=o(function(){var f=!1,m,T,I=function(V){if(!f){f=!0,m=V;var $=E(V);if(g!==void 0&&_.hasValue){var j=_.value;if(g(j,$))return T=j,j}return T=$,$}var ee=m,F=T;if(n(ee,V))return F;var O=E(V);return g!==void 0&&g(F,O)?F:(m=V,T=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=L[0],C=L[1],c=i(l,w,C);return u(function(){_.hasValue=!0,_.value=c},[c]),h(c),c}Ce.useSyncExternalStoreWithSelector=y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ce}(function(e){process.env.NODE_ENV==="production"?e.exports=Pt():e.exports=Ut()})(It);function kt(e){var t=Oe.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),i,a=[],u;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){u={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return a};function Nt(e){return e}var Vt=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Mt(e,t){var r=s.useRef();if(process.env.NODE_ENV!=="production"){var n=Ge(s.useState(e),1),i=n[0];e!==i&&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 a=Ge(kt(function(){var y=[],l=bt(Me(e.config,t||e._options)),d=l.send;return l.send=function(p){if(l.status===Y.NotStarted){y.push(p);return}d(p),r.current=l.state},[l,y]}),2),u=a[0],o=a[1];wt(function(){t&&(u._machine._options=t)});var h=$t(u);return s.useEffect(function(){return u.start(r.current),o.forEach(u.send),r.current=u.state,function(){u.stop()}},[]),h}var Rt=function(e,t){return t.changed===!1};function $t(e){var t=s.useCallback(function(){return Vt(e)},[e]),r=s.useCallback(function(i){var a=e.subscribe(i).unsubscribe;return a},[e]),n=pe.useSyncExternalStoreWithSelector(r,t,t,Nt,Rt);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 xt=e=>`
30
+ */var le=u,$t=_e;function Vt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Lt=typeof Object.is=="function"?Object.is:Vt,Mt=$t.useSyncExternalStore,Ot=le.useRef,Rt=le.useEffect,xt=le.useMemo,qt=le.useDebugValue;Re.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var s=Ot(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=xt(function(){function c(m){if(!l){if(l=!0,d=m,m=n(m),o!==void 0&&i.hasValue){var y=i.value;if(o(y,m))return g=y}return g=m}if(y=g,Lt(d,m))return y;var P=n(m);return o!==void 0&&o(y,P)?y:(d=m,g=P)}var l=!1,d,g,S=r===void 0?null:r;return[function(){return c(t())},S===null?void 0:function(){return c(S())}]},[t,r,n,o]);var a=Mt(e,s[0],s[1]);return Rt(function(){i.hasValue=!0,i.value=a},[a]),qt(a),a},function(e){e.exports=Re}(_t);function Ft(e){var t=W.useRef();return t.current||(t.current={v:e()}),t.current.v}var Bt=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,s=[],i;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)s.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 s};function jt(e){return e}var Ht=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Yt(e,t){var r=u.useRef(),n=Bt(Ft(function(){var a=[],c=St(Me(e.config,t||e._options)),l=c.send;return c.send=function(d){if(c.status===j.NotStarted){a.push(d);return}l(d),r.current=c.state},[c,a]}),2),o=n[0],s=n[1];Tt(function(){t&&(o._machine._options=t)});var i=Zt(o);return u.useEffect(function(){return o.start(r.current),s.forEach(o.send),r.current=o.state,function(){o.stop()}},[]),i}var Gt=function(e,t){return t.changed===!1};function Zt(e){var t=u.useCallback(function(){return Ht(e)},[e]),r=u.useCallback(function(o){var s=e.subscribe(o).unsubscribe;return s},[e]),n=Te.useSyncExternalStoreWithSelector(r,t,t,jt,Gt);return[n,e.send,e]}function F(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
31
  mutation CartLineAdd(
48
32
  $cartId: ID!
49
33
  $lines: [CartLineInput!]!
@@ -58,7 +42,7 @@
58
42
  }
59
43
 
60
44
  ${e}
61
- `,qt=e=>`
45
+ `,Wt=e=>`
62
46
  mutation CartCreate(
63
47
  $input: CartInput!
64
48
  $numCartLines: Int = 250
@@ -72,7 +56,7 @@
72
56
  }
73
57
 
74
58
  ${e}
75
- `,Ft=e=>`
59
+ `,zt=e=>`
76
60
  mutation CartLineRemove(
77
61
  $cartId: ID!
78
62
  $lines: [ID!]!
@@ -87,7 +71,7 @@
87
71
  }
88
72
 
89
73
  ${e}
90
- `,Bt=e=>`
74
+ `,Jt=e=>`
91
75
  mutation CartLineUpdate(
92
76
  $cartId: ID!
93
77
  $lines: [CartLineUpdateInput!]!
@@ -102,7 +86,7 @@
102
86
  }
103
87
 
104
88
  ${e}
105
- `,Ht=e=>`
89
+ `,Kt=e=>`
106
90
  mutation CartNoteUpdate(
107
91
  $cartId: ID!
108
92
  $note: String
@@ -117,7 +101,7 @@
117
101
  }
118
102
 
119
103
  ${e}
120
- `,Gt=e=>`
104
+ `,Xt=e=>`
121
105
  mutation CartBuyerIdentityUpdate(
122
106
  $cartId: ID!
123
107
  $buyerIdentity: CartBuyerIdentityInput!
@@ -132,7 +116,7 @@
132
116
  }
133
117
 
134
118
  ${e}
135
- `,jt=e=>`
119
+ `,er=e=>`
136
120
  mutation CartAttributesUpdate(
137
121
  $attributes: [AttributeInput!]!
138
122
  $cartId: ID!
@@ -147,7 +131,7 @@
147
131
  }
148
132
 
149
133
  ${e}
150
- `,Yt=e=>`
134
+ `,tr=e=>`
151
135
  mutation CartDiscountCodesUpdate(
152
136
  $cartId: ID!
153
137
  $discountCodes: [String!]
@@ -162,7 +146,7 @@
162
146
  }
163
147
 
164
148
  ${e}
165
- `,Wt=e=>`
149
+ `,rr=e=>`
166
150
  query CartQuery(
167
151
  $id: ID!
168
152
  $numCartLines: Int = 250
@@ -174,7 +158,7 @@
174
158
  }
175
159
 
176
160
  ${e}
177
- `,Zt=`
161
+ `,nr=`
178
162
  fragment CartFragment on Cart {
179
163
  id
180
164
  checkoutUrl
@@ -274,7 +258,7 @@
274
258
  width
275
259
  height
276
260
  }
277
- `,te="2023-01";function zt({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:n,contentType:i}){return n!==te&&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: "${n}"; expected version "${te}"`),{getShopifyDomain(a){return(a==null?void 0:a.storeDomain)??e},getStorefrontApiUrl(a){const u=(a==null?void 0:a.storeDomain)??e;return`${u}${u.endsWith("/")?"":"/"}api/${(a==null?void 0:a.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(a){if(!t&&!(a!=null&&a.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((a==null?void 0:a.contentType)??i)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(a==null?void 0:a.privateStorefrontToken)??t??"",...a!=null&&a.buyerIp?{"Shopify-Storefront-Buyer-IP":a.buyerIp}:{}}},getPublicTokenHeaders(a){if(!r&&!(a!=null&&a.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const u=(a==null?void 0:a.contentType)??i??"json";return je(u,n,(a==null?void 0:a.publicStorefrontToken)??r??"")}}}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:te,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!==te&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${te}, 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(i){return(i==null?void 0:i.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(i){return je(i.contentType,t.storefrontApiVersion,i.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(i){const a=n({storeDomain:(i==null?void 0:i.storeDomain)??t.storeDomain});return`${a}${a.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return s.createElement(We.Provider,{value:r},e)}function de(){const e=s.useContext(We);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Te="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,i=0,a=e.split(/;\s*/g),u,o;for(;i<a.length;i++)if(n=a[i],r=n.indexOf("="),~r){if(u=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=u.toLowerCase())?n==="expires"?t.expires=new Date(o):n==="max-age"?t.maxage=+o:t[n]=o:t[u]=o}else(u=n.trim().toLowerCase())&&(u==="httponly"||u==="secure")&&(t[u]=!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 fe(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Ze.replace(/[x]/g,i=>{const a=r[n]%16,u=i==="x"?a:a&3|8;return n++,u.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 ye(e){const t=rr(e);return{[W]:t[W]||"",[Z]:t[Z]||""}}function ar(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=de();return s.useCallback(({query:n,variables:i})=>{const a=t({contentType:"json"});e&&(a[Jt]=e);const u=ye(document.cookie);return a[Xt]=u[W],a[er]=u[Z],fetch(r(),{method:"POST",headers:a,body:JSON.stringify({query:n.toString(),variables:i})}).then(o=>o.json()).catch(o=>({data:void 0,errors:o.toString()}))},[t,e,r])}function ir({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=ar(),i=s.useCallback(E=>n({query:Wt(t),variables:{id:E,numCartLines:e,country:r}}),[n,t,e,r]),a=s.useCallback(E=>n({query:qt(t),variables:{input:E,numCartLines:e,country:r}}),[t,r,n,e]),u=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:i,cartCreate:a,cartLineAdd:u,cartLineUpdate:o,cartLineRemove:h,noteUpdate:y,buyerIdentityUpdate:l,cartAttributesUpdate:d,discountCodesUpdate:p,cartFragment:t}),[i,a,u,o,h,y,l,d,p,t])}function x(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],Q({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[Q({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.cart},rawCartResult:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[Q({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:Q({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const re={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[Q({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>Ae(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 Me({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&Ae(e)},states:{uninitialized:{on:re},cartCompleted:{on:re},initializationError:{on:re},idle:{on:{...re,...ze}},error:{on:{...re,...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:i,cartFragment:a,countryCode:u}){const{cartFetch:o,cartCreate:h,cartLineAdd:y,cartLineUpdate:l,cartLineRemove:d,noteUpdate:p,buyerIdentityUpdate:E,cartAttributesUpdate:g,discountCodesUpdate:b}=ir({numCartLines:e,cartFragment:a,countryCode:u}),_=s.useMemo(()=>ur(i),[i]),[L,w,C]=Mt(_,{actions:{cartFetchAction:async(c,f)=>{var S;if(f.type!=="CART_FETCH")return;const{data:m,errors:T}=await o((S=f==null?void 0:f.payload)==null?void 0:S.cartId),I=q(f,m==null?void 0:m.cart,T);w(I)},cartCreateAction:async(c,f)=>{var S;if(f.type!=="CART_CREATE")return;const{data:m,errors:T}=await h(f==null?void 0:f.payload),I=q(f,(S=m==null?void 0:m.cartCreate)==null?void 0:S.cart,T);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:T}=await y(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesAdd)==null?void 0:D.cart,T);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:T}=await l(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesUpdate)==null?void 0:D.cart,T);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:T}=await d(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesRemove)==null?void 0:D.cart,T);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:T}=await p(c.cart.id,f.payload.note),I=q(f,(D=m==null?void 0:m.cartNoteUpdate)==null?void 0:D.cart,T);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:T}=await E(c.cart.id,f.payload.buyerIdentity),I=q(f,(D=m==null?void 0:m.cartBuyerIdentityUpdate)==null?void 0:D.cart,T);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:T}=await g(c.cart.id,f.payload.attributes),I=q(f,(D=m==null?void 0:m.cartAttributesUpdate)==null?void 0:D.cart,T);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:T}=await b(c.cart.id,f.payload.discountCodes),I=q(f,(D=m==null?void 0:m.cartDiscountCodesUpdate)==null?void 0:D.cart,T);w(I)},...t&&{onCartActionEntry:(c,f)=>{cr(f)&&t(c,f)}},...r&&{onCartActionOptimisticUI:Q((c,f)=>r(c,f))},...n&&{onCartActionComplete:(c,f)=>{lr(f)&&n(c,f)}}}});return s.useMemo(()=>[L,w,C],[L,w,C])}function Ae(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:Ae(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 ne(){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:i,onLineUpdate:a,onNoteUpdate:u,onBuyerIdentityUpdate:o,onAttributesUpdate:h,onDiscountCodesUpdate:y,onCreateComplete:l,onLineAddComplete:d,onLineRemoveComplete:p,onLineUpdateComplete:E,onNoteUpdateComplete:g,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:_,onDiscountCodesUpdateComplete:L,data:w,cartFragment:C=Zt,customerAccessToken:c,countryCode:f="US"}){var Et,pt,_t,St,vt,Ct,Tt;f&&(f=f.toUpperCase());const[m,T]=s.useState(f),[I,S]=s.useState(c),D=s.useRef(!1);(m!==f||I!==c)&&(T(f),S(c),D.current=!1);const[U,V]=sr({numCartLines:t,data:w,cartFragment:C,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 i==null?void 0:i();case"CARTLINE_UPDATE":return a==null?void 0:a();case"NOTE_UPDATE":return u==null?void 0:u();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(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(v,k){var M,B,N,se;if(!v.cart)return{...v};switch(k.type){case"CARTLINE_REMOVE":return{...v,cart:{...v.cart,lines:(B=(M=v==null?void 0:v.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{...v,cart:{...v.cart,lines:(se=(N=v==null?void 0:v.cart)==null?void 0:N.lines)==null?void 0:se.map(R=>{const De=k.payload.lines.find(({id:ln})=>ln===(R==null?void 0:R.id));return De&&De.quantity?{...R,quantity:De.quantity}:R})}}}return{...v}},onCartActionComplete(v,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 hr(v,M)&&(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"),ee=(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&&be("localStorage")){F.current=!0;try{const v=window.localStorage.getItem(Te);v&&V({type:"CART_FETCH",payload:{cartId:v}})}catch(v){console.warn("error fetching cartId"),console.warn(v)}}$.current=!0}},[w,$,V]),s.useEffect(()=>{!ee||D.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:c}}})},[f,c,ee,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,M;if((k=(v=U==null?void 0:U.context)==null?void 0:v.cart)!=null&&k.id&&be("localStorage"))try{window.localStorage.setItem(Te,(M=U.context.cart)==null?void 0:M.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&&be("localStorage"))try{window.localStorage.removeItem(Te)}catch(v){console.warn("Failed to delete cartId from localStorage",v)}},[j]);const K=s.useCallback(v=>{var k,M;f&&!((k=v.buyerIdentity)!=null&&k.countryCode)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.countryCode=f),c&&!((M=v.buyerIdentity)!=null&&M.customerAccessToken)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.customerAccessToken=c),O({type:"CART_CREATE",payload:v})},[f,c,O]),P=yr(U),me=s.useMemo(()=>{var v,k,M,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=(M=P==null?void 0:P.context)==null?void 0:M.cart)==null?void 0:B.totalQuantity)??0,cartCreate:K,linesAdd(N){var se,R;(R=(se=P==null?void 0:P.context)==null?void 0:se.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:C}},[K,(Ct=P==null?void 0:P.context)==null?void 0:Ct.cart,(Tt=P==null?void 0:P.context)==null?void 0:Tt.errors,P.value,C,O]);return s.createElement(Ke.Provider,{value:me},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,i]=s.useState(e),a=s.useRef(!1);t&&(a.current=!0);const u=s.useRef(!1);return!t&&a.current&&(u.current=!0),s.useEffect(()=>{r(()=>{u.current||i(e)})},[e]),u.current?e:n}function be(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 i=s.useMemo(()=>mr(n),[n]),[a,u]=s.useState(()=>et(r,n)),[o,h]=s.useState(()=>tt(a));s.useEffect(()=>{const _=et(r,n);u(_),h(tt(_))},[r,n]);const y=s.useCallback((_,L)=>{h(w=>{const C={...w,[_]:L};return u(Xe(n,C)),C})},[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(!(!a||!p)){if(!((_=a.sellingPlanAllocations)!=null&&_.nodes)&&!((L=a.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(a.sellingPlanAllocations).find(w=>{var C;return((C=w==null?void 0:w.sellingPlan)==null?void 0:C.id)===p.id})}},[a,p]),b=s.useMemo(()=>({variants:n,variantsConnection:t.variants,options:i,selectedVariant:a,setSelectedVariant:u,selectedOptions:o,setSelectedOption:y,setSelectedOptions:h,isOptionInStock:l,selectedSellingPlan:p,setSelectedSellingPlan:E,selectedSellingPlanAllocation:g,sellingPlanGroups:d,sellingPlanGroupsConnection:t.sellingPlanGroups}),[l,i,t.sellingPlanGroups,t.variants,o,p,g,a,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(i=>Object.entries(t).every(([a,u])=>{var o;return(o=i==null?void 0:i.selectedOptions)==null?void 0:o.some(h=>(h==null?void 0:h.name)===a&&(h==null?void 0:h.value)===u)}))}function mr(e){const t=e.reduce((r,n)=>{var i;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(i=n==null?void 0:n.selectedOptions)==null||i.forEach(a=>{r[(a==null?void 0:a.name)??""]=r[(a==null?void 0:a.name)??""]||new Set,r[(a==null?void 0:a.name)??""].add((a==null?void 0:a.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 we(e){const{as:t,onClick:r,defaultOnClick:n,children:i,buttonRef:a,...u}=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:a,onClick:o,...u},i)}function pr(e){const[t,r]=s.useState(!1),{variantId:n,quantity:i=1,attributes:a,sellingPlanId:u,onClick:o,children:h,accessibleAddingToCartLabel:y,...l}=e,{status:d,linesAdd:p}=ne(),{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:i,merchandiseId:g||"",attributes:a,sellingPlanId:u}])},[p,i,g,a,u]);return s.createElement(s.Fragment,null,s.createElement(we,{...l,disabled:b,onClick:o,defaultOnClick:_},h),y?s.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 Ie={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},he={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 J(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,i=r[1]??null;return{id:n,resource:i}}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 Cr(e){const t=e,{id:r,resource:n}=G(t.resourceId),i=n?n.toLowerCase():void 0;return[J(Sr,z({pageType:t.pageType,customerId:t.customerId,resourceType:i,resourceId:parseInt(r)},Tr(t)))]}function Tr(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:fe(),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 oe="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,i=[];switch(i.push(J(oe,z({event_name:br,...r},ae(t)))),n){case he.collection:i.push(J(oe,z({event_name:wr,...r,collection_name:t.collectionHandle},ae(t))));break;case he.product:i.push(J(oe,z({event_name:Ir,...r,products:ot(t.products),total_value:t.totalValue},ae(t))));break;case he.search:i.push(J(oe,z({event_name:Or,...r,search_string:t.searchString},ae(t))));break}return i}function Pr(e){const t=e,r=G(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[J(oe,z({event_name:Dr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:ot(t.products)},ae(t)))]}function ae(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:fe(),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 i=[];if(r===Ie.PAGE_VIEW){const a=n;i=i.concat(Cr(a),Lr(a))}else r===Ie.ADD_TO_CART&&(i=i.concat(Pr(n)));return i.length?kr(i,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(a=>{a.status!==200&&console.error(at,`
261
+ `,te="2023-01";function or(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o,contentType:s}=e;return o!==te&&ar(`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 "${te}"`),{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)??s)==="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)??s??"json";return qe(a,o,(i==null?void 0:i.publicStorefrontToken)??n??"")}}}function qe(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 Fe=new Set,ar=e=>{Fe.has(e)||(console.warn(e),Fe.add(e))},Be=u.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:te,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function ir({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!==te&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${te}, 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=u.useMemo(()=>{function n(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return qe(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const s=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${s}${s.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return u.createElement(Be.Provider,{value:r},e)}function de(){const e=u.useContext(Be);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const ve="shopifyCartId",sr="Shopify-Storefront-Id",ur="Shopify-Storefront-Y",cr="Shopify-Storefront-S",H="_shopify_y",Y="_shopify_s";var lr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function dr(e){let t={},r,n,o=0,s=e.split(/;\s*/g),i,a;for(;o<s.length;o++)if(n=s[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{}lr.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 fr(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 je="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function fe(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=je.replace(/[x]/g,o=>{const s=r[n]%16,i=o==="x"?s:s&3|8;return n++,i.toString(16)}).toUpperCase()}catch{e=je.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${yr()}-${e}`}function yr(){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 ye(e){const t=dr(e);return{[H]:t[H]||"",[Y]:t[Y]||""}}function hr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=de();return u.useCallback(({query:n,variables:o})=>{const s=t({contentType:"json"});e&&(s[sr]=e);const i=ye(document.cookie);return s[ur]=i[H],s[cr]=i[Y],fetch(r(),{method:"POST",headers:s,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 gr({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=hr(),o=u.useCallback(m=>n({query:rr(t),variables:{id:m,numCartLines:e,country:r}}),[n,t,e,r]),s=u.useCallback(m=>n({query:Wt(t),variables:{input:m,numCartLines:e,country:r}}),[t,r,n,e]),i=u.useCallback((m,y)=>n({query:Qt(t),variables:{cartId:m,lines:y,numCartLines:e,country:r}}),[t,r,n,e]),a=u.useCallback((m,y)=>n({query:Jt(t),variables:{cartId:m,lines:y,numCartLines:e,country:r}}),[t,r,n,e]),c=u.useCallback((m,y)=>n({query:zt(t),variables:{cartId:m,lines:y,numCartLines:e,country:r}}),[t,r,n,e]),l=u.useCallback((m,y)=>n({query:Kt(t),variables:{cartId:m,note:y,numCartLines:e,country:r}}),[n,t,e,r]),d=u.useCallback((m,y)=>n({query:Xt(t),variables:{cartId:m,buyerIdentity:y,numCartLines:e,country:r}}),[t,r,n,e]),g=u.useCallback((m,y)=>n({query:er(t),variables:{cartId:m,attributes:y,numCartLines:e,country:r}}),[t,r,n,e]),S=u.useCallback((m,y)=>n({query:tr(t),variables:{cartId:m,discountCodes:y,numCartLines:e,country:r}}),[t,r,n,e]);return u.useMemo(()=>({cartFetch:o,cartCreate:s,cartLineAdd:i,cartLineUpdate:a,cartLineRemove:c,noteUpdate:l,buyerIdentityUpdate:d,cartAttributesUpdate:g,discountCodesUpdate:S,cartFragment:t}),[o,s,i,a,c,l,d,g,S,t])}function R(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],z({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[z({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:[z({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:z({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const re={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[z({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>be(t.payload.cart)})]}},He={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 mr(e){return Me({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&be(e)},states:{uninitialized:{on:re},cartCompleted:{on:re},initializationError:{on:re},idle:{on:{...re,...He}},error:{on:{...re,...He}},cartFetching:R("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:R("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:R("cartLineRemoveAction"),cartLineUpdating:R("cartLineUpdateAction"),cartLineAdding:R("cartLineAddAction"),noteUpdating:R("noteUpdateAction"),buyerIdentityUpdating:R("buyerIdentityUpdateAction"),cartAttributesUpdating:R("cartAttributesUpdateAction"),discountCodesUpdating:R("discountCodesUpdateAction")}})}function Er({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:s,countryCode:i}){const{cartFetch:a,cartCreate:c,cartLineAdd:l,cartLineUpdate:d,cartLineRemove:g,noteUpdate:S,buyerIdentityUpdate:m,cartAttributesUpdate:y,discountCodesUpdate:P}=gr({numCartLines:e,cartFragment:s,countryCode:i}),T=u.useMemo(()=>mr(o),[o]),[k,_,V]=Yt(T,{actions:{cartFetchAction:async(h,f)=>{var A;if(f.type!=="CART_FETCH")return;const{data:C,errors:I}=await a((A=f==null?void 0:f.payload)==null?void 0:A.cartId),D=x(f,C==null?void 0:C.cart,I);_(D)},cartCreateAction:async(h,f)=>{var A;if(f.type!=="CART_CREATE")return;const{data:C,errors:I}=await c(f==null?void 0:f.payload),D=x(f,(A=C==null?void 0:C.cartCreate)==null?void 0:A.cart,I);_(D)},cartLineAddAction:async(h,f)=>{var A,v;if(f.type!=="CARTLINE_ADD"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await l(h.cart.id,f.payload.lines),D=x(f,(v=C==null?void 0:C.cartLinesAdd)==null?void 0:v.cart,I);_(D)},cartLineUpdateAction:async(h,f)=>{var A,v;if(f.type!=="CARTLINE_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await d(h.cart.id,f.payload.lines),D=x(f,(v=C==null?void 0:C.cartLinesUpdate)==null?void 0:v.cart,I);_(D)},cartLineRemoveAction:async(h,f)=>{var A,v;if(f.type!=="CARTLINE_REMOVE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await g(h.cart.id,f.payload.lines),D=x(f,(v=C==null?void 0:C.cartLinesRemove)==null?void 0:v.cart,I);_(D)},noteUpdateAction:async(h,f)=>{var A,v;if(f.type!=="NOTE_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await S(h.cart.id,f.payload.note),D=x(f,(v=C==null?void 0:C.cartNoteUpdate)==null?void 0:v.cart,I);_(D)},buyerIdentityUpdateAction:async(h,f)=>{var A,v;if(f.type!=="BUYER_IDENTITY_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await m(h.cart.id,f.payload.buyerIdentity),D=x(f,(v=C==null?void 0:C.cartBuyerIdentityUpdate)==null?void 0:v.cart,I);_(D)},cartAttributesUpdateAction:async(h,f)=>{var A,v;if(f.type!=="CART_ATTRIBUTES_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await y(h.cart.id,f.payload.attributes),D=x(f,(v=C==null?void 0:C.cartAttributesUpdate)==null?void 0:v.cart,I);_(D)},discountCodesUpdateAction:async(h,f)=>{var A,v;if(f.type!=="DISCOUNT_CODES_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await P(h.cart.id,f.payload.discountCodes),D=x(f,(v=C==null?void 0:C.cartDiscountCodesUpdate)==null?void 0:v.cart,I);_(D)},...t&&{onCartActionEntry:(h,f)=>{pr(f)&&t(h,f)}},...r&&{onCartActionOptimisticUI:z((h,f)=>r(h,f))},...n&&{onCartActionComplete:(h,f)=>{Cr(f)&&n(h,f)}}}});return u.useMemo(()=>[k,_,V],[k,_,V])}function be(e){return{...e,lines:F(e==null?void 0:e.lines),note:e.note??void 0}}function x(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 pr(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 Cr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Ye=u.createContext(null);function K(){const e=u.useContext(Ye);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Sr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:s,onNoteUpdate:i,onBuyerIdentityUpdate:a,onAttributesUpdate:c,onDiscountCodesUpdate:l,onCreateComplete:d,onLineAddComplete:g,onLineRemoveComplete:S,onLineUpdateComplete:m,onNoteUpdateComplete:y,onBuyerIdentityUpdateComplete:P,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:k,data:_,cartFragment:V=nr,customerAccessToken:h,countryCode:f="US"}){var ft,yt,ht,gt,mt,Et,pt;f&&(f=f.toUpperCase());const[C,I]=u.useState(f),[D,A]=u.useState(h),v=u.useRef(!1);(C!==f||D!==h)&&(I(f),A(h),v.current=!1);const[U,O]=Er({numCartLines:t,data:_,cartFragment:V,countryCode:f,onCartActionEntry(p,N){try{switch(N.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 s==null?void 0:s();case"NOTE_UPDATE":return i==null?void 0:i();case"BUYER_IDENTITY_UPDATE":return a==null?void 0:a();case"CART_ATTRIBUTES_UPDATE":return c==null?void 0:c();case"DISCOUNT_CODES_UPDATE":return l==null?void 0:l()}}catch(L){console.error("Cart entry action failed",L)}},onCartActionOptimisticUI(p,N){var L,q,$,ue;if(!p.cart)return{...p};switch(N.type){case"CARTLINE_REMOVE":return{...p,cart:{...p.cart,lines:(q=(L=p==null?void 0:p.cart)==null?void 0:L.lines)==null?void 0:q.filter(M=>(M==null?void 0:M.id)&&!N.payload.lines.includes(M==null?void 0:M.id))}};case"CARTLINE_UPDATE":return{...p,cart:{...p.cart,lines:(ue=($=p==null?void 0:p.cart)==null?void 0:$.lines)==null?void 0:ue.map(M=>{const Pe=N.payload.lines.find(({id:Sn})=>Sn===(M==null?void 0:M.id));return Pe&&Pe.quantity?{...M,quantity:Pe.quantity}:M})}}}return{...p}},onCartActionComplete(p,N){const L=N.payload.cartActionEvent;try{switch(N.type){case"RESOLVE":switch(L.type){case"CART_CREATE":return d==null?void 0:d();case"CARTLINE_ADD":return g==null?void 0:g();case"CARTLINE_REMOVE":return S==null?void 0:S();case"CARTLINE_UPDATE":return m==null?void 0:m();case"NOTE_UPDATE":return y==null?void 0:y();case"BUYER_IDENTITY_UPDATE":return Ar(p,L)&&(v.current=!0),P==null?void 0:P();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return k==null?void 0:k()}}}catch(q){console.error("onCartActionComplete failed",q)}}}),Z=u.useRef(!1),Ee=U.matches("cartCompleted"),pe=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&f!==((ht=(yt=(ft=U==null?void 0:U.context)==null?void 0:ft.cart)==null?void 0:yt.buyerIdentity)==null?void 0:ht.countryCode)&&!U.context.errors,se=u.useRef(!1);u.useEffect(()=>{if(!Z.current&&!se.current){if(!_&&we("localStorage")){se.current=!0;try{const p=window.localStorage.getItem(ve);p&&O({type:"CART_FETCH",payload:{cartId:p}})}catch(p){console.warn("error fetching cartId"),console.warn(p)}}Z.current=!0}},[_,Z,O]),u.useEffect(()=>{!pe||v.current||O({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:h}}})},[f,h,pe,v,O]);const b=u.useCallback(p=>{if(!Z.current)return console.warn("Cart isn't ready yet");O(p)},[O]);u.useEffect(()=>{var p,N,L;if((N=(p=U==null?void 0:U.context)==null?void 0:p.cart)!=null&&N.id&&we("localStorage"))try{window.localStorage.setItem(ve,(L=U.context.cart)==null?void 0:L.id)}catch(q){console.warn("Failed to save cartId to localStorage",q)}},[(mt=(gt=U==null?void 0:U.context)==null?void 0:gt.cart)==null?void 0:mt.id]),u.useEffect(()=>{if(Ee&&we("localStorage"))try{window.localStorage.removeItem(ve)}catch(p){console.warn("Failed to delete cartId from localStorage",p)}},[Ee]);const Q=u.useCallback(p=>{var N,L;f&&!((N=p.buyerIdentity)!=null&&N.countryCode)&&(p.buyerIdentity==null&&(p.buyerIdentity={}),p.buyerIdentity.countryCode=f),h&&!((L=p.buyerIdentity)!=null&&L.customerAccessToken)&&(p.buyerIdentity==null&&(p.buyerIdentity={}),p.buyerIdentity.customerAccessToken=h),b({type:"CART_CREATE",payload:p})},[f,h,b]),w=_r(U),Ce=u.useMemo(()=>{var p,N,L,q;return{...((p=w==null?void 0:w.context)==null?void 0:p.cart)??{lines:[],attributes:[]},status:Tr(w.value),error:(N=w==null?void 0:w.context)==null?void 0:N.errors,totalQuantity:((q=(L=w==null?void 0:w.context)==null?void 0:L.cart)==null?void 0:q.totalQuantity)??0,cartCreate:Q,linesAdd($){var ue,M;(M=(ue=w==null?void 0:w.context)==null?void 0:ue.cart)!=null&&M.id?b({type:"CARTLINE_ADD",payload:{lines:$}}):Q({lines:$})},linesRemove($){b({type:"CARTLINE_REMOVE",payload:{lines:$}})},linesUpdate($){b({type:"CARTLINE_UPDATE",payload:{lines:$}})},noteUpdate($){b({type:"NOTE_UPDATE",payload:{note:$}})},buyerIdentityUpdate($){b({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:$}})},cartAttributesUpdate($){b({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:$}})},discountCodesUpdate($){b({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:$}})},cartFragment:V}},[Q,(Et=w==null?void 0:w.context)==null?void 0:Et.cart,(pt=w==null?void 0:w.context)==null?void 0:pt.errors,w.value,V,b]);return u.createElement(Ye.Provider,{value:Ce},e)}function Tr(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 _r(e){const[t,r]=u.useTransition(),[n,o]=u.useState(e),s=u.useRef(!1);t&&(s.current=!0);const i=u.useRef(!1);return!t&&s.current&&(i.current=!0),u.useEffect(()=>{r(()=>{i.current||o(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 Ar(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 Ge=u.createContext(null);function vr({children:e,data:t,initialVariantId:r}){const n=u.useMemo(()=>F(t.variants??{}),[t.variants]);if(!wr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=u.useMemo(()=>br(n),[n]),[s,i]=u.useState(()=>We(r,n)),[a,c]=u.useState(()=>ze(s));u.useEffect(()=>{const T=We(r,n);i(T),c(ze(T))},[r,n]);const l=u.useCallback((T,k)=>{c(_=>{const V={..._,[T]:k};return i(Qe(n,V)),V})},[c,n]),d=u.useCallback((T,k)=>{const _=Qe(n,{...a,[T]:k});return(_==null?void 0:_.availableForSale)??!0},[a,n]),g=u.useMemo(()=>F(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:F((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[S,m]=u.useState(void 0),y=u.useMemo(()=>{var T,k;if(!(!s||!S)){if(!((T=s.sellingPlanAllocations)!=null&&T.nodes)&&!((k=s.sellingPlanAllocations)!=null&&k.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return F(s.sellingPlanAllocations).find(_=>{var V;return((V=_==null?void 0:_.sellingPlan)==null?void 0:V.id)===S.id})}},[s,S]),P=u.useMemo(()=>({variants:n,variantsConnection:t.variants,options:o,selectedVariant:s,setSelectedVariant:i,selectedOptions:a,setSelectedOption:l,setSelectedOptions:c,isOptionInStock:d,selectedSellingPlan:S,setSelectedSellingPlan:m,selectedSellingPlanAllocation:y,sellingPlanGroups:g,sellingPlanGroupsConnection:t.sellingPlanGroups}),[d,o,t.sellingPlanGroups,t.variants,a,S,y,s,g,l,n]);return u.createElement(Ge.Provider,{value:P},e)}function Ze(){const e=u.useContext(Ge);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Qe(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(([s,i])=>{var a;return(a=o==null?void 0:o.selectedOptions)==null?void 0:a.some(c=>(c==null?void 0:c.name)===s&&(c==null?void 0:c.value)===i)}))}function br(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(s=>{r[(s==null?void 0:s.name)??""]=r[(s==null?void 0:s.name)??""]||new Set,r[(s==null?void 0:s.name)??""].add((s==null?void 0:s.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function We(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 ze(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 wr(e){return!(!e||!Array.isArray(e))}function he(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:s,...i}=e,a=u.useCallback(l=>{if(r){const d=r(l);if(typeof d=="boolean"&&d===!1||l!=null&&l.defaultPrevented)return}n==null||n(l)},[n,r]),c=t||"button";return u.createElement(c,{ref:s,onClick:a,...i},o)}function Ir(e){const[t,r]=u.useState(!1),{variantId:n,quantity:o=1,attributes:s,sellingPlanId:i,onClick:a,children:c,accessibleAddingToCartLabel:l,...d}=e,{status:g,linesAdd:S}=K(),{selectedVariant:m}=Ze(),y=n??(m==null?void 0:m.id)??"",P=n===null||y===""||m===null||t||d.disabled;u.useEffect(()=>{t&&g==="idle"&&r(!1)},[g,t]);const T=u.useCallback(()=>{r(!0),S([{quantity:o,merchandiseId:y||"",attributes:s,sellingPlanId:i}])},[S,o,y,s,i]);return W.createElement(W.Fragment,null,W.createElement(he,{...d,disabled:P,onClick:a,defaultOnClick:T},c),l?W.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?l:null):null)}const Ie={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"},Je={hydrogen:"hydrogen",headless:"headless"},Ke={hydrogen:"6167201",headless:"12875497473"};function X(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function B(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 G(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Dr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Pr="trekkie_storefront_page_view/1.4",kr="myshopify.dev";function Ur(e){const t=e,{id:r,resource:n}=B(t.resourceId),o=n?n.toLowerCase():void 0;return[X(Pr,G({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},Nr(t)))]}function Nr(e){return{appClientId:e.shopifySalesChannel?Ke[e.shopifySalesChannel]:Ke.headless,isMerchantRequest:$r(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:fe(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(B(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function $r(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(kr)!==-1||t==="localhost"}const ne="custom_storefront_customer_tracking/1.0",Vr="page_rendered",Lr="collection_page_rendered",Mr="product_page_rendered",Or="product_added_to_cart",Rr="search_submitted";function xr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(X(ne,G({event_name:Vr,...r},oe(t)))),n){case ge.collection:o.push(X(ne,G({event_name:Lr,...r,collection_name:t.collectionHandle},oe(t))));break;case ge.product:o.push(X(ne,G({event_name:Mr,...r,products:Xe(t.products),total_value:t.totalValue},oe(t))));break;case ge.search:o.push(X(ne,G({event_name:Rr,...r,search_string:t.searchString},oe(t))));break}return o}function qr(e){const t=e,r=B(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[X(ne,G({event_name:Or,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:Xe(t.products)},oe(t)))]}function oe(e){return{source:e.shopifySalesChannel||Je.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:fe(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(B(e.shopId).id),currency:e.currency}}function Xe(e){return e?e.map(t=>{const r=G({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(B(t.productGid).id),variant_id:parseInt(B(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 Fr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===Ie.PAGE_VIEW){const s=n;o=o.concat(Ur(s),xr(s))}else r===Ie.ADD_TO_CART&&(o=o.concat(qr(n)));return o.length?Br(o,t):Promise.resolve()}const et="sendShopifyAnalytics request is unsuccessful";function Br(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(s=>{s.status!==200&&console.error(et,`
278
262
 
279
- `,a.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]=Rr(),r=ye(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 Mr(){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 Rr(){try{let e="PerformanceNavigationTiming",t=Vr();return t||(t=Mr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function $r(e){const{cartCreate:t,checkoutUrl:r}=ne(),[n,i]=s.useState(!1),{quantity:a,variantId:u,onClick:o,attributes:h,children:y,...l}=e;s.useEffect(()=>{r&&(window.location.href=r)},[r]);const d=s.useCallback(()=>{i(!0),t({lines:[{quantity:a??1,merchandiseId:u,attributes:h}]})},[t,a,u,h]);return s.createElement(we,{disabled:n??l.disabled,...l,onClick:o,defaultOnClick:d},y)}function xr(e){const[t,r]=s.useState(!1),{status:n,checkoutUrl:i}=ne(),{children:a,...u}=e;return s.useEffect(()=>{t&&i&&n==="idle"&&(window.location.href=i)},[t,n,i]),s.createElement(we,{...u,disabled:t||u.disabled,onClick:()=>r(!0)},a)}function it(e){const{countryIsoCode:t,languageIsoCode:r}=de(),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 i=parseFloat(e.amount),a=s.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),u=X(n,a),o=X(n,{...a,currencyDisplay:"name"}),h=X(n,{...a,currencyDisplay:"narrowSymbol"}),y=X(n,{...a,minimumFractionDigits:0,maximumFractionDigits:0}),l=X(n),d=X(n,{minimumFractionDigits:0,maximumFractionDigits:0}),p=g=>g.type==="currency",E=s.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>u().format(i),parts:()=>u().formatToParts(i),withoutTrailingZeros:()=>i%1===0?y().format(i):u().format(i),withoutTrailingZerosAndCurrency:()=>i%1===0?d().format(i):l().format(i),currencyName:()=>{var g;return((g=o().formatToParts(i).find(p))==null?void 0:g.value)??e.currencyCode},currencySymbol:()=>{var g;return((g=u().formatToParts(i).find(p))==null?void 0:g.value)??e.currencyCode},currencyNarrowSymbol:()=>{var g;return((g=h().formatToParts(i).find(p))==null?void 0:g.value)??""},amount:()=>u().formatToParts(i).filter(g=>["decimal","fraction","group","integer","literal"].includes(g.type)).map(g=>g.value).join("")}),[e,i,o,u,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 X(e,t){return s.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ie({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:i,measurementSeparator:a="/",...u}){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,{...u},y,i&&i.referenceUnit&&s.createElement(s.Fragment,null,a,i.referenceUnit))}function qr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Fr(e){const{cost:t}=ne(),{amountType:r="total",children:n,...i}=e;let a;return r=="total"?a=t==null?void 0:t.totalAmount:r=="subtotal"?a=t==null?void 0:t.subtotalAmount:r=="tax"?a=t==null?void 0:t.totalTaxAmount:r=="duty"&&(a=t==null?void 0:t.totalDutyAmount),a==null?null:s.createElement(ie,{...i,data:a},n)}function Br(e){var a,u;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const i=r==="regular"?(a=t.cost)==null?void 0:a.totalAmount:(u=t.cost)==null?void 0:u.compareAtAmountPerQuantity;return i==null?null:s.createElement(ie,{...n,data:i})}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:i="0",allow:a="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:u=!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:i,allow:a,allowFullScreen:u,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],ue=[352,832,1200,1920,2560];function ct({src:e,width:t,height:r,crop:n,scale:i}){const a=new URL(e),u=i??1;if(t){let o;typeof t=="string"?o=(ue[0]*u).toString():o=(Number(t)*u).toString(),a.searchParams.append("width",o)}return r&&typeof r=="number"&&a.searchParams.append("height",(r*u).toString()),n&&a.searchParams.append("crop",n),a.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:i=lt,loaderOptions:a,widths:u,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:a,elementProps:{width:t,height:r}});let d=e.url;if(i&&(d=i({...a,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({...a,widths:u,src:e.url,width:p,height:l,loader:i});return Oe.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:i,loader:a,height:u}){const o=i&&Array.isArray(i);if(o&&i.some(d=>isNaN(d)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let h=1;t&&u&&(h=Number(u)/Number(t));let y=o?i:ue;!o&&t&&t<ue[ue.length-1]&&(y=ue.filter(d=>d<=t));const l=a||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:i=!0,controls:a=!0,sourceProps:u={},...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:i,controls:a,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",{...u,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((i,a)=>{const u=document.createElement("script");t!=null&&t.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{i(!0)},u.onerror=()=>{a(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(u):document.body.appendChild(u)});return yt[e]=n,n}function ht(e,t){const[r,n]=s.useState("loading"),i=JSON.stringify(t);return s.useEffect(()=>{async function a(){try{n("loading"),await Qr(e,t),n("done")}catch{n("error")}}a()},[e,i,t]),r}function gt(e){var y,l,d;const[t,r]=s.useState(void 0),n=s.useCallback(p=>{r(p)},[]),{data:i,children:a,className:u,...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=i.sources)==null?void 0:y[0])!=null&&l.url?s.createElement("model-viewer",{ref:n,...o,className:u,id:o.id??i.id,src:i.sources[0].url,alt:i.alt??null,"camera-controls":o.cameraControls??!0,poster:(o.poster||((d=i.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},a):(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:i,...a}=e;if(i==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let u,o;const h=r?H((i==null?void 0:i.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;u=h.compareAtPriceV2}else n==="max"?u=(d=i==null?void 0:i.compareAtPriceRange)==null?void 0:d.maxVariantPrice:u=(p=i==null?void 0:i.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&h?(u=h.priceV2,n==="unit"&&(u=h.unitPrice,o=h.unitPriceMeasurement)):n==="max"?u=(E=i.priceRange)==null?void 0:E.maxVariantPrice:u=(g=i.priceRange)==null?void 0:g.minVariantPrice;return u?o?s.createElement(ie,{...a,data:u,measurement:o}):s.createElement(ie,{...a,data:u}):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:i}=de(),a=ht(tn);let u=[];if(e&&r)throw new Error(an);if(e)u=e.reduce((h,y)=>{const l=G(y).id;return l&&h.push(l),h},[]);else if(r)u=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(u.length===0)throw new Error(nn);const o=n?{"--shop-pay-button-width":n}:void 0;return s.createElement("div",{className:t,style:o},a==="done"&&s.createElement("shop-pay-button",{"store-url":i,variants:u.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=ye(document.cookie);t?(ge(W,n[W]||fe(),un,r),ge(Z,n[Z]||fe(),sn,r)):(ge(W,"",0,r),ge(Z,"",0,r))})}function ge(e,t,r,n){document.cookie=nr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}A.AddToCartButton=pr,A.AnalyticsEventName=Ie,A.AnalyticsPageType=he,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=ie,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=ye,A.parseMetafield=Xr,A.sendShopifyAnalytics=Ur,A.storefrontApiCustomScalars=jr,A.useCart=ne,A.useCartLine=Hr,A.useMoney=it,A.useProduct=Je,A.useShop=de,A.useShopifyCookies=cn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
263
+ `,s.message)})}).catch(n=>{console.error(et,n)})}catch{return Promise.resolve()}}function jr(){if(Dr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=Gr(),r=ye(document.cookie);return{uniqueToken:r[H],visitToken:r[Y],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Hr(){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 Yr(){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 Gr(){try{let e="PerformanceNavigationTiming",t=Hr();return t||(t=Yr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function Zr(e){const{cartCreate:t,checkoutUrl:r}=K(),[n,o]=u.useState(!1),{quantity:s,variantId:i,onClick:a,attributes:c,children:l,...d}=e;u.useEffect(()=>{r&&(window.location.href=r)},[r]);const g=u.useCallback(()=>{o(!0),t({lines:[{quantity:s??1,merchandiseId:i,attributes:c}]})},[t,s,i,c]);return u.createElement(he,{disabled:n??d.disabled,...d,onClick:a,defaultOnClick:g},l)}function Qr(e){const[t,r]=u.useState(!1),{status:n,checkoutUrl:o}=K(),{children:s,...i}=e;return u.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),u.createElement(he,{...i,disabled:t||i.disabled,onClick:()=>r(!0)},s)}function tt(e){const{countryIsoCode:t,languageIsoCode:r}=de(),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),s=u.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),i=ee(n,s),a=ee(n,{...s,currencyDisplay:"name"}),c=ee(n,{...s,currencyDisplay:"narrowSymbol"}),l=ee(n,{...s,minimumFractionDigits:0,maximumFractionDigits:0}),d=ee(n),g=ee(n,{minimumFractionDigits:0,maximumFractionDigits:0}),S=y=>y.type==="currency",m=u.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(o),parts:()=>i().formatToParts(o),withoutTrailingZeros:()=>o%1===0?l().format(o):i().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?g().format(o):d().format(o),currencyName:()=>{var y;return((y=a().formatToParts(o).find(S))==null?void 0:y.value)??e.currencyCode},currencySymbol:()=>{var y;return((y=i().formatToParts(o).find(S))==null?void 0:y.value)??e.currencyCode},currencyNarrowSymbol:()=>{var y;return((y=c().formatToParts(o).find(S))==null?void 0:y.value)??""},amount:()=>i().formatToParts(o).filter(y=>["decimal","fraction","group","integer","literal"].includes(y.type)).map(y=>y.value).join("")}),[e,o,a,i,c,d,l,g]);return u.useMemo(()=>new Proxy(m,{get:(y,P)=>{var T;return(T=Reflect.get(y,P))==null?void 0:T.call(null)}}),[m])}function ee(e,t){return u.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ae({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:s="/",...i}){if(!Wr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const a=tt(e),c=t??"div";let l=a.localizedString;return(r||n)&&(r&&!n?l=a.amount:!r&&n?l=a.withoutTrailingZeros:l=a.withoutTrailingZerosAndCurrency),u.createElement(c,{...i},l,o&&o.referenceUnit&&u.createElement(u.Fragment,null,s,o.referenceUnit))}function Wr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function zr(e){const{cost:t}=K(),{amountType:r="total",children:n,...o}=e;let s;return r=="total"?s=t==null?void 0:t.totalAmount:r=="subtotal"?s=t==null?void 0:t.subtotalAmount:r=="tax"?s=t==null?void 0:t.totalTaxAmount:r=="duty"&&(s=t==null?void 0:t.totalDutyAmount),s==null?null:u.createElement(ae,{...o,data:s},n)}function Jr(e){var s,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"?(s=t.cost)==null?void 0:s.totalAmount:(i=t.cost)==null?void 0:i.compareAtAmountPerQuantity;return o==null?null:u.createElement(ae,{...n,data:o})}const rt=u.createContext(null);function De(){const e=u.useContext(rt);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Kr({children:e,line:t}){return u.createElement(rt.Provider,{value:t},e)}function Xr(e){const t=De(),{as:r,...n}=e,o=r||"span";return u.createElement(o,{...n},t.quantity)}function en(e){const{status:t,linesRemove:r,linesUpdate:n}=K(),o=De(),{children:s,adjust:i,onClick:a,...c}=e,l=u.useCallback(()=>{if(i==="remove"){r([(o==null?void 0:o.id)??""]);return}const d=i==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(d<=0){r([(o==null?void 0:o.id)??""]);return}const g={id:(o==null?void 0:o.id)??"",quantity:d,attributes:(o==null?void 0:o.attributes)??[]};n([g])},[i,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return u.createElement(he,{...c,onClick:a,defaultOnClick:l,disabled:typeof c.disabled<"u"?c.disabled:t!=="idle"},s)}const tn={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function nt(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:s="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:i=!0,loading:a="lazy",...c}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let l=t.embedUrl;if(r){const d=new URL(t.embedUrl);for(const g of Object.keys(r))d.searchParams.set(g,r[g]);l=d.toString()}return u.createElement("iframe",{...c,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:s,allowFullScreen:i,src:l,loading:a})}const rn=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],nn=["spin.dev"],on=[...rn,...nn],ie=[352,832,1200,1920,2560];function ot({src:e,width:t,height:r,crop:n,scale:o}){const s=new URL(e),i=o??1;if(t){let a;typeof t=="string"?a=(ie[0]*i).toString():a=(Number(t)*i).toString(),s.searchParams.append("width",a)}return r&&typeof r=="number"&&s.searchParams.append("height",(r*i).toString()),n&&s.searchParams.append("crop",n),s.toString()}function at(e){const t=new URL(e.src);return!on.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:ot(e)}function an({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 it({data:e,width:t,height:r,loading:n,loader:o=at,loaderOptions:s,widths:i,decoding:a="async",...c}){if(!e.url){const y=`<Image/>: the 'data' prop requires the 'url' property. Image: ${e.id??"no ID provided"}`;return console.error(y),null}const{width:l,height:d}=an({data:e,loaderOptions:s,elementProps:{width:t,height:r}});let g=e.url;if(o&&(g=o({...s,src:e.url,width:l,height:d}),typeof g!="string"||!g))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${e.id??e.url}`);const S=t&&l&&t<l?t:l,m=c.srcSet??sn({...s,widths:i,src:e.url,width:S,height:d,loader:o});return W.createElement("img",{id:e.id??"",alt:e.altText??c.alt??"",loading:n??"lazy",...c,src:g,width:l??void 0,height:d??void 0,srcSet:m,decoding:a})}function sn({src:e,width:t,crop:r,scale:n,widths:o,loader:s,height:i}){const a=o&&Array.isArray(o);if(a&&o.some(g=>isNaN(g)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let c=1;t&&i&&(c=Number(i)/Number(t));let l=a?o:ie;!a&&t&&t<ie[ie.length-1]&&(l=ie.filter(g=>g<=t));const d=s||ot;return l.map(g=>`${d({src:e,width:g,height:r?Number(g)*c:void 0,crop:r,scale:n})} ${g??""}w`).join(", ")}function st(e){var l;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:o=!0,controls:s=!0,sourceProps:i={},...a}=e,c=at({src:((l=t.previewImage)==null?void 0:l.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return u.createElement("video",{...a,id:n,playsInline:o,controls:s,poster:c},t.sources.map(d=>{if(!(d!=null&&d.url&&(d!=null&&d.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return u.createElement("source",{...i,key:d.url,src:d.url,type:d.mimeType})}))}const ut={};function un(e,t){const r=ut[e];if(r)return r;const n=new Promise((o,s)=>{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=()=>{s(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(i):document.body.appendChild(i)});return ut[e]=n,n}function ct(e,t){const[r,n]=u.useState("loading"),o=JSON.stringify(t);return u.useEffect(()=>{async function s(){try{n("loading"),await un(e,t),n("done")}catch{n("error")}}s().catch(()=>{n("error")})},[e,o,t]),r}function lt(e){var l,d,g;const[t,r]=u.useState(void 0),n=u.useCallback(S=>{r(S)},[]),{data:o,children:s,className:i,...a}=e,c=ct("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return u.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]),c!=="done"?null:(d=(l=o.sources)==null?void 0:l[0])!=null&&d.url?u.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||((g=o.previewImage)==null?void 0:g.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},s):(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 cn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?u.createElement(it,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return u.createElement(st,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return u.createElement(nt,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return u.createElement(lt,{...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 ln(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=dt(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=dt((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:F(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 dt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function dn(e){var l,d,g,S,m,y;const{priceType:t="regular",variantId:r,valueType:n="min",data:o,...s}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let i,a;const c=r?F((o==null?void 0:o.variants)??{}).find(P=>(P==null?void 0:P.id)===r)??null:null;if(t==="compareAt")if(r&&c){if(((l=c.compareAtPriceV2)==null?void 0:l.amount)===((d=c.priceV2)==null?void 0:d.amount))return null;i=c.compareAtPriceV2}else n==="max"?i=(g=o==null?void 0:o.compareAtPriceRange)==null?void 0:g.maxVariantPrice:i=(S=o==null?void 0:o.compareAtPriceRange)==null?void 0:S.minVariantPrice;else r&&c?(i=c.priceV2,n==="unit"&&(i=c.unitPrice,a=c.unitPriceMeasurement)):n==="max"?i=(m=o.priceRange)==null?void 0:m.maxVariantPrice:i=(y=o.priceRange)==null?void 0:y.minVariantPrice;return i?a?u.createElement(ae,{...s,data:i,measurement:a}):u.createElement(ae,{...s,data:i}):null}const fn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function yn({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:o}=de(),s=ct(fn);let i=[];if(e&&r)throw new Error(mn);if(e)i=e.reduce((c,l)=>{const d=B(l).id;return d&&c.push(d),c},[]);else if(r)i=r.reduce((c,l)=>{const d=B(l==null?void 0:l.id).id;return d&&c.push(`${d}:${(l==null?void 0:l.quantity)??1}`),c},[]);else throw new Error(gn);if(i.length===0)throw new Error(hn);const a=n?{"--shop-pay-button-width":n}:void 0;return u.createElement("div",{className:t,style:a},s==="done"&&u.createElement("shop-pay-button",{"store-url":o,variants:i.join(",")}))}const hn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',gn='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',mn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",En=60*60*24*360*1,pn=60*30;function Cn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};u.useEffect(()=>{const n=ye(document.cookie);t?(me(H,n[H]||fe(),En,r),me(Y,n[Y]||fe(),pn,r)):(me(H,"",0,r),me(Y,"",0,r))})}function me(e,t,r,n){document.cookie=fr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}E.AddToCartButton=Ir,E.AnalyticsEventName=Ie,E.AnalyticsPageType=ge,E.BuyNowButton=Zr,E.CartCheckoutButton=Qr,E.CartCost=zr,E.CartLinePrice=Jr,E.CartLineProvider=Kr,E.CartLineQuantity=Xr,E.CartLineQuantityAdjustButton=en,E.CartProvider=Sr,E.ExternalVideo=nt,E.Image=it,E.MediaFile=cn,E.ModelViewer=lt,E.Money=ae,E.ProductPrice=dn,E.ProductProvider=vr,E.ShopPayButton=yn,E.ShopifyProvider=ir,E.ShopifySalesChannel=Je,E.Video=st,E.createStorefrontClient=or,E.flattenConnection=F,E.getClientBrowserParameters=jr,E.getShopifyCookies=ye,E.parseMetafield=ln,E.sendShopifyAnalytics=Fr,E.storefrontApiCustomScalars=tn,E.useCart=K,E.useCartLine=De,E.useMoney=tt,E.useProduct=Ze,E.useShop=de,E.useShopifyCookies=Cn,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
280
264
  //# sourceMappingURL=hydrogen-react.prod.js.map