efficient-storefront-blocks 0.98.0 → 0.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/chunks/EditorPreviewCheckout-EBG3NMJI.js +4 -0
- package/dist/chunks/{SiteEditorProvider-LW5QSBKM.js → SiteEditorProvider-YAIB64UV.js} +1 -1
- package/dist/chunks/chunk-5VSNQZU6.js +1 -0
- package/dist/chunks/chunk-DOJJTEJV.js +1 -0
- package/dist/chunks/{chunk-4QN263UJ.js → chunk-KRMWJLBM.js} +2 -2
- package/dist/chunks/{fitment-data-BRGBDG7Y.js → fitment-data-PXY35OVC.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SearchBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/BookingBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/DealerFinder/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/DealerFinder/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/index.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/popup-look-fields.d.ts +1 -0
- package/dist/editor/lib/document/popup-look-fields.js +1 -1
- package/dist/editor/lib/document/text-kind-style-rows.d.ts +5 -0
- package/dist/editor/lib/document/text-kind-style-rows.js +1 -0
- package/dist/editor/lib/storefront-editor-words.d.ts +4 -2
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +31 -31
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +136 -12
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CatalogFilterBarSection.js +1 -1
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/CouponField.d.ts +2 -1
- package/dist/render/components/CouponField.js +1 -1
- package/dist/render/components/CurrencyContext.d.ts +3 -0
- package/dist/render/components/CurrencyContext.js +1 -1
- package/dist/render/components/DealerFinderSection.d.ts +18 -0
- package/dist/render/components/DealerFinderSection.js +1 -0
- package/dist/render/components/FooterMenu.d.ts +5 -3
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FormBlock.d.ts +4 -1
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/HeaderToolBlocks.d.ts +4 -2
- package/dist/render/components/HeaderToolBlocks.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +7 -2
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/PhoneSheet.d.ts +16 -0
- package/dist/render/components/PhoneSheet.js +1 -0
- package/dist/render/components/PreOrderPanel.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/SectionGroupBody.d.ts +2 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/Subscribe.d.ts +1 -0
- package/dist/render/components/Subscribe.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/useTaxNote.d.ts +1 -0
- package/dist/render/components/card-pieces/useTaxNote.js +1 -0
- package/dist/render/components/catalog/CatalogFilterBar.d.ts +5 -1
- package/dist/render/components/catalog/CatalogFilterBar.js +1 -1
- package/dist/render/components/catalog/CatalogFilterContext.d.ts +2 -0
- package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/PriceRange.d.ts +6 -1
- package/dist/render/components/catalog/PriceRange.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +2 -0
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/fitment/PickerField.js +1 -1
- package/dist/render/components/formSubmission.d.ts +4 -2
- package/dist/render/components/formSubmission.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +0 -3
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicWheelDiagram.js +1 -1
- package/dist/render/components/submit/SubmitRegions.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.d.ts +2 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +15 -7
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.d.ts +6 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.js +1 -1
- package/dist/render/lib/api/index.d.ts +4 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +1 -0
- package/dist/render/lib/booking/text-kinds.js +1 -1
- package/dist/render/lib/catalog/tax-note.d.ts +4 -0
- package/dist/render/lib/catalog/tax-note.js +1 -0
- package/dist/render/lib/content/article-page-seed.js +1 -1
- package/dist/render/lib/content/menu-row.d.ts +16 -0
- package/dist/render/lib/content/menu-row.js +1 -1
- package/dist/render/lib/content/text-kind-vars.d.ts +4 -0
- package/dist/render/lib/content/text-kind-vars.js +1 -0
- package/dist/render/lib/document/blocks/commerce/SearchBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/service/DealerFinder/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/render.d.ts +4 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/render.js +1 -0
- package/dist/render/lib/document/blocks/service/SiteHeader/render.js +1 -1
- package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/metas.js +1 -1
- package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/renders.js +1 -1
- package/dist/render/lib/document/blocks/text-part-shapes.json +10 -0
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -1
- package/dist/render/lib/popup/text-kind-style.js +1 -1
- package/dist/render/lib/sections/dealer-finder.d.ts +41 -0
- package/dist/render/lib/sections/dealer-finder.js +1 -0
- package/dist/render/lib/submit/text-kinds.js +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.d.ts +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.js +1 -1
- package/dist/render/lib/wheels/plp-filters.d.ts +5 -0
- package/dist/render/lib/wheels/plp-filters.js +1 -1
- package/dist/render/lib/wheels/wheel-sheet.d.ts +3 -0
- package/dist/render/lib/wheels/wheel-sheet.js +1 -0
- package/dist/words.d.ts +4 -2
- package/dist/words.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/EditorPreviewCheckout-2FW4VEOK.js +0 -4
- package/dist/chunks/chunk-PWSMCGXO.js +0 -1
- package/dist/chunks/chunk-SEIKSSUW.js +0 -1
- /package/dist/chunks/{chunk-XEZ7BYVZ.js → chunk-B2IYTOE3.js} +0 -0
- /package/dist/chunks/{chunk-4QN263UJ.js.LEGAL.txt → chunk-KRMWJLBM.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-GOHV3G3C.js → chunk-QP2F42DV.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.99.1 - 2026-11-12
|
|
4
|
+
|
|
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.
|
|
6
|
+
|
|
7
|
+
**For hosts:**
|
|
8
|
+
- A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. No other step.
|
|
9
|
+
- admin-portal: no new step.
|
|
10
|
+
- No stored page moves.
|
|
11
|
+
|
|
12
|
+
- **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
|
+
- **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
|
+
- **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.
|
|
15
|
+
|
|
16
|
+
## 0.99.0 - 2026-11-12
|
|
17
|
+
|
|
18
|
+
**A major for hosts (major version zero, so a minor number):** the web-builder peer moves to `^67.4.0` (was `^67.3.0`) (#489). `wheelSheetOf` moves to `render/lib/wheels/wheel-sheet` (#489). `MENU_STYLE_PLAIN` and `MENU_STYLE_TABS` move from `render/components/FooterMenu` to `render/lib/content/menu-row` (#505). The editor words lose "Max" and "Min" and gain 3 phrases (#493, #505). From main at `6b144596`: #489, #491, #492, #493, #494, #495, #496, #497, #498, #499, #501, #502, #503, #505, #506.
|
|
19
|
+
|
|
20
|
+
**For hosts:**
|
|
21
|
+
- Install web-builder 67.4.0 or later with this release (#489). Easel `^34.1.0` and shell `^12.33.0` stay.
|
|
22
|
+
- A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. In the same bump:
|
|
23
|
+
- `package.json`: efficient-web-builder `67.4.0` (or later 67); `packages/storefront-blocks/vendored.json` and `packages/storefront-blocks/package.json` peers to match.
|
|
24
|
+
- `scripts/test-general-sections-import-boundary.ts`: when web-builder 67.4.0 and this release arrive in one bump, no WheelDiagram line is needed in `scripts/not-registered-here.ts` or `scripts/registered-not-catalogued.ts` (#489).
|
|
25
|
+
- `scripts/test-plp-rail-scrolls.tsx` and the harness snapshots `scripts/harness/plp-rail-scroll.html` and `tyre-size-rail.html` hold the old price slider: re-pin them. A test that finds the price boxes by "Minimum price" / "Maximum price" now finds the thumbs; the boxes are "Minimum price value" / "Maximum price value" (#493).
|
|
26
|
+
- A host catalogue typed from the blocks phrases drops "Max" and "Min" and adds "Header's own", "Icon and text" and "Menu button" (#493, #505).
|
|
27
|
+
- A host that imports `MENU_STYLE_PLAIN` or `MENU_STYLE_TABS` from `render/components/FooterMenu`, or `wheelSheetOf` from `render/components/pdp-dynamic/DynamicSpecTable`, imports the new path. 0 imports in the storefront and admin-portal.
|
|
28
|
+
- admin-portal: no new step; the 0.98.0 host steps still apply when it raises its blocks range.
|
|
29
|
+
- No stored page moves.
|
|
30
|
+
|
|
31
|
+
- **BREAKING: peer `efficient-web-builder` `^67.4.0`** (#489). Peer and dev, here and in `package/`. The Wheel Diagram is in the commerce set.
|
|
32
|
+
- **BREAKING: module paths move** (#489, #505): `wheelSheetOf` to `render/lib/wheels/wheel-sheet`; `MENU_STYLE_PLAIN` and `MENU_STYLE_TABS` to `render/lib/content/menu-row`.
|
|
33
|
+
- **BREAKING: editor words** (#493, #505): "Max" and "Min" go; "Header's own", "Icon and text" and "Menu button" come.
|
|
34
|
+
- **The header Menu can be a Menu button with a left side panel** (#505). Menu style gains Menu button with its own phone value (`menuStylePhone`); the panel has its own width and tint (`menuPanelWidth`, `menuPanelTintColor`). Search Show as gains Icon and text (`icon_text`) with a phone value. The header tool words take a text style (`toolTextStyle`). New exports `MENU_STYLE_BUTTON`, `MENU_PANEL_WIDTH_DEFAULT`, `MENU_PANEL_TINT_OPACITY_DEFAULT`, `MenuShow`, `menuShowClasses` (menu-row), `menuPanelLookFields`, `SearchStyle`, `components/PhoneSheet`, `lib/content/text-kind-vars`.
|
|
35
|
+
- **One price control with min and max in every place** (#493). New optional props `PriceRange` `bounds` / `boxes`, `PlpSidebar` `onPriceMin`, `CatalogFilterBar` `priceBounds`; `PlpActiveChips` takes `onPriceMin`; the catalog filter context carries `reportPrices` and `priceOptions`. New exports `plpPricedAmounts`, `plpPriceBoundsOf`. `UnmappableCatalogFacet` is now `"lugs"`.
|
|
36
|
+
- **Signup forms tell the applicant what became of their account** (#506): approved, pending or rejected. New export `AccountOutcome`; the form submission keeps `account`.
|
|
37
|
+
- **A mistyped newsletter email gets its own message** (#492). New export `SIGNUP_CHECK_EMAIL`.
|
|
38
|
+
- **Car-fit listings stay on screen when the car check fails** (#499): an outage is not read as "no fit". `products.listCatalog` takes list read options; new type `VehicleCatalog`. The retry button counts as a button (#499).
|
|
39
|
+
- **A saved All-products gallery keeps its cards when products cannot be read** (#498).
|
|
40
|
+
- **Phone menus hold focus** (#495): the header phone menu and the footer sheet are modal dialogs with a focus trap.
|
|
41
|
+
- **The Submit Build send button is always drawn** (#496).
|
|
42
|
+
- **Each car picker box says its label and its value** to a screen reader (#494).
|
|
43
|
+
- **Shop fields with no visible label have a name for screen readers** (#503). Nothing changes on screen.
|
|
44
|
+
- **My orders and each order's returns list read every page** (#502): `myOrders` and `myReturns` follow the next page, 100 a page, up to 20 pages.
|
|
45
|
+
- **One builder for the Text style rows** (#497): new editor module `lib/document/text-kind-style-rows`. No look or stored change.
|
|
46
|
+
- `useCurrency` takes `{ optional: true }` and then returns null outside a provider.
|
|
47
|
+
- Internal (no change to the published package): seeds import `labelLook` (#491); guards import `pressWithheld` from web-builder (#501).
|
|
48
|
+
|
|
3
49
|
## 0.98.0 - 2026-11-11
|
|
4
50
|
|
|
5
51
|
**A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder` `^67.3.0` (was `^66.0.0`), `efficient-easel` `^34.1.0` (was `^33.0.0`) and `efficient-shell` `^12.33.0` (was `^12.30.0`) (#470, #486). The editor words change what a host types (#482). The wheel card frame needs a product card state (#488). From main at `86c28134`: #474, #478, #479, #470, #480, #476, #481, #482, #483, #484, #486, #488.
|
|
@@ -0,0 +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.
|
|
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
|
+
`);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
|
+
${_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-
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as W,f as vt,n as xe,v as Et,x as Pt,y as wt}from"./chunk-DOJJTEJV.js";import{Ga as ht,ae as yt,ce as Ke,de as ze,fe as bt,se as Ce,te as xt,we as Ve,xe as St}from"./chunk-B2IYTOE3.js";import{c as Ct,n as ce}from"./chunk-QP2F42DV.js";import{createContext as wn,useContext as kt,useEffect as Rn,useMemo as Se,useState as Lt}from"react";function _t(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function de(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Xe=4,qr=1,Gr={unit:"set",spares:0,spareSide:"left"};function Nt(e){return e.unit==="single"?1:Xe+e.spares}function Kr(e,t){return[{partNumber:e.partNumber,wheels:Nt(t),prices:e.prices}]}function zr(e,t){let n=Nt(t)-Xe;if(n<=0||e.length===0)return e;let r=vn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function vn(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function En(e,t){return t.spares>0?`${e} + spare`:e}function Vr(e){return e.unit==="single"?"Single":En(`Set of ${Xe}`,e)}var Xr="data-add-to-basket",Ye=9,Pn="en",Rt=new Map;function Te(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Rt.get(r);return o||(o=new Intl.NumberFormat(Pn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Rt.set(r,o)),o}function Q(e,t,n=0){return Te(t,0,n).format(e)}function Yr(e,t){return Te(t).format(e)}function Qr(e,t){let n=e.savings[t];if(n===void 0)return null;let r=Q(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as In}from"react/jsx-runtime";var _n="storefront-country",It=_n,Qe=wn(null);function Nn(e){return At(e,"catalogue")}function Ln(e){return At(e,"money")}function At(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Te(o,t==="money"?i:0,i).format(r)}}function to({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Se(()=>t??[],[t]),a=Se(()=>n??[],[n]),l=Se(()=>r||i.find(f=>f.isDefault)?.code||i[0]?.code||"",[r,i]),c=Se(()=>o||a.find(f=>f.isDefault)?.code||a[0]?.code||"",[o,a]),[u,p]=Lt(c),[C,d]=Lt(!1);Rn(()=>{let f=ce.getItem(It);f&&a.some(M=>M.code===f)&&p(f),d(!0)},[a]);function E(f){p(f),ce.setItem(It,f)}let L=Se(()=>{let f=a.find(_=>_.code===u)??null,M=f?.currency,I=M&&i.some(_=>_.code===M)?M:l,T=Nn(i),R=Ln(i);return{country:u,currency:I,setCountry:E,currencies:i,countries:a,activeCountry:f,formatPrice:(_,x)=>T(_,x??I),formatMoney:(_,x)=>R(_,x??I),ready:C}},[u,i,a,l,C]);return In(Qe.Provider,{value:L,children:e})}function Tt(e){let t=kt(Qe);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function no(){return kt(Qe)?.country??""}import{createContext as Gn,useCallback as v,useContext as Kn,useEffect as j,useMemo as Xt,useRef as fe,useState as N}from"react";function Ot(){return"/edit"}function Dt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ft="We'll confirm this discount when you place your order.",so="Confirmed at checkout";function lo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Mt="coupon_code: ";function uo(e){return!(e instanceof xe)||e.status!==400||!e.message.startsWith(Mt)?null:e.message.slice(Mt.length)}function Ut(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Oe="Price on request",An="Request a quote",$t="from ",mo="From ",go="each",Ht="Free";function je(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ze(e,t){let n=e?.[t];return je(n)?n:null}function ho(e,t,n,r){let o=Ze(e,n),i=Ze(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function yo(e,t,n,r){if(n==null&&r==null)return!0;let o=Ze(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Tn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function On(e,t,n){if(!je(e))return Tn;let r=je(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function bo(e,t,n=""){return!e.priced||e.unit==null?Oe:`${n}${Q(e.unit,t)}`}function Co(e,t){return e.was==null?null:Q(e.was,t)}function Mn(e,t,n=1){let r=de(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,l)=>a+l.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Dn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function xo(e,t,n,r=1){let o=On(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=Mn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Dn,fromSetTotal:i}}function Fn(e,t){return!e.priced||e.unit==null?Oe:`${e.isFrom?$t:""}${Q(e.unit,t)}`}function So(e,t){return e.was==null?null:Q(e.was,t)}function vo(e,t){return!e.priced||e.unit==null?An:Fn(e,t)}function Eo(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let a=i.prices?.[t];if(typeof a!="number")return null;r+=a*i.quantity}let o=Q(r-n,t);return{was:Q(r,t),amount:e.savingIsFrom?`${$t}${o}`:o}}var Un=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Bt(e){return Un.test(e.trim())}var Wt="sf:ga-purchases",$n=20;function Gt(){return typeof window>"u"||window.parent!==window}function ve(...e){try{if(Gt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Hn(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:de(e.components,t)??0,quantity:e.qty}}function Je(e,t){return e.filter(Me).map(n=>Hn(n,t))}function Lo(e){ve("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function Kt(e,t){let n=Je([e],t);n.length!==0&&ve("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Io(e){let t=Je(e.lines,e.currency);t.length!==0&&ve("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var qt=new Set;function Bn(e){if(qt.has(e))return!1;qt.add(e);try{let t=JSON.parse(ce.getItem(Wt)??"[]");if(t.includes(e))return!1;ce.setItem(Wt,JSON.stringify([...t,e].slice(-$n)))}catch{}return!0}function ko(e){let t=e.confirmation;if(Gt()||!Bn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ve("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Je(e.lines,n)}),e.adsSendTo&&ve("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Wn="Arranged after review",zt="Calculated at checkout",qn=zt,Oo=zt;function Vt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Mo(e){switch(e){case"arranged":return Wn;case"pending":return qn;case"free":return Ht;case"charged":return null}}import{jsx as Yn}from"react/jsx-runtime";var zn=400,Vn=400,Xn=1500;function Me(e){return(e.components?.length??0)>0}function Yt(e,t){return{code:e,valid:t.valid,deferred:Dt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function jt(e,t){return de(e.components,t)}function et(e,t){let n=jt(e,t);return n===null?null:n*e.qty}function Qt(e){return e!=="tyre"}var Zt=Gn(null);function Xo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Tt(),[i,a]=N(t),[l,c]=N([]),[u,p]=N([]),[C,d]=N([]),[E,L]=N(!1),[f,M]=N(!1),[I,T]=N(!1),[R,_]=N(!1),[x,K]=N(null),[ie,D]=N(0),b=v(()=>D(s=>s+1),[]),[P,y]=N(void 0),[U,_e]=N(null),[S,$]=N(null),[Ne,z]=N(!1),[w,pe]=N(null),ae=fe(void 0),H=v(()=>a(!0),[]),ee=v(()=>a(!1),[]),me=v(()=>a(s=>!s),[]);j(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let V=Ot(),Le=fe(V);j(()=>{Le.current!==V&&(Le.current=V,t||ee())},[V,t,ee]);let X=v(s=>{_e(m=>m?.country===s?.country&&m?.subdivision===s?.subdivision&&m?.postcode===s?.postcode?m:s)},[]),q=v(s=>{_(!0),Qt(s)&&T(!0)},[]),Ie=I||l.some(s=>Qt(s.kind)),F=R||l.length>0;j(()=>{if(t||!Ie||E)return;let s=!0;return W.listWheels().then(m=>{s&&(p(m),L(!0))}),()=>{s=!1}},[t,Ie,E]),j(()=>{if(t||!F||f)return;let s=!0;return W.listBundles().then(m=>{s&&(d(m),M(!0))}),()=>{s=!1}},[t,F,f]);let G=x?.deliveryOptions??[],se=x?.courier??null;j(()=>{x&&pe(s=>s&&G.some(m=>m.id===s)?s:G[0]?.id??null)},[x]);let te=v(()=>l.filter(Me).flatMap(s=>_t(s.components,s.qty)),[l]),ge=v(async(s,m)=>{let h=s.trim().toUpperCase();if(!h)return;let g=te();if(g.length===0){$({code:h,valid:!1,message:"Add a wheel to the cart first."});return}z(!0),ae.current=m;try{let A=await W.validateCoupon({code:h,items:g,currency:n,shippingMethodId:w??void 0,customerEmail:m});$(Yt(h,A))}catch{$({code:h,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{z(!1)}},[te,n,w]),he=v(()=>{$(null),ae.current=void 0},[]),ye=v(s=>{if(!S)return;let{code:m}=S;$(h=>h&&h.code===m?{code:m,valid:!1,refused:!0,message:s}:h)},[S]);j(()=>{if(!S||S.refused)return;let s=S.code,m=g=>g!==null&&g.code===s&&!g.refused,h=setTimeout(async()=>{let g=te();if(g.length===0){$(A=>m(A)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:A);return}z(!0);try{let A=await W.validateCoupon({code:s,items:g,currency:n,shippingMethodId:w??void 0,customerEmail:ae.current});$(be=>m(be)?Yt(s,A):be)}catch{}finally{z(!1)}},zn);return()=>clearTimeout(h)},[l,n,w]);let ne=S&&!S.refused?S.code:void 0;j(()=>{if(t)return;let s=!0,m=setTimeout(async()=>{let h=te();if(h.length===0){K(null),y(void 0);return}try{let g=await W.quoteCart({items:h,currency:n,shippingMethodId:w??void 0,couponCode:ne,customerEmail:ae.current||void 0,country:U?.country||r||void 0,subdivision:U?.country&&U.subdivision||void 0,postcode:U?.country&&U.postcode||void 0});if(!s)return;K(g)}catch{if(!s)return}y(ne)},Vn);return()=>{s=!1,clearTimeout(m)}},[l,n,w,ne,r,U,ie]);let le=v(s=>{c(m=>{let h=m.findIndex(g=>g.id===s.id);return h===-1?[...m,s]:m.map((g,A)=>A===h?{...g,qty:Math.min(Ye,g.qty+s.qty)}:g)}),Kt(s,n)},[n]),ke=v(s=>{c(m=>m.filter(h=>h.id!==s))},[]),k=v((s,m)=>{let h=Math.max(1,Math.min(Ye,m));c(g=>g.map(A=>A.id===s?{...A,qty:h}:A))},[]),Y=v(s=>{c(s)},[]),[re,gn]=N(null),st=fe(null);st.current=re;let B=fe(null),We=fe(""),lt=v((s,m)=>{let h=s.trim().toLowerCase();Bt(h)&&gn(g=>g&&g.email===h&&g.firstName===(m??"")?g:{email:h,firstName:m??""})},[]);j(()=>{if(t||!re)return;let s=Ut(l.filter(Me),g=>et(g,n)===null?Oe:o(et(g,n),n)),m={email:re.email,firstName:re.firstName,currency:n,items:s},h=JSON.stringify(m);if(h!==We.current)return B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{B.current=null,We.current=h,W.captureCart(m).catch(g=>{})},Xn),()=>{B.current&&(clearTimeout(B.current),B.current=null)}},[l,re,n,t]);let ut=v(()=>{B.current&&(clearTimeout(B.current),B.current=null);let s=st.current;s&&(We.current="",W.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(m=>{}))},[n]),ct=Xt(()=>{let s=l.reduce((O,ue)=>{let Ae=et(ue,n);return Ae===null?O:O+Ae},0),m=l.some(O=>jt(O,n)===null),h=l.reduce((O,ue)=>O+ue.qty,0),g=S?.valid?S.effects:void 0,A=g?Math.min(s,Number(g.discountAmount)):0,be=x?.bundleDiscount??0,yn=x?.appliedBundles??[],qe=!!g?.freeShipping,mt=G.find(O=>O.id===w),gt=qe?0:x?.shipping??mt?.amount??0,bn=Vt({quoted:x!==null,optionCount:G.length,chosenAmount:mt?.amount,couponWaivesFreight:qe}),Ge={};for(let O of g?.freeUnits??[])Ge[O.partNumber]=(Ge[O.partNumber]??0)+O.quantity;let Cn=x?.tax??null,xn=x?x.grandTotal:s-A-be+gt;return{sets:h,units:l.reduce((O,ue)=>O+(ue.components??[]).reduce((Ae,Sn)=>Ae+Sn.wheels*ue.qty,0),0),subtotal:s,hasUnpricedLine:m,discount:A,bundleDiscount:be,appliedBundles:yn,shipping:gt,freeShipping:qe,shippingStatus:bn,freeUnitsByPartNumber:Ge,tax:Cn,grand:xn,repricing:!!S?.refused&&x!==null&&P===S?.code,currency:n}},[l,n,S,G,w,x,P]),dt=fe(!0),ft=v(s=>{dt.current=s},[]),pt=v(s=>{le(s),dt.current&&H()},[le,H]),hn=Xt(()=>({isOpen:i,preview:t,open:H,close:ee,toggle:me,items:l,catalog:u,bundles:C,warmCatalog:q,add:le,addAndOpen:pt,setAutoOpen:ft,remove:ke,setQty:k,replaceItems:Y,identify:lt,clearCapturedCart:ut,coupon:S,applyCoupon:ge,removeCoupon:he,refuseCoupon:ye,couponBusy:Ne,deliveryOptions:G,setQuoteDestination:X,courier:se,requote:b,shippingMethodId:w,setShippingMethodId:pe,totals:ct}),[i,t,H,ee,me,l,u,C,q,le,pt,ft,ke,k,Y,lt,ut,S,ge,he,ye,Ne,G,X,se,b,w,ct]);return Yn(Zt.Provider,{value:hn,children:e})}function Jt(){let e=Kn(Zt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as ar}from"react";function en(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,c]of e){if(c.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Qn=6e4,jn=5e3,Zn=500,De=new Map;async function Jn(e){let{host:t,matchesRequestHost:n}=await Et();if(!t)return"";let r=await Pt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var er=e=>e.includes("|slug:")||e.includes("|xhost:");async function tn(e,t){if(await wt()!==null)return t();let n=await Jn(e);if(!n)return t();let r=Date.now(),o=De.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?jn:Qn,c=De.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,p=a&&u?u:i;return en(De,Zn,er,r),De.set(n,{load:p,expiresAt:r+l,lastGood:u}),p}var tr=404;function nr(e){if(e instanceof xe&&e.status===tr)return{state:"absent"};let t=e instanceof xe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var rr="[storefront:chrome-load-failed]";function or(e,t){console.error(`${rr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function nn(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=nr(o);return i.state==="failed"&&or(e,i),{value:n,outcome:i}}}function ir(e){return e==="production"?"silent":"banner"}var ni=ir("production");function sr(e,t){return e?.trim()||t}function ci({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=sr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var lr={name:Ce,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:Ve},di=ar(async()=>tn("site",()=>nn("site",async()=>{let e=await W.getSite();return{name:xt(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:St(e.socialLinks)}},lr)));var fi={name:Ce,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:Ve};import{jsx as ur}from"react/jsx-runtime";function mi({tone:e="bad",role:t,children:n}){return ur("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Pe,jsxs as tt}from"react/jsx-runtime";import{useEffect as Fe,useId as pr,useRef as on,useState as Ue}from"react";import{useRootIsDark as mr}from"efficient-shell/theme";import{efficientClientOpen as cr}from"efficient-easel/screen/lib/session";var Ee=new Map,dr=64;async function fr(e){if(!cr())return null;try{let t=await fetch(`${Ct()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function rn(e){let t=Ee.get(e);if(t)return t;let n=fr(e);if(Ee.set(e,n),Ee.size>dr){let r=Ee.keys().next();r.done||Ee.delete(r.value)}return n}var gr=202/22,hr=.88,Ti=16,yr="invert(1)";function Oi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:l,size:c="medium",sizePx:u,sizeUnit:p,wordmark:C,siteName:d=Ce,fitToContainer:E=!1,fitWordmarkToContainer:L=!1,fitFloorPx:f,hideClass:M,hideAttrs:I}){let T=C&&C.trim()?C.trim():d,[R,_]=Ue(null),x=on(null),K=k=>{x.current=k};Fe(()=>{_(x.current?.ownerDocument??null)},[]);let ie=!mr({doc:R,whenUnset:!0}),D=n&&n.trim()?n.trim():null,b=!!D&&vt(D),P=i??(ie&&t),y=o&&o.trim()?o.trim():null,U=r&&!y,_e=`logo-color-${pr().replace(/[^A-Za-z0-9_-]/g,"")}`,S=U&&b&&D&&a!=null?{reversed:a,inkIsDark:l??null}:null,$=S!==null,[Ne,z]=Ue(null);Fe(()=>{if(!U||!D||!b||$){z(null);return}let k=!1;return z(null),rn(D).then(Y=>{k||z(Y)}),()=>{k=!0}},[U,D,b,$]);let w=S??Ne,pe=!!w&&w.inkIsDark!==null&&(P?!w.inkIsDark:w.inkIsDark),ae=U&&!!D&&!b&&!P,H=pe&&w?w.reversed:D,ee=H?[H]:[],[me,V]=Ue(0);Fe(()=>{V(0)},[D,pe]);let Le=e==="footer"?ze:Ke[c],X=u&&u>0?u:Le,q=(u&&u>0?ht(u,p,"size",bt,{floor:!0}):null)??`${X}px`,Ie=Math.round(X*gr),F=me<ee.length?ee[me]:null,[G,se]=Ue(H),te=F!==null&&F===G,ge=on(null);Fe(()=>{let k=ge.current;if(!k||!k.complete)return;if(k.naturalWidth>0||k.naturalHeight>0){se(F);return}let Y=!1;return k.decode().then(()=>!Y&&se(F),()=>!Y&&V(re=>re+1)),()=>{Y=!0}},[F]);let he=E||L,ye=`calc(100cqi / ${((T.length+1)*hr).toFixed(2)})`,ne=he&&f&&f>0?q===`${X}px`?`${Math.min(f,X)}px`:`min(${f}px, ${q})`:null,le=he?ne===null?`min(${q}, ${ye})`:`clamp(${ne}, ${ye}, ${q})`:q,ke=tt("span",{className:`font-display font-bold tracking-[0.18em] ${ne===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:le,lineHeight:1,...y?{color:y}:{}},"aria-label":T,children:[T,Pe("span",{className:"text-accent",style:y?{color:y}:void 0,children:"."})]});return tt("span",{ref:K,className:yt("inline-flex items-center",M??""),...I,children:[!te&&ke,y&&F&&Pe("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:tt("filter",{id:_e,colorInterpolationFilters:"sRGB",children:[Pe("feFlood",{style:{floodColor:y}}),Pe("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&Pe("img",{ref:ge,src:F,alt:T,width:Ie,height:X,className:"shrink-0 object-contain",style:{...te?{height:q,width:"auto",...E?{maxWidth:"100cqi"}:{}}:{display:"none"},...ae?{filter:yr}:{},...y?{filter:`url(#${_e})`}:{}},onLoad:()=>se(F),onError:()=>V(k=>k+1)},F)]})}import{jsx as we,jsxs as Cr}from"react/jsx-runtime";function br({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,l=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(l.push({x1:a(100+Math.cos(u)*22),y1:a(100+Math.sin(u)*22),x2:a(100+Math.cos(u)*86),y2:a(100+Math.sin(u)*86),main:!0}),t){let p=u+Math.PI/e;l.push({x1:a(100+Math.cos(p)*22*1.4),y1:a(100+Math.sin(p)*22*1.4),x2:a(100+Math.cos(p)*78),y2:a(100+Math.sin(p)*78),main:!1})}}return Cr("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[we("circle",{cx:100,cy:100,r:92,strokeWidth:2}),we("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),we("circle",{cx:100,cy:100,r:22,strokeWidth:2}),we("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>we("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var Ui="#c9a461",an=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],$i={name:"",color:"var(--fg)",family:"silver",src:""};function xr(e,t){let n=r=>{let o=an.findIndex(i=>i.f===r);return o===-1?an.length:o};return n(e)-n(t)||e.localeCompare(t)}function Hi(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(xr)}import{useState as Sr}from"react";import{jsx as oe,jsxs as nt}from"react/jsx-runtime";function vr({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=Jt(),[a,l]=Sr("");async function c(){t||i||!a.trim()||(await r(a,e),l(""))}return nt("div",{className:"flex flex-col gap-2",children:[n===null?nt("div",{className:"flex border border-line",children:[oe("input",{type:"text",value:a,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),oe("button",{type:"button",onClick:()=>{c()},disabled:i||t,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Apply"})]}):nt("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[oe("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&oe("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&oe("button",{type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ft}):n&&!n.valid&&n.message&&oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var rt="Ads on. Shopper can opt out.",$e="Ads and analytics off until Accept",Er={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:rt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:$e,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:rt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:rt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Pr(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Vi(e,t,n){let r=Pr(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Xi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var wr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Rr=wr;function Zi(e=Rr){if(e.asked)return e.ads?"granted":"denied"}function ea(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as Nr,isValidElement as Lr,useEffect as ln,useId as Ir,useLayoutEffect as dn,useRef as Z,useState as un}from"react";var He=(e,t)=>!!e[t]&&!e[t].disabled;function ot(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(He(e,i))return i}return t}function it(e,t){return ot(e,t===1?-1:e.length,t)}function at(e,t){return He(e,t)?t:Math.max(it(e,1),0)}function sn(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),l=n.findIndex((c,u)=>He(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:l>=0?l:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:ot(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:ot(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:it(n,1)}),handled:!0};case"End":return{state:i({focus:it(n,-1)}),handled:!0};case"Enter":case" ":return He(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as kr}from"efficient-shell/ui";import{Fragment as Ur,jsx as J,jsxs as fn}from"react/jsx-runtime";var cn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Ar({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=un(!1),c=r!==void 0,u=c?r:a,[p,C]=un(0),d=Z({text:"",timer:0}),E=Z(null),L=Z(null),f=Z(null),M=Ir(),I=Z(null),T=e.findIndex(b=>b.value===t),R=b=>{b!==u&&(c||l(b),b?o?.():i?.())},_=b=>{let P=e[b];!P||P.disabled||(n(P.value),R(!1),L.current?.focus())},x=b=>{let P={open:u,focus:u?p:at(e,T),typed:d.current.text},y=sn(P,b,e);return!y.handled&&y.state.open===u?!1:(y.state.typed!==P.typed&&(d.current.text=y.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),C(y.state.focus),y.commit!==void 0?_(y.commit):R(y.state.open),y.refocus&&L.current?.focus(),y.handled)},K=Z(x);K.current=x;let ie=Z(()=>R(!1));ie.current=()=>R(!1);let D=b=>{u||(I.current=b.nativeEvent,K.current(b.key)&&b.preventDefault())};return ln(()=>{if(!u)return;let b=y=>{E.current?.contains(y.target)||ie.current()},P=y=>{y!==I.current&&K.current(y.key)&&y.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",P)}},[u]),ln(()=>{u&&(d.current.text||C(at(e,T)))},[u]),dn(()=>{if(!u||!f.current)return;f.current.children.item(p)?.scrollIntoView({block:"nearest"})},[p,u]),{open:u,toggle:()=>R(!u),close:()=>R(!1),focusIdx:p,setFocusIdx:C,pick:b=>_(e.findIndex(P=>P.value===b)),wrapRef:E,triggerRef:L,listRef:f,listId:M,onTriggerKeyDown:D,activeId:u?`${M}-${p}`:void 0}}var Tr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${cn.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${cn.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Or(e,t){dn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let a=n.offsetParent??n.parentElement;if(!a)return;let l=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-l.right)<Math.abs(c.left-l.left)?"end":"start",p=kr({trigger:{left:l.left,right:l.right,top:l.top,bottom:l.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(p.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=p.top+Math.min(c.height,p.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}p.maxHeight<c.height&&(i.maxHeight=`${p.maxHeight}px`,i.overflowY="auto");let C=p.left-c.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Mr(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Dr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c,align:u="start"}){let p=Tr[t],C=Z(null);return Or(C,n.length),J("ul",{ref:d=>{C.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...p.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?Mr(p.list):p.list,children:n.map((d,E)=>{let L=d.value===r;return J("li",{id:`${e}-${E}`,role:"option","aria-selected":L,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(E),onMouseDown:f=>{f.preventDefault(),d.disabled||a(d.value)},className:p.item(E===o,L&&d.value!=="",!!d.disabled,E===n.length-1),style:p.itemStyle?.(L),children:d.meta===void 0?d.label:fn(Ur,{children:[d.lead,J("span",{className:"flex-1 whitespace-nowrap",children:d.label}),J("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${E}`)})})}function Fr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c,align:u}){let p=Nr.toArray(r).flatMap(f=>{if(!Lr(f))return[];if(f.type!=="option")return[];let I=f.props,T=I.value!==void 0?String(I.value):"",R=I.children,_=typeof R=="string"||typeof R=="number"?String(R):T;return[{value:T,label:_,disabled:!!I.disabled}]}),C=e??"",d=Ar({items:p,value:C,onPick:f=>t?.({target:{value:f}})}),L=p.find(f=>f.value===C)?.label??p[0]?.label??"";return fn("div",{ref:d.wrapRef,className:"relative",children:[a&&J("input",{type:"hidden",name:a,value:C}),J("button",{ref:f=>{d.triggerRef.current=f},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:f=>!n&&d.onTriggerKeyDown(f),className:`block w-full ${o??""}`,style:i,children:J("span",{className:"block w-full truncate text-left",children:L})}),d.open&&J(Dr,{id:d.listId,tone:"select",items:p,value:C,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:u})]})}import{jsx as Re,jsxs as Be}from"react/jsx-runtime";var $r="font-mono text-[length:var(--size-label,12px)]",Hr="font-semibold uppercase tracking-[0.22em] text-fg";function pn(e){return`${e??$r} ${Hr}`}function mn(){return Re("span",{className:"text-accent",children:" *"})}function Br({children:e,required:t,labelFace:n}){return Be("span",{className:pn(n),children:[e,t?Re(mn,{}):null]})}function Wr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:l}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?Re("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Be("div",{className:c,children:[Be("label",{htmlFor:o,className:pn(i),children:[e,t?Re(mn,{}):null]}),l,u]}):Be("label",{htmlFor:o,className:c,children:[Re(Br,{required:t,labelFace:i,children:e}),l]})}var fa="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent";export{Ot as a,so as b,lo as c,uo as d,_t as e,Xe as f,qr as g,Gr as h,Kr as i,zr as j,vn as k,En as l,Vr as m,Xr as n,Ye as o,Te as p,Q as q,Yr as r,Qr as s,Oe as t,An as u,$t as v,mo as w,go as x,Ht as y,Ze as z,ho as A,yo as B,On as C,bo as D,Co as E,Mn as F,xo as G,Fn as H,So as I,vo as J,Eo as K,Bt as L,Lo as M,Io as N,ko as O,Oo as P,Mo as Q,to as R,Tt as S,no as T,Me as U,et as V,Xo as W,Jt as X,ci as Y,lr as Z,fi as _,br as $,Ui as aa,an as ba,$i as ca,xr as da,Hi as ea,vr as fa,mi as ga,Ti as ha,Oi as ia,Er as ja,Vi as ka,Xi as la,wr as ma,Zi as na,ea as oa,Ar as pa,Dr as qa,Fr as ra,Br as sa,Wr as ta,fa as ua};
|
|
@@ -0,0 +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};
|