@shopify/hydrogen-react 2025.5.0 → 2025.7.0

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 (370) hide show
  1. package/customer-account.schema.json +1 -1
  2. package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
  3. package/dist/browser-dev/BaseButton.mjs.map +1 -1
  4. package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
  5. package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
  6. package/dist/browser-dev/CartCost.mjs.map +1 -1
  7. package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
  8. package/dist/browser-dev/CartLineQuantity.mjs.map +1 -1
  9. package/dist/browser-dev/CartLineQuantityAdjustButton.mjs.map +1 -1
  10. package/dist/browser-dev/CartProvider.mjs.map +1 -1
  11. package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
  12. package/dist/browser-dev/Image.mjs.map +1 -1
  13. package/dist/browser-dev/MediaFile.mjs.map +1 -1
  14. package/dist/browser-dev/ModelViewer.mjs.map +1 -1
  15. package/dist/browser-dev/Money.mjs.map +1 -1
  16. package/dist/browser-dev/ProductPrice.mjs.map +1 -1
  17. package/dist/browser-dev/ProductProvider.mjs.map +1 -1
  18. package/dist/browser-dev/RichText.components.mjs.map +1 -1
  19. package/dist/browser-dev/RichText.mjs.map +1 -1
  20. package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
  21. package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
  22. package/dist/browser-dev/Video.mjs.map +1 -1
  23. package/dist/browser-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  24. package/dist/browser-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  25. package/dist/browser-dev/analytics-utils.mjs.map +1 -1
  26. package/dist/browser-dev/analytics.mjs.map +1 -1
  27. package/dist/browser-dev/cart-hooks.mjs.map +1 -1
  28. package/dist/browser-dev/cart-queries.mjs.map +1 -1
  29. package/dist/browser-dev/codegen.helpers.mjs.map +1 -1
  30. package/dist/browser-dev/cookies-utils.mjs.map +1 -1
  31. package/dist/browser-dev/flatten-connection.mjs.map +1 -1
  32. package/dist/browser-dev/getProductOptions.mjs.map +1 -1
  33. package/dist/browser-dev/load-script.mjs.map +1 -1
  34. package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs +17 -17
  35. package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  36. package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs +2 -2
  37. package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  38. package/dist/browser-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  39. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  40. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  41. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  42. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  43. package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  44. package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  45. package/dist/browser-dev/optionValueDecoder.mjs.map +1 -1
  46. package/dist/browser-dev/packages/hydrogen-react/package.json.mjs +1 -1
  47. package/dist/browser-dev/parse-metafield.mjs +26 -1
  48. package/dist/browser-dev/parse-metafield.mjs.map +1 -1
  49. package/dist/browser-dev/storefront-api-constants.mjs +1 -1
  50. package/dist/browser-dev/storefront-api-constants.mjs.map +1 -1
  51. package/dist/browser-dev/storefront-client.mjs.map +1 -1
  52. package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
  53. package/dist/browser-dev/useCartActions.mjs.map +1 -1
  54. package/dist/browser-dev/useMoney.mjs +53 -7
  55. package/dist/browser-dev/useMoney.mjs.map +1 -1
  56. package/dist/browser-dev/useSelectedOptionInUrlParam.mjs.map +1 -1
  57. package/dist/browser-dev/useShopifyCookies.mjs.map +1 -1
  58. package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
  59. package/dist/browser-prod/BaseButton.mjs.map +1 -1
  60. package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
  61. package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
  62. package/dist/browser-prod/CartCost.mjs.map +1 -1
  63. package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
  64. package/dist/browser-prod/CartLineQuantity.mjs.map +1 -1
  65. package/dist/browser-prod/CartLineQuantityAdjustButton.mjs.map +1 -1
  66. package/dist/browser-prod/CartProvider.mjs.map +1 -1
  67. package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
  68. package/dist/browser-prod/Image.mjs.map +1 -1
  69. package/dist/browser-prod/MediaFile.mjs.map +1 -1
  70. package/dist/browser-prod/ModelViewer.mjs.map +1 -1
  71. package/dist/browser-prod/Money.mjs.map +1 -1
  72. package/dist/browser-prod/ProductPrice.mjs.map +1 -1
  73. package/dist/browser-prod/ProductProvider.mjs.map +1 -1
  74. package/dist/browser-prod/RichText.components.mjs.map +1 -1
  75. package/dist/browser-prod/RichText.mjs.map +1 -1
  76. package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
  77. package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
  78. package/dist/browser-prod/Video.mjs.map +1 -1
  79. package/dist/browser-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  80. package/dist/browser-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  81. package/dist/browser-prod/analytics-utils.mjs.map +1 -1
  82. package/dist/browser-prod/analytics.mjs.map +1 -1
  83. package/dist/browser-prod/cart-hooks.mjs.map +1 -1
  84. package/dist/browser-prod/cart-queries.mjs.map +1 -1
  85. package/dist/browser-prod/codegen.helpers.mjs.map +1 -1
  86. package/dist/browser-prod/cookies-utils.mjs.map +1 -1
  87. package/dist/browser-prod/flatten-connection.mjs.map +1 -1
  88. package/dist/browser-prod/getProductOptions.mjs.map +1 -1
  89. package/dist/browser-prod/load-script.mjs.map +1 -1
  90. package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs +17 -17
  91. package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  92. package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs +2 -2
  93. package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  94. package/dist/browser-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  95. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  96. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  97. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  98. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  99. package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  100. package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  101. package/dist/browser-prod/optionValueDecoder.mjs.map +1 -1
  102. package/dist/browser-prod/packages/hydrogen-react/package.json.mjs +1 -1
  103. package/dist/browser-prod/parse-metafield.mjs +27 -1
  104. package/dist/browser-prod/parse-metafield.mjs.map +1 -1
  105. package/dist/browser-prod/storefront-api-constants.mjs +1 -1
  106. package/dist/browser-prod/storefront-api-constants.mjs.map +1 -1
  107. package/dist/browser-prod/storefront-client.mjs.map +1 -1
  108. package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
  109. package/dist/browser-prod/useCartActions.mjs.map +1 -1
  110. package/dist/browser-prod/useMoney.mjs +53 -7
  111. package/dist/browser-prod/useMoney.mjs.map +1 -1
  112. package/dist/browser-prod/useSelectedOptionInUrlParam.mjs.map +1 -1
  113. package/dist/browser-prod/useShopifyCookies.mjs.map +1 -1
  114. package/dist/node-dev/AddToCartButton.js.map +1 -1
  115. package/dist/node-dev/AddToCartButton.mjs.map +1 -1
  116. package/dist/node-dev/BaseButton.js.map +1 -1
  117. package/dist/node-dev/BaseButton.mjs.map +1 -1
  118. package/dist/node-dev/BuyNowButton.js.map +1 -1
  119. package/dist/node-dev/BuyNowButton.mjs.map +1 -1
  120. package/dist/node-dev/CartCheckoutButton.js.map +1 -1
  121. package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
  122. package/dist/node-dev/CartCost.js.map +1 -1
  123. package/dist/node-dev/CartCost.mjs.map +1 -1
  124. package/dist/node-dev/CartLineProvider.js.map +1 -1
  125. package/dist/node-dev/CartLineProvider.mjs.map +1 -1
  126. package/dist/node-dev/CartLineQuantity.js.map +1 -1
  127. package/dist/node-dev/CartLineQuantity.mjs.map +1 -1
  128. package/dist/node-dev/CartLineQuantityAdjustButton.js.map +1 -1
  129. package/dist/node-dev/CartLineQuantityAdjustButton.mjs.map +1 -1
  130. package/dist/node-dev/CartProvider.js.map +1 -1
  131. package/dist/node-dev/CartProvider.mjs.map +1 -1
  132. package/dist/node-dev/ExternalVideo.js.map +1 -1
  133. package/dist/node-dev/ExternalVideo.mjs.map +1 -1
  134. package/dist/node-dev/Image.js.map +1 -1
  135. package/dist/node-dev/Image.mjs.map +1 -1
  136. package/dist/node-dev/MediaFile.js.map +1 -1
  137. package/dist/node-dev/MediaFile.mjs.map +1 -1
  138. package/dist/node-dev/ModelViewer.js.map +1 -1
  139. package/dist/node-dev/ModelViewer.mjs.map +1 -1
  140. package/dist/node-dev/Money.js.map +1 -1
  141. package/dist/node-dev/Money.mjs.map +1 -1
  142. package/dist/node-dev/ProductPrice.js.map +1 -1
  143. package/dist/node-dev/ProductPrice.mjs.map +1 -1
  144. package/dist/node-dev/ProductProvider.js.map +1 -1
  145. package/dist/node-dev/ProductProvider.mjs.map +1 -1
  146. package/dist/node-dev/RichText.components.js.map +1 -1
  147. package/dist/node-dev/RichText.components.mjs.map +1 -1
  148. package/dist/node-dev/RichText.js.map +1 -1
  149. package/dist/node-dev/RichText.mjs.map +1 -1
  150. package/dist/node-dev/ShopPayButton.js.map +1 -1
  151. package/dist/node-dev/ShopPayButton.mjs.map +1 -1
  152. package/dist/node-dev/ShopifyProvider.js.map +1 -1
  153. package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
  154. package/dist/node-dev/Video.js.map +1 -1
  155. package/dist/node-dev/Video.mjs.map +1 -1
  156. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
  157. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  158. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.js.map +1 -1
  159. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  160. package/dist/node-dev/analytics-utils.js.map +1 -1
  161. package/dist/node-dev/analytics-utils.mjs.map +1 -1
  162. package/dist/node-dev/analytics.js.map +1 -1
  163. package/dist/node-dev/analytics.mjs.map +1 -1
  164. package/dist/node-dev/cart-hooks.js.map +1 -1
  165. package/dist/node-dev/cart-hooks.mjs.map +1 -1
  166. package/dist/node-dev/cart-queries.js.map +1 -1
  167. package/dist/node-dev/cart-queries.mjs.map +1 -1
  168. package/dist/node-dev/codegen.helpers.js.map +1 -1
  169. package/dist/node-dev/codegen.helpers.mjs.map +1 -1
  170. package/dist/node-dev/cookies-utils.js.map +1 -1
  171. package/dist/node-dev/cookies-utils.mjs.map +1 -1
  172. package/dist/node-dev/flatten-connection.js.map +1 -1
  173. package/dist/node-dev/flatten-connection.mjs.map +1 -1
  174. package/dist/node-dev/getProductOptions.js.map +1 -1
  175. package/dist/node-dev/getProductOptions.mjs.map +1 -1
  176. package/dist/node-dev/load-script.js.map +1 -1
  177. package/dist/node-dev/load-script.mjs.map +1 -1
  178. package/dist/node-dev/node_modules/@xstate/fsm/es/index.js +17 -17
  179. package/dist/node-dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
  180. package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs +17 -17
  181. package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  182. package/dist/node-dev/node_modules/@xstate/react/es/fsm.js +2 -2
  183. package/dist/node-dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
  184. package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs +2 -2
  185. package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  186. package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  187. package/dist/node-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  188. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  189. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  190. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  191. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  192. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  193. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  194. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  195. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  196. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  197. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  198. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  199. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  200. package/dist/node-dev/optionValueDecoder.js.map +1 -1
  201. package/dist/node-dev/optionValueDecoder.mjs.map +1 -1
  202. package/dist/node-dev/packages/hydrogen-react/package.json.js +1 -1
  203. package/dist/node-dev/packages/hydrogen-react/package.json.mjs +1 -1
  204. package/dist/node-dev/parse-metafield.js +26 -1
  205. package/dist/node-dev/parse-metafield.js.map +1 -1
  206. package/dist/node-dev/parse-metafield.mjs +26 -1
  207. package/dist/node-dev/parse-metafield.mjs.map +1 -1
  208. package/dist/node-dev/storefront-api-constants.js +1 -1
  209. package/dist/node-dev/storefront-api-constants.js.map +1 -1
  210. package/dist/node-dev/storefront-api-constants.mjs +1 -1
  211. package/dist/node-dev/storefront-api-constants.mjs.map +1 -1
  212. package/dist/node-dev/storefront-client.js.map +1 -1
  213. package/dist/node-dev/storefront-client.mjs.map +1 -1
  214. package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
  215. package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
  216. package/dist/node-dev/useCartActions.js.map +1 -1
  217. package/dist/node-dev/useCartActions.mjs.map +1 -1
  218. package/dist/node-dev/useMoney.js +53 -7
  219. package/dist/node-dev/useMoney.js.map +1 -1
  220. package/dist/node-dev/useMoney.mjs +53 -7
  221. package/dist/node-dev/useMoney.mjs.map +1 -1
  222. package/dist/node-dev/useSelectedOptionInUrlParam.js.map +1 -1
  223. package/dist/node-dev/useSelectedOptionInUrlParam.mjs.map +1 -1
  224. package/dist/node-dev/useShopifyCookies.js.map +1 -1
  225. package/dist/node-dev/useShopifyCookies.mjs.map +1 -1
  226. package/dist/node-prod/AddToCartButton.js.map +1 -1
  227. package/dist/node-prod/AddToCartButton.mjs.map +1 -1
  228. package/dist/node-prod/BaseButton.js.map +1 -1
  229. package/dist/node-prod/BaseButton.mjs.map +1 -1
  230. package/dist/node-prod/BuyNowButton.js.map +1 -1
  231. package/dist/node-prod/BuyNowButton.mjs.map +1 -1
  232. package/dist/node-prod/CartCheckoutButton.js.map +1 -1
  233. package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
  234. package/dist/node-prod/CartCost.js.map +1 -1
  235. package/dist/node-prod/CartCost.mjs.map +1 -1
  236. package/dist/node-prod/CartLineProvider.js.map +1 -1
  237. package/dist/node-prod/CartLineProvider.mjs.map +1 -1
  238. package/dist/node-prod/CartLineQuantity.js.map +1 -1
  239. package/dist/node-prod/CartLineQuantity.mjs.map +1 -1
  240. package/dist/node-prod/CartLineQuantityAdjustButton.js.map +1 -1
  241. package/dist/node-prod/CartLineQuantityAdjustButton.mjs.map +1 -1
  242. package/dist/node-prod/CartProvider.js.map +1 -1
  243. package/dist/node-prod/CartProvider.mjs.map +1 -1
  244. package/dist/node-prod/ExternalVideo.js.map +1 -1
  245. package/dist/node-prod/ExternalVideo.mjs.map +1 -1
  246. package/dist/node-prod/Image.js.map +1 -1
  247. package/dist/node-prod/Image.mjs.map +1 -1
  248. package/dist/node-prod/MediaFile.js.map +1 -1
  249. package/dist/node-prod/MediaFile.mjs.map +1 -1
  250. package/dist/node-prod/ModelViewer.js.map +1 -1
  251. package/dist/node-prod/ModelViewer.mjs.map +1 -1
  252. package/dist/node-prod/Money.js.map +1 -1
  253. package/dist/node-prod/Money.mjs.map +1 -1
  254. package/dist/node-prod/ProductPrice.js.map +1 -1
  255. package/dist/node-prod/ProductPrice.mjs.map +1 -1
  256. package/dist/node-prod/ProductProvider.js.map +1 -1
  257. package/dist/node-prod/ProductProvider.mjs.map +1 -1
  258. package/dist/node-prod/RichText.components.js.map +1 -1
  259. package/dist/node-prod/RichText.components.mjs.map +1 -1
  260. package/dist/node-prod/RichText.js.map +1 -1
  261. package/dist/node-prod/RichText.mjs.map +1 -1
  262. package/dist/node-prod/ShopPayButton.js.map +1 -1
  263. package/dist/node-prod/ShopPayButton.mjs.map +1 -1
  264. package/dist/node-prod/ShopifyProvider.js.map +1 -1
  265. package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
  266. package/dist/node-prod/Video.js.map +1 -1
  267. package/dist/node-prod/Video.mjs.map +1 -1
  268. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
  269. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
  270. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.js.map +1 -1
  271. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
  272. package/dist/node-prod/analytics-utils.js.map +1 -1
  273. package/dist/node-prod/analytics-utils.mjs.map +1 -1
  274. package/dist/node-prod/analytics.js.map +1 -1
  275. package/dist/node-prod/analytics.mjs.map +1 -1
  276. package/dist/node-prod/cart-hooks.js.map +1 -1
  277. package/dist/node-prod/cart-hooks.mjs.map +1 -1
  278. package/dist/node-prod/cart-queries.js.map +1 -1
  279. package/dist/node-prod/cart-queries.mjs.map +1 -1
  280. package/dist/node-prod/codegen.helpers.js.map +1 -1
  281. package/dist/node-prod/codegen.helpers.mjs.map +1 -1
  282. package/dist/node-prod/cookies-utils.js.map +1 -1
  283. package/dist/node-prod/cookies-utils.mjs.map +1 -1
  284. package/dist/node-prod/flatten-connection.js.map +1 -1
  285. package/dist/node-prod/flatten-connection.mjs.map +1 -1
  286. package/dist/node-prod/getProductOptions.js.map +1 -1
  287. package/dist/node-prod/getProductOptions.mjs.map +1 -1
  288. package/dist/node-prod/load-script.js.map +1 -1
  289. package/dist/node-prod/load-script.mjs.map +1 -1
  290. package/dist/node-prod/node_modules/@xstate/fsm/es/index.js +17 -17
  291. package/dist/node-prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
  292. package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs +17 -17
  293. package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  294. package/dist/node-prod/node_modules/@xstate/react/es/fsm.js +2 -2
  295. package/dist/node-prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
  296. package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs +2 -2
  297. package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  298. package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  299. package/dist/node-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
  300. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  301. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  302. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  303. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  304. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  305. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  306. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  307. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  308. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
  309. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
  310. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
  311. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
  312. package/dist/node-prod/optionValueDecoder.js.map +1 -1
  313. package/dist/node-prod/optionValueDecoder.mjs.map +1 -1
  314. package/dist/node-prod/packages/hydrogen-react/package.json.js +1 -1
  315. package/dist/node-prod/packages/hydrogen-react/package.json.mjs +1 -1
  316. package/dist/node-prod/parse-metafield.js +27 -1
  317. package/dist/node-prod/parse-metafield.js.map +1 -1
  318. package/dist/node-prod/parse-metafield.mjs +27 -1
  319. package/dist/node-prod/parse-metafield.mjs.map +1 -1
  320. package/dist/node-prod/storefront-api-constants.js +1 -1
  321. package/dist/node-prod/storefront-api-constants.js.map +1 -1
  322. package/dist/node-prod/storefront-api-constants.mjs +1 -1
  323. package/dist/node-prod/storefront-api-constants.mjs.map +1 -1
  324. package/dist/node-prod/storefront-client.js.map +1 -1
  325. package/dist/node-prod/storefront-client.mjs.map +1 -1
  326. package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
  327. package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
  328. package/dist/node-prod/useCartActions.js.map +1 -1
  329. package/dist/node-prod/useCartActions.mjs.map +1 -1
  330. package/dist/node-prod/useMoney.js +53 -7
  331. package/dist/node-prod/useMoney.js.map +1 -1
  332. package/dist/node-prod/useMoney.mjs +53 -7
  333. package/dist/node-prod/useMoney.mjs.map +1 -1
  334. package/dist/node-prod/useSelectedOptionInUrlParam.js.map +1 -1
  335. package/dist/node-prod/useSelectedOptionInUrlParam.mjs.map +1 -1
  336. package/dist/node-prod/useShopifyCookies.js.map +1 -1
  337. package/dist/node-prod/useShopifyCookies.mjs.map +1 -1
  338. package/dist/types/CartLineProvider.d.ts +1 -1
  339. package/dist/types/CartProvider.d.ts +2 -2
  340. package/dist/types/Image.d.ts +1 -1
  341. package/dist/types/ModelViewer.d.ts +1 -1
  342. package/dist/types/Money.d.ts +13 -5
  343. package/dist/types/Video.d.ts +1 -1
  344. package/dist/types/cart-hooks.d.ts +3 -4
  345. package/dist/types/codegen.helpers.d.ts +2 -2
  346. package/dist/types/customer-account-api-types.d.ts +9386 -0
  347. package/dist/types/optionValueDecoder.d.ts +2 -2
  348. package/dist/types/storefront-api-constants.d.ts +1 -1
  349. package/dist/types/storefront-api-types.d.ts +143 -8
  350. package/dist/types/useCartAPIStateMachine.d.ts +2 -2
  351. package/dist/types/useCartActions.d.ts +2 -2
  352. package/dist/types/useMoney.d.ts +16 -2
  353. package/dist/umd/hydrogen-react.dev.js +100 -29
  354. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  355. package/dist/umd/hydrogen-react.prod.js +13 -13
  356. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  357. package/package.json +26 -25
  358. package/storefront.schema.json +1 -1
  359. package/dist/browser-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +0 -6
  360. package/dist/browser-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs.map +0 -1
  361. package/dist/browser-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +0 -6
  362. package/dist/browser-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs.map +0 -1
  363. package/dist/node-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js +0 -5
  364. package/dist/node-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js.map +0 -1
  365. package/dist/node-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.mjs +0 -6
  366. package/dist/node-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.mjs.map +0 -1
  367. package/dist/node-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js +0 -5
  368. package/dist/node-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js.map +0 -1
  369. package/dist/node-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.mjs +0 -6
  370. package/dist/node-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flatten-connection.mjs","sources":["../../src/flatten-connection.ts"],"sourcesContent":["import type {PartialDeep} from 'type-fest';\n\n/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n *\n * If `connection` is null or undefined, will return an empty array instead in production. In development, an error will be thrown.\n */\nexport function flattenConnection<\n ConnectionGeneric extends\n | PartialDeep<ConnectionEdges, {recurseIntoArrays: true}>\n | PartialDeep<ConnectionNodes, {recurseIntoArrays: true}>\n | ConnectionEdges\n | ConnectionNodes,\n>(\n connection?: ConnectionGeneric,\n): ConnectionGeneric extends\n | {\n edges: Array<{node: infer ConnectionBaseType}>;\n }\n | {\n nodes: Array<infer ConnectionBaseType>;\n }\n ? // if it's not a PartialDeep, then return the infered type\n ConnectionBaseType[]\n : ConnectionGeneric extends\n | PartialDeep<\n {edges: {node: Array<infer ConnectionBaseType>}},\n {recurseIntoArrays: true}\n >\n | PartialDeep<\n {\n nodes: Array<infer ConnectionBaseType>;\n },\n {recurseIntoArrays: true}\n >\n ? // if it is a PartialDeep, return a PartialDeep inferred type\n PartialDeep<ConnectionBaseType[], {recurseIntoArrays: true}>\n : never {\n if (!connection) {\n const noConnectionErr = `flattenConnection(): needs a 'connection' to flatten, but received '${\n connection ?? ''\n }' instead.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noConnectionErr);\n } else {\n console.error(noConnectionErr + ` Returning an empty array`);\n // @ts-expect-error We don't want to crash prod, so return an empty array\n return [];\n }\n }\n\n if ('nodes' in connection) {\n // @ts-expect-error return type is failing\n return connection.nodes;\n }\n\n if ('edges' in connection && Array.isArray(connection.edges)) {\n // @ts-expect-error return type is failing\n return connection.edges.map((edge) => {\n if (!edge?.node) {\n throw new Error(\n 'flattenConnection(): Connection edges must contain nodes',\n );\n }\n return edge.node;\n }) as Array<unknown>;\n }\n\n if (__HYDROGEN_DEV__) {\n console.warn(\n `flattenConnection(): The connection did not contain either \"nodes\" or \"edges.node\". Returning an empty array.`,\n );\n }\n\n // @ts-expect-error We don't want to crash prod, so return an empty array\n return [];\n}\n\ntype ConnectionEdges = {\n edges: Array<{node: unknown}>;\n};\n\ntype ConnectionNodes = {\n nodes: Array<unknown>;\n};\n\n// This is only for documentation purposes, and it is not used in the code.\nexport interface ConnectionGenericForDoc {\n connection?: ConnectionEdges | ConnectionNodes;\n}\nexport type FlattenConnectionReturnForDoc = unknown[];\n"],"names":[],"mappings":"AAQO,SAAS,kBAOd,YAuBU;AACV,MAAI,CAAC,YAAY;AACT,UAAA,kBAAkB,uEACtB,cAAc,EAChB;AACsB;AACd,YAAA,IAAI,MAAM,eAAe;AAAA,IAAA;AAAA,EAKjC;AAGF,MAAI,WAAW,YAAY;AAEzB,WAAO,WAAW;AAAA,EAAA;AAGpB,MAAI,WAAW,cAAc,MAAM,QAAQ,WAAW,KAAK,GAAG;AAE5D,WAAO,WAAW,MAAM,IAAI,CAAC,SAAS;AAChC,UAAA,EAAC,6BAAM,OAAM;AACf,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MAAA;AAEF,aAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAGmB;AACZ,YAAA;AAAA,MACN;AAAA,IACF;AAAA,EAAA;AAIF,SAAO,CAAC;AACV;"}
1
+ {"version":3,"file":"flatten-connection.mjs","sources":["../../src/flatten-connection.ts"],"sourcesContent":["import type {PartialDeep} from 'type-fest';\n\n/**\n * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](https://shopify.dev/api/storefront/reference/products/product)) into a flat array of nodes.\n * The utility works with either `nodes` or `edges.node`.\n *\n * If `connection` is null or undefined, will return an empty array instead in production. In development, an error will be thrown.\n */\nexport function flattenConnection<\n ConnectionGeneric extends\n | PartialDeep<ConnectionEdges, {recurseIntoArrays: true}>\n | PartialDeep<ConnectionNodes, {recurseIntoArrays: true}>\n | ConnectionEdges\n | ConnectionNodes,\n>(\n connection?: ConnectionGeneric,\n): ConnectionGeneric extends\n | {\n edges: Array<{node: infer ConnectionBaseType}>;\n }\n | {\n nodes: Array<infer ConnectionBaseType>;\n }\n ? // if it's not a PartialDeep, then return the infered type\n ConnectionBaseType[]\n : ConnectionGeneric extends\n | PartialDeep<\n {edges: {node: Array<infer ConnectionBaseType>}},\n {recurseIntoArrays: true}\n >\n | PartialDeep<\n {\n nodes: Array<infer ConnectionBaseType>;\n },\n {recurseIntoArrays: true}\n >\n ? // if it is a PartialDeep, return a PartialDeep inferred type\n PartialDeep<ConnectionBaseType[], {recurseIntoArrays: true}>\n : never {\n if (!connection) {\n const noConnectionErr = `flattenConnection(): needs a 'connection' to flatten, but received '${\n connection ?? ''\n }' instead.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noConnectionErr);\n } else {\n console.error(noConnectionErr + ` Returning an empty array`);\n // @ts-expect-error We don't want to crash prod, so return an empty array\n return [];\n }\n }\n\n if ('nodes' in connection) {\n // @ts-expect-error return type is failing\n return connection.nodes;\n }\n\n if ('edges' in connection && Array.isArray(connection.edges)) {\n // @ts-expect-error return type is failing\n return connection.edges.map((edge) => {\n if (!edge?.node) {\n throw new Error(\n 'flattenConnection(): Connection edges must contain nodes',\n );\n }\n return edge.node;\n }) as Array<unknown>;\n }\n\n if (__HYDROGEN_DEV__) {\n console.warn(\n `flattenConnection(): The connection did not contain either \"nodes\" or \"edges.node\". Returning an empty array.`,\n );\n }\n\n // @ts-expect-error We don't want to crash prod, so return an empty array\n return [];\n}\n\ntype ConnectionEdges = {\n edges: Array<{node: unknown}>;\n};\n\ntype ConnectionNodes = {\n nodes: Array<unknown>;\n};\n\n// This is only for documentation purposes, and it is not used in the code.\nexport interface ConnectionGenericForDoc {\n connection?: ConnectionEdges | ConnectionNodes;\n}\nexport type FlattenConnectionReturnForDoc = unknown[];\n"],"names":[],"mappings":"AAQO,SAAS,kBAOd,YAuBU;AACV,MAAI,CAAC,YAAY;AACf,UAAM,kBAAkB,uEACtB,cAAc,EAChB;AACsB;AACpB,YAAM,IAAI,MAAM,eAAe;AAAA,IACjC;AAAA,EAKF;AAEA,MAAI,WAAW,YAAY;AAEzB,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,WAAW,cAAc,MAAM,QAAQ,WAAW,KAAK,GAAG;AAE5D,WAAO,WAAW,MAAM,IAAI,CAAC,SAAS;AACpC,UAAI,EAAC,6BAAM,OAAM;AACf,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAAA,MAEJ;AACA,aAAO,KAAK;AAAA,IACd,CAAC;AAAA,EACH;AAEsB;AACpB,YAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ;AAGA,SAAO,CAAA;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getProductOptions.mjs","sources":["../../src/getProductOptions.ts"],"sourcesContent":["import {isOptionValueCombinationInEncodedVariant} from './optionValueDecoder.js';\nimport type {\n Product,\n ProductOption,\n ProductOptionValue,\n ProductVariant,\n SelectedOption,\n} from './storefront-api-types';\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>;\n};\ntype ProductOptionsMapping = Record<string, Record<string, number>>;\ntype ProductOptionValueState = {\n variant: ProductVariant;\n handle: string;\n variantUriQuery: string;\n selected: boolean;\n exists: boolean;\n available: boolean;\n isDifferentProduct: boolean;\n};\ntype MappedProductOptionValue = ProductOptionValue & ProductOptionValueState;\n\n/**\n * Creates a mapping of product options to their index for matching encoded values\n * For example, a product option of\n * [\n * \\{\n * name: 'Color',\n * optionValues: [\\{name: 'Red'\\}, \\{name: 'Blue'\\}]\n * \\},\n * \\{\n * name: 'Size',\n * optionValues: [\\{name: 'Small'\\}, \\{name: 'Medium'\\}, \\{name: 'Large'\\}]\n * \\}\n * ]\n * Would return\n * \\{\n * 'Color': \\{Red: 0, Blue: 1\\},\n * 'Size': \\{Small: 0, Medium: 1, Large: 2\\}\n * \\}\n */\nfunction mapProductOptions(options: ProductOption[]): ProductOptionsMapping {\n return Object.assign(\n {},\n ...options.map((option: ProductOption) => {\n return {\n [option.name]: Object.assign(\n {},\n ...(option?.optionValues\n ? option.optionValues.map((value, index) => {\n return {[value.name]: index};\n })\n : []),\n ),\n } as Record<string, number>;\n }),\n );\n}\n\n/**\n * Converts the product option into an Object\\<key, value\\> for building query params\n * For example, a selected product option of\n * [\n * \\{\n * name: 'Color',\n * value: 'Red',\n * \\},\n * \\{\n * name: 'Size',\n * value: 'Medium',\n * \\}\n * ]\n * Would return\n * \\{\n * Color: 'Red',\n * Size: 'Medium',\n * \\}\n */\nexport function mapSelectedProductOptionToObject(\n options: Pick<SelectedOption, 'name' | 'value'>[],\n): Record<string, string> {\n return Object.assign(\n {},\n ...options.map((key) => {\n return {[key.name]: key.value};\n }),\n ) as Record<string, string>;\n}\n\n/**\n * Returns the JSON stringify result of mapSelectedProductOptionToObject\n */\nfunction mapSelectedProductOptionToObjectAsString(\n options: Pick<SelectedOption, 'name' | 'value'>[],\n): string {\n return JSON.stringify(mapSelectedProductOptionToObject(options));\n}\n\n/**\n * Encode the selected product option as a key for mapping to the encoded variants\n * For example, a selected product option of\n * [\n * \\{\n * name: 'Color',\n * value: 'Red',\n * \\},\n * \\{\n * name: 'Size',\n * value: 'Medium',\n * \\}\n * ]\n * Would return\n * JSON.stringify(\\{\n * Color: 'Red',\n * Size: 'Medium',\n * \\})\n */\nfunction encodeSelectedProductOptionAsKey(\n selectedOption:\n | Pick<SelectedOption, 'name' | 'value'>[]\n | Record<string, string>,\n): string {\n if (Array.isArray(selectedOption)) {\n return JSON.stringify(\n Object.assign(\n {},\n ...selectedOption.map((option) => ({[option.name]: option.value})),\n ),\n );\n } else {\n return JSON.stringify(selectedOption);\n }\n}\n\n/**\n * Build the encoding array for the given selected options. For example, if we have\n * the following productOptionMappings:\n *\n * \\{\n * 'Color': \\{Red: 0, Blue: 1\\},\n * 'Size': \\{Small: 0, Medium: 1, Large: 2\\}\n * \\}\n *\n * A selectedOption of\n *\n * \\{\n * Color: 'Red',\n * Size: 'Medium',\n * \\}\n *\n * `buildEncodingArrayFromSelectedOptions` will produce\n *\n * [0,1]\n *\n * If in the case where a selected option doesn't exists in the mapping array, for example:\n *\n * \\{\n * Color: 'Red',\n * Fabric: 'Cotton',\n * Size: 'Medium',\n * \\}\n *\n * `buildEncodingArrayFromSelectedOptions` will still produce\n *\n * [0,1]\n *\n * This can be caused by when we do not have all the product\n * option information for the loading optimistic variant\n */\nfunction buildEncodingArrayFromSelectedOptions(\n selectedOption: Record<string, string>,\n productOptionMappings: ProductOptionsMapping,\n): Array<number> {\n const encoding = Object.keys(selectedOption).map((key) => {\n return productOptionMappings[key]\n ? productOptionMappings[key][selectedOption[key]]\n : null;\n });\n return encoding.filter((code) => code !== null);\n}\n\n/**\n * Takes an array of product variants and maps them to an object with the encoded selected option values as the key.\n * For example, a product variant of\n * [\n * \\{\n * id: 1,\n * selectedOptions: [\n * \\{name: 'Color', value: 'Red'\\},\n * \\{name: 'Size', value: 'Small'\\},\n * ],\n * \\},\n * \\{\n * id: 2,\n * selectedOptions: [\n * \\{name: 'Color', value: 'Red'\\},\n * \\{name: 'Size', value: 'Medium'\\},\n * ],\n * \\}\n * ]\n * Would return\n * \\{\n * '[0,0]': \\{id: 1, selectedOptions: [\\{name: 'Color', value: 'Red'\\}, \\{name: 'Size', value: 'Small'\\}]\\},\n * '[0,1]': \\{id: 2, selectedOptions: [\\{name: 'Color', value: 'Red'\\}, \\{name: 'Size', value: 'Medium'\\}]\\},\n * \\}\n */\nfunction mapVariants(\n variants: ProductVariant[],\n): Record<string, ProductVariant> {\n return Object.assign(\n {},\n ...variants.map((variant) => {\n const variantKey = encodeSelectedProductOptionAsKey(\n variant.selectedOptions || [],\n );\n return {[variantKey]: variant};\n }),\n ) as Record<string, ProductVariant>;\n}\n\nexport type MappedProductOptions = Omit<ProductOption, 'optionValues'> & {\n optionValues: MappedProductOptionValue[];\n};\n\nconst PRODUCT_INPUTS = [\n 'options',\n 'selectedOrFirstAvailableVariant',\n 'adjacentVariants',\n];\n\nconst PRODUCT_INPUTS_EXTRA = [\n 'handle',\n 'encodedVariantExistence',\n 'encodedVariantAvailability',\n];\n\nfunction logErrorAndReturnFalse(key: string): boolean {\n console.error(\n `[h2:error:getProductOptions] product.${key} is missing. Make sure you query for this field from the Storefront API.`,\n );\n return false;\n}\n\nexport function checkProductParam(\n product: RecursivePartial<Product>,\n checkAll = false,\n): Product {\n let validParam = true;\n const productKeys = Object.keys(product);\n\n // Check product input\n (checkAll\n ? [...PRODUCT_INPUTS, ...PRODUCT_INPUTS_EXTRA]\n : PRODUCT_INPUTS\n ).forEach((key) => {\n if (!productKeys.includes(key)) {\n validParam = logErrorAndReturnFalse(key);\n }\n });\n\n // Check for nested options requirements\n if (product.options) {\n const firstOption = product?.options[0];\n\n if (checkAll && !firstOption?.name) {\n validParam = logErrorAndReturnFalse('options.name');\n }\n\n // Check for options.optionValues\n if (product?.options[0]?.optionValues) {\n let firstOptionValues = product.options[0].optionValues[0];\n\n // Check for options.optionValues.name\n if (checkAll && !firstOptionValues?.name) {\n validParam = logErrorAndReturnFalse('options.optionValues.name');\n }\n\n // It is possible for firstSelectableVariant to be null\n firstOptionValues = product.options[0].optionValues.filter(\n (value) => !!value?.firstSelectableVariant,\n )[0];\n\n // Check for options.optionValues.firstSelectableVariant\n if (firstOptionValues?.firstSelectableVariant) {\n // check product variant\n validParam = checkProductVariantParam(\n firstOptionValues.firstSelectableVariant,\n 'options.optionValues.firstSelectableVariant',\n validParam,\n checkAll,\n );\n }\n } else {\n validParam = logErrorAndReturnFalse('options.optionValues');\n }\n }\n\n // Check for nested selectedOrFirstAvailableVariant requirements\n if (product.selectedOrFirstAvailableVariant) {\n validParam = checkProductVariantParam(\n product.selectedOrFirstAvailableVariant,\n 'selectedOrFirstAvailableVariant',\n validParam,\n checkAll,\n );\n }\n\n // Check for nested adjacentVariants requirements\n if (!!product.adjacentVariants && product.adjacentVariants[0]) {\n validParam = checkProductVariantParam(\n product.adjacentVariants[0],\n 'adjacentVariants',\n validParam,\n checkAll,\n );\n }\n\n return (validParam ? product : {}) as Product;\n}\n\nfunction checkProductVariantParam(\n variant: RecursivePartial<ProductVariant>,\n key: string,\n currentValidParamState: boolean,\n checkAll: boolean,\n): boolean {\n let validParam = currentValidParamState;\n\n if (checkAll && !variant.product?.handle) {\n validParam = logErrorAndReturnFalse(`${key}.product.handle`);\n }\n if (variant.selectedOptions) {\n const firstSelectedOption = variant.selectedOptions[0];\n if (!firstSelectedOption?.name) {\n validParam = logErrorAndReturnFalse(`${key}.selectedOptions.name`);\n }\n if (!firstSelectedOption?.value) {\n validParam = logErrorAndReturnFalse(`${key}.selectedOptions.value`);\n }\n } else {\n validParam = logErrorAndReturnFalse(`${key}.selectedOptions`);\n }\n\n return validParam;\n}\n\n/**\n * Finds all the variants provided by adjacentVariants, options.optionValues.firstAvailableVariant,\n * and selectedOrFirstAvailableVariant and return them in a single array\n */\nexport function getAdjacentAndFirstAvailableVariants(\n product: RecursivePartial<Product>,\n): ProductVariant[] {\n // Checks for valid product input\n const checkedProduct = checkProductParam(product);\n\n if (!checkedProduct.options) return [];\n\n const availableVariants: Record<string, ProductVariant> = {};\n checkedProduct.options.map((option) => {\n option.optionValues?.map((value) => {\n if (value.firstSelectableVariant) {\n const variantKey = mapSelectedProductOptionToObjectAsString(\n value.firstSelectableVariant.selectedOptions,\n );\n availableVariants[variantKey] = value.firstSelectableVariant;\n }\n });\n });\n\n checkedProduct.adjacentVariants.map((variant) => {\n const variantKey = mapSelectedProductOptionToObjectAsString(\n variant.selectedOptions,\n );\n availableVariants[variantKey] = variant;\n });\n\n const selectedVariant = checkedProduct.selectedOrFirstAvailableVariant;\n if (selectedVariant) {\n const variantKey = mapSelectedProductOptionToObjectAsString(\n selectedVariant.selectedOptions,\n );\n availableVariants[variantKey] = selectedVariant;\n }\n\n return Object.values(availableVariants);\n}\n\n/**\n * Returns a product options array with its relevant information\n * about the variant\n */\nexport function getProductOptions(\n product: RecursivePartial<Product>,\n): MappedProductOptions[] {\n // Checks for valid product input\n const checkedProduct = checkProductParam(product, true);\n\n if (!checkedProduct.options) return [];\n\n const {\n options,\n selectedOrFirstAvailableVariant: selectedVariant,\n adjacentVariants,\n encodedVariantExistence,\n encodedVariantAvailability,\n handle: productHandle,\n } = checkedProduct;\n\n // The available product options is dictated by the selected options of the current variant:\n // Filter out un-used options (Happens on parent combined listing product)\n const selectedOptionKeys = selectedVariant?.selectedOptions.map(\n (option) => option.name,\n );\n const filteredOptions = options.filter((option) => {\n return selectedOptionKeys && selectedOptionKeys.indexOf(option.name) >= 0;\n });\n\n // Get a mapping of product option names to their index for matching encoded values\n const productOptionMappings = mapProductOptions(options);\n\n // Get the adjacent variants mapped to the encoded selected option values\n const variants = mapVariants(\n selectedVariant ? [selectedVariant, ...adjacentVariants] : adjacentVariants,\n );\n\n // Get the key:value version of selected options for building url query params\n const selectedOptions = mapSelectedProductOptionToObject(\n selectedVariant ? selectedVariant.selectedOptions : [],\n );\n\n const productOptions = filteredOptions.map((option, optionIndex) => {\n return {\n ...option,\n optionValues: option.optionValues.map((value) => {\n const targetOptionParams = {...selectedOptions}; // Clones the selected options\n\n // Modify the selected option value to the current option value\n targetOptionParams[option.name] = value.name;\n\n // Encode the new selected option values as a key for mapping to the product variants\n const targetKey = encodeSelectedProductOptionAsKey(\n targetOptionParams || [],\n );\n const encodingKey = buildEncodingArrayFromSelectedOptions(\n targetOptionParams || [],\n productOptionMappings,\n );\n\n // Top-down option check for existence and availability\n const topDownKey = encodingKey.slice(0, optionIndex + 1);\n const exists = isOptionValueCombinationInEncodedVariant(\n topDownKey,\n encodedVariantExistence || '',\n );\n const available = isOptionValueCombinationInEncodedVariant(\n topDownKey,\n encodedVariantAvailability || '',\n );\n\n // Get the variant for the current option value if exists, else use the first selectable variant\n const variant: ProductVariant =\n variants[targetKey] || value.firstSelectableVariant;\n\n // Build the query params for this option value\n let variantOptionParam = {};\n if (variant) {\n variantOptionParam = mapSelectedProductOptionToObject(\n variant.selectedOptions || [],\n );\n }\n const searchParams = new URLSearchParams(variantOptionParam);\n const handle = variant?.product?.handle || productHandle;\n\n return {\n ...value,\n variant,\n handle,\n variantUriQuery: searchParams.toString(),\n selected: selectedOptions[option.name] === value.name,\n exists,\n available,\n isDifferentProduct: handle !== productHandle,\n };\n }),\n };\n });\n\n return productOptions;\n}\n"],"names":[],"mappings":";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AAc;AAAA,UAClB,sBAAsB,CAAC;AAAA,UACvB;AAAA,QACF;AAGA,cAAM,aAAa,YAAY,MAAM,GAAG,cAAc,CAAC;AACvD,cAAM,SAAS;AAAA,UACb;AAAA,UACA,2BAA2B;AAAA,QAC7B;AACA,cAAM,YAAY;AAAA,UAChB;AAAA,UACA,8BAA8B;AAAA,QAChC;AAGA,cAAM,UACJ,SAAS,SAAS,KAAK,MAAM;AAG/B,YAAI,qBAAqB,CAAC;AAC1B,YAAI,SAAS;AACU,+BAAA;AAAA,YACnB,QAAQ,mBAAmB,CAAA;AAAA,UAC7B;AAAA,QAAA;AAEI,cAAA,eAAe,IAAI,gBAAgB,kBAAkB;AACrD,cAAA,WAAS,wCAAS,YAAT,mBAAkB,WAAU;AAEpC,eAAA;AAAA,UACL,GAAG;AAAA,UACH;AAAA,UACA;AAAA,UACA,iBAAiB,aAAa,SAAS;AAAA,UACvC,UAAU,gBAAgB,OAAO,IAAI,MAAM,MAAM;AAAA,UACjD;AAAA,UACA;AAAA,UACA,oBAAoB,WAAW;AAAA,QACjC;AAAA,MACD,CAAA;AAAA,IACH;AAAA,EAAA,CACD;AAEM,SAAA;AACT;"}
1
+ {"version":3,"file":"getProductOptions.mjs","sources":["../../src/getProductOptions.ts"],"sourcesContent":["import {isOptionValueCombinationInEncodedVariant} from './optionValueDecoder.js';\nimport type {\n Product,\n ProductOption,\n ProductOptionValue,\n ProductVariant,\n SelectedOption,\n} from './storefront-api-types';\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>;\n};\ntype ProductOptionsMapping = Record<string, Record<string, number>>;\ntype ProductOptionValueState = {\n variant: ProductVariant;\n handle: string;\n variantUriQuery: string;\n selected: boolean;\n exists: boolean;\n available: boolean;\n isDifferentProduct: boolean;\n};\ntype MappedProductOptionValue = ProductOptionValue & ProductOptionValueState;\n\n/**\n * Creates a mapping of product options to their index for matching encoded values\n * For example, a product option of\n * [\n * \\{\n * name: 'Color',\n * optionValues: [\\{name: 'Red'\\}, \\{name: 'Blue'\\}]\n * \\},\n * \\{\n * name: 'Size',\n * optionValues: [\\{name: 'Small'\\}, \\{name: 'Medium'\\}, \\{name: 'Large'\\}]\n * \\}\n * ]\n * Would return\n * \\{\n * 'Color': \\{Red: 0, Blue: 1\\},\n * 'Size': \\{Small: 0, Medium: 1, Large: 2\\}\n * \\}\n */\nfunction mapProductOptions(options: ProductOption[]): ProductOptionsMapping {\n return Object.assign(\n {},\n ...options.map((option: ProductOption) => {\n return {\n [option.name]: Object.assign(\n {},\n ...(option?.optionValues\n ? option.optionValues.map((value, index) => {\n return {[value.name]: index};\n })\n : []),\n ),\n } as Record<string, number>;\n }),\n );\n}\n\n/**\n * Converts the product option into an Object\\<key, value\\> for building query params\n * For example, a selected product option of\n * [\n * \\{\n * name: 'Color',\n * value: 'Red',\n * \\},\n * \\{\n * name: 'Size',\n * value: 'Medium',\n * \\}\n * ]\n * Would return\n * \\{\n * Color: 'Red',\n * Size: 'Medium',\n * \\}\n */\nexport function mapSelectedProductOptionToObject(\n options: Pick<SelectedOption, 'name' | 'value'>[],\n): Record<string, string> {\n return Object.assign(\n {},\n ...options.map((key) => {\n return {[key.name]: key.value};\n }),\n ) as Record<string, string>;\n}\n\n/**\n * Returns the JSON stringify result of mapSelectedProductOptionToObject\n */\nfunction mapSelectedProductOptionToObjectAsString(\n options: Pick<SelectedOption, 'name' | 'value'>[],\n): string {\n return JSON.stringify(mapSelectedProductOptionToObject(options));\n}\n\n/**\n * Encode the selected product option as a key for mapping to the encoded variants\n * For example, a selected product option of\n * [\n * \\{\n * name: 'Color',\n * value: 'Red',\n * \\},\n * \\{\n * name: 'Size',\n * value: 'Medium',\n * \\}\n * ]\n * Would return\n * JSON.stringify(\\{\n * Color: 'Red',\n * Size: 'Medium',\n * \\})\n */\nfunction encodeSelectedProductOptionAsKey(\n selectedOption:\n | Pick<SelectedOption, 'name' | 'value'>[]\n | Record<string, string>,\n): string {\n if (Array.isArray(selectedOption)) {\n return JSON.stringify(\n Object.assign(\n {},\n ...selectedOption.map((option) => ({[option.name]: option.value})),\n ),\n );\n } else {\n return JSON.stringify(selectedOption);\n }\n}\n\n/**\n * Build the encoding array for the given selected options. For example, if we have\n * the following productOptionMappings:\n *\n * \\{\n * 'Color': \\{Red: 0, Blue: 1\\},\n * 'Size': \\{Small: 0, Medium: 1, Large: 2\\}\n * \\}\n *\n * A selectedOption of\n *\n * \\{\n * Color: 'Red',\n * Size: 'Medium',\n * \\}\n *\n * `buildEncodingArrayFromSelectedOptions` will produce\n *\n * [0,1]\n *\n * If in the case where a selected option doesn't exists in the mapping array, for example:\n *\n * \\{\n * Color: 'Red',\n * Fabric: 'Cotton',\n * Size: 'Medium',\n * \\}\n *\n * `buildEncodingArrayFromSelectedOptions` will still produce\n *\n * [0,1]\n *\n * This can be caused by when we do not have all the product\n * option information for the loading optimistic variant\n */\nfunction buildEncodingArrayFromSelectedOptions(\n selectedOption: Record<string, string>,\n productOptionMappings: ProductOptionsMapping,\n): Array<number> {\n const encoding = Object.keys(selectedOption).map((key) => {\n return productOptionMappings[key]\n ? productOptionMappings[key][selectedOption[key]]\n : null;\n });\n return encoding.filter((code) => code !== null);\n}\n\n/**\n * Takes an array of product variants and maps them to an object with the encoded selected option values as the key.\n * For example, a product variant of\n * [\n * \\{\n * id: 1,\n * selectedOptions: [\n * \\{name: 'Color', value: 'Red'\\},\n * \\{name: 'Size', value: 'Small'\\},\n * ],\n * \\},\n * \\{\n * id: 2,\n * selectedOptions: [\n * \\{name: 'Color', value: 'Red'\\},\n * \\{name: 'Size', value: 'Medium'\\},\n * ],\n * \\}\n * ]\n * Would return\n * \\{\n * '[0,0]': \\{id: 1, selectedOptions: [\\{name: 'Color', value: 'Red'\\}, \\{name: 'Size', value: 'Small'\\}]\\},\n * '[0,1]': \\{id: 2, selectedOptions: [\\{name: 'Color', value: 'Red'\\}, \\{name: 'Size', value: 'Medium'\\}]\\},\n * \\}\n */\nfunction mapVariants(\n variants: ProductVariant[],\n): Record<string, ProductVariant> {\n return Object.assign(\n {},\n ...variants.map((variant) => {\n const variantKey = encodeSelectedProductOptionAsKey(\n variant.selectedOptions || [],\n );\n return {[variantKey]: variant};\n }),\n ) as Record<string, ProductVariant>;\n}\n\nexport type MappedProductOptions = Omit<ProductOption, 'optionValues'> & {\n optionValues: MappedProductOptionValue[];\n};\n\nconst PRODUCT_INPUTS = [\n 'options',\n 'selectedOrFirstAvailableVariant',\n 'adjacentVariants',\n];\n\nconst PRODUCT_INPUTS_EXTRA = [\n 'handle',\n 'encodedVariantExistence',\n 'encodedVariantAvailability',\n];\n\nfunction logErrorAndReturnFalse(key: string): boolean {\n console.error(\n `[h2:error:getProductOptions] product.${key} is missing. Make sure you query for this field from the Storefront API.`,\n );\n return false;\n}\n\nexport function checkProductParam(\n product: RecursivePartial<Product>,\n checkAll = false,\n): Product {\n let validParam = true;\n const productKeys = Object.keys(product);\n\n // Check product input\n (checkAll\n ? [...PRODUCT_INPUTS, ...PRODUCT_INPUTS_EXTRA]\n : PRODUCT_INPUTS\n ).forEach((key) => {\n if (!productKeys.includes(key)) {\n validParam = logErrorAndReturnFalse(key);\n }\n });\n\n // Check for nested options requirements\n if (product.options) {\n const firstOption = product?.options[0];\n\n if (checkAll && !firstOption?.name) {\n validParam = logErrorAndReturnFalse('options.name');\n }\n\n // Check for options.optionValues\n if (product?.options[0]?.optionValues) {\n let firstOptionValues = product.options[0].optionValues[0];\n\n // Check for options.optionValues.name\n if (checkAll && !firstOptionValues?.name) {\n validParam = logErrorAndReturnFalse('options.optionValues.name');\n }\n\n // It is possible for firstSelectableVariant to be null\n firstOptionValues = product.options[0].optionValues.filter(\n (value) => !!value?.firstSelectableVariant,\n )[0];\n\n // Check for options.optionValues.firstSelectableVariant\n if (firstOptionValues?.firstSelectableVariant) {\n // check product variant\n validParam = checkProductVariantParam(\n firstOptionValues.firstSelectableVariant,\n 'options.optionValues.firstSelectableVariant',\n validParam,\n checkAll,\n );\n }\n } else {\n validParam = logErrorAndReturnFalse('options.optionValues');\n }\n }\n\n // Check for nested selectedOrFirstAvailableVariant requirements\n if (product.selectedOrFirstAvailableVariant) {\n validParam = checkProductVariantParam(\n product.selectedOrFirstAvailableVariant,\n 'selectedOrFirstAvailableVariant',\n validParam,\n checkAll,\n );\n }\n\n // Check for nested adjacentVariants requirements\n if (!!product.adjacentVariants && product.adjacentVariants[0]) {\n validParam = checkProductVariantParam(\n product.adjacentVariants[0],\n 'adjacentVariants',\n validParam,\n checkAll,\n );\n }\n\n return (validParam ? product : {}) as Product;\n}\n\nfunction checkProductVariantParam(\n variant: RecursivePartial<ProductVariant>,\n key: string,\n currentValidParamState: boolean,\n checkAll: boolean,\n): boolean {\n let validParam = currentValidParamState;\n\n if (checkAll && !variant.product?.handle) {\n validParam = logErrorAndReturnFalse(`${key}.product.handle`);\n }\n if (variant.selectedOptions) {\n const firstSelectedOption = variant.selectedOptions[0];\n if (!firstSelectedOption?.name) {\n validParam = logErrorAndReturnFalse(`${key}.selectedOptions.name`);\n }\n if (!firstSelectedOption?.value) {\n validParam = logErrorAndReturnFalse(`${key}.selectedOptions.value`);\n }\n } else {\n validParam = logErrorAndReturnFalse(`${key}.selectedOptions`);\n }\n\n return validParam;\n}\n\n/**\n * Finds all the variants provided by adjacentVariants, options.optionValues.firstAvailableVariant,\n * and selectedOrFirstAvailableVariant and return them in a single array\n */\nexport function getAdjacentAndFirstAvailableVariants(\n product: RecursivePartial<Product>,\n): ProductVariant[] {\n // Checks for valid product input\n const checkedProduct = checkProductParam(product);\n\n if (!checkedProduct.options) return [];\n\n const availableVariants: Record<string, ProductVariant> = {};\n checkedProduct.options.map((option) => {\n option.optionValues?.map((value) => {\n if (value.firstSelectableVariant) {\n const variantKey = mapSelectedProductOptionToObjectAsString(\n value.firstSelectableVariant.selectedOptions,\n );\n availableVariants[variantKey] = value.firstSelectableVariant;\n }\n });\n });\n\n checkedProduct.adjacentVariants.map((variant) => {\n const variantKey = mapSelectedProductOptionToObjectAsString(\n variant.selectedOptions,\n );\n availableVariants[variantKey] = variant;\n });\n\n const selectedVariant = checkedProduct.selectedOrFirstAvailableVariant;\n if (selectedVariant) {\n const variantKey = mapSelectedProductOptionToObjectAsString(\n selectedVariant.selectedOptions,\n );\n availableVariants[variantKey] = selectedVariant;\n }\n\n return Object.values(availableVariants);\n}\n\n/**\n * Returns a product options array with its relevant information\n * about the variant\n */\nexport function getProductOptions(\n product: RecursivePartial<Product>,\n): MappedProductOptions[] {\n // Checks for valid product input\n const checkedProduct = checkProductParam(product, true);\n\n if (!checkedProduct.options) return [];\n\n const {\n options,\n selectedOrFirstAvailableVariant: selectedVariant,\n adjacentVariants,\n encodedVariantExistence,\n encodedVariantAvailability,\n handle: productHandle,\n } = checkedProduct;\n\n // The available product options is dictated by the selected options of the current variant:\n // Filter out un-used options (Happens on parent combined listing product)\n const selectedOptionKeys = selectedVariant?.selectedOptions.map(\n (option) => option.name,\n );\n const filteredOptions = options.filter((option) => {\n return selectedOptionKeys && selectedOptionKeys.indexOf(option.name) >= 0;\n });\n\n // Get a mapping of product option names to their index for matching encoded values\n const productOptionMappings = mapProductOptions(options);\n\n // Get the adjacent variants mapped to the encoded selected option values\n const variants = mapVariants(\n selectedVariant ? [selectedVariant, ...adjacentVariants] : adjacentVariants,\n );\n\n // Get the key:value version of selected options for building url query params\n const selectedOptions = mapSelectedProductOptionToObject(\n selectedVariant ? selectedVariant.selectedOptions : [],\n );\n\n const productOptions = filteredOptions.map((option, optionIndex) => {\n return {\n ...option,\n optionValues: option.optionValues.map((value) => {\n const targetOptionParams = {...selectedOptions}; // Clones the selected options\n\n // Modify the selected option value to the current option value\n targetOptionParams[option.name] = value.name;\n\n // Encode the new selected option values as a key for mapping to the product variants\n const targetKey = encodeSelectedProductOptionAsKey(\n targetOptionParams || [],\n );\n const encodingKey = buildEncodingArrayFromSelectedOptions(\n targetOptionParams || [],\n productOptionMappings,\n );\n\n // Top-down option check for existence and availability\n const topDownKey = encodingKey.slice(0, optionIndex + 1);\n const exists = isOptionValueCombinationInEncodedVariant(\n topDownKey,\n encodedVariantExistence || '',\n );\n const available = isOptionValueCombinationInEncodedVariant(\n topDownKey,\n encodedVariantAvailability || '',\n );\n\n // Get the variant for the current option value if exists, else use the first selectable variant\n const variant: ProductVariant =\n variants[targetKey] || value.firstSelectableVariant;\n\n // Build the query params for this option value\n let variantOptionParam = {};\n if (variant) {\n variantOptionParam = mapSelectedProductOptionToObject(\n variant.selectedOptions || [],\n );\n }\n const searchParams = new URLSearchParams(variantOptionParam);\n const handle = variant?.product?.handle || productHandle;\n\n return {\n ...value,\n variant,\n handle,\n variantUriQuery: searchParams.toString(),\n selected: selectedOptions[option.name] === value.name,\n exists,\n available,\n isDifferentProduct: handle !== productHandle,\n };\n }),\n };\n });\n\n return productOptions;\n}\n"],"names":[],"mappings":";AA2CA,SAAS,kBAAkB,SAAiD;AAC1E,SAAO,OAAO;AAAA,IACZ,CAAA;AAAA,IACA,GAAG,QAAQ,IAAI,CAAC,WAA0B;AACxC,aAAO;AAAA,QACL,CAAC,OAAO,IAAI,GAAG,OAAO;AAAA,UACpB,CAAA;AAAA,UACA,IAAI,iCAAQ,gBACR,OAAO,aAAa,IAAI,CAAC,OAAO,UAAU;AACxC,mBAAO,EAAC,CAAC,MAAM,IAAI,GAAG,MAAA;AAAA,UACxB,CAAC,IACD,CAAA;AAAA,QAAC;AAAA,MACP;AAAA,IAEJ,CAAC;AAAA,EAAA;AAEL;AAqBO,SAAS,iCACd,SACwB;AACxB,SAAO,OAAO;AAAA,IACZ,CAAA;AAAA,IACA,GAAG,QAAQ,IAAI,CAAC,QAAQ;AACtB,aAAO,EAAC,CAAC,IAAI,IAAI,GAAG,IAAI,MAAA;AAAA,IAC1B,CAAC;AAAA,EAAA;AAEL;AAKA,SAAS,yCACP,SACQ;AACR,SAAO,KAAK,UAAU,iCAAiC,OAAO,CAAC;AACjE;AAqBA,SAAS,iCACP,gBAGQ;AACR,MAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,WAAO,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AAA,EAEL,CAAC;AAED,SAAO;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"load-script.mjs","sources":["../../src/load-script.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\n\nconst SCRIPTS_LOADED: Record<string, Promise<boolean>> = {};\n\ntype LoadScriptOptions = {\n module?: boolean;\n in?: 'head' | 'body';\n attributes?: Record<string, string>;\n};\n\nexport function loadScript(\n src: string,\n options?: LoadScriptOptions,\n): Promise<boolean> {\n const isScriptLoaded = SCRIPTS_LOADED[src];\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (isScriptLoaded) {\n return isScriptLoaded;\n }\n\n const promise = new Promise<boolean>((resolve, reject) => {\n const script = document.createElement('script');\n if (options?.module) {\n script.type = 'module';\n } else {\n script.type = 'text/javascript';\n }\n script.src = src;\n script.onload = (): void => {\n resolve(true);\n };\n script.onerror = (): void => {\n reject(false);\n };\n if (options?.in === 'head') {\n document.head.appendChild(script);\n } else {\n document.body.appendChild(script);\n }\n\n const attributes = options?.attributes;\n if (attributes) {\n Object.keys(attributes).forEach((key) => {\n script.setAttribute(key, attributes[key]);\n });\n }\n });\n\n SCRIPTS_LOADED[src] = promise;\n\n return promise;\n}\n\ntype LoadScriptParams = Parameters<typeof loadScript>;\n\n/**\n * The `useLoadScript` hook loads an external script tag in the browser. It allows React components to lazy-load large third-party dependencies.\n */\nexport function useLoadScript(\n url: LoadScriptParams[0],\n options?: LoadScriptParams[1],\n): ScriptState {\n const [status, setStatus] = useState<ScriptState>('loading');\n\n useEffect(\n () => {\n loadScript(url, options)\n .then(() => setStatus('done'))\n .catch(() => setStatus('error'));\n },\n // Ignore options changes since it won't trigger a new load.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [url],\n );\n\n return status;\n}\n\ntype ScriptState = 'loading' | 'done' | 'error';\n"],"names":[],"mappings":";AAEA,MAAM,iBAAmD,CAAC;AAQ1C,SAAA,WACd,KACA,SACkB;AACZ,QAAA,iBAAiB,eAAe,GAAG;AAGzC,MAAI,gBAAgB;AACX,WAAA;AAAA,EAAA;AAGT,QAAM,UAAU,IAAI,QAAiB,CAAC,SAAS,WAAW;AAClD,UAAA,SAAS,SAAS,cAAc,QAAQ;AAC9C,QAAI,mCAAS,QAAQ;AACnB,aAAO,OAAO;AAAA,IAAA,OACT;AACL,aAAO,OAAO;AAAA,IAAA;AAEhB,WAAO,MAAM;AACb,WAAO,SAAS,MAAY;AAC1B,cAAQ,IAAI;AAAA,IACd;AACA,WAAO,UAAU,MAAY;AAC3B,aAAO,KAAK;AAAA,IACd;AACI,SAAA,mCAAS,QAAO,QAAQ;AACjB,eAAA,KAAK,YAAY,MAAM;AAAA,IAAA,OAC3B;AACI,eAAA,KAAK,YAAY,MAAM;AAAA,IAAA;AAGlC,UAAM,aAAa,mCAAS;AAC5B,QAAI,YAAY;AACd,aAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,eAAO,aAAa,KAAK,WAAW,GAAG,CAAC;AAAA,MAAA,CACzC;AAAA,IAAA;AAAA,EACH,CACD;AAED,iBAAe,GAAG,IAAI;AAEf,SAAA;AACT;AAOgB,SAAA,cACd,KACA,SACa;AACb,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAsB,SAAS;AAE3D;AAAA,IACE,MAAM;AACJ,iBAAW,KAAK,OAAO,EACpB,KAAK,MAAM,UAAU,MAAM,CAAC,EAC5B,MAAM,MAAM,UAAU,OAAO,CAAC;AAAA,IACnC;AAAA;AAAA;AAAA,IAGA,CAAC,GAAG;AAAA,EACN;AAEO,SAAA;AACT;"}
1
+ {"version":3,"file":"load-script.mjs","sources":["../../src/load-script.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\n\nconst SCRIPTS_LOADED: Record<string, Promise<boolean>> = {};\n\ntype LoadScriptOptions = {\n module?: boolean;\n in?: 'head' | 'body';\n attributes?: Record<string, string>;\n};\n\nexport function loadScript(\n src: string,\n options?: LoadScriptOptions,\n): Promise<boolean> {\n const isScriptLoaded = SCRIPTS_LOADED[src];\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (isScriptLoaded) {\n return isScriptLoaded;\n }\n\n const promise = new Promise<boolean>((resolve, reject) => {\n const script = document.createElement('script');\n if (options?.module) {\n script.type = 'module';\n } else {\n script.type = 'text/javascript';\n }\n script.src = src;\n script.onload = (): void => {\n resolve(true);\n };\n script.onerror = (): void => {\n reject(false);\n };\n if (options?.in === 'head') {\n document.head.appendChild(script);\n } else {\n document.body.appendChild(script);\n }\n\n const attributes = options?.attributes;\n if (attributes) {\n Object.keys(attributes).forEach((key) => {\n script.setAttribute(key, attributes[key]);\n });\n }\n });\n\n SCRIPTS_LOADED[src] = promise;\n\n return promise;\n}\n\ntype LoadScriptParams = Parameters<typeof loadScript>;\n\n/**\n * The `useLoadScript` hook loads an external script tag in the browser. It allows React components to lazy-load large third-party dependencies.\n */\nexport function useLoadScript(\n url: LoadScriptParams[0],\n options?: LoadScriptParams[1],\n): ScriptState {\n const [status, setStatus] = useState<ScriptState>('loading');\n\n useEffect(\n () => {\n loadScript(url, options)\n .then(() => setStatus('done'))\n .catch(() => setStatus('error'));\n },\n // Ignore options changes since it won't trigger a new load.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [url],\n );\n\n return status;\n}\n\ntype ScriptState = 'loading' | 'done' | 'error';\n"],"names":[],"mappings":";AAEA,MAAM,iBAAmD,CAAA;AAQlD,SAAS,WACd,KACA,SACkB;AAClB,QAAM,iBAAiB,eAAe,GAAG;AAGzC,MAAI,gBAAgB;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,IAAI,QAAiB,CAAC,SAAS,WAAW;AACxD,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,QAAI,mCAAS,QAAQ;AACnB,aAAO,OAAO;AAAA,IAChB,OAAO;AACL,aAAO,OAAO;AAAA,IAChB;AACA,WAAO,MAAM;AACb,WAAO,SAAS,MAAY;AAC1B,cAAQ,IAAI;AAAA,IACd;AACA,WAAO,UAAU,MAAY;AAC3B,aAAO,KAAK;AAAA,IACd;AACA,SAAI,mCAAS,QAAO,QAAQ;AAC1B,eAAS,KAAK,YAAY,MAAM;AAAA,IAClC,OAAO;AACL,eAAS,KAAK,YAAY,MAAM;AAAA,IAClC;AAEA,UAAM,aAAa,mCAAS;AAC5B,QAAI,YAAY;AACd,aAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,eAAO,aAAa,KAAK,WAAW,GAAG,CAAC;AAAA,MAC1C,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,iBAAe,GAAG,IAAI;AAEtB,SAAO;AACT;AAOO,SAAS,cACd,KACA,SACa;AACb,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAsB,SAAS;AAE3D;AAAA,IACE,MAAM;AACJ,iBAAW,KAAK,OAAO,EACpB,KAAK,MAAM,UAAU,MAAM,CAAC,EAC5B,MAAM,MAAM,UAAU,OAAO,CAAC;AAAA,IACnC;AAAA;AAAA;AAAA,IAGA,CAAC,GAAG;AAAA,EAAA;AAGN,SAAO;AACT;"}
@@ -30,9 +30,9 @@ function t(t2, n2) {
30
30
  return a2;
31
31
  }
32
32
  var n;
33
- !function(t2) {
33
+ !(function(t2) {
34
34
  t2[t2.NotStarted = 0] = "NotStarted", t2[t2.Running = 1] = "Running", t2[t2.Stopped = 2] = "Stopped";
35
- }(n || (n = {}));
35
+ })(n || (n = {}));
36
36
  var e = { type: "xstate.init" };
37
37
  function r(t2) {
38
38
  return void 0 === t2 ? [] : [].concat(t2);
@@ -56,45 +56,45 @@ function c(t2, n2) {
56
56
  }
57
57
  function f(t2, n2, e2) {
58
58
  var r2 = n2, i2 = false;
59
- return [t2.filter(function(t3) {
59
+ return [t2.filter((function(t3) {
60
60
  if ("xstate.assign" === t3.type) {
61
61
  i2 = true;
62
62
  var n3 = Object.assign({}, r2);
63
- return "function" == typeof t3.assignment ? n3 = t3.assignment(r2, e2) : Object.keys(t3.assignment).forEach(function(i3) {
63
+ return "function" == typeof t3.assignment ? n3 = t3.assignment(r2, e2) : Object.keys(t3.assignment).forEach((function(i3) {
64
64
  n3[i3] = "function" == typeof t3.assignment[i3] ? t3.assignment[i3](r2, e2) : t3.assignment[i3];
65
- }), r2 = n3, false;
65
+ })), r2 = n3, false;
66
66
  }
67
67
  return true;
68
- }), r2, i2];
68
+ })), r2, i2];
69
69
  }
70
70
  function s(n2, i2) {
71
71
  void 0 === i2 && (i2 = {});
72
- var s2 = t(f(r(n2.states[n2.initial].entry).map(function(t2) {
72
+ var s2 = t(f(r(n2.states[n2.initial].entry).map((function(t2) {
73
73
  return o(t2, i2.actions);
74
- }), n2.context, e), 2), l2 = s2[0], v2 = s2[1], y = { config: n2, _options: i2, initialState: { value: n2.initial, actions: l2, context: v2, matches: a(n2.initial) }, transition: function(e2, i3) {
74
+ })), n2.context, e), 2), l2 = s2[0], v2 = s2[1], y = { config: n2, _options: i2, initialState: { value: n2.initial, actions: l2, context: v2, matches: a(n2.initial) }, transition: function(e2, i3) {
75
75
  var s3, l3, v3 = "string" == typeof e2 ? { value: e2, context: n2.context } : e2, p = v3.value, g = v3.context, d = u(i3), x = n2.states[p];
76
76
  if (x.on) {
77
77
  var m = r(x.on[d.type]);
78
78
  try {
79
- for (var h = function(t2) {
79
+ for (var h = (function(t2) {
80
80
  var n3 = "function" == typeof Symbol && Symbol.iterator, e3 = n3 && t2[n3], r2 = 0;
81
81
  if (e3) return e3.call(t2);
82
82
  if (t2 && "number" == typeof t2.length) return { next: function() {
83
83
  return t2 && r2 >= t2.length && (t2 = void 0), { value: t2 && t2[r2++], done: !t2 };
84
84
  } };
85
85
  throw new TypeError(n3 ? "Object is not iterable." : "Symbol.iterator is not defined.");
86
- }(m), b = h.next(); !b.done; b = h.next()) {
86
+ })(m), b = h.next(); !b.done; b = h.next()) {
87
87
  var S = b.value;
88
88
  if (void 0 === S) return c(p, g);
89
89
  var w = "string" == typeof S ? { target: S } : S, j = w.target, E = w.actions, R = void 0 === E ? [] : E, N = w.cond, O = void 0 === N ? function() {
90
90
  return true;
91
91
  } : N, _ = void 0 === j, k = null != j ? j : p, T = n2.states[k];
92
92
  if (O(g, d)) {
93
- var q = t(f((_ ? r(R) : [].concat(x.exit, R, T.entry).filter(function(t2) {
93
+ var q = t(f((_ ? r(R) : [].concat(x.exit, R, T.entry).filter((function(t2) {
94
94
  return t2;
95
- })).map(function(t2) {
95
+ }))).map((function(t2) {
96
96
  return o(t2, y._options.actions);
97
- }), g, d), 3), z = q[0], A = q[1], B = q[2], C = null != j ? j : p;
97
+ })), g, d), 3), z = q[0], A = q[1], B = q[2], C = null != j ? j : p;
98
98
  return { value: C, context: A, actions: z, changed: j !== p || z.length > 0 || B, matches: a(C) };
99
99
  }
100
100
  }
@@ -113,16 +113,16 @@ function s(n2, i2) {
113
113
  return y;
114
114
  }
115
115
  var l = function(t2, n2) {
116
- return t2.actions.forEach(function(e2) {
116
+ return t2.actions.forEach((function(e2) {
117
117
  var r2 = e2.exec;
118
118
  return r2 && r2(t2.context, n2);
119
- });
119
+ }));
120
120
  };
121
121
  function v(t2) {
122
122
  var r2 = t2.initialState, i2 = n.NotStarted, o2 = /* @__PURE__ */ new Set(), c2 = { _machine: t2, send: function(e2) {
123
- i2 === n.Running && (r2 = t2.transition(r2, e2), l(r2, u(e2)), o2.forEach(function(t3) {
123
+ i2 === n.Running && (r2 = t2.transition(r2, e2), l(r2, u(e2)), o2.forEach((function(t3) {
124
124
  return t3(r2);
125
- }));
125
+ })));
126
126
  }, subscribe: function(t3) {
127
127
  return o2.add(t3), t3(r2), { unsubscribe: function() {
128
128
  return o2.delete(t3);
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../../../../node_modules/@xstate/fsm/es/index.js"],"sourcesContent":["/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\nfunction t(t,n){var e=\"function\"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,i,o=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return a}var n;!function(t){t[t.NotStarted=0]=\"NotStarted\",t[t.Running=1]=\"Running\",t[t.Stopped=2]=\"Stopped\"}(n||(n={}));var e={type:\"xstate.init\"};function r(t){return void 0===t?[]:[].concat(t)}function i(t){return{type:\"xstate.assign\",assignment:t}}function o(t,n){return\"string\"==typeof(t=\"string\"==typeof t&&n&&n[t]?n[t]:t)?{type:t}:\"function\"==typeof t?{type:t.name,exec:t}:t}function a(t){return function(n){return t===n}}function u(t){return\"string\"==typeof t?{type:t}:t}function c(t,n){return{value:t,context:n,actions:[],changed:!1,matches:a(t)}}function f(t,n,e){var r=n,i=!1;return[t.filter((function(t){if(\"xstate.assign\"===t.type){i=!0;var n=Object.assign({},r);return\"function\"==typeof t.assignment?n=t.assignment(r,e):Object.keys(t.assignment).forEach((function(i){n[i]=\"function\"==typeof t.assignment[i]?t.assignment[i](r,e):t.assignment[i]})),r=n,!1}return!0})),r,i]}function s(n,i){void 0===i&&(i={});var s=t(f(r(n.states[n.initial].entry).map((function(t){return o(t,i.actions)})),n.context,e),2),l=s[0],v=s[1],y={config:n,_options:i,initialState:{value:n.initial,actions:l,context:v,matches:a(n.initial)},transition:function(e,i){var s,l,v=\"string\"==typeof e?{value:e,context:n.context}:e,p=v.value,g=v.context,d=u(i),x=n.states[p];if(x.on){var m=r(x.on[d.type]);try{for(var h=function(t){var n=\"function\"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&\"number\"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(m),b=h.next();!b.done;b=h.next()){var S=b.value;if(void 0===S)return c(p,g);var w=\"string\"==typeof S?{target:S}:S,j=w.target,E=w.actions,R=void 0===E?[]:E,N=w.cond,O=void 0===N?function(){return!0}:N,_=void 0===j,k=null!=j?j:p,T=n.states[k];if(O(g,d)){var q=t(f((_?r(R):[].concat(x.exit,R,T.entry).filter((function(t){return t}))).map((function(t){return o(t,y._options.actions)})),g,d),3),z=q[0],A=q[1],B=q[2],C=null!=j?j:p;return{value:C,context:A,actions:z,changed:j!==p||z.length>0||B,matches:a(C)}}}}catch(t){s={error:t}}finally{try{b&&!b.done&&(l=h.return)&&l.call(h)}finally{if(s)throw s.error}}}return c(p,g)}};return y}var l=function(t,n){return t.actions.forEach((function(e){var r=e.exec;return r&&r(t.context,n)}))};function v(t){var r=t.initialState,i=n.NotStarted,o=new Set,c={_machine:t,send:function(e){i===n.Running&&(r=t.transition(r,e),l(r,u(e)),o.forEach((function(t){return t(r)})))},subscribe:function(t){return o.add(t),t(r),{unsubscribe:function(){return o.delete(t)}}},start:function(o){if(o){var u=\"object\"==typeof o?o:{context:t.config.context,value:o};r={value:u.value,actions:[],context:u.context,matches:a(u.value)}}else r=t.initialState;return i=n.Running,l(r,e),c},stop:function(){return i=n.Stopped,o.clear(),c},get state(){return r},get status(){return i}};return c}export{n as InterpreterStatus,i as assign,s as createMachine,v as interpret};\n"],"names":["t","n","e","r","i","o","a","s","l","v","c","u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cAAaI,KAAE,EAAE,YAAWC,KAAE,oBAAI,OAAIK,KAAE,EAAC,UAASV,IAAE,MAAK,SAASE,IAAE;AAAC,IAAAE,OAAI,EAAE,YAAUD,KAAEH,GAAE,WAAWG,IAAED,EAAC,GAAE,EAAEC,IAAE,EAAED,EAAC,CAAC,GAAEG,GAAE,QAAS,SAASL,IAAE;AAAC,aAAOA,GAAEG,EAAC;AAAA,IAAC,CAAG;AAAA,EAAC,GAAE,WAAU,SAASH,IAAE;AAAC,WAAOK,GAAE,IAAIL,EAAC,GAAEA,GAAEG,EAAC,GAAE,EAAC,aAAY,WAAU;AAAC,aAAOE,GAAE,OAAOL,EAAC;AAAA,IAAC,EAAC;AAAA,EAAC,GAAE,OAAM,SAASK,IAAE;AAAC,QAAGA,IAAE;AAAC,UAAIM,KAAE,YAAU,OAAON,KAAEA,KAAE,EAAC,SAAQL,GAAE,OAAO,SAAQ,OAAMK,GAAC;AAAE,MAAAF,KAAE,EAAC,OAAMQ,GAAE,OAAM,SAAQ,CAAE,GAAC,SAAQA,GAAE,SAAQ,SAAQ,EAAEA,GAAE,KAAK,EAAC;AAAA,IAAC,MAAM,CAAAR,KAAEH,GAAE;AAAa,WAAOI,KAAE,EAAE,SAAQ,EAAED,IAAE,CAAC,GAAEO;AAAA,EAAC,GAAE,MAAK,WAAU;AAAC,WAAON,KAAE,EAAE,SAAQC,GAAE,MAAO,GAACK;AAAA,EAAC,GAAE,IAAI,QAAO;AAAC,WAAOP;AAAA,EAAC,GAAE,IAAI,SAAQ;AAAC,WAAOC;AAAA,EAAC,EAAC;AAAE,SAAOM;AAAC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../../../../node_modules/@xstate/fsm/es/index.js"],"sourcesContent":["/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\nfunction t(t,n){var e=\"function\"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,i,o=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return a}var n;!function(t){t[t.NotStarted=0]=\"NotStarted\",t[t.Running=1]=\"Running\",t[t.Stopped=2]=\"Stopped\"}(n||(n={}));var e={type:\"xstate.init\"};function r(t){return void 0===t?[]:[].concat(t)}function i(t){return{type:\"xstate.assign\",assignment:t}}function o(t,n){return\"string\"==typeof(t=\"string\"==typeof t&&n&&n[t]?n[t]:t)?{type:t}:\"function\"==typeof t?{type:t.name,exec:t}:t}function a(t){return function(n){return t===n}}function u(t){return\"string\"==typeof t?{type:t}:t}function c(t,n){return{value:t,context:n,actions:[],changed:!1,matches:a(t)}}function f(t,n,e){var r=n,i=!1;return[t.filter((function(t){if(\"xstate.assign\"===t.type){i=!0;var n=Object.assign({},r);return\"function\"==typeof t.assignment?n=t.assignment(r,e):Object.keys(t.assignment).forEach((function(i){n[i]=\"function\"==typeof t.assignment[i]?t.assignment[i](r,e):t.assignment[i]})),r=n,!1}return!0})),r,i]}function s(n,i){void 0===i&&(i={});var s=t(f(r(n.states[n.initial].entry).map((function(t){return o(t,i.actions)})),n.context,e),2),l=s[0],v=s[1],y={config:n,_options:i,initialState:{value:n.initial,actions:l,context:v,matches:a(n.initial)},transition:function(e,i){var s,l,v=\"string\"==typeof e?{value:e,context:n.context}:e,p=v.value,g=v.context,d=u(i),x=n.states[p];if(x.on){var m=r(x.on[d.type]);try{for(var h=function(t){var n=\"function\"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&\"number\"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}(m),b=h.next();!b.done;b=h.next()){var S=b.value;if(void 0===S)return c(p,g);var w=\"string\"==typeof S?{target:S}:S,j=w.target,E=w.actions,R=void 0===E?[]:E,N=w.cond,O=void 0===N?function(){return!0}:N,_=void 0===j,k=null!=j?j:p,T=n.states[k];if(O(g,d)){var q=t(f((_?r(R):[].concat(x.exit,R,T.entry).filter((function(t){return t}))).map((function(t){return o(t,y._options.actions)})),g,d),3),z=q[0],A=q[1],B=q[2],C=null!=j?j:p;return{value:C,context:A,actions:z,changed:j!==p||z.length>0||B,matches:a(C)}}}}catch(t){s={error:t}}finally{try{b&&!b.done&&(l=h.return)&&l.call(h)}finally{if(s)throw s.error}}}return c(p,g)}};return y}var l=function(t,n){return t.actions.forEach((function(e){var r=e.exec;return r&&r(t.context,n)}))};function v(t){var r=t.initialState,i=n.NotStarted,o=new Set,c={_machine:t,send:function(e){i===n.Running&&(r=t.transition(r,e),l(r,u(e)),o.forEach((function(t){return t(r)})))},subscribe:function(t){return o.add(t),t(r),{unsubscribe:function(){return o.delete(t)}}},start:function(o){if(o){var u=\"object\"==typeof o?o:{context:t.config.context,value:o};r={value:u.value,actions:[],context:u.context,matches:a(u.value)}}else r=t.initialState;return i=n.Running,l(r,e),c},stop:function(){return i=n.Stopped,o.clear(),c},get state(){return r},get status(){return i}};return c}export{n as InterpreterStatus,i as assign,s as createMachine,v as interpret};\n"],"names":["t","n","e","r","i","o","a","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EH,GAAE,cAAaI,KAAE,EAAE,YAAWC,KAAE,oBAAI,OAAIK,KAAE,EAAC,UAASV,IAAE,MAAK,SAASE,IAAE;AAAC,IAAAE,OAAI,EAAE,YAAUD,KAAEH,GAAE,WAAWG,IAAED,EAAC,GAAE,EAAEC,IAAE,EAAED,EAAC,CAAC,GAAEG,GAAE,SAAS,SAASL,IAAE;AAAC,aAAOA,GAAEG,EAAC;AAAA,IAAC,EAAC;AAAA,EAAG,GAAE,WAAU,SAASH,IAAE;AAAC,WAAOK,GAAE,IAAIL,EAAC,GAAEA,GAAEG,EAAC,GAAE,EAAC,aAAY,WAAU;AAAC,aAAOE,GAAE,OAAOL,EAAC;AAAA,IAAC,EAAC;AAAA,EAAC,GAAE,OAAM,SAASK,IAAE;AAAC,QAAGA,IAAE;AAAC,UAAIM,KAAE,YAAU,OAAON,KAAEA,KAAE,EAAC,SAAQL,GAAE,OAAO,SAAQ,OAAMK,GAAC;AAAE,MAAAF,KAAE,EAAC,OAAMQ,GAAE,OAAM,SAAQ,CAAA,GAAG,SAAQA,GAAE,SAAQ,SAAQ,EAAEA,GAAE,KAAK,EAAC;AAAA,IAAC,MAAM,CAAAR,KAAEH,GAAE;AAAa,WAAOI,KAAE,EAAE,SAAQ,EAAED,IAAE,CAAC,GAAEO;AAAA,EAAC,GAAE,MAAK,WAAU;AAAC,WAAON,KAAE,EAAE,SAAQC,GAAE,MAAK,GAAGK;AAAA,EAAC,GAAE,IAAI,QAAO;AAAC,WAAOP;AAAA,EAAC,GAAE,IAAI,SAAQ;AAAC,WAAOC;AAAA,EAAC,EAAC;AAAE,SAAOM;AAAC;","x_google_ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  import { interpret as v, createMachine as s, InterpreterStatus as n } from "../../fsm/es/index.mjs";
2
2
  import { useRef, useState, useEffect, useCallback } from "react";
3
- import index from "../../../use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs";
3
+ import useIsomorphicLayoutEffect from "use-isomorphic-layout-effect";
4
4
  import { w as withSelectorExports } from "../../../../_virtual/with-selector.mjs";
5
5
  import useConstant from "./useConstant.mjs";
6
6
  var __read = function(o, n2) {
@@ -52,7 +52,7 @@ function useMachine(stateMachine, options) {
52
52
  };
53
53
  return [service2, queue2];
54
54
  }), 2), service = _b[0], queue = _b[1];
55
- index(function() {
55
+ useIsomorphicLayoutEffect(function() {
56
56
  if (options) {
57
57
  service._machine._options = options;
58
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fsm.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/fsm.js"],"sourcesContent":["var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { createMachine, interpret, InterpreterStatus } from '@xstate/fsm';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport useConstant from './useConstant';\nfunction identity(a) {\n return a;\n}\nvar getServiceState = function (service) {\n var currentValue;\n service\n .subscribe(function (state) {\n currentValue = state;\n })\n .unsubscribe();\n return currentValue;\n};\nexport function useMachine(stateMachine, options) {\n var persistedStateRef = useRef();\n if (process.env.NODE_ENV !== 'production') {\n var _a = __read(useState(stateMachine), 1), initialMachine = _a[0];\n if (stateMachine !== initialMachine) {\n console.warn('Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\\n' +\n 'Please make sure that you pass the same Machine as argument each time.');\n }\n }\n var _b = __read(useConstant(function () {\n var queue = [];\n var service = interpret(createMachine(stateMachine.config, options ? options : stateMachine._options));\n var send = service.send;\n service.send = function (event) {\n if (service.status === InterpreterStatus.NotStarted) {\n queue.push(event);\n return;\n }\n send(event);\n persistedStateRef.current = service.state;\n };\n return [service, queue];\n }), 2), service = _b[0], queue = _b[1];\n useIsomorphicLayoutEffect(function () {\n if (options) {\n service._machine._options = options;\n }\n });\n var useServiceResult = useService(service);\n useEffect(function () {\n service.start(persistedStateRef.current);\n queue.forEach(service.send);\n persistedStateRef.current = service.state;\n return function () {\n service.stop();\n };\n }, []);\n return useServiceResult;\n}\nvar isEqual = function (_prevState, nextState) { return nextState.changed === false; };\nexport function useService(service) {\n var getSnapshot = useCallback(function () { return getServiceState(service); }, [service]);\n var subscribe = useCallback(function (handleStoreChange) {\n var unsubscribe = service.subscribe(handleStoreChange).unsubscribe;\n return unsubscribe;\n }, [service]);\n var storeSnapshot = useSyncExternalStoreWithSelector(subscribe, getSnapshot, getSnapshot, identity, isEqual);\n return [storeSnapshot, service.send, service];\n}\n"],"names":["n","queue","service","interpret","createMachine","InterpreterStatus","useIsomorphicLayoutEffect","useSyncExternalStoreWithSelector"],"mappings":";;;;;AAAA,IAAI,SAAkC,SAAU,GAAGA,IAAG;AAClD,MAAI,IAAI,OAAO,WAAW,cAAc,EAAE,OAAO,QAAQ;AACzD,MAAI,CAAC,EAAG,QAAO;AACf,MAAI,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAA,GAAI;AAC/B,MAAI;AACA,YAAQA,OAAM,UAAUA,OAAM,MAAM,EAAE,IAAI,EAAE,KAAM,GAAE,KAAM,IAAG,KAAK,EAAE,KAAK;AAAA,EACjF,SACW,OAAO;AAAE,QAAI,EAAE,MAAY;AAAA,EAAG,UAC7B;AACJ,QAAI;AACA,UAAI,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,QAAQ,GAAI,GAAE,KAAK,CAAC;AAAA,IAC3D,UACgB;AAAE,UAAI,EAAG,OAAM,EAAE;AAAA,IAAM;AAAA,EACvC;AACI,SAAO;AACX;AAMA,SAAS,SAAS,GAAG;AACj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,YAAY;AAAQ;AAC/E,SAAS,WAAW,SAAS;AAChC,MAAI,cAAc,YAAY,WAAY;AAAE,WAAO,gBAAgB,OAAO;AAAA,EAAE,GAAI,CAAC,OAAO,CAAC;AACzF,MAAI,YAAY,YAAY,SAAU,mBAAmB;AACrD,QAAI,cAAc,QAAQ,UAAU,iBAAiB,EAAE;AACvD,WAAO;AAAA,EACf,GAAO,CAAC,OAAO,CAAC;AACZ,MAAI,gBAAgBC,oBAAAA,iCAAiC,WAAW,aAAa,aAAa,UAAU,OAAO;AAC3G,SAAO,CAAC,eAAe,QAAQ,MAAM,OAAO;AAChD;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"fsm.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/fsm.js"],"sourcesContent":["var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { createMachine, interpret, InterpreterStatus } from '@xstate/fsm';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport useConstant from './useConstant';\nfunction identity(a) {\n return a;\n}\nvar getServiceState = function (service) {\n var currentValue;\n service\n .subscribe(function (state) {\n currentValue = state;\n })\n .unsubscribe();\n return currentValue;\n};\nexport function useMachine(stateMachine, options) {\n var persistedStateRef = useRef();\n if (process.env.NODE_ENV !== 'production') {\n var _a = __read(useState(stateMachine), 1), initialMachine = _a[0];\n if (stateMachine !== initialMachine) {\n console.warn('Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\\n' +\n 'Please make sure that you pass the same Machine as argument each time.');\n }\n }\n var _b = __read(useConstant(function () {\n var queue = [];\n var service = interpret(createMachine(stateMachine.config, options ? options : stateMachine._options));\n var send = service.send;\n service.send = function (event) {\n if (service.status === InterpreterStatus.NotStarted) {\n queue.push(event);\n return;\n }\n send(event);\n persistedStateRef.current = service.state;\n };\n return [service, queue];\n }), 2), service = _b[0], queue = _b[1];\n useIsomorphicLayoutEffect(function () {\n if (options) {\n service._machine._options = options;\n }\n });\n var useServiceResult = useService(service);\n useEffect(function () {\n service.start(persistedStateRef.current);\n queue.forEach(service.send);\n persistedStateRef.current = service.state;\n return function () {\n service.stop();\n };\n }, []);\n return useServiceResult;\n}\nvar isEqual = function (_prevState, nextState) { return nextState.changed === false; };\nexport function useService(service) {\n var getSnapshot = useCallback(function () { return getServiceState(service); }, [service]);\n var subscribe = useCallback(function (handleStoreChange) {\n var unsubscribe = service.subscribe(handleStoreChange).unsubscribe;\n return unsubscribe;\n }, [service]);\n var storeSnapshot = useSyncExternalStoreWithSelector(subscribe, getSnapshot, getSnapshot, identity, isEqual);\n return [storeSnapshot, service.send, service];\n}\n"],"names":["n","queue","service","interpret","createMachine","InterpreterStatus","useSyncExternalStoreWithSelector"],"mappings":";;;;;AAAA,IAAI,SAAkC,SAAU,GAAGA,IAAG;AAClD,MAAI,IAAI,OAAO,WAAW,cAAc,EAAE,OAAO,QAAQ;AACzD,MAAI,CAAC,EAAG,QAAO;AACf,MAAI,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAA,GAAI;AAC/B,MAAI;AACA,YAAQA,OAAM,UAAUA,OAAM,MAAM,EAAE,IAAI,EAAE,KAAI,GAAI,KAAM,IAAG,KAAK,EAAE,KAAK;AAAA,EAC7E,SACO,OAAO;AAAE,QAAI,EAAE,MAAY;AAAA,EAAI,UAC1C;AACQ,QAAI;AACA,UAAI,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,QAAQ,GAAI,GAAE,KAAK,CAAC;AAAA,IACnD,UACR;AAAkB,U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B;AAAA,EACJ,GAAG,CAAA,CAAE;AACL,SAAO;AACX;AACA,IAAI,UAAU,SAAU,YAAY,WAAW;AAAE,SAAO,UAAU,YAAY;AAAO;AAC9E,SAAS,WAAW,SAAS;AAChC,MAAI,cAAc,YAAY,WAAY;AAAE,WAAO,gBAAgB,OAAO;AAAA,EAAG,GAAG,CAAC,OAAO,CAAC;AACzF,MAAI,YAAY,YAAY,SAAU,mBAAmB;AACrD,QAAI,cAAc,QAAQ,UAAU,iBAAiB,EAAE;AACvD,WAAO;AAAA,EACX,GAAG,CAAC,OAAO,CAAC;AACZ,MAAI,gBAAgBK,oBAAAA,iCAAiC,WAAW,aAAa,aAAa,UAAU,OAAO;AAC3G,SAAO,CAAC,eAAe,QAAQ,MAAM,OAAO;AAChD;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"useConstant.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/useConstant.js"],"sourcesContent":["import * as React from 'react';\nexport default function useConstant(fn) {\n var ref = React.useRef();\n if (!ref.current) {\n ref.current = { v: fn() };\n }\n return ref.current.v;\n}\n"],"names":[],"mappings":";AACe,SAAS,YAAY,IAAI;AACpC,MAAI,MAAM,MAAM,OAAQ;AACxB,MAAI,CAAC,IAAI,SAAS;AACd,QAAI,UAAU,EAAE,GAAG,GAAE,EAAI;AAAA,EACjC;AACI,SAAO,IAAI,QAAQ;AACvB;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"useConstant.mjs","sources":["../../../../../../../../node_modules/@xstate/react/es/useConstant.js"],"sourcesContent":["import * as React from 'react';\nexport default function useConstant(fn) {\n var ref = React.useRef();\n if (!ref.current) {\n ref.current = { v: fn() };\n }\n return ref.current.v;\n}\n"],"names":[],"mappings":";AACe,SAAS,YAAY,IAAI;AACpC,MAAI,MAAM,MAAM,OAAM;AACtB,MAAI,CAAC,IAAI,SAAS;AACd,QAAI,UAAU,EAAE,GAAG,GAAE,EAAE;AAAA,EAC3B;AACA,SAAO,IAAI,QAAQ;AACvB;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"with-selector.development.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,KAAC,WAAW;AAKd,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,gCACpC,YACF;AACA,uCAA+B,4BAA4B,IAAI,OAAO;AAAA,MACxE;AACU,UAAI,QAAQA;AACtB,UAAI,OAAOC,YAAuC;AAMlD,eAAS,GAAG,GAAG,GAAG;AAChB,eAAO,MAAM,MAAM,MAAM,KAAK,IAAI,MAAM,IAAI,MAAM,MAAM,KAAK,MAAM;AAAA,MAErE;AAEA,UAAI,WAAW,OAAO,OAAO,OAAO,aAAa,OAAO,KAAK;AAE7D,UAAI,uBAAuB,KAAK;AAIhC,UAAI,SAAS,MAAM,QACf,YAAY,MAAM,WAClB,UAAU,MAAM,SAChB,gBAAgB,MAAM;AAE1B,eAAS,iCAAiC,WAAW,aAAa,mBAAmB,UAAU,SAAS;AAEtG,YAAI,UAAU,OAAO,IAAI;AACzB,YAAI;AAEJ,YAAI,QAAQ,YAAY,MAAM;AAC5B,iBAAO;AAAA,YACL,UAAU;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A,QACjB,GAAK,CAAC,KAAK,CAAC;AACV,sBAAc,KAAK;AACnB,eAAO;AAAA,MACT;AAEA,+BAAA,mCAA2C;AAE3C,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,OAAO;AAAA,MACvE;AAAA,IAEA,GAAM;AAAA,EACN;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"with-selector.development.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,KAAC,WAAW;AAKd,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,gCACpC,YACF;AACA,uCAA+B,4BAA4B,IAAI,OAAO;AAAA,MACxE;AACU,UAAI,QAAQA;AACtB,UAAI,OAAOC,YAAA;AAMX,eAAS,GAAG,GAAG,GAAG;AAChB,eAAO,MAAM,MAAM,MAAM,KAAK,IAAI,MAAM,IAAI,MAAM,MAAM,KAAK,MAAM;AAAA,MAErE;AAEA,UAAI,WAAW,OAAO,OAAO,OAAO,aAAa,OAAO,KAAK;AAE7D,UAAI,uBAAuB,KAAK;AAIhC,UAAI,SAAS,MAAM,QACf,YAAY,MAAM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CAAC,aAAa,mBAAmB,UAAU,OAAO,CAAC,GAClD,eAAe,SAAS,CAAC,GACzB,qBAAqB,SAAS,CAAC;AAEnC,YAAI,QAAQ,qBAAqB,WAAW,cAAc,kBAAkB;AAC5E,kBAAU,WAAY;AACpB,eAAK,WAAW;AAChB,eAAK,QAAQ;AAAA,QACjB,GAAK,CAAC,KAAK,CAAC;AACV,sBAAc,KAAK;AACnB,eAAO;AAAA,MACT;AAEA,+BAAA,mCAA2C;AAE3C,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,OAAO;AAAA,MACvE;AAAA,IAEA,GAAG;AAAA,EACH;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"with-selector.production.min.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasVal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,EAAC,CAAE;AAAA,MAAC,GAAE,SAAO,IAAE,SAAO,WAAU;AAAC,eAAOA,GAAE,EAAC,CAAE;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,GAAE,CAAC,CAAC;AAAE,QAAI,IAAE,EAAE,GAAE,EAAE,CAAC,GAAE,EAAE,CAAC,CAAC;AACrf,MAAE,WAAU;AAAC,QAAE,WAAS;AAAG,QAAE,QAAM;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"with-selector.production.min.mjs","sources":["../../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n"],"names":["require$$0","require$$1","a","c","d","b","e"],"mappings":";;;;;;;;;;;;;;;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;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,GAAE,CAAC,CAAC;AAAE,QAAI,IAAE,EAAE,GAAE,EAAE,CAAC,GAAE,EAAE,CAAC,CAAC;AACrf,MAAE,WAAU;AAAC,QAAE,WAAS;AAAG,QAAE,QAAM;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-sync-external-store-shim.development.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('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.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","error"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,KAAC,WAAW;AAKd,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,gCACpC,YACF;AACA,uCAA+B,4BAA4B,IAAI,OAAO;AAAA,MACxE;AACU,UAAI,QAAQA;AAEtB,UAAI,uBAAuB,MAAM;AAEjC,eAAS,MAAM,QAAQ;AACrB;AACE;AACE,qBAAS,QAAQ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AM,yBAAyB,SAAY,MAAM,uBAAuB;AAErG,2CAAA,uBAA+B;AAE/B,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,OAAO;AAAA,MACvE;AAAA,IAEA,GAAM;AAAA,EACN;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"use-sync-external-store-shim.development.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('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.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n"],"names":["require$$0","error"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,KAAC,WAAW;AAKd,UACE,OAAO,mCAAmC,eAC1C,OAAO,+BAA+B,gCACpC,YACF;AACA,uCAA+B,4BAA4B,IAAI,OAAO;AAAA,MACxE;AACU,UAAI,QAAQA;AAEtB,UAAI,uBAAuB,MAAM;AAEjC,eAAS,MAAM,QAAQ;AACrB;AACE;AACE,qBAAS,QAAQ,UAAU,QAAQ,OAAO,IAAI,MAAM,QAAQ,IAAI,QAAQ,IAAI,CAAC,GAAG,QAAQ,GAAG,QAAQ,OAA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A+B,+BACpC,YACF;AACA,uCAA+B,2BAA2B,IAAI,OAAO;AAAA,MACvE;AAAA,IAEA,GAAG;AAAA,EACH;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-sync-external-store-shim.production.min.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n"],"names":["require$$0"],"mappings":";;;;;;;;;;;;;;;AASa,MAAI,IAAEA;AAAiB,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,MAAI,MAAI,MAAI,KAAG,IAAE,MAAI,IAAE,MAAI,MAAI,KAAG,MAAI;AAAA,EAAC;AAAC,MAAI,IAAE,eAAa,OAAO,OAAO,KAAG,OAAO,KAAG,GAAE,IAAE,EAAE,UAAS,IAAE,EAAE,WAAU,IAAE,EAAE,iBAAgB,IAAE,EAAE;AAAc,WAAS,EAAE,GAAE,GAAE;AAAC,QAAI,IAAE,EAAC,GAAG,IAAE,EAAE,EAAC,MAAK,EAAC,OAAM,GAAE,aAAY,EAAC,EAAC,CAAC,GAAE,IAAE,EAAE,CAAC,EAAE,MAAK,IAAE,EAAE,CAAC;AAAE,MAAE,WAAU;AAAC,QAAE,QAAM;AAAE,QAAE,cAAY;AAAE,QAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,CAAC,CAAC;AAAE,MAAE,WAAU;AAAC,QAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAE,aAAO,EAAE,WAAU;AAAC,UAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;AAClc,WAAS,EAAE,GAAE;AAAC,QAAI,IAAE,EAAE;AAAY,QAAE,EAAE;AAAM,QAAG;AAAC,UAAI,IAAE,EAAC;AAAG,aAAM,CAAC,EAAE,GAAE,CAAC;AAAA,IAAC,SAAO,GAAE;AAAC,aAAM;AAAA,IAAE;AAAA,EAAC;AAAC,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,EAAC;AAAA,EAAE;AAAC,MAAI,IAAE,gBAAc,OAAO,UAAQ,gBAAc,OAAO,OAAO,YAAU,gBAAc,OAAO,OAAO,SAAS,gBAAc,IAAE;AAAE,0CAA4B,uBAAC,WAAS,EAAE,uBAAqB,EAAE,uBAAqB;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"use-sync-external-store-shim.production.min.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n"],"names":["require$$0"],"mappings":";;;;;;;;;;;;;;;AASa,MAAI,IAAEA;AAAiB,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,MAAI,MAAI,MAAI,KAAG,IAAE,MAAI,IAAE,MAAI,MAAI,KAAG,MAAI;AAAA,EAAC;AAAC,MAAI,IAAE,eAAa,OAAO,OAAO,KAAG,OAAO,KAAG,GAAE,IAAE,EAAE,UAAS,IAAE,EAAE,WAAU,IAAE,EAAE,iBAAgB,IAAE,EAAE;AAAc,WAAS,EAAE,GAAE,GAAE;AAAC,QAAI,IAAE,EAAC,GAAG,IAAE,EAAE,EAAC,MAAK,EAAC,OAAM,GAAE,aAAY,EAAC,EAAC,CAAC,GAAE,IAAE,EAAE,CAAC,EAAE,MAAK,IAAE,EAAE,CAAC;AAAE,MAAE,WAAU;AAAC,QAAE,QAAM;AAAE,QAAE,cAAY;AAAE,QAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAA,IAAC,GAAE,CAAC,GAAE,GAAE,CAAC,CAAC;AAAE,MAAE,WAAU;AAAC,QAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAE,aAAO,EAAE,WAAU;AAAC,UAAE,CAAC,KAAG,EAAE,EAAC,MAAK,EAAC,CAAC;AAAA,MAAC,CAAC;AAAA,IAAC,GAAE,CAAC,CAAC,CAAC;AAAE,MAAE,CAAC;AAAE,WAAO;AAAA,EAAC;AAClc,WAAS,EAAE,GAAE;AAAC,QAAI,IAAE,EAAE;AAAY,QAAE,EAAE;AAAM,QAAG;AAAC,UAAI,IAAE,EAAC;AAAG,aAAM,CAAC,EAAE,GAAE,CAAC;AAAA,IAAC,SAAO,GAAE;AAAC,aAAM;AAAA,IAAE;AAAA,EAAC;AAAC,WAAS,EAAE,GAAE,GAAE;AAAC,WAAO,EAAC;AAAA,EAAE;AAAC,MAAI,IAAE,gBAAc,OAAO,UAAQ,gBAAc,OAAO,OAAO,YAAU,gBAAc,OAAO,OAAO,SAAS,gBAAc,IAAE;AAAE,0CAAA,uBAA6B,WAAS,EAAE,uBAAqB,EAAE,uBAAqB;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"names":["shimModule","require$$0","require$$1"],"mappings":";;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,SAAA,UAAiBC,+CAAgE;AAAA,EACnF,OAAO;AACLD,SAAA,UAAiBE,4CAA6D;AAAA,EAChF;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"names":["shimModule","require$$0","require$$1"],"mappings":";;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,SAAA,UAAiBC,+CAAA;AAAA,EACnB,OAAO;AACLD,SAAA,UAAiBE,4CAAA;AAAA,EACnB;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"with-selector.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/with-selector.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n"],"names":["withSelectorModule","require$$0","require$$1"],"mappings":";;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,iBAAA,UAAiBC,mCAA8E;AAAA,EACjG,OAAO;AACLD,iBAAA,UAAiBE,gCAA2E;AAAA,EAC9F;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"with-selector.mjs","sources":["../../../../../../../node_modules/use-sync-external-store/shim/with-selector.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n"],"names":["withSelectorModule","require$$0","require$$1"],"mappings":";;;;;;;AAEA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,iBAAA,UAAiBC,mCAAA;AAAA,EACnB,OAAO;AACLD,iBAAA,UAAiBE,gCAAA;AAAA,EACnB;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"optionValueDecoder.mjs","sources":["../../src/optionValueDecoder.ts"],"sourcesContent":["/**\n * This file provides utility functions for determining whether or not an option value combination is present in an encoded option value string.\n *\n * In V1 of the encoding strategy, option value arrays are encoded as a trie with the following rules:\n * - `:` `,` ` ` and `-` are control characters.\n * - `:` indicates a new option. ex: 0:1 indicates value 0 for the option in position 1, value 1 for the option in position 2.\n * - `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * - ` ` indicates a gap in the sequence of option values. ex: `0 4` indicates option values in position 0 and 4 are present.\n * - `-` indicates a continuous range of option values. ex: `0 1-3 4`. Ranges are only present encoded in the final option value position, so for example the trie for the set [[0,0,0],[0,0,1], ..., [0,2,2]] will be structured as `0:0:0-2,1:0-2,2:0-2`, not `0:0-2:0-2`.\n */\n\nimport {Product} from './storefront-api-types.js';\n\nconst OPTION_VALUE_SEPARATOR = ',';\n\nconst V1_CONTROL_CHARS = {\n OPTION: ':',\n END_OF_PREFIX: ',',\n SEQUENCE_GAP: ' ',\n RANGE: '-',\n};\n\nexport type IsOptionValueCombinationInEncodedVariant = (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n) => boolean;\n\n/**\n * Determine whether an option value combination is present in an encoded option value string. Function is memoized by encodedVariantField.\n *\n * @param targetOptionValueCombination - Indices of option values to look up in the encoded option value string. A partial set of indices may be passed to determine whether a node or any children is present. For example, if a product has 3 options, passing [0] will return true if any option value combination for the first option's option value is present in the encoded string.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-04/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-04/objects/Product#field-encodedvariantavailability)\n * @returns - True if a full or partial targetOptionValueIndices is present in the encoded option value string, false otherwise.\n */\nexport const isOptionValueCombinationInEncodedVariant: IsOptionValueCombinationInEncodedVariant =\n ((): IsOptionValueCombinationInEncodedVariant => {\n const decodedOptionValues = new Map<string, Set<string>>();\n\n return function (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n ): boolean {\n if (targetOptionValueCombination.length === 0) {\n return false;\n }\n\n if (!decodedOptionValues.has(encodedVariantField)) {\n const decodedOptionValuesSet = new Set<string>();\n\n for (const optionValue of decodeEncodedVariant(encodedVariantField)) {\n // add the complete option value to the decoded option values set\n decodedOptionValuesSet.add(optionValue.join(OPTION_VALUE_SEPARATOR));\n\n // add all composite parts of the option value to the decoded option values set. e.g. if the option value is [0,1,2], add \"0\", \"0,1\", \"0,1,2\"\n for (let i = 0; i < optionValue.length; i++) {\n decodedOptionValuesSet.add(\n optionValue.slice(0, i + 1).join(OPTION_VALUE_SEPARATOR),\n );\n }\n }\n\n decodedOptionValues.set(encodedVariantField, decodedOptionValuesSet);\n }\n\n return Boolean(\n decodedOptionValues\n .get(encodedVariantField)\n ?.has(targetOptionValueCombination.join(OPTION_VALUE_SEPARATOR)),\n );\n };\n })();\n\ntype EncodedVariantField =\n | Product['encodedVariantAvailability']\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n | Product['encodedVariantExistence'];\ntype DecodedOptionValues = number[][];\n\n/**\n * For an encoded option value string, decode into option value combinations. Entries represent a valid combination formatted as an array of option value positions.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-04/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-04/objects/Product#field-encodedvariantavailability)\n * @returns Decoded option value combinations\n */\nexport function decodeEncodedVariant(\n encodedVariantField: EncodedVariantField,\n): DecodedOptionValues {\n if (!encodedVariantField) return [];\n\n if (encodedVariantField.startsWith('v1_')) {\n return v1Decoder(stripVersion(encodedVariantField));\n }\n\n throw new Error('Unsupported option value encoding');\n}\n\nconst stripVersion: (encodedVariantField: string) => string = (\n encodedVariantField: string,\n) => encodedVariantField.replace(/^v1_/, '');\n\n/**\n * We encode an array of arrays representing variants, expressed in terms of options and option values, as a trie.\n *\n * This encoding strategy allows extremely large numbers of variants to be expressed in an extremely compact data structure.\n *\n * Integers represent option and values, so [0,0,0] represents option_value at array index 0 for the options at array indexes 0, 1 and 2\n *\n * `:`, `,`, ` ` and `-` are control characters.\n * `:` indicates a new option\n * `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * ` ` indicates a gap in the sequence of option values\n * `-` indicates a continuous range of option values\n *\n * Encoding process:\n *\n * example input array: [[0,0,0], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,1], [2,0,1], [2,1,0]]\n *\n * step 1: encode as string: \"0:0:0,0:1:0,0:1:1,1:0:0,1:0:1,1:1:1,2:0:1,2:1:0,\"\n * step 2: combine nodes that share a prefix: \"0:0:0,0:1:0 1,1:0:0 1,1:1:1,2:0:1,2:1:0,\"\n * step 3: encode data as a trie so no prefixes need to be repeated: \"0:0:0,1:0 1,,1:0:0 1,1:1,,2:0:1,1:0,,\"\n * step 4: since the options are sorted, use a dash to express ranges: \"0:0:0,1:0-1,,1:0:0-1,1:1,,2:0:1,1:0,,\"\n */\nfunction v1Decoder(encodedVariantField: string): number[][] {\n const tokenizer = /[ :,-]/g;\n let index = 0;\n let token: RegExpExecArray | null;\n const options: number[][] = [];\n const currentOptionValue: number[] = [];\n let depth = 0;\n let rangeStart: number | null = null;\n\n // iterate over control characters\n while ((token = tokenizer.exec(encodedVariantField))) {\n const operation = token[0];\n const optionValueIndex =\n Number.parseInt(encodedVariantField.slice(index, token.index)) || 0;\n\n if (rangeStart !== null) {\n // If a range has been started, iterate over the range and add each option value to the list of options\n // - `rangeStart` is set if the last control char was a dash, e.g. `0` for 0-2. It represents the numeric option value position for the start of the range.\n // - `optionValueIndex` is the numeric option value position for the end of the range\n for (; rangeStart < optionValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n // indicates the range has been processed\n rangeStart = null;\n }\n\n currentOptionValue[depth] = optionValueIndex;\n\n if (operation === V1_CONTROL_CHARS.RANGE) {\n // dash operation indicates we are in a range. e.g. 0-2 means option values 0, 1, 2\n rangeStart = optionValueIndex;\n } else if (operation === V1_CONTROL_CHARS.OPTION) {\n // colon operation indicates that we are moving down to the next layer of option values. e.g. 0:0:0-2 means we traverse down from option1 to option3 and represents [[0,0,0], [0,0,1], [0,0,2]]\n depth++;\n } else {\n if (\n operation === V1_CONTROL_CHARS.SEQUENCE_GAP ||\n (operation === V1_CONTROL_CHARS.END_OF_PREFIX &&\n encodedVariantField[token.index - 1] !==\n V1_CONTROL_CHARS.END_OF_PREFIX)\n ) {\n // add the current option value to the list of options if we hit a gap in our sequence or we are at the end of our depth and need to move back up\n options.push([...currentOptionValue]);\n }\n if (operation === V1_CONTROL_CHARS.END_OF_PREFIX) {\n // go up an option level, trash the last item in currentOptionValue\n currentOptionValue.pop();\n depth--;\n }\n }\n index = tokenizer.lastIndex;\n }\n\n // The while loop only iterates control characters, meaning if an encoded string ends with an index it will not be processed.\n const encodingEndsWithIndex = encodedVariantField.match(/\\d+$/g);\n if (encodingEndsWithIndex) {\n const finalValueIndex = parseInt(encodingEndsWithIndex[0]);\n if (rangeStart != null) {\n // process final range\n for (; rangeStart <= finalValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n } else {\n // process final index\n options.push([finalValueIndex]);\n }\n }\n\n return options;\n}\n"],"names":[],"mappings":"AAaA,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AAAA,EACvB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,OAAO;AACT;AAcO,MAAM,2CACsC,uBAAA;AACzC,QAAA,0CAA0B,IAAyB;AAElD,SAAA,SACL,8BACA,qBACS;AA5Bf;AA6BU,QAAA,6BAA6B,WAAW,GAAG;AACtC,aAAA;AAAA,IAAA;AAGT,QAAI,CAAC,oBAAoB,IAAI,mBAAmB,GAAG;AAC3C,YAAA,6CAA6B,IAAY;AAEpC,iBAAA,eAAe,qBAAqB,mBAAmB,GAAG;AAEnE,+BAAuB,IAAI,YAAY,KAAK,sBAAsB,CAAC;AAGnE,iBAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AACpB,iCAAA;AAAA,YACrB,YAAY,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,sBAAsB;AAAA,UACzD;AAAA,QAAA;AAAA,MACF;AAGkB,0BAAA,IA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eAAe;AAEhD,2BAAmB,IAAI;AACvB;AAAA,MAAA;AAAA,IACF;AAEF,YAAQ,UAAU;AAAA,EAAA;AAId,QAAA,wBAAwB,oBAAoB,MAAM,OAAO;AAC/D,MAAI,uBAAuB;AACzB,UAAM,kBAAkB,SAAS,sBAAsB,CAAC,CAAC;AACzD,QAAI,cAAc,MAAM;AAEf,aAAA,cAAc,iBAAiB,cAAc;AAClD,2BAAmB,KAAK,IAAI;AAC5B,gBAAQ,KAAK,CAAC,GAAG,kBAAkB,CAAC;AAAA,MAAA;AAAA,IACtC,OACK;AAEG,cAAA,KAAK,CAAC,eAAe,CAAC;AAAA,IAAA;AAAA,EAChC;AAGK,SAAA;AACT;"}
1
+ {"version":3,"file":"optionValueDecoder.mjs","sources":["../../src/optionValueDecoder.ts"],"sourcesContent":["/**\n * This file provides utility functions for determining whether or not an option value combination is present in an encoded option value string.\n *\n * In V1 of the encoding strategy, option value arrays are encoded as a trie with the following rules:\n * - `:` `,` ` ` and `-` are control characters.\n * - `:` indicates a new option. ex: 0:1 indicates value 0 for the option in position 1, value 1 for the option in position 2.\n * - `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * - ` ` indicates a gap in the sequence of option values. ex: `0 4` indicates option values in position 0 and 4 are present.\n * - `-` indicates a continuous range of option values. ex: `0 1-3 4`. Ranges are only present encoded in the final option value position, so for example the trie for the set [[0,0,0],[0,0,1], ..., [0,2,2]] will be structured as `0:0:0-2,1:0-2,2:0-2`, not `0:0-2:0-2`.\n */\n\nimport {Product} from './storefront-api-types.js';\n\nconst OPTION_VALUE_SEPARATOR = ',';\n\nconst V1_CONTROL_CHARS = {\n OPTION: ':',\n END_OF_PREFIX: ',',\n SEQUENCE_GAP: ' ',\n RANGE: '-',\n};\n\nexport type IsOptionValueCombinationInEncodedVariant = (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n) => boolean;\n\n/**\n * Determine whether an option value combination is present in an encoded option value string. Function is memoized by encodedVariantField.\n *\n * @param targetOptionValueCombination - Indices of option values to look up in the encoded option value string. A partial set of indices may be passed to determine whether a node or any children is present. For example, if a product has 3 options, passing [0] will return true if any option value combination for the first option's option value is present in the encoded string.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-07/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-07/objects/Product#field-encodedvariantavailability)\n * @returns - True if a full or partial targetOptionValueIndices is present in the encoded option value string, false otherwise.\n */\nexport const isOptionValueCombinationInEncodedVariant: IsOptionValueCombinationInEncodedVariant =\n ((): IsOptionValueCombinationInEncodedVariant => {\n const decodedOptionValues = new Map<string, Set<string>>();\n\n return function (\n targetOptionValueCombination: number[],\n encodedVariantField: string,\n ): boolean {\n if (targetOptionValueCombination.length === 0) {\n return false;\n }\n\n if (!decodedOptionValues.has(encodedVariantField)) {\n const decodedOptionValuesSet = new Set<string>();\n\n for (const optionValue of decodeEncodedVariant(encodedVariantField)) {\n // add the complete option value to the decoded option values set\n decodedOptionValuesSet.add(optionValue.join(OPTION_VALUE_SEPARATOR));\n\n // add all composite parts of the option value to the decoded option values set. e.g. if the option value is [0,1,2], add \"0\", \"0,1\", \"0,1,2\"\n for (let i = 0; i < optionValue.length; i++) {\n decodedOptionValuesSet.add(\n optionValue.slice(0, i + 1).join(OPTION_VALUE_SEPARATOR),\n );\n }\n }\n\n decodedOptionValues.set(encodedVariantField, decodedOptionValuesSet);\n }\n\n return Boolean(\n decodedOptionValues\n .get(encodedVariantField)\n ?.has(targetOptionValueCombination.join(OPTION_VALUE_SEPARATOR)),\n );\n };\n })();\n\ntype EncodedVariantField =\n | Product['encodedVariantAvailability']\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n | Product['encodedVariantExistence'];\ntype DecodedOptionValues = number[][];\n\n/**\n * For an encoded option value string, decode into option value combinations. Entries represent a valid combination formatted as an array of option value positions.\n * @param encodedVariantField - Encoded option value string from the Storefront API, e.g. [product.encodedVariantExistence](/docs/api/storefront/2025-07/objects/Product#field-encodedvariantexistence) or [product.encodedVariantAvailability](/docs/api/storefront/2025-07/objects/Product#field-encodedvariantavailability)\n * @returns Decoded option value combinations\n */\nexport function decodeEncodedVariant(\n encodedVariantField: EncodedVariantField,\n): DecodedOptionValues {\n if (!encodedVariantField) return [];\n\n if (encodedVariantField.startsWith('v1_')) {\n return v1Decoder(stripVersion(encodedVariantField));\n }\n\n throw new Error('Unsupported option value encoding');\n}\n\nconst stripVersion: (encodedVariantField: string) => string = (\n encodedVariantField: string,\n) => encodedVariantField.replace(/^v1_/, '');\n\n/**\n * We encode an array of arrays representing variants, expressed in terms of options and option values, as a trie.\n *\n * This encoding strategy allows extremely large numbers of variants to be expressed in an extremely compact data structure.\n *\n * Integers represent option and values, so [0,0,0] represents option_value at array index 0 for the options at array indexes 0, 1 and 2\n *\n * `:`, `,`, ` ` and `-` are control characters.\n * `:` indicates a new option\n * `,` indicates the end of a repeated prefix, mulitple consecutive commas indicate the end of multiple repeated prefixes.\n * ` ` indicates a gap in the sequence of option values\n * `-` indicates a continuous range of option values\n *\n * Encoding process:\n *\n * example input array: [[0,0,0], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,1], [2,0,1], [2,1,0]]\n *\n * step 1: encode as string: \"0:0:0,0:1:0,0:1:1,1:0:0,1:0:1,1:1:1,2:0:1,2:1:0,\"\n * step 2: combine nodes that share a prefix: \"0:0:0,0:1:0 1,1:0:0 1,1:1:1,2:0:1,2:1:0,\"\n * step 3: encode data as a trie so no prefixes need to be repeated: \"0:0:0,1:0 1,,1:0:0 1,1:1,,2:0:1,1:0,,\"\n * step 4: since the options are sorted, use a dash to express ranges: \"0:0:0,1:0-1,,1:0:0-1,1:1,,2:0:1,1:0,,\"\n */\nfunction v1Decoder(encodedVariantField: string): number[][] {\n const tokenizer = /[ :,-]/g;\n let index = 0;\n let token: RegExpExecArray | null;\n const options: number[][] = [];\n const currentOptionValue: number[] = [];\n let depth = 0;\n let rangeStart: number | null = null;\n\n // iterate over control characters\n while ((token = tokenizer.exec(encodedVariantField))) {\n const operation = token[0];\n const optionValueIndex =\n Number.parseInt(encodedVariantField.slice(index, token.index)) || 0;\n\n if (rangeStart !== null) {\n // If a range has been started, iterate over the range and add each option value to the list of options\n // - `rangeStart` is set if the last control char was a dash, e.g. `0` for 0-2. It represents the numeric option value position for the start of the range.\n // - `optionValueIndex` is the numeric option value position for the end of the range\n for (; rangeStart < optionValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n // indicates the range has been processed\n rangeStart = null;\n }\n\n currentOptionValue[depth] = optionValueIndex;\n\n if (operation === V1_CONTROL_CHARS.RANGE) {\n // dash operation indicates we are in a range. e.g. 0-2 means option values 0, 1, 2\n rangeStart = optionValueIndex;\n } else if (operation === V1_CONTROL_CHARS.OPTION) {\n // colon operation indicates that we are moving down to the next layer of option values. e.g. 0:0:0-2 means we traverse down from option1 to option3 and represents [[0,0,0], [0,0,1], [0,0,2]]\n depth++;\n } else {\n if (\n operation === V1_CONTROL_CHARS.SEQUENCE_GAP ||\n (operation === V1_CONTROL_CHARS.END_OF_PREFIX &&\n encodedVariantField[token.index - 1] !==\n V1_CONTROL_CHARS.END_OF_PREFIX)\n ) {\n // add the current option value to the list of options if we hit a gap in our sequence or we are at the end of our depth and need to move back up\n options.push([...currentOptionValue]);\n }\n if (operation === V1_CONTROL_CHARS.END_OF_PREFIX) {\n // go up an option level, trash the last item in currentOptionValue\n currentOptionValue.pop();\n depth--;\n }\n }\n index = tokenizer.lastIndex;\n }\n\n // The while loop only iterates control characters, meaning if an encoded string ends with an index it will not be processed.\n const encodingEndsWithIndex = encodedVariantField.match(/\\d+$/g);\n if (encodingEndsWithIndex) {\n const finalValueIndex = parseInt(encodingEndsWithIndex[0]);\n if (rangeStart != null) {\n // process final range\n for (; rangeStart <= finalValueIndex; rangeStart++) {\n currentOptionValue[depth] = rangeStart;\n options.push([...currentOptionValue]);\n }\n } else {\n // process final index\n options.push([finalValueIndex]);\n }\n }\n\n return options;\n}\n"],"names":[],"mappings":"AAaA,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AAAA,EACvB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,cAAc;AAAA,EACd,OAAO;AACT;AAcO,MAAM,2CACV,uBAAgD;AAC/C,QAAM,0CAA0B,IAAA;AAEhC,SAAO,SACL,8BACA,qBACS;AA5Bf;AA6BM,QAAI,6BAA6B,WAAW,GAAG;AAC7C,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,oBAAoB,IAAI,mBAAmB,GAAG;AACjD,YAAM,6CAA6B,IAAA;AAEnC,iBAAW,eAAe,qBAAqB,mBAAmB,GAAG;AAEnE,+BAAuB,IAAI,YAAY,KAAK,sBAAsB,CAAC;AAGnE,iBAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AAC3C,iCAAuB;AAAA,YACrB,YAAY,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,sBAAsB;AAAA,UAAA;AAAA,QAE3D;AAAA,MACF;AAEA,0BAAoB,IAAI,qBAAqB,sBAAsB;AAAA,IACrE;AAEA,WAAO;AAAA,OACL,yBACG,IAAI,mBAAmB,MAD1B,mBAEI,IAAI,6BAA6B,KAAK,sBAAsB;AAAA,IAAC;AAAA,EAErE;AACF,GAAA;AAaK,SAAS,qBACd,qBACqB;AACrB,MAAI,CAAC,oBAAqB,QAAO,CAAA;AAEjC,MAAI,oBAAoB,WAAW,KAAK,GAAG;AACzC,WAAO,UAAU,aAAa,mBAAmB,CAAC;AAAA,EACpD;AAEA,QAAM,IAAI,MAAM,mCAAmC;AACrD;AAEA,MAAM,eAAwD,CAC5D,wBACG,oBAAoB,QAAQ,QAAQ,EAAE;AAwB3C,SAAS,UAAU,qBAAyC;AAC1D,QAAM,YAAY;AAClB,MAAI,QAAQ;AACZ,MAAI;AACJ,QAAM,UAAsB,CAAA;AAC5B,QAAM,qBAA+B,C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seMetafield(metafield) {
30
30
  parsedValue: metafield.value
31
31
  };
32
32
  // TODO: 'money' should probably be parsed even further to like `useMoney()`, but that logic needs to be extracted first so it's not a hook
33
+ case "money": {
34
+ let parsedValue = null;
35
+ try {
36
+ const parsed = parseJSON(metafield.value ?? "");
37
+ if (parsed && typeof parsed === "object" && "currency_code" in parsed) {
38
+ const moneyData = parsed;
39
+ parsedValue = {
40
+ amount: moneyData.amount,
41
+ currencyCode: moneyData.currency_code
42
+ };
43
+ } else if (parsed && typeof parsed === "object" && "currencyCode" in parsed) {
44
+ parsedValue = parsed;
45
+ } else {
46
+ parsedValue = parsed;
47
+ }
48
+ } catch (err) {
49
+ const parseError = `parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed.`;
50
+ {
51
+ throw new Error(parseError);
52
+ }
53
+ }
54
+ return {
55
+ ...metafield,
56
+ parsedValue
57
+ };
58
+ }
33
59
  case "dimension":
34
- case "money":
35
60
  case "json":
36
61
  case "rating":
37
62
  case "volume":