@shopify/hydrogen-react 2022.7.1 → 2022.10.1

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 (398) hide show
  1. package/README.md +1 -1
  2. package/dist/dev/CartProvider.js +35 -35
  3. package/dist/dev/CartProvider.js.map +1 -1
  4. package/dist/dev/{CartProvider.cjs → CartProvider.mjs} +36 -36
  5. package/dist/dev/{CartProvider.cjs.map → CartProvider.mjs.map} +1 -1
  6. package/dist/dev/ExternalVideo.js +5 -5
  7. package/dist/dev/ExternalVideo.js.map +1 -1
  8. package/dist/dev/{ExternalVideo.cjs → ExternalVideo.mjs} +6 -6
  9. package/dist/{prod/ExternalVideo.cjs.map → dev/ExternalVideo.mjs.map} +1 -1
  10. package/dist/dev/Image.js +12 -12
  11. package/dist/dev/Image.js.map +1 -1
  12. package/dist/dev/{Image.cjs → Image.mjs} +13 -13
  13. package/dist/dev/{Image.cjs.map → Image.mjs.map} +1 -1
  14. package/dist/dev/MediaFile.js +12 -12
  15. package/dist/dev/MediaFile.js.map +1 -1
  16. package/dist/dev/{MediaFile.cjs → MediaFile.mjs} +13 -13
  17. package/dist/dev/{MediaFile.cjs.map → MediaFile.mjs.map} +1 -1
  18. package/dist/dev/Metafield.js +32 -32
  19. package/dist/dev/Metafield.js.map +1 -1
  20. package/dist/dev/{Metafield.cjs → Metafield.mjs} +33 -33
  21. package/dist/dev/Metafield.mjs.map +1 -0
  22. package/dist/dev/ModelViewer.js +11 -11
  23. package/dist/dev/ModelViewer.js.map +1 -1
  24. package/dist/dev/{ModelViewer.cjs → ModelViewer.mjs} +12 -12
  25. package/dist/dev/{ModelViewer.cjs.map → ModelViewer.mjs.map} +1 -1
  26. package/dist/dev/Money.js +8 -8
  27. package/dist/dev/Money.js.map +1 -1
  28. package/dist/{prod/Money.cjs → dev/Money.mjs} +9 -9
  29. package/dist/dev/{Money.cjs.map → Money.mjs.map} +1 -1
  30. package/dist/dev/ProductPrice.js +9 -9
  31. package/dist/dev/ProductPrice.js.map +1 -1
  32. package/dist/{prod/ProductPrice.cjs → dev/ProductPrice.mjs} +10 -10
  33. package/dist/dev/{ProductPrice.cjs.map → ProductPrice.mjs.map} +1 -1
  34. package/dist/dev/ProductProvider.js +25 -25
  35. package/dist/dev/ProductProvider.js.map +1 -1
  36. package/dist/{prod/ProductProvider.cjs → dev/ProductProvider.mjs} +26 -26
  37. package/dist/{prod/ProductProvider.cjs.map → dev/ProductProvider.mjs.map} +1 -1
  38. package/dist/dev/ShopPayButton.js +13 -13
  39. package/dist/dev/ShopPayButton.js.map +1 -1
  40. package/dist/{prod/ShopPayButton.cjs → dev/ShopPayButton.mjs} +14 -14
  41. package/dist/{prod/ShopPayButton.cjs.map → dev/ShopPayButton.mjs.map} +1 -1
  42. package/dist/dev/ShopifyProvider.js +14 -14
  43. package/dist/dev/ShopifyProvider.js.map +1 -1
  44. package/dist/dev/ShopifyProvider.mjs +46 -0
  45. package/dist/dev/{ShopifyProvider.cjs.map → ShopifyProvider.mjs.map} +1 -1
  46. package/dist/dev/Video.js +9 -9
  47. package/dist/dev/Video.js.map +1 -1
  48. package/dist/dev/{Video.cjs → Video.mjs} +10 -10
  49. package/dist/dev/{Video.cjs.map → Video.mjs.map} +1 -1
  50. package/dist/dev/_virtual/index.js +3 -3
  51. package/dist/dev/_virtual/index.js.map +1 -1
  52. package/dist/dev/_virtual/index.mjs +5 -0
  53. package/dist/dev/_virtual/index.mjs.map +1 -0
  54. package/dist/dev/_virtual/use-sync-external-store-shim.development.js +3 -3
  55. package/dist/dev/_virtual/use-sync-external-store-shim.development.js.map +1 -1
  56. package/dist/dev/_virtual/use-sync-external-store-shim.development.mjs +5 -0
  57. package/dist/dev/_virtual/use-sync-external-store-shim.development.mjs.map +1 -0
  58. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js +3 -3
  59. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js.map +1 -1
  60. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.mjs +5 -0
  61. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.mjs.map +1 -0
  62. package/dist/dev/_virtual/with-selector.development.js +3 -3
  63. package/dist/dev/_virtual/with-selector.development.js.map +1 -1
  64. package/dist/dev/_virtual/with-selector.development.mjs +5 -0
  65. package/dist/dev/_virtual/with-selector.development.mjs.map +1 -0
  66. package/dist/dev/_virtual/with-selector.js +3 -3
  67. package/dist/dev/_virtual/with-selector.js.map +1 -1
  68. package/dist/dev/_virtual/with-selector.mjs +5 -0
  69. package/dist/dev/_virtual/with-selector.mjs.map +1 -0
  70. package/dist/dev/_virtual/with-selector.production.min.js +3 -3
  71. package/dist/dev/_virtual/with-selector.production.min.js.map +1 -1
  72. package/dist/dev/_virtual/with-selector.production.min.mjs +5 -0
  73. package/dist/dev/_virtual/with-selector.production.min.mjs.map +1 -0
  74. package/dist/dev/cart-constants.js +9 -9
  75. package/dist/dev/cart-constants.js.map +1 -1
  76. package/dist/dev/cart-constants.mjs +17 -0
  77. package/dist/dev/{cart-constants.cjs.map → cart-constants.mjs.map} +1 -1
  78. package/dist/dev/cart-hooks.js +15 -56
  79. package/dist/dev/cart-hooks.js.map +1 -1
  80. package/dist/dev/cart-hooks.mjs +48 -0
  81. package/dist/dev/{cart-hooks.cjs.map → cart-hooks.mjs.map} +1 -1
  82. package/dist/dev/cart-queries.js +11 -113
  83. package/dist/dev/cart-queries.js.map +1 -1
  84. package/dist/{prod/cart-queries.cjs → dev/cart-queries.mjs} +12 -114
  85. package/dist/dev/{cart-queries.cjs.map → cart-queries.mjs.map} +1 -1
  86. package/dist/dev/flatten-connection.js +3 -3
  87. package/dist/dev/flatten-connection.js.map +1 -1
  88. package/dist/dev/{flatten-connection.cjs → flatten-connection.mjs} +4 -4
  89. package/dist/dev/{flatten-connection.cjs.map → flatten-connection.mjs.map} +1 -1
  90. package/dist/dev/image-size.js +6 -6
  91. package/dist/dev/image-size.js.map +1 -1
  92. package/dist/dev/{image-size.cjs → image-size.mjs} +7 -7
  93. package/dist/{prod/image-size.cjs.map → dev/image-size.mjs.map} +1 -1
  94. package/dist/dev/index.js +37 -40
  95. package/dist/dev/index.js.map +1 -1
  96. package/dist/dev/index.mjs +38 -0
  97. package/dist/dev/index.mjs.map +1 -0
  98. package/dist/dev/load-script.js +7 -7
  99. package/dist/dev/load-script.js.map +1 -1
  100. package/dist/{prod/load-script.cjs → dev/load-script.mjs} +8 -8
  101. package/dist/dev/{load-script.cjs.map → load-script.mjs.map} +1 -1
  102. package/dist/dev/node_modules/@xstate/fsm/es/index.js +34 -35
  103. package/dist/dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
  104. package/dist/{prod/node_modules/@xstate/fsm/es/index.cjs → dev/node_modules/@xstate/fsm/es/index.mjs} +36 -35
  105. package/dist/dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -0
  106. package/dist/dev/node_modules/@xstate/react/es/fsm.js +21 -21
  107. package/dist/dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
  108. package/dist/dev/node_modules/@xstate/react/es/{fsm.cjs → fsm.mjs} +22 -22
  109. package/dist/dev/node_modules/@xstate/react/es/{fsm.cjs.map → fsm.mjs.map} +1 -1
  110. package/dist/dev/node_modules/@xstate/react/es/useConstant.js +23 -5
  111. package/dist/dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  112. package/dist/dev/node_modules/@xstate/react/es/useConstant.mjs +12 -0
  113. package/dist/dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -0
  114. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +4 -5
  115. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -1
  116. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +6 -0
  117. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/{use-isomorphic-layout-effect.browser.esm.cjs.map → use-isomorphic-layout-effect.browser.esm.mjs.map} +1 -1
  118. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +13 -11
  119. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  120. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs} +12 -14
  121. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map} +1 -1
  122. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +12 -10
  123. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  124. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.production.min.cjs → with-selector.production.min.mjs} +11 -13
  125. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -0
  126. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +11 -9
  127. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  128. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs} +10 -12
  129. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map} +1 -1
  130. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +11 -9
  131. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  132. package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs} +10 -12
  133. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -0
  134. package/dist/dev/node_modules/use-sync-external-store/shim/index.js +12 -12
  135. package/dist/dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  136. package/dist/dev/node_modules/use-sync-external-store/shim/index.mjs +21 -0
  137. package/dist/dev/node_modules/use-sync-external-store/shim/{index.cjs.map → index.mjs.map} +1 -1
  138. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js +7 -6
  139. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  140. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.mjs +11 -0
  141. package/dist/dev/node_modules/use-sync-external-store/shim/{with-selector.cjs.map → with-selector.mjs.map} +1 -1
  142. package/dist/dev/node_modules/worktop/cookie/index.js +3 -3
  143. package/dist/dev/node_modules/worktop/cookie/index.js.map +1 -1
  144. package/dist/{prod/node_modules/worktop/cookie/index.cjs → dev/node_modules/worktop/cookie/index.mjs} +4 -4
  145. package/dist/dev/node_modules/worktop/cookie/{index.cjs.map → index.mjs.map} +1 -1
  146. package/dist/dev/storefront-api-constants.js +4 -4
  147. package/dist/dev/storefront-api-constants.js.map +1 -1
  148. package/dist/dev/storefront-api-constants.mjs +5 -0
  149. package/dist/dev/storefront-api-constants.mjs.map +1 -0
  150. package/dist/dev/storefront-client.js +6 -6
  151. package/dist/dev/storefront-client.js.map +1 -1
  152. package/dist/dev/{storefront-client.cjs → storefront-client.mjs} +7 -7
  153. package/dist/dev/storefront-client.mjs.map +1 -0
  154. package/dist/dev/useCartAPIStateMachine.js +20 -20
  155. package/dist/dev/useCartAPIStateMachine.js.map +1 -1
  156. package/dist/dev/{useCartAPIStateMachine.cjs → useCartAPIStateMachine.mjs} +21 -21
  157. package/dist/dev/{useCartAPIStateMachine.cjs.map → useCartAPIStateMachine.mjs.map} +1 -1
  158. package/dist/dev/useCartActions.js +26 -26
  159. package/dist/dev/useCartActions.js.map +1 -1
  160. package/dist/{prod/useCartActions.cjs → dev/useCartActions.mjs} +27 -27
  161. package/dist/dev/{useCartActions.cjs.map → useCartActions.mjs.map} +1 -1
  162. package/dist/dev/useMoney.js +10 -10
  163. package/dist/dev/useMoney.js.map +1 -1
  164. package/dist/{prod/useMoney.cjs → dev/useMoney.mjs} +11 -11
  165. package/dist/dev/{useMoney.cjs.map → useMoney.mjs.map} +1 -1
  166. package/dist/prod/CartProvider.js +35 -35
  167. package/dist/prod/CartProvider.js.map +1 -1
  168. package/dist/prod/{CartProvider.cjs → CartProvider.mjs} +36 -36
  169. package/dist/prod/{CartProvider.cjs.map → CartProvider.mjs.map} +1 -1
  170. package/dist/prod/ExternalVideo.js +5 -5
  171. package/dist/prod/ExternalVideo.js.map +1 -1
  172. package/dist/prod/{ExternalVideo.cjs → ExternalVideo.mjs} +6 -6
  173. package/dist/{dev/ExternalVideo.cjs.map → prod/ExternalVideo.mjs.map} +1 -1
  174. package/dist/prod/Image.js +12 -12
  175. package/dist/prod/Image.js.map +1 -1
  176. package/dist/prod/{Image.cjs → Image.mjs} +13 -13
  177. package/dist/prod/{Image.cjs.map → Image.mjs.map} +1 -1
  178. package/dist/prod/MediaFile.js +12 -12
  179. package/dist/prod/MediaFile.js.map +1 -1
  180. package/dist/prod/{MediaFile.cjs → MediaFile.mjs} +13 -13
  181. package/dist/prod/{MediaFile.cjs.map → MediaFile.mjs.map} +1 -1
  182. package/dist/prod/Metafield.js +32 -32
  183. package/dist/prod/Metafield.js.map +1 -1
  184. package/dist/prod/{Metafield.cjs → Metafield.mjs} +33 -33
  185. package/dist/prod/Metafield.mjs.map +1 -0
  186. package/dist/prod/ModelViewer.js +11 -11
  187. package/dist/prod/ModelViewer.js.map +1 -1
  188. package/dist/prod/{ModelViewer.cjs → ModelViewer.mjs} +12 -12
  189. package/dist/prod/{ModelViewer.cjs.map → ModelViewer.mjs.map} +1 -1
  190. package/dist/prod/Money.js +8 -8
  191. package/dist/prod/Money.js.map +1 -1
  192. package/dist/{dev/Money.cjs → prod/Money.mjs} +9 -9
  193. package/dist/prod/{Money.cjs.map → Money.mjs.map} +1 -1
  194. package/dist/prod/ProductPrice.js +9 -9
  195. package/dist/prod/ProductPrice.js.map +1 -1
  196. package/dist/{dev/ProductPrice.cjs → prod/ProductPrice.mjs} +10 -10
  197. package/dist/prod/{ProductPrice.cjs.map → ProductPrice.mjs.map} +1 -1
  198. package/dist/prod/ProductProvider.js +25 -25
  199. package/dist/prod/ProductProvider.js.map +1 -1
  200. package/dist/{dev/ProductProvider.cjs → prod/ProductProvider.mjs} +26 -26
  201. package/dist/{dev/ProductProvider.cjs.map → prod/ProductProvider.mjs.map} +1 -1
  202. package/dist/prod/ShopPayButton.js +13 -13
  203. package/dist/prod/ShopPayButton.js.map +1 -1
  204. package/dist/{dev/ShopPayButton.cjs → prod/ShopPayButton.mjs} +14 -14
  205. package/dist/{dev/ShopPayButton.cjs.map → prod/ShopPayButton.mjs.map} +1 -1
  206. package/dist/prod/ShopifyProvider.js +14 -14
  207. package/dist/prod/ShopifyProvider.js.map +1 -1
  208. package/dist/prod/ShopifyProvider.mjs +46 -0
  209. package/dist/prod/{ShopifyProvider.cjs.map → ShopifyProvider.mjs.map} +1 -1
  210. package/dist/prod/Video.js +9 -9
  211. package/dist/prod/Video.js.map +1 -1
  212. package/dist/prod/{Video.cjs → Video.mjs} +10 -10
  213. package/dist/prod/{Video.cjs.map → Video.mjs.map} +1 -1
  214. package/dist/prod/_virtual/index.js +3 -3
  215. package/dist/prod/_virtual/index.js.map +1 -1
  216. package/dist/prod/_virtual/index.mjs +5 -0
  217. package/dist/prod/_virtual/index.mjs.map +1 -0
  218. package/dist/prod/_virtual/use-sync-external-store-shim.development.js +3 -3
  219. package/dist/prod/_virtual/use-sync-external-store-shim.development.js.map +1 -1
  220. package/dist/prod/_virtual/use-sync-external-store-shim.development.mjs +5 -0
  221. package/dist/prod/_virtual/use-sync-external-store-shim.development.mjs.map +1 -0
  222. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js +3 -3
  223. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js.map +1 -1
  224. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.mjs +5 -0
  225. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.mjs.map +1 -0
  226. package/dist/prod/_virtual/with-selector.development.js +3 -3
  227. package/dist/prod/_virtual/with-selector.development.js.map +1 -1
  228. package/dist/prod/_virtual/with-selector.development.mjs +5 -0
  229. package/dist/prod/_virtual/with-selector.development.mjs.map +1 -0
  230. package/dist/prod/_virtual/with-selector.js +3 -3
  231. package/dist/prod/_virtual/with-selector.js.map +1 -1
  232. package/dist/prod/_virtual/with-selector.mjs +5 -0
  233. package/dist/prod/_virtual/with-selector.mjs.map +1 -0
  234. package/dist/prod/_virtual/with-selector.production.min.js +3 -3
  235. package/dist/prod/_virtual/with-selector.production.min.js.map +1 -1
  236. package/dist/prod/_virtual/with-selector.production.min.mjs +5 -0
  237. package/dist/prod/_virtual/with-selector.production.min.mjs.map +1 -0
  238. package/dist/prod/cart-constants.js +9 -9
  239. package/dist/prod/cart-constants.js.map +1 -1
  240. package/dist/prod/cart-constants.mjs +17 -0
  241. package/dist/prod/{cart-constants.cjs.map → cart-constants.mjs.map} +1 -1
  242. package/dist/prod/cart-hooks.js +15 -56
  243. package/dist/prod/cart-hooks.js.map +1 -1
  244. package/dist/prod/cart-hooks.mjs +48 -0
  245. package/dist/prod/{cart-hooks.cjs.map → cart-hooks.mjs.map} +1 -1
  246. package/dist/prod/cart-queries.js +11 -113
  247. package/dist/prod/cart-queries.js.map +1 -1
  248. package/dist/{dev/cart-queries.cjs → prod/cart-queries.mjs} +12 -114
  249. package/dist/prod/{cart-queries.cjs.map → cart-queries.mjs.map} +1 -1
  250. package/dist/prod/flatten-connection.js +3 -3
  251. package/dist/prod/flatten-connection.js.map +1 -1
  252. package/dist/prod/{flatten-connection.cjs → flatten-connection.mjs} +4 -4
  253. package/dist/prod/{flatten-connection.cjs.map → flatten-connection.mjs.map} +1 -1
  254. package/dist/prod/image-size.js +6 -6
  255. package/dist/prod/image-size.js.map +1 -1
  256. package/dist/prod/{image-size.cjs → image-size.mjs} +7 -7
  257. package/dist/{dev/image-size.cjs.map → prod/image-size.mjs.map} +1 -1
  258. package/dist/prod/index.js +37 -40
  259. package/dist/prod/index.js.map +1 -1
  260. package/dist/prod/index.mjs +38 -0
  261. package/dist/prod/index.mjs.map +1 -0
  262. package/dist/prod/load-script.js +7 -7
  263. package/dist/prod/load-script.js.map +1 -1
  264. package/dist/{dev/load-script.cjs → prod/load-script.mjs} +8 -8
  265. package/dist/prod/{load-script.cjs.map → load-script.mjs.map} +1 -1
  266. package/dist/prod/node_modules/@xstate/fsm/es/index.js +34 -35
  267. package/dist/prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
  268. package/dist/{dev/node_modules/@xstate/fsm/es/index.cjs → prod/node_modules/@xstate/fsm/es/index.mjs} +36 -35
  269. package/dist/prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -0
  270. package/dist/prod/node_modules/@xstate/react/es/fsm.js +21 -21
  271. package/dist/prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
  272. package/dist/prod/node_modules/@xstate/react/es/{fsm.cjs → fsm.mjs} +22 -22
  273. package/dist/prod/node_modules/@xstate/react/es/{fsm.cjs.map → fsm.mjs.map} +1 -1
  274. package/dist/prod/node_modules/@xstate/react/es/useConstant.js +23 -5
  275. package/dist/prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  276. package/dist/prod/node_modules/@xstate/react/es/useConstant.mjs +12 -0
  277. package/dist/prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -0
  278. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +4 -5
  279. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -1
  280. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +6 -0
  281. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/{use-isomorphic-layout-effect.browser.esm.cjs.map → use-isomorphic-layout-effect.browser.esm.mjs.map} +1 -1
  282. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +13 -11
  283. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  284. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs} +12 -14
  285. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map} +1 -1
  286. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +12 -10
  287. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  288. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.production.min.cjs → with-selector.production.min.mjs} +11 -13
  289. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -0
  290. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +11 -9
  291. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  292. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs} +10 -12
  293. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map} +1 -1
  294. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +11 -9
  295. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  296. package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs} +10 -12
  297. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -0
  298. package/dist/prod/node_modules/use-sync-external-store/shim/index.js +12 -12
  299. package/dist/prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  300. package/dist/prod/node_modules/use-sync-external-store/shim/index.mjs +21 -0
  301. package/dist/prod/node_modules/use-sync-external-store/shim/{index.cjs.map → index.mjs.map} +1 -1
  302. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js +7 -6
  303. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  304. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.mjs +11 -0
  305. package/dist/prod/node_modules/use-sync-external-store/shim/{with-selector.cjs.map → with-selector.mjs.map} +1 -1
  306. package/dist/prod/node_modules/worktop/cookie/index.js +3 -3
  307. package/dist/prod/node_modules/worktop/cookie/index.js.map +1 -1
  308. package/dist/{dev/node_modules/worktop/cookie/index.cjs → prod/node_modules/worktop/cookie/index.mjs} +4 -4
  309. package/dist/prod/node_modules/worktop/cookie/{index.cjs.map → index.mjs.map} +1 -1
  310. package/dist/prod/storefront-api-constants.js +4 -4
  311. package/dist/prod/storefront-api-constants.js.map +1 -1
  312. package/dist/prod/storefront-api-constants.mjs +5 -0
  313. package/dist/prod/storefront-api-constants.mjs.map +1 -0
  314. package/dist/prod/storefront-client.js +6 -6
  315. package/dist/prod/storefront-client.js.map +1 -1
  316. package/dist/prod/{storefront-client.cjs → storefront-client.mjs} +7 -7
  317. package/dist/prod/storefront-client.mjs.map +1 -0
  318. package/dist/prod/useCartAPIStateMachine.js +20 -20
  319. package/dist/prod/useCartAPIStateMachine.js.map +1 -1
  320. package/dist/prod/{useCartAPIStateMachine.cjs → useCartAPIStateMachine.mjs} +21 -21
  321. package/dist/prod/{useCartAPIStateMachine.cjs.map → useCartAPIStateMachine.mjs.map} +1 -1
  322. package/dist/prod/useCartActions.js +26 -26
  323. package/dist/prod/useCartActions.js.map +1 -1
  324. package/dist/{dev/useCartActions.cjs → prod/useCartActions.mjs} +27 -27
  325. package/dist/prod/{useCartActions.cjs.map → useCartActions.mjs.map} +1 -1
  326. package/dist/prod/useMoney.js +10 -10
  327. package/dist/prod/useMoney.js.map +1 -1
  328. package/dist/{dev/useMoney.cjs → prod/useMoney.mjs} +11 -11
  329. package/dist/prod/{useMoney.cjs.map → useMoney.mjs.map} +1 -1
  330. package/dist/types/index.d.cts +0 -1
  331. package/dist/types/index.d.ts +0 -1
  332. package/dist/types/storefront-api-constants.d.ts +1 -1
  333. package/dist/types/storefront-api-types.d.ts +278 -73
  334. package/dist/types/useCartActions.d.ts +1 -1
  335. package/dist/umd/hydrogen-react.dev.js +253 -394
  336. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  337. package/dist/umd/hydrogen-react.prod.js +57 -157
  338. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  339. package/package.json +15 -14
  340. package/storefront.schema.json +1 -1
  341. package/dist/dev/Metafield.cjs.map +0 -1
  342. package/dist/dev/ShopifyProvider.cjs +0 -46
  343. package/dist/dev/_virtual/index.cjs +0 -5
  344. package/dist/dev/_virtual/index.cjs.map +0 -1
  345. package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs +0 -5
  346. package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs.map +0 -1
  347. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs +0 -5
  348. package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs.map +0 -1
  349. package/dist/dev/_virtual/with-selector.cjs +0 -5
  350. package/dist/dev/_virtual/with-selector.cjs.map +0 -1
  351. package/dist/dev/_virtual/with-selector.development.cjs +0 -5
  352. package/dist/dev/_virtual/with-selector.development.cjs.map +0 -1
  353. package/dist/dev/_virtual/with-selector.production.min.cjs +0 -5
  354. package/dist/dev/_virtual/with-selector.production.min.cjs.map +0 -1
  355. package/dist/dev/cart-constants.cjs +0 -17
  356. package/dist/dev/cart-hooks.cjs +0 -89
  357. package/dist/dev/index.cjs +0 -41
  358. package/dist/dev/index.cjs.map +0 -1
  359. package/dist/dev/node_modules/@xstate/fsm/es/index.cjs.map +0 -1
  360. package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs +0 -30
  361. package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs.map +0 -1
  362. package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +0 -5
  363. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +0 -1
  364. package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +0 -1
  365. package/dist/dev/node_modules/use-sync-external-store/shim/index.cjs +0 -21
  366. package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.cjs +0 -12
  367. package/dist/dev/storefront-api-constants.cjs +0 -5
  368. package/dist/dev/storefront-api-constants.cjs.map +0 -1
  369. package/dist/dev/storefront-client.cjs.map +0 -1
  370. package/dist/prod/Metafield.cjs.map +0 -1
  371. package/dist/prod/ShopifyProvider.cjs +0 -46
  372. package/dist/prod/_virtual/index.cjs +0 -5
  373. package/dist/prod/_virtual/index.cjs.map +0 -1
  374. package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs +0 -5
  375. package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs.map +0 -1
  376. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs +0 -5
  377. package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs.map +0 -1
  378. package/dist/prod/_virtual/with-selector.cjs +0 -5
  379. package/dist/prod/_virtual/with-selector.cjs.map +0 -1
  380. package/dist/prod/_virtual/with-selector.development.cjs +0 -5
  381. package/dist/prod/_virtual/with-selector.development.cjs.map +0 -1
  382. package/dist/prod/_virtual/with-selector.production.min.cjs +0 -5
  383. package/dist/prod/_virtual/with-selector.production.min.cjs.map +0 -1
  384. package/dist/prod/cart-constants.cjs +0 -17
  385. package/dist/prod/cart-hooks.cjs +0 -89
  386. package/dist/prod/index.cjs +0 -41
  387. package/dist/prod/index.cjs.map +0 -1
  388. package/dist/prod/node_modules/@xstate/fsm/es/index.cjs.map +0 -1
  389. package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs +0 -30
  390. package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs.map +0 -1
  391. package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +0 -5
  392. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +0 -1
  393. package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +0 -1
  394. package/dist/prod/node_modules/use-sync-external-store/shim/index.cjs +0 -21
  395. package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.cjs +0 -12
  396. package/dist/prod/storefront-api-constants.cjs +0 -5
  397. package/dist/prod/storefront-api-constants.cjs.map +0 -1
  398. package/dist/prod/storefront-client.cjs.map +0 -1
@@ -1,4 +1,49 @@
1
- (function(L,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(L=typeof globalThis<"u"?globalThis:L||self,g(L.hydrogenreact={},L.React))})(this,function(L,g){"use strict";const yt=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function ht(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const w=yt(g),ve=ht(g),Q="2022-07";var _t="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopifyProvider.tsx";const be=g.createContext({storeDomain:"test.myshopify.com",storefrontToken:"abc123",storefrontApiVersion:Q,country:{isoCode:"US"},language:{isoCode:"EN"},locale:"EN-US"});function gt({children:e,shopifyConfig:t}){if(!t)throw new Error("The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'");t.storefrontApiVersion!==Q&&console.warn(`This version of Hydrogen-UI is built for Shopify's Storefront API version ${Q}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`);const r=g.useMemo(()=>({...t,storeDomain:t.storeDomain.replace(/^https?:\/\//,"")}),[t]);return w.default.createElement(be.Provider,{value:r,__self:this,__source:{fileName:_t,lineNumber:49,columnNumber:5}},e)}function X(){const e=g.useContext(be);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}function x(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e}' instead`;return console.error(t),[]}return e.nodes?e.nodes:e.edges?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("Connection edges must contain nodes");return t.node}):[]}const Et=e=>`
1
+ (function(U,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(U=typeof globalThis<"u"?globalThis:U||self,g(U.hydrogenreact={},U.React))})(this,function(U,g){"use strict";const fr=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function yr(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const w=fr(g),Se=yr(g);/*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */function ve(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var a,o,i=t.call(e),u=[];try{for(;(r===void 0||r-- >0)&&!(a=i.next()).done;)u.push(a.value)}catch(n){o={error:n}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.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 be={type:"xstate.init"};function se(e){return e===void 0?[]:[].concat(e)}function Q(e){return{type:"xstate.assign",assignment:e}}function Te(e,r){return typeof(e=typeof e=="string"&&r&&r[e]?r[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function ae(e){return function(r){return e===r}}function Ce(e){return typeof e=="string"?{type:e}:e}function Ae(e,r){return{value:e,context:r,actions:[],changed:!1,matches:ae(e)}}function Ne(e,r,t){var a=r,o=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){o=!0;var u=Object.assign({},a);return typeof i.assignment=="function"?u=i.assignment(a,t):Object.keys(i.assignment).forEach(function(n){u[n]=typeof i.assignment[n]=="function"?i.assignment[n](a,t):i.assignment[n]}),a=u,!1}return!0}),a,o]}function we(e,r){r===void 0&&(r={});var t=ve(Ne(se(e.states[e.initial].entry).map(function(u){return Te(u,r.actions)}),e.context,be),2),a=t[0],o=t[1],i={config:e,_options:r,initialState:{value:e.initial,actions:a,context:o,matches:ae(e.initial)},transition:function(u,n){var l,d,h=typeof u=="string"?{value:u,context:e.context}:u,s=h.value,m=h.context,_=Ce(n),p=e.states[s];if(p.on){var A=se(p.on[_.type]);try{for(var f=function(D){var G=typeof Symbol=="function"&&Symbol.iterator,P=G&&D[G],ue=0;if(P)return P.call(D);if(D&&typeof D.length=="number")return{next:function(){return D&&ue>=D.length&&(D=void 0),{value:D&&D[ue++],done:!D}}};throw new TypeError(G?"Object is not iterable.":"Symbol.iterator is not defined.")}(A),S=f.next();!S.done;S=f.next()){var v=S.value;if(v===void 0)return Ae(s,m);var b=typeof v=="string"?{target:v}:v,c=b.target,y=b.actions,E=y===void 0?[]:y,N=b.cond,I=N===void 0?function(){return!0}:N,C=c===void 0,O=c!=null?c:s,R=e.states[O];if(I(m,_)){var V=ve(Ne((C?se(E):[].concat(p.exit,E,R.entry).filter(function(D){return D})).map(function(D){return Te(D,i._options.actions)}),m,_),3),F=V[0],W=V[1],K=V[2],q=c!=null?c:s;return{value:q,context:W,actions:F,changed:c!==s||F.length>0||K,matches:ae(q)}}}}catch(D){l={error:D}}finally{try{S&&!S.done&&(d=f.return)&&d.call(f)}finally{if(l)throw l.error}}}return Ae(s,m)}};return i}var Ie=function(e,r){return e.actions.forEach(function(t){var a=t.exec;return a&&a(e.context,r)})};function mr(e){var r=e.initialState,t=Y.NotStarted,a=new Set,o={_machine:e,send:function(i){t===Y.Running&&(r=e.transition(r,i),Ie(r,Ce(i)),a.forEach(function(u){return u(r)}))},subscribe:function(i){return a.add(i),i(r),{unsubscribe:function(){return a.delete(i)}}},start:function(i){if(i){var u=typeof i=="object"?i:{context:e.config.context,value:i};r={value:u.value,actions:[],context:u.context,matches:ae(u.value)}}else r=e.initialState;return t=Y.Running,Ie(r,be),o},stop:function(){return t=Y.Stopped,a.clear(),o},get state(){return r},get status(){return t}};return o}var _r=g.useLayoutEffect,Oe={exports:{}},le={},de={exports:{}},fe={};/**
15
+ * @license React
16
+ * use-sync-external-store-shim.production.min.js
17
+ *
18
+ * Copyright (c) Facebook, Inc. and its affiliates.
19
+ *
20
+ * This source code is licensed under the MIT license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */var De;function hr(){if(De)return fe;De=1;var e=w.default;function r(s,m){return s===m&&(s!==0||1/s===1/m)||s!==s&&m!==m}var t=typeof Object.is=="function"?Object.is:r,a=e.useState,o=e.useEffect,i=e.useLayoutEffect,u=e.useDebugValue;function n(s,m){var _=m(),p=a({inst:{value:_,getSnapshot:m}}),A=p[0].inst,f=p[1];return i(function(){A.value=_,A.getSnapshot=m,l(A)&&f({inst:A})},[s,_,m]),o(function(){return l(A)&&f({inst:A}),s(function(){l(A)&&f({inst:A})})},[s]),u(_),_}function l(s){var m=s.getSnapshot;s=s.value;try{var _=m();return!t(s,_)}catch{return!0}}function d(s,m){return m()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:n;return fe.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,fe}var ye={};/**
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 Le;function gr(){return Le||(Le=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=w.default,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(b){{for(var c=arguments.length,y=new Array(c>1?c-1:0),E=1;E<c;E++)y[E-1]=arguments[E];a("error",b,y)}}function a(b,c,y){{var E=r.ReactDebugCurrentFrame,N=E.getStackAddendum();N!==""&&(c+="%s",y=y.concat([N]));var I=y.map(function(C){return String(C)});I.unshift("Warning: "+c),Function.prototype.apply.call(console[b],console,I)}}function o(b,c){return b===c&&(b!==0||1/b===1/c)||b!==b&&c!==c}var i=typeof Object.is=="function"?Object.is:o,u=e.useState,n=e.useEffect,l=e.useLayoutEffect,d=e.useDebugValue,h=!1,s=!1;function m(b,c,y){h||e.startTransition!==void 0&&(h=!0,t("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 E=c();if(!s){var N=c();i(E,N)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),s=!0)}var I=u({inst:{value:E,getSnapshot:c}}),C=I[0].inst,O=I[1];return l(function(){C.value=E,C.getSnapshot=c,_(C)&&O({inst:C})},[b,E,c]),n(function(){_(C)&&O({inst:C});var R=function(){_(C)&&O({inst:C})};return b(R)},[b]),d(E),E}function _(b){var c=b.getSnapshot,y=b.value;try{var E=c();return!i(y,E)}catch{return!0}}function p(b,c,y){return c()}var A=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",f=!A,S=f?p:m,v=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:S;ye.useSyncExternalStore=v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ye}var Ue;function Pe(){return Ue||(Ue=1,function(e){process.env.NODE_ENV==="production"?e.exports=hr():e.exports=gr()}(de)),de.exports}/**
31
+ * @license React
32
+ * use-sync-external-store-shim/with-selector.production.min.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */var Re;function Er(){if(Re)return le;Re=1;var e=w.default,r=Pe();function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var a=typeof Object.is=="function"?Object.is:t,o=r.useSyncExternalStore,i=e.useRef,u=e.useEffect,n=e.useMemo,l=e.useDebugValue;return le.useSyncExternalStoreWithSelector=function(d,h,s,m,_){var p=i(null);if(p.current===null){var A={hasValue:!1,value:null};p.current=A}else A=p.current;p=n(function(){function S(E){if(!v){if(v=!0,b=E,E=m(E),_!==void 0&&A.hasValue){var N=A.value;if(_(N,E))return c=N}return c=E}if(N=c,a(b,E))return N;var I=m(E);return _!==void 0&&_(N,I)?N:(b=E,c=I)}var v=!1,b,c,y=s===void 0?null:s;return[function(){return S(h())},y===null?void 0:function(){return S(y())}]},[h,s,m,_]);var f=o(d,p[0],p[1]);return u(function(){A.hasValue=!0,A.value=f},[f]),l(f),f},le}var me={};/**
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 Me;function pr(){return Me||(Me=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=w.default,r=Pe();function t(h,s){return h===s&&(h!==0||1/h===1/s)||h!==h&&s!==s}var a=typeof Object.is=="function"?Object.is:t,o=r.useSyncExternalStore,i=e.useRef,u=e.useEffect,n=e.useMemo,l=e.useDebugValue;function d(h,s,m,_,p){var A=i(null),f;A.current===null?(f={hasValue:!1,value:null},A.current=f):f=A.current;var S=n(function(){var y=!1,E,N,I=function(V){if(!y){y=!0,E=V;var F=_(V);if(p!==void 0&&f.hasValue){var W=f.value;if(p(W,F))return N=W,W}return N=F,F}var K=E,q=N;if(a(K,V))return q;var D=_(V);return p!==void 0&&p(q,D)?q:(E=V,N=D,D)},C=m===void 0?null:m,O=function(){return I(s())},R=C===null?void 0:function(){return I(C())};return[O,R]},[s,m,_,p]),v=S[0],b=S[1],c=o(h,v,b);return u(function(){f.hasValue=!0,f.value=c},[c]),l(c),c}me.useSyncExternalStoreWithSelector=d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),me}(function(e){process.env.NODE_ENV==="production"?e.exports=Er():e.exports=pr()})(Oe);function Sr(e){var r=Se.useRef();return r.current||(r.current={v:e()}),r.current.v}var $e=globalThis&&globalThis.__read||function(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var a=t.call(e),o,i=[],u;try{for(;(r===void 0||r-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(n){u={error:n}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(u)throw u.error}}return i};function vr(e){return e}var br=function(e){var r;return e.subscribe(function(t){r=t}).unsubscribe(),r};function Tr(e,r){var t=g.useRef();if(process.env.NODE_ENV!=="production"){var a=$e(g.useState(e),1),o=a[0];e!==o&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var i=$e(Sr(function(){var d=[],h=mr(we(e.config,r||e._options)),s=h.send;return h.send=function(m){if(h.status===Y.NotStarted){d.push(m);return}s(m),t.current=h.state},[h,d]}),2),u=i[0],n=i[1];_r(function(){r&&(u._machine._options=r)});var l=Ar(u);return g.useEffect(function(){return u.start(t.current),n.forEach(u.send),t.current=u.state,function(){u.stop()}},[]),l}var Cr=function(e,r){return r.changed===!1};function Ar(e){var r=g.useCallback(function(){return br(e)},[e]),t=g.useCallback(function(o){var i=e.subscribe(o).unsubscribe;return i},[e]),a=Oe.exports.useSyncExternalStoreWithSelector(t,r,r,vr,Cr);return[a,e.send,e]}function B(e){if(!e){const r=`flattenConnection(): needs a 'connection' to flatten, but received '${e}' instead`;return console.error(r),[]}return e.nodes?e.nodes:e.edges?e.edges.map(r=>{if(!(r!=null&&r.node))throw new Error("Connection edges must contain nodes");return r.node}):[]}const Nr=e=>`
2
47
  mutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
3
48
  cartLinesAdd(cartId: $cartId, lines: $lines) {
4
49
  cart {
@@ -8,7 +53,7 @@ mutation CartLineAdd($cartId: ID!, $lines: [CartLineInput!]!, $numCartLines: Int
8
53
  }
9
54
 
10
55
  ${e}
11
- `,Ce=e=>`
56
+ `,wr=e=>`
12
57
  mutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
13
58
  cartCreate(input: $input) {
14
59
  cart {
@@ -18,7 +63,7 @@ mutation CartCreate($input: CartInput!, $numCartLines: Int = 250, $country: Coun
18
63
  }
19
64
 
20
65
  ${e}
21
- `,pt=e=>`
66
+ `,Ir=e=>`
22
67
  mutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
23
68
  cartLinesRemove(cartId: $cartId, lineIds: $lines) {
24
69
  cart {
@@ -28,7 +73,7 @@ mutation CartLineRemove($cartId: ID!, $lines: [ID!]!, $numCartLines: Int = 250,
28
73
  }
29
74
 
30
75
  ${e}
31
- `,St=e=>`
76
+ `,Or=e=>`
32
77
  mutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
33
78
  cartLinesUpdate(cartId: $cartId, lines: $lines) {
34
79
  cart {
@@ -38,7 +83,7 @@ mutation CartLineUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!, $numCartL
38
83
  }
39
84
 
40
85
  ${e}
41
- `,vt=e=>`
86
+ `,Dr=e=>`
42
87
  mutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
43
88
  cartNoteUpdate(cartId: $cartId, note: $note) {
44
89
  cart {
@@ -48,7 +93,7 @@ mutation CartNoteUpdate($cartId: ID!, $note: String, $numCartLines: Int = 250, $
48
93
  }
49
94
 
50
95
  ${e}
51
- `,bt=e=>`
96
+ `,Lr=e=>`
52
97
  mutation CartBuyerIdentityUpdate(
53
98
  $cartId: ID!
54
99
  $buyerIdentity: CartBuyerIdentityInput!
@@ -63,7 +108,7 @@ mutation CartBuyerIdentityUpdate(
63
108
  }
64
109
 
65
110
  ${e}
66
- `,Ct=e=>`
111
+ `,Ur=e=>`
67
112
  mutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
68
113
  cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
69
114
  cart {
@@ -73,7 +118,7 @@ mutation CartAttributesUpdate($attributes: [AttributeInput!]!, $cartId: ID!, $nu
73
118
  }
74
119
 
75
120
  ${e}
76
- `,Tt=e=>`
121
+ `,Pr=e=>`
77
122
  mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
78
123
  cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
79
124
  cart {
@@ -83,7 +128,7 @@ mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!], $numCa
83
128
  }
84
129
 
85
130
  ${e}
86
- `,At=e=>`
131
+ `,Rr=e=>`
87
132
  query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ) @inContext(country: $country) {
88
133
  cart(id: $id) {
89
134
  ...CartFragment
@@ -91,152 +136,7 @@ query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ)
91
136
  }
92
137
 
93
138
  ${e}
94
- `,Nt=`
95
- fragment CartFragment on Cart {
96
- id
97
- checkoutUrl
98
- totalQuantity
99
- buyerIdentity {
100
- countryCode
101
- customer {
102
- id
103
- email
104
- firstName
105
- lastName
106
- displayName
107
- }
108
- email
109
- phone
110
- }
111
- lines(first: $numCartLines) {
112
- edges {
113
- node {
114
- id
115
- quantity
116
- attributes {
117
- key
118
- value
119
- }
120
- cost {
121
- totalAmount {
122
- amount
123
- currencyCode
124
- }
125
- compareAtAmountPerQuantity {
126
- amount
127
- currencyCode
128
- }
129
- }
130
- merchandise {
131
- ... on ProductVariant {
132
- id
133
- availableForSale
134
- compareAtPriceV2 {
135
- ...MoneyFragment
136
- }
137
- priceV2 {
138
- ...MoneyFragment
139
- }
140
- requiresShipping
141
- title
142
- image {
143
- ...ImageFragment
144
- }
145
- product {
146
- handle
147
- title
148
- id
149
- }
150
- selectedOptions {
151
- name
152
- value
153
- }
154
- }
155
- }
156
- }
157
- }
158
- }
159
- cost {
160
- subtotalAmount {
161
- ...MoneyFragment
162
- }
163
- totalAmount {
164
- ...MoneyFragment
165
- }
166
- totalDutyAmount {
167
- ...MoneyFragment
168
- }
169
- totalTaxAmount {
170
- ...MoneyFragment
171
- }
172
- }
173
- note
174
- attributes {
175
- key
176
- value
177
- }
178
- discountCodes {
179
- code
180
- }
181
- }
182
-
183
- fragment MoneyFragment on MoneyV2 {
184
- currencyCode
185
- amount
186
- }
187
- fragment ImageFragment on Image {
188
- id
189
- url
190
- altText
191
- width
192
- height
193
- }
194
- `,se="shopifyCartId",wt="X-Shopify-Storefront-Access-Token",It="Shopify-Storefront-Id",Ot="Shopify-Storefront-Y",Dt="Shopify-Storefront-S",Te="_shopify_y",Ae="_shopify_s";var Lt=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Ut(e){let t={},r,a,o=0,i=e.split(/;\s*/g),u,n;for(;o<i.length;o++)if(a=i[o],r=a.indexOf("="),~r){if(u=a.substring(0,r++).trim(),n=a.substring(r).trim(),n[0]==='"'&&(n=n.substring(1,n.length-1)),~n.indexOf("%"))try{n=decodeURIComponent(n)}catch{}Lt.has(a=u.toLowerCase())?a==="expires"?t.expires=new Date(n):a==="max-age"?t.maxage=+n:t[a]=n:t[u]=n}else(u=a.trim().toLowerCase())&&(u==="httponly"||u==="secure")&&(t[u]=!0);return t}function le(){const{storeDomain:e,storefrontApiVersion:t,storefrontToken:r,storefrontId:a}=X();return g.useCallback(({query:o,variables:i})=>{const u={"Content-Type":"application/json","X-SDK-Variant":"hydrogen","X-SDK-Version":t,[wt]:r};a&&(u[It]=a);const n=Ut(document.cookie);return n[Te]&&n[Ae]&&(u[Ot]=n[Te],u[Dt]=n[Ae]),fetch(`https://${e}/api/${t}/graphql.json`,{method:"POST",headers:u,body:JSON.stringify({query:o.toString(),variables:i})}).then(l=>l.json()).catch(l=>({data:void 0,errors:l.toString()}))},[e,t,r,a])}function Pt(){const[e,t]=g.useState(),[r,a]=g.useState(),[o,i]=g.useState(),u=le(),n=g.useCallback(async l=>{var c,h;const{data:d,errors:_}=await u({query:Ce(Nt),variables:{input:l}});if(_&&(i(_.toString()),t(void 0),a(void 0)),(c=d==null?void 0:d.cartCreate)!=null&&c.cart){const m=d.cartCreate.cart;t({...m,lines:x(m.lines),note:(h=m.note)!=null?h:void 0}),a(m.checkoutUrl)}},[u]);return{cart:e,checkoutUrl:r,error:o,createInstantCheckout:n}}/*! *****************************************************************************
195
- Copyright (c) Microsoft Corporation.
196
-
197
- Permission to use, copy, modify, and/or distribute this software for any
198
- purpose with or without fee is hereby granted.
199
-
200
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
201
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
202
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
203
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
204
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
205
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
206
- PERFORMANCE OF THIS SOFTWARE.
207
- ***************************************************************************** */function Ne(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a,o,i=r.call(e),u=[];try{for(;(t===void 0||t-- >0)&&!(a=i.next()).done;)u.push(a.value)}catch(n){o={error:n}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.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 we={type:"xstate.init"};function de(e){return e===void 0?[]:[].concat(e)}function J(e){return{type:"xstate.assign",assignment:e}}function Ie(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 ae(e){return function(t){return e===t}}function Oe(e){return typeof e=="string"?{type:e}:e}function De(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ae(e)}}function Le(e,t,r){var a=t,o=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){o=!0;var u=Object.assign({},a);return typeof i.assignment=="function"?u=i.assignment(a,r):Object.keys(i.assignment).forEach(function(n){u[n]=typeof i.assignment[n]=="function"?i.assignment[n](a,r):i.assignment[n]}),a=u,!1}return!0}),a,o]}function Ue(e,t){t===void 0&&(t={});var r=Ne(Le(de(e.states[e.initial].entry).map(function(u){return Ie(u,t.actions)}),e.context,we),2),a=r[0],o=r[1],i={config:e,_options:t,initialState:{value:e.initial,actions:a,context:o,matches:ae(e.initial)},transition:function(u,n){var l,d,_=typeof u=="string"?{value:u,context:e.context}:u,c=_.value,h=_.context,m=Oe(n),p=e.states[c];if(p.on){var A=de(p.on[m.type]);try{for(var f=function(D){var G=typeof Symbol=="function"&&Symbol.iterator,P=G&&D[G],ue=0;if(P)return P.call(D);if(D&&typeof D.length=="number")return{next:function(){return D&&ue>=D.length&&(D=void 0),{value:D&&D[ue++],done:!D}}};throw new TypeError(G?"Object is not iterable.":"Symbol.iterator is not defined.")}(A),S=f.next();!S.done;S=f.next()){var v=S.value;if(v===void 0)return De(c,h);var b=typeof v=="string"?{target:v}:v,s=b.target,y=b.actions,E=y===void 0?[]:y,N=b.cond,I=N===void 0?function(){return!0}:N,T=s===void 0,O=s!=null?s:c,M=e.states[O];if(I(h,m)){var $=Ne(Le((T?de(E):[].concat(p.exit,E,M.entry).filter(function(D){return D})).map(function(D){return Ie(D,i._options.actions)}),h,m),3),F=$[0],W=$[1],K=$[2],H=s!=null?s:c;return{value:H,context:W,actions:F,changed:s!==c||F.length>0||K,matches:ae(H)}}}}catch(D){l={error:D}}finally{try{S&&!S.done&&(d=f.return)&&d.call(f)}finally{if(l)throw l.error}}}return De(c,h)}};return i}var Pe=function(e,t){return e.actions.forEach(function(r){var a=r.exec;return a&&a(e.context,t)})};function Mt(e){var t=e.initialState,r=Y.NotStarted,a=new Set,o={_machine:e,send:function(i){r===Y.Running&&(t=e.transition(t,i),Pe(t,Oe(i)),a.forEach(function(u){return u(t)}))},subscribe:function(i){return a.add(i),i(t),{unsubscribe:function(){return a.delete(i)}}},start:function(i){if(i){var u=typeof i=="object"?i:{context:e.config.context,value:i};t={value:u.value,actions:[],context:u.context,matches:ae(u.value)}}else t=e.initialState;return r=Y.Running,Pe(t,we),o},stop:function(){return r=Y.Stopped,a.clear(),o},get state(){return t},get status(){return r}};return o}var Rt=g.useLayoutEffect,Me={exports:{}},fe={},me={exports:{}},ye={};/**
208
- * @license React
209
- * use-sync-external-store-shim.production.min.js
210
- *
211
- * Copyright (c) Facebook, Inc. and its affiliates.
212
- *
213
- * This source code is licensed under the MIT license found in the
214
- * LICENSE file in the root directory of this source tree.
215
- */var Re;function kt(){if(Re)return ye;Re=1;var e=w.default;function t(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}var r=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,i=e.useLayoutEffect,u=e.useDebugValue;function n(c,h){var m=h(),p=a({inst:{value:m,getSnapshot:h}}),A=p[0].inst,f=p[1];return i(function(){A.value=m,A.getSnapshot=h,l(A)&&f({inst:A})},[c,m,h]),o(function(){return l(A)&&f({inst:A}),c(function(){l(A)&&f({inst:A})})},[c]),u(m),m}function l(c){var h=c.getSnapshot;c=c.value;try{var m=h();return!r(c,m)}catch{return!0}}function d(c,h){return h()}var _=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:n;return ye.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:_,ye}var he={};/**
216
- * @license React
217
- * use-sync-external-store-shim.development.js
218
- *
219
- * Copyright (c) Facebook, Inc. and its affiliates.
220
- *
221
- * This source code is licensed under the MIT license found in the
222
- * LICENSE file in the root directory of this source tree.
223
- */var ke;function $t(){return ke||(ke=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=w.default,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(b){{for(var s=arguments.length,y=new Array(s>1?s-1:0),E=1;E<s;E++)y[E-1]=arguments[E];a("error",b,y)}}function a(b,s,y){{var E=t.ReactDebugCurrentFrame,N=E.getStackAddendum();N!==""&&(s+="%s",y=y.concat([N]));var I=y.map(function(T){return String(T)});I.unshift("Warning: "+s),Function.prototype.apply.call(console[b],console,I)}}function o(b,s){return b===s&&(b!==0||1/b===1/s)||b!==b&&s!==s}var i=typeof Object.is=="function"?Object.is:o,u=e.useState,n=e.useEffect,l=e.useLayoutEffect,d=e.useDebugValue,_=!1,c=!1;function h(b,s,y){_||e.startTransition!==void 0&&(_=!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 E=s();if(!c){var N=s();i(E,N)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var I=u({inst:{value:E,getSnapshot:s}}),T=I[0].inst,O=I[1];return l(function(){T.value=E,T.getSnapshot=s,m(T)&&O({inst:T})},[b,E,s]),n(function(){m(T)&&O({inst:T});var M=function(){m(T)&&O({inst:T})};return b(M)},[b]),d(E),E}function m(b){var s=b.getSnapshot,y=b.value;try{var E=s();return!i(y,E)}catch{return!0}}function p(b,s,y){return s()}var A=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",f=!A,S=f?p:h,v=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:S;he.useSyncExternalStore=v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),he}var $e;function Ve(){return $e||($e=1,function(e){process.env.NODE_ENV==="production"?e.exports=kt():e.exports=$t()}(me)),me.exports}/**
224
- * @license React
225
- * use-sync-external-store-shim/with-selector.production.min.js
226
- *
227
- * Copyright (c) Facebook, Inc. and its affiliates.
228
- *
229
- * This source code is licensed under the MIT license found in the
230
- * LICENSE file in the root directory of this source tree.
231
- */var Fe;function Vt(){if(Fe)return fe;Fe=1;var e=w.default,t=Ve();function r(d,_){return d===_&&(d!==0||1/d===1/_)||d!==d&&_!==_}var a=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,i=e.useRef,u=e.useEffect,n=e.useMemo,l=e.useDebugValue;return fe.useSyncExternalStoreWithSelector=function(d,_,c,h,m){var p=i(null);if(p.current===null){var A={hasValue:!1,value:null};p.current=A}else A=p.current;p=n(function(){function S(E){if(!v){if(v=!0,b=E,E=h(E),m!==void 0&&A.hasValue){var N=A.value;if(m(N,E))return s=N}return s=E}if(N=s,a(b,E))return N;var I=h(E);return m!==void 0&&m(N,I)?N:(b=E,s=I)}var v=!1,b,s,y=c===void 0?null:c;return[function(){return S(_())},y===null?void 0:function(){return S(y())}]},[_,c,h,m]);var f=o(d,p[0],p[1]);return u(function(){A.hasValue=!0,A.value=f},[f]),l(f),f},fe}var _e={};/**
232
- * @license React
233
- * use-sync-external-store-shim/with-selector.development.js
234
- *
235
- * Copyright (c) Facebook, Inc. and its affiliates.
236
- *
237
- * This source code is licensed under the MIT license found in the
238
- * LICENSE file in the root directory of this source tree.
239
- */var xe;function Ft(){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=w.default,t=Ve();function r(_,c){return _===c&&(_!==0||1/_===1/c)||_!==_&&c!==c}var a=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,i=e.useRef,u=e.useEffect,n=e.useMemo,l=e.useDebugValue;function d(_,c,h,m,p){var A=i(null),f;A.current===null?(f={hasValue:!1,value:null},A.current=f):f=A.current;var S=n(function(){var y=!1,E,N,I=function($){if(!y){y=!0,E=$;var F=m($);if(p!==void 0&&f.hasValue){var W=f.value;if(p(W,F))return N=W,W}return N=F,F}var K=E,H=N;if(a(K,$))return H;var D=m($);return p!==void 0&&p(H,D)?H:(E=$,N=D,D)},T=h===void 0?null:h,O=function(){return I(c())},M=T===null?void 0:function(){return I(T())};return[O,M]},[c,h,m,p]),v=S[0],b=S[1],s=o(_,v,b);return u(function(){f.hasValue=!0,f.value=s},[s]),l(s),s}_e.useSyncExternalStoreWithSelector=d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),_e}(function(e){process.env.NODE_ENV==="production"?e.exports=Vt():e.exports=Ft()})(Me);function xt(e){var t=ve.useRef();return t.current||(t.current={v:e()}),t.current.v}var je=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var a=r.call(e),o,i=[],u;try{for(;(t===void 0||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(n){u={error:n}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(u)throw u.error}}return i};function jt(e){return e}var qt=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Ht(e,t){var r=g.useRef();if(process.env.NODE_ENV!=="production"){var a=je(g.useState(e),1),o=a[0];e!==o&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var i=je(xt(function(){var d=[],_=Mt(Ue(e.config,t||e._options)),c=_.send;return _.send=function(h){if(_.status===Y.NotStarted){d.push(h);return}c(h),r.current=_.state},[_,d]}),2),u=i[0],n=i[1];Rt(function(){t&&(u._machine._options=t)});var l=Wt(u);return g.useEffect(function(){return u.start(r.current),n.forEach(u.send),r.current=u.state,function(){u.stop()}},[]),l}var Bt=function(e,t){return t.changed===!1};function Wt(e){var t=g.useCallback(function(){return qt(e)},[e]),r=g.useCallback(function(o){var i=e.subscribe(o).unsubscribe;return i},[e]),a=Me.exports.useSyncExternalStoreWithSelector(r,t,t,jt,Bt);return[a,e.send,e]}function Yt({numCartLines:e,cartFragment:t,countryCode:r="US"}){const a=le(),o=g.useCallback(m=>a({query:At(t),variables:{id:m,numCartLines:e,country:r}}),[a,t,e,r]),i=g.useCallback(m=>a({query:Ce(t),variables:{input:m,numCartLines:e,country:r}}),[t,r,a,e]),u=g.useCallback((m,p)=>a({query:Et(t),variables:{cartId:m,lines:p,numCartLines:e,country:r}}),[t,r,a,e]),n=g.useCallback((m,p)=>a({query:St(t),variables:{cartId:m,lines:p,numCartLines:e,country:r}}),[t,r,a,e]),l=g.useCallback((m,p)=>a({query:pt(t),variables:{cartId:m,lines:p,numCartLines:e,country:r}}),[t,r,a,e]),d=g.useCallback((m,p)=>a({query:vt(t),variables:{cartId:m,note:p,numCartLines:e,country:r}}),[a,t,e,r]),_=g.useCallback((m,p)=>a({query:bt(t),variables:{cartId:m,buyerIdentity:p,numCartLines:e,country:r}}),[t,r,a,e]),c=g.useCallback((m,p)=>a({query:Ct(t),variables:{cartId:m,attributes:p,numCartLines:e,country:r}}),[t,r,a,e]),h=g.useCallback((m,p)=>a({query:Tt(t),variables:{cartId:m,discountCodes:p,numCartLines:e,country:r}}),[t,r,a,e]);return g.useMemo(()=>({cartFetch:o,cartCreate:i,cartLineAdd:u,cartLineUpdate:n,cartLineRemove:l,noteUpdate:d,buyerIdentityUpdate:_,cartAttributesUpdate:c,discountCodesUpdate:h,cartFragment:t}),[o,i,u,n,l,d,_,c,h,t])}function j(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[J({prevCart:r=>r==null?void 0:r.cart,cart:(r,a)=>{var o;return(o=a==null?void 0:a.payload)==null?void 0:o.cart},rawCartResult:(r,a)=>{var o;return(o=a==null?void 0:a.payload)==null?void 0:o.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[J({prevCart:r=>r==null?void 0:r.cart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,a)=>{var o;return(o=a==null?void 0:a.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:J({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ee={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[J({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>ge(t.payload.cart)})]}},qe={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 Gt(e){return Ue({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&ge(e)},states:{uninitialized:{on:ee},cartCompleted:{on:ee},initializationError:{on:ee},idle:{on:{...ee,...qe}},error:{on:{...ee,...qe}},cartFetching:j("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:j("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:j("cartLineRemoveAction"),cartLineUpdating:j("cartLineUpdateAction"),cartLineAdding:j("cartLineAddAction"),noteUpdating:j("noteUpdateAction"),buyerIdentityUpdating:j("buyerIdentityUpdateAction"),cartAttributesUpdating:j("cartAttributesUpdateAction"),discountCodesUpdating:j("discountCodesUpdateAction")}})}function Zt({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:a,data:o,cartFragment:i,countryCode:u}){const{cartFetch:n,cartCreate:l,cartLineAdd:d,cartLineUpdate:_,cartLineRemove:c,noteUpdate:h,buyerIdentityUpdate:m,cartAttributesUpdate:p,discountCodesUpdate:A}=Yt({numCartLines:e,cartFragment:i,countryCode:u}),f=g.useMemo(()=>Gt(o),[o]),[S,v,b]=Ht(f,{actions:{cartFetchAction:async(s,y)=>{var T;if(y.type!=="CART_FETCH")return;const{data:E,errors:N}=await n((T=y==null?void 0:y.payload)==null?void 0:T.cartId),I=q(y,E==null?void 0:E.cart,N);v(I)},cartCreateAction:async(s,y)=>{var T;if(y.type!=="CART_CREATE")return;const{data:E,errors:N}=await l(y==null?void 0:y.payload),I=q(y,(T=E==null?void 0:E.cartCreate)==null?void 0:T.cart,N);v(I)},cartLineAddAction:async(s,y)=>{var T,O;if(y.type!=="CARTLINE_ADD"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await d(s.cart.id,y.payload.lines),I=q(y,(O=E==null?void 0:E.cartLinesAdd)==null?void 0:O.cart,N);v(I)},cartLineUpdateAction:async(s,y)=>{var T,O;if(y.type!=="CARTLINE_UPDATE"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await _(s.cart.id,y.payload.lines),I=q(y,(O=E==null?void 0:E.cartLinesUpdate)==null?void 0:O.cart,N);v(I)},cartLineRemoveAction:async(s,y)=>{var T,O;if(y.type!=="CARTLINE_REMOVE"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await c(s.cart.id,y.payload.lines),I=q(y,(O=E==null?void 0:E.cartLinesRemove)==null?void 0:O.cart,N);v(I)},noteUpdateAction:async(s,y)=>{var T,O;if(y.type!=="NOTE_UPDATE"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await h(s.cart.id,y.payload.note),I=q(y,(O=E==null?void 0:E.cartNoteUpdate)==null?void 0:O.cart,N);v(I)},buyerIdentityUpdateAction:async(s,y)=>{var T,O;if(y.type!=="BUYER_IDENTITY_UPDATE"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await m(s.cart.id,y.payload.buyerIdentity),I=q(y,(O=E==null?void 0:E.cartBuyerIdentityUpdate)==null?void 0:O.cart,N);v(I)},cartAttributesUpdateAction:async(s,y)=>{var T,O;if(y.type!=="CART_ATTRIBUTES_UPDATE"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await p(s.cart.id,y.payload.attributes),I=q(y,(O=E==null?void 0:E.cartAttributesUpdate)==null?void 0:O.cart,N);v(I)},discountCodesUpdateAction:async(s,y)=>{var T,O;if(y.type!=="DISCOUNT_CODES_UPDATE"||!((T=s==null?void 0:s.cart)!=null&&T.id))return;const{data:E,errors:N}=await A(s.cart.id,y.payload.discountCodes),I=q(y,(O=E==null?void 0:E.cartDiscountCodesUpdate)==null?void 0:O.cart,N);v(I)},...t&&{onCartActionEntry:(s,y)=>{Kt(y)&&t(s,y)}},...r&&{onCartActionOptimisticUI:J((s,y)=>r(s,y))},...a&&{onCartActionComplete:(s,y)=>{zt(y)&&a(s,y)}}}});return g.useMemo(()=>[S,v,b],[S,v,b])}function ge(e){var t;return{...e,lines:x(e==null?void 0:e.lines),note:(t=e.note)!=null?t:void 0}}function q(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:ge(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function Kt(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 zt(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}var Qt="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/CartProvider.tsx";const He=g.createContext(null);function Xt(){const e=g.useContext(He);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Jt({children:e,numCartLines:t,onCreate:r,onLineAdd:a,onLineRemove:o,onLineUpdate:i,onNoteUpdate:u,onBuyerIdentityUpdate:n,onAttributesUpdate:l,onDiscountCodesUpdate:d,onCreateComplete:_,onLineAddComplete:c,onLineRemoveComplete:h,onLineUpdateComplete:m,onNoteUpdateComplete:p,onBuyerIdentityUpdateComplete:A,onAttributesUpdateComplete:f,onDiscountCodesUpdateComplete:S,data:v,cartFragment:b=nr,customerAccessToken:s,countryCode:y="US"}){var ut,ct,st,lt,dt,ft,mt;y&&(y=y.toUpperCase());const[E,N]=g.useState(y),[I,T]=g.useState(s),O=g.useRef(!1);(E!==y||I!==s)&&(N(y),T(s),O.current=!1);const[M,$]=Zt({numCartLines:t,data:v,cartFragment:b,countryCode:y,onCartActionEntry(C,R){try{switch(R.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return a==null?void 0:a();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return u==null?void 0:u();case"BUYER_IDENTITY_UPDATE":return n==null?void 0:n();case"CART_ATTRIBUTES_UPDATE":return l==null?void 0:l();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(V){console.error("Cart entry action failed",V)}},onCartActionOptimisticUI(C,R){var V,B,re,ne;if(!(C!=null&&C.cart))return{cart:void 0};switch(R.type){case"CARTLINE_REMOVE":return{...C,lastValidCart:C.cart,cart:{...C.cart,lines:(B=(V=C==null?void 0:C.cart)==null?void 0:V.lines)==null?void 0:B.filter(U=>(U==null?void 0:U.id)&&!R.payload.lines.includes(U==null?void 0:U.id))}};case"CARTLINE_UPDATE":return{...C,lastValidCart:C.cart,cart:{...C.cart,lines:(ne=(re=C==null?void 0:C.cart)==null?void 0:re.lines)==null?void 0:ne.map(U=>{const z=R.payload.lines.find(({id:ce})=>ce===(U==null?void 0:U.id));return z&&z.quantity?{...U,quantity:z.quantity}:U})}}}return{cart:C.cart?{...C.cart}:void 0}},onCartActionComplete(C,R){const V=R.payload.cartActionEvent;try{switch(R.type){case"RESOLVE":switch(V.type){case"CART_CREATE":return _==null?void 0:_();case"CARTLINE_ADD":return c==null?void 0:c();case"CARTLINE_REMOVE":return h==null?void 0:h();case"CARTLINE_UPDATE":return m==null?void 0:m();case"NOTE_UPDATE":return p==null?void 0:p();case"BUYER_IDENTITY_UPDATE":return rr(C,V)&&(O.current=!0),A==null?void 0:A();case"CART_ATTRIBUTES_UPDATE":return f==null?void 0:f();case"DISCOUNT_CODES_UPDATE":return S==null?void 0:S()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),F=g.useRef(!1),W=M.matches("cartCompleted"),K=(M.value==="idle"||M.value==="error"||M.value==="cartCompleted")&&y!==((st=(ct=(ut=M==null?void 0:M.context)==null?void 0:ut.cart)==null?void 0:ct.buyerIdentity)==null?void 0:st.countryCode)&&!M.context.errors,H=g.useRef(!1);g.useEffect(()=>{if(!F.current&&!H.current){if(!v&&Ee("localStorage")){H.current=!0;try{const C=window.localStorage.getItem(se);C&&$({type:"CART_FETCH",payload:{cartId:C}})}catch(C){console.warn("error fetching cartId"),console.warn(C)}}F.current=!0}},[v,F,$]),g.useEffect(()=>{!K||O.current||$({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:y,customerAccessToken:s}}})},[y,s,K,O,$]);const D=g.useCallback(C=>{if(!F.current)return console.warn("Cart isn't ready yet");$(C)},[$]);g.useEffect(()=>{var C,R,V;if(((R=(C=M==null?void 0:M.context)==null?void 0:C.cart)==null?void 0:R.id)&&Ee("localStorage"))try{window.localStorage.setItem(se,(V=M.context.cart)==null?void 0:V.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(dt=(lt=M==null?void 0:M.context)==null?void 0:lt.cart)==null?void 0:dt.id]),g.useEffect(()=>{if(W&&Ee("localStorage"))try{window.localStorage.removeItem(se)}catch(C){console.warn("Failed to delete cartId from localStorage",C)}},[W]);const G=g.useCallback(C=>{var R,V;y&&!((R=C.buyerIdentity)!=null&&R.countryCode)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.countryCode=y),s&&!((V=C.buyerIdentity)!=null&&V.customerAccessToken)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.customerAccessToken=s),D({type:"CART_CREATE",payload:C})},[y,s,D]),P=tr(M),ue=g.useMemo(()=>{var C,R,V,B,re,ne;return{...(R=(C=P==null?void 0:P.context)==null?void 0:C.cart)!=null?R:{lines:[],attributes:[]},status:er(P.value),error:(V=P==null?void 0:P.context)==null?void 0:V.errors,totalQuantity:(ne=(re=(B=P==null?void 0:P.context)==null?void 0:B.cart)==null?void 0:re.totalQuantity)!=null?ne:0,cartCreate:G,linesAdd(U){var z,ce;(ce=(z=P==null?void 0:P.context)==null?void 0:z.cart)!=null&&ce.id?D({type:"CARTLINE_ADD",payload:{lines:U}}):G({lines:U})},linesRemove(U){D({type:"CARTLINE_REMOVE",payload:{lines:U}})},linesUpdate(U){D({type:"CARTLINE_UPDATE",payload:{lines:U}})},noteUpdate(U){D({type:"NOTE_UPDATE",payload:{note:U}})},buyerIdentityUpdate(U){D({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:U}})},cartAttributesUpdate(U){D({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:U}})},discountCodesUpdate(U){D({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:U}})},cartFragment:b}},[G,(ft=P==null?void 0:P.context)==null?void 0:ft.cart,(mt=P==null?void 0:P.context)==null?void 0:mt.errors,P.value,b,D]);return w.default.createElement(He.Provider,{value:ue,__self:this,__source:{fileName:Qt,lineNumber:425,columnNumber:5}},e)}function er(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 tr(e){const[t,r]=g.useTransition(),[a,o]=g.useState(e),i=g.useRef(!1);t&&(i.current=!0);const u=g.useRef(!1);return!t&&i.current&&(u.current=!0),g.useEffect(()=>{r(()=>{u.current||o(e)})},[e]),u.current?e:a}function Ee(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 rr(e,t){var r,a;return t.payload.buyerIdentity.countryCode&&((a=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:a.countryCode)!==t.payload.buyerIdentity.countryCode}const nr=`
139
+ `,X="2022-10";var Mr="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopifyProvider.tsx";const Ve=g.createContext({storeDomain:"test.myshopify.com",storefrontToken:"abc123",storefrontApiVersion:X,country:{isoCode:"US"},language:{isoCode:"EN"},locale:"EN-US"});function $r({children:e,shopifyConfig:r}){if(!r)throw new Error("The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'");r.storefrontApiVersion!==X&&console.warn(`This version of Hydrogen-UI is built for Shopify's Storefront API version ${X}, but it looks like you're using version ${r.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`);const t=g.useMemo(()=>({...r,storeDomain:r.storeDomain.replace(/^https?:\/\//,"")}),[r]);return w.default.createElement(Ve.Provider,{value:t,__self:this,__source:{fileName:Mr,lineNumber:49,columnNumber:5}},e)}function J(){const e=g.useContext(Ve);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const _e="shopifyCartId",Vr="X-Shopify-Storefront-Access-Token",kr="Shopify-Storefront-Id",Fr="Shopify-Storefront-Y",xr="Shopify-Storefront-S",ke="_shopify_y",Fe="_shopify_s";var jr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function qr(e){let r={},t,a,o=0,i=e.split(/;\s*/g),u,n;for(;o<i.length;o++)if(a=i[o],t=a.indexOf("="),~t){if(u=a.substring(0,t++).trim(),n=a.substring(t).trim(),n[0]==='"'&&(n=n.substring(1,n.length-1)),~n.indexOf("%"))try{n=decodeURIComponent(n)}catch{}jr.has(a=u.toLowerCase())?a==="expires"?r.expires=new Date(n):a==="max-age"?r.maxage=+n:r[a]=n:r[u]=n}else(u=a.trim().toLowerCase())&&(u==="httponly"||u==="secure")&&(r[u]=!0);return r}function Hr(){const{storeDomain:e,storefrontApiVersion:r,storefrontToken:t,storefrontId:a}=J();return g.useCallback(({query:o,variables:i})=>{const u={"Content-Type":"application/json","X-SDK-Variant":"hydrogen","X-SDK-Version":r,[Vr]:t};a&&(u[kr]=a);const n=qr(document.cookie);return n[ke]&&n[Fe]&&(u[Fr]=n[ke],u[xr]=n[Fe]),fetch(`https://${e}/api/${r}/graphql.json`,{method:"POST",headers:u,body:JSON.stringify({query:o.toString(),variables:i})}).then(l=>l.json()).catch(l=>({data:void 0,errors:l.toString()}))},[e,r,t,a])}function Br({numCartLines:e,cartFragment:r,countryCode:t="US"}){const a=Hr(),o=g.useCallback(_=>a({query:Rr(r),variables:{id:_,numCartLines:e,country:t}}),[a,r,e,t]),i=g.useCallback(_=>a({query:wr(r),variables:{input:_,numCartLines:e,country:t}}),[r,t,a,e]),u=g.useCallback((_,p)=>a({query:Nr(r),variables:{cartId:_,lines:p,numCartLines:e,country:t}}),[r,t,a,e]),n=g.useCallback((_,p)=>a({query:Or(r),variables:{cartId:_,lines:p,numCartLines:e,country:t}}),[r,t,a,e]),l=g.useCallback((_,p)=>a({query:Ir(r),variables:{cartId:_,lines:p,numCartLines:e,country:t}}),[r,t,a,e]),d=g.useCallback((_,p)=>a({query:Dr(r),variables:{cartId:_,note:p,numCartLines:e,country:t}}),[a,r,e,t]),h=g.useCallback((_,p)=>a({query:Lr(r),variables:{cartId:_,buyerIdentity:p,numCartLines:e,country:t}}),[r,t,a,e]),s=g.useCallback((_,p)=>a({query:Ur(r),variables:{cartId:_,attributes:p,numCartLines:e,country:t}}),[r,t,a,e]),m=g.useCallback((_,p)=>a({query:Pr(r),variables:{cartId:_,discountCodes:p,numCartLines:e,country:t}}),[r,t,a,e]);return g.useMemo(()=>({cartFetch:o,cartCreate:i,cartLineAdd:u,cartLineUpdate:n,cartLineRemove:l,noteUpdate:d,buyerIdentityUpdate:h,cartAttributesUpdate:s,discountCodesUpdate:m,cartFragment:r}),[o,i,u,n,l,d,h,s,m,r])}function x(e,r){return{entry:[...(r==null?void 0:r.entryActions)||[],"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(r==null?void 0:r.resolveTarget)||"idle",actions:[Q({prevCart:t=>t==null?void 0:t.cart,cart:(t,a)=>{var o;return(o=a==null?void 0:a.payload)==null?void 0:o.cart},rawCartResult:(t,a)=>{var o;return(o=a==null?void 0:a.payload)==null?void 0:o.rawCartResult},errors:t=>{}})]},ERROR:{target:(r==null?void 0:r.errorTarget)||"error",actions:[Q({prevCart:t=>t==null?void 0:t.cart,cart:t=>t==null?void 0:t.lastValidCart,errors:(t,a)=>{var o;return(o=a==null?void 0:a.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:Q({prevCart:t=>{},cart:t=>{},lastValidCart:t=>{},errors:t=>{}})}},exit:["onCartActionComplete",...(r==null?void 0:r.exitActions)||[]]}}const ee={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[Q({rawCartResult:(e,r)=>r.payload.cart,cart:(e,r)=>he(r.payload.cart)})]}},xe={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 Wr(e){return we({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&he(e)},states:{uninitialized:{on:ee},cartCompleted:{on:ee},initializationError:{on:ee},idle:{on:{...ee,...xe}},error:{on:{...ee,...xe}},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 Yr({numCartLines:e,onCartActionEntry:r,onCartActionOptimisticUI:t,onCartActionComplete:a,data:o,cartFragment:i,countryCode:u}){const{cartFetch:n,cartCreate:l,cartLineAdd:d,cartLineUpdate:h,cartLineRemove:s,noteUpdate:m,buyerIdentityUpdate:_,cartAttributesUpdate:p,discountCodesUpdate:A}=Br({numCartLines:e,cartFragment:i,countryCode:u}),f=g.useMemo(()=>Wr(o),[o]),[S,v,b]=Tr(f,{actions:{cartFetchAction:async(c,y)=>{var C;if(y.type!=="CART_FETCH")return;const{data:E,errors:N}=await n((C=y==null?void 0:y.payload)==null?void 0:C.cartId),I=j(y,E==null?void 0:E.cart,N);v(I)},cartCreateAction:async(c,y)=>{var C;if(y.type!=="CART_CREATE")return;const{data:E,errors:N}=await l(y==null?void 0:y.payload),I=j(y,(C=E==null?void 0:E.cartCreate)==null?void 0:C.cart,N);v(I)},cartLineAddAction:async(c,y)=>{var C,O;if(y.type!=="CARTLINE_ADD"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await d(c.cart.id,y.payload.lines),I=j(y,(O=E==null?void 0:E.cartLinesAdd)==null?void 0:O.cart,N);v(I)},cartLineUpdateAction:async(c,y)=>{var C,O;if(y.type!=="CARTLINE_UPDATE"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await h(c.cart.id,y.payload.lines),I=j(y,(O=E==null?void 0:E.cartLinesUpdate)==null?void 0:O.cart,N);v(I)},cartLineRemoveAction:async(c,y)=>{var C,O;if(y.type!=="CARTLINE_REMOVE"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await s(c.cart.id,y.payload.lines),I=j(y,(O=E==null?void 0:E.cartLinesRemove)==null?void 0:O.cart,N);v(I)},noteUpdateAction:async(c,y)=>{var C,O;if(y.type!=="NOTE_UPDATE"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await m(c.cart.id,y.payload.note),I=j(y,(O=E==null?void 0:E.cartNoteUpdate)==null?void 0:O.cart,N);v(I)},buyerIdentityUpdateAction:async(c,y)=>{var C,O;if(y.type!=="BUYER_IDENTITY_UPDATE"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await _(c.cart.id,y.payload.buyerIdentity),I=j(y,(O=E==null?void 0:E.cartBuyerIdentityUpdate)==null?void 0:O.cart,N);v(I)},cartAttributesUpdateAction:async(c,y)=>{var C,O;if(y.type!=="CART_ATTRIBUTES_UPDATE"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await p(c.cart.id,y.payload.attributes),I=j(y,(O=E==null?void 0:E.cartAttributesUpdate)==null?void 0:O.cart,N);v(I)},discountCodesUpdateAction:async(c,y)=>{var C,O;if(y.type!=="DISCOUNT_CODES_UPDATE"||!((C=c==null?void 0:c.cart)!=null&&C.id))return;const{data:E,errors:N}=await A(c.cart.id,y.payload.discountCodes),I=j(y,(O=E==null?void 0:E.cartDiscountCodesUpdate)==null?void 0:O.cart,N);v(I)},...r&&{onCartActionEntry:(c,y)=>{Gr(y)&&r(c,y)}},...t&&{onCartActionOptimisticUI:Q((c,y)=>t(c,y))},...a&&{onCartActionComplete:(c,y)=>{Zr(y)&&a(c,y)}}}});return g.useMemo(()=>[S,v,b],[S,v,b])}function he(e){var r;return{...e,lines:B(e==null?void 0:e.lines),note:(r=e.note)!=null?r:void 0}}function j(e,r,t){return t?{type:"ERROR",payload:{errors:t,cartActionEvent:e}}:r?{type:"RESOLVE",payload:{cart:he(r),rawCartResult:r,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function Gr(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 Zr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}var Kr="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/CartProvider.tsx";const je=g.createContext(null);function zr(){const e=g.useContext(je);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Qr({children:e,numCartLines:r,onCreate:t,onLineAdd:a,onLineRemove:o,onLineUpdate:i,onNoteUpdate:u,onBuyerIdentityUpdate:n,onAttributesUpdate:l,onDiscountCodesUpdate:d,onCreateComplete:h,onLineAddComplete:s,onLineRemoveComplete:m,onLineUpdateComplete:_,onNoteUpdateComplete:p,onBuyerIdentityUpdateComplete:A,onAttributesUpdateComplete:f,onDiscountCodesUpdateComplete:S,data:v,cartFragment:b=rt,customerAccessToken:c,countryCode:y="US"}){var ir,or,ur,cr,sr,lr,dr;y&&(y=y.toUpperCase());const[E,N]=g.useState(y),[I,C]=g.useState(c),O=g.useRef(!1);(E!==y||I!==c)&&(N(y),C(c),O.current=!1);const[R,V]=Yr({numCartLines:r,data:v,cartFragment:b,countryCode:y,onCartActionEntry(T,M){try{switch(M.type){case"CART_CREATE":return t==null?void 0:t();case"CARTLINE_ADD":return a==null?void 0:a();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return u==null?void 0:u();case"BUYER_IDENTITY_UPDATE":return n==null?void 0:n();case"CART_ATTRIBUTES_UPDATE":return l==null?void 0:l();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(k){console.error("Cart entry action failed",k)}},onCartActionOptimisticUI(T,M){var k,H,te,ne;if(!(T!=null&&T.cart))return{cart:void 0};switch(M.type){case"CARTLINE_REMOVE":return{...T,lastValidCart:T.cart,cart:{...T.cart,lines:(H=(k=T==null?void 0:T.cart)==null?void 0:k.lines)==null?void 0:H.filter(L=>(L==null?void 0:L.id)&&!M.payload.lines.includes(L==null?void 0:L.id))}};case"CARTLINE_UPDATE":return{...T,lastValidCart:T.cart,cart:{...T.cart,lines:(ne=(te=T==null?void 0:T.cart)==null?void 0:te.lines)==null?void 0:ne.map(L=>{const z=M.payload.lines.find(({id:ce})=>ce===(L==null?void 0:L.id));return z&&z.quantity?{...L,quantity:z.quantity}:L})}}}return{cart:T.cart?{...T.cart}:void 0}},onCartActionComplete(T,M){const k=M.payload.cartActionEvent;try{switch(M.type){case"RESOLVE":switch(k.type){case"CART_CREATE":return h==null?void 0:h();case"CARTLINE_ADD":return s==null?void 0:s();case"CARTLINE_REMOVE":return m==null?void 0:m();case"CARTLINE_UPDATE":return _==null?void 0:_();case"NOTE_UPDATE":return p==null?void 0:p();case"BUYER_IDENTITY_UPDATE":return et(T,k)&&(O.current=!0),A==null?void 0:A();case"CART_ATTRIBUTES_UPDATE":return f==null?void 0:f();case"DISCOUNT_CODES_UPDATE":return S==null?void 0:S()}}}catch(H){console.error("onCartActionComplete failed",H)}}}),F=g.useRef(!1),W=R.matches("cartCompleted"),K=(R.value==="idle"||R.value==="error"||R.value==="cartCompleted")&&y!==((ur=(or=(ir=R==null?void 0:R.context)==null?void 0:ir.cart)==null?void 0:or.buyerIdentity)==null?void 0:ur.countryCode)&&!R.context.errors,q=g.useRef(!1);g.useEffect(()=>{if(!F.current&&!q.current){if(!v&&ge("localStorage")){q.current=!0;try{const T=window.localStorage.getItem(_e);T&&V({type:"CART_FETCH",payload:{cartId:T}})}catch(T){console.warn("error fetching cartId"),console.warn(T)}}F.current=!0}},[v,F,V]),g.useEffect(()=>{!K||O.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:y,customerAccessToken:c}}})},[y,c,K,O,V]);const D=g.useCallback(T=>{if(!F.current)return console.warn("Cart isn't ready yet");V(T)},[V]);g.useEffect(()=>{var T,M,k;if(((M=(T=R==null?void 0:R.context)==null?void 0:T.cart)==null?void 0:M.id)&&ge("localStorage"))try{window.localStorage.setItem(_e,(k=R.context.cart)==null?void 0:k.id)}catch(H){console.warn("Failed to save cartId to localStorage",H)}},[(sr=(cr=R==null?void 0:R.context)==null?void 0:cr.cart)==null?void 0:sr.id]),g.useEffect(()=>{if(W&&ge("localStorage"))try{window.localStorage.removeItem(_e)}catch(T){console.warn("Failed to delete cartId from localStorage",T)}},[W]);const G=g.useCallback(T=>{var M,k;y&&!((M=T.buyerIdentity)!=null&&M.countryCode)&&(T.buyerIdentity==null&&(T.buyerIdentity={}),T.buyerIdentity.countryCode=y),c&&!((k=T.buyerIdentity)!=null&&k.customerAccessToken)&&(T.buyerIdentity==null&&(T.buyerIdentity={}),T.buyerIdentity.customerAccessToken=c),D({type:"CART_CREATE",payload:T})},[y,c,D]),P=Jr(R),ue=g.useMemo(()=>{var T,M,k,H,te,ne;return{...(M=(T=P==null?void 0:P.context)==null?void 0:T.cart)!=null?M:{lines:[],attributes:[]},status:Xr(P.value),error:(k=P==null?void 0:P.context)==null?void 0:k.errors,totalQuantity:(ne=(te=(H=P==null?void 0:P.context)==null?void 0:H.cart)==null?void 0:te.totalQuantity)!=null?ne:0,cartCreate:G,linesAdd(L){var z,ce;(ce=(z=P==null?void 0:P.context)==null?void 0:z.cart)!=null&&ce.id?D({type:"CARTLINE_ADD",payload:{lines:L}}):G({lines:L})},linesRemove(L){D({type:"CARTLINE_REMOVE",payload:{lines:L}})},linesUpdate(L){D({type:"CARTLINE_UPDATE",payload:{lines:L}})},noteUpdate(L){D({type:"NOTE_UPDATE",payload:{note:L}})},buyerIdentityUpdate(L){D({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:L}})},cartAttributesUpdate(L){D({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:L}})},discountCodesUpdate(L){D({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:L}})},cartFragment:b}},[G,(lr=P==null?void 0:P.context)==null?void 0:lr.cart,(dr=P==null?void 0:P.context)==null?void 0:dr.errors,P.value,b,D]);return w.default.createElement(je.Provider,{value:ue,__self:this,__source:{fileName:Kr,lineNumber:425,columnNumber:5}},e)}function Xr(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 Jr(e){const[r,t]=g.useTransition(),[a,o]=g.useState(e),i=g.useRef(!1);r&&(i.current=!0);const u=g.useRef(!1);return!r&&i.current&&(u.current=!0),g.useEffect(()=>{t(()=>{u.current||o(e)})},[e]),u.current?e:a}function ge(e){let r;try{r=window[e];const t="__storage_test__";return r.setItem(t,t),r.removeItem(t),!0}catch(t){return t instanceof DOMException&&(t.code===22||t.code===1014||t.name==="QuotaExceededError"||t.name==="NS_ERROR_DOM_QUOTA_REACHED")&&r&&r.length!==0}}function et(e,r){var t,a;return r.payload.buyerIdentity.countryCode&&((a=(t=e.cart)==null?void 0:t.buyerIdentity)==null?void 0:a.countryCode)!==r.payload.buyerIdentity.countryCode}const rt=`
240
140
  fragment CartFragment on Cart {
241
141
  id
242
142
  checkoutUrl
@@ -335,6 +235,6 @@ fragment ImageFragment on Image {
335
235
  width
336
236
  height
337
237
  }
338
- `;var ar="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ExternalVideo.tsx";function Be(e){var _,c;const{data:t,options:r,id:a=t.id,frameBorder:o="0",allow:i="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:u=!0,loading:n="lazy",...l}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let d=t.embedUrl;if(r){const h=new URL(t.embedUrl);for(const m of Object.keys(r))h.searchParams.set(m,r[m]);d=h.toString()}return w.default.createElement("iframe",{...l,id:a!=null?a:t.embedUrl,title:(c=(_=t.alt)!=null?_:t.id)!=null?c:"external video",frameBorder:o,allow:i,allowFullScreen:u,src:d,loading:n,__self:this,__source:{fileName:ar,lineNumber:56,columnNumber:5}})}const ir=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],or=["spin.dev"],ur=[...ir,...or],te=[352,832,1200,1920,2560];function We({src:e,width:t,height:r,crop:a,scale:o}){const i=new URL(e),u=o!=null?o:1;if(t){let n;typeof t=="string"?n=(te[0]*u).toString():n=(Number(t)*u).toString(),i.searchParams.append("width",n)}return r&&typeof r=="number"&&i.searchParams.append("height",(r*u).toString()),a&&i.searchParams.append("crop",a),i.toString()}function Ye(e){const t=new URL(e.src);return!ur.some(a=>t.hostname.endsWith(a))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:We(e)}function cr({data:e,loaderOptions:t,elementProps:r}){var o,i,u,n,l,d;let a=null;return(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&(a=(e==null?void 0:e.width)/(e==null?void 0:e.height)),(t==null?void 0:t.width)||(t==null?void 0:t.height)?{width:(o=t==null?void 0:t.width)!=null?o:a&&typeof t.height=="number"?Math.round(a*t.height):null,height:(i=t==null?void 0:t.height)!=null?i:a&&typeof t.width=="number"?Math.round(a*t.width):null}:(r==null?void 0:r.width)||(r==null?void 0:r.height)?{width:(u=r==null?void 0:r.width)!=null?u:a&&typeof r.height=="number"?Math.round(a*r.height):null,height:(n=r==null?void 0:r.height)!=null?n:a&&typeof r.width=="number"?Math.round(a*r.width):null}:(e==null?void 0:e.width)||(e==null?void 0:e.height)?{width:(l=e==null?void 0:e.width)!=null?l:null,height:(d=e==null?void 0:e.height)!=null?d:null}:{width:null,height:null}}var sr="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Image.tsx";function ie({data:e,width:t,height:r,loading:a,loader:o=Ye,loaderOptions:i,widths:u,decoding:n="async",...l}){var p,A,f,S,v,b;if(!e.url){const s=`<Image/>: the 'data' prop requires the 'url' property. Image: ${(p=e.id)!=null?p:"no ID provided"}`;return console.error(s),null}const{width:d,height:_}=cr({data:e,loaderOptions:i,elementProps:{width:t,height:r}});let c=e.url;if(o&&(c=o({...i,src:e.url,width:d,height:_}),typeof c!="string"||!c))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${(A=e.id)!=null?A:e.url}`);const h=t&&d&&t<d?t:d,m=(f=l.srcSet)!=null?f:lr({...i,widths:u,src:e.url,width:h,height:_,loader:o});return ve.createElement("img",{id:(S=e.id)!=null?S:"",alt:(b=(v=e.altText)!=null?v:l.alt)!=null?b:"",loading:a!=null?a:"lazy",...l,src:c,width:d!=null?d:void 0,height:_!=null?_:void 0,srcSet:m,decoding:n,__self:this,__source:{fileName:sr,lineNumber:150,columnNumber:5}})}function lr({src:e,width:t,crop:r,scale:a,widths:o,loader:i,height:u}){const n=o&&Array.isArray(o);if(n&&o.some(c=>isNaN(c)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let l=1;t&&u&&(l=Number(u)/Number(t));let d=n?o:te;!n&&t&&t<te[te.length-1]&&(d=te.filter(c=>c<=t));const _=i||We;return d.map(c=>`${_({src:e,width:c,height:r?Number(c)*l:void 0,crop:r,scale:a})} ${c}w`).join(", ")}var Ge="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Video.tsx";function pe(e){var d,_;const{data:t,previewImageOptions:r,id:a=t.id,playsInline:o=!0,controls:i=!0,sourceProps:u={},...n}=e,l=Ye({src:(_=(d=t.previewImage)==null?void 0:d.url)!=null?_:"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return w.default.createElement("video",{...n,id:a,playsInline:o,controls:i,poster:l,__self:this,__source:{fileName:Ge,lineNumber:42,columnNumber:5}},t.sources.map(c=>{if(!((c==null?void 0:c.url)&&(c==null?void 0:c.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return w.default.createElement("source",{...u,key:c.url,src:c.url,type:c.mimeType,__self:this,__source:{fileName:Ge,lineNumber:54,columnNumber:11}})}))}const Ze={};function dr(e,t){const r=Ze[e];if(r)return r;const a=new Promise((o,i)=>{const u=document.createElement("script");t!=null&&t.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{o(!0)},u.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(u):document.body.appendChild(u)});return Ze[e]=a,a}function Ke(e,t){const[r,a]=g.useState("loading"),o=JSON.stringify(t);return g.useEffect(()=>{async function i(){try{a("loading"),await dr(e,t),a("done")}catch{a("error")}}i()},[e,o,t]),r}var fr="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ModelViewer.tsx";function ze(e){var d,_,c,h,m,p,A,f,S,v,b;const[t,r]=g.useState(void 0),a=g.useCallback(s=>{r(s)},[]),{data:o,children:i,className:u,...n}=e,l=Ke("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return g.useEffect(()=>{if(!!t)return n.onError&&t.addEventListener("error",n.onError),n.onLoad&&t.addEventListener("load",n.onLoad),n.onPreload&&t.addEventListener("preload",n.onPreload),n.onModelVisibility&&t.addEventListener("model-visibility",n.onModelVisibility),n.onProgress&&t.addEventListener("progress",n.onProgress),n.onArStatus&&t.addEventListener("ar-status",n.onArStatus),n.onArTracking&&t.addEventListener("ar-tracking",n.onArTracking),n.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",n.onQuickLookButtonTapped),n.onCameraChange&&t.addEventListener("camera-change",n.onCameraChange),n.onEnvironmentChange&&t.addEventListener("environment-change",n.onEnvironmentChange),n.onPlay&&t.addEventListener("play",n.onPlay),n.onPause&&t.addEventListener("ar-status",n.onPause),n.onSceneGraphReady&&t.addEventListener("scene-graph-ready",n.onSceneGraphReady),()=>{t!=null&&(n.onError&&t.removeEventListener("error",n.onError),n.onLoad&&t.removeEventListener("load",n.onLoad),n.onPreload&&t.removeEventListener("preload",n.onPreload),n.onModelVisibility&&t.removeEventListener("model-visibility",n.onModelVisibility),n.onProgress&&t.removeEventListener("progress",n.onProgress),n.onArStatus&&t.removeEventListener("ar-status",n.onArStatus),n.onArTracking&&t.removeEventListener("ar-tracking",n.onArTracking),n.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",n.onQuickLookButtonTapped),n.onCameraChange&&t.removeEventListener("camera-change",n.onCameraChange),n.onEnvironmentChange&&t.removeEventListener("environment-change",n.onEnvironmentChange),n.onPlay&&t.removeEventListener("play",n.onPlay),n.onPause&&t.removeEventListener("ar-status",n.onPause),n.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",n.onSceneGraphReady))}},[t,n.onArStatus,n.onArTracking,n.onCameraChange,n.onEnvironmentChange,n.onError,n.onLoad,n.onModelVisibility,n.onPause,n.onPlay,n.onPreload,n.onProgress,n.onQuickLookButtonTapped,n.onSceneGraphReady]),l!=="done"?null:(_=(d=o.sources)==null?void 0:d[0])!=null&&_.url?w.default.createElement("model-viewer",{ref:a,...n,className:u,id:(c=n.id)!=null?c:o.id,src:o.sources[0].url,alt:(h=o.alt)!=null?h:null,"camera-controls":(m=n.cameraControls)!=null?m:!0,poster:(A=n.poster||((p=o.previewImage)==null?void 0:p.url))!=null?A:null,autoplay:(f=n.autoplay)!=null?f:!0,loading:n.loading,reveal:n.reveal,ar:n.ar,"ar-modes":n.arModes,"ar-scale":n.arScale,"ar-placement":n.arPlacement,"ios-src":n.iosSrc,"touch-action":n.touchAction,"disable-zoom":n.disableZoom,"orbit-sensitivity":n.orbitSensitivity,"auto-rotate":n.autoRotate,"auto-rotate-delay":n.autoRotateDelay,"rotation-per-second":n.rotationPerSecond,"interaction-policy":n.interactionPolicy,"interaction-prompt":n.interactionPrompt,"interaction-prompt-style":n.interactionPromptStyle,"interaction-prompt-threshold":n.interactionPromptThreshold,"camera-orbit":n.cameraOrbit,"camera-target":n.cameraTarget,"field-of-view":n.fieldOfView,"max-camera-orbit":n.maxCameraOrbit,"min-camera-orbit":n.minCameraOrbit,"max-field-of-view":n.maxFieldOfView,"min-field-of-view":n.minFieldOfView,bounds:n.bounds,"interpolation-decay":(S=n.interpolationDecay)!=null?S:100,"skybox-image":n.skyboxImage,"environment-image":n.environmentImage,exposure:n.exposure,"shadow-intensity":(v=n.shadowIntensity)!=null?v:0,"shadow-softness":(b=n.shadowSoftness)!=null?b:0,"animation-name":n.animationName,"animation-crossfade-duration":n.animationCrossfadeDuration,"variant-name":n.variantName,orientation:n.orientation,scale:n.scale,__self:this,__source:{fileName:fr,lineNumber:222,columnNumber:5}},i):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}var oe="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/MediaFile.tsx";function mr({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?w.default.createElement(ie,{...r,...t==null?void 0:t.image,data:e.image,__self:this,__source:{fileName:oe,lineNumber:50,columnNumber:9}}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return w.default.createElement(pe,{...r,...t==null?void 0:t.video,data:e,__self:this,__source:{fileName:oe,lineNumber:59,columnNumber:9}});case"ExternalVideo":return w.default.createElement(Be,{...r,...t==null?void 0:t.externalVideo,data:e,__self:this,__source:{fileName:oe,lineNumber:64,columnNumber:9}});case"Model3d":return w.default.createElement(ze,{...r,...t==null?void 0:t.modelViewer,data:e,__self:this,__source:{fileName:oe,lineNumber:73,columnNumber:9}});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to correctly render the correct component for this media. Rendering 'null' by default"),null}}var k="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Metafield.tsx";function yr(e){var n,l,d,_,c,h,m,p,A;const{data:t,as:r,...a}=e,{locale:o}=X(),i=g.useMemo(()=>Qe(t),[t]);if(!i)return console.warn("<Metafield/>: nothing was passed to the data prop 'data'. Rendering 'null'"),null;if(i.value===null||i.value===void 0){const f=`<Metafield/>: No metafield value for metafield ${(n=i.id)!=null?n:i.key}. Rendering 'null'`;return console.warn(f),null}switch(i.type){case"date":{const f=r!=null?r:"time";return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:68,columnNumber:9}},i.value.toLocaleDateString(o))}case"date_time":{const f=r!=null?r:"time";return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:76,columnNumber:9}},i.value.toLocaleString(o))}case"weight":case"dimension":case"volume":{const f=r!=null?r:"span";return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:86,columnNumber:9}},gr(i.value,o))}case"rating":{const f=r!=null?r:"span";return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:94,columnNumber:9}},i.value.value)}case"single_line_text_field":{const f=r!=null?r:"span";return w.default.createElement(f,{...a,dangerouslySetInnerHTML:{__html:i.value},__self:this,__source:{fileName:k,lineNumber:102,columnNumber:9}})}case"multi_line_text_field":{const f=r!=null?r:"div";return w.default.createElement(f,{...a,dangerouslySetInnerHTML:{__html:i.value.split(`
339
- `).join("<br/>")},__self:this,__source:{fileName:k,lineNumber:111,columnNumber:9}})}case"url":{const f=new URL(i.value);return w.default.createElement("a",{href:f.href.replace(f.protocol,""),...a,__self:this,__source:{fileName:k,lineNumber:122,columnNumber:9}},i.value)}case"json":{const f=r!=null?r:"span";return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:133,columnNumber:9}},JSON.stringify(i.value))}case"product_reference":case"variant_reference":case"page_reference":{const f=r!=null?r:"span",S=i.reference;return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:144,columnNumber:9}},(d=(l=S==null?void 0:S.title)!=null?l:S==null?void 0:S.id)!=null?d:"")}case"list.single_line_text_field":{const f=r!=null?r:"ul",S=i.references?x(i.references):[];return w.default.createElement(f,{...a,__self:this,__source:{fileName:k,lineNumber:155,columnNumber:9}},S.map((v,b)=>w.default.createElement("li",{key:`${v!=null?v:""}-${b}`,__self:this,__source:{fileName:k,lineNumber:159,columnNumber:13}},v)))}case"file_reference":if(((_=i.reference)==null?void 0:_.__typename)==="MediaImage"){const f=i.reference;return f.image?w.default.createElement(ie,{data:f.image,...a,__self:this,__source:{fileName:k,lineNumber:168,columnNumber:11}}):null}else if(((c=i.reference)==null?void 0:c.__typename)==="GenericFile"){const f=i.reference;return f.previewImage?w.default.createElement("a",{href:(m=(h=i.reference)==null?void 0:h.url)!=null?m:"",...a,__self:this,__source:{fileName:k,lineNumber:173,columnNumber:11}},w.default.createElement(ie,{data:f.previewImage,__self:this,__source:{fileName:k,lineNumber:174,columnNumber:13}})):null}else if(((p=i.reference)==null?void 0:p.__typename)==="Video"){const f=i.reference;return w.default.createElement(pe,{...a,data:f,__self:this,__source:{fileName:k,lineNumber:179,columnNumber:16}})}}const u=r!=null?r:"span";return w.default.createElement(u,{...a,__self:this,__source:{fileName:k,lineNumber:186,columnNumber:5}},(A=i.value)==null?void 0:A.toString())}function Qe(e){return e?{...e,value:Xe(e)}:null}function Xe(e){if(!e)return null;if(e.value===null||e.value===void 0)return e.value;switch(e.type){case"boolean":return e.value==="true";case"number_integer":return parseInt(e.value);case"number_decimal":return parseFloat(e.value);case"date":case"date_time":return new Date(e.value);case"json":case"weight":case"dimension":case"volume":case"rating":return hr(e.value);case"color":case"single_line_text_field":case"multi_line_text_field":case"product_reference":case"page_reference":case"variant_reference":case"file_reference":case"url":default:return e.value}}function hr(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}const _r={mm:"millimeter",cm:"centimeter",m:"meter",in:"inch",ft:"foot",yd:"yard",ml:"milliliter",l:"liter",us_fl_oz:"fluid-ounce",us_gal:"gallon",kg:"kilogram",g:"gram",lb:"pound",oz:"ounce"};function gr(e,t="en-us",r={}){let a={value:e.value,unit:_r[e.unit]};return a.unit==null&&(a=Er(e.value,e.unit)),new Intl.NumberFormat(t,{...r,unit:a.unit,style:"unit"}).format(a.value)}function Er(e,t){switch(t){case"cl":return{value:e/1e3,unit:"liter"};case"m3":return{value:e*1e3,unit:"liter"};case"us_pt":return{value:e*.125,unit:"gallon"};case"us_qt":return{value:e*.5,unit:"gallon"};case"us_oz":return{value:e/128,unit:"gallon"};case"imp_pt":return{value:e/6.661,unit:"gallon"};case"imp_qt":return{value:e/3.331,unit:"gallon"};case"imp_gal":return{value:e/1.201,unit:"gallon"};case"imp_fl_oz":return{value:e*.96076,unit:"fluid-ounce"};default:throw new Error(`Unit not supported: ${t}`)}}function Je(e){const{locale:t}=X();if(!t)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 r=parseFloat(e.amount),a=g.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),o=Z(t,a),i=Z(t,{...a,currencyDisplay:"name"}),u=Z(t,{...a,currencyDisplay:"narrowSymbol"}),n=Z(t,{...a,minimumFractionDigits:0,maximumFractionDigits:0}),l=Z(t),d=Z(t,{minimumFractionDigits:0,maximumFractionDigits:0}),_=h=>h.type==="currency",c=g.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>o().format(r),parts:()=>o().formatToParts(r),withoutTrailingZeros:()=>r%1===0?n().format(r):o().format(r),withoutTrailingZerosAndCurrency:()=>r%1===0?d().format(r):l().format(r),currencyName:()=>{var h,m;return(m=(h=i().formatToParts(r).find(_))==null?void 0:h.value)!=null?m:e.currencyCode},currencySymbol:()=>{var h,m;return(m=(h=o().formatToParts(r).find(_))==null?void 0:h.value)!=null?m:e.currencyCode},currencyNarrowSymbol:()=>{var h,m;return(m=(h=u().formatToParts(r).find(_))==null?void 0:h.value)!=null?m:""},amount:()=>o().formatToParts(r).filter(h=>["decimal","fraction","group","integer","literal"].includes(h.type)).map(h=>h.value).join("")}),[e,r,i,o,u,l,n,d]);return g.useMemo(()=>new Proxy(c,{get:(h,m)=>{var p;return(p=Reflect.get(h,m))==null?void 0:p.call(null)}}),[c])}function Z(e,t){return g.useMemo(()=>{let r;return()=>r!=null?r:r=new Intl.NumberFormat(e,t)},[e,t])}var pr="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Money.tsx";function Se({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:a,measurement:o,measurementSeparator:i="/",...u}){if(!Sr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const n=Je(e),l=t!=null?t:"div";let d=n.localizedString;return(r||a)&&(r&&!a?d=n.amount:!r&&a?d=n.withoutTrailingZeros:d=n.withoutTrailingZerosAndCurrency),w.default.createElement(l,{...u,__self:this,__source:{fileName:pr,lineNumber:65,columnNumber:5}},d,o&&o.referenceUnit&&w.default.createElement(w.default.Fragment,null,i,o.referenceUnit))}function Sr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}var et="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductPrice.tsx";function vr(e){var d,_,c,h,m,p,A,f;const{priceType:t="regular",variantId:r,valueType:a="min",data:o,...i}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let u,n;const l=r&&(_=x((d=o==null?void 0:o.variants)!=null?d:{}).find(S=>(S==null?void 0:S.id)===r))!=null?_:null;if(t==="compareAt")if(r&&l){if(((c=l.compareAtPriceV2)==null?void 0:c.amount)===((h=l.priceV2)==null?void 0:h.amount))return null;u=l.compareAtPriceV2}else a==="max"?u=(m=o==null?void 0:o.compareAtPriceRange)==null?void 0:m.maxVariantPrice:u=(p=o==null?void 0:o.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&l?(u=l.priceV2,a==="unit"&&(u=l.unitPrice,n=l.unitPriceMeasurement)):a==="max"?u=(A=o.priceRange)==null?void 0:A.maxVariantPrice:u=(f=o.priceRange)==null?void 0:f.minVariantPrice;return u?n?w.default.createElement(Se,{...i,data:u,measurement:n,__self:this,__source:{fileName:et,lineNumber:81,columnNumber:7}}):w.default.createElement(Se,{...i,data:u,__self:this,__source:{fileName:et,lineNumber:85,columnNumber:10}}):null}var br="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductProvider.tsx";const tt=g.createContext(null);function Cr({children:e,data:t,initialVariantId:r}){const a=g.useMemo(()=>{var f;return x((f=t.variants)!=null?f:{})},[t.variants]);if(!Nr(a))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=g.useMemo(()=>Ar(a),[a]),[i,u]=g.useState(()=>nt(r,a)),[n,l]=g.useState(()=>at(i));g.useEffect(()=>{const f=nt(r,a);u(f),l(at(f))},[r,a]);const d=g.useCallback((f,S)=>{l(v=>{const b={...v,[f]:S};return u(rt(a,b)),b})},[l,a]),_=g.useCallback((f,S)=>{var b;const v=rt(a,{...n,[f]:S});return(b=v==null?void 0:v.availableForSale)!=null?b:!0},[n,a]),c=g.useMemo(()=>{var f;return x((f=t.sellingPlanGroups)!=null?f:{}).map(S=>{var v;return{...S,sellingPlans:x((v=S==null?void 0:S.sellingPlans)!=null?v:{})}})},[t.sellingPlanGroups]),[h,m]=g.useState(void 0),p=g.useMemo(()=>{var f,S;if(!(!i||!h)){if(!((f=i.sellingPlanAllocations)!=null&&f.nodes)&&!((S=i.sellingPlanAllocations)!=null&&S.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return x(i.sellingPlanAllocations).find(v=>{var b;return((b=v==null?void 0:v.sellingPlan)==null?void 0:b.id)===h.id})}},[i,h]),A=g.useMemo(()=>({variants:a,variantsConnection:t.variants,options:o,selectedVariant:i,setSelectedVariant:u,selectedOptions:n,setSelectedOption:d,setSelectedOptions:l,isOptionInStock:_,selectedSellingPlan:h,setSelectedSellingPlan:m,selectedSellingPlanAllocation:p,sellingPlanGroups:c,sellingPlanGroupsConnection:t.sellingPlanGroups}),[_,o,t.sellingPlanGroups,t.variants,n,h,p,i,c,d,a]);return w.default.createElement(tt.Provider,{value:A,__self:this,__source:{fileName:br,lineNumber:201,columnNumber:5}},e)}function Tr(){const e=g.useContext(tt);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function rt(e,t){var r,a;if(!(!e.length||((a=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:a.length)!==Object.keys(t).length))return e==null?void 0:e.find(o=>Object.entries(t).every(([i,u])=>{var n;return(n=o==null?void 0:o.selectedOptions)==null?void 0:n.some(l=>(l==null?void 0:l.name)===i&&(l==null?void 0:l.value)===u)}))}function Ar(e){const t=e.reduce((r,a)=>{var o;if(!a.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=a==null?void 0:a.selectedOptions)==null||o.forEach(i=>{var u,n,l,d;r[(u=i==null?void 0:i.name)!=null?u:""]=r[(n=i==null?void 0:i.name)!=null?n:""]||new Set,r[(l=i==null?void 0:i.name)!=null?l:""].add((d=i==null?void 0:i.value)!=null?d:"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function nt(e,t){if(e){const r=t.find(a=>(a==null?void 0:a.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 at(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>{var a,o;return t[(a=r==null?void 0:r.name)!=null?a:""]=(o=r==null?void 0:r.value)!=null?o:"",t},{}):{}}function Nr(e){return!(!e||!Array.isArray(e))}var it="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopPayButton.tsx";const wr="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function Ir({variantIds:e,className:t,variantIdsAndQuantities:r,width:a}){const{storeDomain:o}=X(),i=Ke(wr);let u;if(e&&r)throw new Error(Dr);if(e)u=e.reduce((l,d)=>{const _=ot(d);return _&&l.push(_),l},[]);else if(r)u=r.reduce((l,d)=>{var c;const _=ot(d==null?void 0:d.id);return _&&l.push(`${_}:${(c=d==null?void 0:d.quantity)!=null?c:1}`),l},[]);else throw new Error(Or);const n=a?{"--shop-pay-button-width":a}:void 0;return w.default.createElement("div",{className:t,style:n,__self:this,__source:{fileName:it,lineNumber:90,columnNumber:5}},i==="done"&&w.default.createElement("shop-pay-button",{"store-url":`https://${o}`,variants:u.join(","),__self:this,__source:{fileName:it,lineNumber:92,columnNumber:9}}))}function ot(e){if(!!e)return e.split("/").pop()}const Or='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',Dr="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component";function Lr({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:a,contentType:o}){return a!==Q&&console.warn(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen-UI is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${a}"; expected version ${Q}`),{getStorefrontApiUrl(i){var u,n;return`https://${(u=i==null?void 0:i.storeDomain)!=null?u:e}.myshopify.com/api/${(n=i==null?void 0:i.storefrontApiVersion)!=null?n:a}/graphql.json`},getPrivateTokenHeaders(i){var n,l,d;if(!t&&!(i!=null&&i.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((n=i==null?void 0:i.contentType)!=null?n:o)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-ui","X-SDK-Variant-Source":"react","X-SDK-Version":a,"Shopify-Storefront-Private-Token":(d=(l=i==null?void 0:i.privateStorefrontToken)!=null?l:t)!=null?d:"",...i!=null&&i.buyerIp?{"Shopify-Storefront-Buyer-IP":i.buyerIp}:{}}},getPublicTokenHeaders(i){var n,l,d;if(!r&&!(i!=null&&i.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");return{"content-type":((n=i==null?void 0:i.contentType)!=null?n:o)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-ui","X-SDK-Variant-Source":"react","X-SDK-Version":a,"X-Shopify-Storefront-Access-Token":(d=(l=i==null?void 0:i.publicStorefrontToken)!=null?l:r)!=null?d:""}}}}L.CartProvider=Jt,L.ExternalVideo=Be,L.Image=ie,L.MediaFile=mr,L.Metafield=yr,L.ModelViewer=ze,L.Money=Se,L.ProductPrice=vr,L.ProductProvider=Cr,L.ShopPayButton=Ir,L.ShopifyProvider=gt,L.Video=pe,L.createStorefrontClient=Lr,L.flattenConnection=x,L.parseMetafield=Qe,L.parseMetafieldValue=Xe,L.useCart=Xt,L.useCartFetch=le,L.useInstantCheckout=Pt,L.useMoney=Je,L.useProduct=Tr,L.useShop=X,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
238
+ `;var tt="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ExternalVideo.tsx";function qe(e){var h,s;const{data:r,options:t,id:a=r.id,frameBorder:o="0",allow:i="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:u=!0,loading:n="lazy",...l}=e;if(!r.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let d=r.embedUrl;if(t){const m=new URL(r.embedUrl);for(const _ of Object.keys(t))m.searchParams.set(_,t[_]);d=m.toString()}return w.default.createElement("iframe",{...l,id:a!=null?a:r.embedUrl,title:(s=(h=r.alt)!=null?h:r.id)!=null?s:"external video",frameBorder:o,allow:i,allowFullScreen:u,src:d,loading:n,__self:this,__source:{fileName:tt,lineNumber:56,columnNumber:5}})}const nt=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],at=["spin.dev"],it=[...nt,...at],re=[352,832,1200,1920,2560];function He({src:e,width:r,height:t,crop:a,scale:o}){const i=new URL(e),u=o!=null?o:1;if(r){let n;typeof r=="string"?n=(re[0]*u).toString():n=(Number(r)*u).toString(),i.searchParams.append("width",n)}return t&&typeof t=="number"&&i.searchParams.append("height",(t*u).toString()),a&&i.searchParams.append("crop",a),i.toString()}function Be(e){const r=new URL(e.src);return!it.some(a=>r.hostname.endsWith(a))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:He(e)}function ot({data:e,loaderOptions:r,elementProps:t}){var o,i,u,n,l,d;let a=null;return(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&(a=(e==null?void 0:e.width)/(e==null?void 0:e.height)),(r==null?void 0:r.width)||(r==null?void 0:r.height)?{width:(o=r==null?void 0:r.width)!=null?o:a&&typeof r.height=="number"?Math.round(a*r.height):null,height:(i=r==null?void 0:r.height)!=null?i:a&&typeof r.width=="number"?Math.round(a*r.width):null}:(t==null?void 0:t.width)||(t==null?void 0:t.height)?{width:(u=t==null?void 0:t.width)!=null?u:a&&typeof t.height=="number"?Math.round(a*t.height):null,height:(n=t==null?void 0:t.height)!=null?n:a&&typeof t.width=="number"?Math.round(a*t.width):null}:(e==null?void 0:e.width)||(e==null?void 0:e.height)?{width:(l=e==null?void 0:e.width)!=null?l:null,height:(d=e==null?void 0:e.height)!=null?d:null}:{width:null,height:null}}var ut="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Image.tsx";function ie({data:e,width:r,height:t,loading:a,loader:o=Be,loaderOptions:i,widths:u,decoding:n="async",...l}){var p,A,f,S,v,b;if(!e.url){const c=`<Image/>: the 'data' prop requires the 'url' property. Image: ${(p=e.id)!=null?p:"no ID provided"}`;return console.error(c),null}const{width:d,height:h}=ot({data:e,loaderOptions:i,elementProps:{width:r,height:t}});let s=e.url;if(o&&(s=o({...i,src:e.url,width:d,height:h}),typeof s!="string"||!s))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${(A=e.id)!=null?A:e.url}`);const m=r&&d&&r<d?r:d,_=(f=l.srcSet)!=null?f:ct({...i,widths:u,src:e.url,width:m,height:h,loader:o});return Se.createElement("img",{id:(S=e.id)!=null?S:"",alt:(b=(v=e.altText)!=null?v:l.alt)!=null?b:"",loading:a!=null?a:"lazy",...l,src:s,width:d!=null?d:void 0,height:h!=null?h:void 0,srcSet:_,decoding:n,__self:this,__source:{fileName:ut,lineNumber:150,columnNumber:5}})}function ct({src:e,width:r,crop:t,scale:a,widths:o,loader:i,height:u}){const n=o&&Array.isArray(o);if(n&&o.some(s=>isNaN(s)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let l=1;r&&u&&(l=Number(u)/Number(r));let d=n?o:re;!n&&r&&r<re[re.length-1]&&(d=re.filter(s=>s<=r));const h=i||He;return d.map(s=>`${h({src:e,width:s,height:t?Number(s)*l:void 0,crop:t,scale:a})} ${s}w`).join(", ")}var We="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Video.tsx";function Ee(e){var d,h;const{data:r,previewImageOptions:t,id:a=r.id,playsInline:o=!0,controls:i=!0,sourceProps:u={},...n}=e,l=Be({src:(h=(d=r.previewImage)==null?void 0:d.url)!=null?h:"",...t});if(!r.sources)throw new Error("<Video/> requires a 'data.sources' array");return w.default.createElement("video",{...n,id:a,playsInline:o,controls:i,poster:l,__self:this,__source:{fileName:We,lineNumber:42,columnNumber:5}},r.sources.map(s=>{if(!((s==null?void 0:s.url)&&(s==null?void 0:s.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return w.default.createElement("source",{...u,key:s.url,src:s.url,type:s.mimeType,__self:this,__source:{fileName:We,lineNumber:54,columnNumber:11}})}))}const Ye={};function st(e,r){const t=Ye[e];if(t)return t;const a=new Promise((o,i)=>{const u=document.createElement("script");r!=null&&r.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{o(!0)},u.onerror=()=>{i(!1)},(r==null?void 0:r.in)==="head"?document.head.appendChild(u):document.body.appendChild(u)});return Ye[e]=a,a}function Ge(e,r){const[t,a]=g.useState("loading"),o=JSON.stringify(r);return g.useEffect(()=>{async function i(){try{a("loading"),await st(e,r),a("done")}catch{a("error")}}i()},[e,o,r]),t}var lt="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ModelViewer.tsx";function Ze(e){var d,h,s,m,_,p,A,f,S,v,b;const[r,t]=g.useState(void 0),a=g.useCallback(c=>{t(c)},[]),{data:o,children:i,className:u,...n}=e,l=Ge("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return g.useEffect(()=>{if(!!r)return n.onError&&r.addEventListener("error",n.onError),n.onLoad&&r.addEventListener("load",n.onLoad),n.onPreload&&r.addEventListener("preload",n.onPreload),n.onModelVisibility&&r.addEventListener("model-visibility",n.onModelVisibility),n.onProgress&&r.addEventListener("progress",n.onProgress),n.onArStatus&&r.addEventListener("ar-status",n.onArStatus),n.onArTracking&&r.addEventListener("ar-tracking",n.onArTracking),n.onQuickLookButtonTapped&&r.addEventListener("quick-look-button-tapped",n.onQuickLookButtonTapped),n.onCameraChange&&r.addEventListener("camera-change",n.onCameraChange),n.onEnvironmentChange&&r.addEventListener("environment-change",n.onEnvironmentChange),n.onPlay&&r.addEventListener("play",n.onPlay),n.onPause&&r.addEventListener("ar-status",n.onPause),n.onSceneGraphReady&&r.addEventListener("scene-graph-ready",n.onSceneGraphReady),()=>{r!=null&&(n.onError&&r.removeEventListener("error",n.onError),n.onLoad&&r.removeEventListener("load",n.onLoad),n.onPreload&&r.removeEventListener("preload",n.onPreload),n.onModelVisibility&&r.removeEventListener("model-visibility",n.onModelVisibility),n.onProgress&&r.removeEventListener("progress",n.onProgress),n.onArStatus&&r.removeEventListener("ar-status",n.onArStatus),n.onArTracking&&r.removeEventListener("ar-tracking",n.onArTracking),n.onQuickLookButtonTapped&&r.removeEventListener("quick-look-button-tapped",n.onQuickLookButtonTapped),n.onCameraChange&&r.removeEventListener("camera-change",n.onCameraChange),n.onEnvironmentChange&&r.removeEventListener("environment-change",n.onEnvironmentChange),n.onPlay&&r.removeEventListener("play",n.onPlay),n.onPause&&r.removeEventListener("ar-status",n.onPause),n.onSceneGraphReady&&r.removeEventListener("scene-graph-ready",n.onSceneGraphReady))}},[r,n.onArStatus,n.onArTracking,n.onCameraChange,n.onEnvironmentChange,n.onError,n.onLoad,n.onModelVisibility,n.onPause,n.onPlay,n.onPreload,n.onProgress,n.onQuickLookButtonTapped,n.onSceneGraphReady]),l!=="done"?null:(h=(d=o.sources)==null?void 0:d[0])!=null&&h.url?w.default.createElement("model-viewer",{ref:a,...n,className:u,id:(s=n.id)!=null?s:o.id,src:o.sources[0].url,alt:(m=o.alt)!=null?m:null,"camera-controls":(_=n.cameraControls)!=null?_:!0,poster:(A=n.poster||((p=o.previewImage)==null?void 0:p.url))!=null?A:null,autoplay:(f=n.autoplay)!=null?f:!0,loading:n.loading,reveal:n.reveal,ar:n.ar,"ar-modes":n.arModes,"ar-scale":n.arScale,"ar-placement":n.arPlacement,"ios-src":n.iosSrc,"touch-action":n.touchAction,"disable-zoom":n.disableZoom,"orbit-sensitivity":n.orbitSensitivity,"auto-rotate":n.autoRotate,"auto-rotate-delay":n.autoRotateDelay,"rotation-per-second":n.rotationPerSecond,"interaction-policy":n.interactionPolicy,"interaction-prompt":n.interactionPrompt,"interaction-prompt-style":n.interactionPromptStyle,"interaction-prompt-threshold":n.interactionPromptThreshold,"camera-orbit":n.cameraOrbit,"camera-target":n.cameraTarget,"field-of-view":n.fieldOfView,"max-camera-orbit":n.maxCameraOrbit,"min-camera-orbit":n.minCameraOrbit,"max-field-of-view":n.maxFieldOfView,"min-field-of-view":n.minFieldOfView,bounds:n.bounds,"interpolation-decay":(S=n.interpolationDecay)!=null?S:100,"skybox-image":n.skyboxImage,"environment-image":n.environmentImage,exposure:n.exposure,"shadow-intensity":(v=n.shadowIntensity)!=null?v:0,"shadow-softness":(b=n.shadowSoftness)!=null?b:0,"animation-name":n.animationName,"animation-crossfade-duration":n.animationCrossfadeDuration,"variant-name":n.variantName,orientation:n.orientation,scale:n.scale,__self:this,__source:{fileName:lt,lineNumber:222,columnNumber:5}},i):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}var oe="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/MediaFile.tsx";function dt({data:e,mediaOptions:r,...t}){switch(e.__typename){case"MediaImage":return e.image?w.default.createElement(ie,{...t,...r==null?void 0:r.image,data:e.image,__self:this,__source:{fileName:oe,lineNumber:50,columnNumber:9}}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return w.default.createElement(Ee,{...t,...r==null?void 0:r.video,data:e,__self:this,__source:{fileName:oe,lineNumber:59,columnNumber:9}});case"ExternalVideo":return w.default.createElement(qe,{...t,...r==null?void 0:r.externalVideo,data:e,__self:this,__source:{fileName:oe,lineNumber:64,columnNumber:9}});case"Model3d":return w.default.createElement(Ze,{...t,...r==null?void 0:r.modelViewer,data:e,__self:this,__source:{fileName:oe,lineNumber:73,columnNumber:9}});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to correctly render the correct component for this media. Rendering 'null' by default"),null}}var $="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Metafield.tsx";function ft(e){var n,l,d,h,s,m,_,p,A;const{data:r,as:t,...a}=e,{locale:o}=J(),i=g.useMemo(()=>Ke(r),[r]);if(!i)return console.warn("<Metafield/>: nothing was passed to the data prop 'data'. Rendering 'null'"),null;if(i.value===null||i.value===void 0){const f=`<Metafield/>: No metafield value for metafield ${(n=i.id)!=null?n:i.key}. Rendering 'null'`;return console.warn(f),null}switch(i.type){case"date":{const f=t!=null?t:"time";return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:68,columnNumber:9}},i.value.toLocaleDateString(o))}case"date_time":{const f=t!=null?t:"time";return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:76,columnNumber:9}},i.value.toLocaleString(o))}case"weight":case"dimension":case"volume":{const f=t!=null?t:"span";return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:86,columnNumber:9}},_t(i.value,o))}case"rating":{const f=t!=null?t:"span";return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:94,columnNumber:9}},i.value.value)}case"single_line_text_field":{const f=t!=null?t:"span";return w.default.createElement(f,{...a,dangerouslySetInnerHTML:{__html:i.value},__self:this,__source:{fileName:$,lineNumber:102,columnNumber:9}})}case"multi_line_text_field":{const f=t!=null?t:"div";return w.default.createElement(f,{...a,dangerouslySetInnerHTML:{__html:i.value.split(`
239
+ `).join("<br/>")},__self:this,__source:{fileName:$,lineNumber:111,columnNumber:9}})}case"url":{const f=new URL(i.value);return w.default.createElement("a",{href:f.href.replace(f.protocol,""),...a,__self:this,__source:{fileName:$,lineNumber:122,columnNumber:9}},i.value)}case"json":{const f=t!=null?t:"span";return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:133,columnNumber:9}},JSON.stringify(i.value))}case"product_reference":case"variant_reference":case"page_reference":{const f=t!=null?t:"span",S=i.reference;return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:144,columnNumber:9}},(d=(l=S==null?void 0:S.title)!=null?l:S==null?void 0:S.id)!=null?d:"")}case"list.single_line_text_field":{const f=t!=null?t:"ul",S=i.references?B(i.references):[];return w.default.createElement(f,{...a,__self:this,__source:{fileName:$,lineNumber:154,columnNumber:9}},S.map((v,b)=>w.default.createElement("li",{key:`${v!=null?v:""}-${b}`,__self:this,__source:{fileName:$,lineNumber:158,columnNumber:13}},v)))}case"file_reference":if(((h=i.reference)==null?void 0:h.__typename)==="MediaImage"){const f=i.reference;return f.image?w.default.createElement(ie,{data:f.image,...a,__self:this,__source:{fileName:$,lineNumber:167,columnNumber:11}}):null}else if(((s=i.reference)==null?void 0:s.__typename)==="GenericFile"){const f=i.reference;return f.previewImage?w.default.createElement("a",{href:(_=(m=i.reference)==null?void 0:m.url)!=null?_:"",...a,__self:this,__source:{fileName:$,lineNumber:172,columnNumber:11}},w.default.createElement(ie,{data:f.previewImage,__self:this,__source:{fileName:$,lineNumber:173,columnNumber:13}})):null}else if(((p=i.reference)==null?void 0:p.__typename)==="Video"){const f=i.reference;return w.default.createElement(Ee,{...a,data:f,__self:this,__source:{fileName:$,lineNumber:178,columnNumber:16}})}}const u=t!=null?t:"span";return w.default.createElement(u,{...a,__self:this,__source:{fileName:$,lineNumber:185,columnNumber:5}},(A=i.value)==null?void 0:A.toString())}function Ke(e){return e?{...e,value:ze(e)}:null}function ze(e){if(!e)return null;if(e.value===null||e.value===void 0)return e.value;switch(e.type){case"boolean":return e.value==="true";case"number_integer":return parseInt(e.value);case"number_decimal":return parseFloat(e.value);case"date":case"date_time":return new Date(e.value);case"json":case"weight":case"dimension":case"volume":case"rating":return yt(e.value);case"color":case"single_line_text_field":case"multi_line_text_field":case"product_reference":case"page_reference":case"variant_reference":case"file_reference":case"url":default:return e.value}}function yt(e){return String(e).includes("__proto__")?JSON.parse(e,(r,t)=>{if(r!=="__proto__")return t}):JSON.parse(e)}const mt={mm:"millimeter",cm:"centimeter",m:"meter",in:"inch",ft:"foot",yd:"yard",ml:"milliliter",l:"liter",us_fl_oz:"fluid-ounce",us_gal:"gallon",kg:"kilogram",g:"gram",lb:"pound",oz:"ounce"};function _t(e,r="en-us",t={}){let a={value:e.value,unit:mt[e.unit]};return a.unit==null&&(a=ht(e.value,e.unit)),new Intl.NumberFormat(r,{...t,unit:a.unit,style:"unit"}).format(a.value)}function ht(e,r){switch(r){case"cl":return{value:e/1e3,unit:"liter"};case"m3":return{value:e*1e3,unit:"liter"};case"us_pt":return{value:e*.125,unit:"gallon"};case"us_qt":return{value:e*.5,unit:"gallon"};case"us_oz":return{value:e/128,unit:"gallon"};case"imp_pt":return{value:e/6.661,unit:"gallon"};case"imp_qt":return{value:e/3.331,unit:"gallon"};case"imp_gal":return{value:e/1.201,unit:"gallon"};case"imp_fl_oz":return{value:e*.96076,unit:"fluid-ounce"};default:throw new Error(`Unit not supported: ${r}`)}}function Qe(e){const{locale:r}=J();if(!r)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 t=parseFloat(e.amount),a=g.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),o=Z(r,a),i=Z(r,{...a,currencyDisplay:"name"}),u=Z(r,{...a,currencyDisplay:"narrowSymbol"}),n=Z(r,{...a,minimumFractionDigits:0,maximumFractionDigits:0}),l=Z(r),d=Z(r,{minimumFractionDigits:0,maximumFractionDigits:0}),h=m=>m.type==="currency",s=g.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>o().format(t),parts:()=>o().formatToParts(t),withoutTrailingZeros:()=>t%1===0?n().format(t):o().format(t),withoutTrailingZerosAndCurrency:()=>t%1===0?d().format(t):l().format(t),currencyName:()=>{var m,_;return(_=(m=i().formatToParts(t).find(h))==null?void 0:m.value)!=null?_:e.currencyCode},currencySymbol:()=>{var m,_;return(_=(m=o().formatToParts(t).find(h))==null?void 0:m.value)!=null?_:e.currencyCode},currencyNarrowSymbol:()=>{var m,_;return(_=(m=u().formatToParts(t).find(h))==null?void 0:m.value)!=null?_:""},amount:()=>o().formatToParts(t).filter(m=>["decimal","fraction","group","integer","literal"].includes(m.type)).map(m=>m.value).join("")}),[e,t,i,o,u,l,n,d]);return g.useMemo(()=>new Proxy(s,{get:(m,_)=>{var p;return(p=Reflect.get(m,_))==null?void 0:p.call(null)}}),[s])}function Z(e,r){return g.useMemo(()=>{let t;return()=>t!=null?t:t=new Intl.NumberFormat(e,r)},[e,r])}var gt="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Money.tsx";function pe({data:e,as:r,withoutCurrency:t,withoutTrailingZeros:a,measurement:o,measurementSeparator:i="/",...u}){if(!Et(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const n=Qe(e),l=r!=null?r:"div";let d=n.localizedString;return(t||a)&&(t&&!a?d=n.amount:!t&&a?d=n.withoutTrailingZeros:d=n.withoutTrailingZerosAndCurrency),w.default.createElement(l,{...u,__self:this,__source:{fileName:gt,lineNumber:65,columnNumber:5}},d,o&&o.referenceUnit&&w.default.createElement(w.default.Fragment,null,i,o.referenceUnit))}function Et(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}var Xe="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductPrice.tsx";function pt(e){var d,h,s,m,_,p,A,f;const{priceType:r="regular",variantId:t,valueType:a="min",data:o,...i}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let u,n;const l=t&&(h=B((d=o==null?void 0:o.variants)!=null?d:{}).find(S=>(S==null?void 0:S.id)===t))!=null?h:null;if(r==="compareAt")if(t&&l){if(((s=l.compareAtPriceV2)==null?void 0:s.amount)===((m=l.priceV2)==null?void 0:m.amount))return null;u=l.compareAtPriceV2}else a==="max"?u=(_=o==null?void 0:o.compareAtPriceRange)==null?void 0:_.maxVariantPrice:u=(p=o==null?void 0:o.compareAtPriceRange)==null?void 0:p.minVariantPrice;else t&&l?(u=l.priceV2,a==="unit"&&(u=l.unitPrice,n=l.unitPriceMeasurement)):a==="max"?u=(A=o.priceRange)==null?void 0:A.maxVariantPrice:u=(f=o.priceRange)==null?void 0:f.minVariantPrice;return u?n?w.default.createElement(pe,{...i,data:u,measurement:n,__self:this,__source:{fileName:Xe,lineNumber:81,columnNumber:7}}):w.default.createElement(pe,{...i,data:u,__self:this,__source:{fileName:Xe,lineNumber:85,columnNumber:10}}):null}var St="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductProvider.tsx";const Je=g.createContext(null);function vt({children:e,data:r,initialVariantId:t}){const a=g.useMemo(()=>{var f;return B((f=r.variants)!=null?f:{})},[r.variants]);if(!Ct(a))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=g.useMemo(()=>Tt(a),[a]),[i,u]=g.useState(()=>rr(t,a)),[n,l]=g.useState(()=>tr(i));g.useEffect(()=>{const f=rr(t,a);u(f),l(tr(f))},[t,a]);const d=g.useCallback((f,S)=>{l(v=>{const b={...v,[f]:S};return u(er(a,b)),b})},[l,a]),h=g.useCallback((f,S)=>{var b;const v=er(a,{...n,[f]:S});return(b=v==null?void 0:v.availableForSale)!=null?b:!0},[n,a]),s=g.useMemo(()=>{var f;return B((f=r.sellingPlanGroups)!=null?f:{}).map(S=>{var v;return{...S,sellingPlans:B((v=S==null?void 0:S.sellingPlans)!=null?v:{})}})},[r.sellingPlanGroups]),[m,_]=g.useState(void 0),p=g.useMemo(()=>{var f,S;if(!(!i||!m)){if(!((f=i.sellingPlanAllocations)!=null&&f.nodes)&&!((S=i.sellingPlanAllocations)!=null&&S.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return B(i.sellingPlanAllocations).find(v=>{var b;return((b=v==null?void 0:v.sellingPlan)==null?void 0:b.id)===m.id})}},[i,m]),A=g.useMemo(()=>({variants:a,variantsConnection:r.variants,options:o,selectedVariant:i,setSelectedVariant:u,selectedOptions:n,setSelectedOption:d,setSelectedOptions:l,isOptionInStock:h,selectedSellingPlan:m,setSelectedSellingPlan:_,selectedSellingPlanAllocation:p,sellingPlanGroups:s,sellingPlanGroupsConnection:r.sellingPlanGroups}),[h,o,r.sellingPlanGroups,r.variants,n,m,p,i,s,d,a]);return w.default.createElement(Je.Provider,{value:A,__self:this,__source:{fileName:St,lineNumber:201,columnNumber:5}},e)}function bt(){const e=g.useContext(Je);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function er(e,r){var t,a;if(!(!e.length||((a=(t=e==null?void 0:e[0])==null?void 0:t.selectedOptions)==null?void 0:a.length)!==Object.keys(r).length))return e==null?void 0:e.find(o=>Object.entries(r).every(([i,u])=>{var n;return(n=o==null?void 0:o.selectedOptions)==null?void 0:n.some(l=>(l==null?void 0:l.name)===i&&(l==null?void 0:l.value)===u)}))}function Tt(e){const r=e.reduce((t,a)=>{var o;if(!a.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=a==null?void 0:a.selectedOptions)==null||o.forEach(i=>{var u,n,l,d;t[(u=i==null?void 0:i.name)!=null?u:""]=t[(n=i==null?void 0:i.name)!=null?n:""]||new Set,t[(l=i==null?void 0:i.name)!=null?l:""].add((d=i==null?void 0:i.value)!=null?d:"")}),t},{});return Object.keys(r).map(t=>({name:t,values:Array.from(r[t])}))}function rr(e,r){if(e){const t=r.find(a=>(a==null?void 0:a.id)===e);return t||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),t}if(e===null)return null;if(e===void 0)return r.find(t=>t==null?void 0:t.availableForSale)||r[0]}function tr(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((r,t)=>{var a,o;return r[(a=t==null?void 0:t.name)!=null?a:""]=(o=t==null?void 0:t.value)!=null?o:"",r},{}):{}}function Ct(e){return!(!e||!Array.isArray(e))}var nr="/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopPayButton.tsx";const At="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function Nt({variantIds:e,className:r,variantIdsAndQuantities:t,width:a}){const{storeDomain:o}=J(),i=Ge(At);let u;if(e&&t)throw new Error(It);if(e)u=e.reduce((l,d)=>{const h=ar(d);return h&&l.push(h),l},[]);else if(t)u=t.reduce((l,d)=>{var s;const h=ar(d==null?void 0:d.id);return h&&l.push(`${h}:${(s=d==null?void 0:d.quantity)!=null?s:1}`),l},[]);else throw new Error(wt);const n=a?{"--shop-pay-button-width":a}:void 0;return w.default.createElement("div",{className:r,style:n,__self:this,__source:{fileName:nr,lineNumber:90,columnNumber:5}},i==="done"&&w.default.createElement("shop-pay-button",{"store-url":`https://${o}`,variants:u.join(","),__self:this,__source:{fileName:nr,lineNumber:92,columnNumber:9}}))}function ar(e){if(!!e)return e.split("/").pop()}const wt='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',It="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component";function Ot({storeDomain:e,privateStorefrontToken:r,publicStorefrontToken:t,storefrontApiVersion:a,contentType:o}){return a!==X&&console.warn(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen-UI is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${a}"; expected version "${X}"`),{getStorefrontApiUrl(i){var u,n;return`https://${(u=i==null?void 0:i.storeDomain)!=null?u:e}.myshopify.com/api/${(n=i==null?void 0:i.storefrontApiVersion)!=null?n:a}/graphql.json`},getPrivateTokenHeaders(i){var n,l,d;if(!r&&!(i!=null&&i.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((n=i==null?void 0:i.contentType)!=null?n:o)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-ui","X-SDK-Variant-Source":"react","X-SDK-Version":a,"Shopify-Storefront-Private-Token":(d=(l=i==null?void 0:i.privateStorefrontToken)!=null?l:r)!=null?d:"",...i!=null&&i.buyerIp?{"Shopify-Storefront-Buyer-IP":i.buyerIp}:{}}},getPublicTokenHeaders(i){var n,l,d;if(!t&&!(i!=null&&i.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");return{"content-type":((n=i==null?void 0:i.contentType)!=null?n:o)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-ui","X-SDK-Variant-Source":"react","X-SDK-Version":a,"X-Shopify-Storefront-Access-Token":(d=(l=i==null?void 0:i.publicStorefrontToken)!=null?l:t)!=null?d:""}}}}U.CartProvider=Qr,U.ExternalVideo=qe,U.Image=ie,U.MediaFile=dt,U.Metafield=ft,U.ModelViewer=Ze,U.Money=pe,U.ProductPrice=pt,U.ProductProvider=vt,U.ShopPayButton=Nt,U.ShopifyProvider=$r,U.Video=Ee,U.createStorefrontClient=Ot,U.flattenConnection=B,U.parseMetafield=Ke,U.parseMetafieldValue=ze,U.useCart=zr,U.useMoney=Qe,U.useProduct=bt,U.useShop=J,Object.defineProperties(U,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
340
240
  //# sourceMappingURL=hydrogen-react.prod.js.map