@shopify/hydrogen-react 0.0.0-next-5c16c78 → 0.0.0-next-dada720

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 (567) hide show
  1. package/README.md +21 -21
  2. package/dist/browser-dev/AddToCartButton.mjs +43 -40
  3. package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
  4. package/dist/browser-dev/BaseButton.mjs +13 -15
  5. package/dist/browser-dev/BaseButton.mjs.map +1 -1
  6. package/dist/browser-dev/BuyNowButton.mjs +19 -17
  7. package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
  8. package/dist/browser-dev/CartCheckoutButton.mjs +12 -15
  9. package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
  10. package/dist/browser-dev/CartCost.mjs +25 -0
  11. package/dist/browser-dev/CartCost.mjs.map +1 -0
  12. package/dist/browser-dev/CartLinePrice.mjs +18 -0
  13. package/dist/browser-dev/CartLinePrice.mjs.map +1 -0
  14. package/dist/browser-dev/CartLineProvider.mjs +19 -0
  15. package/dist/browser-dev/CartLineProvider.mjs.map +1 -0
  16. package/dist/browser-dev/CartProvider.mjs +73 -67
  17. package/dist/browser-dev/CartProvider.mjs.map +1 -1
  18. package/dist/browser-dev/ExternalVideo.mjs +13 -11
  19. package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
  20. package/dist/browser-dev/Image.mjs +41 -30
  21. package/dist/browser-dev/Image.mjs.map +1 -1
  22. package/dist/browser-dev/MediaFile.mjs +29 -21
  23. package/dist/browser-dev/MediaFile.mjs.map +1 -1
  24. package/dist/browser-dev/ModelViewer.mjs +138 -76
  25. package/dist/browser-dev/ModelViewer.mjs.map +1 -1
  26. package/dist/browser-dev/Money.mjs +12 -9
  27. package/dist/browser-dev/Money.mjs.map +1 -1
  28. package/dist/browser-dev/ProductPrice.mjs +12 -17
  29. package/dist/browser-dev/ProductPrice.mjs.map +1 -1
  30. package/dist/browser-dev/ProductProvider.mjs +102 -73
  31. package/dist/browser-dev/ProductProvider.mjs.map +1 -1
  32. package/dist/browser-dev/ShopPayButton.mjs +14 -24
  33. package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
  34. package/dist/browser-dev/ShopifyProvider.mjs +22 -29
  35. package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
  36. package/dist/browser-dev/Video.mjs +30 -21
  37. package/dist/browser-dev/Video.mjs.map +1 -1
  38. package/dist/browser-dev/_virtual/index.mjs +11 -2
  39. package/dist/browser-dev/_virtual/index.mjs.map +1 -1
  40. package/dist/browser-dev/_virtual/with-selector.mjs +11 -2
  41. package/dist/browser-dev/_virtual/with-selector.mjs.map +1 -1
  42. package/dist/browser-dev/analytics-constants.mjs +43 -0
  43. package/dist/browser-dev/analytics-constants.mjs.map +1 -0
  44. package/dist/browser-dev/analytics-schema-custom-storefront-customer-tracking.mjs +145 -0
  45. package/dist/browser-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -0
  46. package/dist/browser-dev/analytics-schema-trekkie-storefront-page-view.mjs +58 -0
  47. package/dist/browser-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -0
  48. package/dist/browser-dev/analytics-utils.mjs +49 -0
  49. package/dist/browser-dev/analytics-utils.mjs.map +1 -0
  50. package/dist/browser-dev/analytics.mjs +159 -0
  51. package/dist/browser-dev/analytics.mjs.map +1 -0
  52. package/dist/browser-dev/cart-hooks.mjs +29 -34
  53. package/dist/browser-dev/cart-hooks.mjs.map +1 -1
  54. package/dist/browser-dev/cart-queries.mjs +50 -20
  55. package/dist/browser-dev/cart-queries.mjs.map +1 -1
  56. package/dist/browser-dev/codegen.helpers.mjs +1 -0
  57. package/dist/browser-dev/codegen.helpers.mjs.map +1 -1
  58. package/dist/browser-dev/cookies-utils.mjs +50 -0
  59. package/dist/browser-dev/cookies-utils.mjs.map +1 -0
  60. package/dist/browser-dev/image-size.mjs +8 -8
  61. package/dist/browser-dev/image-size.mjs.map +1 -1
  62. package/dist/browser-dev/index.mjs +20 -2
  63. package/dist/browser-dev/index.mjs.map +1 -1
  64. package/dist/browser-dev/load-script.mjs.map +1 -1
  65. package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  66. package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs +2 -2
  67. package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  68. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  69. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  70. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  71. package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  72. package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs +3 -3
  73. package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
  74. package/dist/browser-dev/parse-metafield.mjs +4 -5
  75. package/dist/browser-dev/parse-metafield.mjs.map +1 -1
  76. package/dist/browser-dev/storefront-client.mjs +19 -20
  77. package/dist/browser-dev/storefront-client.mjs.map +1 -1
  78. package/dist/browser-dev/useCartAPIStateMachine.mjs +111 -80
  79. package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
  80. package/dist/browser-dev/useCartActions.mjs +150 -109
  81. package/dist/browser-dev/useCartActions.mjs.map +1 -1
  82. package/dist/browser-dev/useMoney.mjs +62 -36
  83. package/dist/browser-dev/useMoney.mjs.map +1 -1
  84. package/dist/browser-dev/useShopifyCookies.mjs +41 -0
  85. package/dist/browser-dev/useShopifyCookies.mjs.map +1 -0
  86. package/dist/browser-prod/AddToCartButton.mjs +43 -40
  87. package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
  88. package/dist/browser-prod/BaseButton.mjs +13 -15
  89. package/dist/browser-prod/BaseButton.mjs.map +1 -1
  90. package/dist/browser-prod/BuyNowButton.mjs +19 -17
  91. package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
  92. package/dist/browser-prod/CartCheckoutButton.mjs +12 -15
  93. package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
  94. package/dist/browser-prod/CartCost.mjs +25 -0
  95. package/dist/browser-prod/CartCost.mjs.map +1 -0
  96. package/dist/browser-prod/CartLinePrice.mjs +18 -0
  97. package/dist/browser-prod/CartLinePrice.mjs.map +1 -0
  98. package/dist/browser-prod/CartLineProvider.mjs +19 -0
  99. package/dist/browser-prod/CartLineProvider.mjs.map +1 -0
  100. package/dist/browser-prod/CartProvider.mjs +73 -67
  101. package/dist/browser-prod/CartProvider.mjs.map +1 -1
  102. package/dist/browser-prod/ExternalVideo.mjs +13 -11
  103. package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
  104. package/dist/browser-prod/Image.mjs +35 -28
  105. package/dist/browser-prod/Image.mjs.map +1 -1
  106. package/dist/browser-prod/MediaFile.mjs +29 -21
  107. package/dist/browser-prod/MediaFile.mjs.map +1 -1
  108. package/dist/browser-prod/ModelViewer.mjs +135 -75
  109. package/dist/browser-prod/ModelViewer.mjs.map +1 -1
  110. package/dist/browser-prod/Money.mjs +12 -9
  111. package/dist/browser-prod/Money.mjs.map +1 -1
  112. package/dist/browser-prod/ProductPrice.mjs +12 -17
  113. package/dist/browser-prod/ProductPrice.mjs.map +1 -1
  114. package/dist/browser-prod/ProductProvider.mjs +102 -73
  115. package/dist/browser-prod/ProductProvider.mjs.map +1 -1
  116. package/dist/browser-prod/ShopPayButton.mjs +14 -24
  117. package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
  118. package/dist/browser-prod/ShopifyProvider.mjs +22 -26
  119. package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
  120. package/dist/browser-prod/Video.mjs +30 -21
  121. package/dist/browser-prod/Video.mjs.map +1 -1
  122. package/dist/browser-prod/_virtual/index.mjs +11 -2
  123. package/dist/browser-prod/_virtual/index.mjs.map +1 -1
  124. package/dist/browser-prod/_virtual/with-selector.mjs +11 -2
  125. package/dist/browser-prod/_virtual/with-selector.mjs.map +1 -1
  126. package/dist/browser-prod/analytics-constants.mjs +43 -0
  127. package/dist/browser-prod/analytics-constants.mjs.map +1 -0
  128. package/dist/browser-prod/analytics-schema-custom-storefront-customer-tracking.mjs +145 -0
  129. package/dist/browser-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -0
  130. package/dist/browser-prod/analytics-schema-trekkie-storefront-page-view.mjs +58 -0
  131. package/dist/browser-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -0
  132. package/dist/browser-prod/analytics-utils.mjs +49 -0
  133. package/dist/browser-prod/analytics-utils.mjs.map +1 -0
  134. package/dist/browser-prod/analytics.mjs +158 -0
  135. package/dist/browser-prod/analytics.mjs.map +1 -0
  136. package/dist/browser-prod/cart-hooks.mjs +29 -34
  137. package/dist/browser-prod/cart-hooks.mjs.map +1 -1
  138. package/dist/browser-prod/cart-queries.mjs +50 -20
  139. package/dist/browser-prod/cart-queries.mjs.map +1 -1
  140. package/dist/browser-prod/codegen.helpers.mjs +1 -0
  141. package/dist/browser-prod/codegen.helpers.mjs.map +1 -1
  142. package/dist/browser-prod/cookies-utils.mjs +50 -0
  143. package/dist/browser-prod/cookies-utils.mjs.map +1 -0
  144. package/dist/browser-prod/image-size.mjs +8 -8
  145. package/dist/browser-prod/image-size.mjs.map +1 -1
  146. package/dist/browser-prod/index.mjs +20 -2
  147. package/dist/browser-prod/index.mjs.map +1 -1
  148. package/dist/browser-prod/load-script.mjs.map +1 -1
  149. package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  150. package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs +2 -2
  151. package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  152. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  153. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  154. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  155. package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  156. package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs +3 -3
  157. package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
  158. package/dist/browser-prod/parse-metafield.mjs +4 -5
  159. package/dist/browser-prod/parse-metafield.mjs.map +1 -1
  160. package/dist/browser-prod/storefront-client.mjs +19 -20
  161. package/dist/browser-prod/storefront-client.mjs.map +1 -1
  162. package/dist/browser-prod/useCartAPIStateMachine.mjs +111 -80
  163. package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
  164. package/dist/browser-prod/useCartActions.mjs +150 -109
  165. package/dist/browser-prod/useCartActions.mjs.map +1 -1
  166. package/dist/browser-prod/useMoney.mjs +62 -36
  167. package/dist/browser-prod/useMoney.mjs.map +1 -1
  168. package/dist/browser-prod/useShopifyCookies.mjs +41 -0
  169. package/dist/browser-prod/useShopifyCookies.mjs.map +1 -0
  170. package/dist/node-dev/AddToCartButton.js +44 -41
  171. package/dist/node-dev/AddToCartButton.js.map +1 -1
  172. package/dist/node-dev/AddToCartButton.mjs +43 -40
  173. package/dist/node-dev/AddToCartButton.mjs.map +1 -1
  174. package/dist/node-dev/BaseButton.js +14 -16
  175. package/dist/node-dev/BaseButton.js.map +1 -1
  176. package/dist/node-dev/BaseButton.mjs +13 -15
  177. package/dist/node-dev/BaseButton.mjs.map +1 -1
  178. package/dist/node-dev/BuyNowButton.js +20 -18
  179. package/dist/node-dev/BuyNowButton.js.map +1 -1
  180. package/dist/node-dev/BuyNowButton.mjs +19 -17
  181. package/dist/node-dev/BuyNowButton.mjs.map +1 -1
  182. package/dist/node-dev/CartCheckoutButton.js +13 -16
  183. package/dist/node-dev/CartCheckoutButton.js.map +1 -1
  184. package/dist/node-dev/CartCheckoutButton.mjs +12 -15
  185. package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
  186. package/dist/node-dev/CartCost.js +25 -0
  187. package/dist/node-dev/CartCost.js.map +1 -0
  188. package/dist/node-dev/CartCost.mjs +25 -0
  189. package/dist/node-dev/CartCost.mjs.map +1 -0
  190. package/dist/node-dev/CartLinePrice.js +18 -0
  191. package/dist/node-dev/CartLinePrice.js.map +1 -0
  192. package/dist/node-dev/CartLinePrice.mjs +18 -0
  193. package/dist/node-dev/CartLinePrice.mjs.map +1 -0
  194. package/dist/node-dev/CartLineProvider.js +19 -0
  195. package/dist/node-dev/CartLineProvider.js.map +1 -0
  196. package/dist/node-dev/CartLineProvider.mjs +19 -0
  197. package/dist/node-dev/CartLineProvider.mjs.map +1 -0
  198. package/dist/node-dev/CartProvider.js +74 -68
  199. package/dist/node-dev/CartProvider.js.map +1 -1
  200. package/dist/node-dev/CartProvider.mjs +73 -67
  201. package/dist/node-dev/CartProvider.mjs.map +1 -1
  202. package/dist/node-dev/ExternalVideo.js +14 -12
  203. package/dist/node-dev/ExternalVideo.js.map +1 -1
  204. package/dist/node-dev/ExternalVideo.mjs +13 -11
  205. package/dist/node-dev/ExternalVideo.mjs.map +1 -1
  206. package/dist/node-dev/Image.js +42 -31
  207. package/dist/node-dev/Image.js.map +1 -1
  208. package/dist/node-dev/Image.mjs +41 -30
  209. package/dist/node-dev/Image.mjs.map +1 -1
  210. package/dist/node-dev/MediaFile.js +30 -22
  211. package/dist/node-dev/MediaFile.js.map +1 -1
  212. package/dist/node-dev/MediaFile.mjs +29 -21
  213. package/dist/node-dev/MediaFile.mjs.map +1 -1
  214. package/dist/node-dev/ModelViewer.js +139 -77
  215. package/dist/node-dev/ModelViewer.js.map +1 -1
  216. package/dist/node-dev/ModelViewer.mjs +138 -76
  217. package/dist/node-dev/ModelViewer.mjs.map +1 -1
  218. package/dist/node-dev/Money.js +13 -10
  219. package/dist/node-dev/Money.js.map +1 -1
  220. package/dist/node-dev/Money.mjs +12 -9
  221. package/dist/node-dev/Money.mjs.map +1 -1
  222. package/dist/node-dev/ProductPrice.js +13 -18
  223. package/dist/node-dev/ProductPrice.js.map +1 -1
  224. package/dist/node-dev/ProductPrice.mjs +12 -17
  225. package/dist/node-dev/ProductPrice.mjs.map +1 -1
  226. package/dist/node-dev/ProductProvider.js +103 -74
  227. package/dist/node-dev/ProductProvider.js.map +1 -1
  228. package/dist/node-dev/ProductProvider.mjs +102 -73
  229. package/dist/node-dev/ProductProvider.mjs.map +1 -1
  230. package/dist/node-dev/ShopPayButton.js +14 -24
  231. package/dist/node-dev/ShopPayButton.js.map +1 -1
  232. package/dist/node-dev/ShopPayButton.mjs +14 -24
  233. package/dist/node-dev/ShopPayButton.mjs.map +1 -1
  234. package/dist/node-dev/ShopifyProvider.js +23 -30
  235. package/dist/node-dev/ShopifyProvider.js.map +1 -1
  236. package/dist/node-dev/ShopifyProvider.mjs +22 -29
  237. package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
  238. package/dist/node-dev/Video.js +31 -22
  239. package/dist/node-dev/Video.js.map +1 -1
  240. package/dist/node-dev/Video.mjs +30 -21
  241. package/dist/node-dev/Video.mjs.map +1 -1
  242. package/dist/node-dev/_virtual/index.js +11 -3
  243. package/dist/node-dev/_virtual/index.js.map +1 -1
  244. package/dist/node-dev/_virtual/index.mjs +11 -2
  245. package/dist/node-dev/_virtual/index.mjs.map +1 -1
  246. package/dist/node-dev/_virtual/use-sync-external-store-shim.development.js +1 -1
  247. package/dist/node-dev/_virtual/use-sync-external-store-shim.production.min.js +1 -1
  248. package/dist/node-dev/_virtual/with-selector.development.js +1 -1
  249. package/dist/node-dev/_virtual/with-selector.js +11 -3
  250. package/dist/node-dev/_virtual/with-selector.js.map +1 -1
  251. package/dist/node-dev/_virtual/with-selector.mjs +11 -2
  252. package/dist/node-dev/_virtual/with-selector.mjs.map +1 -1
  253. package/dist/node-dev/_virtual/with-selector.production.min.js +1 -1
  254. package/dist/node-dev/analytics-constants.js +43 -0
  255. package/dist/node-dev/analytics-constants.js.map +1 -0
  256. package/dist/node-dev/analytics-constants.mjs +43 -0
  257. package/dist/node-dev/analytics-constants.mjs.map +1 -0
  258. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.js +145 -0
  259. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.js.map +1 -0
  260. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.mjs +145 -0
  261. package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -0
  262. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.js +58 -0
  263. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.js.map +1 -0
  264. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.mjs +58 -0
  265. package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -0
  266. package/dist/node-dev/analytics-utils.js +49 -0
  267. package/dist/node-dev/analytics-utils.js.map +1 -0
  268. package/dist/node-dev/analytics-utils.mjs +49 -0
  269. package/dist/node-dev/analytics-utils.mjs.map +1 -0
  270. package/dist/node-dev/analytics.js +159 -0
  271. package/dist/node-dev/analytics.js.map +1 -0
  272. package/dist/node-dev/analytics.mjs +159 -0
  273. package/dist/node-dev/analytics.mjs.map +1 -0
  274. package/dist/node-dev/cart-constants.js +1 -1
  275. package/dist/node-dev/cart-hooks.js +29 -34
  276. package/dist/node-dev/cart-hooks.js.map +1 -1
  277. package/dist/node-dev/cart-hooks.mjs +29 -34
  278. package/dist/node-dev/cart-hooks.mjs.map +1 -1
  279. package/dist/node-dev/cart-queries.js +51 -21
  280. package/dist/node-dev/cart-queries.js.map +1 -1
  281. package/dist/node-dev/cart-queries.mjs +50 -20
  282. package/dist/node-dev/cart-queries.mjs.map +1 -1
  283. package/dist/node-dev/codegen.helpers.js +2 -1
  284. package/dist/node-dev/codegen.helpers.js.map +1 -1
  285. package/dist/node-dev/codegen.helpers.mjs +1 -0
  286. package/dist/node-dev/codegen.helpers.mjs.map +1 -1
  287. package/dist/node-dev/cookies-utils.js +50 -0
  288. package/dist/node-dev/cookies-utils.js.map +1 -0
  289. package/dist/node-dev/cookies-utils.mjs +50 -0
  290. package/dist/node-dev/cookies-utils.mjs.map +1 -0
  291. package/dist/node-dev/flatten-connection.js +1 -1
  292. package/dist/node-dev/image-size.js +9 -9
  293. package/dist/node-dev/image-size.js.map +1 -1
  294. package/dist/node-dev/image-size.mjs +8 -8
  295. package/dist/node-dev/image-size.mjs.map +1 -1
  296. package/dist/node-dev/index.js +21 -3
  297. package/dist/node-dev/index.js.map +1 -1
  298. package/dist/node-dev/index.mjs +20 -2
  299. package/dist/node-dev/index.mjs.map +1 -1
  300. package/dist/node-dev/load-script.js +1 -1
  301. package/dist/node-dev/load-script.js.map +1 -1
  302. package/dist/node-dev/load-script.mjs.map +1 -1
  303. package/dist/node-dev/node_modules/@xstate/fsm/es/index.js +1 -1
  304. package/dist/node-dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
  305. package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  306. package/dist/node-dev/node_modules/@xstate/react/es/fsm.js +2 -2
  307. package/dist/node-dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
  308. package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs +2 -2
  309. package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  310. package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js +2 -4
  311. package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  312. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +2 -4
  313. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  314. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  315. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2 -4
  316. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  317. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  318. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +2 -4
  319. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  320. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  321. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +2 -4
  322. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  323. package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  324. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js +4 -4
  325. package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs +3 -3
  326. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js +1 -1
  327. package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
  328. package/dist/node-dev/parse-metafield.js +5 -6
  329. package/dist/node-dev/parse-metafield.js.map +1 -1
  330. package/dist/node-dev/parse-metafield.mjs +4 -5
  331. package/dist/node-dev/parse-metafield.mjs.map +1 -1
  332. package/dist/node-dev/storefront-api-constants.js +1 -1
  333. package/dist/node-dev/storefront-client.js +20 -21
  334. package/dist/node-dev/storefront-client.js.map +1 -1
  335. package/dist/node-dev/storefront-client.mjs +19 -20
  336. package/dist/node-dev/storefront-client.mjs.map +1 -1
  337. package/dist/node-dev/useCartAPIStateMachine.js +112 -81
  338. package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
  339. package/dist/node-dev/useCartAPIStateMachine.mjs +111 -80
  340. package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
  341. package/dist/node-dev/useCartActions.js +151 -110
  342. package/dist/node-dev/useCartActions.js.map +1 -1
  343. package/dist/node-dev/useCartActions.mjs +150 -109
  344. package/dist/node-dev/useCartActions.mjs.map +1 -1
  345. package/dist/node-dev/useMoney.js +63 -37
  346. package/dist/node-dev/useMoney.js.map +1 -1
  347. package/dist/node-dev/useMoney.mjs +62 -36
  348. package/dist/node-dev/useMoney.mjs.map +1 -1
  349. package/dist/node-dev/useShopifyCookies.js +41 -0
  350. package/dist/node-dev/useShopifyCookies.js.map +1 -0
  351. package/dist/node-dev/useShopifyCookies.mjs +41 -0
  352. package/dist/node-dev/useShopifyCookies.mjs.map +1 -0
  353. package/dist/node-prod/AddToCartButton.js +44 -41
  354. package/dist/node-prod/AddToCartButton.js.map +1 -1
  355. package/dist/node-prod/AddToCartButton.mjs +43 -40
  356. package/dist/node-prod/AddToCartButton.mjs.map +1 -1
  357. package/dist/node-prod/BaseButton.js +14 -16
  358. package/dist/node-prod/BaseButton.js.map +1 -1
  359. package/dist/node-prod/BaseButton.mjs +13 -15
  360. package/dist/node-prod/BaseButton.mjs.map +1 -1
  361. package/dist/node-prod/BuyNowButton.js +20 -18
  362. package/dist/node-prod/BuyNowButton.js.map +1 -1
  363. package/dist/node-prod/BuyNowButton.mjs +19 -17
  364. package/dist/node-prod/BuyNowButton.mjs.map +1 -1
  365. package/dist/node-prod/CartCheckoutButton.js +13 -16
  366. package/dist/node-prod/CartCheckoutButton.js.map +1 -1
  367. package/dist/node-prod/CartCheckoutButton.mjs +12 -15
  368. package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
  369. package/dist/node-prod/CartCost.js +25 -0
  370. package/dist/node-prod/CartCost.js.map +1 -0
  371. package/dist/node-prod/CartCost.mjs +25 -0
  372. package/dist/node-prod/CartCost.mjs.map +1 -0
  373. package/dist/node-prod/CartLinePrice.js +18 -0
  374. package/dist/node-prod/CartLinePrice.js.map +1 -0
  375. package/dist/node-prod/CartLinePrice.mjs +18 -0
  376. package/dist/node-prod/CartLinePrice.mjs.map +1 -0
  377. package/dist/node-prod/CartLineProvider.js +19 -0
  378. package/dist/node-prod/CartLineProvider.js.map +1 -0
  379. package/dist/node-prod/CartLineProvider.mjs +19 -0
  380. package/dist/node-prod/CartLineProvider.mjs.map +1 -0
  381. package/dist/node-prod/CartProvider.js +74 -68
  382. package/dist/node-prod/CartProvider.js.map +1 -1
  383. package/dist/node-prod/CartProvider.mjs +73 -67
  384. package/dist/node-prod/CartProvider.mjs.map +1 -1
  385. package/dist/node-prod/ExternalVideo.js +14 -12
  386. package/dist/node-prod/ExternalVideo.js.map +1 -1
  387. package/dist/node-prod/ExternalVideo.mjs +13 -11
  388. package/dist/node-prod/ExternalVideo.mjs.map +1 -1
  389. package/dist/node-prod/Image.js +36 -29
  390. package/dist/node-prod/Image.js.map +1 -1
  391. package/dist/node-prod/Image.mjs +35 -28
  392. package/dist/node-prod/Image.mjs.map +1 -1
  393. package/dist/node-prod/MediaFile.js +30 -22
  394. package/dist/node-prod/MediaFile.js.map +1 -1
  395. package/dist/node-prod/MediaFile.mjs +29 -21
  396. package/dist/node-prod/MediaFile.mjs.map +1 -1
  397. package/dist/node-prod/ModelViewer.js +136 -76
  398. package/dist/node-prod/ModelViewer.js.map +1 -1
  399. package/dist/node-prod/ModelViewer.mjs +135 -75
  400. package/dist/node-prod/ModelViewer.mjs.map +1 -1
  401. package/dist/node-prod/Money.js +13 -10
  402. package/dist/node-prod/Money.js.map +1 -1
  403. package/dist/node-prod/Money.mjs +12 -9
  404. package/dist/node-prod/Money.mjs.map +1 -1
  405. package/dist/node-prod/ProductPrice.js +13 -18
  406. package/dist/node-prod/ProductPrice.js.map +1 -1
  407. package/dist/node-prod/ProductPrice.mjs +12 -17
  408. package/dist/node-prod/ProductPrice.mjs.map +1 -1
  409. package/dist/node-prod/ProductProvider.js +103 -74
  410. package/dist/node-prod/ProductProvider.js.map +1 -1
  411. package/dist/node-prod/ProductProvider.mjs +102 -73
  412. package/dist/node-prod/ProductProvider.mjs.map +1 -1
  413. package/dist/node-prod/ShopPayButton.js +14 -24
  414. package/dist/node-prod/ShopPayButton.js.map +1 -1
  415. package/dist/node-prod/ShopPayButton.mjs +14 -24
  416. package/dist/node-prod/ShopPayButton.mjs.map +1 -1
  417. package/dist/node-prod/ShopifyProvider.js +23 -27
  418. package/dist/node-prod/ShopifyProvider.js.map +1 -1
  419. package/dist/node-prod/ShopifyProvider.mjs +22 -26
  420. package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
  421. package/dist/node-prod/Video.js +31 -22
  422. package/dist/node-prod/Video.js.map +1 -1
  423. package/dist/node-prod/Video.mjs +30 -21
  424. package/dist/node-prod/Video.mjs.map +1 -1
  425. package/dist/node-prod/_virtual/index.js +11 -3
  426. package/dist/node-prod/_virtual/index.js.map +1 -1
  427. package/dist/node-prod/_virtual/index.mjs +11 -2
  428. package/dist/node-prod/_virtual/index.mjs.map +1 -1
  429. package/dist/node-prod/_virtual/use-sync-external-store-shim.development.js +1 -1
  430. package/dist/node-prod/_virtual/use-sync-external-store-shim.production.min.js +1 -1
  431. package/dist/node-prod/_virtual/with-selector.development.js +1 -1
  432. package/dist/node-prod/_virtual/with-selector.js +11 -3
  433. package/dist/node-prod/_virtual/with-selector.js.map +1 -1
  434. package/dist/node-prod/_virtual/with-selector.mjs +11 -2
  435. package/dist/node-prod/_virtual/with-selector.mjs.map +1 -1
  436. package/dist/node-prod/_virtual/with-selector.production.min.js +1 -1
  437. package/dist/node-prod/analytics-constants.js +43 -0
  438. package/dist/node-prod/analytics-constants.js.map +1 -0
  439. package/dist/node-prod/analytics-constants.mjs +43 -0
  440. package/dist/node-prod/analytics-constants.mjs.map +1 -0
  441. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.js +145 -0
  442. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.js.map +1 -0
  443. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.mjs +145 -0
  444. package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -0
  445. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.js +58 -0
  446. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.js.map +1 -0
  447. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.mjs +58 -0
  448. package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -0
  449. package/dist/node-prod/analytics-utils.js +49 -0
  450. package/dist/node-prod/analytics-utils.js.map +1 -0
  451. package/dist/node-prod/analytics-utils.mjs +49 -0
  452. package/dist/node-prod/analytics-utils.mjs.map +1 -0
  453. package/dist/node-prod/analytics.js +158 -0
  454. package/dist/node-prod/analytics.js.map +1 -0
  455. package/dist/node-prod/analytics.mjs +158 -0
  456. package/dist/node-prod/analytics.mjs.map +1 -0
  457. package/dist/node-prod/cart-constants.js +1 -1
  458. package/dist/node-prod/cart-hooks.js +29 -34
  459. package/dist/node-prod/cart-hooks.js.map +1 -1
  460. package/dist/node-prod/cart-hooks.mjs +29 -34
  461. package/dist/node-prod/cart-hooks.mjs.map +1 -1
  462. package/dist/node-prod/cart-queries.js +51 -21
  463. package/dist/node-prod/cart-queries.js.map +1 -1
  464. package/dist/node-prod/cart-queries.mjs +50 -20
  465. package/dist/node-prod/cart-queries.mjs.map +1 -1
  466. package/dist/node-prod/codegen.helpers.js +2 -1
  467. package/dist/node-prod/codegen.helpers.js.map +1 -1
  468. package/dist/node-prod/codegen.helpers.mjs +1 -0
  469. package/dist/node-prod/codegen.helpers.mjs.map +1 -1
  470. package/dist/node-prod/cookies-utils.js +50 -0
  471. package/dist/node-prod/cookies-utils.js.map +1 -0
  472. package/dist/node-prod/cookies-utils.mjs +50 -0
  473. package/dist/node-prod/cookies-utils.mjs.map +1 -0
  474. package/dist/node-prod/flatten-connection.js +1 -1
  475. package/dist/node-prod/image-size.js +9 -9
  476. package/dist/node-prod/image-size.js.map +1 -1
  477. package/dist/node-prod/image-size.mjs +8 -8
  478. package/dist/node-prod/image-size.mjs.map +1 -1
  479. package/dist/node-prod/index.js +21 -3
  480. package/dist/node-prod/index.js.map +1 -1
  481. package/dist/node-prod/index.mjs +20 -2
  482. package/dist/node-prod/index.mjs.map +1 -1
  483. package/dist/node-prod/load-script.js +1 -1
  484. package/dist/node-prod/load-script.js.map +1 -1
  485. package/dist/node-prod/load-script.mjs.map +1 -1
  486. package/dist/node-prod/node_modules/@xstate/fsm/es/index.js +1 -1
  487. package/dist/node-prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
  488. package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
  489. package/dist/node-prod/node_modules/@xstate/react/es/fsm.js +2 -2
  490. package/dist/node-prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
  491. package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs +2 -2
  492. package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
  493. package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js +2 -4
  494. package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
  495. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +2 -4
  496. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
  497. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
  498. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2 -4
  499. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
  500. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
  501. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +2 -4
  502. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
  503. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
  504. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +2 -4
  505. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
  506. package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
  507. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js +4 -4
  508. package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs +3 -3
  509. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js +1 -1
  510. package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
  511. package/dist/node-prod/parse-metafield.js +5 -6
  512. package/dist/node-prod/parse-metafield.js.map +1 -1
  513. package/dist/node-prod/parse-metafield.mjs +4 -5
  514. package/dist/node-prod/parse-metafield.mjs.map +1 -1
  515. package/dist/node-prod/storefront-api-constants.js +1 -1
  516. package/dist/node-prod/storefront-client.js +20 -21
  517. package/dist/node-prod/storefront-client.js.map +1 -1
  518. package/dist/node-prod/storefront-client.mjs +19 -20
  519. package/dist/node-prod/storefront-client.mjs.map +1 -1
  520. package/dist/node-prod/useCartAPIStateMachine.js +112 -81
  521. package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
  522. package/dist/node-prod/useCartAPIStateMachine.mjs +111 -80
  523. package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
  524. package/dist/node-prod/useCartActions.js +151 -110
  525. package/dist/node-prod/useCartActions.js.map +1 -1
  526. package/dist/node-prod/useCartActions.mjs +150 -109
  527. package/dist/node-prod/useCartActions.mjs.map +1 -1
  528. package/dist/node-prod/useMoney.js +63 -37
  529. package/dist/node-prod/useMoney.js.map +1 -1
  530. package/dist/node-prod/useMoney.mjs +62 -36
  531. package/dist/node-prod/useMoney.mjs.map +1 -1
  532. package/dist/node-prod/useShopifyCookies.js +41 -0
  533. package/dist/node-prod/useShopifyCookies.js.map +1 -0
  534. package/dist/node-prod/useShopifyCookies.mjs +41 -0
  535. package/dist/node-prod/useShopifyCookies.mjs.map +1 -0
  536. package/dist/types/AddToCartButton.d.ts +3 -2
  537. package/dist/types/BuyNowButton.d.ts +7 -3
  538. package/dist/types/CartCheckoutButton.d.ts +6 -5
  539. package/dist/types/CartCost.d.ts +7 -5
  540. package/dist/types/CartLinePrice.d.ts +4 -4
  541. package/dist/types/CartLineProvider.d.ts +8 -6
  542. package/dist/types/CartProvider.d.ts +12 -2
  543. package/dist/types/ExternalVideo.d.ts +1 -2
  544. package/dist/types/Image.d.ts +5 -3
  545. package/dist/types/MediaFile.d.ts +12 -11
  546. package/dist/types/ModelViewer.d.ts +2 -2
  547. package/dist/types/ProductPrice.d.ts +1 -1
  548. package/dist/types/ProductProvider.d.ts +1 -1
  549. package/dist/types/ShopPayButton.d.ts +10 -10
  550. package/dist/types/ShopifyProvider.d.ts +35 -39
  551. package/dist/types/analytics-constants.d.ts +48 -0
  552. package/dist/types/analytics-schema-custom-storefront-customer-tracking.d.ts +3 -0
  553. package/dist/types/analytics-schema-trekkie-storefront-page-view.d.ts +2 -0
  554. package/dist/types/analytics-types.d.ts +108 -0
  555. package/dist/types/analytics-utils.d.ts +36 -0
  556. package/dist/types/analytics.d.ts +9 -0
  557. package/dist/types/cookies-utils.d.ts +4 -0
  558. package/dist/types/index.d.cts +11 -3
  559. package/dist/types/index.d.ts +11 -3
  560. package/dist/types/parse-metafield.d.ts +2 -4
  561. package/dist/types/storefront-client.d.ts +14 -14
  562. package/dist/types/useShopifyCookies.d.ts +14 -0
  563. package/dist/umd/hydrogen-react.dev.js +1625 -979
  564. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  565. package/dist/umd/hydrogen-react.prod.js +18 -16
  566. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  567. package/package.json +24 -19
@@ -1 +1 @@
1
- {"version":3,"file":"Image.js","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n }\n>;\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["Image","data","width","height","loading","loader","shopifyImageLoader","loaderOptions","widths","decoding","rest","url","missingUrlError","id","console","error","imgElementWidth","imgElementHeight","getShopifyImageDimensions","elementProps","finalSrc","src","Error","maxWidth","finalSrcset","srcSet","internalImageSrcSet","altText","alt","undefined","crop","scale","hasCustomWidths","Array","isArray","some","size","isNaN","aspectRatio","Number","setSizes","IMG_SRC_SET_SIZES","length","filter","srcGenerator","addImageSizeParametersToUrl","map","join"],"mappings":";;;;AA6DO,SAASA,MAAM;AAAA,EACpBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC,UAAAA;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AACc,GAAG;;AAChB,MAAA,CAACT,KAAKU,KAAK;AACPC,UAAAA,kBAAmB,kEACvBX,UAAKY,OAALZ,YAAW;AAKN;AACLa,cAAQC,MAAMH,eAAe;AAAA,IAC/B;AAEO,WAAA;AAAA,EACT;AAUM,QAAA;AAAA,IAACV,OAAOc;AAAAA,IAAiBb,QAAQc;AAAAA,MACrCC,oCAA0B;AAAA,IACxBjB;AAAAA,IACAM;AAAAA,IACAY,cAAc;AAAA,MACZjB;AAAAA,MACAC;AAAAA,IACF;AAAA,EAAA,CACD;AAUH,MAAIiB,WAAWnB,KAAKU;AAEpB,MAAIN,QAAQ;AACVe,eAAWf,OAAO;AAAA,MAChB,GAAGE;AAAAA,MACHc,KAAKpB,KAAKU;AAAAA,MACVT,OAAOc;AAAAA,MACPb,QAAQc;AAAAA,IAAAA,CACT;AACD,QAAI,OAAOG,aAAa,YAAY,CAACA,UAAU;AAC7C,YAAM,IAAIE,MACP,6DACCrB,UAAKY,OAALZ,YAAWA,KAAKU,KAChB;AAAA,IAEN;AAAA,EACF;AAIA,QAAMY,WACJrB,SAASc,mBAAmBd,QAAQc,kBAChCd,QACAc;AACAQ,QAAAA,eACJd,UAAKe,WAALf,YACAgB,oBAAoB;AAAA,IAClB,GAAGnB;AAAAA,IACHC;AAAAA,IACAa,KAAKpB,KAAKU;AAAAA,IACVT,OAAOqB;AAAAA,IACPpB,QAAQc;AAAAA,IACRZ;AAAAA,EAAAA,CACD;AAGH,wCACE,OAAA;AAAA,IACE,KAAIJ,UAAKY,OAALZ,YAAW;AAAA,IACf,MAAKA,gBAAK0B,YAAL1B,YAAgBS,KAAKkB,QAArB3B,YAA4B;AAAA,IACjC,SAASG,4BAAW;AAAA,IAAO,GACvBM;AAAAA,IACJ,KAAKU;AAAAA,IACL,OAAOJ,4CAAmBa;AAAAA,IAC1B,QAAQZ,8CAAoBY;AAAAA,IAC5B,QAAQL;AAAAA,IACR;AAAA,EAAA,CACA;AAGN;AASA,SAASE,oBAAoB;AAAA,EAC3BL;AAAAA,EACAnB;AAAAA,EACA4B;AAAAA,EACAC;AAAAA,EACAvB;AAAAA,EACAH;AAAAA,EACAF;AACqC,GAAG;AACxC,QAAM6B,kBAAkBxB,UAAUyB,MAAMC,QAAQ1B,MAAM;AACtD,MAAIwB,mBAAmBxB,OAAO2B,KAAMC,UAASC,MAAMD,IAAc,CAAC,GAAG;AAC7D,UAAA,IAAId,MACP,8DAA6DD,KAAK;AAAA,EAEvE;AAEA,MAAIiB,cAAc;AAClB,MAAIpC,SAASC,QAAQ;AACnBmC,kBAAcC,OAAOpC,MAAM,IAAIoC,OAAOrC,KAAK;AAAA,EAC7C;AAEIsC,MAAAA,WAAWR,kBAAkBxB,SAASiC;AAC1C,MACE,CAACT,mBACD9B,SACAA,QAAQuC,UAAkBA,kBAAAA,4BAAkBC,SAAS,IACrD;AACAF,eAAWC,UAAkBE,kBAAAA,OAAQP,CAASA,SAAAA,QAAQlC,KAAK;AAAA,EAC7D;AACM0C,QAAAA,eAAevC,SAASA,SAASwC;AACvC,SAAOL,SACJM,IACEV,CACE,SAAA,GAAEQ,aAAa;AAAA,IACdvB;AAAAA,IACAnB,OAAOkC;AAAAA,IAGPjC,QAAQ2B,OAAOS,OAAOH,IAAI,IAAIE,cAAcT;AAAAA,IAC5CC;AAAAA,IACAC;AAAAA,EAAAA,CACD,KAAKK,OAAO,EAEhBW,KAAK,IAAI;AACd;;"}
1
+ {"version":3,"file":"Image.js","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<ShopifyLoaderOptions & ImageSrc>;\n\ntype ImageSrc = {\n src: ImageType['url'];\n};\n\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> &\n ShopifyImageBaseProps;\n\ntype ShopifyImageBaseProps = {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["shopifyImageLoader","getShopifyImageDimensions","jsx","IMG_SRC_SET_SIZES","addImageSizeParametersToUrl"],"mappings":";;;;AAiEO,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAASA,UAAA;AAAA,EACT;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAsB;AAChB,MAAA,CAAC,KAAK,KAAK;AACP,UAAA,kBAAkB,iEACtB,KAAK,MAAM;AAKN;AACL,cAAQ,MAAM,eAAe;AAAA,IAC/B;AAEO,WAAA;AAAA,EACT;AAUA,QAAM,EAAC,OAAO,iBAAiB,QAAQ,iBAAA,IACrCC,UAAAA,0BAA0B;AAAA,IACxB;AAAA,IACA;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,IACF;AAAA,EAAA,CACD;AAUH,MAAI,WAAW,KAAK;AAEpB,MAAI,QAAQ;AACV,eAAW,OAAO;AAAA,MAChB,GAAG;AAAA,MACH,KAAK,KAAK;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,IAAA,CACT;AACD,QAAI,OAAO,aAAa,YAAY,CAAC,UAAU;AAC7C,YAAM,IAAI;AAAA,QACR,4DACE,KAAK,MAAM,KAAK;AAAA,MAAA;AAAA,IAGtB;AAAA,EACF;AAIA,QAAM,WACJ,SAAS,mBAAmB,QAAQ,kBAChC,QACA;AACA,QAAA,cACJ,KAAK,UACL,oBAAoB;AAAA,IAClB,GAAG;AAAA,IACH;AAAA,IACA,KAAK,KAAK;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,EAAA,CACD;AAID,SAAAC,2BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI,KAAK,MAAM;AAAA,MACf,KAAK,KAAK,WAAW,KAAK,OAAO;AAAA,MACjC,SAAS,WAAW;AAAA,MACnB,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO,mBAAmB;AAAA,MAC1B,QAAQ,oBAAoB;AAAA,MAC5B,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAAA;AAIN;AASA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0C;AACxC,QAAM,kBAAkB,UAAU,MAAM,QAAQ,MAAM;AAClD,MAAA,mBAAmB,OAAO,KAAK,CAAC,SAAS,MAAM,IAAc,CAAC,GAAG;AACnE,UAAM,IAAI;AAAA,MACR,8DAA8D;AAAA,IAAA;AAAA,EAElE;AAEA,MAAI,cAAc;AAClB,MAAI,SAAS,QAAQ;AACnB,kBAAc,OAAO,MAAM,IAAI,OAAO,KAAK;AAAA,EAC7C;AAEI,MAAA,WAAW,kBAAkB,SAASC;AAExC,MAAA,CAAC,mBACD,SACA,QAAQA,4BAAkBA,4BAAkB,SAAS,CAAC,GACtD;AACA,eAAWA,UAAkB,kBAAA,OAAO,CAAC,SAAS,QAAQ,KAAK;AAAA,EAC7D;AACM,QAAA,eAAe,SAAS,SAASC;AACvC,SAAO,SACJ;AAAA,IACC,CAAC,SACC,GAAG,aAAa;AAAA,MACd;AAAA,MACA,OAAO;AAAA;AAAA;AAAA,MAGP,QAAQ,OAAO,OAAO,IAAI,IAAI,cAAc;AAAA,MAC5C;AAAA,MACA;AAAA,IAAA,CACD,KAAK;AAAA,EAAA,EAET,KAAK,IAAI;AACd;;"}
@@ -1,5 +1,5 @@
1
- import { getShopifyImageDimensions, shopifyImageLoader, IMG_SRC_SET_SIZES, addImageSizeParametersToUrl } from "./image-size.mjs";
2
1
  import { jsx } from "react/jsx-runtime";
2
+ import { getShopifyImageDimensions, shopifyImageLoader, IMG_SRC_SET_SIZES, addImageSizeParametersToUrl } from "./image-size.mjs";
3
3
  function Image({
4
4
  data,
5
5
  width,
@@ -11,18 +11,14 @@ function Image({
11
11
  decoding = "async",
12
12
  ...rest
13
13
  }) {
14
- var _a, _b, _c, _d, _e, _f;
15
14
  if (!data.url) {
16
- const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${(_a = data.id) != null ? _a : "no ID provided"}`;
15
+ const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${data.id ?? "no ID provided"}`;
17
16
  {
18
17
  console.error(missingUrlError);
19
18
  }
20
19
  return null;
21
20
  }
22
- const {
23
- width: imgElementWidth,
24
- height: imgElementHeight
25
- } = getShopifyImageDimensions({
21
+ const { width: imgElementWidth, height: imgElementHeight } = getShopifyImageDimensions({
26
22
  data,
27
23
  loaderOptions,
28
24
  elementProps: {
@@ -39,11 +35,13 @@ function Image({
39
35
  height: imgElementHeight
40
36
  });
41
37
  if (typeof finalSrc !== "string" || !finalSrc) {
42
- throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${(_b = data.id) != null ? _b : data.url}`);
38
+ throw new Error(
39
+ `<Image/>: 'loader' did not return a valid string. Image: ${data.id ?? data.url}`
40
+ );
43
41
  }
44
42
  }
45
43
  const maxWidth = width && imgElementWidth && width < imgElementWidth ? width : imgElementWidth;
46
- const finalSrcset = (_c = rest.srcSet) != null ? _c : internalImageSrcSet({
44
+ const finalSrcset = rest.srcSet ?? internalImageSrcSet({
47
45
  ...loaderOptions,
48
46
  widths,
49
47
  src: data.url,
@@ -51,17 +49,20 @@ function Image({
51
49
  height: imgElementHeight,
52
50
  loader
53
51
  });
54
- return /* @__PURE__ */ jsx("img", {
55
- id: (_d = data.id) != null ? _d : "",
56
- alt: (_f = (_e = data.altText) != null ? _e : rest.alt) != null ? _f : "",
57
- loading: loading != null ? loading : "lazy",
58
- ...rest,
59
- src: finalSrc,
60
- width: imgElementWidth != null ? imgElementWidth : void 0,
61
- height: imgElementHeight != null ? imgElementHeight : void 0,
62
- srcSet: finalSrcset,
63
- decoding
64
- });
52
+ return /* @__PURE__ */ jsx(
53
+ "img",
54
+ {
55
+ id: data.id ?? "",
56
+ alt: data.altText ?? rest.alt ?? "",
57
+ loading: loading ?? "lazy",
58
+ ...rest,
59
+ src: finalSrc,
60
+ width: imgElementWidth ?? void 0,
61
+ height: imgElementHeight ?? void 0,
62
+ srcSet: finalSrcset,
63
+ decoding
64
+ }
65
+ );
65
66
  }
66
67
  function internalImageSrcSet({
67
68
  src,
@@ -74,7 +75,9 @@ function internalImageSrcSet({
74
75
  }) {
75
76
  const hasCustomWidths = widths && Array.isArray(widths);
76
77
  if (hasCustomWidths && widths.some((size) => isNaN(size))) {
77
- throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${src}`);
78
+ throw new Error(
79
+ `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`
80
+ );
78
81
  }
79
82
  let aspectRatio = 1;
80
83
  if (width && height) {
@@ -85,13 +88,17 @@ function internalImageSrcSet({
85
88
  setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);
86
89
  }
87
90
  const srcGenerator = loader ? loader : addImageSizeParametersToUrl;
88
- return setSizes.map((size) => `${srcGenerator({
89
- src,
90
- width: size,
91
- height: crop ? Number(size) * aspectRatio : void 0,
92
- crop,
93
- scale
94
- })} ${size}w`).join(", ");
91
+ return setSizes.map(
92
+ (size) => `${srcGenerator({
93
+ src,
94
+ width: size,
95
+ // height is not applied if there is no crop
96
+ // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size
97
+ height: crop ? Number(size) * aspectRatio : void 0,
98
+ crop,
99
+ scale
100
+ })} ${size}w`
101
+ ).join(", ");
95
102
  }
96
103
  export {
97
104
  Image
@@ -1 +1 @@
1
- {"version":3,"file":"Image.mjs","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n }\n>;\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> & {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":["Image","data","width","height","loading","loader","shopifyImageLoader","loaderOptions","widths","decoding","rest","url","missingUrlError","id","console","error","imgElementWidth","imgElementHeight","getShopifyImageDimensions","elementProps","finalSrc","src","Error","maxWidth","finalSrcset","srcSet","internalImageSrcSet","altText","alt","undefined","crop","scale","hasCustomWidths","Array","isArray","some","size","isNaN","aspectRatio","Number","setSizes","IMG_SRC_SET_SIZES","length","filter","srcGenerator","addImageSizeParametersToUrl","map","join"],"mappings":";;AA6DO,SAASA,MAAM;AAAA,EACpBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AACc,GAAG;;AAChB,MAAA,CAACT,KAAKU,KAAK;AACPC,UAAAA,kBAAmB,kEACvBX,UAAKY,OAALZ,YAAW;AAKN;AACLa,cAAQC,MAAMH,eAAe;AAAA,IAC/B;AAEO,WAAA;AAAA,EACT;AAUM,QAAA;AAAA,IAACV,OAAOc;AAAAA,IAAiBb,QAAQc;AAAAA,MACrCC,0BAA0B;AAAA,IACxBjB;AAAAA,IACAM;AAAAA,IACAY,cAAc;AAAA,MACZjB;AAAAA,MACAC;AAAAA,IACF;AAAA,EAAA,CACD;AAUH,MAAIiB,WAAWnB,KAAKU;AAEpB,MAAIN,QAAQ;AACVe,eAAWf,OAAO;AAAA,MAChB,GAAGE;AAAAA,MACHc,KAAKpB,KAAKU;AAAAA,MACVT,OAAOc;AAAAA,MACPb,QAAQc;AAAAA,IAAAA,CACT;AACD,QAAI,OAAOG,aAAa,YAAY,CAACA,UAAU;AAC7C,YAAM,IAAIE,MACP,6DACCrB,UAAKY,OAALZ,YAAWA,KAAKU,KAChB;AAAA,IAEN;AAAA,EACF;AAIA,QAAMY,WACJrB,SAASc,mBAAmBd,QAAQc,kBAChCd,QACAc;AACAQ,QAAAA,eACJd,UAAKe,WAALf,YACAgB,oBAAoB;AAAA,IAClB,GAAGnB;AAAAA,IACHC;AAAAA,IACAa,KAAKpB,KAAKU;AAAAA,IACVT,OAAOqB;AAAAA,IACPpB,QAAQc;AAAAA,IACRZ;AAAAA,EAAAA,CACD;AAGH,6BACE,OAAA;AAAA,IACE,KAAIJ,UAAKY,OAALZ,YAAW;AAAA,IACf,MAAKA,gBAAK0B,YAAL1B,YAAgBS,KAAKkB,QAArB3B,YAA4B;AAAA,IACjC,SAASG,4BAAW;AAAA,IAAO,GACvBM;AAAAA,IACJ,KAAKU;AAAAA,IACL,OAAOJ,4CAAmBa;AAAAA,IAC1B,QAAQZ,8CAAoBY;AAAAA,IAC5B,QAAQL;AAAAA,IACR;AAAA,EAAA,CACA;AAGN;AASA,SAASE,oBAAoB;AAAA,EAC3BL;AAAAA,EACAnB;AAAAA,EACA4B;AAAAA,EACAC;AAAAA,EACAvB;AAAAA,EACAH;AAAAA,EACAF;AACqC,GAAG;AACxC,QAAM6B,kBAAkBxB,UAAUyB,MAAMC,QAAQ1B,MAAM;AACtD,MAAIwB,mBAAmBxB,OAAO2B,KAAMC,UAASC,MAAMD,IAAc,CAAC,GAAG;AAC7D,UAAA,IAAId,MACP,8DAA6DD,KAAK;AAAA,EAEvE;AAEA,MAAIiB,cAAc;AAClB,MAAIpC,SAASC,QAAQ;AACnBmC,kBAAcC,OAAOpC,MAAM,IAAIoC,OAAOrC,KAAK;AAAA,EAC7C;AAEIsC,MAAAA,WAAWR,kBAAkBxB,SAASiC;AAC1C,MACE,CAACT,mBACD9B,SACAA,QAAQuC,kBAAkBA,kBAAkBC,SAAS,IACrD;AACAF,eAAWC,kBAAkBE,OAAQP,CAASA,SAAAA,QAAQlC,KAAK;AAAA,EAC7D;AACM0C,QAAAA,eAAevC,SAASA,SAASwC;AACvC,SAAOL,SACJM,IACEV,CACE,SAAA,GAAEQ,aAAa;AAAA,IACdvB;AAAAA,IACAnB,OAAOkC;AAAAA,IAGPjC,QAAQ2B,OAAOS,OAAOH,IAAI,IAAIE,cAAcT;AAAAA,IAC5CC;AAAAA,IACAC;AAAAA,EAAAA,CACD,KAAKK,OAAO,EAEhBW,KAAK,IAAI;AACd;"}
1
+ {"version":3,"file":"Image.mjs","sources":["../../src/Image.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n getShopifyImageDimensions,\n shopifyImageLoader,\n addImageSizeParametersToUrl,\n IMG_SRC_SET_SIZES,\n} from './image-size.js';\nimport type {Image as ImageType} from './storefront-api-types.js';\nimport type {PartialDeep, Simplify} from 'type-fest';\n\ntype HtmlImageProps = React.ImgHTMLAttributes<HTMLImageElement>;\n\nexport type ShopifyLoaderOptions = {\n crop?: 'top' | 'bottom' | 'left' | 'right' | 'center';\n scale?: 2 | 3;\n width?: HtmlImageProps['width'] | ImageType['width'];\n height?: HtmlImageProps['height'] | ImageType['height'];\n};\nexport type ShopifyLoaderParams = Simplify<ShopifyLoaderOptions & ImageSrc>;\n\ntype ImageSrc = {\n src: ImageType['url'];\n};\n\nexport type ShopifyImageProps = Omit<HtmlImageProps, 'src'> &\n ShopifyImageBaseProps;\n\ntype ShopifyImageBaseProps = {\n /** An object with fields that correspond to the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image).\n * The `data` prop is required.\n */\n data: PartialDeep<ImageType, {recurseIntoArrays: true}>;\n /** A custom function that generates the image URL. Parameters passed in\n * are `ShopifyLoaderParams`\n */\n loader?: (params: ShopifyLoaderParams) => string;\n /** An object of `loader` function options. For example, if the `loader` function\n * requires a `scale` option, then the value can be a property of the\n * `loaderOptions` object (for example, `{scale: 2}`). The object shape is `ShopifyLoaderOptions`.\n */\n loaderOptions?: ShopifyLoaderOptions;\n /**\n * `src` isn't used, and should instead be passed as part of the `data` object\n */\n src?: never;\n /**\n * An array of pixel widths to overwrite the default generated srcset. For example, `[300, 600, 800]`.\n */\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n};\n\n/**\n * The `Image` component renders an image for the Storefront API's\n * [Image object](https://shopify.dev/api/storefront/reference/common-objects/image) by using the `data` prop. You can [customize this component](https://shopify.dev/api/hydrogen/components#customizing-hydrogen-components) using passthrough props.\n *\n * An image's width and height are determined using the following priority list:\n * 1. The width and height values for the `loaderOptions` prop\n * 2. The width and height values for bare props\n * 3. The width and height values for the `data` prop\n *\n * If only one of `width` or `height` are defined, then the other will attempt to be calculated based on the image's aspect ratio,\n * provided that both `data.width` and `data.height` are available. If `data.width` and `data.height` aren't available, then the aspect ratio cannot be determined and the missing\n * value will remain as `null`\n */\nexport function Image({\n data,\n width,\n height,\n loading,\n loader = shopifyImageLoader,\n loaderOptions,\n widths,\n decoding = 'async',\n ...rest\n}: ShopifyImageProps) {\n if (!data.url) {\n const missingUrlError = `<Image/>: the 'data' prop requires the 'url' property. Image: ${\n data.id ?? 'no ID provided'\n }`;\n\n if (__HYDROGEN_DEV__) {\n throw new Error(missingUrlError);\n } else {\n console.error(missingUrlError);\n }\n\n return null;\n }\n\n if (__HYDROGEN_DEV__ && !data.altText && !rest.alt) {\n console.warn(\n `<Image/>: the 'data' prop should have the 'altText' property, or the 'alt' prop, and one of them should not be empty. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n const {width: imgElementWidth, height: imgElementHeight} =\n getShopifyImageDimensions({\n data,\n loaderOptions,\n elementProps: {\n width,\n height,\n },\n });\n\n if (__HYDROGEN_DEV__ && (!imgElementWidth || !imgElementHeight)) {\n console.warn(\n `<Image/>: the 'data' prop requires either 'width' or 'data.width', and 'height' or 'data.height' properties. Image: ${\n data.id ?? data.url\n }`\n );\n }\n\n let finalSrc = data.url;\n\n if (loader) {\n finalSrc = loader({\n ...loaderOptions,\n src: data.url,\n width: imgElementWidth,\n height: imgElementHeight,\n });\n if (typeof finalSrc !== 'string' || !finalSrc) {\n throw new Error(\n `<Image/>: 'loader' did not return a valid string. Image: ${\n data.id ?? data.url\n }`\n );\n }\n }\n\n // determining what the intended width of the image is. For example, if the width is specified and lower than the image width, then that is the maximum image width\n // to prevent generating a srcset with widths bigger than needed or to generate images that would distort because of being larger than original\n const maxWidth =\n width && imgElementWidth && width < imgElementWidth\n ? width\n : imgElementWidth;\n const finalSrcset =\n rest.srcSet ??\n internalImageSrcSet({\n ...loaderOptions,\n widths,\n src: data.url,\n width: maxWidth,\n height: imgElementHeight,\n loader,\n });\n\n /* eslint-disable hydrogen/prefer-image-component */\n return (\n <img\n id={data.id ?? ''}\n alt={data.altText ?? rest.alt ?? ''}\n loading={loading ?? 'lazy'}\n {...rest}\n src={finalSrc}\n width={imgElementWidth ?? undefined}\n height={imgElementHeight ?? undefined}\n srcSet={finalSrcset}\n decoding={decoding}\n />\n );\n /* eslint-enable hydrogen/prefer-image-component */\n}\n\ntype InternalShopifySrcSetGeneratorsParams = Simplify<\n ShopifyLoaderOptions & {\n src: ImageType['url'];\n widths?: (HtmlImageProps['width'] | ImageType['width'])[];\n loader?: (params: ShopifyLoaderParams) => string;\n }\n>;\nfunction internalImageSrcSet({\n src,\n width,\n crop,\n scale,\n widths,\n loader,\n height,\n}: InternalShopifySrcSetGeneratorsParams) {\n const hasCustomWidths = widths && Array.isArray(widths);\n if (hasCustomWidths && widths.some((size) => isNaN(size as number))) {\n throw new Error(\n `<Image/>: the 'widths' must be an array of numbers. Image: ${src}`\n );\n }\n\n let aspectRatio = 1;\n if (width && height) {\n aspectRatio = Number(height) / Number(width);\n }\n\n let setSizes = hasCustomWidths ? widths : IMG_SRC_SET_SIZES;\n if (\n !hasCustomWidths &&\n width &&\n width < IMG_SRC_SET_SIZES[IMG_SRC_SET_SIZES.length - 1]\n ) {\n setSizes = IMG_SRC_SET_SIZES.filter((size) => size <= width);\n }\n const srcGenerator = loader ? loader : addImageSizeParametersToUrl;\n return setSizes\n .map(\n (size) =>\n `${srcGenerator({\n src,\n width: size,\n // height is not applied if there is no crop\n // if there is crop, then height is applied as a ratio of the original width + height aspect ratio * size\n height: crop ? Number(size) * aspectRatio : undefined,\n crop,\n scale,\n })} ${size}w`\n )\n .join(', ');\n}\n"],"names":[],"mappings":";;AAiEO,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,GAAsB;AAChB,MAAA,CAAC,KAAK,KAAK;AACP,UAAA,kBAAkB,iEACtB,KAAK,MAAM;AAKN;AACL,cAAQ,MAAM,eAAe;AAAA,IAC/B;AAEO,WAAA;AAAA,EACT;AAUA,QAAM,EAAC,OAAO,iBAAiB,QAAQ,iBAAA,IACrC,0BAA0B;AAAA,IACxB;AAAA,IACA;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,IACF;AAAA,EAAA,CACD;AAUH,MAAI,WAAW,KAAK;AAEpB,MAAI,QAAQ;AACV,eAAW,OAAO;AAAA,MAChB,GAAG;AAAA,MACH,KAAK,KAAK;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,IAAA,CACT;AACD,QAAI,OAAO,aAAa,YAAY,CAAC,UAAU;AAC7C,YAAM,IAAI;AAAA,QACR,4DACE,KAAK,MAAM,KAAK;AAAA,MAAA;AAAA,IAGtB;AAAA,EACF;AAIA,QAAM,WACJ,SAAS,mBAAmB,QAAQ,kBAChC,QACA;AACA,QAAA,cACJ,KAAK,UACL,oBAAoB;AAAA,IAClB,GAAG;AAAA,IACH;AAAA,IACA,KAAK,KAAK;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,EAAA,CACD;AAID,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI,KAAK,MAAM;AAAA,MACf,KAAK,KAAK,WAAW,KAAK,OAAO;AAAA,MACjC,SAAS,WAAW;AAAA,MACnB,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO,mBAAmB;AAAA,MAC1B,QAAQ,oBAAoB;AAAA,MAC5B,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAAA;AAIN;AASA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0C;AACxC,QAAM,kBAAkB,UAAU,MAAM,QAAQ,MAAM;AAClD,MAAA,mBAAmB,OAAO,KAAK,CAAC,SAAS,MAAM,IAAc,CAAC,GAAG;AACnE,UAAM,IAAI;AAAA,MACR,8DAA8D;AAAA,IAAA;AAAA,EAElE;AAEA,MAAI,cAAc;AAClB,MAAI,SAAS,QAAQ;AACnB,kBAAc,OAAO,MAAM,IAAI,OAAO,KAAK;AAAA,EAC7C;AAEI,MAAA,WAAW,kBAAkB,SAAS;AAExC,MAAA,CAAC,mBACD,SACA,QAAQ,kBAAkB,kBAAkB,SAAS,CAAC,GACtD;AACA,eAAW,kBAAkB,OAAO,CAAC,SAAS,QAAQ,KAAK;AAAA,EAC7D;AACM,QAAA,eAAe,SAAS,SAAS;AACvC,SAAO,SACJ;AAAA,IACC,CAAC,SACC,GAAG,aAAa;AAAA,MACd;AAAA,MACA,OAAO;AAAA;AAAA;AAAA,MAGP,QAAQ,OAAO,OAAO,IAAI,IAAI,cAAc;AAAA,MAC5C;AAAA,MACA;AAAA,IAAA,CACD,KAAK;AAAA,EAAA,EAET,KAAK,IAAI;AACd;"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
3
4
  const Image = require("./Image.js");
4
5
  const Video = require("./Video.js");
5
6
  const ExternalVideo = require("./ExternalVideo.js");
6
7
  const ModelViewer = require("./ModelViewer.js");
7
- const jsxRuntime = require("react/jsx-runtime");
8
8
  function MediaFile({
9
9
  data,
10
10
  mediaOptions,
@@ -19,32 +19,40 @@ function MediaFile({
19
19
  return null;
20
20
  }
21
21
  }
22
- return /* @__PURE__ */ jsxRuntime.jsx(Image.Image, {
23
- ...passthroughProps,
24
- ...mediaOptions == null ? void 0 : mediaOptions.image,
25
- data: data.image
26
- });
22
+ return /* @__PURE__ */ jsxRuntime.jsx(
23
+ Image.Image,
24
+ {
25
+ ...passthroughProps,
26
+ ...mediaOptions == null ? void 0 : mediaOptions.image,
27
+ data: data.image
28
+ }
29
+ );
27
30
  }
28
31
  case "Video": {
29
- return /* @__PURE__ */ jsxRuntime.jsx(Video.Video, {
30
- ...passthroughProps,
31
- ...mediaOptions == null ? void 0 : mediaOptions.video,
32
- data
33
- });
32
+ return /* @__PURE__ */ jsxRuntime.jsx(Video.Video, { ...passthroughProps, ...mediaOptions == null ? void 0 : mediaOptions.video, data });
34
33
  }
35
34
  case "ExternalVideo": {
36
- return /* @__PURE__ */ jsxRuntime.jsx(ExternalVideo.ExternalVideo, {
37
- ...passthroughProps,
38
- ...mediaOptions == null ? void 0 : mediaOptions.externalVideo,
39
- data
40
- });
35
+ return /* @__PURE__ */ jsxRuntime.jsx(
36
+ ExternalVideo.ExternalVideo,
37
+ {
38
+ ...passthroughProps,
39
+ ...mediaOptions == null ? void 0 : mediaOptions.externalVideo,
40
+ data
41
+ }
42
+ );
41
43
  }
42
44
  case "Model3d": {
43
- return /* @__PURE__ */ jsxRuntime.jsx(ModelViewer.ModelViewer, {
44
- ...passthroughProps,
45
- ...mediaOptions == null ? void 0 : mediaOptions.modelViewer,
46
- data
47
- });
45
+ return (
46
+ // @ts-expect-error There are issues with the inferred HTML attribute types here for ModelViewer (and contentEditable), but I think that's a little bit beyond me at the moment
47
+ /* @__PURE__ */ jsxRuntime.jsx(
48
+ ModelViewer.ModelViewer,
49
+ {
50
+ ...passthroughProps,
51
+ ...mediaOptions == null ? void 0 : mediaOptions.modelViewer,
52
+ data
53
+ }
54
+ )
55
+ );
48
56
  }
49
57
  default: {
50
58
  const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media.`;
@@ -1 +1 @@
1
- {"version":3,"file":"MediaFile.js","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\nimport type {ModelViewerElement} from '@google/model-viewer/lib/model-viewer.js';\n\ntype BaseProps = React.HTMLAttributes<\n HTMLImageElement | HTMLVideoElement | HTMLIFrameElement | ModelViewerElement\n>;\nexport interface MediaFileProps extends BaseProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, or `ExternalVideo` components. */\n mediaOptions?: {\n /** Props that will only apply when an `<Image />` is rendered */\n image?: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video?: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo?: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer?: Omit<typeof ModelViewer, 'data'>;\n };\n}\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n // @ts-expect-error There are issues with the inferred HTML attribute types here for ModelViewer (and contentEditable), but I think that's a little bit beyond me at the moment\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(`${typenameMissingMessage} Rendering 'null' by default`);\n return null;\n }\n }\n }\n}\n"],"names":["MediaFile","data","mediaOptions","passthroughProps","__typename","image","noDataImage","console","warn","Image","Video","video","ExternalVideo","externalVideo","ModelViewer","modelViewer","typenameMissingMessage","error"],"mappings":";;;;;;;AAmCO,SAASA,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAAAA,KACGC;AACW,GAAG;AACjB,UAAQF,KAAKG,YAAU;AAAA,IACrB,KAAK,cAAc;AACb,UAAA,CAACH,KAAKI,OAAO;AACf,cAAMC,cAAe;AAGd;AACLC,kBAAQC,KAAKF,WAAW;AACjB,iBAAA;AAAA,QACT;AAAA,MACF;AAEA,4CACGG,MAAAA,OAAK;AAAA,QAAA,GACAN;AAAAA,QAAgB,GAChBD,6CAAcG;AAAAA,QAClB,MAAMJ,KAAKI;AAAAA,MAAAA,CACX;AAAA,IAEN;AAAA,IACA,KAAK,SAAS;AACZ,4CACGK,MAAAA,OAAK;AAAA,QAAA,GAAKP;AAAAA,QAAgB,GAAMD,6CAAcS;AAAAA,QAAO;AAAA,MAAA,CAAc;AAAA,IAExE;AAAA,IACA,KAAK,iBAAiB;AACpB,4CACGC,cAAAA,eAAa;AAAA,QAAA,GACRT;AAAAA,QAAgB,GAChBD,6CAAcW;AAAAA,QAClB;AAAA,MAAA,CACA;AAAA,IAEN;AAAA,IACA,KAAK,WAAW;AACd,4CAEGC,YAAAA,aAAW;AAAA,QAAA,GACNX;AAAAA,QAAgB,GAChBD,6CAAca;AAAAA,QAClB;AAAA,MAAA,CAAW;AAAA,IAGjB;AAAA,IACA,SAAS;AACP,YAAMC,yBAA0B;AAGzB;AACGC,gBAAAA,MAAO,GAAED,qDAAqD;AAC/D,eAAA;AAAA,MACT;AAAA,IACF;AAAA,EAAC;AAEL;;"}
1
+ {"version":3,"file":"MediaFile.js","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\nimport type {ModelViewerElement} from '@google/model-viewer/lib/model-viewer.js';\n\ntype BaseProps = React.HTMLAttributes<\n HTMLImageElement | HTMLVideoElement | HTMLIFrameElement | ModelViewerElement\n>;\nexport interface MediaFileProps extends BaseProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, `ExternalVideo`, or `ModelViewer` components. */\n mediaOptions?: MediaOptions;\n}\n\ntype MediaOptions = {\n /** Props that will only apply when an `<Image />` is rendered */\n image?: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video?: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo?: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer?: Omit<typeof ModelViewer, 'data'>;\n};\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n // @ts-expect-error There are issues with the inferred HTML attribute types here for ModelViewer (and contentEditable), but I think that's a little bit beyond me at the moment\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(`${typenameMissingMessage} Rendering 'null' by default`);\n return null;\n }\n }\n }\n}\n"],"names":["jsx","Image","Video","ExternalVideo","ModelViewer"],"mappings":";;;;;;;AAqCO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,UAAQ,KAAK,YAAY;AAAA,IACvB,KAAK,cAAc;AACb,UAAA,CAAC,KAAK,OAAO;AACf,cAAM,cAAc;AAGb;AACL,kBAAQ,KAAK,WAAW;AACjB,iBAAA;AAAA,QACT;AAAA,MACF;AAGE,aAAAA,2BAAA;AAAA,QAACC,MAAA;AAAA,QAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG,6CAAc;AAAA,UAClB,MAAM,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAGjB;AAAA,IACA,KAAK,SAAS;AACZ,4CACGC,MAAO,OAAA,EAAA,GAAG,kBAAmB,GAAG,6CAAc,OAAO,KAAY,CAAA;AAAA,IAEtE;AAAA,IACA,KAAK,iBAAiB;AAElB,aAAAF,2BAAA;AAAA,QAACG,cAAA;AAAA,QAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG,6CAAc;AAAA,UAClB;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN;AAAA,IACA,KAAK,WAAW;AACd;AAAA;AAAA,QAEEH,2BAAA;AAAA,UAACI,YAAA;AAAA,UAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG,6CAAc;AAAA,YAClB;AAAA,UAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA,SAAS;AACP,YAAM,yBAAyB;AAGxB;AACG,gBAAA,MAAM,GAAG,qDAAqD;AAC/D,eAAA;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;;"}
@@ -1,8 +1,8 @@
1
+ import { jsx } from "react/jsx-runtime";
1
2
  import { Image } from "./Image.mjs";
2
3
  import { Video } from "./Video.mjs";
3
4
  import { ExternalVideo } from "./ExternalVideo.mjs";
4
5
  import { ModelViewer } from "./ModelViewer.mjs";
5
- import { jsx } from "react/jsx-runtime";
6
6
  function MediaFile({
7
7
  data,
8
8
  mediaOptions,
@@ -17,32 +17,40 @@ function MediaFile({
17
17
  return null;
18
18
  }
19
19
  }
20
- return /* @__PURE__ */ jsx(Image, {
21
- ...passthroughProps,
22
- ...mediaOptions == null ? void 0 : mediaOptions.image,
23
- data: data.image
24
- });
20
+ return /* @__PURE__ */ jsx(
21
+ Image,
22
+ {
23
+ ...passthroughProps,
24
+ ...mediaOptions == null ? void 0 : mediaOptions.image,
25
+ data: data.image
26
+ }
27
+ );
25
28
  }
26
29
  case "Video": {
27
- return /* @__PURE__ */ jsx(Video, {
28
- ...passthroughProps,
29
- ...mediaOptions == null ? void 0 : mediaOptions.video,
30
- data
31
- });
30
+ return /* @__PURE__ */ jsx(Video, { ...passthroughProps, ...mediaOptions == null ? void 0 : mediaOptions.video, data });
32
31
  }
33
32
  case "ExternalVideo": {
34
- return /* @__PURE__ */ jsx(ExternalVideo, {
35
- ...passthroughProps,
36
- ...mediaOptions == null ? void 0 : mediaOptions.externalVideo,
37
- data
38
- });
33
+ return /* @__PURE__ */ jsx(
34
+ ExternalVideo,
35
+ {
36
+ ...passthroughProps,
37
+ ...mediaOptions == null ? void 0 : mediaOptions.externalVideo,
38
+ data
39
+ }
40
+ );
39
41
  }
40
42
  case "Model3d": {
41
- return /* @__PURE__ */ jsx(ModelViewer, {
42
- ...passthroughProps,
43
- ...mediaOptions == null ? void 0 : mediaOptions.modelViewer,
44
- data
45
- });
43
+ return (
44
+ // @ts-expect-error There are issues with the inferred HTML attribute types here for ModelViewer (and contentEditable), but I think that's a little bit beyond me at the moment
45
+ /* @__PURE__ */ jsx(
46
+ ModelViewer,
47
+ {
48
+ ...passthroughProps,
49
+ ...mediaOptions == null ? void 0 : mediaOptions.modelViewer,
50
+ data
51
+ }
52
+ )
53
+ );
46
54
  }
47
55
  default: {
48
56
  const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media.`;
@@ -1 +1 @@
1
- {"version":3,"file":"MediaFile.mjs","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\nimport type {ModelViewerElement} from '@google/model-viewer/lib/model-viewer.js';\n\ntype BaseProps = React.HTMLAttributes<\n HTMLImageElement | HTMLVideoElement | HTMLIFrameElement | ModelViewerElement\n>;\nexport interface MediaFileProps extends BaseProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, or `ExternalVideo` components. */\n mediaOptions?: {\n /** Props that will only apply when an `<Image />` is rendered */\n image?: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video?: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo?: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer?: Omit<typeof ModelViewer, 'data'>;\n };\n}\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n // @ts-expect-error There are issues with the inferred HTML attribute types here for ModelViewer (and contentEditable), but I think that's a little bit beyond me at the moment\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(`${typenameMissingMessage} Rendering 'null' by default`);\n return null;\n }\n }\n }\n}\n"],"names":["MediaFile","data","mediaOptions","passthroughProps","__typename","image","noDataImage","console","warn","video","externalVideo","modelViewer","typenameMissingMessage","error"],"mappings":";;;;;AAmCO,SAASA,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAAAA,KACGC;AACW,GAAG;AACjB,UAAQF,KAAKG,YAAU;AAAA,IACrB,KAAK,cAAc;AACb,UAAA,CAACH,KAAKI,OAAO;AACf,cAAMC,cAAe;AAGd;AACLC,kBAAQC,KAAKF,WAAW;AACjB,iBAAA;AAAA,QACT;AAAA,MACF;AAEA,iCACG,OAAK;AAAA,QAAA,GACAH;AAAAA,QAAgB,GAChBD,6CAAcG;AAAAA,QAClB,MAAMJ,KAAKI;AAAAA,MAAAA,CACX;AAAA,IAEN;AAAA,IACA,KAAK,SAAS;AACZ,iCACG,OAAK;AAAA,QAAA,GAAKF;AAAAA,QAAgB,GAAMD,6CAAcO;AAAAA,QAAO;AAAA,MAAA,CAAc;AAAA,IAExE;AAAA,IACA,KAAK,iBAAiB;AACpB,iCACG,eAAa;AAAA,QAAA,GACRN;AAAAA,QAAgB,GAChBD,6CAAcQ;AAAAA,QAClB;AAAA,MAAA,CACA;AAAA,IAEN;AAAA,IACA,KAAK,WAAW;AACd,iCAEG,aAAW;AAAA,QAAA,GACNP;AAAAA,QAAgB,GAChBD,6CAAcS;AAAAA,QAClB;AAAA,MAAA,CAAW;AAAA,IAGjB;AAAA,IACA,SAAS;AACP,YAAMC,yBAA0B;AAGzB;AACGC,gBAAAA,MAAO,GAAED,qDAAqD;AAC/D,eAAA;AAAA,MACT;AAAA,IACF;AAAA,EAAC;AAEL;"}
1
+ {"version":3,"file":"MediaFile.mjs","sources":["../../src/MediaFile.tsx"],"sourcesContent":["import {Image, type ShopifyImageProps} from './Image.js';\nimport {Video} from './Video.js';\nimport {ExternalVideo} from './ExternalVideo.js';\nimport {ModelViewer} from './ModelViewer.js';\nimport type {MediaEdge as MediaEdgeType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\nimport type {ModelViewerElement} from '@google/model-viewer/lib/model-viewer.js';\n\ntype BaseProps = React.HTMLAttributes<\n HTMLImageElement | HTMLVideoElement | HTMLIFrameElement | ModelViewerElement\n>;\nexport interface MediaFileProps extends BaseProps {\n /** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */\n data: PartialDeep<MediaEdgeType['node'], {recurseIntoArrays: true}>;\n /** The options for the `Image`, `Video`, `ExternalVideo`, or `ModelViewer` components. */\n mediaOptions?: MediaOptions;\n}\n\ntype MediaOptions = {\n /** Props that will only apply when an `<Image />` is rendered */\n image?: Omit<ShopifyImageProps, 'data'>;\n /** Props that will only apply when a `<Video />` is rendered */\n video?: Omit<React.ComponentProps<typeof Video>, 'data'>;\n /** Props that will only apply when an `<ExternalVideo />` is rendered */\n externalVideo?: Omit<\n React.ComponentProps<typeof ExternalVideo>['options'],\n 'data'\n >;\n /** Props that will only apply when a `<ModelViewer />` is rendered */\n modelViewer?: Omit<typeof ModelViewer, 'data'>;\n};\n\n/**\n * The `MediaFile` component renders the media for the Storefront API's\n * [Media object](https://shopify.dev/api/storefront/reference/products/media). It renders an `Image`, a\n * `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.\n */\nexport function MediaFile({\n data,\n mediaOptions,\n ...passthroughProps\n}: MediaFileProps) {\n switch (data.__typename) {\n case 'MediaImage': {\n if (!data.image) {\n const noDataImage = `<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(noDataImage);\n } else {\n console.warn(noDataImage);\n return null;\n }\n }\n\n return (\n <Image\n {...passthroughProps}\n {...mediaOptions?.image}\n data={data.image}\n />\n );\n }\n case 'Video': {\n return (\n <Video {...passthroughProps} {...mediaOptions?.video} data={data} />\n );\n }\n case 'ExternalVideo': {\n return (\n <ExternalVideo\n {...passthroughProps}\n {...mediaOptions?.externalVideo}\n data={data}\n />\n );\n }\n case 'Model3d': {\n return (\n // @ts-expect-error There are issues with the inferred HTML attribute types here for ModelViewer (and contentEditable), but I think that's a little bit beyond me at the moment\n <ModelViewer\n {...passthroughProps}\n {...mediaOptions?.modelViewer}\n data={data}\n />\n );\n }\n default: {\n const typenameMissingMessage = `<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media.`;\n if (__HYDROGEN_DEV__) {\n throw new Error(typenameMissingMessage);\n } else {\n console.error(`${typenameMissingMessage} Rendering 'null' by default`);\n return null;\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAqCO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,UAAQ,KAAK,YAAY;AAAA,IACvB,KAAK,cAAc;AACb,UAAA,CAAC,KAAK,OAAO;AACf,cAAM,cAAc;AAGb;AACL,kBAAQ,KAAK,WAAW;AACjB,iBAAA;AAAA,QACT;AAAA,MACF;AAGE,aAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG,6CAAc;AAAA,UAClB,MAAM,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAGjB;AAAA,IACA,KAAK,SAAS;AACZ,iCACG,OAAO,EAAA,GAAG,kBAAmB,GAAG,6CAAc,OAAO,KAAY,CAAA;AAAA,IAEtE;AAAA,IACA,KAAK,iBAAiB;AAElB,aAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG,6CAAc;AAAA,UAClB;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN;AAAA,IACA,KAAK,WAAW;AACd;AAAA;AAAA,QAEE;AAAA,UAAC;AAAA,UAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG,6CAAc;AAAA,YAClB;AAAA,UAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA,SAAS;AACP,YAAM,yBAAyB;AAGxB;AACG,gBAAA,MAAM,GAAG,qDAAqD;AAC/D,eAAA;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;"}