efficient-storefront-blocks 0.99.1 → 0.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/dist/chunks/{EditorPreviewCheckout-EBG3NMJI.js → EditorPreviewCheckout-OLTXWUGM.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-YAIB64UV.js → SiteEditorProvider-4XV2T5MD.js} +1 -1
  4. package/dist/chunks/{chunk-DOJJTEJV.js → chunk-4SYZK3TW.js} +1 -1
  5. package/dist/chunks/chunk-G6OVBAOA.js +74 -0
  6. package/dist/chunks/chunk-OWUMH5VC.js +339 -0
  7. package/dist/chunks/chunk-SCTOV5CT.js +1 -0
  8. package/dist/chunks/{chunk-5VSNQZU6.js → chunk-WN7SFD3N.js} +1 -1
  9. package/dist/chunks/{fitment-data-PXY35OVC.js → fitment-data-ZWKG2FFA.js} +1 -1
  10. package/dist/contract.js +1 -1
  11. package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
  12. package/dist/editor/lib/document/blocks/commerce/DetailRows/fields.js +1 -1
  13. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  14. package/dist/editor/lib/document/blocks/service/FooterLogo/fields.js +1 -1
  15. package/dist/editor/lib/document/config.js +1 -1
  16. package/dist/editor/lib/storefront-editor-words.d.ts +3 -0
  17. package/dist/editor/lib/storefront-editor-words.js +1 -1
  18. package/dist/editor.css +1 -1
  19. package/dist/index.js +33 -31
  20. package/dist/render/built-with.json +1 -1
  21. package/dist/render/components/DetailRows.d.ts +2 -3
  22. package/dist/render/components/DetailRows.js +1 -1
  23. package/dist/render/components/Events.d.ts +2 -3
  24. package/dist/render/components/Events.js +1 -1
  25. package/dist/render/components/GalleryGrid.d.ts +2 -3
  26. package/dist/render/components/GalleryGrid.js +3 -3
  27. package/dist/render/components/GridCardTemplate.js +1 -1
  28. package/dist/render/components/ProductGridSection.d.ts +3 -2
  29. package/dist/render/components/ProductGridSection.js +1 -1
  30. package/dist/render/components/catalog/ShopperFilters.d.ts +3 -1
  31. package/dist/render/components/catalog/ShopperFilters.js +1 -1
  32. package/dist/render/components/pdp-dynamic/DynamicDetailRows.d.ts +1 -2
  33. package/dist/render/components/pdp-dynamic/DynamicDetailRows.js +1 -1
  34. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +1 -2
  35. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
  36. package/dist/render/components/useProductSelection.d.ts +2 -1
  37. package/dist/render/components/useProductSelection.js +1 -1
  38. package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +4 -2
  39. package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
  40. package/dist/render/components/wheels-plp/PlpFacetRows.d.ts +5 -2
  41. package/dist/render/components/wheels-plp/PlpFacetRows.js +1 -1
  42. package/dist/render/components/wheels-plp/PlpSidebar.d.ts +17 -6
  43. package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
  44. package/dist/render/lib/api/types.d.ts +2 -0
  45. package/dist/render/lib/catalog/default-variant.d.ts +2 -0
  46. package/dist/render/lib/catalog/default-variant.js +1 -0
  47. package/dist/render/lib/content/facet-row-seed.d.ts +1 -0
  48. package/dist/render/lib/content/facet-row-seed.js +1 -1
  49. package/dist/render/lib/content/rail-row-seed.d.ts +16 -0
  50. package/dist/render/lib/content/rail-row-seed.js +1 -0
  51. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.d.ts +8 -0
  52. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.js +1 -1
  53. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
  54. package/dist/render/lib/document/blocks/commerce/DetailRows/meta.js +1 -1
  55. package/dist/render/lib/document/blocks/commerce/DetailRows/render.js +1 -1
  56. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +8 -0
  57. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -1
  58. package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -1
  59. package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
  60. package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
  61. package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
  62. package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
  63. package/dist/render/lib/document/blocks/service/DealerFinder/meta.js +1 -1
  64. package/dist/render/lib/document/blocks/service/Events/meta.js +1 -1
  65. package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
  66. package/dist/render/lib/document/card-templates.js +1 -1
  67. package/dist/render/lib/document/current-product.d.ts +2 -1
  68. package/dist/render/lib/document/current-product.js +1 -1
  69. package/dist/render/lib/document/lazy-draws.js +1 -1
  70. package/dist/render/lib/document/section-to-box-rows-listing.js +1 -1
  71. package/dist/render/lib/sections/band-padding.d.ts +23 -0
  72. package/dist/render/lib/sections/band-padding.js +1 -0
  73. package/dist/words.d.ts +12 -0
  74. package/dist/words.js +4 -4
  75. package/package.json +2 -2
  76. package/dist/chunks/chunk-B2IYTOE3.js +0 -1
  77. package/dist/chunks/chunk-KRMWJLBM.js +0 -412
  78. package/dist/chunks/chunk-QP2F42DV.js +0 -1
  79. package/dist/render/lib/sections/own-padding.d.ts +0 -3
  80. package/dist/render/lib/sections/own-padding.js +0 -1
  81. /package/dist/chunks/{chunk-KRMWJLBM.js.LEGAL.txt → chunk-OWUMH5VC.js.LEGAL.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,14 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.100.0 - 2026-11-12
4
+
5
+ **A major for hosts (major version zero, so a minor number):** the web-builder peer moves to `^67.7.0` (was `^67.4.0`) (#500). The module `render/lib/sections/own-padding` is deleted, and the `padTop` / `padBottom` props of `DetailRows`, `Events`, `GalleryGrid` and `ProductGridSection` become `pads` (#500). `facetTemplate`, `railTemplate` and `railHeadTemplate` are required on `AlloyWheelsListing`, on the `ShopperFilters` owner and on `RailOwner` (#516). From main at `bb1291ff`: #500, #513, #515, #516, #517, #518, #519.
6
+
7
+ **For hosts:**
8
+ - Install web-builder 67.7.0 or later with this release (#500); the blocks' lockfile names 67.8.1 (#519), which the storefront installs. Easel `^34.1.0` and shell `^12.33.0` stay.
9
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. In the same bump:
10
+ - `package.json`: efficient-web-builder `67.8.1`; `packages/storefront-blocks/vendored.json` and `packages/storefront-blocks/package.json` peers to match.
11
+ - The four scripts that draw the rail or the listing alone (`scripts/test-plp-rail-scrolls.tsx`, `scripts/harness/plp-rail-scroll.tsx`, `scripts/harness/tyre-size-rail.tsx`, `scripts/test-editor-currency.tsx`) hand `railTemplate` and `railHeadTemplate` too, built from the vendored seed (`lib/content/rail-row-seed`) (#516).
12
+ - Pass `defaultVariant` from the wheel and tyre detail reads to `CurrentProductProvider` / `useProductSelection` (#517; done in efficient-storefront#1967).
13
+ - A host catalogue typed from the blocks phrases adds "Dealer Locations", "Filter group template" and "Filter head template", and the web-builder 67.8 words (#516, #518, #519).
14
+ - admin-portal: no new step beyond the web-builder 67.7 range.
15
+ - No stored page moves: the band padding keys and the rail templates are read on read; 0 live nodes carry the retired outer padding keys (#500).
16
+
17
+ - **BREAKING: peer `efficient-web-builder` `^67.7.0`** (#500). Peer and dev, here and in `package/`.
18
+ - **BREAKING: sections draw the one band Padding row** (#500). Feature Rows, Product Grid, Latest Posts and Customer Photo Grid declare their band padding default and draw it through the builder's `bandPadAttrs` (new `render/lib/sections/band-padding`); their own padding rows go, and Footer Logo takes the shared four-side Padding row. A value under the retired outer keys now draws on the band as frame + value with no wrapper, and Product Grid draws a stored bottom. `render/lib/sections/own-padding` is deleted.
19
+ - **BREAKING: the filter side rail draws its head and group folds on Box templates** (#516). New slots `railTemplate` and `railHeadTemplate` (seed in `render/lib/content/rail-row-seed`), required with `facetTemplate`; the fold mark is the shell's chevron. `HostPart` is registered in the editor.
20
+ - **Product pages can open on the merchant's variant** (#517): `useProductSelection(product, { defaultVariant })` and `CurrentProductProvider`'s `defaultVariant` start the selection on that variant's picks. New module `render/lib/catalog/default-variant` (`picksForVariant`); `defaultVariant?: number | null` on the Wheel and Tyre API types. For SG#02503.
21
+ - **The Find a dealer section is named "Dealer Locations" in the editor** (#518). Its type, props and default heading are unchanged.
22
+ - Internal (no change to the published package): web-builder 67.8.1 in the lockfile (#519); the verify job's timeout is 45 minutes (#513); the 0.99.1 section names #504 (#515).
23
+
3
24
  ## 0.99.1 - 2026-11-12
4
25
 
5
- **A patch for hosts:** no peer, path or word changes; nothing is removed from the published types. From main at `aee239da`: #509, #510, #512.
26
+ **A patch for hosts:** no peer or path changes, one editor word added; nothing is removed from the published types. From main at `d4f12e3b`: #504, #509, #510, #512. (#504 merged while the release PR was open; it was first left out of this list.)
6
27
 
7
28
  **For hosts:**
8
29
  - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. No other step.
9
30
  - admin-portal: no new step.
31
+ - A host catalogue typed from the blocks phrases adds "Find a dealer" (#504).
10
32
  - No stored page moves.
11
33
 
34
+ - **A "Find a dealer" section** (#504): shoppers type a postcode or suburb and see the website's dealers nearest first (`GET /api/v1/dealers`). New block `DealerFinder`, new exports `dealersPath` and `fetchDealers` (`render/lib/api`), new module `render/lib/sections/dealer-finder`.
12
35
  - **A placed order's details lock while its payment is tried again** (#512). Once an order has a number and its payment did not start, the contact, address, delivery and discount controls are disabled under a note to contact the shop; the payment method stays open. A held pay-first checkout is unchanged. New export `placedOrderLockNote` (checkout-state); `CouponField` takes an optional `disabled`.
13
36
  - **Catalogue prices say whether tax is included** (#510): "incl. GST", "+ VAT", "+ Sales Tax, calculated at checkout", or nothing, from the shopper's selected country, on product cards and the product page price. New modules `render/lib/catalog/tax-note` and `render/components/card-pieces/useTaxNote`.
14
37
  - **The site's "share button on posts" switch is in the API types** (#509): `shareButtonOnPosts` on the site theme settings. The storefront draws the button.
@@ -1,4 +1,4 @@
1
- "use client";import{$ as hr,N as lr,O as ur,P as dr,Q as pr,R as mr,S as ye,U as dt,V as fr,W as gr,X as St,Y as yr,_ as Vt,aa as br,b as ir,c as Jt,d as sr,e as cr,fa as vr,ga as Oe,ia as xr,na as kr,oa as Qe,ra as Xt,ta as oe,ua as Et,y as Nt}from"./chunk-5VSNQZU6.js";import{A as W,n as de,t as Ze}from"./chunk-DOJJTEJV.js";import{he as rr,je as ge,ne as ar}from"./chunk-B2IYTOE3.js";import{m as or,n as ut,o as ue}from"./chunk-QP2F42DV.js";import{a as Gt,b as ho}from"./chunk-Y6SLVHK3.js";var Pr=Gt((Oi,wr)=>{"use strict";var vo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";wr.exports=vo});var Rr=Gt((Ai,Er)=>{"use strict";var xo=Pr();function Nr(){}function Sr(){}Sr.resetWarningCache=Nr;Er.exports=function(){function e(r,o,s,l,f,g){if(g!==xo){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Sr,resetWarningCache:Nr};return n.PropTypes=n,n}});var Ar=Gt((Li,Or)=>{"use strict";Or.exports=Rr()();var Ii,Ti});import{useEffect as ja,useMemo as Fa,useRef as nt,useState as $e}from"react";import{rootIsDark as bo}from"efficient-shell/format";function Cr(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,o)=>e.getPropertyValue(r).trim()||o,n=bo({whenUnset:!0});return{theme:n?"night":"stripe",variables:{colorPrimary:t("--accent",n?"#c9a461":"#8a6a2a"),colorBackground:t("--site-surface",n?"#131313":"#ffffff"),colorText:t("--fg",n?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}}var _=ho(Ar(),1);import T from"react";function Ir(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ko(e){if(Array.isArray(e))return e}function qr(e,t,n){return(t=Eo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Co(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,l,f=[],g=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(g=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);g=!0);}catch(y){d=!0,o=y}finally{try{if(!g&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw o}}return f}}function wo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ "use client";import{$ as hr,N as lr,O as ur,P as dr,Q as pr,R as mr,S as ye,U as dt,V as fr,W as gr,X as St,Y as yr,_ as Vt,aa as br,b as ir,c as Jt,d as sr,e as cr,fa as vr,ga as Oe,ia as xr,na as kr,oa as Qe,ra as Xt,ta as oe,ua as Et,y as Nt}from"./chunk-WN7SFD3N.js";import{A as W,n as de,t as Ze}from"./chunk-4SYZK3TW.js";import{$h as rr,bi as ge,fi as ar}from"./chunk-G6OVBAOA.js";import{n as or,o as ut,p as ue}from"./chunk-SCTOV5CT.js";import{a as Gt,b as ho}from"./chunk-Y6SLVHK3.js";var Pr=Gt((Oi,wr)=>{"use strict";var vo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";wr.exports=vo});var Rr=Gt((Ai,Er)=>{"use strict";var xo=Pr();function Nr(){}function Sr(){}Sr.resetWarningCache=Nr;Er.exports=function(){function e(r,o,s,l,f,g){if(g!==xo){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Sr,resetWarningCache:Nr};return n.PropTypes=n,n}});var Ar=Gt((Li,Or)=>{"use strict";Or.exports=Rr()();var Ii,Ti});import{useEffect as ja,useMemo as Fa,useRef as nt,useState as $e}from"react";import{rootIsDark as bo}from"efficient-shell/format";function Cr(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,o)=>e.getPropertyValue(r).trim()||o,n=bo({whenUnset:!0});return{theme:n?"night":"stripe",variables:{colorPrimary:t("--accent",n?"#c9a461":"#8a6a2a"),colorBackground:t("--site-surface",n?"#131313":"#ffffff"),colorText:t("--fg",n?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}}var _=ho(Ar(),1);import T from"react";function Ir(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ko(e){if(Array.isArray(e))return e}function qr(e,t,n){return(t=Eo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Co(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,l,f=[],g=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(g=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);g=!0);}catch(y){d=!0,o=y}finally{try{if(!g&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw o}}return f}}function wo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Lr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tr(Object(n),!0).forEach(function(r){qr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Po(e,t){if(e==null)return{};var n,r,o=No(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function No(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Mr(e,t){return ko(e)||Co(e,t)||Ro(e,t)||wo()}function So(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Eo(e){var t=So(e,"string");return typeof t=="symbol"?t:t+""}function Zt(e){"@babel/helpers - typeof";return Zt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zt(e)}function Ro(e,t){if(e){if(typeof e=="string")return Ir(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(e,t):void 0}}var G=function(t,n,r){var o=!!r,s=T.useRef(r);T.useEffect(function(){s.current=r},[r]),T.useEffect(function(){if(!o||!t)return function(){};var l=function(){if(s.current)return s.current.apply(s,arguments)};return t.on(n,l),function(){t.off(n,l)}},[o,n,t,s])},Qt=function(t){var n=T.useRef(t);return T.useEffect(function(){n.current=t},[t]),n.current},et=function(t){return t!==null&&Zt(t)==="object"},Oo=function(t){return et(t)&&typeof t.then=="function"},Ao=function(t){return et(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},_r="[object Object]",Io=function e(t,n){if(t===n)return!0;if(!et(t)||!et(n))return t===n;var r=Array.isArray(t),o=Array.isArray(n);if(r!==o)return!1;var s=Object.prototype.toString.call(t)===_r,l=Object.prototype.toString.call(n)===_r;if(s!==l)return!1;if(!s&&!r)return t===n;var f=Object.keys(t),g=Object.keys(n);if(f.length!==g.length)return!1;for(var d={},y=0;y<f.length;y+=1)d[f[y]]=!0;for(var N=0;N<g.length;N+=1)d[g[N]]=!0;var b=Object.keys(d);if(b.length!==f.length)return!1;var m=t,v=n,E=function(Z){return e(m[Z],v[Z])};return b.every(E)},Dr=function(t,n,r){return et(t)?Object.keys(t).reduce(function(o,s){var l=!et(n)||!Io(t[s],n[s]);return r.includes(s)?(l&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),o):l?Lr(Lr({},o||{}),{},qr({},s,t[s])):o},null):null},jr="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Fr=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jr;if(t===null||Ao(t))return t;throw new Error(n)},To=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jr;if(Oo(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(o){return Fr(o,n)})};var r=Fr(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Lo=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"6.12.0"}),t.registerAppInfo({name:"react-stripe-js",version:"6.12.0",url:"https://stripe.com/docs/stripe-js/react"}))},Rt=T.createContext(null);Rt.displayName="ElementsContext";var Kr=function(t,n){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return t},tn=function(t){var n=t.stripe,r=t.options,o=t.children,s=T.useMemo(function(){return To(n)},[n]),l=T.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(r):null}}),f=Mr(l,2),g=f[0],d=f[1];T.useEffect(function(){var b=!0,m=function(E){d(function(A){return A.stripe?A:{stripe:E,elements:E.elements(r)}})};return s.tag==="async"&&!g.stripe?s.stripePromise.then(function(v){v&&b&&m(v)}):s.tag==="sync"&&!g.stripe&&m(s.stripe),function(){b=!1}},[s,g,r]);var y=Qt(n);T.useEffect(function(){y!==null&&y!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[y,n]);var N=Qt(r);return T.useEffect(function(){if(g.elements){var b=Dr(r,N,["clientSecret","fonts"]);b&&g.elements.update(b)}},[r,N,g.elements]),T.useEffect(function(){Lo(g.stripe)},[g.stripe]),T.createElement(Rt.Provider,{value:g},o)};tn.propTypes={stripe:_.default.any,options:_.default.object};var Ur=function(t){var n=T.useContext(Rt);return Kr(n,t)},Wr=function(){var t=Ur("calls useElements()"),n=t.elements;return n},_o=function(t){var n=t.children,r=Ur("mounts <ElementsConsumer>");return n(r)};_o.propTypes={children:_.default.func.isRequired};var Fo=T.createContext(null);Fo.displayName="CheckoutContext";var $r=T.createContext(null);$r.displayName="CheckoutSdkContext";var en=function(t){var n=T.useContext($r),r=T.useContext(Rt);if(n){if(r)throw new Error("You cannot wrap the part of your app that ".concat(t," in both a checkout provider and <Elements> provider."));return n}else return Kr(r,t)},qo=["mode"],Mo=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},F=function(t,n,r){var o="".concat(Mo(t),"Element"),s=function(d){var y=d.id,N=d.className,b=d.options,m=b===void 0?{}:b,v=d.onBlur,E=d.onFocus,A=d.onReady,Z=d.onChange,O=d.onEscape,C=d.onClick,Y=d.onLoadError,Q=d.onLoaderStart,M=d.onNetworksChange,ie=d.onConfirm,he=d.onCancel,Le=d.onShippingAddressChange,me=d.onShippingRateChange,z=d.onSavedPaymentMethodRemove,le=d.onSavedPaymentMethodUpdate,I=d.onAvailablePaymentMethodsChange,H=en("mounts <".concat(o,">")),$="elements"in H?H.elements:null,k="checkoutSdk"in H?H.checkoutSdk:null,rt=T.useState(null),Ye=Mr(rt,2),K=Ye[0],Be=Ye[1],ee=T.useRef(null),_e=T.useRef(null);G(K,"blur",v),G(K,"focus",E),G(K,"escape",O),G(K,"click",C),G(K,"loaderror",Y),G(K,"loaderstart",Q),G(K,"networkschange",M),G(K,"confirm",ie),G(K,"cancel",he),G(K,"shippingaddresschange",Le),G(K,"shippingratechange",me),G(K,"savedpaymentmethodremove",z),G(K,"savedpaymentmethodupdate",le),G(K,"availablepaymentmethodschange",I),G(K,"change",Z);var Pe;A&&(t==="expressCheckout"?Pe=A:Pe=function(){A(K)}),G(K,"ready",Pe),T.useLayoutEffect(function(){if(ee.current===null&&_e.current!==null&&($||k)){var L=null;if(k){var V=k,ze=k;switch(t){case"paymentForm":L=ze.createForm(m);break;case"payment":L=V.createPaymentElement(m);break;case"address":if("mode"in m){var Ne=m.mode,Fe=Po(m,qo);if(Ne==="shipping")L=V.createShippingAddressElement(Fe);else if(Ne==="billing")L=V.createBillingAddressElement(Fe);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":L=V.createExpressCheckoutElement(m);break;case"currencySelector":L=k.createCurrencySelectorElement();break;case"taxId":L=V.createTaxIdElement(m);break;case"contactDetails":L=V.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in k)L=k.createLinkSignupElement(m);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":L=V.createTermsElement(m);break;default:throw new Error("<".concat(o,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else $&&(L=$.create(t,m));ee.current=L,Be(L),L&&L.mount(_e.current)}},[$,k,m]);var be=Qt(m);return T.useEffect(function(){if(ee.current){var L=Dr(m,be,["paymentRequest"]);L&&"update"in ee.current&&ee.current.update(L)}},[m,be]),T.useLayoutEffect(function(){return function(){if(ee.current&&typeof ee.current.destroy=="function")try{ee.current.destroy(),ee.current=null}catch{}}},[]),T.createElement("div",{id:y,className:N,ref:_e})},l=function(d){en("mounts <".concat(o,">"));var y=d.id,N=d.className;return T.createElement("div",{id:y,className:N})},f=n?l:s;return f.propTypes={id:_.default.string,className:_.default.string,onChange:_.default.func,onBlur:_.default.func,onFocus:_.default.func,onReady:_.default.func,onEscape:_.default.func,onClick:_.default.func,onLoadError:_.default.func,onLoaderStart:_.default.func,onNetworksChange:_.default.func,onConfirm:_.default.func,onCancel:_.default.func,onShippingAddressChange:_.default.func,onShippingRateChange:_.default.func,onSavedPaymentMethodRemove:_.default.func,onSavedPaymentMethodUpdate:_.default.func,onAvailablePaymentMethodsChange:_.default.func,options:_.default.object},f.displayName=o,f.__elementType=t,f},q=typeof window>"u",Do=T.createContext(null);Do.displayName="EmbeddedCheckoutProviderContext";var Yr=function(){var t=en("calls useStripe()"),n=t.stripe;return n},Fi=F("auBankAccount",q),qi=F("card",q),Mi=F("cardNumber",q),Di=F("cardExpiry",q),ji=F("cardCvc",q),Ki=F("currencySelector",q),Ui=F("iban",q),Br=F("payment",q),Wi=F("expressCheckout",q),$i=F("paymentRequestButton",q),Yi=F("linkAuthentication",q),Bi=F("linkSignup",q),zi=F("contactDetails",q),Hi=F("address",q),Gi=F("shippingAddress",q),Ji=F("paymentMethodMessaging",q),Vi=F("taxId",q),Xi=F("issuingCardNumberDisplay",q),Zi=F("issuingCardCvcDisplay",q),Qi=F("issuingCardExpiryDisplay",q),es=F("issuingCardPinDisplay",q),ts=F("issuingCardCopyButton",q),ns=F("terms",q);function It(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?It=function(t){return typeof t}:It=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(e)}var Gr="dahlia",jo=function(t){return t===3?"v3":t},Jr="https://js.stripe.com",Ko="".concat(Jr,"/").concat(Gr,"/stripe.js"),Uo=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Wo=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,zr="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",$o=function(t){return Uo.test(t)||Wo.test(t)},Yo=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Jr,'"]')),n=0;n<t.length;n++){var r=t[n];if($o(r.src))return r}return null},Hr=function(t){var n=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(Ko).concat(n);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(r),r},Bo=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},pt=null,Ot=null,At=null,zo=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},Ho=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},Go=function(t){return pt!==null?pt:(pt=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(zr),window.Stripe){n(window.Stripe);return}try{var o=Yo();if(o&&t)console.warn(zr);else if(!o)o=Hr(t);else if(o&&At!==null&&Ot!==null){var s;o.removeEventListener("load",At),o.removeEventListener("error",Ot),(s=o.parentNode)===null||s===void 0||s.removeChild(o),o=Hr(t)}At=Ho(n,r),Ot=zo(r),o.addEventListener("load",At),o.addEventListener("error",Ot)}catch(l){r(l);return}}),pt.catch(function(n){return pt=null,Promise.reject(n)}))},Jo=function(t,n,r){if(t===null)return null;var o=n[0];if(typeof o!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(It(o)," instead."));var s=o.match(/^pk_test/),l=jo(t.version),f=Gr;s&&l!==f&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(f,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var g=t.apply(void 0,n);return Bo(g,r),g},mt,Vr=!1,Xr=function(){return mt||(mt=Go(null).catch(function(t){return mt=null,Promise.reject(t)}),mt)};Promise.resolve().then(function(){return Xr()}).catch(function(e){Vr||console.warn(e)});var Tt=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Vr=!0;var o=Date.now();return Xr().then(function(s){return Jo(s,n,o)})};var nn=2;function Zr(e){return e==="card"}var Vo="checkout_unavailable",Xo="checkout_waiting",Qr="committed",Ae="We could not check your payment. Please try again.",rn="Your last change was not saved. This is your order as placed.",ea="Your bank is still waiting for you to approve this payment, so your order stays as it was. Finish the approval, or try again in a few minutes.",ta=1e4;async function na(e,t=ta){let n,r=new Promise(s=>{n=setTimeout(()=>s(void 0),t)}),o=(async()=>{try{return(await(await Tt(e.publishableKey))?.retrievePaymentIntent(e.clientSecret))?.paymentIntent?.status}catch{return}})();try{return await Promise.race([o,r])}finally{clearTimeout(n)}}var ra=new Set(["none","requires_payment_method","canceled"]);async function an(e,t=ta){let n,r=new Promise(o=>{n=setTimeout(()=>o(void 0),t)});try{return await Promise.race([W.releaseCheckout({idempotencyKey:e}).then(o=>o.status,()=>{}),r])}finally{clearTimeout(n)}}function aa(e,t){return e instanceof de&&typeof e.data=="object"&&e.data!==null&&e.data.code===t}function Lt(e){return aa(e,Vo)}function on(e){return aa(e,Xo)}function sn(e){return e instanceof de&&e.status>=400&&e.status<500&&e.status!==408}function oa(e){return JSON.stringify([e.email,e.firstName,e.lastName,e.phone,e.address,e.city,e.subdivision,e.postcode,e.country,e.lines,e.shippingMethodId,e.couponCode,e.currency,e.shopperId,e.company])}function _t(e){return e.orderNumber||e.checkoutNumber}function Zo(e){return e.orderNumber?{kind:"placed",order:e}:{kind:e.status==="released"?"refunded":e.status==="expired"?"expired":"pending",checkoutNumber:e.checkoutNumber}}async function ia({checkoutNumber:e,resend:t,page:n}){n.setConfirming(!0);let r;try{r=Zo(await t())}catch{r={kind:"pending",checkoutNumber:e}}r.kind==="placed"?(n.markPaid(),n.track(r.order),n.land(r.order)):n.unplaced({...r,checkoutNumber:r.checkoutNumber||e}),n.setConfirming(!1)}import{createContext as ci,useContext as li,useEffect as X,useMemo as ba,useRef as J,useState as w}from"react";var Qo="sf:gclid",ei="sf:fbclid",ti=2160*60*60*1e3;function la(){return typeof window<"u"}function sa(e){let t=ut.getItem(e);if(!t)return"";try{let{v:n,t:r}=JSON.parse(t);return!n||typeof r!="number"||Date.now()-r>ti?"":n}catch{return""}}function ca(e){if(!la())return"";let t=e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function ua(){if(!la())return{};let e=sa(Qo),t=sa(ei),n=ca("_fbp"),r=ca("_fbc");!r&&t&&(r=`fb.1.${Date.now()}.${t}`);let o={};return e&&(o.gclid=e),t&&(o.fbclid=t),n&&(o.fbp=n),r&&(o.fbc=r),o}var da="sf:meta-purchases",ni=20;function ma(){return typeof window>"u"||window.parent!==window}function ri(...e){try{if(ma()||typeof window.fbq!="function")return;window.fbq(...e)}catch{}}var pa=new Set;function ai(e){if(pa.has(e))return!1;pa.add(e);try{let t=JSON.parse(ut.getItem(da)??"[]");if(t.includes(e))return!1;ut.setItem(da,JSON.stringify([...t,e].slice(-ni)))}catch{}return!0}function oi(e){return[...new Set(e.filter(dt).flatMap(t=>t.components.map(n=>n.partNumber)))]}function fa(e){let t=e.confirmation;ma()||!ai(t.orderNumber)||ri("track","Purchase",{value:Number(t.grandTotal),currency:t.currency,content_type:"product",content_ids:oi(e.lines)},{eventID:t.orderNumber})}var cn="checkout-afterpay-context",Ft="checkout-gocardless-context",ln="checkout-zip-context",qt="checkout-klarna-context";function ii({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function si(e,t){let n=e.getItem(t);if(e.removeItem(t),!n)return null;try{return JSON.parse(n)}catch{return null}}var ga={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:cn,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},ya={name:"Zip",legParam:"zip",legValues:["return"],storageKey:ln,evidenceFrom(e){let t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})};async function un(e,t){let n=new URLSearchParams(t.search),r=n.get(e.legParam);if(!r||!e.legValues.includes(r))return;let o=si(t.storage,e.storageKey),s=e.evidenceFrom(n,r);t.scrubQuery();let l=ii({evidence:s,parked:o});if(l.action!=="ignore"){if(t.page.clearCart(),l.action==="settle"){t.page.note(`The ${e.name} payment was not completed \u2014 our team will follow up on payment.`),t.page.land(l.parked.confirmation);return}t.page.setConfirming(!0);try{let f=await t.capture(e.requestFrom(l.evidence));f.status==="paid"?t.page.markPaid():t.page.note(`${e.name} declined the payment \u2014 our team will follow up on payment.`),t.page.land(l.parked?.confirmation??f)}catch{l.parked?(t.page.note(`We could not confirm the ${e.name} payment \u2014 our team will follow up on payment.`),t.page.land(l.parked.confirmation)):t.page.fail(`We could not confirm your ${e.name} payment. Please contact us before trying again \u2014 your payment may already have been taken.`)}finally{t.page.setConfirming(!1)}}}function ha(e,t,n){let r=(t??"").trim();if(!r)return"";if(n.length===0)return r;let o=r.toUpperCase(),s=`${e.toUpperCase()}-${o}`,l=n.find(f=>f.code&&f.code.toUpperCase()===o)??n.find(f=>f.code&&f.code.toUpperCase()===s)??n.find(f=>f.name.toUpperCase()===o);return l?l.code||l.name:""}import{jsx as we}from"react/jsx-runtime";function va(e){let t=e.indexOf(`
3
3
  `);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}function xa(e,{canParkContext:t}={canParkContext:!0}){let n=e.paymentMethods,r=[];return n.includes("card")&&r.push({key:"card",title:"Card",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("paypal")&&e.paypalClientId&&r.push({key:"paypal",title:"PayPal",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL \xB7 CARDS"})}),n.includes("afterpay")&&r.push({key:"afterpay",title:"Afterpay",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 \xD7 INTEREST-FREE"})}),n.includes("square")&&e.squareApplicationId&&e.squareLocationId&&r.push({key:"square",title:"Card (Square)",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("gocardless")&&t&&r.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),n.includes("zip")&&r.push({key:"zip",title:"Zip",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),n.includes("klarna")&&t&&r.push({key:"klarna",title:"Klarna",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),n.includes("bank")&&r.push({key:"bank",title:"Bank transfer",body:null,price:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),r}var wa="This shop does not take payment online yet. Please contact the shop to order.",tt=class extends Error{};function ka(e,t){if(!e.orderNumber&&Lt(t))return t.message;let n=t instanceof de?` (${t.message})`:"";return e.orderNumber?`Your order ${e.orderNumber} is saved, but the payment did not start${n}. Try the payment again \u2014 your order will not be placed twice.`:`Your items are held under ${e.checkoutNumber}, but the payment did not start${n}. Try the payment again \u2014 you will not be charged twice.`}var Ca=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]),Ue=e=>JSON.parse(e),Pa="Shipping cannot be calculated right now. Please try again.";function Na(e){return`Your order is saved, so its contact, address, delivery and discount can't change here. To change any of them, contact the shop and quote ${e}.`}function ui({site:e,logo:t,preview:n=!1}){let{items:r,totals:o,coupon:s,refuseCoupon:l,deliveryOptions:f,shippingMethodId:g,setShippingMethodId:d,setQuoteDestination:y,courier:N,requote:b,identify:m,clearCapturedCart:v,replaceItems:E,removeCoupon:A}=St(),Z=f.find(a=>a.id===g)?.pickupLocation??null,{country:O,countries:C,activeCountry:Y,formatMoney:Q}=ye(),[M,ie]=w(()=>xa(e)[0]?.key??null),[he,Le]=w(!0);X(()=>{Le(or(ue))},[]);let[me,z]=w(!1),[le,I]=w(""),[H,$]=w(""),[k,rt]=w(""),[Ye,K]=w(""),[Be,ee]=w(""),[_e,Pe]=w(""),[be,L]=w(""),[V,ze]=w(""),[Ne,Fe]=w(""),[j,ft]=w(()=>O||C[0]?.code||""),[Se,gt]=w(""),[at,yn]=w([]),[Kt,Ut]=w(null),[yt,ot]=w(null),hn=ba(()=>C.find(a=>a.code===j)??Y,[C,j,Y]),Ka=hn?.postalLabel||"Postal Code",Ua=at[0]?.divisionType||"State / Province";X(()=>{if(!j){yn([]),Ut(j);return}Ut(null);let a=!1;return W.listCountrySubdivisions(j).then(u=>{a||(yn(u),Ut(j),gt(""))}),()=>{a=!0}},[j]);let bn=Be.trim()!==""&&be.trim()!==""&&V.trim()!==""&&Kt===j&&(at.length===0||Se!=="")?V.trim():"";X(()=>{y(j?{country:j,subdivision:Se,postcode:bn}:null)},[j,Se,bn,y]),X(()=>()=>y(null),[y]);let Wa=N?.status==="unavailable",$a=b,[ht,vn]=w(null),[Ya,xn]=w([]),[kn,Wt]=w("new"),[Cn,wn]=w(!1),[$t,Ba]=w("Home"),[za,Pn]=w(null),[Ha,Nn]=w(null),[it,bt]=w(()=>Qe()),Sn=J(null),[En,fe]=w(null),[Ga,se]=w(null),[Rn,vt]=w(null),[On,Ja]=w(!1),[An,Va]=w(!1),[Ee,He]=w(null),[Xa,Ge]=w(!1),[ne,ve]=w(null),Za=!!ne?.orderNumber,[Qa,xe]=w(null),[eo,to]=w(!1),[no,In]=w(!1),[ro,ao]=w(!1),[oo,Tn]=w(!1),[Ln,io]=w(!1),[so,Yt]=w(!1),[Bt,_n]=w(null),qe=J(null),st=J(r),Me=J(null),Je=J(null),Fn=!!(En||Bt&&Bt.kind!=="processing"||Ln||On||An||Rn&&Ee?.orderNumber);X(()=>{Fn&&(E([]),A())},[Fn,E,A]);let qn=J(!1);X(()=>{n||qn.current||!r.some(dt)||(qn.current=!0,lr({lines:r,currency:o.currency,value:o.subtotal-o.discount,coupon:s?.valid?s.code:void 0}))},[r,o,s,n]),X(()=>{m(le,H.trim()||void 0)},[le,H,m]);let Mn=J(null),[xt,co]=w(null);X(()=>{let a=Mn.current;if(!xt||!a)return;let u=()=>a.style.setProperty("--sf-checkout-header-h",`${xt.offsetHeight}px`);u();let p=new ResizeObserver(u);return p.observe(xt),()=>p.disconnect()},[xt]),X(()=>{let a=p=>({setConfirming:p,land:fe,markPaid:()=>Ge(!0),note:xe,fail:se,clearCart:v}),u={search:window.location.search,storage:ue,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};un(ga,{...u,capture:W.captureAfterpayPayment,page:a(to)}),un(ya,{...u,capture:W.captureZipPayment,page:a(ao)})},[]),X(()=>{let u=new URLSearchParams(window.location.search).get("gocardless");if(u!=="confirm"&&u!=="cancel")return;let p=ue.getItem(Ft);if(ue.removeItem(Ft),window.history.replaceState(null,"",window.location.pathname),!p)return;let S;try{S=JSON.parse(p)}catch{return}if(v(),u==="cancel"){xe("The direct debit was not set up \u2014 our team will follow up on payment."),fe(S.confirmation);return}In(!0),W.completeGocardlessPayment({idempotencyKey:S.idempotencyKey}).then(h=>{h.status==="paid"?Ge(!0):h.status==="declined"?xe("The direct debit was declined \u2014 our team will follow up on payment."):xe("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{xe("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{fe(S.confirmation),In(!1)})},[]),X(()=>{let a=new URLSearchParams(window.location.search),u=a.get("klarna");if(u!=="confirm"&&u!=="cancel")return;let p=ue.getItem(qt);ue.removeItem(qt);let S=a.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!p)return;let h;try{h=JSON.parse(p)}catch{return}if(v(),u==="cancel"||!S){xe("The Klarna payment was not completed \u2014 our team will follow up on payment."),fe(h.confirmation);return}Tn(!0),W.captureKlarnaPayment({idempotencyKey:h.idempotencyKey,authorizationToken:S}).then(D=>{D.status==="paid"?Ge(!0):D.status==="declined"?xe("Klarna declined the payment \u2014 our team will follow up on payment."):xe("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{xe("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{fe(h.confirmation),Tn(!1)})},[]);function Dn(a){let[u,p]=va(a.address);ee(u),Pe(p),L(a.city),ze(a.zip_code),a.country&&ft(a.country),a.phone&&Fe(a.phone),ot({country:a.country||null,state:a.state??""})}X(()=>{if(yt){if((yt.country||j)!==j){ot(null);return}Kt===j&&(gt(ha(j,yt.state,at)),ot(null))}},[yt,j,Kt,at]),X(()=>{let a=!1;return(async()=>{try{let[u,p,S]=await Promise.all([Ze.me(),Ze.myProfile().catch(()=>null),Ze.myAddresses().catch(()=>[])]);if(a)return;vn(u);let h=S.filter(U=>U.is_active);xn(h),I(u.email);let D=(p?.contact_name??"").split(/\s+/);$(u.first_name||D[0]||""),rt(u.last_name||D.slice(1).join(" "));let R=u.phone||p?.phone;R&&Fe(R);let re=h.find(U=>U.id===u.default_delivery_location)??h[0];if(re)Wt(re.id),Dn(re);else if(p){let[U,ae]=va(p.address??"");ee(U),Pe(ae),L(p.city??""),ze(p.zip_code??""),p.country&&ft(p.country),ot({country:p.country||null,state:p.state??""})}}catch{}})(),()=>{a=!0}},[]);function lo(){Ze.logout(),vn(null),xn([]),Wt("new"),wn(!1),I(""),$(""),rt(""),K(""),ee(""),Pe(""),L(""),ze(""),Fe(""),ft(O||C[0]?.code||""),gt(""),ot(null)}let Ve=ba(()=>xa(e,{canParkContext:he}),[e,he]);X(()=>{Ve.some(a=>a.key===M)||ie(Ve[0]?.key??null)},[Ve,M]);let uo=Ve.length===0,kt=_e.trim()?`${Be}
4
4
  ${_e.trim()}`:Be,po=oa({email:le,firstName:H,lastName:k,company:Ye.trim(),phone:Ne,address:kt,city:be,subdivision:Se,postcode:V,country:j,lines:r.map(a=>[a.id,a.qty]),shippingMethodId:g,couponCode:Jt(s),currency:o.currency,shopperId:ht?.id??null}),te=JSON.stringify([po,M]),Re=J(null),zt=J(null),Ct=J(!1),ke=J(!1),Xe=J(null),wt=J(!1),ce=J(te);ce.current=te;let jn=J(me);jn.current=me;let Kn=()=>ke.current&&ce.current!==Re.current,De=J(null);X(()=>{jn.current||(te!==De.current&&(De.current=null),!(!ke.current||!ne||ne.orderNumber)&&(te===Re.current||te===De.current||Pt(ne)))},[te,ne]);async function Pt(a){if(wt.current)return null;wt.current=!0,z(!0);try{let u=Xe.current?await na(Xe.current):"none";if(u==="succeeded"||u==="processing")return ke.current=!1,ve(null),Ce("card"),u==="succeeded"?await je(void 0,a):Jn(a),null;if(u===void 0||!ra.has(u))return De.current=ce.current,ve(a),se(u==="requires_action"?ea:Ae),null;let p=await an(it);if(p==="committed")return ke.current=!1,ve(null),Ce("card"),await je(void 0,a),null;if(p!=="released")return De.current=ce.current,ve(a),se(Ae),null;ke.current=!1,Xe.current=null,De.current=null,se(null),ve(null);let S=Qe();return bt(S),S}finally{wt.current=!1,z(!1)}}async function mo(){if(!(n||me||wt.current)){if(ne){if((ke.current?te!==Re.current:ct())&&!ne.orderNumber){let S=await Pt(ne);S&&ce.current===te&&await Un(S);return}z(!0),se(null),Ct.current=!1,await Ht();let u=Ue(ce.current)[1],p=ne.orderNumber?u:"card";if(p&&Ca.has(p)&&ct()&&Ue(ce.current)[0]!==zt.current){Wn(ne);return}Ce(p),p!==M&&ie(p),await Vn(ne,p,!ne.orderNumber);return}await Un(it)}}async function Un(a){if(r.length===0||o.repricing||!M||!Ve.some(R=>R.key===M))return;let u=r.filter(dt).flatMap(R=>cr(R.components,R.qty));if(u.length===0){se("Pick a size on each wheel's product page before checking out.");return}z(!0),se(null);let p,S=a,h=M,D=!1;try{let R=ht?W.createOrderAuthed:W.createOrder,re=kr(),U={customer:{email:le,name:`${H} ${k}`.trim(),phone:Ne.trim()||void 0,companyName:Ye.trim()||void 0,address:kt,city:be,state:Se||void 0,zipCode:V,country:j},items:u,currency:o.currency,idempotencyKey:a,shippingMethodId:g??void 0,couponCode:Jt(s),...re==="denied"?{}:ua(),...re?{adConsent:re}:{},...Zr(M)?{checkoutFlow:nn}:{}};qe.current=()=>R(U),Nn(null),zt.current=null,Ct.current=!1,Xe.current=null,ke.current=!1,De.current=null,Re.current=te,st.current=r;let ae=Me.current,Qn=ae?.key===U.idempotencyKey&&(ae.shape!==te&&(!!U.checkoutFlow||!!ae.method||!!ae.plainMethod)||!!U.checkoutFlow&&!!ae.plainMethod);Qn&&(Je.current=U.idempotencyKey);let er=zn(U,R),tr=Qn||!U.checkoutFlow&&Je.current===U.idempotencyKey,nr=!er&&!tr&&!U.checkoutFlow&&!!ae&&!ae.method;nr&&(ae.plainMethod=M,ae.plainLines=r,ae.plainShape=te);let Ke=await(tr?Yn(U,R):R(U).then(lt=>({answer:lt,request:U})).catch(lt=>(er?$n(lt,U.idempotencyKey):nr&&sn(lt)&&(ae.plainMethod=""),fo(lt,U,R))));if(!Ke)return;p=Ke.answer,S=Ke.request.idempotencyKey,h=Ke.method??h,Ce(h),D=ct()||h!==Ue(ce.current)[1],Ke.method&&Ke.method!==M&&ie(Ke.method),p.orderNumber&&(Hn(p),v()),await Ht()}catch(R){let re=sr(R);re?(l(re),se(`${re} Your order has not been placed. Place it again to continue without the code.`)):R instanceof tt?se(Ae):se(R instanceof de?R.message:"Could not place the order. Please try again."),z(!1);return}if(h&&Ca.has(h)&&(D||ct())){Wn(p);return}await Vn(p,h,!1,S)}function Wn(a){zt.current=Ue(ce.current)[0],se(`${ka(a,null)} ${rn}`),ve(a),z(!1)}function $n(a,u){sn(a)&&!on(a)&&Me.current?.key===u&&(Me.current=null)}async function fo(a,u,p){if(Lt(a))return Bn(u,p);if(!on(a))throw a;return Je.current=u.idempotencyKey,Yn(u,p,!0)}async function Yn(a,u,p=!1){let S=await an(a.idempotencyKey);if(S==="released")return ce.current===te?Bn(a,u):(bt(Qe()),z(!1),null);if(S!=="committed")throw new tt;let h=Me.current?.key===a.idempotencyKey?Me.current:null;if(st.current=h?.lines??r,h?.method&&!p){Je.current=null,qe.current=h.send;let re=await h.send().catch(()=>{throw new tt});return Re.current=h.shape,{answer:re,request:a,method:h.method}}let D=h&&!h.method?h.send:()=>u({...a,checkoutFlow:nn});qe.current=D;let R=await D().catch(()=>null);if(!R&&h?.plainMethod)throw new tt;return R?.orderNumber&&R.status!==Qr?(Je.current=null,h?.plainMethod&&(st.current=h.plainLines),h&&(Re.current=h.plainMethod?h.plainShape:h.shape),{answer:R,request:a,method:h?.plainMethod||void 0}):(z(!1),h&&(Re.current=h.shape),Ce("card"),await Gn("",R?async()=>R:()=>Promise.reject(new Error("The order request did not answer."))),await Ht(),null)}function ct(){let a=Re.current;return a!==null&&Ue(a)[0]!==Ue(ce.current)[0]}function Ce(a){a!==Ue(ce.current)[1]&&(Ct.current=!0),Nn(Ct.current||ct()?rn:null)}async function Bn(a,u){let p={...a,idempotencyKey:Qe()};Je.current=null,bt(p.idempotencyKey),qe.current=()=>u(p),zn(p,u);try{return{answer:await u(p),request:p}}catch(S){throw $n(S,p.idempotencyKey),S}}function zn(a,u){return Me.current?.key===a.idempotencyKey?!1:(Me.current={key:a.idempotencyKey,send:()=>u(a),lines:r,shape:te,method:a.checkoutFlow?"":M??"",plainMethod:"",plainLines:r,plainShape:te},!0)}function Hn(a){ur({confirmation:a,lines:st.current,adsSendTo:e.googleAdsId&&e.googleAdsConversionLabel?`${e.googleAdsId}/${e.googleAdsConversionLabel}`:null}),fa({confirmation:a,lines:st.current})}async function je(a,u=Ee){if(!u)return;let p=a?async()=>a:qe.current;if(u.orderNumber||!p){Ge(!0),fe(u);return}await Gn(u.checkoutNumber,p)}async function Gn(a,u){v(),await ia({checkoutNumber:a,resend:u,page:{setConfirming:io,land:fe,markPaid:()=>Ge(!0),track:Hn,unplaced:_n}})}function Jn(a=Ee){if(a){if(a.orderNumber){fe(a);return}v(),_n({kind:"processing",checkoutNumber:a.checkoutNumber})}}async function Ht(){let a=JSON.stringify([$t.trim(),H,k,Ne.trim(),kt,be,Se,V,j]);if(!(!ht||!Cn||kn!=="new"||Sn.current===a))try{await Ze.createAddress({label:$t.trim()||"Home",contact_name:`${H} ${k}`.trim(),phone:Ne.trim(),address:kt,city:be,zip_code:V,state:Se,country:j}),Sn.current=a,Pn("Address saved to your account.")}catch{Pn("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}}async function Vn(a,u=M,p=!1,S=it){ve(null);try{if(u==="card"&&e.paymentMethods.includes("card")){let h=await W.createPaymentIntent({idempotencyKey:S});if(Xe.current=h,p&&Kn()){await Pt(a);return}let D=a;if(p){let R=await qe.current?.().catch(()=>null);if(R?.orderNumber){Ce("card"),await je(R,a);return}if(D=Xn(a,R)??{...a,expiresAt:null},Kn()){await Pt(a);return}}Ce("card"),He(D),Yt(!1),vt(h)}else if(u==="paypal"&&e.paymentMethods.includes("paypal"))He(a),Ja(!0);else if(u==="afterpay"&&e.paymentMethods.includes("afterpay")){let h=window.location.origin,D=await W.createAfterpayCheckout({idempotencyKey:S,confirmUrl:`${h}/checkout?afterpay=confirm`,cancelUrl:`${h}/checkout?afterpay=cancel`}),R={idempotencyKey:S,confirmation:a};ue.setItem(cn,JSON.stringify(R)),window.location.assign(D.redirectCheckoutUrl);return}else if(u==="square"&&e.paymentMethods.includes("square"))He(a),Va(!0);else if(u==="gocardless"&&e.paymentMethods.includes("gocardless")){let h=window.location.origin,D=await W.createGocardlessBillingRequest({idempotencyKey:S,confirmUrl:`${h}/checkout?gocardless=confirm`,cancelUrl:`${h}/checkout?gocardless=cancel`}),R={idempotencyKey:S,confirmation:a};ue.setItem(Ft,JSON.stringify(R)),window.location.assign(D.authorisationUrl);return}else if(u==="zip"&&e.paymentMethods.includes("zip")){let h=window.location.origin,D=await W.createZipCheckout({idempotencyKey:S,redirectUrl:`${h}/checkout?zip=return`}),R={idempotencyKey:S,confirmation:a};ue.setItem(ln,JSON.stringify(R)),window.location.assign(D.redirectUrl);return}else if(u==="klarna"&&e.paymentMethods.includes("klarna")){let h=window.location.origin,D=await W.createKlarnaCheckout({idempotencyKey:S,confirmUrl:`${h}/checkout?klarna=confirm`,cancelUrl:`${h}/checkout?klarna=cancel`}),R={idempotencyKey:S,confirmation:a};ue.setItem(qt,JSON.stringify(R)),window.location.assign(D.redirectUrl);return}else Ce(u),fe(a)}catch(h){if((p||u==="card")&&h instanceof de&&h.status===409){Ce(u),await je(void 0,a);return}Zn(a,h),z(!1)}}function Xn(a,u){return u&&!u.orderNumber&&u.status==="open"&&u.checkoutNumber===a.checkoutNumber?u:null}function Zn(a,u){se(ka(a,u)),!a.orderNumber&&Lt(u)?(ke.current=!1,bt(Qe())):ve(a)}async function go(a){if(!Ee)return;let u=Ee;try{let p=await W.createPaymentIntent({idempotencyKey:it}),S=await qe.current?.().catch(()=>null);if(S?.orderNumber){await je(S);return}let h=Xn(u,S);He(h??{...u,expiresAt:null}),Yt(a&&h!==null),Xe.current=p,vt(p)}catch(p){if(p instanceof de&&p.status===409){await je();return}vt(null),He(null),Zn(u,p),z(!1)}}function yo(){Ee&&(ke.current=!0,ve(Ee),vt(null),He(null),Yt(!1),z(!1))}return{site:e,logo:t,items:r,totals:o,coupon:s,deliveryOptions:f,courierUnavailable:Wa,retryCourier:$a,shippingMethodId:g,setShippingMethodId:d,pickupLocation:Z,servedCountries:C,formatMoney:Q,payChoice:M,setPayChoice:ie,placing:me,email:le,setEmail:I,firstName:H,setFirstName:$,lastName:k,setLastName:rt,company:Ye,setCompany:K,address1:Be,setAddress1:ee,address2:_e,setAddress2:Pe,city:be,setCity:L,postcode:V,setPostcode:ze,phone:Ne,setPhone:Fe,country:j,setCountry:ft,subdivision:Se,setSubdivision:gt,subdivisions:at,destination:hn,postcodeLabel:Ka,subdivisionLabel:Ua,me:ht,savedAddresses:Ya,selectedAddressId:kn,setSelectedAddressId:Wt,saveAddress:Cn,setSaveAddress:wn,saveLabel:$t,setSaveLabel:Ba,addressSaveNote:za,lostChangeNote:Ha,idemKey:it,confirmation:En,setConfirmation:fe,orderError:Ga,payment:Rn,paypalStep:On,squareStep:An,pendingConf:Ee,paid:Xa,setPaid:Ge,unpaidOrder:ne,orderLocked:Za,payNote:Qa,afterpayConfirming:eo,gocardlessConfirming:no,zipConfirming:ro,klarnaConfirming:oo,cardConfirming:Ln,checkoutResult:Bt,confirmCardPayment:je,cardStillProcessing:Jn,renewCardPayment:go,holdRenewed:so,leaveCardPayment:yo,checkoutRootRef:Mn,setCheckoutHeaderEl:co,fillFromAddress:Dn,checkoutSignOut:lo,payOptions:Ve,noPaymentMethod:uo,placeOrder:mo}}var Sa=ci(null);function Ea({children:e,...t}){let n=ui(t);return we(Sa.Provider,{value:n,children:e})}function Ie(){let e=li(Sa);if(!e)throw new Error("useCheckout must be used inside CheckoutStateProvider");return e}import{useId as dn}from"react";import{Fragment as Te,jsx as i,jsxs as P}from"react/jsx-runtime";function Oa(){let{email:e,setEmail:t,firstName:n,setFirstName:r,lastName:o,setLastName:s,company:l,setCompany:f,me:g,checkoutSignOut:d,orderLocked:y,unpaidOrder:N}=Ie(),b=dn();return P(Dt,{num:"N\xB0 01",title:"Contact",children:[y&&N&&i(di,{orderNumber:N.orderNumber}),i(oe,{label:"Email",htmlFor:b,hint:g?P(Te,{children:["Signed in \xB7"," ",i("button",{type:"button",onClick:d,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:i("input",{id:b,type:"email",value:e,onChange:m=>t(m.target.value),placeholder:"you@example.com",readOnly:g!==null,disabled:y,className:Et+(g||y?pn:"")})}),P(_a,{children:[i(oe,{label:"First name",children:i("input",{type:"text",value:n,onChange:m=>r(m.target.value),disabled:y,className:pe(y)})}),i(oe,{label:"Last name",children:i("input",{type:"text",value:o,onChange:m=>s(m.target.value),disabled:y,className:pe(y)})})]}),i(oe,{label:"Company (optional)",children:i("input",{type:"text",value:l,onChange:m=>f(m.target.value),autoComplete:"organization",disabled:y,className:pe(y)})})]})}function Aa(){let{pickupLocation:e,servedCountries:t,address1:n,setAddress1:r,address2:o,setAddress2:s,city:l,setCity:f,postcode:g,setPostcode:d,phone:y,setPhone:N,country:b,setCountry:m,subdivision:v,setSubdivision:E,subdivisions:A,destination:Z,postcodeLabel:O,subdivisionLabel:C,me:Y,savedAddresses:Q,selectedAddressId:M,setSelectedAddressId:ie,saveAddress:he,setSaveAddress:Le,saveLabel:me,setSaveLabel:z,fillFromAddress:le,orderLocked:I}=Ie(),H=dn(),$=dn();return P(Dt,{num:"N\xB0 02",title:e?"Collection":"Shipping address",children:[e?P("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[i("span",{className:"font-medium",children:e.name}),[e.address,e.city,e.state,e.zipCode,e.country].filter(Boolean).length>0&&i("span",{className:"opacity-80",children:[e.address,e.city,e.state,e.zipCode,e.country].filter(Boolean).join(", ")}),e.openingHours&&i("span",{className:"opacity-80",children:e.openingHours}),e.instructions&&i("span",{className:"opacity-80",children:e.instructions}),i("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):P(Te,{children:[Y!==null&&Q.length>0&&P("div",{className:"grid gap-3",children:[Q.map(k=>i(Mt,{active:M===k.id,disabled:I,onClick:()=>{ie(k.id),le(k)},title:k.label,body:k.formatted_address,price:null},k.id)),i(Mt,{active:M==="new",disabled:I,onClick:()=>ie("new"),title:"New address",body:null,price:null})]}),i(oe,{label:"Address line 1",children:i("input",{type:"text",value:n,onChange:k=>r(k.target.value),disabled:I,className:pe(I)})}),i(oe,{label:"Address line 2",children:i("input",{type:"text",value:o,onChange:k=>s(k.target.value),placeholder:"Apartment, unit, garage bay\u2026",disabled:I,className:pe(I)})}),P(_a,{cols:"three",children:[i(oe,{label:"City",children:i("input",{type:"text",value:l,onChange:k=>f(k.target.value),disabled:I,className:pe(I)})}),i(oe,{label:O,children:i("input",{type:"text",value:g,onChange:k=>d(k.target.value),disabled:I,className:pe(I)})}),i(oe,{label:"Country",separate:!0,htmlFor:H,children:i(Xt,{id:H,value:b,onChange:k=>m(k.target.value),disabled:I,className:pe(I)+" pr-10",style:Ra,children:t.map(k=>i("option",{value:k.code,children:k.name},k.code))})})]}),i(oe,{label:C,separate:!0,htmlFor:$,children:A.length>0?P(Xt,{id:$,value:v,onChange:k=>E(k.target.value),disabled:I,className:pe(I)+" pr-10",style:Ra,children:[i("option",{value:"",children:"Select\u2026"}),A.map(k=>i("option",{value:k.code||k.name,children:k.name},k.code||k.name))]}):i("input",{id:$,type:"text",value:v,onChange:k=>E(k.target.value),disabled:I,className:pe(I)})})]}),i(oe,{label:"Phone",children:i("input",{type:"tel",value:y,onChange:k=>N(k.target.value),disabled:I,className:pe(I)})}),!e&&Y!==null&&M==="new"&&!I&&P(Te,{children:[i(pi,{checked:he,onChange:Le,label:"Save this address to my account"}),he&&i(oe,{label:"Address label",children:i("input",{type:"text",value:me,onChange:k=>z(k.target.value),placeholder:"Home",className:Et})})]})]})}function Ia(){let{totals:e,coupon:t,deliveryOptions:n,shippingMethodId:r,setShippingMethodId:o,pickupLocation:s,formatMoney:l,city:f,destination:g,courierUnavailable:d,retryCourier:y,orderLocked:N}=Ie();return i(Dt,{num:"N\xB0 03",title:"Shipping",children:P("div",{className:"grid gap-3",children:[n.map(b=>{let m=b.pickupLocation,v=m?[m.address,m.city,m.state,m.zipCode].filter(Boolean).join(", "):null;return i(Mt,{active:r===b.id,disabled:N,onClick:()=>o(b.id),title:m?`${b.name} \u2014 ${m.name}`:b.name,body:m?[v,m.openingHours,m.instructions,b.description].filter(Boolean).join(" \xB7 "):b.description||null,price:e.freeShipping||b.amount===0?Nt:l(b.amount,e.currency),tag:b.tag||void 0},b.id)}),d?P("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[Pa," ",i("button",{type:"button",onClick:y,className:"underline transition-colors hover:text-accent",children:"Try again"})]}):n.length===0&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Ta(){let{payChoice:e,setPayChoice:t,placing:n,payment:r,payOptions:o,noPaymentMethod:s}=Ie();return P(Dt,{num:"N\xB0 04",title:"Payment",children:[s&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:wa}),i("div",{className:"grid gap-3",children:o.map(l=>i(Mt,{active:e===l.key,onClick:()=>t(l.key),title:l.title,body:l.body,price:l.price,tag:l.tag},l.key))}),e==="card"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):e==="paypal"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll approve the payment with PayPal on the payment step after placing the order."}):e==="afterpay"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):e==="square"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):e==="gocardless"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):e==="zip"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Zip to approve four instalments, then brought straight back."}):e==="klarna"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Klarna to choose how to pay, then brought straight back."}):e==="bank"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function La(){let{site:e,items:t,totals:n,coupon:r,formatMoney:o,payChoice:s,placing:l,email:f,orderError:g,payment:d,noPaymentMethod:y,unpaidOrder:N,orderLocked:b,placeOrder:m}=Ie();return P("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[P("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[i("span",{children:"Your order"}),i(ge,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit \u2197"})]}),i("div",{className:"flex flex-col px-6 py-2",children:t.length===0?P("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",i(ge,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):t.map(v=>i(mi,{slug:v.slug,name:v.name,qty:v.qty,config:v.config,configSummary:fi(v.config),price:fr(v,n.currency)??0,currency:n.currency},v.id))}),i("div",{className:"border-t border-line px-6 pt-5",children:i(vr,{customerEmail:f,disabled:b})}),P("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[i(We,{label:"Subtotal",value:o(n.subtotal,n.currency)}),n.discount>0&&r?.valid&&i(We,{label:`Coupon \xB7 ${r.code}`,value:P("span",{className:"font-semibold text-green",children:["\u2212 ",o(n.discount,n.currency)]})}),r?.deferred&&i(We,{label:`Coupon \xB7 ${r.code}`,value:ir}),r?.valid&&r.effects?.gift&&i(We,{label:`Free gift \xB7 ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` \xD7${r.effects.gift.quantity}`:""}`,value:i("span",{className:"font-semibold text-green",children:Nt})}),i(We,{label:"Shipping",value:n.shippingStatus==="free"?i("span",{className:"font-semibold text-green",children:Nt}):pr(n.shippingStatus)??o(n.shipping,n.currency)}),n.tax&&(n.tax.charged?i(We,{label:n.tax.inclusive?`${n.tax.name} included \xB7 ${n.tax.rate}%`:n.tax.name,value:o(n.tax.amount,n.currency)}):n.tax.name?i(We,{label:n.tax.name,value:dr}):null)]}),P("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[i("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),i("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?"\u2026":o(n.grand,n.currency)})]}),P("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[g&&i(Oe,{role:"alert",children:g}),n.hasUnpricedLine&&P(Oe,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),i("button",{type:"button",onClick:m,disabled:l||!N&&(y||t.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",l||!N&&(t.length===0||y||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:l?P(Te,{children:["Building order\u2026 ",i("span",{children:"\xB7"})]}):y?P(Te,{children:["No online payment ",i("span",{children:"\xB7"})]}):N?P(Te,{children:["Try payment again \xB7 ",_t(N),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]}):n.repricing?P(Te,{children:["Updating total\u2026 ",i("span",{children:"\xB7"})]}):P(Te,{children:[s==="bank"?"Place order":"Continue to payment"," \xB7"," ",o(n.grand,n.currency),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})}var pn=" cursor-not-allowed opacity-70";function pe(e){return Et+(e?pn:"")}function di({orderNumber:e}){return i(Oe,{tone:"quiet",role:"status",children:P("span",{className:"flex items-start gap-2",children:[P("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[i("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),i("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),i("span",{children:Na(e)})]})})}var Ra={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function Dt({num:e,title:t,children:n}){return P("section",{className:"mb-6 border border-line bg-bg",children:[P("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[i("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e}),i("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:t})]}),i("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function _a({cols:e="two",children:t}){return i("div",{className:["grid gap-3 max-[640px]:grid-cols-1",e==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:t})}function Mt({active:e,onClick:t,title:n,body:r,price:o,tag:s,disabled:l=!1}){return P("button",{type:"button",onClick:t,"aria-pressed":e,disabled:l,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",e?"border-accent outline outline-1 outline-accent -outline-offset-1":l?"border-line":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]",l?pn.trim():""].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[e&&i("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),i("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",e?"border-accent":"border-fg-dim"].join(" "),children:e&&i("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),P("span",{className:"flex min-w-0 flex-col gap-1",children:[P("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&i("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:s})]}),r&&i("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),i("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:o})]})}function pi({checked:e,onChange:t,label:n,sub:r}){return P("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[i("button",{type:"button",onClick:()=>t(!e),"aria-pressed":e,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",e?"border-accent":"border-line"].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:e&&i("span",{className:"text-[13px] text-accent",children:"\u2713"})}),P("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,r&&i("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:r})]})]})}function mi({slug:e,name:t,qty:n,config:r,configSummary:o,price:s,currency:l}){let{catalog:f}=St(),{formatMoney:g}=ye(),d=f.find(E=>E.slug===e),y=d?.spokes??5,N=d?.mesh??!1,b=r.find(E=>E.gold)?.label,m=d?.finishes.find(E=>E.name===b&&E.src)??d?.finishes.find(E=>E.src),v=d?.finishes[0]?.color??br;return P("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[P("div",{className:"relative aspect-square",children:[i("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:m?.src?i(rr,{src:m.src,alt:`${t.lead}${t.accent} \u2014 ${m.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):i("div",{className:"block w-[78%]",style:{color:v},children:i(hr,{spokes:y,mesh:N,className:"block w-full"})})}),i("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),P("div",{className:"flex min-w-0 flex-col gap-0.5",children:[P("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[t.lead,i("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:t.accent})]}),i("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:o})]}),i("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:g(s,l)})]})}function We({label:e,value:t}){return P("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[i("span",{children:e}),i("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:t})]})}function fi(e){return e.map(t=>t.label).join(" \xB7 ")}import{Fragment as B,jsx as c,jsxs as x}from"react/jsx-runtime";function gn(e){return c(Ea,{...e,children:c(hi,{})})}function gi({order:e,paid:t}){let{formatMoney:n}=ye();if(!e.grandTotal||!e.currency)return null;let r=l=>n(Number(l),e.currency),o=Number(e.freightCharge??0),s=Number(e.discountAmount??0);return x("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(e.shippingMethod||o>0)&&x(B,{children:[x("dt",{className:"text-fg-dim",children:["Delivery",e.shippingMethod?` \xB7 ${e.shippingMethod}`:""]}),c("dd",{className:"text-right font-mono",children:r(e.freightCharge??"0")})]}),s>0&&x(B,{children:[x("dt",{className:"text-fg-dim",children:["Discount",e.couponCode?` \xB7 ${e.couponCode}`:""]}),x("dd",{className:"text-right font-mono",children:["\u2212",r(e.discountAmount??"0")]})]}),c("dt",{className:"text-fg",children:t?"Total paid":"Order total"}),c("dd",{className:"text-right font-mono text-fg",children:r(e.grandTotal)})]})}function yi({result:e,lostChangeNote:t=null}){let n=c("span",{className:"font-mono text-fg",children:e.checkoutNumber});return x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:e.kind==="refunded"||e.kind==="expired"?"Order not placed":e.kind==="processing"?"Payment processing":"Payment received"}),c("p",{className:"text-fg-dim",children:e.kind==="refunded"?x(B,{children:["An item sold out or an offer ended while you paid for checkout ",n,". Your payment goes back to your card."]}):e.kind==="expired"?x(B,{children:["The hold on checkout ",n," ran out before your payment arrived. Your payment goes back to your card."]}):e.kind==="processing"?x(B,{children:["Your payment for checkout ",n," is being processed. When it goes through, we will email your order confirmation."]}):x(B,{children:["Thank you \u2014 your payment",e.checkoutNumber?x(B,{children:[" for checkout ",n]}):null," has gone through. We will email you the order number shortly."]})}),t&&e.kind!=="refunded"&&e.kind!=="expired"&&c("p",{className:"text-sm text-fg-dim",children:t}),c(ge,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function hi(){let{site:e,logo:t,items:n,placing:r,email:o,me:s,addressSaveNote:l,lostChangeNote:f,idemKey:g,confirmation:d,setConfirmation:y,payment:N,paypalStep:b,squareStep:m,pendingConf:v,paid:E,setPaid:A,payNote:Z,afterpayConfirming:O,gocardlessConfirming:C,zipConfirming:Y,klarnaConfirming:Q,cardConfirming:M,checkoutResult:ie,confirmCardPayment:he,cardStillProcessing:Le,renewCardPayment:me,holdRenewed:z,leaveCardPayment:le,checkoutRootRef:I,setCheckoutHeaderEl:H}=Ie();return d?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:E?"Payment received":"Order received"}),x("p",{className:"text-fg-dim",children:[E?x(B,{children:["Thank you \u2014 your payment for order"," ",c("span",{className:"font-mono text-fg",children:d.orderNumber})," has gone through."," "]}):x(B,{children:["Thank you \u2014 your order ",c("span",{className:"font-mono text-fg",children:d.orderNumber})," is being reviewed by our team."," "]}),s?x(B,{children:["Track it under"," ",c(ge,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):c(B,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),c(gi,{order:d,paid:E}),f&&c("p",{className:"text-sm text-fg-dim",children:f}),Z&&c("p",{className:"text-sm text-fg-dim",children:Z}),l&&c("p",{className:"text-sm text-fg-dim",children:l}),!s&&x("p",{className:"text-sm text-fg-dim",children:["You can also"," ",c(ge,{href:`/track?order=${encodeURIComponent(d.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),c(ge,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):ie?c(yi,{result:ie,lostChangeNote:f}):M?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order \u2014 one moment."})]}):O?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):C?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):Y?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):Q?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):N&&v?c(bi,{payment:N,checkout:v,holdRenewed:z,onPaid:he,onProcessing:Le,onRenew:me,onBack:le}):b&&v?c(Ci,{confirmation:v,clientId:e.paypalClientId??"",idemKey:g,onPaid:()=>{A(!0),y(v)},onSkip:()=>y(v)}):m&&v?c(Pi,{confirmation:v,applicationId:e.squareApplicationId??"",locationId:e.squareLocationId??"",environment:e.squareEnvironment??"production",idemKey:g,onPaid:()=>{A(!0),y(v)},onSkip:()=>y(v)}):x("div",{ref:I,className:"bg-bg text-fg",children:[x("header",{ref:H,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[x(ge,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",c("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),c(ge,{href:"/","aria-label":`${e.name} home`,className:"inline-flex items-center justify-center",children:c(xr,{variant:"header",scrolled:!0,src:t?.url??null,reverse:t?.reverse??!1,reversedSrc:t?.reversed??null,inkIsDark:t?.inkIsDark??null,size:t?.size??"medium",sizePx:t?.sizePx??null,sizeUnit:t?.sizeUnit??null,siteName:e.name})}),e.cardPayments?x("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[c("span",{className:"text-green",children:"\u25CF"}),c("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):c("span",{})]}),x("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[c("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),c("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map($=>x("span",{className:["relative flex items-center gap-2 transition-colors",$.state==="pending"?"text-fg-dim":"text-fg",$.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[c("span",{className:$.state==="done"?"text-accent font-bold":"",children:$.n}),c("span",{children:$.label})]},$.n))})]}),x("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[x("div",{children:[c(Oa,{}),c(Aa,{}),c(Ia,{}),c(Ta,{})]}),c(La,{})]}),c("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:c("span",{children:yr({legalName:e.legalName,foundedYear:e.foundedYear,siteName:e.name})})})]})}function bi({payment:e,checkout:t,holdRenewed:n,onPaid:r,onProcessing:o,onRenew:s,onBack:l}){let{formatMoney:f}=ye(),g=c("span",{className:"text-fg",children:f(Number(e.amount),e.currency)}),d=Fa(()=>Tt(e.publishableKey),[e.publishableKey]),y=Fa(()=>Cr(),[]);return c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[c("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:_t(t)}),c("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:t.orderNumber?x(B,{children:["Your order is placed. Pay ",g," by card to confirm it now."]}):n?x(B,{children:["Your hold ran out, so your items are held again",t.expiresAt?` until ${qa(t.expiresAt)}`:"",". Enter your card again, then pay ",g,"."]}):x(B,{children:["Your items are held",t.expiresAt?` until ${qa(t.expiresAt)}`:"",". Pay ",g," by card to place your order."]})}),c(tn,{stripe:d,options:{clientSecret:e.clientSecret,appearance:y},children:c(xi,{payment:e,checkout:t,onPaid:r,onProcessing:o,onRenew:s,onBack:l})},e.clientSecret)]})]})})}function qa(e){return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}var vi=5;function xi({payment:e,checkout:t,onPaid:n,onProcessing:r,onRenew:o,onBack:s}){let{formatMoney:l}=ye(),f=Yr(),g=Wr(),[d,y]=$e(!1),[N,b]=$e(null),m=nt(!1);async function v(){try{return(await f.retrievePaymentIntent(e.clientSecret)).paymentIntent?.status}catch{return}}async function E(O){let C=O;for(let Y=0;C==="processing"&&Y<vi;Y+=1)await new Promise(Q=>setTimeout(Q,1e3)),C=await v()??C;if(C==="succeeded"){n();return}if(C==="processing"){r();return}b("Payment did not complete. Please try again."),y(!1)}async function A(){if(!f||!g||d)return;y(!0),b(null),m.current=!0;let O=await f.confirmPayment({elements:g,redirect:"if_required"}).catch(()=>null);if(!O){let C=await v();if(C==="succeeded"||C==="processing"){await E(C);return}b(C===void 0?Ae:"Payment failed. Please try again."),y(!1);return}if(O.error){if(!t.orderNumber&&O.error.code==="payment_intent_unexpected_state"){let C=await v();if(C==="succeeded"||C==="processing"){await E(C);return}if(C===void 0){b(Ae),y(!1);return}await o(C==="canceled"),y(!1);return}b(O.error.message??"Payment failed. Please try again."),y(!1);return}await E(O.paymentIntent?.status)}async function Z(){if(d)return;if(!m.current){s();return}y(!0),b(null);let O=await v();if(O==="succeeded"||O==="processing"){await E(O);return}if(y(!1),O===void 0){b(Ae);return}s()}return x("div",{className:"flex flex-col gap-4",children:[c(Br,{}),N&&c(Oe,{role:"alert",children:N}),c("button",{type:"button",onClick:A,disabled:!f||!g||d,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!f||!g||d?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:d?x(B,{children:["Processing\u2026 ",c("span",{children:"\xB7"})]}):x(B,{children:["Pay ",l(Number(e.amount),e.currency),c("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),!t.orderNumber&&!d&&x("button",{type:"button",onClick:Z,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",c("span",{children:"Back to checkout"})]})]})}var Ma="paypal-sdk-js",mn=null;function ki(e,t){let n=`${e}|${t}`;if(mn?.key===n)return mn.promise;let r=new Promise((o,s)=>{document.getElementById(Ma)?.remove();let l=document.createElement("script");l.id=Ma;let f=new URLSearchParams({"client-id":e,currency:t,intent:"capture"});l.src=`https://www.paypal.com/sdk/js?${f}`,l.onload=()=>{let g=window.paypal;g?o(g):s(new Error("PayPal SDK loaded without its namespace"))},l.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(l)});return mn={key:n,promise:r},r}function Ci({confirmation:e,clientId:t,idemKey:n,onPaid:r,onSkip:o}){let{formatMoney:s}=ye(),l=nt(null),[f,g]=$e(!1),[d,y]=$e(null),N=nt(r);return N.current=r,ja(()=>{let b=!1,m=null;return ki(t,e.currency).then(v=>{if(!(b||!l.current))return m=v.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await W.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async E=>{try{if((await W.capturePaypalOrder({idempotencyKey:n,paypalOrderId:E.orderID})).status==="paid"){N.current();return}y("PayPal did not complete the payment. Please try again.")}catch(A){y(A instanceof de?A.message:"PayPal payment failed. Please try again.")}},onError:()=>{y("PayPal could not process the payment. Please try again.")}}),m.render(l.current).then(()=>{b||g(!0)})}).catch(()=>{b||y("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{b=!0,m?.close?.()}},[t,e.currency,n]),c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[c("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),c("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[x("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",c("span",{className:"text-fg",children:s(Number(e.grandTotal),e.currency)})," ","with PayPal to confirm it now."]}),!f&&!d&&c("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),c("div",{ref:l}),d&&c(Oe,{role:"alert",children:d}),c("button",{type:"button",onClick:o,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var Da="square-web-sdk",fn=null;function wi(e){let t=e==="sandbox"?"sandbox":"production";if(fn?.key===t)return fn.promise;let n=new Promise((r,o)=>{document.getElementById(Da)?.remove();let s=document.createElement("script");s.id=Da,s.src=t==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{let l=window.Square;l?r(l):o(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>o(new Error("Square SDK failed to load")),document.head.appendChild(s)});return fn={key:t,promise:n},n}function Pi({confirmation:e,applicationId:t,locationId:n,environment:r,idemKey:o,onPaid:s,onSkip:l}){let{formatMoney:f}=ye(),g=nt(null),d=nt(null),y=nt(null),[N,b]=$e(!1),[m,v]=$e(!1),[E,A]=$e(null);ja(()=>{let O=!1,C=null;return wi(r).then(async Y=>{if(O||!g.current)return;let Q=Y.payments(t,n);y.current=Q,C=await Q.card(),await C.attach(g.current),d.current=C,O||b(!0)}).catch(()=>{O||A("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{O=!0,C?.destroy?.()}},[t,n,r]);async function Z(){let O=d.current;if(!(!O||m)){v(!0),A(null);try{let C=await O.tokenize();if(C.status!=="OK"||!C.token){A(C.errors?.[0]?.message??"Please check the card details and try again."),v(!1);return}let Y;try{Y=(await y.current?.verifyBuyer?.(C.token,{amount:String(e.grandTotal),currencyCode:e.currency,intent:"CHARGE"}))?.token}catch{}if((await W.chargeSquare({idempotencyKey:o,sourceId:C.token,...Y?{verificationToken:Y}:{}})).status==="paid"){s();return}A("Square did not complete the payment. Please try again.")}catch(C){A(C instanceof de?C.message:"Square payment failed. Please try again.")}v(!1)}}return c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[c("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),c("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[x("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",c("span",{className:"text-fg",children:f(Number(e.grandTotal),e.currency)})," ","by card to confirm it now."]}),!N&&!E&&c("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),c("div",{ref:g}),E&&c(Oe,{role:"alert",children:E}),c("button",{type:"button",onClick:Z,disabled:!N||m,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!N||m?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:m?x(B,{children:["Processing\u2026 ",c("span",{children:"\xB7"})]}):x(B,{children:["Pay ",f(Number(e.grandTotal),e.currency),c("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),c("button",{type:"button",onClick:l,disabled:m,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}import{jsx as jt}from"react/jsx-runtime";function Ni(){let{settings:e,websiteName:t}=ar(),n=t?{...Vt,name:t}:Vt,r=e?{url:e.logoUrl,reversed:e.logoReversed??null,inkIsDark:e.logoInkIsDark??null,reverse:e.reverseLogo,size:e.logoSize,sizePx:e.logoSizePx,sizeUnit:e.logoSizeUnit??null}:null;return jt("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:jt(mr,{children:jt(gr,{preview:!0,children:jt(gn,{site:n,logo:r,preview:!0})})})})}export{Ni as default};
@@ -1 +1 @@
1
- "use client";import{ir as r}from"./chunk-KRMWJLBM.js";import"./chunk-B2IYTOE3.js";import"./chunk-QP2F42DV.js";import"./chunk-Y6SLVHK3.js";import{jsx as o}from"react/jsx-runtime";import e from"efficient-easel/screen/components/ScreenStoreProvider";function a(t){return o(e,{...t,parts:r})}export{a as default};
1
+ "use client";import{tp as r}from"./chunk-OWUMH5VC.js";import"./chunk-G6OVBAOA.js";import"./chunk-SCTOV5CT.js";import"./chunk-Y6SLVHK3.js";import{jsx as o}from"react/jsx-runtime";import e from"efficient-easel/screen/components/ScreenStoreProvider";function a(t){return o(e,{...t,parts:r})}export{a as default};
@@ -1 +1 @@
1
- import{b as U,c as Q,f as X,h as O,l as Y,n as v}from"./chunk-QP2F42DV.js";var N="".replace(/\/+$/,"");var B="x-forwarded-for";function ee(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var He="x-forwarded-host";function te(e,t,n){let s={};return e&&(s[He]=e),t&&n==="uncached"&&(s[B]=t),s}function ne(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var re="x-storefront-site",se="x-storefront-host",ie="x-storefront-preview";var We="shop_access_token",oe="shop_refresh_token",D=null;function M(){v.removeItem(We),v.removeItem(oe)}var w={getAccess(){return D},takeLegacyRefresh(){let e=v.getItem(oe);return M(),e},setTokens(e){D=e,M()},clear(){D=null,M()}};import{efficientClientOpen as lt}from"efficient-easel/screen/lib/session";function Je(e){return!!e.src}function R(e){let t=e.finishes.filter(Je);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(s=>s.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function Ge(e){return e.listable!==!1}function _(e){return e.map(R).filter(Ge)}var ue=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],me=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),E={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},de=12,pe=/\burl\(/i,ge=new RegExp(`(?<![-\\w])(${ue.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),he=new RegExp(`((?:^|[;{\\s"'])(?:${ue.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ke=/<svg\b([^>]*)>/i,Ve=/\bfill\s*[=:]/i;function je(e){let t=e.replace(ge,(n,s,a,c,p)=>{let r=ae(p);return r===null?n:`${s}${a}${c}${r}${c}`}).replace(he,(n,s,a)=>{let c=ae(a);return c===null?n:`${s}${c}`});return t=t.replace(Ke,(n,s)=>Ve.test(s)?n:`<svg fill="#ffffff"${s}>`),t}function ae(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||pe.test(n)||me.has(n))return null;let s=n in E?[...E[n],1]:ye(n);if(!s)return null;let[a,c,p,r]=s;if(Math.max(a,c,p)-Math.min(a,c,p)>de)return null;let i=ze(255-a,255-c,255-p,r);return t?`${i} !important`:i}function ze(e,t,n,s){if(s<1)return`rgba(${e}, ${t}, ${n}, ${s})`;let a=c=>c.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function ye(e){return e.startsWith("#")?Ze(e):e.startsWith("rgb")?Qe(e):e.startsWith("hsl")?Ye(e):null}function Ze(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(s=>s+s).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function Qe(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let c=a.map(r=>r.endsWith("%")?Math.round(parseFloat(r)/100*255):Math.round(parseFloat(r)));if(c.some(r=>Number.isNaN(r)))return null;let p=s?F(s):Xe(n);return[c[0],c[1],c[2],p]}function Xe(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?F(t[3]):1}function F(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ye(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let c=parseFloat(a[0]),p=parseFloat(a[1])/100,r=parseFloat(a[2])/100;if([c,p,r].some(P=>Number.isNaN(P)))return null;let i=s?F(s):a.length>=4?F(a[3]):1,[o,u,g]=et(c,p,r);return[o,u,g,i]}function et(e,t,n){let s=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,c=s*(1-Math.abs(a%2-1)),p=0,r=0,i=0;a<1?[p,r,i]=[s,c,0]:a<2?[p,r,i]=[c,s,0]:a<3?[p,r,i]=[0,s,c]:a<4?[p,r,i]=[0,c,s]:a<5?[p,r,i]=[c,0,s]:[p,r,i]=[s,0,c];let o=n-s/2;return[Math.round((p+o)*255),Math.round((r+o)*255),Math.round((i+o)*255)]}var ce=512*1024;function H(e){return/\.svg(\?|$)/i.test(e)}function tt(e){return`data:image/svg+xml,${encodeURIComponent(je(e))}`}function nt(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||pe.test(t)||me.has(t))return null;let n=t in E?[...E[t],1]:ye(t);if(!n)return null;let[s,a,c]=n;return Math.max(s,a,c)-Math.min(s,a,c)>de?null:(.2126*s+.7152*a+.0722*c)/255}function rt(e){let t=[],n=s=>{let a=nt(s);a!==null&&t.push(a)};for(let s of e.matchAll(ge))n(s[4]);for(let s of e.matchAll(he))n(s[2]);return t.length?t.reduce((s,a)=>s+a,0)/t.length<.5:null}var le=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function st(e){let t=e;for(let n=le.exec(t);n&&n[0].length>0;n=le.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function it(e,t){if(!H(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let s=Number(n.headers.get("content-length"));if(Number.isFinite(s)&&s>ce)return null;let a=await n.text();return a.length>ce?null:st(a)?a:null}catch{return null}}async function fe(e,t){let n=await it(e,t);return n===null?null:{reversed:tt(n),inkIsDark:rt(n)}}import{currentEaselSession as ot,setSessionBridgedSite as tn,setSessionDocumentSite as nn}from"efficient-easel/screen/lib/session";function Se(){return ot().siteId()}var Pe={title:"Find a dealer",placeholder:"Postcode or suburb",search:"Search",searching:"Searching\u2026",none:"No dealers to show yet.",notFound:"We couldn't find that place. Check the postcode or suburb and search again.",tryAgain:"We couldn't look up that place just now. Please try again.",website:"Website",map:"Dealers on the map"},b=e=>typeof e=="string"?e:"",W=e=>typeof e=="number"&&Number.isFinite(e)?e:null,at=["found","not_found","try_again"];function ct(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.name!="string"||!t.name?null:{id:b(t.id)||t.name,name:t.name,address:b(t.address),city:b(t.city),state:b(t.state),postcode:b(t.postcode),country:b(t.country),phone:b(t.phone),website:b(t.website),lat:W(t.lat),lng:W(t.lng),distanceKm:W(t.distanceKm)}}function we(e){if(!e||typeof e!="object")return{near:null,dealers:[]};let t=e,n=typeof t.near=="string"&&at.includes(t.near)?t.near:null,s=Array.isArray(t.dealers)?t.dealers:[];return{near:n,dealers:s.map(ct).filter(a=>a!==null)}}function sn(e){return e==="not_found"?Pe.notFound:e==="try_again"?Pe.tryAgain:null}function on(e){return e===null?null:e<10?`${e.toFixed(1)} km`:`${Math.round(e)} km`}function an(e){return[e.city,e.state,e.postcode].filter(Boolean).join(" ")}function cn(e){let t=e.map((o,u)=>({dealer:o,index:u})).filter(({dealer:o})=>o.lat!==null&&o.lng!==null);if(!t.length)return[];let n=t.map(({dealer:o})=>o.lat),s=t.map(({dealer:o})=>o.lng),[a,c]=[Math.min(...n),Math.max(...n)],[p,r]=[Math.min(...s),Math.max(...s)],i=(o,u,g)=>g===u?50:8+(o-u)/(g-u)*84;return t.map(({dealer:o,index:u})=>({id:o.id,index:u,left:i(o.lng,p,r),top:100-i(o.lat,a,c)}))}var ut="",S=class extends Error{constructor(t,n,s){super(n),this.status=t,this.data=s}},V="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",mt=new Set([502,503,504]),J=0,dt="This editor runs on its host's own backend, which does not serve this request.",pt=5e3,gt=15e3,ht=()=>typeof window>"u"?pt:gt;function Ie(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(ht())}var be=e=>e instanceof Error&&e.name==="TimeoutError",Ae=(e,t)=>mt.has(e)?V:t,yt=["admin","venue"],qe="admin";function Sn(e){qe=yt.includes(e)?e:"admin"}function ft(){return qe}var St=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,$e=null;function Pn(e){$e=e&&St.test(e)?e:null}function Pt(){return $e}function wt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:L(e,`site=${encodeURIComponent(t)}`)}async function l(e,t={}){let{token:n,baseUrl:s,headers:a,audience:c,...p}=t;if(typeof window<"u"&&!lt())throw new S(J,dt,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let r=typeof FormData<"u"&&p.body instanceof FormData,i;try{i=await fetch(`${s??ut}${wt(e)}`,{...p,headers:{...r?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...c===null?{}:{"X-Portal-Audience":c??"shop"},...a},signal:p.signal??Ie({...p,audience:c})})}catch(g){throw g instanceof TypeError||be(g)?new S(J,V,null):g}let o;try{o=await i.text()}catch(g){throw be(g)?new S(J,V,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new S(i.status,i.ok?"Expected JSON but received a non-JSON response":Ae(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Ae(i.status,i.statusText);throw new S(i.status,g,u)}return u}var x=null;async function Le(){return x||(x=bt().finally(()=>{x=null}),x)}async function bt(){let e=w.takeLegacyRefresh(),t=await _t.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Ue(){return w.getAccess()??Le()}async function y(e,t={}){let n;try{n=await Ue()}catch{throw w.clear(),new S(401,"Not signed in",null)}try{return await l(e,{...t,token:n})}catch(s){if(!(s instanceof S)||s.status!==401)throw s;try{let a=await Le();return await l(e,{...t,token:a})}catch{throw w.clear(),s}}}var At=100,Re=20;function Rt(e){if(!e)return null;try{return new URL(e,"http://page.invalid").searchParams.get("page")}catch{return null}}async function _e(e,t){let[n,s=""]=e.split("?"),a=[],c="1";for(let p=0;p<Re&&c;p++){let r=new URLSearchParams(s);r.set("page_size",String(At)),c!=="1"&&r.set("page",c);let i=await y(`${n}?${r.toString()}`);a.push(...i.results),c=Rt(i.next)}return c&&console.warn(`[${t}] stopped at ${Re} pages (${a.length} rows); list may be truncated`),a}async function xe(e,t={}){if(w.getAccess())try{return{data:await y(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await l(e,t),asShopper:!1}}async function ke(){let e=await y("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new S(403,"This session is not valid for this shop.",null);return e}var _t={login:(e,t)=>l("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>l("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await l("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Ue();return await ke(),e},me:ke,updateMe:e=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>y("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>y("/api/shop-portal/profile/"),updateMyProfile:e=>y("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>y("/api/shop-portal/delivery-locations/"),createAddress:e=>y("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>l("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>l("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>y("/api/products/brands/"),myOrders:()=>_e("/api/shop-portal/orders/","api.myOrders"),myOrder:e=>y(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>y(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>_e(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`,"api.myReturns"),createReturn:e=>y("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>y(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),y("/api/shop-portal/return-media/",{method:"POST",body:n})}};function f(e){if(typeof e=="string")return e.startsWith("/media/")?X(e):e;if(Array.isArray(e))return e.map(f);if(e&&typeof e=="object"){let t={};for(let[n,s]of Object.entries(e))t[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([a,c])=>[f(a),c])):f(s);return t}return e}var Ne=typeof window>"u"&&N!=="",xt=Ne?N:"",kt=Q,A=()=>({baseUrl:kt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var Be=100,Te=50;function Z(e,t,n){let s=new URLSearchParams;for(let[a,c]of Object.entries(t))c!=null&&c!==""&&s.set(a,String(c));return s.set("pageSize",String(Be)),n&&s.set("cursor",n),`/api/v1${e}?${s.toString()}`}function Tt(e,t){return Z("/wheels",{process:e},t)}var Ce=Be;function Ct(e,t){return Z("/wheels",{slug:e.join(",")},t)}function Ot(e,t,n){return Z("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function vt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function G(e,t,n=()=>!1,s=()=>!1){let a=[],c=null;try{for(let p=0;p<Te;p++){let r=await l(await t(c),await d());if(a.push(...r.results),c=vt(r.next),!c)break;if(s(a))return a}c&&console.warn(`[${e}] stopped at ${Te} pages (${a.length} rows); catalog may be truncated`)}catch(p){if(n(p))throw p;console.warn(`[${e}] product API unavailable, returning []`,p)}return a}var Oe=e=>e instanceof S&&e.status===400;function ve(e){return e.flatMap(t=>t.kind==="alloy-wheel"?_([t]):[t])}async function De(){return(await Et()).host}async function Et(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=c=>c?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(t.get(se)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:s,matchesRequestHost:s!==null&&s===a}}catch{return{host:null,matchesRequestHost:!1}}}async function Ft(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return ee((await e()).get(B))}catch{return null}}async function It(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(re)||null}catch{return null}}async function qt(){let e=await It();if(e)return`site=${encodeURIComponent(e)}`;let t=await De();return t?`host=${encodeURIComponent(t)}`:""}async function h(e){if(typeof window<"u"){let t=U();return t?L(e,`site=${encodeURIComponent(t)}`):e}return L(e,await qt())}function L(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var $t="preview";async function Lt(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(ie)}catch{return null}}async function Ut(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function K(e,t){let n=await Lt();if(n===null)return[await h(e),await d(t)];let s=L(await h(e),`${$t}=${encodeURIComponent(n)}`),{next:a,cache:c,...p}=t??{},r=await d({...p,cache:"no-store"}),i=await Ut();return i&&(r.headers={...r.headers,"user-agent":i}),[s,r]}async function Nt(e){if(!Ne)return;let[t,n]=await Promise.all([De(),Ft()]),s=te(t,n,e);return Object.keys(s).length>0?s:void 0}async function d(e){let t=await Nt(ne(e)),n={baseUrl:xt,...e};return t&&(n.headers={...t,...e?.headers}),n}var k=typeof window>"u";function T(e,t){let n=new URLSearchParams;for(let[a,c]of Object.entries(t))c!==void 0&&c!==""&&n.set(a,String(c));let s=n.toString();return`/api/v1/fitment${e}${s?`?${s}`:""}`}var xn={listMakes:async e=>{if(k){let{fitmentData:n}=await import("./fitment-data-PXY35OVC.js");return n.makes(e)}return(await l(T("/makes",{region:e}),A())).results},listModels:async(e,t)=>{if(k){let{fitmentData:s}=await import("./fitment-data-PXY35OVC.js");return s.models(e,t)}return(await l(T("/models",{make:e,region:t}),A())).results},listYears:async(e,t,n)=>{if(k){let{fitmentData:a}=await import("./fitment-data-PXY35OVC.js");return a.years(e,t,n)}return(await l(T("/years",{make:e,model:t,region:n}),A())).results},listModifications:async(e,t,n,s)=>{if(k){let{fitmentData:c}=await import("./fitment-data-PXY35OVC.js");return c.modifications(e,t,n,s)}return(await l(T("/modifications",{make:e,model:t,year:n,region:s}),A())).results},getStockFitment:async(e,t,n,s,a)=>{if(k){let{fitmentData:c}=await import("./fitment-data-PXY35OVC.js");return c.stockFitment(e,t,n,s,a)}return l(T("/stock-fitment",{make:e,model:t,year:n,modification:s,region:a}),A())}},kn={listWheels:async(e,t={})=>{let n=await G("products.listWheels",async s=>await h(Tt(e,s)),t.throwOnFailure?()=>!0:void 0,t.maxRows===void 0?void 0:s=>_([...s]).length>=t.maxRows);return _(f(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(r=>r.trim()).filter(Boolean))];if(n.length===0)return[];let s=[];for(let r=0;r<n.length;r+=Ce)s.push(n.slice(r,r+Ce));let a=await Promise.all(s.map(r=>G("products.listWheelsBySlug",async i=>await h(Ct(r,i)),t.throwOnFailure?()=>!0:Oe))),c=new Set(n),p=a.flat().filter(r=>c.has(r.slug));return _(f(p))},listCatalog:async(e,t,n={})=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let s=await G("products.listCatalog",async a=>await h(Ot(e,t,a)),n.throwOnFailure?()=>!0:Oe,n.maxRows===void 0?void 0:a=>ve([...a]).length>=n.maxRows);return ve(f(s))},getWheel:async e=>R(f(await l(await h(m(`/wheels/${e}`)),await d()))),getTyre:async e=>f(await l(await h(m(`/tyres/${e}`)),await d())),listBundles:async(e={})=>{try{return await l(await h(m("/bundles")),await d())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>l(await h(m(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:s}=await import("./gallery-builds-data-TD3QJK7L.js");return f(s(t,n))}try{let s=new URLSearchParams;t&&s.set("process",t),n&&s.set("wheelSlug",n);let a=s.toString(),c=await l(`/api/v1/gallery-builds${a?`?${a}`:""}`,A());return f(c.results)}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>l(await h(m("/site")),await d()),getSiteBySlug:async e=>l(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listPages:async()=>f(await l(await h(m("/pages")),await d())),listPopups:async()=>l(await h(m("/popups")),await d()),listProductTemplates:async()=>{try{return await l(await h(m("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await l(await h(`${m("/dynamic-pages")}${t}`),await d())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await l(await h(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await l(await h(m(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await l(await h(m("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await l(await h(m("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[s,a]=await K(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return f(await l(s,a))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await l(m("/blog-posts")+n,await d())).map(a=>({...a,coverImage:O(a.coverImage)??""}))}catch(s){if(t)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async e=>{let t=await l(m(`/blog-posts/${e}`),await d());return{...t,coverImage:O(t.coverImage)??""}},createOrder:async e=>l(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>y(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>l(m("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>l(m("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>l(m("/checkouts/release"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>l(m("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>l(m("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>l(m("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>l(m("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>l(m("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>l(m("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>l(m("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>l(m("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>l(m("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>l(m("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>l(m("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>l(m("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>l(m("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>l(m("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>l(m("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>l(m("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>l(m("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>l(m("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),s=t.toString();try{return await l(await h(s?`${n}?${s}`:n),await d())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>l(m("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>l(m(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>l(m(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await l(m("/shipping-methods"),await d())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await l(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await xe(t,n)).data:l(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await xe(m("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Ie({method:"GET"}),t=await l(...await K(m("/header-settings"),{signal:e})),n=O(t.logoUrl),s=null,a=null;if(n&&H(n)){let c=await fe(n,e);c&&(s=c.reversed,a=c.inkIsDark)}return{...t,logoUrl:n,logoReversed:s,logoInkIsDark:a}},getThemeSettings:async()=>l(...await K(m("/theme-settings"))),getChatSettings:async()=>l(await h(m("/chat-settings")),await d())},Tn={listServices:async()=>{try{return await l(m("/bookings/services"),await d())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>l(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await d()),create:async e=>l(m("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>l(m(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>l(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),createPaymentIntent:async e=>l(m("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},j=class extends Error{constructor(n,s){super(`Slug "${n}" exists on ${s} websites; a site is required to pick one.`);this.slug=n;this.count=s;this.name="AmbiguousPageSlugError"}},I=(e,t,n)=>{let s=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${s?`?${s}`:""}`},$=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Bt=e=>`${$(e)}currencies/`,Dt="/api/storefront/media/ingest/",z=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function Mt(){let e=Se();if(!e)throw new z;return`${Dt}?${new URLSearchParams({site:e})}`}var Ht="X-Puck-Media-Manifest",Ee=Y.contentHash,q={"X-Media-Manifest":Ee,[Ht]:Ee},Cn=Me({});function Me(e){return(t,n={})=>{let s=Pt(),a=e.headers||s?{...s?{"Accept-Language":s}:{},...e.headers,...n.headers}:void 0;return l(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??ft()})}}function Wt(e={}){let t=Me(e),n=e.siteDrafts===!0,s=r=>I("header-settings",r,n),a=r=>I("theme-settings",r,n),c=r=>I("chat-settings",r,n),p=r=>I("social-settings",r,n);return{findPageBySlug:async(r,i,o)=>{let u=new URLSearchParams({slug:r});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new j(r,P.length);return P[0]??null},getPageById:(r,i)=>t(`/api/storefront/pages/${r}/`,{token:i}),saveLayout:(r,i,o,u,g)=>t(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(r,i,o)=>t(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(r,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:r,country:o}:{q:r})}`,{token:i}),listBlockSources:r=>t("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>t("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,i)=>t(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(r,i,o,u=!1)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(r,i)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(r,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:i}),headers:q,token:o}),getTemplate:(r,i)=>t(`/api/storefront/page-templates/${r}/`,{token:i}),saveTemplateLayout:(r,i,o)=>t(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:q,token:o}),listTemplatePages:async(r,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(r,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(r,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...i}),headers:q,token:o}),saveTemplatePageLayout:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:q,token:o}),deleteTemplatePage:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},createPage:(r,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:i,layout:o}),token:u}),deletePage:(r,i)=>t(`/api/storefront/pages/${r}/`,{method:"DELETE",token:i}),getHeaderSettings:(r,i)=>t(s(i),{token:r}),listMenus:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:r});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(r,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:r});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,C)=>P.sort_order-C.sort_order||P.name.localeCompare(C.name))},listForms:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,C)=>P.title.localeCompare(C.title))},listWheelSummaries:async(r,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:r});return f(g)},listProducts:async(r,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:r});return f(g)},getWheelDetail:async(r,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),R(f(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:r})))},updateHeaderSettings:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSite:(r,i)=>t($(r),{token:i}),listSites:async r=>{let i=await t("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(r,i)=>{let o=await t(Bt(r),{token:i});return Array.isArray(o)?o:[]},publishSite:(r,i)=>t(`${$(r)}publish/`,{method:"POST",token:i}),getSiteLiveState:(r,i)=>t(`${$(r)}live-state/`,{token:i}),getThemeSettings:(r,i)=>t(a(i),{token:r}),updateThemeSettings:(r,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getMyPreferences:async r=>(await t("/api/auth/me/",{token:r})).preferences??{},updateMyPreferences:(r,i)=>t("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:r}),token:i}),getChatSettings:(r,i)=>t(c(i),{token:r}),updateChatSettings:(r,i,o)=>t(c(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSocialSettings:(r,i)=>t(p(i),{token:r}),updateSocialSettings:(r,i,o)=>t(p(o),{method:"PATCH",body:JSON.stringify(r),token:i}),uploadHeaderLogo:(r,i,o)=>{let u=new FormData;return u.append("logo",r),t(s(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(r,i)=>t(s(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:i}),uploadMedia:async(r,i)=>{let o=new FormData;return o.append("file",r),t(Mt(),{method:"POST",body:o,token:i})},listMedia:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]}}}var On=Wt({siteDrafts:!0});function Jt(e){let t=e.trim();return t?`/api/v1/dealers?${new URLSearchParams({near:t}).toString()}`:"/api/v1/dealers"}async function vn(e){return we(await l(Jt(e)))}export{N as a,te as b,ne as c,w as d,Je as e,H as f,Se as g,Pe as h,sn as i,on as j,an as k,cn as l,ut as m,S as n,V as o,J as p,Sn as q,Pn as r,l as s,_t as t,De as u,Et as v,Ft as w,It as x,Lt as y,xn as z,kn as A,Tn as B,j as C,Cn as D,On as E,vn as F};
1
+ import{b as U,c as Q,f as X,h as O,m as Y,o as v}from"./chunk-SCTOV5CT.js";var N="".replace(/\/+$/,"");var B="x-forwarded-for";function ee(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var He="x-forwarded-host";function te(e,t,n){let s={};return e&&(s[He]=e),t&&n==="uncached"&&(s[B]=t),s}function ne(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var re="x-storefront-site",se="x-storefront-host",ie="x-storefront-preview";var We="shop_access_token",oe="shop_refresh_token",D=null;function M(){v.removeItem(We),v.removeItem(oe)}var w={getAccess(){return D},takeLegacyRefresh(){let e=v.getItem(oe);return M(),e},setTokens(e){D=e,M()},clear(){D=null,M()}};import{efficientClientOpen as lt}from"efficient-easel/screen/lib/session";function Je(e){return!!e.src}function R(e){let t=e.finishes.filter(Je);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(s=>s.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function Ge(e){return e.listable!==!1}function _(e){return e.map(R).filter(Ge)}var ue=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],me=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),E={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},de=12,pe=/\burl\(/i,ge=new RegExp(`(?<![-\\w])(${ue.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),he=new RegExp(`((?:^|[;{\\s"'])(?:${ue.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ke=/<svg\b([^>]*)>/i,Ve=/\bfill\s*[=:]/i;function je(e){let t=e.replace(ge,(n,s,a,c,p)=>{let r=ae(p);return r===null?n:`${s}${a}${c}${r}${c}`}).replace(he,(n,s,a)=>{let c=ae(a);return c===null?n:`${s}${c}`});return t=t.replace(Ke,(n,s)=>Ve.test(s)?n:`<svg fill="#ffffff"${s}>`),t}function ae(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||pe.test(n)||me.has(n))return null;let s=n in E?[...E[n],1]:ye(n);if(!s)return null;let[a,c,p,r]=s;if(Math.max(a,c,p)-Math.min(a,c,p)>de)return null;let i=ze(255-a,255-c,255-p,r);return t?`${i} !important`:i}function ze(e,t,n,s){if(s<1)return`rgba(${e}, ${t}, ${n}, ${s})`;let a=c=>c.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function ye(e){return e.startsWith("#")?Ze(e):e.startsWith("rgb")?Qe(e):e.startsWith("hsl")?Ye(e):null}function Ze(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(s=>s+s).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function Qe(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let c=a.map(r=>r.endsWith("%")?Math.round(parseFloat(r)/100*255):Math.round(parseFloat(r)));if(c.some(r=>Number.isNaN(r)))return null;let p=s?F(s):Xe(n);return[c[0],c[1],c[2],p]}function Xe(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?F(t[3]):1}function F(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ye(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let c=parseFloat(a[0]),p=parseFloat(a[1])/100,r=parseFloat(a[2])/100;if([c,p,r].some(P=>Number.isNaN(P)))return null;let i=s?F(s):a.length>=4?F(a[3]):1,[o,u,g]=et(c,p,r);return[o,u,g,i]}function et(e,t,n){let s=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,c=s*(1-Math.abs(a%2-1)),p=0,r=0,i=0;a<1?[p,r,i]=[s,c,0]:a<2?[p,r,i]=[c,s,0]:a<3?[p,r,i]=[0,s,c]:a<4?[p,r,i]=[0,c,s]:a<5?[p,r,i]=[c,0,s]:[p,r,i]=[s,0,c];let o=n-s/2;return[Math.round((p+o)*255),Math.round((r+o)*255),Math.round((i+o)*255)]}var ce=512*1024;function H(e){return/\.svg(\?|$)/i.test(e)}function tt(e){return`data:image/svg+xml,${encodeURIComponent(je(e))}`}function nt(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||pe.test(t)||me.has(t))return null;let n=t in E?[...E[t],1]:ye(t);if(!n)return null;let[s,a,c]=n;return Math.max(s,a,c)-Math.min(s,a,c)>de?null:(.2126*s+.7152*a+.0722*c)/255}function rt(e){let t=[],n=s=>{let a=nt(s);a!==null&&t.push(a)};for(let s of e.matchAll(ge))n(s[4]);for(let s of e.matchAll(he))n(s[2]);return t.length?t.reduce((s,a)=>s+a,0)/t.length<.5:null}var le=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function st(e){let t=e;for(let n=le.exec(t);n&&n[0].length>0;n=le.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function it(e,t){if(!H(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let s=Number(n.headers.get("content-length"));if(Number.isFinite(s)&&s>ce)return null;let a=await n.text();return a.length>ce?null:st(a)?a:null}catch{return null}}async function fe(e,t){let n=await it(e,t);return n===null?null:{reversed:tt(n),inkIsDark:rt(n)}}import{currentEaselSession as ot,setSessionBridgedSite as tn,setSessionDocumentSite as nn}from"efficient-easel/screen/lib/session";function Se(){return ot().siteId()}var Pe={title:"Find a dealer",placeholder:"Postcode or suburb",search:"Search",searching:"Searching\u2026",none:"No dealers to show yet.",notFound:"We couldn't find that place. Check the postcode or suburb and search again.",tryAgain:"We couldn't look up that place just now. Please try again.",website:"Website",map:"Dealers on the map"},b=e=>typeof e=="string"?e:"",W=e=>typeof e=="number"&&Number.isFinite(e)?e:null,at=["found","not_found","try_again"];function ct(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.name!="string"||!t.name?null:{id:b(t.id)||t.name,name:t.name,address:b(t.address),city:b(t.city),state:b(t.state),postcode:b(t.postcode),country:b(t.country),phone:b(t.phone),website:b(t.website),lat:W(t.lat),lng:W(t.lng),distanceKm:W(t.distanceKm)}}function we(e){if(!e||typeof e!="object")return{near:null,dealers:[]};let t=e,n=typeof t.near=="string"&&at.includes(t.near)?t.near:null,s=Array.isArray(t.dealers)?t.dealers:[];return{near:n,dealers:s.map(ct).filter(a=>a!==null)}}function sn(e){return e==="not_found"?Pe.notFound:e==="try_again"?Pe.tryAgain:null}function on(e){return e===null?null:e<10?`${e.toFixed(1)} km`:`${Math.round(e)} km`}function an(e){return[e.city,e.state,e.postcode].filter(Boolean).join(" ")}function cn(e){let t=e.map((o,u)=>({dealer:o,index:u})).filter(({dealer:o})=>o.lat!==null&&o.lng!==null);if(!t.length)return[];let n=t.map(({dealer:o})=>o.lat),s=t.map(({dealer:o})=>o.lng),[a,c]=[Math.min(...n),Math.max(...n)],[p,r]=[Math.min(...s),Math.max(...s)],i=(o,u,g)=>g===u?50:8+(o-u)/(g-u)*84;return t.map(({dealer:o,index:u})=>({id:o.id,index:u,left:i(o.lng,p,r),top:100-i(o.lat,a,c)}))}var ut="",S=class extends Error{constructor(t,n,s){super(n),this.status=t,this.data=s}},V="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",mt=new Set([502,503,504]),J=0,dt="This editor runs on its host's own backend, which does not serve this request.",pt=5e3,gt=15e3,ht=()=>typeof window>"u"?pt:gt;function Ie(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(ht())}var be=e=>e instanceof Error&&e.name==="TimeoutError",Ae=(e,t)=>mt.has(e)?V:t,yt=["admin","venue"],qe="admin";function Sn(e){qe=yt.includes(e)?e:"admin"}function ft(){return qe}var St=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,$e=null;function Pn(e){$e=e&&St.test(e)?e:null}function Pt(){return $e}function wt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:L(e,`site=${encodeURIComponent(t)}`)}async function l(e,t={}){let{token:n,baseUrl:s,headers:a,audience:c,...p}=t;if(typeof window<"u"&&!lt())throw new S(J,dt,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let r=typeof FormData<"u"&&p.body instanceof FormData,i;try{i=await fetch(`${s??ut}${wt(e)}`,{...p,headers:{...r?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...c===null?{}:{"X-Portal-Audience":c??"shop"},...a},signal:p.signal??Ie({...p,audience:c})})}catch(g){throw g instanceof TypeError||be(g)?new S(J,V,null):g}let o;try{o=await i.text()}catch(g){throw be(g)?new S(J,V,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new S(i.status,i.ok?"Expected JSON but received a non-JSON response":Ae(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Ae(i.status,i.statusText);throw new S(i.status,g,u)}return u}var x=null;async function Le(){return x||(x=bt().finally(()=>{x=null}),x)}async function bt(){let e=w.takeLegacyRefresh(),t=await _t.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Ue(){return w.getAccess()??Le()}async function y(e,t={}){let n;try{n=await Ue()}catch{throw w.clear(),new S(401,"Not signed in",null)}try{return await l(e,{...t,token:n})}catch(s){if(!(s instanceof S)||s.status!==401)throw s;try{let a=await Le();return await l(e,{...t,token:a})}catch{throw w.clear(),s}}}var At=100,Re=20;function Rt(e){if(!e)return null;try{return new URL(e,"http://page.invalid").searchParams.get("page")}catch{return null}}async function _e(e,t){let[n,s=""]=e.split("?"),a=[],c="1";for(let p=0;p<Re&&c;p++){let r=new URLSearchParams(s);r.set("page_size",String(At)),c!=="1"&&r.set("page",c);let i=await y(`${n}?${r.toString()}`);a.push(...i.results),c=Rt(i.next)}return c&&console.warn(`[${t}] stopped at ${Re} pages (${a.length} rows); list may be truncated`),a}async function xe(e,t={}){if(w.getAccess())try{return{data:await y(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await l(e,t),asShopper:!1}}async function ke(){let e=await y("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new S(403,"This session is not valid for this shop.",null);return e}var _t={login:(e,t)=>l("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>l("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await l("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Ue();return await ke(),e},me:ke,updateMe:e=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>y("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>y("/api/shop-portal/profile/"),updateMyProfile:e=>y("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>y("/api/shop-portal/delivery-locations/"),createAddress:e=>y("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>l("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>l("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>y("/api/products/brands/"),myOrders:()=>_e("/api/shop-portal/orders/","api.myOrders"),myOrder:e=>y(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>y(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>_e(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`,"api.myReturns"),createReturn:e=>y("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>y(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),y("/api/shop-portal/return-media/",{method:"POST",body:n})}};function f(e){if(typeof e=="string")return e.startsWith("/media/")?X(e):e;if(Array.isArray(e))return e.map(f);if(e&&typeof e=="object"){let t={};for(let[n,s]of Object.entries(e))t[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([a,c])=>[f(a),c])):f(s);return t}return e}var Ne=typeof window>"u"&&N!=="",xt=Ne?N:"",kt=Q,A=()=>({baseUrl:kt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var Be=100,Te=50;function Z(e,t,n){let s=new URLSearchParams;for(let[a,c]of Object.entries(t))c!=null&&c!==""&&s.set(a,String(c));return s.set("pageSize",String(Be)),n&&s.set("cursor",n),`/api/v1${e}?${s.toString()}`}function Tt(e,t){return Z("/wheels",{process:e},t)}var Ce=Be;function Ct(e,t){return Z("/wheels",{slug:e.join(",")},t)}function Ot(e,t,n){return Z("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function vt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function G(e,t,n=()=>!1,s=()=>!1){let a=[],c=null;try{for(let p=0;p<Te;p++){let r=await l(await t(c),await d());if(a.push(...r.results),c=vt(r.next),!c)break;if(s(a))return a}c&&console.warn(`[${e}] stopped at ${Te} pages (${a.length} rows); catalog may be truncated`)}catch(p){if(n(p))throw p;console.warn(`[${e}] product API unavailable, returning []`,p)}return a}var Oe=e=>e instanceof S&&e.status===400;function ve(e){return e.flatMap(t=>t.kind==="alloy-wheel"?_([t]):[t])}async function De(){return(await Et()).host}async function Et(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=c=>c?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(t.get(se)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:s,matchesRequestHost:s!==null&&s===a}}catch{return{host:null,matchesRequestHost:!1}}}async function Ft(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return ee((await e()).get(B))}catch{return null}}async function It(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(re)||null}catch{return null}}async function qt(){let e=await It();if(e)return`site=${encodeURIComponent(e)}`;let t=await De();return t?`host=${encodeURIComponent(t)}`:""}async function h(e){if(typeof window<"u"){let t=U();return t?L(e,`site=${encodeURIComponent(t)}`):e}return L(e,await qt())}function L(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var $t="preview";async function Lt(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(ie)}catch{return null}}async function Ut(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function K(e,t){let n=await Lt();if(n===null)return[await h(e),await d(t)];let s=L(await h(e),`${$t}=${encodeURIComponent(n)}`),{next:a,cache:c,...p}=t??{},r=await d({...p,cache:"no-store"}),i=await Ut();return i&&(r.headers={...r.headers,"user-agent":i}),[s,r]}async function Nt(e){if(!Ne)return;let[t,n]=await Promise.all([De(),Ft()]),s=te(t,n,e);return Object.keys(s).length>0?s:void 0}async function d(e){let t=await Nt(ne(e)),n={baseUrl:xt,...e};return t&&(n.headers={...t,...e?.headers}),n}var k=typeof window>"u";function T(e,t){let n=new URLSearchParams;for(let[a,c]of Object.entries(t))c!==void 0&&c!==""&&n.set(a,String(c));let s=n.toString();return`/api/v1/fitment${e}${s?`?${s}`:""}`}var xn={listMakes:async e=>{if(k){let{fitmentData:n}=await import("./fitment-data-ZWKG2FFA.js");return n.makes(e)}return(await l(T("/makes",{region:e}),A())).results},listModels:async(e,t)=>{if(k){let{fitmentData:s}=await import("./fitment-data-ZWKG2FFA.js");return s.models(e,t)}return(await l(T("/models",{make:e,region:t}),A())).results},listYears:async(e,t,n)=>{if(k){let{fitmentData:a}=await import("./fitment-data-ZWKG2FFA.js");return a.years(e,t,n)}return(await l(T("/years",{make:e,model:t,region:n}),A())).results},listModifications:async(e,t,n,s)=>{if(k){let{fitmentData:c}=await import("./fitment-data-ZWKG2FFA.js");return c.modifications(e,t,n,s)}return(await l(T("/modifications",{make:e,model:t,year:n,region:s}),A())).results},getStockFitment:async(e,t,n,s,a)=>{if(k){let{fitmentData:c}=await import("./fitment-data-ZWKG2FFA.js");return c.stockFitment(e,t,n,s,a)}return l(T("/stock-fitment",{make:e,model:t,year:n,modification:s,region:a}),A())}},kn={listWheels:async(e,t={})=>{let n=await G("products.listWheels",async s=>await h(Tt(e,s)),t.throwOnFailure?()=>!0:void 0,t.maxRows===void 0?void 0:s=>_([...s]).length>=t.maxRows);return _(f(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(r=>r.trim()).filter(Boolean))];if(n.length===0)return[];let s=[];for(let r=0;r<n.length;r+=Ce)s.push(n.slice(r,r+Ce));let a=await Promise.all(s.map(r=>G("products.listWheelsBySlug",async i=>await h(Ct(r,i)),t.throwOnFailure?()=>!0:Oe))),c=new Set(n),p=a.flat().filter(r=>c.has(r.slug));return _(f(p))},listCatalog:async(e,t,n={})=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let s=await G("products.listCatalog",async a=>await h(Ot(e,t,a)),n.throwOnFailure?()=>!0:Oe,n.maxRows===void 0?void 0:a=>ve([...a]).length>=n.maxRows);return ve(f(s))},getWheel:async e=>R(f(await l(await h(m(`/wheels/${e}`)),await d()))),getTyre:async e=>f(await l(await h(m(`/tyres/${e}`)),await d())),listBundles:async(e={})=>{try{return await l(await h(m("/bundles")),await d())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>l(await h(m(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:s}=await import("./gallery-builds-data-TD3QJK7L.js");return f(s(t,n))}try{let s=new URLSearchParams;t&&s.set("process",t),n&&s.set("wheelSlug",n);let a=s.toString(),c=await l(`/api/v1/gallery-builds${a?`?${a}`:""}`,A());return f(c.results)}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>l(await h(m("/site")),await d()),getSiteBySlug:async e=>l(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listPages:async()=>f(await l(await h(m("/pages")),await d())),listPopups:async()=>l(await h(m("/popups")),await d()),listProductTemplates:async()=>{try{return await l(await h(m("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await l(await h(`${m("/dynamic-pages")}${t}`),await d())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await l(await h(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await l(await h(m(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await l(await h(m("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await l(await h(m("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[s,a]=await K(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return f(await l(s,a))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await l(m("/blog-posts")+n,await d())).map(a=>({...a,coverImage:O(a.coverImage)??""}))}catch(s){if(t)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async e=>{let t=await l(m(`/blog-posts/${e}`),await d());return{...t,coverImage:O(t.coverImage)??""}},createOrder:async e=>l(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>y(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>l(m("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>l(m("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>l(m("/checkouts/release"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>l(m("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>l(m("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>l(m("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>l(m("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>l(m("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>l(m("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>l(m("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>l(m("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>l(m("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>l(m("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>l(m("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>l(m("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>l(m("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>l(m("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>l(m("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>l(m("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>l(m("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>l(m("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),s=t.toString();try{return await l(await h(s?`${n}?${s}`:n),await d())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>l(m("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>l(m(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>l(m(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await l(m("/shipping-methods"),await d())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await l(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await xe(t,n)).data:l(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await xe(m("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Ie({method:"GET"}),t=await l(...await K(m("/header-settings"),{signal:e})),n=O(t.logoUrl),s=null,a=null;if(n&&H(n)){let c=await fe(n,e);c&&(s=c.reversed,a=c.inkIsDark)}return{...t,logoUrl:n,logoReversed:s,logoInkIsDark:a}},getThemeSettings:async()=>l(...await K(m("/theme-settings"))),getChatSettings:async()=>l(await h(m("/chat-settings")),await d())},Tn={listServices:async()=>{try{return await l(m("/bookings/services"),await d())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>l(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await d()),create:async e=>l(m("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>l(m(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>l(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),createPaymentIntent:async e=>l(m("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},j=class extends Error{constructor(n,s){super(`Slug "${n}" exists on ${s} websites; a site is required to pick one.`);this.slug=n;this.count=s;this.name="AmbiguousPageSlugError"}},I=(e,t,n)=>{let s=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${s?`?${s}`:""}`},$=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Bt=e=>`${$(e)}currencies/`,Dt="/api/storefront/media/ingest/",z=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function Mt(){let e=Se();if(!e)throw new z;return`${Dt}?${new URLSearchParams({site:e})}`}var Ht="X-Puck-Media-Manifest",Ee=Y.contentHash,q={"X-Media-Manifest":Ee,[Ht]:Ee},Cn=Me({});function Me(e){return(t,n={})=>{let s=Pt(),a=e.headers||s?{...s?{"Accept-Language":s}:{},...e.headers,...n.headers}:void 0;return l(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??ft()})}}function Wt(e={}){let t=Me(e),n=e.siteDrafts===!0,s=r=>I("header-settings",r,n),a=r=>I("theme-settings",r,n),c=r=>I("chat-settings",r,n),p=r=>I("social-settings",r,n);return{findPageBySlug:async(r,i,o)=>{let u=new URLSearchParams({slug:r});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new j(r,P.length);return P[0]??null},getPageById:(r,i)=>t(`/api/storefront/pages/${r}/`,{token:i}),saveLayout:(r,i,o,u,g)=>t(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(r,i,o)=>t(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(r,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:r,country:o}:{q:r})}`,{token:i}),listBlockSources:r=>t("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>t("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,i)=>t(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(r,i,o,u=!1)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(r,i)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(r,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:i}),headers:q,token:o}),getTemplate:(r,i)=>t(`/api/storefront/page-templates/${r}/`,{token:i}),saveTemplateLayout:(r,i,o)=>t(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:q,token:o}),listTemplatePages:async(r,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(r,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(r,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...i}),headers:q,token:o}),saveTemplatePageLayout:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:q,token:o}),deleteTemplatePage:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},createPage:(r,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:i,layout:o}),token:u}),deletePage:(r,i)=>t(`/api/storefront/pages/${r}/`,{method:"DELETE",token:i}),getHeaderSettings:(r,i)=>t(s(i),{token:r}),listMenus:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:r});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(r,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:r});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,C)=>P.sort_order-C.sort_order||P.name.localeCompare(C.name))},listForms:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,C)=>P.title.localeCompare(C.title))},listWheelSummaries:async(r,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:r});return f(g)},listProducts:async(r,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:r});return f(g)},getWheelDetail:async(r,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),R(f(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:r})))},updateHeaderSettings:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSite:(r,i)=>t($(r),{token:i}),listSites:async r=>{let i=await t("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(r,i)=>{let o=await t(Bt(r),{token:i});return Array.isArray(o)?o:[]},publishSite:(r,i)=>t(`${$(r)}publish/`,{method:"POST",token:i}),getSiteLiveState:(r,i)=>t(`${$(r)}live-state/`,{token:i}),getThemeSettings:(r,i)=>t(a(i),{token:r}),updateThemeSettings:(r,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getMyPreferences:async r=>(await t("/api/auth/me/",{token:r})).preferences??{},updateMyPreferences:(r,i)=>t("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:r}),token:i}),getChatSettings:(r,i)=>t(c(i),{token:r}),updateChatSettings:(r,i,o)=>t(c(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSocialSettings:(r,i)=>t(p(i),{token:r}),updateSocialSettings:(r,i,o)=>t(p(o),{method:"PATCH",body:JSON.stringify(r),token:i}),uploadHeaderLogo:(r,i,o)=>{let u=new FormData;return u.append("logo",r),t(s(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(r,i)=>t(s(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:i}),uploadMedia:async(r,i)=>{let o=new FormData;return o.append("file",r),t(Mt(),{method:"POST",body:o,token:i})},listMedia:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]}}}var On=Wt({siteDrafts:!0});function Jt(e){let t=e.trim();return t?`/api/v1/dealers?${new URLSearchParams({near:t}).toString()}`:"/api/v1/dealers"}async function vn(e){return we(await l(Jt(e)))}export{N as a,te as b,ne as c,w as d,Je as e,H as f,Se as g,Pe as h,sn as i,on as j,an as k,cn as l,ut as m,S as n,V as o,J as p,Sn as q,Pn as r,l as s,_t as t,De as u,Et as v,Ft as w,It as x,Lt as y,xn as z,kn as A,Tn as B,j as C,Cn as D,On as E,vn as F};