efficient-storefront-blocks 0.109.0 → 0.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/chunks/EditorPreviewCheckout-2JRQSG4O.js +4 -0
  3. package/dist/chunks/{SiteEditorProvider-KN5FKGBX.js → SiteEditorProvider-P4HVFXUX.js} +1 -1
  4. package/dist/chunks/chunk-CPAF23MT.js +1 -0
  5. package/dist/chunks/chunk-FRCI3FAV.js +80 -0
  6. package/dist/chunks/{chunk-SUX7QH3R.js → chunk-GB6OHYUY.js} +1 -1
  7. package/dist/chunks/{chunk-X3ERHC7Y.js → chunk-MVJVIU2F.js} +1 -1
  8. package/dist/chunks/chunk-RFFTWKCU.js +340 -0
  9. package/dist/chunks/{fitment-data-Z3FDYFU6.js → fitment-data-EGBXHTFW.js} +1 -1
  10. package/dist/contract.js +8 -2
  11. package/dist/editor/components/BlogSource.d.ts +1 -1
  12. package/dist/editor/components/BlogSource.js +1 -1
  13. package/dist/editor/lib/efficient-backend.js +1 -1
  14. package/dist/index.js +32 -32
  15. package/dist/links.js +1 -1
  16. package/dist/render/built-with.json +1 -1
  17. package/dist/render/components/CartContext.d.ts +3 -0
  18. package/dist/render/components/CartContext.js +1 -1
  19. package/dist/render/components/Events.d.ts +2 -1
  20. package/dist/render/components/Events.js +1 -1
  21. package/dist/render/components/cart/drawer-parts.js +1 -1
  22. package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
  23. package/dist/render/components/checkout/checkout-parts.d.ts +11 -0
  24. package/dist/render/components/checkout/checkout-parts.js +1 -1
  25. package/dist/render/components/checkout/checkout-state.d.ts +5 -0
  26. package/dist/render/components/checkout/checkout-state.js +3 -3
  27. package/dist/render/lib/checkout/checkout-memory.d.ts +62 -0
  28. package/dist/render/lib/checkout/checkout-memory.js +1 -0
  29. package/dist/render/lib/content/event-post.d.ts +5 -0
  30. package/dist/render/lib/content/event-post.js +1 -0
  31. package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
  32. package/dist/render/lib/wheels/price-display.d.ts +2 -0
  33. package/dist/render/lib/wheels/price-display.js +1 -1
  34. package/dist/words.d.ts +1 -0
  35. package/dist/words.js +1 -1
  36. package/package.json +3 -3
  37. package/dist/chunks/EditorPreviewCheckout-IVYEDVVN.js +0 -4
  38. package/dist/chunks/chunk-5VN7IA5L.js +0 -1
  39. package/dist/chunks/chunk-G5XZ736Y.js +0 -339
  40. package/dist/chunks/chunk-UBOGEIFX.js +0 -74
  41. /package/dist/chunks/{chunk-G5XZ736Y.js.LEGAL.txt → chunk-RFFTWKCU.js.LEGAL.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.110.0 - 2026-11-15
4
+
5
+ **A major for hosts (major version zero, so a minor number):** the `efficient-shell` peer is `^13.3.0` (was `^13.0.0`, #559). The `efficient-web-builder` peer widens to `^68.2.0 || ^69.0.0`. From main at `524defe9`: #556, #557, #559, #561, #562, #563, #564, #565, #566. `efficient-easel ^34.3.0` unchanged. No export removed (21 added). No stored page moves.
6
+
7
+ **For hosts:**
8
+ - **BREAKING (#559):** the embed entries bundle efficient-web-builder and leave efficient-shell to the host. Builder 69 imports `efficient-shell/icons/brands`, which exists only from efficient-shell 13.3.0. admin-portal (on `^13.2.0`) takes efficient-shell 13.3.0 or later in the same bump that takes this release. The storefront takes efficient-shell 13.3.0 with it; it may also take efficient-web-builder 69 (68.2 stays inside the peer).
9
+ - The storefront re-vendors `src/` with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. The checkout changes (#557, #564) and the journal pieces (#556) reach it only through that copy.
10
+ - No new backend endpoint. The checkout memory (#564) uses the tab's session storage only.
11
+
12
+ ### Added
13
+
14
+ - **The checkout keeps its order key and memory across a reload** (#564): new `render/lib/checkout/checkout-memory` (`parkCheckoutMemory`, `readCheckoutMemory`, `clearCheckoutMemory`, `parkRequest`, `sendableRequest`, `parkForm`, `parkLine`, `parkOrder`, `holdsPress`). An allow-list of fields is parked in session storage from the first press until a landing; no payment data is parked. After a restore the totals wait for the server's quote (`FIGURE_UPDATING`, `PRICES_REQUOTED`). A press after a reload uses the same idempotency key, so it cannot place a second order.
15
+ - **One post-to-card rule and a served journal category** (#556): new `render/lib/content/event-post` (`blogPostRowOfAdmin`, `eventPostOf`), used by the editor's Blog control and the backend binding. `Events` takes an optional `servedCategory`: a published section with no card then says "No posts in this category yet." with an "All posts" link. The editor's post date is now the post's UTC day (`postDateLabel`), as on every other post surface.
16
+
17
+ ### Fixed
18
+
19
+ - **The checkout form is locked while a press waits** (#557). Every contact, address, delivery, coupon and payment-method control, "Not you? Sign out" and the courier's "Try again" are disabled from the press until its answer (order request, address save, card start, wallet start, release). The card step and a hosted wallet now always get the checkout as it is on the page. A redirect to a wallet keeps the form locked; a return by the browser's Back button offers "Try payment again" for that order. The form parts sit in one lock, `FormLock` (a disabled `<fieldset>`), so a control added later is locked too. "Edit ↗", "Browse the catalog" and the header's links to the shop lead nowhere during the wait (`LeaveLink`). A wallet redirect that the browser refuses (a navigation that throws) gives the form back with "Try payment again". New exports: `formLocked` on `CheckoutState`, `FormLock`, `LeaveLink` (minor). The branches that served a change made during the wait are deleted.
20
+
21
+ ### Changed
22
+
23
+ - **Dependencies (#559):** efficient-shell peer `^13.3.0`, efficient-web-builder peer `^68.2.0 || ^69.0.0`; dev install efficient-web-builder 69 and efficient-shell 13.3.0. The editor words gain `"Chips"`.
24
+
25
+ ### Internal
26
+
27
+ - Browser checks run by discovery, not a list (#561); the README names the one-time Chromium install (#562).
28
+ - Guards: one JS/TS extension list and one whole-tree floor in `scripts/blocks-source.ts` (#563, #565: `BLOCKS_SOURCE_FLOOR`, `BLOCKS_TSX_FLOOR`); the align checks come from efficient-web-builder 69.1.0 (`one-block-box-word-map`, `ALIGN_TABLE_WORDS`), dev builder `^69.1.0` (#566).
29
+
3
30
  ## 0.109.0 - 2026-11-14
4
31
 
5
32
  **A major for hosts (major version zero, so a minor number):** the `efficient-web-builder` peer is `^68.2.0` (was `^68.0.0`, #555). From main at `4278711f`: #551, #553, #554, #555. Other peers unchanged: `efficient-shell ^13.0.0`, `efficient-easel ^34.3.0`. No export removed. No stored page moves; the drawn bytes are the same.
@@ -0,0 +1,4 @@
1
+ "use client";import{A as jr,P as Ur,Q as Wr,R as $r,S as Yr,T as Br,U as ye,W as bt,X as zr,Y as Hr,Z as Wt,_ as Gr,aa as bn,b as _r,ba as te,c as hn,d as Kr,e as jt,ea as Jr,fa as Vr,ka as Xr,la as Ne,ma as Zr,na as Qr,sa as eo,ta as vt,wa as vn,y as Ut,ya as ae,z as Dr}from"./chunk-CPAF23MT.js";import{P as ue,V as nt,aa as $}from"./chunk-MVJVIU2F.js";import{ni as Fr,pi as He,ti as qr}from"./chunk-FRCI3FAV.js";import{n as Mr,o as ht,p as ce}from"./chunk-GB6OHYUY.js";import{a as yn,b as ui}from"./chunk-Y6SLVHK3.js";var ro=yn((Rs,no)=>{"use strict";var pi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";no.exports=pi});var so=yn((Os,io)=>{"use strict";var mi=ro();function oo(){}function ao(){}ao.resetWarningCache=oo;io.exports=function(){function e(r,a,c,d,g,f){if(f!==mi){var p=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 p.name="Invariant Violation",p}}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:ao,resetWarningCache:oo};return n.PropTypes=n,n}});var lo=yn((Is,co)=>{"use strict";co.exports=so()();var As,Ls});import{useEffect as Ea,useMemo as Pa,useRef as it,useState as Je}from"react";import{rootIsDark as di}from"efficient-shell/format";function to(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,a)=>e.getPropertyValue(r).trim()||a,n=di({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 M=ui(lo(),1);import I from"react";function uo(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 fi(e){if(Array.isArray(e))return e}function yo(e,t,n){return(t=xi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gi(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,c,d,g=[],f=!0,p=!1;try{if(c=(n=n.call(e)).next,t!==0)for(;!(f=(r=c.call(n)).done)&&(g.push(r.value),g.length!==t);f=!0);}catch(h){p=!0,a=h}finally{try{if(!f&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(p)throw a}}return g}}function yi(){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 po(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?po(Object(n),!0).forEach(function(r){yo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):po(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hi(e,t){if(e==null)return{};var n,r,a=bi(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function bi(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 ho(e,t){return fi(e)||gi(e,t)||ki(e,t)||yi()}function vi(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 xi(e){var t=vi(e,"string");return typeof t=="symbol"?t:t+""}function xn(e){"@babel/helpers - typeof";return xn=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},xn(e)}function ki(e,t){if(e){if(typeof e=="string")return uo(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)?uo(e,t):void 0}}var V=function(t,n,r){var a=!!r,c=I.useRef(r);I.useEffect(function(){c.current=r},[r]),I.useEffect(function(){if(!a||!t)return function(){};var d=function(){if(c.current)return c.current.apply(c,arguments)};return t.on(n,d),function(){t.off(n,d)}},[a,n,t,c])},kn=function(t){var n=I.useRef(t);return I.useEffect(function(){n.current=t},[t]),n.current},rt=function(t){return t!==null&&xn(t)==="object"},Ci=function(t){return rt(t)&&typeof t.then=="function"},Pi=function(t){return rt(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},fo="[object Object]",wi=function e(t,n){if(t===n)return!0;if(!rt(t)||!rt(n))return t===n;var r=Array.isArray(t),a=Array.isArray(n);if(r!==a)return!1;var c=Object.prototype.toString.call(t)===fo,d=Object.prototype.toString.call(n)===fo;if(c!==d)return!1;if(!c&&!r)return t===n;var g=Object.keys(t),f=Object.keys(n);if(g.length!==f.length)return!1;for(var p={},h=0;h<g.length;h+=1)p[g[h]]=!0;for(var k=0;k<f.length;k+=1)p[f[k]]=!0;var v=Object.keys(p);if(v.length!==g.length)return!1;var y=t,E=n,C=function(D){return e(y[D],E[D])};return v.every(C)},bo=function(t,n,r){return rt(t)?Object.keys(t).reduce(function(a,c){var d=!rt(n)||!wi(t[c],n[c]);return r.includes(c)?(d&&console.warn("Unsupported prop change: options.".concat(c," is not a mutable property.")),a):d?mo(mo({},a||{}),{},yo({},c,t[c])):a},null):null},vo="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.",go=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vo;if(t===null||Pi(t))return t;throw new Error(n)},Ni=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vo;if(Ci(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return go(a,n)})};var r=go(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Si=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"}))},$t=I.createContext(null);$t.displayName="ElementsContext";var xo=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},Pn=function(t){var n=t.stripe,r=t.options,a=t.children,c=I.useMemo(function(){return Ni(n)},[n]),d=I.useState(function(){return{stripe:c.tag==="sync"?c.stripe:null,elements:c.tag==="sync"?c.stripe.elements(r):null}}),g=ho(d,2),f=g[0],p=g[1];I.useEffect(function(){var v=!0,y=function(C){p(function(R){return R.stripe?R:{stripe:C,elements:C.elements(r)}})};return c.tag==="async"&&!f.stripe?c.stripePromise.then(function(E){E&&v&&y(E)}):c.tag==="sync"&&!f.stripe&&y(c.stripe),function(){v=!1}},[c,f,r]);var h=kn(n);I.useEffect(function(){h!==null&&h!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[h,n]);var k=kn(r);return I.useEffect(function(){if(f.elements){var v=bo(r,k,["clientSecret","fonts"]);v&&f.elements.update(v)}},[r,k,f.elements]),I.useEffect(function(){Si(f.stripe)},[f.stripe]),I.createElement($t.Provider,{value:f},a)};Pn.propTypes={stripe:M.default.any,options:M.default.object};var ko=function(t){var n=I.useContext($t);return xo(n,t)},Co=function(){var t=ko("calls useElements()"),n=t.elements;return n},Ei=function(t){var n=t.children,r=ko("mounts <ElementsConsumer>");return n(r)};Ei.propTypes={children:M.default.func.isRequired};var Ri=I.createContext(null);Ri.displayName="CheckoutContext";var Po=I.createContext(null);Po.displayName="CheckoutSdkContext";var Cn=function(t){var n=I.useContext(Po),r=I.useContext($t);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 xo(r,t)},Oi=["mode"],Ai=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},_=function(t,n,r){var a="".concat(Ai(t),"Element"),c=function(p){var h=p.id,k=p.className,v=p.options,y=v===void 0?{}:v,E=p.onBlur,C=p.onFocus,R=p.onReady,D=p.onChange,O=p.onEscape,S=p.onClick,B=p.onLoadError,X=p.onLoaderStart,de=p.onNetworksChange,j=p.onConfirm,ie=p.onCancel,Re=p.onShippingAddressChange,De=p.onShippingRateChange,Q=p.onSavedPaymentMethodRemove,be=p.onSavedPaymentMethodUpdate,ne=p.onAvailablePaymentMethodsChange,ee=Cn("mounts <".concat(a,">")),z="elements"in ee?ee.elements:null,b="checkoutSdk"in ee?ee.checkoutSdk:null,Oe=I.useState(null),je=ho(Oe,2),U=je[0],st=je[1],Z=I.useRef(null),ve=I.useRef(null);V(U,"blur",E),V(U,"focus",C),V(U,"escape",O),V(U,"click",S),V(U,"loaderror",B),V(U,"loaderstart",X),V(U,"networkschange",de),V(U,"confirm",j),V(U,"cancel",ie),V(U,"shippingaddresschange",Re),V(U,"shippingratechange",De),V(U,"savedpaymentmethodremove",Q),V(U,"savedpaymentmethodupdate",be),V(U,"availablepaymentmethodschange",ne),V(U,"change",D);var Ae;R&&(t==="expressCheckout"?Ae=R:Ae=function(){R(U)}),V(U,"ready",Ae),I.useLayoutEffect(function(){if(Z.current===null&&ve.current!==null&&(z||b)){var L=null;if(b){var re=b,pe=b;switch(t){case"paymentForm":L=pe.createForm(y);break;case"payment":L=re.createPaymentElement(y);break;case"address":if("mode"in y){var Ie=y.mode,xe=hi(y,Oi);if(Ie==="shipping")L=re.createShippingAddressElement(xe);else if(Ie==="billing")L=re.createBillingAddressElement(xe);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=re.createExpressCheckoutElement(y);break;case"currencySelector":L=b.createCurrencySelectorElement();break;case"taxId":L=re.createTaxIdElement(y);break;case"contactDetails":L=re.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in b)L=b.createLinkSignupElement(y);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":L=re.createTermsElement(y);break;default:throw new Error("<".concat(a,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else z&&(L=z.create(t,y));Z.current=L,st(L),L&&L.mount(ve.current)}},[z,b,y]);var Le=kn(y);return I.useEffect(function(){if(Z.current){var L=bo(y,Le,["paymentRequest"]);L&&"update"in Z.current&&Z.current.update(L)}},[y,Le]),I.useLayoutEffect(function(){return function(){if(Z.current&&typeof Z.current.destroy=="function")try{Z.current.destroy(),Z.current=null}catch{}}},[]),I.createElement("div",{id:h,className:k,ref:ve})},d=function(p){Cn("mounts <".concat(a,">"));var h=p.id,k=p.className;return I.createElement("div",{id:h,className:k})},g=n?d:c;return g.propTypes={id:M.default.string,className:M.default.string,onChange:M.default.func,onBlur:M.default.func,onFocus:M.default.func,onReady:M.default.func,onEscape:M.default.func,onClick:M.default.func,onLoadError:M.default.func,onLoaderStart:M.default.func,onNetworksChange:M.default.func,onConfirm:M.default.func,onCancel:M.default.func,onShippingAddressChange:M.default.func,onShippingRateChange:M.default.func,onSavedPaymentMethodRemove:M.default.func,onSavedPaymentMethodUpdate:M.default.func,onAvailablePaymentMethodsChange:M.default.func,options:M.default.object},g.displayName=a,g.__elementType=t,g},K=typeof window>"u",Li=I.createContext(null);Li.displayName="EmbeddedCheckoutProviderContext";var wo=function(){var t=Cn("calls useStripe()"),n=t.stripe;return n},Fs=_("auBankAccount",K),qs=_("card",K),Ms=_("cardNumber",K),_s=_("cardExpiry",K),Ks=_("cardCvc",K),Ds=_("currencySelector",K),js=_("iban",K),No=_("payment",K),Us=_("expressCheckout",K),Ws=_("paymentRequestButton",K),$s=_("linkAuthentication",K),Ys=_("linkSignup",K),Bs=_("contactDetails",K),zs=_("address",K),Hs=_("shippingAddress",K),Gs=_("paymentMethodMessaging",K),Js=_("taxId",K),Vs=_("issuingCardNumberDisplay",K),Xs=_("issuingCardCvcDisplay",K),Zs=_("issuingCardExpiryDisplay",K),Qs=_("issuingCardPinDisplay",K),ec=_("issuingCardCopyButton",K),tc=_("terms",K);function zt(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?zt=function(t){return typeof t}:zt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zt(e)}var Ro="dahlia",Ii=function(t){return t===3?"v3":t},Oo="https://js.stripe.com",Ti="".concat(Oo,"/").concat(Ro,"/stripe.js"),Fi=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,qi=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,So="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Mi=function(t){return Fi.test(t)||qi.test(t)},_i=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Oo,'"]')),n=0;n<t.length;n++){var r=t[n];if(Mi(r.src))return r}return null},Eo=function(t){var n=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(Ti).concat(n);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},Ki=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},xt=null,Yt=null,Bt=null,Di=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},ji=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},Ui=function(t){return xt!==null?xt:(xt=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(So),window.Stripe){n(window.Stripe);return}try{var a=_i();if(a&&t)console.warn(So);else if(!a)a=Eo(t);else if(a&&Bt!==null&&Yt!==null){var c;a.removeEventListener("load",Bt),a.removeEventListener("error",Yt),(c=a.parentNode)===null||c===void 0||c.removeChild(a),a=Eo(t)}Bt=ji(n,r),Yt=Di(r),a.addEventListener("load",Bt),a.addEventListener("error",Yt)}catch(d){r(d);return}}),xt.catch(function(n){return xt=null,Promise.reject(n)}))},Wi=function(t,n,r){if(t===null)return null;var a=n[0];if(typeof a!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(zt(a)," instead."));var c=a.match(/^pk_test/),d=Ii(t.version),g=Ro;c&&d!==g&&console.warn("Stripe.js@".concat(d," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(g,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var f=t.apply(void 0,n);return Ki(f,r),f},kt,Ao=!1,Lo=function(){return kt||(kt=Ui(null).catch(function(t){return kt=null,Promise.reject(t)}),kt)};Promise.resolve().then(function(){return Lo()}).catch(function(e){Ao||console.warn(e)});var Ht=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Ao=!0;var a=Date.now();return Lo().then(function(c){return Wi(c,n,a)})};var Ct=2;function Io(e){return e==="card"}var $i="checkout_unavailable",Yi="checkout_waiting",To="committed",_e="We could not check your payment. Please try again.",wn="Your last change was not saved. This is your order as placed.",Fo="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.",qo=1e4;async function Mo(e,t=qo){let n,r=new Promise(c=>{n=setTimeout(()=>c(void 0),t)}),a=(async()=>{try{return(await(await Ht(e.publishableKey))?.retrievePaymentIntent(e.clientSecret))?.paymentIntent?.status}catch{return}})();try{return await Promise.race([a,r])}finally{clearTimeout(n)}}var _o=new Set(["none","requires_payment_method","canceled"]);async function Nn(e,t=qo){let n,r=new Promise(a=>{n=setTimeout(()=>a(void 0),t)});try{return await Promise.race([$.releaseCheckout({idempotencyKey:e}).then(a=>a.status,()=>{}),r])}finally{clearTimeout(n)}}function Ko(e,t){return e instanceof ue&&typeof e.data=="object"&&e.data!==null&&e.data.code===t}function Gt(e){return Ko(e,$i)}function Sn(e){return Ko(e,Yi)}function En(e){return e instanceof ue&&e.status>=400&&e.status<500&&e.status!==408}function Do(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 Jt(e){return e.orderNumber||e.checkoutNumber}function Bi(e){return e.orderNumber?{kind:"placed",order:e}:{kind:e.status==="released"?"refunded":e.status==="expired"?"expired":"pending",checkoutNumber:e.checkoutNumber}}async function jo({checkoutNumber:e,resend:t,page:n}){n.setConfirming(!0);let r;try{r=Bi(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 os,useContext as as,useEffect as Y,useMemo as aa,useRef as q,useState as w}from"react";var zi="sf:gclid",Hi="sf:fbclid",Gi=2160*60*60*1e3;function $o(){return typeof window<"u"}function Uo(e){let t=ht.getItem(e);if(!t)return"";try{let{v:n,t:r}=JSON.parse(t);return!n||typeof r!="number"||Date.now()-r>Gi?"":n}catch{return""}}function Wo(e){if(!$o())return"";let t=e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function Yo(){if(!$o())return{};let e=Uo(zi),t=Uo(Hi),n=Wo("_fbp"),r=Wo("_fbc");!r&&t&&(r=`fb.1.${Date.now()}.${t}`);let a={};return e&&(a.gclid=e),t&&(a.fbclid=t),n&&(a.fbp=n),r&&(a.fbc=r),a}var Bo="sf:meta-purchases",Ji=20;function Ho(){return typeof window>"u"||window.parent!==window}function Vi(...e){try{if(Ho()||typeof window.fbq!="function")return;window.fbq(...e)}catch{}}var zo=new Set;function Xi(e){if(zo.has(e))return!1;zo.add(e);try{let t=JSON.parse(ht.getItem(Bo)??"[]");if(t.includes(e))return!1;ht.setItem(Bo,JSON.stringify([...t,e].slice(-Ji)))}catch{}return!0}function Zi(e){return[...new Set(e.filter(bt).flatMap(t=>t.components.map(n=>n.partNumber)))]}function Go(e){let t=e.confirmation;Ho()||!Xi(t.orderNumber)||Vi("track","Purchase",{value:Number(t.grandTotal),currency:t.currency,content_type:"product",content_ids:Zi(e.lines)},{eventID:t.orderNumber})}var Rn="checkout-afterpay-context",Vt="checkout-gocardless-context",On="checkout-zip-context",Xt="checkout-klarna-context";function Qi({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function es(e,t){let n=e.getItem(t);if(e.removeItem(t),!n)return null;try{return JSON.parse(n)}catch{return null}}var Jo={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:Rn,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},Vo={name:"Zip",legParam:"zip",legValues:["return"],storageKey:On,evidenceFrom(e){let t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})};async function An(e,t){let n=new URLSearchParams(t.search),r=n.get(e.legParam);if(!r||!e.legValues.includes(r))return;let a=es(t.storage,e.storageKey),c=e.evidenceFrom(n,r);t.scrubQuery();let d=Qi({evidence:c,parked:a});if(d.action!=="ignore"){if(t.page.clearCart(),d.action==="settle"){t.page.note(`The ${e.name} payment was not completed \u2014 our team will follow up on payment.`),t.page.land(d.parked.confirmation);return}t.page.setConfirming(!0);try{let g=await t.capture(e.requestFrom(d.evidence));g.status==="paid"?t.page.markPaid():t.page.note(`${e.name} declined the payment \u2014 our team will follow up on payment.`),t.page.land(d.parked?.confirmation??g)}catch{d.parked?(t.page.note(`We could not confirm the ${e.name} payment \u2014 our team will follow up on payment.`),t.page.land(d.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 Xo(e,t,n){let r=(t??"").trim();if(!r)return"";if(n.length===0)return r;let a=r.toUpperCase(),c=`${e.toUpperCase()}-${a}`,d=n.find(g=>g.code&&g.code.toUpperCase()===a)??n.find(g=>g.code&&g.code.toUpperCase()===c)??n.find(g=>g.name.toUpperCase()===a);return d?d.code||d.name:""}var In="checkout-memory-context",Qo="Prices have changed since this checkout started. The total shows today's prices.",ea=2,ts=3600*1e3;function ns(e){return{id:e.id,slug:e.slug,name:{lead:e.name?.lead,accent:e.name?.accent},process:e.process,positionNo:e.positionNo,config:(e.config??[]).map(t=>({label:t.label,gold:t.gold})),finishName:e.finishName,size:e.size,qty:e.qty,href:e.href,kind:e.kind,sku:e.sku,components:e.components.map(t=>({partNumber:t.partNumber,wheels:t.wheels,prices:{...t.prices},hand:t.hand}))}}var ot=e=>e.map(ns);function ta(e){let t=e.customer;return{customer:{email:t.email,name:t.name,phone:t.phone,companyName:t.companyName,address:t.address,city:t.city,state:t.state,zipCode:t.zipCode,country:t.country},items:e.items.flatMap(n=>jt([{partNumber:n.partNumber,wheels:n.quantity,prices:{}}],1)),currency:e.currency,idempotencyKey:e.idempotencyKey,shippingMethodId:e.shippingMethodId,couponCode:e.couponCode}}function Tn(e){return{...ta(e),payFirst:!!e.checkoutFlow}}function na(e){return ta(e)}function Fn(e){let t=n=>typeof n=="string"?n:"";return{email:t(e.email),firstName:t(e.firstName),lastName:t(e.lastName),company:t(e.company),address1:t(e.address1),address2:t(e.address2),city:t(e.city),postcode:t(e.postcode),phone:t(e.phone),country:t(e.country),subdivision:t(e.subdivision),selectedAddressId:t(e.selectedAddressId),shippingMethodId:typeof e.shippingMethodId=="string"?e.shippingMethodId:null,couponCode:typeof e.couponCode=="string"?e.couponCode:null}}function qn(e){return{orderNumber:e.orderNumber,checkoutNumber:e.checkoutNumber,expiresAt:e.expiresAt,status:e.status,total:e.total,currency:e.currency,freightCharge:e.freightCharge,discountAmount:e.discountAmount,grandTotal:e.grandTotal,shippingMethod:e.shippingMethod,couponCode:e.couponCode}}function Mn(e){return e.lastPress!==null||e.unpaidOrder!==null||e.keptCardKey!==null}function rs(e){let t=e.parkedAt+ts,n=e.unpaidOrder&&!e.unpaidOrder.orderNumber?e.unpaidOrder.expiresAt:null,r=n?Date.parse(n):NaN;return Number.isNaN(r)?t:Math.min(t,r)}function ra(e){try{let t=e.lastPress,n={...e,lines:ot(e.lines),lastPress:t&&{...t,lines:ot(t.lines),plainLines:ot(t.plainLines)}};ce.setItem(In,JSON.stringify({v:ea,...n}))}catch{}}var Pt=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Zo=e=>Pt(e)&&typeof e.idempotencyKey=="string"&&Array.isArray(e.items)&&e.items.every(t=>Pt(t)&&typeof t.partNumber=="string"&&typeof t.quantity=="number")&&Pt(e.customer)&&typeof e.payFirst=="boolean",Ln=e=>Pt(e)&&typeof e.id=="string"&&typeof e.qty=="number"&&Array.isArray(e.components);function oa(){let e;try{e=ce.getItem(In)}catch{return null}if(!e)return null;try{let t=JSON.parse(e);if(t.v!==ea||typeof t.key!="string"||!t.key||!Array.isArray(t.lines)||!t.lines.every(Ln)||typeof t.parkedAt!="number")return null;let n=t.lastPress,r={key:t.key,authed:t.authed===!0,parkedAt:t.parkedAt,lastPress:Pt(n)&&typeof n.key=="string"&&Zo(n.request)&&Array.isArray(n.lines)&&n.lines.every(Ln)&&Array.isArray(n.plainLines)&&n.plainLines.every(Ln)?{...n,lines:ot(n.lines),plainLines:ot(n.plainLines)}:null,keptCardKey:typeof t.keptCardKey=="string"?t.keptCardKey:null,placedGoods:typeof t.placedGoods=="string"?t.placedGoods:null,unpaidOrder:t.unpaidOrder&&typeof t.unpaidOrder=="object"?qn(t.unpaidOrder):null,placedRequest:Zo(t.placedRequest)?t.placedRequest:null,lines:ot(t.lines),form:t.form&&typeof t.form=="object"?Fn(t.form):null};return Date.now()>=rs(r)?(_n(),null):Mn(r)?r:null}catch{return null}}function _n(){try{ce.removeItem(In)}catch{}}import{jsx as Se}from"react/jsx-runtime";function ia(e){let t=e.indexOf(`
3
+ `);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}function sa(e,{canParkContext:t}={canParkContext:!0}){let n=e.paymentMethods,r=[];return n.includes("card")&&r.push({key:"card",title:"Card",body:null,price:Se("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:Se("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:Se("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:Se("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:Se("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:Se("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:Se("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:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),r}var da="This shop does not take payment online yet. Please contact the shop to order.",at=class extends Error{};function ca(e,t){if(!e.orderNumber&&Gt(t))return t.message;let n=t instanceof ue?` (${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 is=3e3,ss=.005,la=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]);function ua(){let e=eo();return{...e==="denied"?{}:Yo(),...e?{adConsent:e}:{}}}var he=e=>JSON.parse(e),pa="Shipping cannot be calculated right now. Please try again.";function ma(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 cs({site:e,logo:t,preview:n=!1}){let{items:r,totals:a,coupon:c,refuseCoupon:d,deliveryOptions:g,shippingMethodId:f,setShippingMethodId:p,setQuoteDestination:h,courier:k,requote:v,identify:y,clearCapturedCart:E,replaceItems:C,removeCoupon:R,applyCoupon:D}=Wt(),O=g.find(o=>o.id===f)?.pickupLocation??null,{country:S,countries:B,activeCountry:X,formatMoney:de}=ye(),[j,ie]=w(()=>sa(e)[0]?.key??null),[Re,De]=w(!0);Y(()=>{De(Mr(ce))},[]);let[Q,be]=w(!1),[ne,ee]=w(""),[z,b]=w(""),[Oe,je]=w(""),[U,st]=w(""),[Z,ve]=w(""),[Ae,Le]=w(""),[L,re]=w(""),[pe,Ie]=w(""),[xe,ct]=w(""),[W,lt]=w(()=>S||B[0]?.code||""),[ke,Nt]=w(""),[ut,Wn]=w([]),[nn,rn]=w(null),[St,Ve]=w(null),$n=aa(()=>B.find(o=>o.code===W)??X,[B,W,X]),Ra=$n?.postalLabel||"Postal Code",Oa=ut[0]?.divisionType||"State / Province";Y(()=>{if(!W){Wn([]),rn(W);return}rn(null);let o=!1;return $.listCountrySubdivisions(W).then(s=>{o||(Wn(s),rn(W),Nt(""))}),()=>{o=!0}},[W]);let Yn=Z.trim()!==""&&L.trim()!==""&&pe.trim()!==""&&nn===W&&(ut.length===0||ke!=="")?pe.trim():"";Y(()=>{h(W?{country:W,subdivision:ke,postcode:Yn}:null)},[W,ke,Yn,h]),Y(()=>()=>h(null),[h]);let Aa=k?.status==="unavailable",La=v,[dt,Bn]=w(null),[Ia,zn]=w([]),[on,Et]=w("new"),[Hn,Gn]=w(!1),[an,Ta]=w("Home"),[Fa,Jn]=w(null),[qa,Vn]=w(null),[Ue,Rt]=w(()=>vt()),Xn=q(null),[sn,me]=w(null),[Ma,se]=w(null),[Zn,Ot]=w(null),[Qn,_a]=w(!1),[er,Ka]=w(!1),[Te,Xe]=w(null),[Da,Ze]=w(!1),[G,le]=w(null),tr=!!G?.orderNumber,ja=tr||Q,[Ua,Ce]=w(null),[Wa,$a]=w(!1),[Ya,nr]=w(!1),[Ba,za]=w(!1),[Ha,rr]=w(!1),[or,Ga]=w(!1),[Ja,cn]=w(!1),[pt,ar]=w(null),Fe=q(null),We=q(null),ln=q(!1),$e=q(r),Pe=q(null),qe=q(null),ir=!!(sn||pt&&pt.kind!=="processing"||or||Qn||er||Zn&&Te?.orderNumber);Y(()=>{ir&&(C([]),R())},[ir,C,R]);let sr=q(!1);Y(()=>{n||sr.current||!r.some(bt)||(sr.current=!0,Ur({lines:r,currency:a.currency,value:a.subtotal-a.discount,coupon:c?.valid?c.code:void 0}))},[r,a,c,n]),Y(()=>{y(ne,z.trim()||void 0)},[ne,z,y]);let cr=q(null),[At,Va]=w(null);Y(()=>{let o=cr.current;if(!At||!o)return;let s=()=>o.style.setProperty("--sf-checkout-header-h",`${At.offsetHeight}px`);s();let u=new ResizeObserver(s);return u.observe(At),()=>u.disconnect()},[At]),Y(()=>{let o=u=>({setConfirming:u,land:me,markPaid:()=>Ze(!0),note:Ce,fail:se,clearCart:E}),s={search:window.location.search,storage:ce,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};An(Jo,{...s,capture:$.captureAfterpayPayment,page:o($a)}),An(Vo,{...s,capture:$.captureZipPayment,page:o(za)})},[]),Y(()=>{let s=new URLSearchParams(window.location.search).get("gocardless");if(s!=="confirm"&&s!=="cancel")return;let u=ce.getItem(Vt);if(ce.removeItem(Vt),window.history.replaceState(null,"",window.location.pathname),!u)return;let P;try{P=JSON.parse(u)}catch{return}if(E(),s==="cancel"){Ce("The direct debit was not set up \u2014 our team will follow up on payment."),me(P.confirmation);return}nr(!0),$.completeGocardlessPayment({idempotencyKey:P.idempotencyKey}).then(m=>{m.status==="paid"?Ze(!0):m.status==="declined"?Ce("The direct debit was declined \u2014 our team will follow up on payment."):Ce("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{Ce("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{me(P.confirmation),nr(!1)})},[]),Y(()=>{let o=new URLSearchParams(window.location.search),s=o.get("klarna");if(s!=="confirm"&&s!=="cancel")return;let u=ce.getItem(Xt);ce.removeItem(Xt);let P=o.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!u)return;let m;try{m=JSON.parse(u)}catch{return}if(E(),s==="cancel"||!P){Ce("The Klarna payment was not completed \u2014 our team will follow up on payment."),me(m.confirmation);return}rr(!0),$.captureKlarnaPayment({idempotencyKey:m.idempotencyKey,authorizationToken:P}).then(T=>{T.status==="paid"?Ze(!0):T.status==="declined"?Ce("Klarna declined the payment \u2014 our team will follow up on payment."):Ce("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{Ce("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{me(m.confirmation),rr(!1)})},[]);function lr(o){let[s,u]=ia(o.address);ve(s),Le(u),re(o.city),Ie(o.zip_code),o.country&&lt(o.country),o.phone&&ct(o.phone),Ve({country:o.country||null,state:o.state??""})}Y(()=>{if(St){if((St.country||W)!==W){Ve(null);return}nn===W&&(Nt(Xo(W,St.state,ut)),Ve(null))}},[St,W,nn,ut]),Y(()=>{let o=!1;return(async()=>{try{let[s,u,P]=await Promise.all([nt.me(),nt.myProfile().catch(()=>null),nt.myAddresses().catch(()=>[])]);if(o)return;Bn(s);let m=P.filter(J=>J.is_active);zn(m),ee(s.email);let T=(u?.contact_name??"").split(/\s+/);b(s.first_name||T[0]||""),je(s.last_name||T.slice(1).join(" "));let A=s.phone||u?.phone;A&&ct(A);let F=m.find(J=>J.id===s.default_delivery_location)??m[0];if(F)Et(F.id),lr(F);else if(u){let[J,Dt]=ia(u.address??"");ve(J),Le(Dt),re(u.city??""),Ie(u.zip_code??""),u.country&&lt(u.country),Ve({country:u.country||null,state:u.state??""})}_t.current&&hr(_t.current,!1)}catch{}})(),()=>{o=!0}},[]);function Xa(){nt.logout(),mt.current=!0,_t.current=null,Mt.current=null,ft(),Bn(null),zn([]),Et("new"),Gn(!1),ee(""),b(""),je(""),st(""),ve(""),Le(""),re(""),Ie(""),ct(""),lt(S||B[0]?.code||""),Nt(""),Ve(null)}let Qe=aa(()=>sa(e,{canParkContext:Re}),[e,Re]);Y(()=>{Qe.some(o=>o.key===j)||ie(Qe[0]?.key??null)},[Qe,j]);let Za=Qe.length===0,Lt=Ae.trim()?`${Z}
4
+ ${Ae.trim()}`:Z,Qa=Do({email:ne,firstName:z,lastName:Oe,company:U.trim(),phone:xe,address:Lt,city:L,subdivision:ke,postcode:pe,country:W,lines:r.map(o=>[o.id,o.qty]),shippingMethodId:f,couponCode:hn(c),currency:a.currency,shopperId:dt?.id??null}),oe=JSON.stringify([Qa,j]),fe=q(null),un=q(null),It=q(!1),Me=q(!1),et=q(null),Tt=q(!1),ge=q(oe);ge.current=oe;let ur=q(Q);ur.current=Q;let Ft=q(null);Y(()=>{let o=()=>{let s=Ft.current;s&&(Ft.current=null,le(s),be(!1))};return window.addEventListener("pageshow",o),()=>window.removeEventListener("pageshow",o)},[]);function qt(o,s,u,P){let m={idempotencyKey:s,confirmation:u};ce.setItem(o,JSON.stringify(m)),window.location.assign(P),Ft.current=u}async function dr(o){be(!0);try{await o()}finally{Ft.current||be(!1)}}let pr=q(!1),mr=!!(sn||pt&&pt.kind!=="processing");Y(()=>{mr&&(pr.current=!0,ft())},[mr]);let Mt=q(null),mt=q(!1),dn=q(null);function ft(){dn.current=null,_n()}let _t=q(null),[tt,ei]=w(!1);function pn(o){if(pr.current||n||mt.current)return;let s=Pe.current,u={key:o,authed:ln.current,parkedAt:dn.current??=Date.now(),lastPress:s&&{key:s.key,request:Tn(s.request),lines:s.lines,goods:he(s.shape)[0],plainPressed:!!s.plainMethod,plainLines:s.plainLines,plainGoods:he(s.plainShape)[0]},keptCardKey:qe.current,placedGoods:fe.current===null?null:he(fe.current)[0],unpaidOrder:Kt.current&&qn(Kt.current),placedRequest:We.current&&Tn(We.current),lines:r.length>0?r:$e.current,form:Fn({email:ne,firstName:z,lastName:Oe,company:U,address1:Z,address2:Ae,city:L,postcode:pe,phone:xe,country:W,subdivision:ke,selectedAddressId:on,shippingMethodId:f,couponCode:c?.valid?c.code:null})};Mn(u)?ra(u):ft()}let Kt=q(G);Kt.current=G;let fr=q(j);fr.current=j;function mn(o){return{...na(o),...ua(),...o.payFirst?{checkoutFlow:Ct}:{}}}function ti(o,s){let u=o.request.payFirst?"":null,P=o.plainPressed?null:"",m=()=>fr.current??"";return{key:o.key,send:()=>s(mn(o.request)),request:mn(o.request),lines:o.lines,shape:JSON.stringify([o.goods,null]),get method(){return u??m()},set method(T){u=T},get plainMethod(){return P??m()},set plainMethod(T){P=T},plainLines:o.plainLines,plainShape:JSON.stringify([o.plainGoods,null])}}let[ni,ri]=w(!1),gr=ni?!a.quoted||a.serverSubtotal===null?"waiting":Math.abs(a.serverSubtotal-a.subtotal)<ss?"same":"changed":null,fn=!G&&gr==="waiting",oi=fn?{...a,repricing:!0}:a,yr=fn&&a.quoteFailed;Y(()=>{if(!yr)return;let o=setInterval(v,is);return()=>clearInterval(o)},[yr,v]);function hr(o,s=!0){ee(o.email),b(o.firstName),je(o.lastName),st(o.company),ve(o.address1),Le(o.address2),re(o.city),Ie(o.postcode),ct(o.phone),o.country&&lt(o.country),Ve({country:o.country||null,state:o.subdivision}),Et(o.selectedAddressId),o.shippingMethodId&&p(o.shippingMethodId),s&&(Mt.current=o.couponCode)}Y(()=>{let o=n?null:oa();if(o&&r.length>0&&(ft(),o=null),o){let s=o.authed?$.createOrderAuthed:$.createOrder;Rt(o.key),dn.current=o.parkedAt,Pe.current=o.lastPress&&ti(o.lastPress,s),qe.current=o.keptCardKey,fe.current=o.placedGoods===null?null:JSON.stringify([o.placedGoods,null]),ln.current=o.authed;let u=o.placedRequest&&mn(o.placedRequest);We.current=u,Fe.current=u?()=>s(u):null,o.unpaidOrder&&le(o.unpaidOrder),o.lines.length>0&&(C(o.lines),$e.current=o.lines,ri(!0)),o.form&&(_t.current=o.form,hr(o.form))}ei(!0)},[]),Y(()=>{!tt||r.length>0||Kt.current||Q||(mt.current=!0,ft())},[tt,r.length]),Y(()=>{let o=Mt.current;!tt||!o||r.length===0||(Mt.current=null,D(o,ne||void 0))},[tt,r.length]),Y(()=>{!tt||Q||pn(Ue)},[tt,Q,Ue,G]);let Ye=q(null);Y(()=>{ur.current||(oe!==Ye.current&&(Ye.current=null),!(!Me.current||!G||G.orderNumber)&&(oe===fe.current||oe===Ye.current||dr(()=>br(G))))},[oe,G]);async function br(o){if(Tt.current)return null;Tt.current=!0;try{let s=et.current?await Mo(et.current):"none";if(s==="succeeded"||s==="processing")return Me.current=!1,le(null),we("card"),s==="succeeded"?await Be(void 0,o):Er(o),null;if(s===void 0||!_o.has(s))return Ye.current=ge.current,le(o),se(s==="requires_action"?Fo:_e),null;let u=await Nn(Ue);if(u==="committed")return Me.current=!1,le(null),we("card"),await Be(void 0,o),null;if(u!=="released")return Ye.current=ge.current,le(o),se(_e),null;Me.current=!1,et.current=null,Ye.current=null,se(null),le(null);let P=vt();return Rt(P),P}finally{Tt.current=!1}}async function ai(){n||Q||Tt.current||await dr(ii)}async function ii(){if(G){if((Me.current?oe!==fe.current:gt())&&!G.orderNumber){let P=await br(G);P&&ge.current===oe&&await vr(P);return}se(null),It.current=!1,await gn();let s=he(ge.current)[1],u=G.orderNumber?s:"card";if(u&&la.has(u)&&gt()&&he(ge.current)[0]!==un.current){xr(G);return}we(u),u!==j&&ie(u),await Rr(G,u,!G.orderNumber);return}await vr(Ue)}async function vr(o){if(r.length===0||a.repricing||fn||!j||!Qe.some(A=>A.key===j))return;let s=r.filter(bt).flatMap(A=>jt(A.components,A.qty));if(s.length===0){se("Pick a size on each wheel's product page before checking out.");return}se(null);let u,P=o,m=j,T=!1;try{let A=dt?$.createOrderAuthed:$.createOrder,F={customer:{email:ne,name:`${z} ${Oe}`.trim(),phone:xe.trim()||void 0,companyName:U.trim()||void 0,address:Lt,city:L,state:ke||void 0,zipCode:pe,country:W},items:s,currency:a.currency,idempotencyKey:o,shippingMethodId:f??void 0,couponCode:hn(c),...ua(),...Io(j)?{checkoutFlow:Ct}:{}};Fe.current=()=>A(F),We.current=F,ln.current=!!dt,mt.current=!1,Vn(null),un.current=null,It.current=!1,et.current=null,Me.current=!1,Ye.current=null,fe.current=oe,$e.current=r;let J=Pe.current,Dt=J?.key===F.idempotencyKey&&(J.shape!==oe&&(!!F.checkoutFlow||!!J.method||!!J.plainMethod)||!!F.checkoutFlow&&!!J.plainMethod);Dt&&(qe.current=F.idempotencyKey);let Lr=wr(F,A),Ir=Dt||!F.checkoutFlow&&qe.current===F.idempotencyKey,Tr=!Lr&&!Ir&&!F.checkoutFlow&&!!J&&!J.method;Tr&&(J.plainMethod=j,J.plainLines=r,J.plainShape=oe,pn(F.idempotencyKey));let ze=await(Ir?Cr(F,A):A(F).then(yt=>({answer:yt,request:F})).catch(yt=>(Lr?kr(yt,F.idempotencyKey):Tr&&En(yt)&&(J.plainMethod=""),si(yt,F,A))));if(!ze)return;u=ze.answer,P=ze.request.idempotencyKey,m=ze.method??m,we(m),T=gt()||m!==he(ge.current)[1],ze.method&&ze.method!==j&&ie(ze.method),u.orderNumber&&(Nr(u),E()),await gn()}catch(A){let F=Kr(A);F?(d(F),se(`${F} Your order has not been placed. Place it again to continue without the code.`)):A instanceof at?se(_e):se(A instanceof ue?A.message:"Could not place the order. Please try again.");return}if(m&&la.has(m)&&(T||gt())){xr(u);return}await Rr(u,m,!1,P)}function xr(o){un.current=he(ge.current)[0],se(`${ca(o,null)} ${wn}`),le(o)}function kr(o,s){En(o)&&!Sn(o)&&Pe.current?.key===s&&(Pe.current=null)}async function si(o,s,u){if(Gt(o))return Pr(s,u);if(!Sn(o))throw o;return qe.current=s.idempotencyKey,Cr(s,u,!0)}async function Cr(o,s,u=!1){let P=await Nn(o.idempotencyKey);if(P==="released")return Pr(o,s);if(P!=="committed")throw new at;let m=Pe.current?.key===o.idempotencyKey?Pe.current:null;if($e.current=m?.lines??r,m?.method&&!u){qe.current=null,Fe.current=m.send,We.current=m.request;let F=await m.send().catch(()=>{throw new at});return fe.current=m.shape,{answer:F,request:o,method:m.method}}let T=m&&!m.method?m.send:()=>s({...o,checkoutFlow:Ct});Fe.current=T,We.current=m&&!m.method?m.request:{...o,checkoutFlow:Ct};let A=await T().catch(()=>null);if(!A&&m?.plainMethod)throw new at;return A?.orderNumber&&A.status!==To?(qe.current=null,m?.plainMethod&&($e.current=m.plainLines),m&&(fe.current=m.plainMethod?m.plainShape:m.shape),{answer:A,request:o,method:m?.plainMethod||void 0}):(m&&(fe.current=m.shape),we("card"),await Sr("",A?async()=>A:()=>Promise.reject(new Error("The order request did not answer."))),await gn(),null)}function gt(){let o=fe.current;return o!==null&&he(o)[0]!==he(ge.current)[0]}function we(o){o!==he(ge.current)[1]&&(It.current=!0),Vn(It.current||gt()?wn:null)}async function Pr(o,s){let u={...o,idempotencyKey:vt()};qe.current=null,Rt(u.idempotencyKey),Fe.current=()=>s(u),We.current=u,wr(u,s);try{return{answer:await s(u),request:u}}catch(P){throw kr(P,u.idempotencyKey),P}}function wr(o,s){return Pe.current?.key===o.idempotencyKey?!1:(Pe.current={key:o.idempotencyKey,send:()=>s(o),request:o,lines:r,shape:oe,method:o.checkoutFlow?"":j??"",plainMethod:"",plainLines:r,plainShape:oe},mt.current=!1,pn(o.idempotencyKey),!0)}function Nr(o){Wr({confirmation:o,lines:$e.current,adsSendTo:e.googleAdsId&&e.googleAdsConversionLabel?`${e.googleAdsId}/${e.googleAdsConversionLabel}`:null}),Go({confirmation:o,lines:$e.current})}async function Be(o,s=Te){if(!s)return;let u=o?async()=>o:Fe.current;if(s.orderNumber||!u){Ze(!0),me(s);return}await Sr(s.checkoutNumber,u)}async function Sr(o,s){E(),await jo({checkoutNumber:o,resend:s,page:{setConfirming:Ga,land:me,markPaid:()=>Ze(!0),track:Nr,unplaced:ar}})}function Er(o=Te){if(o){if(o.orderNumber){me(o);return}E(),ar({kind:"processing",checkoutNumber:o.checkoutNumber})}}async function gn(){let o=JSON.stringify([an.trim(),z,Oe,xe.trim(),Lt,L,ke,pe,W]);if(!(!dt||!Hn||on!=="new"||Xn.current===o))try{await nt.createAddress({label:an.trim()||"Home",contact_name:`${z} ${Oe}`.trim(),phone:xe.trim(),address:Lt,city:L,zip_code:pe,state:ke,country:W}),Xn.current=o,Jn("Address saved to your account.")}catch{Jn("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}}async function Rr(o,s=j,u=!1,P=Ue){le(null);try{if(s==="card"&&e.paymentMethods.includes("card")){let m=await $.createPaymentIntent({idempotencyKey:P});et.current=m;let T=o;if(u){let A=await Fe.current?.().catch(()=>null);if(A?.orderNumber){we("card"),await Be(A,o);return}T=Or(o,A)??{...o,expiresAt:null}}we("card"),Xe(T),cn(!1),Ot(m)}else if(s==="paypal"&&e.paymentMethods.includes("paypal"))Xe(o),_a(!0);else if(s==="afterpay"&&e.paymentMethods.includes("afterpay")){let m=window.location.origin,T=await $.createAfterpayCheckout({idempotencyKey:P,confirmUrl:`${m}/checkout?afterpay=confirm`,cancelUrl:`${m}/checkout?afterpay=cancel`});qt(Rn,P,o,T.redirectCheckoutUrl);return}else if(s==="square"&&e.paymentMethods.includes("square"))Xe(o),Ka(!0);else if(s==="gocardless"&&e.paymentMethods.includes("gocardless")){let m=window.location.origin,T=await $.createGocardlessBillingRequest({idempotencyKey:P,confirmUrl:`${m}/checkout?gocardless=confirm`,cancelUrl:`${m}/checkout?gocardless=cancel`});qt(Vt,P,o,T.authorisationUrl);return}else if(s==="zip"&&e.paymentMethods.includes("zip")){let m=window.location.origin,T=await $.createZipCheckout({idempotencyKey:P,redirectUrl:`${m}/checkout?zip=return`});qt(On,P,o,T.redirectUrl);return}else if(s==="klarna"&&e.paymentMethods.includes("klarna")){let m=window.location.origin,T=await $.createKlarnaCheckout({idempotencyKey:P,confirmUrl:`${m}/checkout?klarna=confirm`,cancelUrl:`${m}/checkout?klarna=cancel`});qt(Xt,P,o,T.redirectUrl);return}else we(s),me(o)}catch(m){if((u||s==="card")&&m instanceof ue&&m.status===409){we(s),await Be(void 0,o);return}Ar(o,m)}}function Or(o,s){return s&&!s.orderNumber&&s.status==="open"&&s.checkoutNumber===o.checkoutNumber?s:null}function Ar(o,s){se(ca(o,s)),!o.orderNumber&&Gt(s)?(Me.current=!1,Rt(vt())):le(o)}async function ci(o){if(!Te)return;let s=Te;try{let u=await $.createPaymentIntent({idempotencyKey:Ue}),P=await Fe.current?.().catch(()=>null);if(P?.orderNumber){await Be(P);return}let m=Or(s,P);Xe(m??{...s,expiresAt:null}),cn(o&&m!==null),et.current=u,Ot(u)}catch(u){if(u instanceof ue&&u.status===409){await Be();return}Ot(null),Xe(null),Ar(s,u)}}function li(){Te&&(Me.current=!0,le(Te),Ot(null),Xe(null),cn(!1))}return{site:e,logo:t,items:r,totals:oi,coupon:c,deliveryOptions:g,courierUnavailable:Aa,retryCourier:La,shippingMethodId:f,setShippingMethodId:p,pickupLocation:O,servedCountries:B,formatMoney:de,payChoice:j,setPayChoice:ie,placing:Q,email:ne,setEmail:ee,firstName:z,setFirstName:b,lastName:Oe,setLastName:je,company:U,setCompany:st,address1:Z,setAddress1:ve,address2:Ae,setAddress2:Le,city:L,setCity:re,postcode:pe,setPostcode:Ie,phone:xe,setPhone:ct,country:W,setCountry:lt,subdivision:ke,setSubdivision:Nt,subdivisions:ut,destination:$n,postcodeLabel:Ra,subdivisionLabel:Oa,me:dt,savedAddresses:Ia,selectedAddressId:on,setSelectedAddressId:Et,saveAddress:Hn,setSaveAddress:Gn,saveLabel:an,setSaveLabel:Ta,addressSaveNote:Fa,lostChangeNote:qa,idemKey:Ue,confirmation:sn,setConfirmation:me,orderError:Ma,payment:Zn,paypalStep:Qn,squareStep:er,pendingConf:Te,paid:Da,setPaid:Ze,unpaidOrder:G,orderLocked:tr,formLocked:ja,restoredPrices:gr,payNote:Ua,afterpayConfirming:Wa,gocardlessConfirming:Ya,zipConfirming:Ba,klarnaConfirming:Ha,cardConfirming:or,checkoutResult:pt,confirmCardPayment:Be,cardStillProcessing:Er,renewCardPayment:ci,holdRenewed:Ja,leaveCardPayment:li,checkoutRootRef:cr,setCheckoutHeaderEl:Va,fillFromAddress:lr,checkoutSignOut:Xa,payOptions:Qe,noPaymentMethod:Za,placeOrder:ai}}var fa=os(null);function ga({children:e,...t}){let n=cs(t);return Se(fa.Provider,{value:n,children:e})}function Ee(){let e=as(fa);if(!e)throw new Error("useCheckout must be used inside CheckoutStateProvider");return e}import{useId as Kn}from"react";import{Fragment as Ke,jsx as i,jsxs as N}from"react/jsx-runtime";function ha(){let{email:e,setEmail:t,firstName:n,setFirstName:r,lastName:a,setLastName:c,company:d,setCompany:g,me:f,checkoutSignOut:p,orderLocked:h,unpaidOrder:k}=Ee(),v=Kn();return N(en,{num:"N\xB0 01",title:"Contact",children:[h&&k&&i(us,{orderNumber:k.orderNumber}),i(ae,{label:"Email",htmlFor:v,hint:f?N(Ke,{children:["Signed in \xB7"," ",i("button",{type:"button",onClick:p,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:i("input",{id:v,type:"email",value:e,onChange:y=>t(y.target.value),placeholder:"you@example.com",readOnly:f!==null,className:te})}),N(Ca,{children:[i(ae,{label:"First name",children:i("input",{type:"text",value:n,onChange:y=>r(y.target.value),className:te})}),i(ae,{label:"Last name",children:i("input",{type:"text",value:a,onChange:y=>c(y.target.value),className:te})})]}),i(ae,{label:"Company (optional)",children:i("input",{type:"text",value:d,onChange:y=>g(y.target.value),autoComplete:"organization",className:te})})]})}function ba(){let{pickupLocation:e,servedCountries:t,address1:n,setAddress1:r,address2:a,setAddress2:c,city:d,setCity:g,postcode:f,setPostcode:p,phone:h,setPhone:k,country:v,setCountry:y,subdivision:E,setSubdivision:C,subdivisions:R,destination:D,postcodeLabel:O,subdivisionLabel:S,me:B,savedAddresses:X,selectedAddressId:de,setSelectedAddressId:j,saveAddress:ie,setSaveAddress:Re,saveLabel:De,setSaveLabel:Q,fillFromAddress:be,orderLocked:ne}=Ee(),ee=Kn(),z=Kn();return N(en,{num:"N\xB0 02",title:e?"Collection":"Shipping address",children:[e?N("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"})]}):N(Ke,{children:[B!==null&&X.length>0&&N("div",{className:"grid gap-3",children:[X.map(b=>i(Zt,{active:de===b.id,onClick:()=>{j(b.id),be(b)},title:b.label,body:b.formatted_address,price:null},b.id)),i(Zt,{active:de==="new",onClick:()=>j("new"),title:"New address",body:null,price:null})]}),i(ae,{label:"Address line 1",children:i("input",{type:"text",value:n,onChange:b=>r(b.target.value),className:te})}),i(ae,{label:"Address line 2",children:i("input",{type:"text",value:a,onChange:b=>c(b.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:te})}),N(Ca,{cols:"three",children:[i(ae,{label:"City",children:i("input",{type:"text",value:d,onChange:b=>g(b.target.value),className:te})}),i(ae,{label:O,children:i("input",{type:"text",value:f,onChange:b=>p(b.target.value),className:te})}),i(ae,{label:"Country",separate:!0,htmlFor:ee,children:i(vn,{id:ee,value:v,onChange:b=>y(b.target.value),className:te+" pr-10",style:ya,children:t.map(b=>i("option",{value:b.code,children:b.name},b.code))})})]}),i(ae,{label:S,separate:!0,htmlFor:z,children:R.length>0?N(vn,{id:z,value:E,onChange:b=>C(b.target.value),className:te+" pr-10",style:ya,children:[i("option",{value:"",children:"Select\u2026"}),R.map(b=>i("option",{value:b.code||b.name,children:b.name},b.code||b.name))]}):i("input",{id:z,type:"text",value:E,onChange:b=>C(b.target.value),className:te})})]}),i(ae,{label:"Phone",children:i("input",{type:"tel",value:h,onChange:b=>k(b.target.value),className:te})}),!e&&B!==null&&de==="new"&&!ne&&N(Ke,{children:[i(ds,{checked:ie,onChange:Re,label:"Save this address to my account"}),ie&&i(ae,{label:"Address label",children:i("input",{type:"text",value:De,onChange:b=>Q(b.target.value),placeholder:"Home",className:te})})]})]})}function va(){let{totals:e,coupon:t,deliveryOptions:n,shippingMethodId:r,setShippingMethodId:a,pickupLocation:c,formatMoney:d,city:g,destination:f,courierUnavailable:p,retryCourier:h}=Ee();return i(en,{num:"N\xB0 03",title:"Shipping",children:N("div",{className:"grid gap-3",children:[n.map(k=>{let v=k.pickupLocation,y=v?[v.address,v.city,v.state,v.zipCode].filter(Boolean).join(", "):null;return i(Zt,{active:r===k.id,onClick:()=>a(k.id),title:v?`${k.name} \u2014 ${v.name}`:k.name,body:v?[y,v.openingHours,v.instructions,k.description].filter(Boolean).join(" \xB7 "):k.description||null,price:e.freeShipping||k.amount===0?Ut:d(k.amount,e.currency),tag:k.tag||void 0},k.id)}),p?N("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[pa," ",i("button",{type:"button",onClick:h,className:"underline transition-colors enabled: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 xa(){let{payChoice:e,setPayChoice:t,payment:n,payOptions:r,noPaymentMethod:a}=Ee();return N(en,{num:"N\xB0 04",title:"Payment",children:[a&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:da}),i("div",{className:"grid gap-3",children:r.map(c=>i(Zt,{active:e===c.key,onClick:()=>t(c.key),title:c.title,body:c.body,price:c.price,tag:c.tag},c.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 ka(){let{site:e,items:t,totals:n,coupon:r,formatMoney:a,payChoice:c,placing:d,email:g,orderError:f,payment:p,noPaymentMethod:h,unpaidOrder:k,formLocked:v,restoredPrices:y,placeOrder:E}=Ee(),C=y==="waiting",R=y==="changed";return N("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:[N("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(wt,{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?N("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",i(wt,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):t.map(D=>i(ps,{slug:D.slug,name:D.name,qty:D.qty,config:D.config,configSummary:ms(D.config),price:R||C?null:zr(D,n.currency)??0,currency:n.currency},D.id))}),i(Qt,{locked:v,className:"border-t border-line px-6 pt-5",children:i(Xr,{customerEmail:g,disabled:v})}),N("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[i(Ge,{label:"Subtotal",value:C?jr:a(R?n.serverSubtotal??0:n.subtotal,n.currency)}),n.discount>0&&r?.valid&&i(Ge,{label:`Coupon \xB7 ${r.code}`,value:N("span",{className:"font-semibold text-green",children:["\u2212 ",a(n.discount,n.currency)]})}),r?.deferred&&i(Ge,{label:`Coupon \xB7 ${r.code}`,value:_r}),r?.valid&&r.effects?.gift&&i(Ge,{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:Ut})}),i(Ge,{label:"Shipping",value:n.shippingStatus==="free"?i("span",{className:"font-semibold text-green",children:Ut}):Yr(n.shippingStatus)??a(n.shipping,n.currency)}),n.tax&&(n.tax.charged?i(Ge,{label:n.tax.inclusive?`${n.tax.name} included \xB7 ${n.tax.rate}%`:n.tax.name,value:a(n.tax.amount,n.currency)}):n.tax.name?i(Ge,{label:n.tax.name,value:$r}):null)]}),N("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?Dr:a(n.grand,n.currency)})]}),N("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[R&&i(Ne,{tone:"quiet",children:Qo}),f&&i(Ne,{role:"alert",children:f}),n.hasUnpricedLine&&N(Ne,{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:E,disabled:d||!k&&(h||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",d||!k&&(t.length===0||h||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:d?N(Ke,{children:["Building order\u2026 ",i("span",{children:"\xB7"})]}):h?N(Ke,{children:["No online payment ",i("span",{children:"\xB7"})]}):k?N(Ke,{children:["Try payment again \xB7 ",Jt(k),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]}):n.repricing?N(Ke,{children:["Updating total\u2026 ",i("span",{children:"\xB7"})]}):N(Ke,{children:[c==="bank"?"Place order":"Continue to payment"," \xB7"," ",a(n.grand,n.currency),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})}var ls=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function Qt({locked:e,className:t="",children:n}){return i("fieldset",{disabled:e,className:"m-0 min-w-0 border-0 p-0 "+t+ls,children:n})}function wt({href:e,className:t="",children:n,...r}){let{placing:a}=Ee();return a?i("span",{"aria-disabled":"true","aria-label":r["aria-label"],className:t+" pointer-events-none",children:n}):i(He,{href:e,"aria-label":r["aria-label"],className:t,children:n})}function us({orderNumber:e}){return i(Ne,{tone:"quiet",role:"status",children:N("span",{className:"flex items-start gap-2",children:[N("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:ma(e)})]})})}var ya={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 en({num:e,title:t,children:n}){return N("section",{className:"mb-6 border border-line bg-bg",children:[N("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 Ca({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 Zt({active:e,onClick:t,title:n,body:r,price:a,tag:c}){return N("button",{type:"button",onClick:t,"aria-pressed":e,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":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].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"})}),N("span",{className:"flex min-w-0 flex-col gap-1",children:[N("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,c&&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:c})]}),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:a})]})}function ds({checked:e,onChange:t,label:n,sub:r}){return N("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"})}),N("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 ps({slug:e,name:t,qty:n,config:r,configSummary:a,price:c,currency:d}){let{catalog:g}=Wt(),{formatMoney:f}=ye(),p=g.find(C=>C.slug===e),h=p?.spokes??5,k=p?.mesh??!1,v=r.find(C=>C.gold)?.label,y=p?.finishes.find(C=>C.name===v&&C.src)??p?.finishes.find(C=>C.src),E=p?.finishes[0]?.color??Vr;return N("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[N("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:y?.src?i(Fr,{src:y.src,alt:`${t.lead}${t.accent} \u2014 ${y.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:E},children:i(Jr,{spokes:h,mesh:k,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})]}),N("div",{className:"flex min-w-0 flex-col gap-0.5",children:[N("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:a})]}),i("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:c===null?null:f(c,d)})]})}function Ge({label:e,value:t}){return N("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 ms(e){return e.map(t=>t.label).join(" \xB7 ")}import{Fragment as H,jsx as l,jsxs as x}from"react/jsx-runtime";function Un(e){return l(ga,{...e,children:l(ys,{})})}function fs({order:e,paid:t}){let{formatMoney:n}=ye();if(!e.grandTotal||!e.currency)return null;let r=d=>n(Number(d),e.currency),a=Number(e.freightCharge??0),c=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||a>0)&&x(H,{children:[x("dt",{className:"text-fg-dim",children:["Delivery",e.shippingMethod?` \xB7 ${e.shippingMethod}`:""]}),l("dd",{className:"text-right font-mono",children:r(e.freightCharge??"0")})]}),c>0&&x(H,{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")]})]}),l("dt",{className:"text-fg",children:t?"Total paid":"Order total"}),l("dd",{className:"text-right font-mono text-fg",children:r(e.grandTotal)})]})}function gs({result:e,lostChangeNote:t=null}){let n=l("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:[l("h1",{className:"font-display text-3xl",children:e.kind==="refunded"||e.kind==="expired"?"Order not placed":e.kind==="processing"?"Payment processing":"Payment received"}),l("p",{className:"text-fg-dim",children:e.kind==="refunded"?x(H,{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(H,{children:["The hold on checkout ",n," ran out before your payment arrived. Your payment goes back to your card."]}):e.kind==="processing"?x(H,{children:["Your payment for checkout ",n," is being processed. When it goes through, we will email your order confirmation."]}):x(H,{children:["Thank you \u2014 your payment",e.checkoutNumber?x(H,{children:[" for checkout ",n]}):null," has gone through. We will email you the order number shortly."]})}),t&&e.kind!=="refunded"&&e.kind!=="expired"&&l("p",{className:"text-sm text-fg-dim",children:t}),l(He,{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 ys(){let{site:e,logo:t,items:n,placing:r,formLocked:a,email:c,me:d,addressSaveNote:g,lostChangeNote:f,idemKey:p,confirmation:h,setConfirmation:k,payment:v,paypalStep:y,squareStep:E,pendingConf:C,paid:R,setPaid:D,payNote:O,afterpayConfirming:S,gocardlessConfirming:B,zipConfirming:X,klarnaConfirming:de,cardConfirming:j,checkoutResult:ie,confirmCardPayment:Re,cardStillProcessing:De,renewCardPayment:Q,holdRenewed:be,leaveCardPayment:ne,checkoutRootRef:ee,setCheckoutHeaderEl:z}=Ee();return h?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:R?"Payment received":"Order received"}),x("p",{className:"text-fg-dim",children:[R?x(H,{children:["Thank you \u2014 your payment for order"," ",l("span",{className:"font-mono text-fg",children:h.orderNumber})," has gone through."," "]}):x(H,{children:["Thank you \u2014 your order ",l("span",{className:"font-mono text-fg",children:h.orderNumber})," is being reviewed by our team."," "]}),d?x(H,{children:["Track it under"," ",l(He,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):l(H,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),l(fs,{order:h,paid:R}),f&&l("p",{className:"text-sm text-fg-dim",children:f}),O&&l("p",{className:"text-sm text-fg-dim",children:O}),g&&l("p",{className:"text-sm text-fg-dim",children:g}),!d&&x("p",{className:"text-sm text-fg-dim",children:["You can also"," ",l(He,{href:`/track?order=${encodeURIComponent(h.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),l(He,{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?l(gs,{result:ie,lostChangeNote:f}):j?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order \u2014 one moment."})]}):S?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):B?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):X?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):de?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):v&&C?l(hs,{payment:v,checkout:C,holdRenewed:be,onPaid:Re,onProcessing:De,onRenew:Q,onBack:ne}):y&&C?l(ks,{confirmation:C,clientId:e.paypalClientId??"",idemKey:p,onPaid:()=>{D(!0),k(C)},onSkip:()=>k(C)}):E&&C?l(Ps,{confirmation:C,applicationId:e.squareApplicationId??"",locationId:e.squareLocationId??"",environment:e.squareEnvironment??"production",idemKey:p,onPaid:()=>{D(!0),k(C)},onSkip:()=>k(C)}):x("div",{ref:ee,className:"bg-bg text-fg",children:[x("header",{ref:z,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 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(wt,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",l("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),l("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:l(wt,{href:"/","aria-label":`${e.name} home`,className:"inline-flex max-w-full items-center justify-center overflow-x-clip",children:l(Qr,{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,fitWordmarkToContainer:!0,fitFloorPx:Zr})})}),e.cardPayments?x("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[l("span",{className:"text-green",children:"\u25CF"}),l("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):l("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:[l("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),l("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(b=>x("span",{className:["relative flex items-center gap-2 transition-colors",b.state==="pending"?"text-fg-dim":"text-fg",b.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[l("span",{className:b.state==="done"?"text-accent font-bold":"",children:b.n}),l("span",{children:b.label})]},b.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:[x(Qt,{locked:a,children:[l(ha,{}),l(ba,{}),l(va,{})]}),l(Qt,{locked:r,children:l(xa,{})})]}),l(ka,{})]}),l("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:l("span",{children:Gr({legalName:e.legalName,foundedYear:e.foundedYear,siteName:e.name})})})]})}function hs({payment:e,checkout:t,holdRenewed:n,onPaid:r,onProcessing:a,onRenew:c,onBack:d}){let{formatMoney:g}=ye(),f=l("span",{className:"text-fg",children:g(Number(e.amount),e.currency)}),p=Pa(()=>Ht(e.publishableKey),[e.publishableKey]),h=Pa(()=>to(),[]);return l("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:[l("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:Jt(t)}),l("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:[l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:t.orderNumber?x(H,{children:["Your order is placed. Pay ",f," by card to confirm it now."]}):n?x(H,{children:["Your hold ran out, so your items are held again",t.expiresAt?` until ${wa(t.expiresAt)}`:"",". Enter your card again, then pay ",f,"."]}):x(H,{children:["Your items are held",t.expiresAt?` until ${wa(t.expiresAt)}`:"",". Pay ",f," by card to place your order."]})}),l(Pn,{stripe:p,options:{clientSecret:e.clientSecret,appearance:h},children:l(vs,{payment:e,checkout:t,onPaid:r,onProcessing:a,onRenew:c,onBack:d})},e.clientSecret)]})]})})}function wa(e){return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}var bs=5;function vs({payment:e,checkout:t,onPaid:n,onProcessing:r,onRenew:a,onBack:c}){let{formatMoney:d}=ye(),g=wo(),f=Co(),[p,h]=Je(!1),[k,v]=Je(null),y=it(!1);async function E(){try{return(await g.retrievePaymentIntent(e.clientSecret)).paymentIntent?.status}catch{return}}async function C(O){let S=O;for(let B=0;S==="processing"&&B<bs;B+=1)await new Promise(X=>setTimeout(X,1e3)),S=await E()??S;if(S==="succeeded"){n();return}if(S==="processing"){r();return}v("Payment did not complete. Please try again."),h(!1)}async function R(){if(!g||!f||p)return;h(!0),v(null),y.current=!0;let O=await g.confirmPayment({elements:f,redirect:"if_required"}).catch(()=>null);if(!O){let S=await E();if(S==="succeeded"||S==="processing"){await C(S);return}v(S===void 0?_e:"Payment failed. Please try again."),h(!1);return}if(O.error){if(!t.orderNumber&&O.error.code==="payment_intent_unexpected_state"){let S=await E();if(S==="succeeded"||S==="processing"){await C(S);return}if(S===void 0){v(_e),h(!1);return}await a(S==="canceled"),h(!1);return}v(O.error.message??"Payment failed. Please try again."),h(!1);return}await C(O.paymentIntent?.status)}async function D(){if(p)return;if(!y.current){c();return}h(!0),v(null);let O=await E();if(O==="succeeded"||O==="processing"){await C(O);return}if(h(!1),O===void 0){v(_e);return}c()}return x("div",{className:"flex flex-col gap-4",children:[l(No,{}),k&&l(Ne,{role:"alert",children:k}),l("button",{type:"button",onClick:R,disabled:!g||!f||p,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!g||!f||p?"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:p?x(H,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):x(H,{children:["Pay ",d(Number(e.amount),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),!t.orderNumber&&!p&&x("button",{type:"button",onClick:D,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",l("span",{children:"Back to checkout"})]})]})}var Na="paypal-sdk-js",Dn=null;function xs(e,t){let n=`${e}|${t}`;if(Dn?.key===n)return Dn.promise;let r=new Promise((a,c)=>{document.getElementById(Na)?.remove();let d=document.createElement("script");d.id=Na;let g=new URLSearchParams({"client-id":e,currency:t,intent:"capture"});d.src=`https://www.paypal.com/sdk/js?${g}`,d.onload=()=>{let f=window.paypal;f?a(f):c(new Error("PayPal SDK loaded without its namespace"))},d.onerror=()=>c(new Error("PayPal SDK failed to load")),document.head.appendChild(d)});return Dn={key:n,promise:r},r}function ks({confirmation:e,clientId:t,idemKey:n,onPaid:r,onSkip:a}){let{formatMoney:c}=ye(),d=it(null),[g,f]=Je(!1),[p,h]=Je(null),k=it(r);return k.current=r,Ea(()=>{let v=!1,y=null;return xs(t,e.currency).then(E=>{if(!(v||!d.current))return y=E.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await $.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async C=>{try{if((await $.capturePaypalOrder({idempotencyKey:n,paypalOrderId:C.orderID})).status==="paid"){k.current();return}h("PayPal did not complete the payment. Please try again.")}catch(R){h(R instanceof ue?R.message:"PayPal payment failed. Please try again.")}},onError:()=>{h("PayPal could not process the payment. Please try again.")}}),y.render(d.current).then(()=>{v||f(!0)})}).catch(()=>{v||h("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{v=!0,y?.close?.()}},[t,e.currency,n]),l("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:[l("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}),l("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"," ",l("span",{className:"text-fg",children:c(Number(e.grandTotal),e.currency)})," ","with PayPal to confirm it now."]}),!g&&!p&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),l("div",{ref:d}),p&&l(Ne,{role:"alert",children:p}),l("button",{type:"button",onClick:a,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 Sa="square-web-sdk",jn=null;function Cs(e){let t=e==="sandbox"?"sandbox":"production";if(jn?.key===t)return jn.promise;let n=new Promise((r,a)=>{document.getElementById(Sa)?.remove();let c=document.createElement("script");c.id=Sa,c.src=t==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",c.onload=()=>{let d=window.Square;d?r(d):a(new Error("Square SDK loaded without its namespace"))},c.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(c)});return jn={key:t,promise:n},n}function Ps({confirmation:e,applicationId:t,locationId:n,environment:r,idemKey:a,onPaid:c,onSkip:d}){let{formatMoney:g}=ye(),f=it(null),p=it(null),h=it(null),[k,v]=Je(!1),[y,E]=Je(!1),[C,R]=Je(null);Ea(()=>{let O=!1,S=null;return Cs(r).then(async B=>{if(O||!f.current)return;let X=B.payments(t,n);h.current=X,S=await X.card(),await S.attach(f.current),p.current=S,O||v(!0)}).catch(()=>{O||R("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{O=!0,S?.destroy?.()}},[t,n,r]);async function D(){let O=p.current;if(!(!O||y)){E(!0),R(null);try{let S=await O.tokenize();if(S.status!=="OK"||!S.token){R(S.errors?.[0]?.message??"Please check the card details and try again."),E(!1);return}let B;try{B=(await h.current?.verifyBuyer?.(S.token,{amount:String(e.grandTotal),currencyCode:e.currency,intent:"CHARGE"}))?.token}catch{}if((await $.chargeSquare({idempotencyKey:a,sourceId:S.token,...B?{verificationToken:B}:{}})).status==="paid"){c();return}R("Square did not complete the payment. Please try again.")}catch(S){R(S instanceof ue?S.message:"Square payment failed. Please try again.")}E(!1)}}return l("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:[l("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}),l("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"," ",l("span",{className:"text-fg",children:g(Number(e.grandTotal),e.currency)})," ","by card to confirm it now."]}),!k&&!C&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),l("div",{ref:f}),C&&l(Ne,{role:"alert",children:C}),l("button",{type:"button",onClick:D,disabled:!k||y,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!k||y?"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:y?x(H,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):x(H,{children:["Pay ",g(Number(e.grandTotal),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),l("button",{type:"button",onClick:d,disabled:y,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 tn}from"react/jsx-runtime";function ws(){let{settings:e,websiteName:t}=qr(),n=t?{...bn,name:t}:bn,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 tn("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:tn(Br,{children:tn(Hr,{preview:!0,children:tn(Un,{site:n,logo:r,preview:!0})})})})}export{ws as default};
@@ -1 +1 @@
1
- "use client";import{Bp as r}from"./chunk-G5XZ736Y.js";import"./chunk-UBOGEIFX.js";import"./chunk-SUX7QH3R.js";import"./chunk-Y6SLVHK3.js";import{jsx as o}from"react/jsx-runtime";import e from"efficient-easel/screen/components/ScreenStoreProvider";function a(t){return o(e,{...t,parts:r})}export{a as default};
1
+ "use client";import{vp as r}from"./chunk-RFFTWKCU.js";import"./chunk-FRCI3FAV.js";import"./chunk-GB6OHYUY.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{P as xe,X as _t,Z as Rt,_ as Nt,aa as G,g as wt}from"./chunk-MVJVIU2F.js";import{Ci as Xe,Di as Pt,Ie as Ct,gi as xt,ii as ze,ji as Ve,li as St,yi as Ce,zi as Et}from"./chunk-FRCI3FAV.js";import{c as vt,o as de}from"./chunk-GB6OHYUY.js";import{createContext as In,useContext as Ot,useEffect as Ln,useMemo as Se,useState as At}from"react";function It(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function fe(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 Ye=4,Vr=1,Xr={unit:"set",spares:0,spareSide:"left"};function Lt(e){return e.unit==="single"?1:Ye+e.spares}function Yr(e,t){return[{partNumber:e.partNumber,wheels:Lt(t),prices:e.prices}]}function Qr(e,t){let n=Lt(t)-Ye;if(n<=0||e.length===0)return e;let r=Rn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function Rn(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 Nn(e,t){return t.spares>0?`${e} + spare`:e}function jr(e){return e.unit==="single"?"Single":Nn(`Set of ${Ye}`,e)}var Zr="data-add-to-basket",Qe=9,kn="en",kt=new Map;function Te(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=kt.get(r);return o||(o=new Intl.NumberFormat(kn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),kt.set(r,o)),o}function Y(e,t,n=0){return Te(t,0,n).format(e)}function Jr(e,t){return Te(t).format(e)}function eo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=Y(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as Mn}from"react/jsx-runtime";var An="storefront-country",Tt=An,je=In(null);function Tn(e){return Mt(e,"catalogue")}function On(e){return Mt(e,"money")}function Mt(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 io({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Se(()=>t??[],[t]),a=Se(()=>n??[],[n]),l=Se(()=>r||i.find(m=>m.isDefault)?.code||i[0]?.code||"",[r,i]),c=Se(()=>o||a.find(m=>m.isDefault)?.code||a[0]?.code||"",[o,a]),[u,g]=At(c),[x,d]=At(!1);Ln(()=>{let m=de.getItem(Tt);m&&a.some(L=>L.code===m)&&g(m),d(!0)},[a]);function P(m){g(m),de.setItem(Tt,m)}let k=Se(()=>{let m=a.find(y=>y.code===u)??null,L=m?.currency,I=L&&i.some(y=>y.code===L)?L:l,A=Tn(i),_=On(i);return{country:u,currency:I,setCountry:P,currencies:i,countries:a,activeCountry:m,formatPrice:(y,U)=>A(y,U??I),formatMoney:(y,U)=>_(y,U??I),ready:x}},[u,i,a,l,x]);return Mn(je.Provider,{value:k,children:e})}function Dt(e){let t=Ot(je);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function ao(){return Ot(je)?.country??""}import{createContext as Yn,useCallback as E,useContext as Qn,useEffect as z,useMemo as jt,useRef as Q,useState as w}from"react";function Ft(){return"/edit"}function $t(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ht="We'll confirm this discount when you place your order.",fo="Confirmed at checkout";function po(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Ut="coupon_code: ";function mo(e){return!(e instanceof xe)||e.status!==400||!e.message.startsWith(Ut)?null:e.message.slice(Ut.length)}function Bt(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",Fn="Request a quote",qt="from ",bo="From ",Co="each",Wt="Free",xo="\u2026",So="Updating";function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Je(e,t){let n=e?.[t];return Ze(n)?n:null}function vo(e,t,n,r){let o=Je(e,n),i=Je(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Eo(e,t,n,r){if(n==null&&r==null)return!0;let o=Je(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Un={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function $n(e,t,n){if(!Ze(e))return Un;let r=Ze(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Po(e,t,n=""){return!e.priced||e.unit==null?Oe:`${n}${Y(e.unit,t)}`}function wo(e,t){return e.was==null?null:Y(e.was,t)}function Hn(e,t,n=1){let r=fe(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 Bn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function _o(e,t,n,r=1){let o=$n(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=Hn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Bn,fromSetTotal:i}}function qn(e,t){return!e.priced||e.unit==null?Oe:`${e.isFrom?qt:""}${Y(e.unit,t)}`}function Ro(e,t){return e.was==null?null:Y(e.was,t)}function No(e,t){return!e.priced||e.unit==null?Fn:qn(e,t)}function ko(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=Y(r-n,t);return{was:Y(r,t),amount:e.savingIsFrom?`${qt}${o}`:o}}var Wn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Gt(e){return Wn.test(e.trim())}var Kt="sf:ga-purchases",Gn=20;function Vt(){return typeof window>"u"||window.parent!==window}function ve(...e){try{if(Vt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Kn(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:fe(e.components,t)??0,quantity:e.qty}}function et(e,t){return e.filter(Me).map(n=>Kn(n,t))}function Mo(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 Xt(e,t){let n=et([e],t);n.length!==0&&ve("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Do(e){let t=et(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 zt=new Set;function zn(e){if(zt.has(e))return!1;zt.add(e);try{let t=JSON.parse(de.getItem(Kt)??"[]");if(t.includes(e))return!1;de.setItem(Kt,JSON.stringify([...t,e].slice(-Gn)))}catch{}return!0}function Fo(e){let t=e.confirmation;if(Vt()||!zn(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:et(e.lines,n)}),e.adsSendTo&&ve("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Vn="Arranged after review",Yt="Calculated at checkout",Xn=Yt,Ho=Yt;function Qt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Bo(e){switch(e){case"arranged":return Vn;case"pending":return Xn;case"free":return Wt;case"charged":return null}}import{jsx as er}from"react/jsx-runtime";var jn=400,Zn=400,Jn=1500;function Me(e){return(e.components?.length??0)>0}function Zt(e,t){return{code:e,valid:t.valid,deferred:$t(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function en(e,t){return fe(e.components,t)}function tt(e,t){let n=en(e,t);return n===null?null:n*e.qty}function Jt(e){return e!=="tyre"}var tn=Yn(null);function ei({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Dt(),[i,a]=w(t),[l,c]=w([]),[u,g]=w([]),[x,d]=w([]),[P,k]=w(!1),m=Q(new Set),[L,I]=w([]),[A,_]=w(!1),[y,U]=w(null),[V,J]=w(null),[T,b]=w(null),[R,C]=w(0),ee=E(()=>C(s=>s+1),[]),[pe,me]=w(void 0),[K,qe]=w(null),[v,O]=w(null),[ge,ie]=w(!1),[M,he]=w(null),te=Q(void 0),H=E(()=>a(!0),[]),ae=E(()=>a(!1),[]),X=E(()=>a(s=>!s),[]);z(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let $=Ft(),Re=Q($);z(()=>{Re.current!==$&&(Re.current=$,t||ae())},[$,t,ae]);let F=E(s=>{qe(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision&&p?.postcode===s?.postcode?p:s)},[]),Ne=E((s,p)=>{_(!0),!(!p||!Jt(s))&&I(f=>f.includes(p)?f:[...f,p])},[]),se=A||l.length>0,le=Q(!0);z(()=>(le.current=!0,()=>{le.current=!1}),[]),z(()=>{if(t)return;let s=[...L,...l.filter(f=>Jt(f.kind)).map(f=>f.slug)],p=[...new Set(s)].filter(f=>f&&!m.current.has(f));if(p.length!==0){for(let f of p)m.current.add(f);G.listWheelsBySlug(p).then(f=>{if(!le.current||f.length===0)return;let h=new Set(f.map(S=>S.slug));g(S=>[...S.filter(re=>!h.has(re.slug)),...f])})}},[t,L,l]),z(()=>{if(t||!se||P)return;let s=!0;return G.listBundles().then(p=>{s&&(d(p),k(!0))}),()=>{s=!1}},[t,se,P]);let B=y?.deliveryOptions??[],ye=y?.courier??null;z(()=>{y&&he(s=>s&&B.some(p=>p.id===s)?s:B[0]?.id??null)},[y]);let ne=E(()=>l.filter(Me).flatMap(s=>It(s.components,s.qty)),[l]),ue=E(async(s,p)=>{let f=s.trim().toUpperCase();if(!f)return;let h=ne();if(h.length===0){O({code:f,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),te.current=p;try{let S=await G.validateCoupon({code:f,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:p});O(Zt(f,S))}catch{O({code:f,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[ne,n,M]),ke=E(()=>{O(null),te.current=void 0},[]),Ie=E(s=>{if(!v)return;let{code:p}=v;O(f=>f&&f.code===p?{code:p,valid:!1,refused:!0,message:s}:f)},[v]);z(()=>{if(!v||v.refused)return;let s=v.code,p=h=>h!==null&&h.code===s&&!h.refused,f=setTimeout(async()=>{let h=ne();if(h.length===0){O(S=>p(S)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:S);return}ie(!0);try{let S=await G.validateCoupon({code:s,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:te.current});O(re=>p(re)?Zt(s,S):re)}catch{}finally{ie(!1)}},jn);return()=>clearTimeout(f)},[l,n,M]);let N=v&&!v.refused?v.code:void 0;z(()=>{if(t)return;let s=!0,p=l,f=setTimeout(async()=>{let h=ne();if(h.length===0){U(null),J(null),me(void 0);return}try{let S=await G.quoteCart({items:h,currency:n,shippingMethodId:M??void 0,couponCode:N,customerEmail:te.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!s)return;U(S),J(p),b(null)}catch{if(!s)return;b(p)}me(N)},Zn);return()=>{s=!1,clearTimeout(f)}},[l,n,M,N,r,K,R]);let q=E(s=>{c(p=>{let f=p.findIndex(h=>h.id===s.id);return f===-1?[...p,s]:p.map((h,S)=>S===f?{...h,qty:Math.min(Qe,h.qty+s.qty)}:h)}),Xt(s,n)},[n]),Le=E(s=>{c(p=>p.filter(f=>f.id!==s))},[]),lt=E((s,p)=>{let f=Math.max(1,Math.min(Qe,p));c(h=>h.map(S=>S.id===s?{...S,qty:f}:S))},[]),ut=E(s=>{c(s)},[]),[be,xn]=w(null),ct=Q(null);ct.current=be;let W=Q(null),We=Q(""),dt=E((s,p)=>{let f=s.trim().toLowerCase();Gt(f)&&xn(h=>h&&h.email===f&&h.firstName===(p??"")?h:{email:f,firstName:p??""})},[]);z(()=>{if(t||!be)return;let s=Bt(l.filter(Me),h=>tt(h,n)===null?Oe:o(tt(h,n),n)),p={email:be.email,firstName:be.firstName,currency:n,items:s},f=JSON.stringify(p);if(f!==We.current)return W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,We.current=f,G.captureCart(p).catch(h=>{})},Jn),()=>{W.current&&(clearTimeout(W.current),W.current=null)}},[l,be,n,t]);let ft=E(()=>{W.current&&(clearTimeout(W.current),W.current=null);let s=ct.current;s&&(We.current="",G.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),pt=jt(()=>{let s=l.reduce((D,ce)=>{let Ae=tt(ce,n);return Ae===null?D:D+Ae},0),p=l.some(D=>en(D,n)===null),f=l.reduce((D,ce)=>D+ce.qty,0),h=v?.valid?v.effects:void 0,S=h?Math.min(s,Number(h.discountAmount)):0,re=y?.bundleDiscount??0,vn=y?.appliedBundles??[],Ge=!!h?.freeShipping,yt=B.find(D=>D.id===M),bt=Ge?0:y?.shipping??yt?.amount??0,En=Qt({quoted:y!==null,optionCount:B.length,chosenAmount:yt?.amount,couponWaivesFreight:Ge}),Ke={};for(let D of h?.freeUnits??[])Ke[D.partNumber]=(Ke[D.partNumber]??0)+D.quantity;let Pn=y?.tax??null,wn=y?y.grandTotal:s-S-re+bt;return{sets:f,units:l.reduce((D,ce)=>D+(ce.components??[]).reduce((Ae,_n)=>Ae+_n.wheels*ce.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:S,bundleDiscount:re,appliedBundles:vn,shipping:bt,freeShipping:Ge,shippingStatus:En,freeUnitsByPartNumber:Ke,tax:Pn,grand:wn,repricing:!!v?.refused&&y!==null&&pe===v?.code,quoted:y!==null&&V===l,serverSubtotal:y?.subtotal??null,quoteFailed:T===l,currency:n}},[l,n,v,B,M,y,pe,V,T]),mt=Q(!0),gt=E(s=>{mt.current=s},[]),ht=E(s=>{q(s),mt.current&&H()},[q,H]),Sn=jt(()=>({isOpen:i,preview:t,open:H,close:ae,toggle:X,items:l,catalog:u,bundles:x,warmCatalog:Ne,add:q,addAndOpen:ht,setAutoOpen:gt,remove:Le,setQty:lt,replaceItems:ut,identify:dt,clearCapturedCart:ft,coupon:v,applyCoupon:ue,removeCoupon:ke,refuseCoupon:Ie,couponBusy:ge,deliveryOptions:B,setQuoteDestination:F,courier:ye,requote:ee,shippingMethodId:M,setShippingMethodId:he,totals:pt}),[i,t,H,ae,X,l,u,x,Ne,q,ht,gt,Le,lt,ut,dt,ft,v,ue,ke,Ie,ge,B,F,ye,ee,M,pt]);return er(tn.Provider,{value:Sn,children:e})}function nn(){let e=Qn(tn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as cr}from"react";function rn(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function on(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 tr=6e4,nr=5e3,rr=500,De=new Map;async function or(e){let{host:t,matchesRequestHost:n}=await _t();if(!t)return"";let r=await Rt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function an(e,t){if(await Nt()!==null)return t();let n=await or(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?nr:tr,c=De.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,g=a&&u?u:i;return on(De,rr,rn,r),De.set(n,{load:g,expiresAt:r+l,lastGood:u}),g}var ir=404;function ar(e){if(e instanceof xe&&e.status===ir)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 sr="[storefront:chrome-load-failed]";function lr(e,t){console.error(`${sr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function sn(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=ar(o);return i.state==="failed"&&lr(e,i),{value:n,outcome:i}}}function ur(e){return e==="production"?"silent":"banner"}var li=ur("production");function dr(e,t){return e?.trim()||t}function hi({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=dr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var fr={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,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:Xe},yi=cr(async()=>an("site",()=>sn("site",async()=>{let e=await G.getSite();return{name:Et(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,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Pt(e.socialLinks)}},fr)));var bi={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,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:Xe};import{jsx as pr}from"react/jsx-runtime";function xi({tone:e="bad",role:t,children:n}){return pr("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 nt}from"react/jsx-runtime";import{useEffect as Fe,useId as yr,useRef as un,useState as Ue}from"react";import{useRootIsDark as br}from"efficient-shell/theme";import{efficientClientOpen as mr}from"efficient-easel/screen/lib/session";var Ee=new Map,gr=64;async function hr(e){if(!mr())return null;try{let t=await fetch(`${vt()}/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 ln(e){let t=Ee.get(e);if(t)return t;let n=hr(e);if(Ee.set(e,n),Ee.size>gr){let r=Ee.keys().next();r.done||Ee.delete(r.value)}return n}var Cr=202/22,xr=.88,$i=16,Sr="invert(1)";function Hi({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:g,wordmark:x,siteName:d=Ce,fitToContainer:P=!1,fitWordmarkToContainer:k=!1,fitFloorPx:m,hideClass:L,hideAttrs:I}){let A=x&&x.trim()?x.trim():d,[_,y]=Ue(null),U=un(null),V=N=>{U.current=N};Fe(()=>{y(U.current?.ownerDocument??null)},[]);let J=!br({doc:_,whenUnset:!0}),T=n&&n.trim()?n.trim():null,b=!!T&&wt(T),R=i??(J&&t),C=o&&o.trim()?o.trim():null,ee=r&&!C,pe=`logo-color-${yr().replace(/[^A-Za-z0-9_-]/g,"")}`,me=ee&&b&&T&&a!=null?{reversed:a,inkIsDark:l??null}:null,K=me!==null,[qe,v]=Ue(null);Fe(()=>{if(!ee||!T||!b||K){v(null);return}let N=!1;return v(null),ln(T).then(q=>{N||v(q)}),()=>{N=!0}},[ee,T,b,K]);let O=me??qe,ge=!!O&&O.inkIsDark!==null&&(R?!O.inkIsDark:O.inkIsDark),ie=ee&&!!T&&!b&&!R,M=ge&&O?O.reversed:T,he=M?[M]:[],[te,H]=Ue(0);Fe(()=>{H(0)},[T,ge]);let ae=e==="footer"?Ve:ze[c],X=u&&u>0?u:ae,$=(u&&u>0?Ct(u,g,"size",St):null)??`${X}px`,Re=Math.round(X*Cr),F=te<he.length?he[te]:null,[Ne,se]=Ue(M),le=F!==null&&F===Ne,B=un(null);Fe(()=>{let N=B.current;if(!N||!N.complete)return;if(N.naturalWidth>0||N.naturalHeight>0){se(F);return}let q=!1;return N.decode().then(()=>!q&&se(F),()=>!q&&H(Le=>Le+1)),()=>{q=!0}},[F]);let ye=P||k,ne=`calc(100cqi / ${((A.length+1)*xr).toFixed(2)})`,ue=ye&&m&&m>0?$===`${X}px`?`${Math.min(m,X)}px`:`min(${m}px, ${$})`:null,ke=ye?ue===null?`min(${$}, ${ne})`:`clamp(${ue}, ${ne}, ${$})`:$,Ie=nt("span",{className:`font-display font-bold tracking-[0.18em] ${ue===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ke,lineHeight:1,...C?{color:C}:{}},"aria-label":A,children:[A,Pe("span",{className:"text-accent",style:C?{color:C}:void 0,children:"."})]});return nt("span",{ref:V,className:xt("inline-flex items-center",L??""),...I,children:[!le&&Ie,C&&F&&Pe("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:nt("filter",{id:pe,colorInterpolationFilters:"sRGB",children:[Pe("feFlood",{style:{floodColor:C}}),Pe("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&Pe("img",{ref:B,src:F,alt:A,width:Re,height:X,className:"shrink-0 object-contain",style:{...le?{height:$,width:"auto",...P?{maxWidth:"100cqi"}:{}}:{display:"none"},...ie?{filter:Sr}:{},...C?{filter:`url(#${pe})`}:{}},onLoad:()=>se(F),onError:()=>H(N=>N+1)},F)]})}var qi="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",cn="w-0 min-w-0 flex-1",Wi="w-0 min-w-[7rem] flex-1";import{jsx as we,jsxs as Er}from"react/jsx-runtime";function vr({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 g=u+Math.PI/e;l.push({x1:a(100+Math.cos(g)*22*1.4),y1:a(100+Math.sin(g)*22*1.4),x2:a(100+Math.cos(g)*78),y2:a(100+Math.sin(g)*78),main:!1})}}return Er("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 Vi="#c9a461",dn=[{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"}],Xi={name:"",color:"var(--fg)",family:"silver",src:""};function Pr(e,t){let n=r=>{let o=dn.findIndex(i=>i.f===r);return o===-1?dn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Yi(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(Pr)}import{useState as wr}from"react";import{jsx as oe,jsxs as rt}from"react/jsx-runtime";function _r({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=nn(),[a,l]=wr("");async function c(){t||i||!a.trim()||(await r(a,e),l(""))}return rt("div",{className:"flex flex-col gap-2",children:[n===null?rt("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:`${cn} 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"})]}):rt("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:Ht}):n&&!n.valid&&n.message&&oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var ot="Ads on. Shopper can opt out.",$e="Ads and analytics off until Accept",Rr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:ot,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:ot,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:ot,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 Nr(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 ra(e,t,n){let r=Nr(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 oa={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var kr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Ir=kr;function la(e=Ir){if(e.asked)return e.ads?"granted":"denied"}function ca(){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 Ar,isValidElement as Tr,useEffect as pn,useId as Or,useLayoutEffect as hn,useRef as j,useState as mn}from"react";var He=(e,t)=>!!e[t]&&!e[t].disabled;function it(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 at(e,t){return it(e,t===1?-1:e.length,t)}function st(e,t){return He(e,t)?t:Math.max(at(e,1),0)}function fn(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:it(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:it(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:at(n,1)}),handled:!0};case"End":return{state:i({focus:at(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 Mr}from"efficient-shell/ui";import{Fragment as qr,jsx as Z,jsxs as yn}from"react/jsx-runtime";var gn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Dr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=mn(!1),c=r!==void 0,u=c?r:a,[g,x]=mn(0),d=j({text:"",timer:0}),P=j(null),k=j(null),m=j(null),L=Or(),I=j(null),A=e.findIndex(b=>b.value===t),_=b=>{b!==u&&(c||l(b),b?o?.():i?.())},y=b=>{let R=e[b];!R||R.disabled||(n(R.value),_(!1),k.current?.focus())},U=b=>{let R={open:u,focus:u?g:st(e,A),typed:d.current.text},C=fn(R,b,e);return!C.handled&&C.state.open===u?!1:(C.state.typed!==R.typed&&(d.current.text=C.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),x(C.state.focus),C.commit!==void 0?y(C.commit):_(C.state.open),C.refocus&&k.current?.focus(),C.handled)},V=j(U);V.current=U;let J=j(()=>_(!1));J.current=()=>_(!1);let T=b=>{u||(I.current=b.nativeEvent,V.current(b.key)&&b.preventDefault())};return pn(()=>{if(!u)return;let b=C=>{P.current?.contains(C.target)||J.current()},R=C=>{C!==I.current&&V.current(C.key)&&C.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",R)}},[u]),pn(()=>{u&&(d.current.text||x(st(e,A)))},[u]),hn(()=>{if(!u||!m.current)return;m.current.children.item(g)?.scrollIntoView({block:"nearest"})},[g,u]),{open:u,toggle:()=>_(!u),close:()=>_(!1),focusIdx:g,setFocusIdx:x,pick:b=>y(e.findIndex(R=>R.value===b)),wrapRef:P,triggerRef:k,listRef:m,listId:L,onTriggerKeyDown:T,activeId:u?`${L}-${g}`:void 0}}var Fr={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 ${gn.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 ${gn.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 Ur(e,t){hn(()=>{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",g=Mr({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(g.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=g.top+Math.min(c.height,g.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}g.maxHeight<c.height&&(i.maxHeight=`${g.maxHeight}px`,i.overflowY="auto");let x=g.left-c.left;x&&(i.translate=`${x}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function $r(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Hr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c,align:u="start"}){let g=Fr[t],x=j(null);return Ur(x,n.length),Z("ul",{ref:d=>{x.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...g.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?$r(g.list):g.list,children:n.map((d,P)=>{let k=d.value===r;return Z("li",{id:`${e}-${P}`,role:"option","aria-selected":k,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(P),onMouseDown:m=>{m.preventDefault(),d.disabled||a(d.value)},className:g.item(P===o,k&&d.value!=="",!!d.disabled,P===n.length-1),style:g.itemStyle?.(k),children:d.meta===void 0?d.label:yn(qr,{children:[d.lead,Z("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Z("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${P}`)})})}function Br({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c,align:u}){let g=Ar.toArray(r).flatMap(m=>{if(!Tr(m))return[];if(m.type!=="option")return[];let I=m.props,A=I.value!==void 0?String(I.value):"",_=I.children,y=typeof _=="string"||typeof _=="number"?String(_):A;return[{value:A,label:y,disabled:!!I.disabled}]}),x=e??"",d=Dr({items:g,value:x,onPick:m=>t?.({target:{value:m}})}),k=g.find(m=>m.value===x)?.label??g[0]?.label??"";return yn("div",{ref:d.wrapRef,className:"relative",children:[a&&Z("input",{type:"hidden",name:a,value:x}),Z("button",{ref:m=>{d.triggerRef.current=m},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:m=>!n&&d.onTriggerKeyDown(m),className:`block w-full ${o??""}`,style:i,children:Z("span",{className:"block w-full truncate text-left",children:k})}),d.open&&Z(Hr,{id:d.listId,tone:"select",items:g,value:x,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:u})]})}import{jsx as _e,jsxs as Be}from"react/jsx-runtime";var Wr="font-mono text-[length:var(--size-label,12px)]",Gr="font-semibold uppercase tracking-[0.22em] text-fg";function bn(e){return`${e??Wr} ${Gr}`}function Cn(){return _e("span",{className:"text-accent",children:" *"})}function Kr({children:e,required:t,labelFace:n}){return Be("span",{className:bn(n),children:[e,t?_e(Cn,{}):null]})}function zr({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?_e("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:bn(i),children:[e,t?_e(Cn,{}):null]}),l,u]}):Be("label",{htmlFor:o,className:c,children:[_e(Kr,{required:t,labelFace:i,children:e}),l]})}export{Ft as a,fo as b,po as c,mo as d,It as e,Ye as f,Vr as g,Xr as h,Yr as i,Qr as j,Rn as k,Nn as l,jr as m,Zr as n,Qe as o,Te as p,Y as q,Jr as r,eo as s,Oe as t,Fn as u,qt as v,bo as w,Co as x,Wt as y,xo as z,So as A,Je as B,vo as C,Eo as D,$n as E,Po as F,wo as G,Hn as H,_o as I,qn as J,Ro as K,No as L,ko as M,Gt as N,Mo as O,Do as P,Fo as Q,Ho as R,Bo as S,io as T,Dt as U,ao as V,Me as W,tt as X,ei as Y,nn as Z,hi as _,fr as $,bi as aa,qi as ba,cn as ca,Wi as da,vr as ea,Vi as fa,dn as ga,Xi as ha,Pr as ia,Yi as ja,_r as ka,xi as la,$i as ma,Hi as na,Rr as oa,ra as pa,oa as qa,kr as ra,la as sa,ca as ta,Dr as ua,Hr as va,Br as wa,Kr as xa,zr as ya};