@shopify/hydrogen-react 2023.4.5 → 2023.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
- package/dist/browser-dev/CartProvider.mjs.map +1 -1
- package/dist/browser-dev/Image.mjs.map +1 -1
- package/dist/browser-dev/ModelViewer.mjs.map +1 -1
- package/dist/browser-dev/Money.mjs.map +1 -1
- package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
- package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
- package/dist/browser-dev/Video.mjs.map +1 -1
- package/dist/browser-dev/_virtual/index.mjs +2 -11
- package/dist/browser-dev/_virtual/index.mjs.map +1 -1
- package/dist/browser-dev/_virtual/with-selector.mjs +2 -11
- package/dist/browser-dev/_virtual/with-selector.mjs.map +1 -1
- package/dist/browser-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/browser-dev/analytics-utils.mjs.map +1 -1
- package/dist/browser-dev/analytics.mjs.map +1 -1
- package/dist/browser-dev/cart-queries.mjs +1 -0
- package/dist/browser-dev/cart-queries.mjs.map +1 -1
- package/dist/browser-dev/cookies-utils.mjs +1 -1
- package/dist/browser-dev/cookies-utils.mjs.map +1 -1
- package/dist/browser-dev/flatten-connection.mjs.map +1 -1
- package/dist/browser-dev/index.mjs +2 -0
- package/dist/browser-dev/index.mjs.map +1 -1
- package/dist/browser-dev/load-script.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs +1 -2
- package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs +8 -10
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +10 -8
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/browser-dev/parse-metafield.mjs.map +1 -1
- package/dist/browser-dev/storefront-api-constants.mjs +1 -1
- package/dist/browser-dev/storefront-api-constants.mjs.map +1 -1
- package/dist/browser-dev/storefront-client.mjs +17 -7
- package/dist/browser-dev/storefront-client.mjs.map +1 -1
- package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-dev/useCartActions.mjs.map +1 -1
- package/dist/browser-dev/useMoney.mjs +1 -1
- package/dist/browser-dev/useMoney.mjs.map +1 -1
- package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
- package/dist/browser-prod/CartProvider.mjs.map +1 -1
- package/dist/browser-prod/Image.mjs.map +1 -1
- package/dist/browser-prod/MediaFile.mjs.map +1 -1
- package/dist/browser-prod/ModelViewer.mjs.map +1 -1
- package/dist/browser-prod/Money.mjs.map +1 -1
- package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
- package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
- package/dist/browser-prod/Video.mjs.map +1 -1
- package/dist/browser-prod/_virtual/index.mjs +2 -11
- package/dist/browser-prod/_virtual/index.mjs.map +1 -1
- package/dist/browser-prod/_virtual/with-selector.mjs +2 -11
- package/dist/browser-prod/_virtual/with-selector.mjs.map +1 -1
- package/dist/browser-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/browser-prod/analytics-utils.mjs.map +1 -1
- package/dist/browser-prod/analytics.mjs.map +1 -1
- package/dist/browser-prod/cart-queries.mjs +1 -0
- package/dist/browser-prod/cart-queries.mjs.map +1 -1
- package/dist/browser-prod/cookies-utils.mjs +1 -1
- package/dist/browser-prod/cookies-utils.mjs.map +1 -1
- package/dist/browser-prod/flatten-connection.mjs.map +1 -1
- package/dist/browser-prod/index.mjs +2 -0
- package/dist/browser-prod/index.mjs.map +1 -1
- package/dist/browser-prod/load-script.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs +1 -2
- package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs +8 -10
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +10 -8
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/browser-prod/parse-metafield.mjs.map +1 -1
- package/dist/browser-prod/storefront-api-constants.mjs +1 -1
- package/dist/browser-prod/storefront-api-constants.mjs.map +1 -1
- package/dist/browser-prod/storefront-client.mjs +13 -4
- package/dist/browser-prod/storefront-client.mjs.map +1 -1
- package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-prod/useCartActions.mjs.map +1 -1
- package/dist/browser-prod/useMoney.mjs +1 -1
- package/dist/browser-prod/useMoney.mjs.map +1 -1
- package/dist/node-dev/CartLineProvider.js.map +1 -1
- package/dist/node-dev/CartLineProvider.mjs.map +1 -1
- package/dist/node-dev/CartProvider.js.map +1 -1
- package/dist/node-dev/CartProvider.mjs.map +1 -1
- package/dist/node-dev/Image.js.map +1 -1
- package/dist/node-dev/Image.mjs.map +1 -1
- package/dist/node-dev/ModelViewer.js.map +1 -1
- package/dist/node-dev/ModelViewer.mjs.map +1 -1
- package/dist/node-dev/Money.js.map +1 -1
- package/dist/node-dev/Money.mjs.map +1 -1
- package/dist/node-dev/ShopPayButton.js.map +1 -1
- package/dist/node-dev/ShopPayButton.mjs.map +1 -1
- package/dist/node-dev/ShopifyProvider.js.map +1 -1
- package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
- package/dist/node-dev/Video.js.map +1 -1
- package/dist/node-dev/Video.mjs.map +1 -1
- package/dist/node-dev/_virtual/index.js +1 -9
- package/dist/node-dev/_virtual/index.js.map +1 -1
- package/dist/node-dev/_virtual/index.mjs +2 -11
- package/dist/node-dev/_virtual/index.mjs.map +1 -1
- package/dist/node-dev/_virtual/with-selector.js +1 -9
- package/dist/node-dev/_virtual/with-selector.js.map +1 -1
- package/dist/node-dev/_virtual/with-selector.mjs +2 -11
- package/dist/node-dev/_virtual/with-selector.mjs.map +1 -1
- package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
- package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/node-dev/analytics-utils.js.map +1 -1
- package/dist/node-dev/analytics-utils.mjs.map +1 -1
- package/dist/node-dev/analytics.js.map +1 -1
- package/dist/node-dev/analytics.mjs.map +1 -1
- package/dist/node-dev/cart-queries.js +1 -0
- package/dist/node-dev/cart-queries.js.map +1 -1
- package/dist/node-dev/cart-queries.mjs +1 -0
- package/dist/node-dev/cart-queries.mjs.map +1 -1
- package/dist/node-dev/cookies-utils.js +1 -1
- package/dist/node-dev/cookies-utils.js.map +1 -1
- package/dist/node-dev/cookies-utils.mjs +1 -1
- package/dist/node-dev/cookies-utils.mjs.map +1 -1
- package/dist/node-dev/flatten-connection.js.map +1 -1
- package/dist/node-dev/flatten-connection.mjs.map +1 -1
- package/dist/node-dev/index.js +2 -0
- package/dist/node-dev/index.js.map +1 -1
- package/dist/node-dev/index.mjs +2 -0
- package/dist/node-dev/index.mjs.map +1 -1
- package/dist/node-dev/load-script.js.map +1 -1
- package/dist/node-dev/load-script.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.js +2 -3
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs +1 -2
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js.map +1 -1
- package/dist/node-dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js +7 -9
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs +8 -10
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js +8 -7
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +10 -8
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/node-dev/parse-metafield.js.map +1 -1
- package/dist/node-dev/parse-metafield.mjs.map +1 -1
- package/dist/node-dev/storefront-api-constants.js +1 -1
- package/dist/node-dev/storefront-api-constants.js.map +1 -1
- package/dist/node-dev/storefront-api-constants.mjs +1 -1
- package/dist/node-dev/storefront-api-constants.mjs.map +1 -1
- package/dist/node-dev/storefront-client.js +17 -7
- package/dist/node-dev/storefront-client.js.map +1 -1
- package/dist/node-dev/storefront-client.mjs +17 -7
- package/dist/node-dev/storefront-client.mjs.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-dev/useCartActions.js.map +1 -1
- package/dist/node-dev/useCartActions.mjs.map +1 -1
- package/dist/node-dev/useMoney.js +1 -1
- package/dist/node-dev/useMoney.js.map +1 -1
- package/dist/node-dev/useMoney.mjs +1 -1
- package/dist/node-dev/useMoney.mjs.map +1 -1
- package/dist/node-prod/CartLineProvider.js.map +1 -1
- package/dist/node-prod/CartLineProvider.mjs.map +1 -1
- package/dist/node-prod/CartProvider.js.map +1 -1
- package/dist/node-prod/CartProvider.mjs.map +1 -1
- package/dist/node-prod/Image.js.map +1 -1
- package/dist/node-prod/Image.mjs.map +1 -1
- package/dist/node-prod/MediaFile.js.map +1 -1
- package/dist/node-prod/MediaFile.mjs.map +1 -1
- package/dist/node-prod/ModelViewer.js.map +1 -1
- package/dist/node-prod/ModelViewer.mjs.map +1 -1
- package/dist/node-prod/Money.js.map +1 -1
- package/dist/node-prod/Money.mjs.map +1 -1
- package/dist/node-prod/ShopPayButton.js.map +1 -1
- package/dist/node-prod/ShopPayButton.mjs.map +1 -1
- package/dist/node-prod/ShopifyProvider.js.map +1 -1
- package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
- package/dist/node-prod/Video.js.map +1 -1
- package/dist/node-prod/Video.mjs.map +1 -1
- package/dist/node-prod/_virtual/index.js +1 -9
- package/dist/node-prod/_virtual/index.js.map +1 -1
- package/dist/node-prod/_virtual/index.mjs +2 -11
- package/dist/node-prod/_virtual/index.mjs.map +1 -1
- package/dist/node-prod/_virtual/with-selector.js +1 -9
- package/dist/node-prod/_virtual/with-selector.js.map +1 -1
- package/dist/node-prod/_virtual/with-selector.mjs +2 -11
- package/dist/node-prod/_virtual/with-selector.mjs.map +1 -1
- package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
- package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/node-prod/analytics-utils.js.map +1 -1
- package/dist/node-prod/analytics-utils.mjs.map +1 -1
- package/dist/node-prod/analytics.js.map +1 -1
- package/dist/node-prod/analytics.mjs.map +1 -1
- package/dist/node-prod/cart-queries.js +1 -0
- package/dist/node-prod/cart-queries.js.map +1 -1
- package/dist/node-prod/cart-queries.mjs +1 -0
- package/dist/node-prod/cart-queries.mjs.map +1 -1
- package/dist/node-prod/cookies-utils.js +1 -1
- package/dist/node-prod/cookies-utils.js.map +1 -1
- package/dist/node-prod/cookies-utils.mjs +1 -1
- package/dist/node-prod/cookies-utils.mjs.map +1 -1
- package/dist/node-prod/flatten-connection.js.map +1 -1
- package/dist/node-prod/flatten-connection.mjs.map +1 -1
- package/dist/node-prod/index.js +2 -0
- package/dist/node-prod/index.js.map +1 -1
- package/dist/node-prod/index.mjs +2 -0
- package/dist/node-prod/index.mjs.map +1 -1
- package/dist/node-prod/load-script.js.map +1 -1
- package/dist/node-prod/load-script.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.js +2 -3
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs +1 -2
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js.map +1 -1
- package/dist/node-prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js +7 -9
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs +8 -10
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js +8 -7
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +10 -8
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/node-prod/parse-metafield.js.map +1 -1
- package/dist/node-prod/parse-metafield.mjs.map +1 -1
- package/dist/node-prod/storefront-api-constants.js +1 -1
- package/dist/node-prod/storefront-api-constants.js.map +1 -1
- package/dist/node-prod/storefront-api-constants.mjs +1 -1
- package/dist/node-prod/storefront-api-constants.mjs.map +1 -1
- package/dist/node-prod/storefront-client.js +13 -4
- package/dist/node-prod/storefront-client.js.map +1 -1
- package/dist/node-prod/storefront-client.mjs +13 -4
- package/dist/node-prod/storefront-client.mjs.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-prod/useCartActions.js.map +1 -1
- package/dist/node-prod/useCartActions.mjs.map +1 -1
- package/dist/node-prod/useMoney.js +1 -1
- package/dist/node-prod/useMoney.js.map +1 -1
- package/dist/node-prod/useMoney.mjs +1 -1
- package/dist/node-prod/useMoney.mjs.map +1 -1
- package/dist/types/CartLineProvider.d.ts +3 -5
- package/dist/types/CartProvider.d.ts +2 -2
- package/dist/types/Image.d.ts +5 -1
- package/dist/types/ModelViewer.d.ts +1 -1
- package/dist/types/Money.d.ts +1 -1
- package/dist/types/Video.d.ts +1 -1
- package/dist/types/analytics-types.d.ts +1 -1
- package/dist/types/cart-queries.d.ts +1 -1
- package/dist/types/cart-types.d.ts +2 -2
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/storefront-api-constants.d.ts +1 -1
- package/dist/types/storefront-api-types.d.ts +349 -87
- package/dist/types/useCartAPIStateMachine.d.ts +2 -2
- package/dist/types/useCartActions.d.ts +2 -2
- package/dist/umd/hydrogen-react.dev.js +163 -169
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +17 -14
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +6 -7
- package/storefront.schema.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,
|
|
1
|
+
(function(E,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(E=typeof globalThis<"u"?globalThis:E||self,u(E.hydrogenreact={},E.React))})(this,function(E,u){"use strict";function Rt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const V=Rt(u);/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */function
|
|
14
|
+
***************************************************************************** */function Oe(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}var Q;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Q||(Q={}));var Ne={type:"xstate.init"};function _e(e){return e===void 0?[]:[].concat(e)}function K(e){return{type:"xstate.assign",assignment:e}}function Me(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function he(e){return function(t){return e===t}}function Ve(e){return typeof e=="string"?{type:e}:e}function Le(e,t){return{value:e,context:t,actions:[],changed:!1,matches:he(e)}}function xe(e,t,r){var n=t,o=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){o=!0;var s=Object.assign({},n);return typeof i.assignment=="function"?s=i.assignment(n,r):Object.keys(i.assignment).forEach(function(a){s[a]=typeof i.assignment[a]=="function"?i.assignment[a](n,r):i.assignment[a]}),n=s,!1}return!0}),n,o]}function Fe(e,t){t===void 0&&(t={});var r=Oe(xe(_e(e.states[e.initial].entry).map(function(s){return Me(s,t.actions)}),e.context,Ne),2),n=r[0],o=r[1],i={config:e,_options:t,initialState:{value:e.initial,actions:n,context:o,matches:he(e.initial)},transition:function(s,a){var c,d,l=typeof s=="string"?{value:s,context:e.context}:s,h=l.value,m=l.context,p=Ve(a),f=e.states[h];if(f.on){var b=_e(f.on[p.type]);try{for(var T=function(k){var x=typeof Symbol=="function"&&Symbol.iterator,ae=x&&k[x],R=0;if(ae)return ae.call(k);if(k&&typeof k.length=="number")return{next:function(){return k&&R>=k.length&&(k=void 0),{value:k&&k[R++],done:!k}}};throw new TypeError(x?"Object is not iterable.":"Symbol.iterator is not defined.")}(b),w=T.next();!w.done;w=T.next()){var A=w.value;if(A===void 0)return Le(h,m);var U=typeof A=="string"?{target:A}:A,g=U.target,y=U.actions,C=y===void 0?[]:y,D=U.cond,I=D===void 0?function(){return!0}:D,_=g===void 0,v=g??h,B=e.states[v];if(I(m,p)){var P=Oe(xe((_?_e(C):[].concat(f.exit,C,B.entry).filter(function(k){return k})).map(function(k){return Me(k,i._options.actions)}),m,p),3),F=P[0],W=P[1],oe=P[2],X=g??h;return{value:X,context:W,actions:F,changed:g!==h||F.length>0||oe,matches:he(X)}}}}catch(k){c={error:k}}finally{try{w&&!w.done&&(d=T.return)&&d.call(T)}finally{if(c)throw c.error}}}return Le(h,m)}};return i}var qe=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function kt(e){var t=e.initialState,r=Q.NotStarted,n=new Set,o={_machine:e,send:function(i){r===Q.Running&&(t=e.transition(t,i),qe(t,Ve(i)),n.forEach(function(s){return s(t)}))},subscribe:function(i){return n.add(i),i(t),{unsubscribe:function(){return n.delete(i)}}},start:function(i){if(i){var s=typeof i=="object"?i:{context:e.config.context,value:i};t={value:s.value,actions:[],context:s.context,matches:he(s.value)}}else t=e.initialState;return r=Q.Running,qe(t,Ne),o},stop:function(){return r=Q.Stopped,n.clear(),o},get state(){return t},get status(){return r}};return o}var Ut=u.useLayoutEffect,He={exports:{}},$e={},Be={exports:{}},Ye={};/**
|
|
15
15
|
* @license React
|
|
16
16
|
* use-sync-external-store-shim.production.min.js
|
|
17
17
|
*
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var z=
|
|
22
|
+
*/var z=u;function Ot(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nt=typeof Object.is=="function"?Object.is:Ot,Mt=z.useState,Vt=z.useEffect,Lt=z.useLayoutEffect,xt=z.useDebugValue;function Ft(e,t){var r=t(),n=Mt({inst:{value:r,getSnapshot:t}}),o=n[0].inst,i=n[1];return Lt(function(){o.value=r,o.getSnapshot=t,Ae(o)&&i({inst:o})},[e,r,t]),Vt(function(){return Ae(o)&&i({inst:o}),e(function(){Ae(o)&&i({inst:o})})},[e]),xt(r),r}function Ae(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Nt(e,r)}catch{return!0}}function qt(e,t){return t()}var Ht=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qt:Ft;Ye.useSyncExternalStore=z.useSyncExternalStore!==void 0?z.useSyncExternalStore:Ht,Be.exports=Ye;var $t=Be.exports;/**
|
|
23
23
|
* @license React
|
|
24
24
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
25
25
|
*
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*/var ge=
|
|
30
|
+
*/var ge=u,Bt=$t;function Yt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jt=typeof Object.is=="function"?Object.is:Yt,Gt=Bt.useSyncExternalStore,Zt=ge.useRef,Wt=ge.useEffect,Qt=ge.useMemo,Jt=ge.useDebugValue;$e.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var i=Zt(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=Qt(function(){function c(p){if(!d){if(d=!0,l=p,p=n(p),o!==void 0&&s.hasValue){var f=s.value;if(o(f,p))return h=f}return h=p}if(f=h,jt(l,p))return f;var b=n(p);return o!==void 0&&o(f,b)?f:(l=p,h=b)}var d=!1,l,h,m=r===void 0?null:r;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,r,n,o]);var a=Gt(e,i[0],i[1]);return Wt(function(){s.hasValue=!0,s.value=a},[a]),Jt(a),a},He.exports=$e;var Xt=He.exports;function Kt(e){var t=V.useRef();return t.current||(t.current={v:e()}),t.current.v}var zt=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i};function er(e){return e}var tr=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function rr(e,t){var r=u.useRef(),n=zt(Kt(function(){var a=[],c=kt(Fe(e.config,t||e._options)),d=c.send;return c.send=function(l){if(c.status===Q.NotStarted){a.push(l);return}d(l),r.current=c.state},[c,a]}),2),o=n[0],i=n[1];Ut(function(){t&&(o._machine._options=t)});var s=or(o);return u.useEffect(function(){return o.start(r.current),i.forEach(o.send),r.current=o.state,function(){o.stop()}},[]),s}var nr=function(e,t){return t.changed===!1};function or(e){var t=u.useCallback(function(){return tr(e)},[e]),r=u.useCallback(function(o){var i=e.subscribe(o).unsubscribe;return i},[e]),n=Xt.useSyncExternalStoreWithSelector(r,t,t,er,nr);return[n,e.send,e]}function j(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e??""}' instead.`;return console.error(t+" Returning an empty array"),[]}return"nodes"in e?e.nodes:"edges"in e&&Array.isArray(e.edges)?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node}):[]}const ar=e=>`
|
|
31
31
|
mutation CartLineAdd(
|
|
32
32
|
$cartId: ID!
|
|
33
33
|
$lines: [CartLineInput!]!
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
${e}
|
|
59
|
-
`,
|
|
59
|
+
`,sr=e=>`
|
|
60
60
|
mutation CartLineRemove(
|
|
61
61
|
$cartId: ID!
|
|
62
62
|
$lines: [ID!]!
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
${e}
|
|
74
|
-
`,
|
|
74
|
+
`,cr=e=>`
|
|
75
75
|
mutation CartLineUpdate(
|
|
76
76
|
$cartId: ID!
|
|
77
77
|
$lines: [CartLineUpdateInput!]!
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
${e}
|
|
104
|
-
`,
|
|
104
|
+
`,lr=e=>`
|
|
105
105
|
mutation CartBuyerIdentityUpdate(
|
|
106
106
|
$cartId: ID!
|
|
107
107
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
${e}
|
|
119
|
-
`,
|
|
119
|
+
`,dr=e=>`
|
|
120
120
|
mutation CartAttributesUpdate(
|
|
121
121
|
$attributes: [AttributeInput!]!
|
|
122
122
|
$cartId: ID!
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
${e}
|
|
134
|
-
`,
|
|
134
|
+
`,fr=e=>`
|
|
135
135
|
mutation CartDiscountCodesUpdate(
|
|
136
136
|
$cartId: ID!
|
|
137
137
|
$discountCodes: [String!]
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
${e}
|
|
149
|
-
`,
|
|
149
|
+
`,yr=e=>`
|
|
150
150
|
query CartQuery(
|
|
151
151
|
$id: ID!
|
|
152
152
|
$numCartLines: Int = 250
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
${e}
|
|
161
|
-
`,
|
|
161
|
+
`,hr=`
|
|
162
162
|
fragment CartFragment on Cart {
|
|
163
163
|
id
|
|
164
164
|
checkoutUrl
|
|
@@ -244,6 +244,7 @@
|
|
|
244
244
|
}
|
|
245
245
|
discountCodes {
|
|
246
246
|
code
|
|
247
|
+
applicable
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -258,14 +259,16 @@
|
|
|
258
259
|
width
|
|
259
260
|
height
|
|
260
261
|
}
|
|
261
|
-
`,ee="2023-04";function hr(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o=ee,contentType:a}=e;o!==ee&&gr(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${o}"; expected version "${ee}"`);const s=u=>u.includes("mock.shop"),i=u=>{const d=(u==null?void 0:u.storeDomain)??t;return d.includes("://")?d:`https://${d}`};return{getShopifyDomain:i,getStorefrontApiUrl(u){const d=i(u),l=d+(d.endsWith("/")?"api":"/api");return s(d)?l:`${l}/${(u==null?void 0:u.storefrontApiVersion)??o}/graphql.json`},getPrivateTokenHeaders(u){if(!r&&!(u!=null&&u.privateStorefrontToken)&&!s(t))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((u==null?void 0:u.contentType)??a)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":o,"Shopify-Storefront-Private-Token":(u==null?void 0:u.privateStorefrontToken)??r??"",...u!=null&&u.buyerIp?{"Shopify-Storefront-Buyer-IP":u.buyerIp}:{}}},getPublicTokenHeaders(u){if(!n&&!(u!=null&&u.publicStorefrontToken)&&!s(t))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const d=(u==null?void 0:u.contentType)??a??"json";return Be(d,o,(u==null?void 0:u.publicStorefrontToken)??n??"")}}}function Be(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const Ye=new Set,gr=e=>{Ye.has(e)||(console.warn(e),Ye.add(e))},je={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ee,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},Ge=c.createContext(je);function mr({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==ee&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${ee}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=c.useMemo(()=>{function n(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return Be(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const a=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${a}${a.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return c.createElement(Ge.Provider,{value:r},e)}function ae(){const e=c.useContext(Ge);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Ie="shopifyCartId",Ze="Shopify-Storefront-Id",We="Shopify-Storefront-Y",Qe="Shopify-Storefront-S",G="_shopify_y",Z="_shopify_s";var pr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Er(e){let t={},r,n,o=0,a=e.split(/;\s*/g),s,i;for(;o<a.length;o++)if(n=a[o],r=n.indexOf("="),~r){if(s=n.substring(0,r++).trim(),i=n.substring(r).trim(),i[0]==='"'&&(i=i.substring(1,i.length-1)),~i.indexOf("%"))try{i=decodeURIComponent(i)}catch{}pr.has(n=s.toLowerCase())?n==="expires"?t.expires=new Date(i):n==="max-age"?t.maxage=+i:t[n]=i:t[s]=i}else(s=n.trim().toLowerCase())&&(s==="httponly"||s==="secure")&&(t[s]=!0);return t}function Cr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const Je="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function me(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Je.replace(/[x]/g,o=>{const a=r[n]%16,s=o==="x"?a:a&3|8;return n++,s.toString(16)}).toUpperCase()}catch{e=Je.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${Sr()}-${e}`}function Sr(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function pe(e){const t=Er(e);return{[G]:t[G]||"",[Z]:t[Z]||""}}function Tr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=ae();return c.useCallback(({query:n,variables:o})=>{const a=t({contentType:"json"});e&&(a[Ze]=e);const s=pe(document.cookie);return a[We]=s[G],a[Qe]=s[Z],fetch(r(),{method:"POST",headers:a,body:JSON.stringify({query:n.toString(),variables:o})}).then(i=>i.json()).catch(i=>({data:void 0,errors:i==null?void 0:i.toString()}))},[t,e,r])}function _r({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=Tr(),o=c.useCallback(p=>n({query:fr(t),variables:{id:p,numCartLines:e,country:r}}),[n,t,e,r]),a=c.useCallback(p=>n({query:ir(t),variables:{input:p,numCartLines:e,country:r}}),[t,r,n,e]),s=c.useCallback((p,f)=>n({query:or(t),variables:{cartId:p,lines:f,numCartLines:e,country:r}}),[t,r,n,e]),i=c.useCallback((p,f)=>n({query:sr(t),variables:{cartId:p,lines:f,numCartLines:e,country:r}}),[t,r,n,e]),u=c.useCallback((p,f)=>n({query:ar(t),variables:{cartId:p,lines:f,numCartLines:e,country:r}}),[t,r,n,e]),d=c.useCallback((p,f)=>n({query:ur(t),variables:{cartId:p,note:f,numCartLines:e,country:r}}),[n,t,e,r]),l=c.useCallback((p,f)=>n({query:cr(t),variables:{cartId:p,buyerIdentity:f,numCartLines:e,country:r}}),[t,r,n,e]),h=c.useCallback((p,f)=>n({query:lr(t),variables:{cartId:p,attributes:f,numCartLines:e,country:r}}),[t,r,n,e]),m=c.useCallback((p,f)=>n({query:dr(t),variables:{cartId:p,discountCodes:f,numCartLines:e,country:r}}),[t,r,n,e]);return c.useMemo(()=>({cartFetch:o,cartCreate:a,cartLineAdd:s,cartLineUpdate:i,cartLineRemove:u,noteUpdate:d,buyerIdentityUpdate:l,cartAttributesUpdate:h,discountCodesUpdate:m,cartFragment:t}),[o,a,s,i,u,d,l,h,m,t])}function F(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],X({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[X({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.cart},rawCartResult:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[X({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:X({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const se={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[X({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>we(t.payload.cart)})]}},Ke={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function Ar(e){return xe({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&we(e)},states:{uninitialized:{on:se},cartCompleted:{on:se},initializationError:{on:se},idle:{on:{...se,...Ke}},error:{on:{...se,...Ke}},cartFetching:F("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:F("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:F("cartLineRemoveAction"),cartLineUpdating:F("cartLineUpdateAction"),cartLineAdding:F("cartLineAddAction"),noteUpdating:F("noteUpdateAction"),buyerIdentityUpdating:F("buyerIdentityUpdateAction"),cartAttributesUpdating:F("cartAttributesUpdateAction"),discountCodesUpdating:F("discountCodesUpdateAction")}})}function vr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:a,countryCode:s}){const{cartFetch:i,cartCreate:u,cartLineAdd:d,cartLineUpdate:l,cartLineRemove:h,noteUpdate:m,buyerIdentityUpdate:p,cartAttributesUpdate:f,discountCodesUpdate:b}=_r({numCartLines:e,cartFragment:a,countryCode:s}),T=c.useMemo(()=>Ar(o),[o]),[I,A,O]=tr(T,{actions:{cartFetchAction:async(g,y)=>{var _;if(y.type!=="CART_FETCH")return;const{data:C,errors:D}=await i((_=y==null?void 0:y.payload)==null?void 0:_.cartId),w=q(y,C==null?void 0:C.cart,D);A(w)},cartCreateAction:async(g,y)=>{var _;if(y.type!=="CART_CREATE")return;const{data:C,errors:D}=await u(y==null?void 0:y.payload),w=q(y,(_=C==null?void 0:C.cartCreate)==null?void 0:_.cart,D);A(w)},cartLineAddAction:async(g,y)=>{var _,v;if(y.type!=="CARTLINE_ADD"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await d(g.cart.id,y.payload.lines),w=q(y,(v=C==null?void 0:C.cartLinesAdd)==null?void 0:v.cart,D);A(w)},cartLineUpdateAction:async(g,y)=>{var _,v;if(y.type!=="CARTLINE_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await l(g.cart.id,y.payload.lines),w=q(y,(v=C==null?void 0:C.cartLinesUpdate)==null?void 0:v.cart,D);A(w)},cartLineRemoveAction:async(g,y)=>{var _,v;if(y.type!=="CARTLINE_REMOVE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await h(g.cart.id,y.payload.lines),w=q(y,(v=C==null?void 0:C.cartLinesRemove)==null?void 0:v.cart,D);A(w)},noteUpdateAction:async(g,y)=>{var _,v;if(y.type!=="NOTE_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await m(g.cart.id,y.payload.note),w=q(y,(v=C==null?void 0:C.cartNoteUpdate)==null?void 0:v.cart,D);A(w)},buyerIdentityUpdateAction:async(g,y)=>{var _,v;if(y.type!=="BUYER_IDENTITY_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await p(g.cart.id,y.payload.buyerIdentity),w=q(y,(v=C==null?void 0:C.cartBuyerIdentityUpdate)==null?void 0:v.cart,D);A(w)},cartAttributesUpdateAction:async(g,y)=>{var _,v;if(y.type!=="CART_ATTRIBUTES_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await f(g.cart.id,y.payload.attributes),w=q(y,(v=C==null?void 0:C.cartAttributesUpdate)==null?void 0:v.cart,D);A(w)},discountCodesUpdateAction:async(g,y)=>{var _,v;if(y.type!=="DISCOUNT_CODES_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await b(g.cart.id,y.payload.discountCodes),w=q(y,(v=C==null?void 0:C.cartDiscountCodesUpdate)==null?void 0:v.cart,D);A(w)},...t&&{onCartActionEntry:(g,y)=>{br(y)&&t(g,y)}},...r&&{onCartActionOptimisticUI:X((g,y)=>r(g,y))},...n&&{onCartActionComplete:(g,y)=>{Ir(y)&&n(g,y)}}}});return c.useMemo(()=>[I,A,O],[I,A,O])}function we(e){return{...e,lines:j(e==null?void 0:e.lines),note:e.note??void 0}}function q(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:we(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function br(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function Ir(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Xe=c.createContext(null);function te(){const e=c.useContext(Xe);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function wr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:a,onNoteUpdate:s,onBuyerIdentityUpdate:i,onAttributesUpdate:u,onDiscountCodesUpdate:d,onCreateComplete:l,onLineAddComplete:h,onLineRemoveComplete:m,onLineUpdateComplete:p,onNoteUpdateComplete:f,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:I,data:A,cartFragment:O=yr,customerAccessToken:g,countryCode:y}){var _t,At,vt,bt,It,wt,Pt;const C=ae();if(!C)throw new Error("<CartProvider> needs to be a descendant of <ShopifyProvider>");y=(y??C.countryIsoCode??"US").toUpperCase(),y&&(y=y.toUpperCase());const[D,w]=c.useState(y),[_,v]=c.useState(g),B=c.useRef(!1);(D!==y||_!==g)&&(w(y),v(g),B.current=!1);const[P,x]=vr({numCartLines:t,data:A,cartFragment:O,countryCode:y,onCartActionEntry(S,$){try{switch($.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return a==null?void 0:a();case"NOTE_UPDATE":return s==null?void 0:s();case"BUYER_IDENTITY_UPDATE":return i==null?void 0:i();case"CART_ATTRIBUTES_UPDATE":return u==null?void 0:u();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(S,$){var M,Y,N,ye;if(!S.cart)return{...S};switch($.type){case"CARTLINE_REMOVE":return{...S,cart:{...S.cart,lines:(Y=(M=S==null?void 0:S.cart)==null?void 0:M.lines)==null?void 0:Y.filter(R=>(R==null?void 0:R.id)&&!$.payload.lines.includes(R==null?void 0:R.id))}};case"CARTLINE_UPDATE":return{...S,cart:{...S.cart,lines:(ye=(N=S==null?void 0:S.cart)==null?void 0:N.lines)==null?void 0:ye.map(R=>{const Oe=$.payload.lines.find(({id:In})=>In===(R==null?void 0:R.id));return Oe&&Oe.quantity?{...R,quantity:Oe.quantity}:R})}}}return{...S}},onCartActionComplete(S,$){const M=$.payload.cartActionEvent;try{switch($.type){case"RESOLVE":switch(M.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return h==null?void 0:h();case"CARTLINE_REMOVE":return m==null?void 0:m();case"CARTLINE_UPDATE":return p==null?void 0:p();case"NOTE_UPDATE":return f==null?void 0:f();case"BUYER_IDENTITY_UPDATE":return kr(S,M)&&(B.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return I==null?void 0:I()}}}catch(Y){console.error("onCartActionComplete failed",Y)}}}),W=c.useRef(!1),oe=P.matches("cartCompleted"),K=(P.value==="idle"||P.value==="error"||P.value==="cartCompleted")&&y!==((vt=(At=(_t=P==null?void 0:P.context)==null?void 0:_t.cart)==null?void 0:At.buyerIdentity)==null?void 0:vt.countryCode)&&!P.context.errors,U=c.useRef(!1);c.useEffect(()=>{if(!W.current&&!U.current){if(!A&&Pe("localStorage")){U.current=!0;try{const S=window.localStorage.getItem(Ie);S&&x({type:"CART_FETCH",payload:{cartId:S}})}catch(S){console.warn("error fetching cartId"),console.warn(S)}}W.current=!0}},[A,W,x]),c.useEffect(()=>{!K||B.current||x({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:y,customerAccessToken:g}}})},[y,g,K,B,x]);const L=c.useCallback(S=>{if(!W.current)return console.warn("Cart isn't ready yet");x(S)},[x]);c.useEffect(()=>{var S,$,M;if(($=(S=P==null?void 0:P.context)==null?void 0:S.cart)!=null&&$.id&&Pe("localStorage"))try{window.localStorage.setItem(Ie,(M=P.context.cart)==null?void 0:M.id)}catch(Y){console.warn("Failed to save cartId to localStorage",Y)}},[(It=(bt=P==null?void 0:P.context)==null?void 0:bt.cart)==null?void 0:It.id]),c.useEffect(()=>{if(oe&&Pe("localStorage"))try{window.localStorage.removeItem(Ie)}catch(S){console.warn("Failed to delete cartId from localStorage",S)}},[oe]);const ie=c.useCallback(S=>{var $,M;y&&!(($=S.buyerIdentity)!=null&&$.countryCode)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.countryCode=y),g&&!((M=S.buyerIdentity)!=null&&M.customerAccessToken)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.customerAccessToken=g),L({type:"CART_CREATE",payload:S})},[y,g,L]),k=Dr(P),bn=c.useMemo(()=>{var S,$,M,Y;return{...((S=k==null?void 0:k.context)==null?void 0:S.cart)??{lines:[],attributes:[]},status:Pr(k.value),error:($=k==null?void 0:k.context)==null?void 0:$.errors,totalQuantity:((Y=(M=k==null?void 0:k.context)==null?void 0:M.cart)==null?void 0:Y.totalQuantity)??0,cartCreate:ie,linesAdd(N){var ye,R;(R=(ye=k==null?void 0:k.context)==null?void 0:ye.cart)!=null&&R.id?L({type:"CARTLINE_ADD",payload:{lines:N}}):ie({lines:N})},linesRemove(N){L({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){L({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){L({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){L({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){L({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){L({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:O}},[ie,(wt=k==null?void 0:k.context)==null?void 0:wt.cart,(Pt=k==null?void 0:k.context)==null?void 0:Pt.errors,k.value,O,L]);return c.createElement(Xe.Provider,{value:bn},e)}function Pr(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function Dr(e){const[t,r]=c.useTransition(),[n,o]=c.useState(e),a=c.useRef(!1);t&&(a.current=!0);const s=c.useRef(!1);return!t&&a.current&&(s.current=!0),c.useEffect(()=>{r(()=>{s.current||o(e)})},[e]),s.current?e:n}function Pe(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return!!(r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0)}}function kr(e,t){var r,n;return!!(t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode)}const ze=c.createContext(null);function Ur({children:e,data:t,initialVariantId:r}){const n=c.useMemo(()=>j(t.variants??{}),[t.variants]);if(!$r(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=c.useMemo(()=>Or(n),[n]),[a,s]=c.useState(()=>rt(r,n)),[i,u]=c.useState(()=>nt(a));c.useEffect(()=>{const T=rt(r,n);s(T),u(nt(T))},[r,n]);const d=c.useCallback((T,I)=>{u(A=>{const O={...A,[T]:I};return s(tt(n,O)),O})},[u,n]),l=c.useCallback((T,I)=>{const A=tt(n,{...i,[T]:I});return(A==null?void 0:A.availableForSale)??!0},[i,n]),h=c.useMemo(()=>j(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:j((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[m,p]=c.useState(void 0),f=c.useMemo(()=>{var T,I;if(!(!a||!m)){if(!((T=a.sellingPlanAllocations)!=null&&T.nodes)&&!((I=a.sellingPlanAllocations)!=null&&I.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return j(a.sellingPlanAllocations).find(A=>{var O;return((O=A==null?void 0:A.sellingPlan)==null?void 0:O.id)===m.id})}},[a,m]),b=c.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:o,selectedVariant:a,setSelectedVariant:s,selectedOptions:i,setSelectedOption:d,setSelectedOptions:u,isOptionInStock:l,selectedSellingPlan:m,setSelectedSellingPlan:p,selectedSellingPlanAllocation:f,sellingPlanGroups:h,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,l,o,i,m,f,a,h,d,n]);return c.createElement(ze.Provider,{value:b},e)}function et(){const e=c.useContext(ze);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function tt(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(o=>Object.entries(t).every(([a,s])=>{var i;return(i=o==null?void 0:o.selectedOptions)==null?void 0:i.some(u=>(u==null?void 0:u.name)===a&&(u==null?void 0:u.value)===s)}))}function Or(e){const t=e.reduce((r,n)=>{var o;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=n==null?void 0:n.selectedOptions)==null||o.forEach(a=>{r[(a==null?void 0:a.name)??""]=r[(a==null?void 0:a.name)??""]||new Set,r[(a==null?void 0:a.name)??""].add((a==null?void 0:a.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function rt(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function nt(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function $r(e){return!(!e||!Array.isArray(e))}function Ee(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:a,...s}=e,i=c.useCallback(d=>{if(r){const l=r(d);if(typeof l=="boolean"&&l===!1||d!=null&&d.defaultPrevented)return}n==null||n(d)},[n,r]),u=t||"button";return c.createElement(u,{ref:a,onClick:i,...s},o)}function Nr(e){const[t,r]=c.useState(!1),{variantId:n,quantity:o=1,attributes:a,sellingPlanId:s,onClick:i,children:u,accessibleAddingToCartLabel:d,...l}=e,{status:h,linesAdd:m}=te(),{selectedVariant:p}=et(),f=n??(p==null?void 0:p.id)??"",b=n===null||f===""||p===null||t||l.disabled;c.useEffect(()=>{t&&h==="idle"&&r(!1)},[h,t]);const T=c.useCallback(()=>{r(!0),m([{quantity:o,merchandiseId:f||"",attributes:a,sellingPlanId:s}])},[m,o,f,a,s]);return V.createElement(V.Fragment,null,V.createElement(Ee,{...l,disabled:b,onClick:i,defaultOnClick:T},u),d?V.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?d:null):null)}const De={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},Ce={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},ot={hydrogen:"hydrogen",headless:"headless"},it={hydrogen:"6167201",headless:"12875497473"};function re(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function H(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([^/]+)/);if(!r||r.length===1)return t;const n=r[2]??null,o=r[1]??null;return{id:n,resource:o}}function J(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Mr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Vr="trekkie_storefront_page_view/1.4",Rr="myshopify.dev";function Lr(e){const t=e,{id:r,resource:n}=H(t.resourceId),o=n?n.toLowerCase():void 0;return[re(Vr,J({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},xr(t)))]}function xr(e){return{appClientId:e.shopifySalesChannel?it[e.shopifySalesChannel]:it.headless,isMerchantRequest:Fr(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:me(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(H(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function Fr(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(Rr)!==-1||t==="localhost"}const ue="custom_storefront_customer_tracking/1.0",qr="page_rendered",Hr="collection_page_rendered",Br="product_page_rendered",Yr="product_added_to_cart",jr="search_submitted";function Gr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(re(ue,J({event_name:qr,...r},ce(t)))),n){case Ce.collection:o.push(re(ue,J({event_name:Hr,...r,collection_name:t.collectionHandle},ce(t))));break;case Ce.product:o.push(re(ue,J({event_name:Br,...r,products:at(t.products),total_value:t.totalValue},ce(t))));break;case Ce.search:o.push(re(ue,J({event_name:jr,...r,search_string:t.searchString},ce(t))));break}return o}function Zr(e){const t=e,r=H(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[re(ue,J({event_name:Yr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:at(t.products)},ce(t)))]}function ce(e){return{source:e.shopifySalesChannel||ot.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:me(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(H(e.shopId).id),currency:e.currency}}function at(e){return e?e.map(t=>{const r=J({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(H(t.productGid).id),variant_id:parseInt(H(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function Wr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===De.PAGE_VIEW){const a=n;o=o.concat(Lr(a),Gr(a))}else r===De.ADD_TO_CART&&(o=o.concat(Zr(n)));return o.length?Qr(o,t):Promise.resolve()}const st="sendShopifyAnalytics request is unsuccessful";function Qr(e,t){const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(a=>{a.status!==200&&console.error(st,`
|
|
262
|
+
`,ee="2023-07";function gr(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o=ee,contentType:i}=e;if(!t)throw new Error(ve+`\`storeDomain\` is required when creating a new Storefront client.
|
|
263
|
+
Received "${t}".`);o!==ee&&pr(`The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.
|
|
264
|
+
You may run into unexpected errors if these versions don't match. Received verion: "${o}"; expected version "${ee}"`);const s=c=>c.includes("mock.shop"),a=c=>{const d=(c==null?void 0:c.storeDomain)??t;return d.includes("://")?d:`https://${d}`};return{getShopifyDomain:a,getStorefrontApiUrl(c){const d=a(c),l=d+(d.endsWith("/")?"api":"/api");return s(d)?l:`${l}/${(c==null?void 0:c.storefrontApiVersion)??o}/graphql.json`},getPrivateTokenHeaders(c){if(!r&&!(c!=null&&c.privateStorefrontToken)&&!s(t))throw new Error(ve+"You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`");return{"content-type":((c==null?void 0:c.contentType)??i)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":o,"Shopify-Storefront-Private-Token":(c==null?void 0:c.privateStorefrontToken)??r??"",...c!=null&&c.buyerIp?{"Shopify-Storefront-Buyer-IP":c.buyerIp}:{}}},getPublicTokenHeaders(c){if(!n&&!(c!=null&&c.publicStorefrontToken)&&!s(t))throw new Error(ve+"You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`");const d=(c==null?void 0:c.contentType)??i??"json";return je(d,o,(c==null?void 0:c.publicStorefrontToken)??n??"")}}}function je(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const Ge=new Set,ve="[h2:error:createStorefrontClient] ",mr="[h2:warn:createStorefrontClient] ",pr=e=>{Ge.has(e)||(console.warn(mr+e),Ge.add(e))},Ze={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ee,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},We=u.createContext(Ze);function Er({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==ee&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${ee}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=u.useMemo(()=>{function n(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return je(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const i=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${i}${i.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return React.createElement(We.Provider,{value:r},e)}function ie(){const e=u.useContext(We);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const be="shopifyCartId",Qe="Shopify-Storefront-Id",Je="Shopify-Storefront-Y",Xe="Shopify-Storefront-S",G="_shopify_y",Z="_shopify_s";var Cr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function Sr(e){let t={},r,n,o=0,i=e.split(/;\s*/g),s,a;for(;o<i.length;o++)if(n=i[o],r=n.indexOf("="),~r){if(s=n.substring(0,r++).trim(),a=n.substring(r).trim(),a[0]==='"'&&(a=a.substring(1,a.length-1)),~a.indexOf("%"))try{a=decodeURIComponent(a)}catch{}Cr.has(n=s.toLowerCase())?n==="expires"?t.expires=new Date(a):n==="max-age"?t.maxage=+a:t[n]=a:t[s]=a}else(s=n.trim().toLowerCase())&&(s==="httponly"||s==="secure")&&(t[s]=!0);return t}function Tr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const Ke="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function me(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Ke.replace(/[x]/g,o=>{const i=r[n]%16,s=o==="x"?i:i&3|8;return n++,s.toString(16)}).toUpperCase()}catch{e=Ke.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${_r()}-${e}`}function _r(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function pe(e){const t=Sr(e);return{[G]:t[G]||"",[Z]:t[Z]||""}}function Ar(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=ie();return u.useCallback(({query:n,variables:o})=>{const i=t({contentType:"json"});e&&(i[Qe]=e);const s=pe(document.cookie);return i[Je]=s[G],i[Xe]=s[Z],fetch(r(),{method:"POST",headers:i,body:JSON.stringify({query:n.toString(),variables:o})}).then(a=>a.json()).catch(a=>({data:void 0,errors:a==null?void 0:a.toString()}))},[t,e,r])}function vr({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=Ar(),o=u.useCallback(p=>n({query:yr(t),variables:{id:p,numCartLines:e,country:r}}),[n,t,e,r]),i=u.useCallback(p=>n({query:ir(t),variables:{input:p,numCartLines:e,country:r}}),[t,r,n,e]),s=u.useCallback((p,f)=>n({query:ar(t),variables:{cartId:p,lines:f,numCartLines:e,country:r}}),[t,r,n,e]),a=u.useCallback((p,f)=>n({query:cr(t),variables:{cartId:p,lines:f,numCartLines:e,country:r}}),[t,r,n,e]),c=u.useCallback((p,f)=>n({query:sr(t),variables:{cartId:p,lines:f,numCartLines:e,country:r}}),[t,r,n,e]),d=u.useCallback((p,f)=>n({query:ur(t),variables:{cartId:p,note:f,numCartLines:e,country:r}}),[n,t,e,r]),l=u.useCallback((p,f)=>n({query:lr(t),variables:{cartId:p,buyerIdentity:f,numCartLines:e,country:r}}),[t,r,n,e]),h=u.useCallback((p,f)=>n({query:dr(t),variables:{cartId:p,attributes:f,numCartLines:e,country:r}}),[t,r,n,e]),m=u.useCallback((p,f)=>n({query:fr(t),variables:{cartId:p,discountCodes:f,numCartLines:e,country:r}}),[t,r,n,e]);return u.useMemo(()=>({cartFetch:o,cartCreate:i,cartLineAdd:s,cartLineUpdate:a,cartLineRemove:c,noteUpdate:d,buyerIdentityUpdate:l,cartAttributesUpdate:h,discountCodesUpdate:m,cartFragment:t}),[o,i,s,a,c,d,l,h,m,t])}function q(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],K({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[K({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.cart},rawCartResult:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[K({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:K({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const se={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[K({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>we(t.payload.cart)})]}},ze={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function br(e){return Fe({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&we(e)},states:{uninitialized:{on:se},cartCompleted:{on:se},initializationError:{on:se},idle:{on:{...se,...ze}},error:{on:{...se,...ze}},cartFetching:q("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:q("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:q("cartLineRemoveAction"),cartLineUpdating:q("cartLineUpdateAction"),cartLineAdding:q("cartLineAddAction"),noteUpdating:q("noteUpdateAction"),buyerIdentityUpdating:q("buyerIdentityUpdateAction"),cartAttributesUpdating:q("cartAttributesUpdateAction"),discountCodesUpdating:q("discountCodesUpdateAction")}})}function wr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:i,countryCode:s}){const{cartFetch:a,cartCreate:c,cartLineAdd:d,cartLineUpdate:l,cartLineRemove:h,noteUpdate:m,buyerIdentityUpdate:p,cartAttributesUpdate:f,discountCodesUpdate:b}=vr({numCartLines:e,cartFragment:i,countryCode:s}),T=u.useMemo(()=>br(o),[o]),[w,A,U]=rr(T,{actions:{cartFetchAction:async(g,y)=>{var _;if(y.type!=="CART_FETCH")return;const{data:C,errors:D}=await a((_=y==null?void 0:y.payload)==null?void 0:_.cartId),I=H(y,C==null?void 0:C.cart,D);A(I)},cartCreateAction:async(g,y)=>{var _;if(y.type!=="CART_CREATE")return;const{data:C,errors:D}=await c(y==null?void 0:y.payload),I=H(y,(_=C==null?void 0:C.cartCreate)==null?void 0:_.cart,D);A(I)},cartLineAddAction:async(g,y)=>{var _,v;if(y.type!=="CARTLINE_ADD"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await d(g.cart.id,y.payload.lines),I=H(y,(v=C==null?void 0:C.cartLinesAdd)==null?void 0:v.cart,D);A(I)},cartLineUpdateAction:async(g,y)=>{var _,v;if(y.type!=="CARTLINE_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await l(g.cart.id,y.payload.lines),I=H(y,(v=C==null?void 0:C.cartLinesUpdate)==null?void 0:v.cart,D);A(I)},cartLineRemoveAction:async(g,y)=>{var _,v;if(y.type!=="CARTLINE_REMOVE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await h(g.cart.id,y.payload.lines),I=H(y,(v=C==null?void 0:C.cartLinesRemove)==null?void 0:v.cart,D);A(I)},noteUpdateAction:async(g,y)=>{var _,v;if(y.type!=="NOTE_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await m(g.cart.id,y.payload.note),I=H(y,(v=C==null?void 0:C.cartNoteUpdate)==null?void 0:v.cart,D);A(I)},buyerIdentityUpdateAction:async(g,y)=>{var _,v;if(y.type!=="BUYER_IDENTITY_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await p(g.cart.id,y.payload.buyerIdentity),I=H(y,(v=C==null?void 0:C.cartBuyerIdentityUpdate)==null?void 0:v.cart,D);A(I)},cartAttributesUpdateAction:async(g,y)=>{var _,v;if(y.type!=="CART_ATTRIBUTES_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await f(g.cart.id,y.payload.attributes),I=H(y,(v=C==null?void 0:C.cartAttributesUpdate)==null?void 0:v.cart,D);A(I)},discountCodesUpdateAction:async(g,y)=>{var _,v;if(y.type!=="DISCOUNT_CODES_UPDATE"||!((_=g==null?void 0:g.cart)!=null&&_.id))return;const{data:C,errors:D}=await b(g.cart.id,y.payload.discountCodes),I=H(y,(v=C==null?void 0:C.cartDiscountCodesUpdate)==null?void 0:v.cart,D);A(I)},...t&&{onCartActionEntry:(g,y)=>{Ir(y)&&t(g,y)}},...r&&{onCartActionOptimisticUI:K((g,y)=>r(g,y))},...n&&{onCartActionComplete:(g,y)=>{Pr(y)&&n(g,y)}}}});return u.useMemo(()=>[w,A,U],[w,A,U])}function we(e){return{...e,lines:j(e==null?void 0:e.lines),note:e.note??void 0}}function H(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:we(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function Ir(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function Pr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const et=u.createContext(null);function te(){const e=u.useContext(et);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Dr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:i,onNoteUpdate:s,onBuyerIdentityUpdate:a,onAttributesUpdate:c,onDiscountCodesUpdate:d,onCreateComplete:l,onLineAddComplete:h,onLineRemoveComplete:m,onLineUpdateComplete:p,onNoteUpdateComplete:f,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:w,data:A,cartFragment:U=hr,customerAccessToken:g,countryCode:y}){var At,vt,bt,wt,It,Pt,Dt;const C=ie();if(!C)throw new Error("<CartProvider> needs to be a descendant of <ShopifyProvider>");y=(y??C.countryIsoCode??"US").toUpperCase(),y&&(y=y.toUpperCase());const[D,I]=u.useState(y),[_,v]=u.useState(g),B=u.useRef(!1);(D!==y||_!==g)&&(I(y),v(g),B.current=!1);const[P,F]=wr({numCartLines:t,data:A,cartFragment:U,countryCode:y,onCartActionEntry(S,O){try{switch(O.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return s==null?void 0:s();case"BUYER_IDENTITY_UPDATE":return a==null?void 0:a();case"CART_ATTRIBUTES_UPDATE":return c==null?void 0:c();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(S,O){var M,Y,N,ye;if(!S.cart)return{...S};switch(O.type){case"CARTLINE_REMOVE":return{...S,cart:{...S.cart,lines:(Y=(M=S==null?void 0:S.cart)==null?void 0:M.lines)==null?void 0:Y.filter(L=>(L==null?void 0:L.id)&&!O.payload.lines.includes(L==null?void 0:L.id))}};case"CARTLINE_UPDATE":return{...S,cart:{...S.cart,lines:(ye=(N=S==null?void 0:S.cart)==null?void 0:N.lines)==null?void 0:ye.map(L=>{const Ue=O.payload.lines.find(({id:Pn})=>Pn===(L==null?void 0:L.id));return Ue&&Ue.quantity?{...L,quantity:Ue.quantity}:L})}}}return{...S}},onCartActionComplete(S,O){const M=O.payload.cartActionEvent;try{switch(O.type){case"RESOLVE":switch(M.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return h==null?void 0:h();case"CARTLINE_REMOVE":return m==null?void 0:m();case"CARTLINE_UPDATE":return p==null?void 0:p();case"NOTE_UPDATE":return f==null?void 0:f();case"BUYER_IDENTITY_UPDATE":return Ur(S,M)&&(B.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return w==null?void 0:w()}}}catch(Y){console.error("onCartActionComplete failed",Y)}}}),W=u.useRef(!1),oe=P.matches("cartCompleted"),X=(P.value==="idle"||P.value==="error"||P.value==="cartCompleted")&&y!==((bt=(vt=(At=P==null?void 0:P.context)==null?void 0:At.cart)==null?void 0:vt.buyerIdentity)==null?void 0:bt.countryCode)&&!P.context.errors,k=u.useRef(!1);u.useEffect(()=>{if(!W.current&&!k.current){if(!A&&Ie("localStorage")){k.current=!0;try{const S=window.localStorage.getItem(be);S&&F({type:"CART_FETCH",payload:{cartId:S}})}catch(S){console.warn("error fetching cartId"),console.warn(S)}}W.current=!0}},[A,W,F]),u.useEffect(()=>{!X||B.current||F({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:y,customerAccessToken:g}}})},[y,g,X,B,F]);const x=u.useCallback(S=>{if(!W.current)return console.warn("Cart isn't ready yet");F(S)},[F]);u.useEffect(()=>{var S,O,M;if((O=(S=P==null?void 0:P.context)==null?void 0:S.cart)!=null&&O.id&&Ie("localStorage"))try{window.localStorage.setItem(be,(M=P.context.cart)==null?void 0:M.id)}catch(Y){console.warn("Failed to save cartId to localStorage",Y)}},[(It=(wt=P==null?void 0:P.context)==null?void 0:wt.cart)==null?void 0:It.id]),u.useEffect(()=>{if(oe&&Ie("localStorage"))try{window.localStorage.removeItem(be)}catch(S){console.warn("Failed to delete cartId from localStorage",S)}},[oe]);const ae=u.useCallback(S=>{var O,M;y&&!((O=S.buyerIdentity)!=null&&O.countryCode)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.countryCode=y),g&&!((M=S.buyerIdentity)!=null&&M.customerAccessToken)&&(S.buyerIdentity==null&&(S.buyerIdentity={}),S.buyerIdentity.customerAccessToken=g),x({type:"CART_CREATE",payload:S})},[y,g,x]),R=kr(P),In=u.useMemo(()=>{var S,O,M,Y;return{...((S=R==null?void 0:R.context)==null?void 0:S.cart)??{lines:[],attributes:[]},status:Rr(R.value),error:(O=R==null?void 0:R.context)==null?void 0:O.errors,totalQuantity:((Y=(M=R==null?void 0:R.context)==null?void 0:M.cart)==null?void 0:Y.totalQuantity)??0,cartCreate:ae,linesAdd(N){var ye,L;(L=(ye=R==null?void 0:R.context)==null?void 0:ye.cart)!=null&&L.id?x({type:"CARTLINE_ADD",payload:{lines:N}}):ae({lines:N})},linesRemove(N){x({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){x({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){x({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){x({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){x({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){x({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:U}},[ae,(Pt=R==null?void 0:R.context)==null?void 0:Pt.cart,(Dt=R==null?void 0:R.context)==null?void 0:Dt.errors,R.value,U,x]);return React.createElement(et.Provider,{value:In},e)}function Rr(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function kr(e){const[t,r]=u.useTransition(),[n,o]=u.useState(e),i=u.useRef(!1);t&&(i.current=!0);const s=u.useRef(!1);return!t&&i.current&&(s.current=!0),u.useEffect(()=>{r(()=>{s.current||o(e)})},[e]),s.current?e:n}function Ie(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return!!(r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0)}}function Ur(e,t){var r,n;return!!(t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode)}const tt=u.createContext(null);function Or({children:e,data:t,initialVariantId:r}){const n=u.useMemo(()=>j(t.variants??{}),[t.variants]);if(!Mr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=u.useMemo(()=>Nr(n),[n]),[i,s]=u.useState(()=>ot(r,n)),[a,c]=u.useState(()=>at(i));u.useEffect(()=>{const T=ot(r,n);s(T),c(at(T))},[r,n]);const d=u.useCallback((T,w)=>{c(A=>{const U={...A,[T]:w};return s(nt(n,U)),U})},[c,n]),l=u.useCallback((T,w)=>{const A=nt(n,{...a,[T]:w});return(A==null?void 0:A.availableForSale)??!0},[a,n]),h=u.useMemo(()=>j(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:j((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[m,p]=u.useState(void 0),f=u.useMemo(()=>{var T,w;if(!(!i||!m)){if(!((T=i.sellingPlanAllocations)!=null&&T.nodes)&&!((w=i.sellingPlanAllocations)!=null&&w.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return j(i.sellingPlanAllocations).find(A=>{var U;return((U=A==null?void 0:A.sellingPlan)==null?void 0:U.id)===m.id})}},[i,m]),b=u.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:o,selectedVariant:i,setSelectedVariant:s,selectedOptions:a,setSelectedOption:d,setSelectedOptions:c,isOptionInStock:l,selectedSellingPlan:m,setSelectedSellingPlan:p,selectedSellingPlanAllocation:f,sellingPlanGroups:h,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,l,o,a,m,f,i,h,d,n]);return React.createElement(tt.Provider,{value:b},e)}function rt(){const e=u.useContext(tt);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function nt(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(o=>Object.entries(t).every(([i,s])=>{var a;return(a=o==null?void 0:o.selectedOptions)==null?void 0:a.some(c=>(c==null?void 0:c.name)===i&&(c==null?void 0:c.value)===s)}))}function Nr(e){const t=e.reduce((r,n)=>{var o;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=n==null?void 0:n.selectedOptions)==null||o.forEach(i=>{r[(i==null?void 0:i.name)??""]=r[(i==null?void 0:i.name)??""]||new Set,r[(i==null?void 0:i.name)??""].add((i==null?void 0:i.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function ot(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function at(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function Mr(e){return!(!e||!Array.isArray(e))}function Ee(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:i,...s}=e,a=u.useCallback(d=>{if(r){const l=r(d);if(typeof l=="boolean"&&l===!1||d!=null&&d.defaultPrevented)return}n==null||n(d)},[n,r]),c=t||"button";return React.createElement(c,{ref:i,onClick:a,...s},o)}function Vr(e){const[t,r]=u.useState(!1),{variantId:n,quantity:o=1,attributes:i,sellingPlanId:s,onClick:a,children:c,accessibleAddingToCartLabel:d,...l}=e,{status:h,linesAdd:m}=te(),{selectedVariant:p}=rt(),f=n??(p==null?void 0:p.id)??"",b=n===null||f===""||p===null||t||l.disabled;u.useEffect(()=>{t&&h==="idle"&&r(!1)},[h,t]);const T=u.useCallback(()=>{r(!0),m([{quantity:o,merchandiseId:f||"",attributes:i,sellingPlanId:s}])},[m,o,f,i,s]);return V.createElement(V.Fragment,null,V.createElement(Ee,{...l,disabled:b,onClick:a,defaultOnClick:T},c),d?V.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?d:null):null)}const Pe={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},Ce={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},it={hydrogen:"hydrogen",headless:"headless"},st={hydrogen:"6167201",headless:"12875497473"};function re(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function $(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([^/]+)/);if(!r||r.length===1)return t;const n=r[2]??null,o=r[1]??null;return{id:n,resource:o}}function J(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Lr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const xr="trekkie_storefront_page_view/1.4",Fr="myshopify.dev";function qr(e){const t=e,{id:r,resource:n}=$(t.resourceId),o=n?n.toLowerCase():void 0;return[re(xr,J({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},Hr(t)))]}function Hr(e){return{appClientId:e.shopifySalesChannel?st[e.shopifySalesChannel]:st.headless,isMerchantRequest:$r(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:me(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt($(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function $r(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(Fr)!==-1||t==="localhost"}const ce="custom_storefront_customer_tracking/1.0",Br="page_rendered",Yr="collection_page_rendered",jr="product_page_rendered",Gr="product_added_to_cart",Zr="search_submitted";function Wr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(re(ce,J({event_name:Br,...r},ue(t)))),n){case Ce.collection:o.push(re(ce,J({event_name:Yr,...r,collection_name:t.collectionHandle},ue(t))));break;case Ce.product:o.push(re(ce,J({event_name:jr,...r,products:ct(t.products),total_value:t.totalValue},ue(t))));break;case Ce.search:o.push(re(ce,J({event_name:Zr,...r,search_string:t.searchString},ue(t))));break}return o}function Qr(e){const t=e,r=$(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[re(ce,J({event_name:Gr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:ct(t.products)},ue(t)))]}function ue(e){return{source:e.shopifySalesChannel||it.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:me(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt($(e.shopId).id),currency:e.currency}}function ct(e){return e?e.map(t=>{const r=J({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt($(t.productGid).id),variant_id:parseInt($(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function Jr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===Pe.PAGE_VIEW){const i=n;o=o.concat(qr(i),Wr(i))}else r===Pe.ADD_TO_CART&&(o=o.concat(Qr(n)));return o.length?Xr(o,t):Promise.resolve()}const ut="sendShopifyAnalytics request is unsuccessful";function Xr(e,t){const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(i=>{i.status!==200&&console.error(ut,`
|
|
262
265
|
|
|
263
|
-
`,
|
|
266
|
+
`,i.message)})}).catch(n=>{console.error(ut,n)})}catch{return Promise.resolve()}}function Kr(){if(Lr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=tn(),r=pe(document.cookie);return{uniqueToken:r[G],visitToken:r[Z],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function zr(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function en(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function tn(){try{let e="PerformanceNavigationTiming",t=zr();return t||(t=en(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function rn(e){const{cartCreate:t,checkoutUrl:r}=te(),[n,o]=u.useState(!1),{quantity:i,variantId:s,onClick:a,attributes:c,children:d,...l}=e;u.useEffect(()=>{n&&r&&(window.location.href=r)},[n,r]);const h=u.useCallback(()=>{o(!0),t({lines:[{quantity:i??1,merchandiseId:s,attributes:c}]})},[t,i,s,c]);return React.createElement(Ee,{disabled:n??l.disabled,...l,onClick:a,defaultOnClick:h},d)}function nn(e){const[t,r]=u.useState(!1),{status:n,checkoutUrl:o}=te(),{children:i,...s}=e;return u.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),React.createElement(Ee,{...s,disabled:t||s.disabled,onClick:()=>r(!0)},i)}function lt(e){const{countryIsoCode:t,languageIsoCode:r}=ie(),n=r.includes("_")?r.replace("_","-"):`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const o=parseFloat(e.amount),i=u.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),s=ne(n,i),a=ne(n,{...i,currencyDisplay:"name"}),c=ne(n,{...i,currencyDisplay:"narrowSymbol"}),d=ne(n,{...i,minimumFractionDigits:0,maximumFractionDigits:0}),l=ne(n),h=ne(n,{minimumFractionDigits:0,maximumFractionDigits:0}),m=f=>f.type==="currency",p=u.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>s().format(o),parts:()=>s().formatToParts(o),withoutTrailingZeros:()=>o%1===0?d().format(o):s().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?h().format(o):l().format(o),currencyName:()=>{var f;return((f=a().formatToParts(o).find(m))==null?void 0:f.value)??e.currencyCode},currencySymbol:()=>{var f;return((f=s().formatToParts(o).find(m))==null?void 0:f.value)??e.currencyCode},currencyNarrowSymbol:()=>{var f;return((f=c().formatToParts(o).find(m))==null?void 0:f.value)??""},amount:()=>s().formatToParts(o).filter(f=>["decimal","fraction","group","integer","literal"].includes(f.type)).map(f=>f.value).join("")}),[e,o,a,s,c,l,d,h]);return u.useMemo(()=>new Proxy(p,{get:(f,b)=>{var T;return(T=Reflect.get(f,b))==null?void 0:T.call(null)}}),[p])}function ne(e,t){return u.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function Se({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:i="/",...s}){if(!on(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const a=lt(e),c=t??"div";let d=a.localizedString;return(r||n)&&(r&&!n?d=a.amount:!r&&n?d=a.withoutTrailingZeros:d=a.withoutTrailingZerosAndCurrency),React.createElement(c,{...s},d,o&&o.referenceUnit&&React.createElement(React.Fragment,null,i,o.referenceUnit))}function on(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function an(e){const{cost:t}=te(),{amountType:r="total",children:n,...o}=e;let i;return r=="total"?i=t==null?void 0:t.totalAmount:r=="subtotal"?i=t==null?void 0:t.subtotalAmount:r=="tax"?i=t==null?void 0:t.totalTaxAmount:r=="duty"&&(i=t==null?void 0:t.totalDutyAmount),i==null?null:React.createElement(Se,{...o,data:i},n)}const dt=u.createContext(null);function De(){const e=u.useContext(dt);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function sn({children:e,line:t}){return React.createElement(dt.Provider,{value:t},e)}function cn(e){const t=De(),{as:r,...n}=e,o=r||"span";return React.createElement(o,{...n},t.quantity)}function un(e){const{status:t,linesRemove:r,linesUpdate:n}=te(),o=De(),{children:i,adjust:s,onClick:a,...c}=e,d=u.useCallback(()=>{if(s==="remove"){r([(o==null?void 0:o.id)??""]);return}const l=s==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(l<=0){r([(o==null?void 0:o.id)??""]);return}const h={id:(o==null?void 0:o.id)??"",quantity:l,attributes:(o==null?void 0:o.attributes)??[]};n([h])},[s,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return React.createElement(Ee,{...c,onClick:a,defaultOnClick:d,disabled:typeof c.disabled<"u"?c.disabled:t!=="idle"},i)}const ln={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function ft(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:i="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:a="lazy",...c}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let d=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const h of Object.keys(r))l.searchParams.set(h,r[h]);d=l.toString()}return React.createElement("iframe",{...c,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:i,allowFullScreen:s,src:d,loading:a})}const dn=`#graphql
|
|
264
267
|
fragment Image on Image {
|
|
265
268
|
altText
|
|
266
269
|
url
|
|
267
270
|
width
|
|
268
271
|
height
|
|
269
272
|
}
|
|
270
|
-
`,dt=V.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:o="async",height:a="auto",loader:s=le,loaderOptions:i,loading:u="lazy",sizes:d,src:l,srcSetOptions:h={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:m="100%",widths:p,...f},b)=>{const T=V.useMemo(()=>{const w=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,_=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:w,height:_,unitsMatch:Boolean(ft(w,_))}},[n]),I=V.useMemo(()=>{const _=de((m||"100%").toString()),v=`${_.number}${_.unit}`,B=a==null,P=B?null:de(a.toString()),x=P?`${P.number}${P.unit}`:"",W=B?"auto":x,oe=l||(n==null?void 0:n.url),K=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",U=t||(T.unitsMatch?[fe(T.width),fe(T.height)].join("/"):void 0);return{width:v,height:W,src:oe,alt:K,aspectRatio:U}},[m,a,l,n,e,t,T,f==null?void 0:f.key]),{intervals:A,startingWidth:O,incrementSize:g,placeholderWidth:y}=h,C=V.useMemo(()=>fn(m,A,O,g),[m,A,O,g]);return yt(I.width)?V.createElement(ln,{aspectRatio:t,crop:r,decoding:o,height:a,imageWidths:C,loader:s,loading:u,normalizedProps:I,passthroughProps:f,ref:b,width:m}):V.createElement(dn,{aspectRatio:t,crop:r,decoding:o,imageWidths:C,loader:s,loading:u,normalizedProps:I,passthroughProps:f,placeholderWidth:y,ref:b,sizes:d})});function ln({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:o,loader:a=le,loading:s,normalizedProps:i,passthroughProps:u,ref:d,width:l}){const h=V.useMemo(()=>{const m=fe(l),p=fe(n),f=e||(ft(i.width,i.height)?[m,p].join("/"):i.aspectRatio?i.aspectRatio:void 0),b=o===void 0?void 0:gt(o,f,t),T=p||(f&&m?m*(Ue(f)??1):void 0),I=ht(i.src,b,a),A=a({src:i.src,width:m,height:T,crop:i.height==="auto"?void 0:t});return{width:m,aspectRatio:f,height:T,srcSet:I,src:A}},[e,t,n,o,a,i,l]);return V.createElement("img",{ref:d,alt:i.alt,decoding:r,height:h.height,loading:s,src:h.src,srcSet:h.srcSet,width:h.width,style:{aspectRatio:h.aspectRatio,...u.style},...u})}function dn({crop:e,decoding:t,imageWidths:r,loader:n=le,loading:o,normalizedProps:a,passthroughProps:s,placeholderWidth:i,ref:u,sizes:d}){const l=V.useMemo(()=>{const h=r===void 0?void 0:gt(r,a.aspectRatio,e),m=a.aspectRatio&&i?i*(Ue(a.aspectRatio)??1):void 0,p=ht(a.src,h,n),f=n({src:a.src,width:i,height:m,crop:e});return{placeholderHeight:m,srcSet:p,src:f}},[e,r,n,a,i]);return V.createElement("img",{ref:u,alt:a.alt,decoding:t,height:l.placeholderHeight,loading:o,sizes:d,src:l.src,srcSet:l.srcSet,width:i,...s,style:{width:a.width,aspectRatio:a.aspectRatio,...s.style}})}function le({src:e,width:t,height:r,crop:n}){if(!e)return"";const o=new URL(e);return t&&o.searchParams.append("width",Math.round(t).toString()),r&&o.searchParams.append("height",Math.round(r).toString()),n&&o.searchParams.append("crop",n),o.href}function ft(e="100%",t="auto"){return de(e.toString()).unit===de(t.toString()).unit}function de(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function fe(e){if(e===void 0)return;const{unit:t,number:r}=de(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function yt(e){return typeof e=="number"||typeof e=="string"&&/\d(px|em|rem)$/.test(e)}function ht(e,t,r=le){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,o)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${o+1}x`:`${n.width??0}w`}`).join(", "):""}function fn(e="100%",t,r,n){const o=Array.from({length:t},(s,i)=>i*n+r),a=Array.from({length:3},(s,i)=>(i+1)*(fe(e)??0));return yt(e)?a:o}function Ue(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function gt(e,t,r="center"){return e?e.map(o=>({width:o,height:t?o*(Ue(t)??1):void 0,crop:r})):void 0}function mt(e){var d;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:o=!0,controls:a=!0,sourceProps:s={},...i}=e,u=le({src:((d=t.previewImage)==null?void 0:d.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return c.createElement("video",{...i,id:n,playsInline:o,controls:a,poster:u},t.sources.map(l=>{if(!(l!=null&&l.url&&(l!=null&&l.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return c.createElement("source",{...s,key:l.url,src:l.url,type:l.mimeType})}))}const pt={};function yn(e,t){const r=pt[e];if(r)return r;const n=new Promise((o,a)=>{const s=document.createElement("script");t!=null&&t.module?s.type="module":s.type="text/javascript",s.src=e,s.onload=()=>{o(!0)},s.onerror=()=>{a(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(s):document.body.appendChild(s)});return pt[e]=n,n}function Et(e,t){const[r,n]=c.useState("loading"),o=JSON.stringify(t);return c.useEffect(()=>{async function a(){try{n("loading"),await yn(e,t),n("done")}catch{n("error")}}a().catch(()=>{n("error")})},[e,o,t]),r}function Ct(e){var d,l,h;const[t,r]=c.useState(void 0),n=c.useCallback(m=>{r(m)},[]),{data:o,children:a,className:s,...i}=e,u=Et("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return c.useEffect(()=>{if(t)return i.onError&&t.addEventListener("error",i.onError),i.onLoad&&t.addEventListener("load",i.onLoad),i.onPreload&&t.addEventListener("preload",i.onPreload),i.onModelVisibility&&t.addEventListener("model-visibility",i.onModelVisibility),i.onProgress&&t.addEventListener("progress",i.onProgress),i.onArStatus&&t.addEventListener("ar-status",i.onArStatus),i.onArTracking&&t.addEventListener("ar-tracking",i.onArTracking),i.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",i.onQuickLookButtonTapped),i.onCameraChange&&t.addEventListener("camera-change",i.onCameraChange),i.onEnvironmentChange&&t.addEventListener("environment-change",i.onEnvironmentChange),i.onPlay&&t.addEventListener("play",i.onPlay),i.onPause&&t.addEventListener("ar-status",i.onPause),i.onSceneGraphReady&&t.addEventListener("scene-graph-ready",i.onSceneGraphReady),()=>{t!=null&&(i.onError&&t.removeEventListener("error",i.onError),i.onLoad&&t.removeEventListener("load",i.onLoad),i.onPreload&&t.removeEventListener("preload",i.onPreload),i.onModelVisibility&&t.removeEventListener("model-visibility",i.onModelVisibility),i.onProgress&&t.removeEventListener("progress",i.onProgress),i.onArStatus&&t.removeEventListener("ar-status",i.onArStatus),i.onArTracking&&t.removeEventListener("ar-tracking",i.onArTracking),i.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",i.onQuickLookButtonTapped),i.onCameraChange&&t.removeEventListener("camera-change",i.onCameraChange),i.onEnvironmentChange&&t.removeEventListener("environment-change",i.onEnvironmentChange),i.onPlay&&t.removeEventListener("play",i.onPlay),i.onPause&&t.removeEventListener("ar-status",i.onPause),i.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",i.onSceneGraphReady))}},[t,i.onArStatus,i.onArTracking,i.onCameraChange,i.onEnvironmentChange,i.onError,i.onLoad,i.onModelVisibility,i.onPause,i.onPlay,i.onPreload,i.onProgress,i.onQuickLookButtonTapped,i.onSceneGraphReady]),u!=="done"?null:(l=(d=o.sources)==null?void 0:d[0])!=null&&l.url?c.createElement("model-viewer",{ref:n,...i,class:s,id:i.id??o.id,src:o.sources[0].url,alt:o.alt??null,"camera-controls":i.cameraControls??!0,poster:(i.poster||((h=o.previewImage)==null?void 0:h.url))??null,autoplay:i.autoplay??!0,loading:i.loading,reveal:i.reveal,ar:i.ar,"ar-modes":i.arModes,"ar-scale":i.arScale,"ar-placement":i.arPlacement,"ios-src":i.iosSrc,"touch-action":i.touchAction,"disable-zoom":i.disableZoom,"orbit-sensitivity":i.orbitSensitivity,"auto-rotate":i.autoRotate,"auto-rotate-delay":i.autoRotateDelay,"rotation-per-second":i.rotationPerSecond,"interaction-policy":i.interactionPolicy,"interaction-prompt":i.interactionPrompt,"interaction-prompt-style":i.interactionPromptStyle,"interaction-prompt-threshold":i.interactionPromptThreshold,"camera-orbit":i.cameraOrbit,"camera-target":i.cameraTarget,"field-of-view":i.fieldOfView,"max-camera-orbit":i.maxCameraOrbit,"min-camera-orbit":i.minCameraOrbit,"max-field-of-view":i.maxFieldOfView,"min-field-of-view":i.minFieldOfView,bounds:i.bounds,"interpolation-decay":i.interpolationDecay??100,"skybox-image":i.skyboxImage,"environment-image":i.environmentImage,exposure:i.exposure,"shadow-intensity":i.shadowIntensity??0,"shadow-softness":i.shadowSoftness??0,"animation-name":i.animationName,"animation-crossfade-duration":i.animationCrossfadeDuration,"variant-name":i.variantName,orientation:i.orientation,scale:i.scale},a):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}function hn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?c.createElement(dt,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return c.createElement(mt,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return c.createElement(lt,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return c.createElement(Ct,{...r,...t==null?void 0:t.modelViewer,data:e});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media. Rendering 'null' by default"),null}}function gn(e){if(!e.type)return console.error("parseMetafield(): The 'type' field is required in order to parse the Metafield. Returning 'parsedValue' of 'null'"),{...e,parsedValue:null};switch(e.type){case"boolean":return{...e,parsedValue:e.value==="true"};case"collection_reference":case"file_reference":case"page_reference":case"product_reference":case"variant_reference":return{...e,parsedValue:e.reference};case"color":case"multi_line_text_field":case"single_line_text_field":case"url":return{...e,parsedValue:e.value};case"dimension":case"money":case"json":case"rating":case"volume":case"weight":case"list.color":case"list.dimension":case"list.number_integer":case"list.number_decimal":case"list.rating":case"list.single_line_text_field":case"list.url":case"list.volume":case"list.weight":{let t=null;try{t=St(e.value??"")}catch{console.error("parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed. Returning 'null' for 'parsedValue'"),t=null}return{...e,parsedValue:t}}case"date":case"date_time":return{...e,parsedValue:new Date(e.value??"")};case"list.date":case"list.date_time":{const t=St((e==null?void 0:e.value)??"");return{...e,parsedValue:t.map(r=>new Date(r))}}case"number_decimal":case"number_integer":return{...e,parsedValue:Number(e.value)};case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:j(e.references??void 0)};default:{const t=`parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: "${e.type}". If you believe this is an error, please open an issue on GitHub.`;return console.error(`${t} Returning 'parsedValue' of 'null'`),{...e,parsedValue:null}}}}function St(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function mn(e){var d,l,h,m,p,f;const{priceType:t="regular",variantId:r,valueType:n="min",data:o,...a}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let s,i;const u=r?j((o==null?void 0:o.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&u){if(((d=u.compareAtPriceV2)==null?void 0:d.amount)===((l=u.priceV2)==null?void 0:l.amount))return null;s=u.compareAtPriceV2}else n==="max"?s=(h=o==null?void 0:o.compareAtPriceRange)==null?void 0:h.maxVariantPrice:s=(m=o==null?void 0:o.compareAtPriceRange)==null?void 0:m.minVariantPrice;else r&&u?(s=u.priceV2,n==="unit"&&(s=u.unitPrice,i=u.unitPriceMeasurement)):n==="max"?s=(p=o.priceRange)==null?void 0:p.maxVariantPrice:s=(f=o.priceRange)==null?void 0:f.minVariantPrice;return s?i?c.createElement(Se,{...a,data:s,measurement:i}):c.createElement(Se,{...a,data:s}):null}const pn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function En({variantIds:e,className:t,variantIdsAndQuantities:r,width:n,storeDomain:o}){const a=ae(),s=o||(a==null?void 0:a.storeDomain),i=Et(pn);let u=[];if(!s||s===je.storeDomain)throw new Error(Cn);if(e&&r)throw new Error(Tn);if(!e&&!r)throw new Error(Tt);if(e)u=e.reduce((l,h)=>{const m=H(h).id;return m&&l.push(m),l},[]);else if(r)u=r.reduce((l,h)=>{const m=H(h==null?void 0:h.id).id;return m&&l.push(`${m}:${(h==null?void 0:h.quantity)??1}`),l},[]);else throw new Error(Tt);if(u.length===0)throw new Error(Sn);const d=n?{"--shop-pay-button-width":n}:void 0;return c.createElement("div",{className:t,style:d},i==="done"&&c.createElement("shop-pay-button",{"store-url":s,variants:u.join(",")}))}const Cn='You must pass a "storeDomain" prop to the "ShopPayButton" component, or wrap it in a "ShopifyProvider" component.',Sn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',Tt='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',Tn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",_n=60*60*24*360*1,An=60*30;function vn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};c.useEffect(()=>{const n=pe(document.cookie);t?(Te(G,n[G]||me(),_n,r),Te(Z,n[Z]||me(),An,r)):(Te(G,"",0,r),Te(Z,"",0,r))})}function Te(e,t,r,n){document.cookie=Cr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}E.AddToCartButton=Nr,E.AnalyticsEventName=De,E.AnalyticsPageType=Ce,E.BuyNowButton=en,E.CartCheckoutButton=tn,E.CartCost=nn,E.CartLineProvider=on,E.CartLineQuantity=an,E.CartLineQuantityAdjustButton=sn,E.CartProvider=wr,E.ExternalVideo=lt,E.IMAGE_FRAGMENT=cn,E.Image=dt,E.MediaFile=hn,E.ModelViewer=Ct,E.Money=Se,E.ProductPrice=mn,E.ProductProvider=Ur,E.SHOPIFY_S=Z,E.SHOPIFY_STOREFRONT_ID_HEADER=Ze,E.SHOPIFY_STOREFRONT_S_HEADER=Qe,E.SHOPIFY_STOREFRONT_Y_HEADER=We,E.SHOPIFY_Y=G,E.ShopPayButton=En,E.ShopifyProvider=mr,E.ShopifySalesChannel=ot,E.Video=mt,E.createStorefrontClient=hr,E.flattenConnection=j,E.getClientBrowserParameters=Jr,E.getShopifyCookies=pe,E.parseGid=H,E.parseMetafield=gn,E.sendShopifyAnalytics=Wr,E.storefrontApiCustomScalars=un,E.useCart=te,E.useCartLine=ke,E.useMoney=ut,E.useProduct=et,E.useShop=ae,E.useShopifyCookies=vn,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
273
|
+
`,yt=V.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:o="async",height:i="auto",loader:s=le,loaderOptions:a,loading:c="lazy",sizes:d,src:l,srcSetOptions:h={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:m="100%",widths:p,...f},b)=>{const T=V.useMemo(()=>{const I=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,_=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:I,height:_,unitsMatch:!!ht(I,_)}},[n]),w=V.useMemo(()=>{const _=de((m||"100%").toString()),v=`${_.number}${_.unit}`,B=i==null,P=B?null:de(i.toString()),F=P?`${P.number}${P.unit}`:"",W=B?"auto":F,oe=l||(n==null?void 0:n.url),X=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",k=t||(T.unitsMatch?[fe(T.width),fe(T.height)].join("/"):void 0);return{width:v,height:W,src:oe,alt:X,aspectRatio:k}},[m,i,l,n,e,t,T,f==null?void 0:f.key]),{intervals:A,startingWidth:U,incrementSize:g,placeholderWidth:y}=h,C=V.useMemo(()=>hn(m,A,U,g),[m,A,U,g]);return gt(w.width)?V.createElement(fn,{aspectRatio:t,crop:r,decoding:o,height:i,imageWidths:C,loader:s,loading:c,normalizedProps:w,passthroughProps:f,ref:b,width:m}):V.createElement(yn,{aspectRatio:t,crop:r,decoding:o,imageWidths:C,loader:s,loading:c,normalizedProps:w,passthroughProps:f,placeholderWidth:y,ref:b,sizes:d})});function fn({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:o,loader:i=le,loading:s,normalizedProps:a,passthroughProps:c,ref:d,width:l}){const h=V.useMemo(()=>{const m=fe(l),p=fe(n),f=e||(ht(a.width,a.height)?[m,p].join("/"):a.aspectRatio?a.aspectRatio:void 0),b=o===void 0?void 0:pt(o,f,t),T=p||(f&&m?m*(Re(f)??1):void 0),w=mt(a.src,b,i),A=i({src:a.src,width:m,height:T,crop:a.height==="auto"?void 0:t});return{width:m,aspectRatio:f,height:T,srcSet:w,src:A}},[e,t,n,o,i,a,l]);return V.createElement("img",{ref:d,alt:a.alt,decoding:r,height:h.height,loading:s,src:h.src,srcSet:h.srcSet,width:h.width,style:{aspectRatio:h.aspectRatio,...c.style},...c})}function yn({crop:e,decoding:t,imageWidths:r,loader:n=le,loading:o,normalizedProps:i,passthroughProps:s,placeholderWidth:a,ref:c,sizes:d}){const l=V.useMemo(()=>{const h=r===void 0?void 0:pt(r,i.aspectRatio,e),m=i.aspectRatio&&a?a*(Re(i.aspectRatio)??1):void 0,p=mt(i.src,h,n),f=n({src:i.src,width:a,height:m,crop:e});return{placeholderHeight:m,srcSet:p,src:f}},[e,r,n,i,a]);return V.createElement("img",{ref:c,alt:i.alt,decoding:t,height:l.placeholderHeight,loading:o,sizes:d,src:l.src,srcSet:l.srcSet,width:a,...s,style:{width:i.width,aspectRatio:i.aspectRatio,...s.style}})}function le({src:e,width:t,height:r,crop:n}){if(!e)return"";const o=new URL(e);return t&&o.searchParams.append("width",Math.round(t).toString()),r&&o.searchParams.append("height",Math.round(r).toString()),n&&o.searchParams.append("crop",n),o.href}function ht(e="100%",t="auto"){return de(e.toString()).unit===de(t.toString()).unit}function de(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function fe(e){if(e===void 0)return;const{unit:t,number:r}=de(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function gt(e){return typeof e=="number"||typeof e=="string"&&/\d(px|em|rem)$/.test(e)}function mt(e,t,r=le){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,o)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${o+1}x`:`${n.width??0}w`}`).join(", "):""}function hn(e="100%",t,r,n){const o=Array.from({length:t},(s,a)=>a*n+r),i=Array.from({length:3},(s,a)=>(a+1)*(fe(e)??0));return gt(e)?i:o}function Re(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function pt(e,t,r="center"){return e?e.map(o=>({width:o,height:t?o*(Re(t)??1):void 0,crop:r})):void 0}const Et={};function gn(e,t){const r=Et[e];if(r)return r;const n=new Promise((o,i)=>{const s=document.createElement("script");t!=null&&t.module?s.type="module":s.type="text/javascript",s.src=e,s.onload=()=>{o(!0)},s.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(s):document.body.appendChild(s)});return Et[e]=n,n}function ke(e,t){const[r,n]=u.useState("loading"),o=JSON.stringify(t);return u.useEffect(()=>{async function i(){try{n("loading"),await gn(e,t),n("done")}catch{n("error")}}i().catch(()=>{n("error")})},[e,o,t]),r}function Ct(e){var d;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:o=!0,controls:i=!0,sourceProps:s={},...a}=e,c=le({src:((d=t.previewImage)==null?void 0:d.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return React.createElement("video",{...a,id:n,playsInline:o,controls:i,poster:c},t.sources.map(l=>{if(!(l!=null&&l.url&&(l!=null&&l.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return React.createElement("source",{...s,key:l.url,src:l.url,type:l.mimeType})}))}function St(e){var d,l,h;const[t,r]=u.useState(void 0),n=u.useCallback(m=>{r(m)},[]),{data:o,children:i,className:s,...a}=e,c=ke("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return u.useEffect(()=>{if(t)return a.onError&&t.addEventListener("error",a.onError),a.onLoad&&t.addEventListener("load",a.onLoad),a.onPreload&&t.addEventListener("preload",a.onPreload),a.onModelVisibility&&t.addEventListener("model-visibility",a.onModelVisibility),a.onProgress&&t.addEventListener("progress",a.onProgress),a.onArStatus&&t.addEventListener("ar-status",a.onArStatus),a.onArTracking&&t.addEventListener("ar-tracking",a.onArTracking),a.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",a.onQuickLookButtonTapped),a.onCameraChange&&t.addEventListener("camera-change",a.onCameraChange),a.onEnvironmentChange&&t.addEventListener("environment-change",a.onEnvironmentChange),a.onPlay&&t.addEventListener("play",a.onPlay),a.onPause&&t.addEventListener("ar-status",a.onPause),a.onSceneGraphReady&&t.addEventListener("scene-graph-ready",a.onSceneGraphReady),()=>{t!=null&&(a.onError&&t.removeEventListener("error",a.onError),a.onLoad&&t.removeEventListener("load",a.onLoad),a.onPreload&&t.removeEventListener("preload",a.onPreload),a.onModelVisibility&&t.removeEventListener("model-visibility",a.onModelVisibility),a.onProgress&&t.removeEventListener("progress",a.onProgress),a.onArStatus&&t.removeEventListener("ar-status",a.onArStatus),a.onArTracking&&t.removeEventListener("ar-tracking",a.onArTracking),a.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",a.onQuickLookButtonTapped),a.onCameraChange&&t.removeEventListener("camera-change",a.onCameraChange),a.onEnvironmentChange&&t.removeEventListener("environment-change",a.onEnvironmentChange),a.onPlay&&t.removeEventListener("play",a.onPlay),a.onPause&&t.removeEventListener("ar-status",a.onPause),a.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",a.onSceneGraphReady))}},[t,a.onArStatus,a.onArTracking,a.onCameraChange,a.onEnvironmentChange,a.onError,a.onLoad,a.onModelVisibility,a.onPause,a.onPlay,a.onPreload,a.onProgress,a.onQuickLookButtonTapped,a.onSceneGraphReady]),c!=="done"?null:(l=(d=o.sources)==null?void 0:d[0])!=null&&l.url?React.createElement("model-viewer",{ref:n,...a,class:s,id:a.id??o.id,src:o.sources[0].url,alt:o.alt??null,"camera-controls":a.cameraControls??!0,poster:(a.poster||((h=o.previewImage)==null?void 0:h.url))??null,autoplay:a.autoplay??!0,loading:a.loading,reveal:a.reveal,ar:a.ar,"ar-modes":a.arModes,"ar-scale":a.arScale,"ar-placement":a.arPlacement,"ios-src":a.iosSrc,"touch-action":a.touchAction,"disable-zoom":a.disableZoom,"orbit-sensitivity":a.orbitSensitivity,"auto-rotate":a.autoRotate,"auto-rotate-delay":a.autoRotateDelay,"rotation-per-second":a.rotationPerSecond,"interaction-policy":a.interactionPolicy,"interaction-prompt":a.interactionPrompt,"interaction-prompt-style":a.interactionPromptStyle,"interaction-prompt-threshold":a.interactionPromptThreshold,"camera-orbit":a.cameraOrbit,"camera-target":a.cameraTarget,"field-of-view":a.fieldOfView,"max-camera-orbit":a.maxCameraOrbit,"min-camera-orbit":a.minCameraOrbit,"max-field-of-view":a.maxFieldOfView,"min-field-of-view":a.minFieldOfView,bounds:a.bounds,"interpolation-decay":a.interpolationDecay??100,"skybox-image":a.skyboxImage,"environment-image":a.environmentImage,exposure:a.exposure,"shadow-intensity":a.shadowIntensity??0,"shadow-softness":a.shadowSoftness??0,"animation-name":a.animationName,"animation-crossfade-duration":a.animationCrossfadeDuration,"variant-name":a.variantName,orientation:a.orientation,scale:a.scale},i):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}function mn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?React.createElement(yt,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return React.createElement(Ct,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return React.createElement(ft,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return React.createElement(St,{...r,...t==null?void 0:t.modelViewer,data:e});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media. Rendering 'null' by default"),null}}function pn(e){if(!e.type)return console.error("parseMetafield(): The 'type' field is required in order to parse the Metafield. Returning 'parsedValue' of 'null'"),{...e,parsedValue:null};switch(e.type){case"boolean":return{...e,parsedValue:e.value==="true"};case"collection_reference":case"file_reference":case"page_reference":case"product_reference":case"variant_reference":return{...e,parsedValue:e.reference};case"color":case"multi_line_text_field":case"single_line_text_field":case"url":return{...e,parsedValue:e.value};case"dimension":case"money":case"json":case"rating":case"volume":case"weight":case"list.color":case"list.dimension":case"list.number_integer":case"list.number_decimal":case"list.rating":case"list.single_line_text_field":case"list.url":case"list.volume":case"list.weight":{let t=null;try{t=Tt(e.value??"")}catch{console.error("parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed. Returning 'null' for 'parsedValue'"),t=null}return{...e,parsedValue:t}}case"date":case"date_time":return{...e,parsedValue:new Date(e.value??"")};case"list.date":case"list.date_time":{const t=Tt((e==null?void 0:e.value)??"");return{...e,parsedValue:t.map(r=>new Date(r))}}case"number_decimal":case"number_integer":return{...e,parsedValue:Number(e.value)};case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:j(e.references??void 0)};default:{const t=`parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: "${e.type}". If you believe this is an error, please open an issue on GitHub.`;return console.error(`${t} Returning 'parsedValue' of 'null'`),{...e,parsedValue:null}}}}function Tt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function En(e){var d,l,h,m,p,f;const{priceType:t="regular",variantId:r,valueType:n="min",data:o,...i}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let s,a;const c=r?j((o==null?void 0:o.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&c){if(((d=c.compareAtPriceV2)==null?void 0:d.amount)===((l=c.priceV2)==null?void 0:l.amount))return null;s=c.compareAtPriceV2}else n==="max"?s=(h=o==null?void 0:o.compareAtPriceRange)==null?void 0:h.maxVariantPrice:s=(m=o==null?void 0:o.compareAtPriceRange)==null?void 0:m.minVariantPrice;else r&&c?(s=c.priceV2,n==="unit"&&(s=c.unitPrice,a=c.unitPriceMeasurement)):n==="max"?s=(p=o.priceRange)==null?void 0:p.maxVariantPrice:s=(f=o.priceRange)==null?void 0:f.minVariantPrice;return s?a?React.createElement(Se,{...i,data:s,measurement:a}):React.createElement(Se,{...i,data:s}):null}const Cn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function Sn({variantIds:e,className:t,variantIdsAndQuantities:r,width:n,storeDomain:o}){const i=ie(),s=o||(i==null?void 0:i.storeDomain),a=ke(Cn);let c=[];if(!s||s===Ze.storeDomain)throw new Error(Tn);if(e&&r)throw new Error(An);if(!e&&!r)throw new Error(_t);if(e)c=e.reduce((l,h)=>{const m=$(h).id;return m&&l.push(m),l},[]);else if(r)c=r.reduce((l,h)=>{const m=$(h==null?void 0:h.id).id;return m&&l.push(`${m}:${(h==null?void 0:h.quantity)??1}`),l},[]);else throw new Error(_t);if(c.length===0)throw new Error(_n);const d=n?{"--shop-pay-button-width":n}:void 0;return React.createElement("div",{className:t,style:d},a==="done"&&React.createElement("shop-pay-button",{"store-url":s,variants:c.join(",")}))}const Tn='You must pass a "storeDomain" prop to the "ShopPayButton" component, or wrap it in a "ShopifyProvider" component.',_n='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',_t='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',An="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",vn=60*60*24*360*1,bn=60*30;function wn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};u.useEffect(()=>{const n=pe(document.cookie);t?(Te(G,n[G]||me(),vn,r),Te(Z,n[Z]||me(),bn,r)):(Te(G,"",0,r),Te(Z,"",0,r))})}function Te(e,t,r,n){document.cookie=Tr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}E.AddToCartButton=Vr,E.AnalyticsEventName=Pe,E.AnalyticsPageType=Ce,E.BuyNowButton=rn,E.CartCheckoutButton=nn,E.CartCost=an,E.CartLineProvider=sn,E.CartLineQuantity=cn,E.CartLineQuantityAdjustButton=un,E.CartProvider=Dr,E.ExternalVideo=ft,E.IMAGE_FRAGMENT=dn,E.Image=yt,E.MediaFile=mn,E.ModelViewer=St,E.Money=Se,E.ProductPrice=En,E.ProductProvider=Or,E.SHOPIFY_S=Z,E.SHOPIFY_STOREFRONT_ID_HEADER=Qe,E.SHOPIFY_STOREFRONT_S_HEADER=Xe,E.SHOPIFY_STOREFRONT_Y_HEADER=Je,E.SHOPIFY_Y=G,E.ShopPayButton=Sn,E.ShopifyProvider=Er,E.ShopifySalesChannel=it,E.Video=Ct,E.createStorefrontClient=gr,E.flattenConnection=j,E.getClientBrowserParameters=Kr,E.getShopifyCookies=pe,E.parseGid=$,E.parseMetafield=pn,E.sendShopifyAnalytics=Jr,E.storefrontApiCustomScalars=ln,E.useCart=te,E.useCartLine=De,E.useLoadScript=ke,E.useMoney=lt,E.useProduct=rt,E.useShop=ie,E.useShopifyCookies=wn,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
271
274
|
//# sourceMappingURL=hydrogen-react.prod.js.map
|