efficient-storefront-blocks 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.36.0 — 2026-10-16
4
+
5
+ **The site's header and footer are edited on the page** (card [BUILD] Header And Footer In Place, PR 4 of the plan `_desk/plans/2026-10-15-header-footer-in-place.md`; design approved by Lewis 2026-10-15: https://claude.ai/artifact/53ddJmXavpdDspYJrqVf6q). The builder now carries the site-footer document's header and footer in every page's working document (efficient-web-builder `pinned-chrome-doc`), so they render as nodes of the page and are edited where they stand. This is the blocks' half. **Needs the builder release that turns that on** (PR 3); on an older builder a site page shows no footer in the editor.
6
+
7
+ - **Builds on efficient-web-builder 16.0.2 and needs efficient-easel ^8.3.0** (the easel peer narrows from ^8.1.0, the builder moves from ^15.1.1): 16.0.0 carries the header and footer in each page (16.0.1: a page still opens when the site-footer document fails to load; 16.0.2: a set hero height grows to fit its words on a phone), and easel 8.3.0 draws them in place (the band tab, the Layers badge, the change notice, the section limits).
8
+ - **No footer focus.** The site-footer page's focus body (the page you came from, locked above an editable footer), its read-only origin render, the read-only footer drawn under every page (`PreviewFooter`) and the primer that fetched it (`PreviewFooterPrimer`) are gone. The footer is part of the page now.
9
+ - **One header bar.** The page's header placeholder draws nothing once the page carries the Box header group, read off the live document, so "Switch to Box header" shows at once. The old header keeps its preview and its Header panel.
10
+ - **The Box header, edited, draws its bar**: the `SiteHeader` group wraps its sections in `BoxHeaderBar` while edited (height, sticky mode, theme, top text colour), as the live site draws it. Published, `PublishedHeader` still draws the bar.
11
+ - **The footer, edited in place, wears the site's colours.** It draws inside the page body now, whose background is the page's own (white unless the page names one); the read-only footer it replaced sat outside it, on the site theme. The Box footer group and the old Footer re-apply `.sf-theme-surfaces` while edited, as the old header's preview does, so a graphite site's footer is no longer white in the editor (the 2026-09-09 defect). Live they are unchanged: an authored footer colour still wins.
12
+ - **"Switch to Box header" is at the top of the Header panel**, which a click on the old header opens in place, as the shell's `Banner` ("This header uses the old layout", one button; it still asks once and is one Undo). It is no longer a panel of the site-footer page (`panels.chromePage` is not handed).
13
+ - **Guards on builder 16.0.2:** `test-shell-peer-range` pins easel ^8.3.0 and the builder ^16.0.2; `test-web-host-contract` expects the new `editsPinnedInPlace` capability (false where the adapter is made directly; the site's own addressing turns it on); `test-template-editor-isolation`'s fake API answers the site-footer lookup with an empty list, as the real API does for a site with no footer page yet, and a new case (3b) answers it with a 404: the site page still opens.
14
+ - **Guards:** new `test-header-footer-in-place` (16 checks, all failing on 0.32.3). `test-template-editor-isolation`: the site-footer page is read by the builder's adapter, not by a furniture primer, so the check "without the host's furniture nothing reads it" is dropped. `ui-kit.baseline.json` goes down (config.tsx: one raw button, one `title`, two hex colours left with the focus body).
15
+
16
+ ## 0.35.0 — 2026-10-16
17
+
18
+ **The storefront's chat bubble can be the streaming assistant.** The backend
19
+ says so in `GET /api/v1/chat-settings` (`assistantChat`, efficient-backend
20
+ `feat(storefront)/assistant-chat-signal`); the storefront's `ChatMount` then
21
+ mounts `AssistantChatMount`, the shared `efficient-shell/ai`
22
+ (efficient-shell 7.46.0; the peer is now `^7.46.0`), in place of the classic
23
+ `ChatWidget`. A site without the field, or with it false, keeps the classic
24
+ chat exactly as it was.
25
+
26
+ - **The chat is loaded only when a visitor asks for it.** `AssistantChatMount`
27
+ is a launcher drawn with inline styles (no stylesheet); `AssistantChatPanel`,
28
+ `efficient-shell`'s assistant chat and its compiled utilities (15 KB, no
29
+ reset, no theme variables) are one lazy chunk, fetched on the first click or when the pointer or
30
+ focus reaches the launcher. The page pays for neither until then.
31
+ - **`AssistantChatPanel`.** A guest's conversation id and
32
+ guest token are kept per site in `sf:chat:assistant:<site>` (the classic
33
+ chat's `sf:chat` is left alone: the two are different conversations on the
34
+ server); a signed-in shopper rides their Bearer token and
35
+ `X-Portal-Audience: shop`, and an expired token is refreshed once and the
36
+ request repeated. The message history is never sent: the server holds it.
37
+ A 403 on the stream (the assistant was turned off since the page loaded, or
38
+ the shopper's role lacks it) hands the bubble back to the classic chat.
39
+ - **A person can take the conversation over, and the visitor sees it live.**
40
+ The assistant thread is a live-chat conversation, so the same `ws/chat/`
41
+ socket the classic widget uses tells the chat when the team wrote; the chat
42
+ adds that reply under its own name. The socket moved from `ChatContext` to
43
+ `lib/chat-socket`, one owner for both chats (the classic widget's behaviour
44
+ is unchanged).
45
+ - **Wording.** The classic chat's built-in title and greeting ("leave your
46
+ details and we'll reply") are not true of an automated assistant, so only
47
+ wording the merchant changed is used; otherwise the chat says it is the
48
+ shop's automated assistant and that a person is one question away.
49
+ - `ChatSettings` gains `assistantChat` (from the storefront's `openapi.yml`).
50
+ `ai`, `@ai-sdk/react` and `zod` are dev dependencies here (the shell's chat
51
+ needs them to compile); the storefront installs them, as the shell's README
52
+ says.
53
+ - The editor is untouched: `ChatMount` still withholds the chat on `/edit/*`
54
+ and `EditorPreviewChat` keeps its inert copy of the classic widget.
55
+
3
56
  ## 0.34.0 — 2026-10-16
4
57
 
5
58
  - **The sheet draws a section's and a Box's own Border** (Box Border, approved
@@ -1,4 +1,4 @@
1
- "use client";import{F as jt,G as qt,H as _t,I as Ft,J as oe,K as Se,L as Dt,M as Mt,N as Je,O as Ut,Q as Xe,W as Wt,Z as Ze,_ as $t,a as At,b as Lt,c as Ot,d as Tt,ea as K,fa as Kt,ga as Yt,ha as zt}from"./chunk-ZK4TVVHJ.js";import{i as je,o as pe,w as T}from"./chunk-OADA35KT.js";import{La as Rt,a as Et,c as te}from"./chunk-P5QC7OSD.js";import{r as It,s as Ce,t as H}from"./chunk-TNXPBHCM.js";import{a as Ge,b as rr}from"./chunk-Y6SLVHK3.js";var Ht=Ge((ea,Bt)=>{"use strict";var ar="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Bt.exports=ar});var Xt=Ge((ta,Jt)=>{"use strict";var or=Ht();function Vt(){}function Gt(){}Gt.resetWarningCache=Vt;Jt.exports=function(){function t(a,o,s,l,d,p){if(p!==or){var u=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 u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Gt,resetWarningCache:Vt};return n.PropTypes=n,n}});var Qt=Ge((aa,Zt)=>{"use strict";Zt.exports=Xt()();var na,ra});import{useEffect as z,useMemo as Ke,useRef as se,useState as g}from"react";var P=rr(Qt(),1);import x from"react";function en(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function ir(t){if(Array.isArray(t))return t}function on(t,e,n){return(e=dr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a,o,s,l,d=[],p=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(p=(a=s.call(n)).done)&&(d.push(a.value),d.length!==e);p=!0);}catch(v){u=!0,o=v}finally{try{if(!p&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return d}}function cr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ "use client";import{F as jt,G as qt,H as _t,I as Ft,J as oe,K as Se,L as Dt,M as Mt,N as Je,O as Ut,Q as Xe,W as Wt,Z as Ze,_ as $t,a as At,b as Lt,c as Ot,d as Tt,ea as K,fa as Kt,ga as Yt,ha as zt}from"./chunk-IYPIVAIO.js";import{i as je,o as pe,w as T}from"./chunk-O624SD7C.js";import{La as Rt,a as Et,c as te}from"./chunk-EZGGINPR.js";import{r as It,s as Ce,t as H}from"./chunk-UT6IGC4H.js";import{a as Ge,b as rr}from"./chunk-Y6SLVHK3.js";var Ht=Ge((ea,Bt)=>{"use strict";var ar="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Bt.exports=ar});var Xt=Ge((ta,Jt)=>{"use strict";var or=Ht();function Vt(){}function Gt(){}Gt.resetWarningCache=Vt;Jt.exports=function(){function t(a,o,s,l,d,p){if(p!==or){var u=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 u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Gt,resetWarningCache:Vt};return n.PropTypes=n,n}});var Qt=Ge((aa,Zt)=>{"use strict";Zt.exports=Xt()();var na,ra});import{useEffect as z,useMemo as Ke,useRef as se,useState as g}from"react";var P=rr(Qt(),1);import x from"react";function en(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function ir(t){if(Array.isArray(t))return t}function on(t,e,n){return(e=dr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a,o,s,l,d=[],p=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(p=(a=s.call(n)).done)&&(d.push(a.value),d.length!==e);p=!0);}catch(v){u=!0,o=v}finally{try{if(!p&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return d}}function cr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function nn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tn(Object(n),!0).forEach(function(a){on(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function lr(t,e){if(t==null)return{};var n,a,o=ur(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(a=0;a<s.length;a++)n=s[a],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function ur(t,e){if(t==null)return{};var n={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;n[a]=t[a]}return n}function sn(t,e){return ir(t)||sr(t,e)||mr(t,e)||cr()}function pr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var a=n.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dr(t){var e=pr(t,"string");return typeof e=="symbol"?e:e+""}function Qe(t){"@babel/helpers - typeof";return Qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qe(t)}function mr(t,e){if(t){if(typeof t=="string")return en(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?en(t,e):void 0}}var j=function(e,n,a){var o=!!a,s=x.useRef(a);x.useEffect(function(){s.current=a},[a]),x.useEffect(function(){if(!o||!e)return function(){};var l=function(){if(s.current)return s.current.apply(s,arguments)};return e.on(n,l),function(){e.off(n,l)}},[o,n,e,s])},et=function(e){var n=x.useRef(e);return x.useEffect(function(){n.current=e},[e]),n.current},de=function(e){return e!==null&&Qe(e)==="object"},fr=function(e){return de(e)&&typeof e.then=="function"},gr=function(e){return de(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},rn="[object Object]",yr=function t(e,n){if(e===n)return!0;if(!de(e)||!de(n))return e===n;var a=Array.isArray(e),o=Array.isArray(n);if(a!==o)return!1;var s=Object.prototype.toString.call(e)===rn,l=Object.prototype.toString.call(n)===rn;if(s!==l)return!1;if(!s&&!a)return e===n;var d=Object.keys(e),p=Object.keys(n);if(d.length!==p.length)return!1;for(var u={},v=0;v<d.length;v+=1)u[d[v]]=!0;for(var b=0;b<p.length;b+=1)u[p[b]]=!0;var f=Object.keys(u);if(f.length!==d.length)return!1;var h=e,A=n,k=function(S){return t(h[S],A[S])};return f.every(k)},cn=function(e,n,a){return de(e)?Object.keys(e).reduce(function(o,s){var l=!de(n)||!yr(e[s],n[s]);return a.includes(s)?(l&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),o):l?nn(nn({},o||{}),{},on({},s,e[s])):o},null):null},ln="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.",an=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;if(e===null||gr(e))return e;throw new Error(n)},hr=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;if(fr(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(o){return an(o,n)})};var a=an(e,n);return a===null?{tag:"empty"}:{tag:"sync",stripe:a}},vr=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"6.12.0"}),e.registerAppInfo({name:"react-stripe-js",version:"6.12.0",url:"https://stripe.com/docs/stripe-js/react"}))},qe=x.createContext(null);qe.displayName="ElementsContext";var un=function(e,n){if(!e)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 e},nt=function(e){var n=e.stripe,a=e.options,o=e.children,s=x.useMemo(function(){return hr(n)},[n]),l=x.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(a):null}}),d=sn(l,2),p=d[0],u=d[1];x.useEffect(function(){var f=!0,h=function(k){u(function(C){return C.stripe?C:{stripe:k,elements:k.elements(a)}})};return s.tag==="async"&&!p.stripe?s.stripePromise.then(function(A){A&&f&&h(A)}):s.tag==="sync"&&!p.stripe&&h(s.stripe),function(){f=!1}},[s,p,a]);var v=et(n);x.useEffect(function(){v!==null&&v!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[v,n]);var b=et(a);return x.useEffect(function(){if(p.elements){var f=cn(a,b,["clientSecret","fonts"]);f&&p.elements.update(f)}},[a,b,p.elements]),x.useEffect(function(){vr(p.stripe)},[p.stripe]),x.createElement(qe.Provider,{value:p},o)};nt.propTypes={stripe:P.default.any,options:P.default.object};var pn=function(e){var n=x.useContext(qe);return un(n,e)},dn=function(){var e=pn("calls useElements()"),n=e.elements;return n},br=function(e){var n=e.children,a=pn("mounts <ElementsConsumer>");return n(a)};br.propTypes={children:P.default.func.isRequired};var xr=x.createContext(null);xr.displayName="CheckoutContext";var mn=x.createContext(null);mn.displayName="CheckoutSdkContext";var tt=function(e){var n=x.useContext(mn),a=x.useContext(qe);if(n){if(a)throw new Error("You cannot wrap the part of your app that ".concat(e," in both a checkout provider and <Elements> provider."));return n}else return un(a,e)},kr=["mode"],Cr=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},N=function(e,n,a){var o="".concat(Cr(e),"Element"),s=function(u){var v=u.id,b=u.className,f=u.options,h=f===void 0?{}:f,A=u.onBlur,k=u.onFocus,C=u.onReady,S=u.onChange,D=u.onEscape,O=u.onClick,J=u.onLoadError,V=u.onLoaderStart,me=u.onNetworksChange,ne=u.onConfirm,Ne=u.onCancel,re=u.onShippingAddressChange,Ee=u.onShippingRateChange,fe=u.onSavedPaymentMethodRemove,Re=u.onSavedPaymentMethodUpdate,ge=u.onAvailablePaymentMethodsChange,Q=tt("mounts <".concat(o,">")),ee="elements"in Q?Q.elements:null,M="checkoutSdk"in Q?Q.checkoutSdk:null,ye=x.useState(null),ce=sn(ye,2),I=ce[0],he=ce[1],_=x.useRef(null),ae=x.useRef(null);j(I,"blur",A),j(I,"focus",k),j(I,"escape",D),j(I,"click",O),j(I,"loaderror",J),j(I,"loaderstart",V),j(I,"networkschange",me),j(I,"confirm",ne),j(I,"cancel",Ne),j(I,"shippingaddresschange",re),j(I,"shippingratechange",Ee),j(I,"savedpaymentmethodremove",fe),j(I,"savedpaymentmethodupdate",Re),j(I,"availablepaymentmethodschange",ge),j(I,"change",S);var U;C&&(e==="expressCheckout"?U=C:U=function(){C(I)}),j(I,"ready",U),x.useLayoutEffect(function(){if(_.current===null&&ae.current!==null&&(ee||M)){var w=null;if(M){var B=M,ve=M;switch(e){case"paymentForm":w=ve.createForm(h);break;case"payment":w=B.createPaymentElement(h);break;case"address":if("mode"in h){var be=h.mode,ze=lr(h,kr);if(be==="shipping")w=B.createShippingAddressElement(ze);else if(be==="billing")w=B.createBillingAddressElement(ze);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":w=B.createExpressCheckoutElement(h);break;case"currencySelector":w=M.createCurrencySelectorElement();break;case"taxId":w=B.createTaxIdElement(h);break;case"contactDetails":w=B.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in M)w=M.createLinkSignupElement(h);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":w=B.createTermsElement(h);break;default:throw new Error("<".concat(o,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else ee&&(w=ee.create(e,h));_.current=w,he(w),w&&w.mount(ae.current)}},[ee,M,h]);var le=et(h);return x.useEffect(function(){if(_.current){var w=cn(h,le,["paymentRequest"]);w&&"update"in _.current&&_.current.update(w)}},[h,le]),x.useLayoutEffect(function(){return function(){if(_.current&&typeof _.current.destroy=="function")try{_.current.destroy(),_.current=null}catch{}}},[]),x.createElement("div",{id:v,className:b,ref:ae})},l=function(u){tt("mounts <".concat(o,">"));var v=u.id,b=u.className;return x.createElement("div",{id:v,className:b})},d=n?l:s;return d.propTypes={id:P.default.string,className:P.default.string,onChange:P.default.func,onBlur:P.default.func,onFocus:P.default.func,onReady:P.default.func,onEscape:P.default.func,onClick:P.default.func,onLoadError:P.default.func,onLoaderStart:P.default.func,onNetworksChange:P.default.func,onConfirm:P.default.func,onCancel:P.default.func,onShippingAddressChange:P.default.func,onShippingRateChange:P.default.func,onSavedPaymentMethodRemove:P.default.func,onSavedPaymentMethodUpdate:P.default.func,onAvailablePaymentMethodsChange:P.default.func,options:P.default.object},d.displayName=o,d.__elementType=e,d},E=typeof window>"u",Sr=x.createContext(null);Sr.displayName="EmbeddedCheckoutProviderContext";var fn=function(){var e=tt("calls useStripe()"),n=e.stripe;return n},ia=N("auBankAccount",E),sa=N("card",E),ca=N("cardNumber",E),la=N("cardExpiry",E),ua=N("cardCvc",E),pa=N("currencySelector",E),da=N("iban",E),gn=N("payment",E),ma=N("expressCheckout",E),fa=N("paymentRequestButton",E),ga=N("linkAuthentication",E),ya=N("linkSignup",E),ha=N("contactDetails",E),va=N("address",E),ba=N("shippingAddress",E),xa=N("paymentMethodMessaging",E),ka=N("taxId",E),Ca=N("issuingCardNumberDisplay",E),Sa=N("issuingCardCvcDisplay",E),wa=N("issuingCardExpiryDisplay",E),Pa=N("issuingCardPinDisplay",E),Na=N("issuingCardCopyButton",E),Ea=N("terms",E);function De(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?De=function(e){return typeof e}:De=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},De(t)}var vn="dahlia",wr=function(e){return e===3?"v3":e},bn="https://js.stripe.com",Pr="".concat(bn,"/").concat(vn,"/stripe.js"),Nr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Er=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,yn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Rr=function(e){return Nr.test(e)||Er.test(e)},Ir=function(){for(var e=document.querySelectorAll('script[src^="'.concat(bn,'"]')),n=0;n<e.length;n++){var a=e[n];if(Rr(a.src))return a}return null},hn=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",a=document.createElement("script");a.src="".concat(Pr).concat(n);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(a),a},Ar=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},we=null,_e=null,Fe=null,Lr=function(e){return function(n){e(new Error("Failed to load Stripe.js",{cause:n}))}},Or=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},Tr=function(e){return we!==null?we:(we=new Promise(function(n,a){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(yn),window.Stripe){n(window.Stripe);return}try{var o=Ir();if(o&&e)console.warn(yn);else if(!o)o=hn(e);else if(o&&Fe!==null&&_e!==null){var s;o.removeEventListener("load",Fe),o.removeEventListener("error",_e),(s=o.parentNode)===null||s===void 0||s.removeChild(o),o=hn(e)}Fe=Or(n,a),_e=Lr(a),o.addEventListener("load",Fe),o.addEventListener("error",_e)}catch(l){a(l);return}}),we.catch(function(n){return we=null,Promise.reject(n)}))},jr=function(e,n,a){if(e===null)return null;var o=n[0];if(typeof o!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(De(o)," instead."));var s=o.match(/^pk_test/),l=wr(e.version),d=vn;s&&l!==d&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(d,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var p=e.apply(void 0,n);return Ar(p,a),p},Pe,xn=!1,kn=function(){return Pe||(Pe=Tr(null).catch(function(e){return Pe=null,Promise.reject(e)}),Pe)};Promise.resolve().then(function(){return kn()}).catch(function(t){xn||console.warn(t)});var Cn=function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];xn=!0;var o=Date.now();return kn().then(function(s){return jr(s,n,o)})};var qr="sf:gclid",_r="sf:fbclid",Fr=2160*60*60*1e3;function Pn(){return typeof window<"u"}function Sn(t){let e=Ce.getItem(t);if(!e)return"";try{let{v:n,t:a}=JSON.parse(e);return!n||typeof a!="number"||Date.now()-a>Fr?"":n}catch{return""}}function wn(t){if(!Pn())return"";let e=t.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function Nn(){if(!Pn())return{};let t=Sn(qr),e=Sn(_r),n=wn("_fbp"),a=wn("_fbc");!a&&e&&(a=`fb.1.${Date.now()}.${e}`);let o={};return t&&(o.gclid=t),e&&(o.fbclid=e),n&&(o.fbp=n),a&&(o.fbc=a),o}var En="sf:meta-purchases",Dr=20;function In(){return typeof window>"u"||window.parent!==window}function Mr(...t){try{if(In()||typeof window.fbq!="function")return;window.fbq(...t)}catch{}}var Rn=new Set;function Ur(t){if(Rn.has(t))return!1;Rn.add(t);try{let e=JSON.parse(Ce.getItem(En)??"[]");if(e.includes(t))return!1;Ce.setItem(En,JSON.stringify([...e,t].slice(-Dr)))}catch{}return!0}function Wr(t){return[...new Set(t.filter(Se).flatMap(e=>e.components.map(n=>n.partNumber)))]}function An(t){let e=t.confirmation;In()||!Ur(e.orderNumber)||Mr("track","Purchase",{value:Number(e.grandTotal),currency:e.currency,content_type:"product",content_ids:Wr(t.lines)},{eventID:e.orderNumber})}var rt="checkout-afterpay-context",Me="checkout-gocardless-context",at="checkout-zip-context",Ue="checkout-klarna-context";function $r({evidence:t,parked:e}){return t?{action:"capture",evidence:t,parked:e}:e?{action:"settle",parked:e}:{action:"ignore"}}function Kr(t,e){let n=t.getItem(e);if(t.removeItem(e),!n)return null;try{return JSON.parse(n)}catch{return null}}var Ln={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:rt,evidenceFrom(t,e){return e==="cancel"||(t.get("status")??"").toUpperCase()==="CANCELLED"?null:t.get("orderToken")},requestFrom:t=>({token:t})},On={name:"Zip",legParam:"zip",legValues:["return"],storageKey:at,evidenceFrom(t){let e=(t.get("result")??"").toLowerCase();return e==="cancelled"||e==="declined"?null:t.get("checkoutId")},requestFrom:t=>({checkoutId:t})};async function ot(t,e){let n=new URLSearchParams(e.search),a=n.get(t.legParam);if(!a||!t.legValues.includes(a))return;let o=Kr(e.storage,t.storageKey),s=t.evidenceFrom(n,a);e.scrubQuery();let l=$r({evidence:s,parked:o});if(l.action!=="ignore"){if(e.page.clearCart(),l.action==="settle"){e.page.note(`The ${t.name} payment was not completed \u2014 our team will follow up on payment.`),e.page.land(l.parked.confirmation);return}e.page.setConfirming(!0);try{let d=await e.capture(t.requestFrom(l.evidence));d.status==="paid"?e.page.markPaid():e.page.note(`${t.name} declined the payment \u2014 our team will follow up on payment.`),e.page.land(l.parked?.confirmation??d)}catch{l.parked?(e.page.note(`We could not confirm the ${t.name} payment \u2014 our team will follow up on payment.`),e.page.land(l.parked.confirmation)):e.page.fail(`We could not confirm your ${t.name} payment. Please contact us before trying again \u2014 your payment may already have been taken.`)}finally{e.page.setConfirming(!1)}}}import{Fragment as q,jsx as r,jsxs as c}from"react/jsx-runtime";function Tn(t){let e=t.indexOf(`
3
3
  `);return e===-1?[t,""]:[t.slice(0,e),t.slice(e+1)]}function jn(t,{canParkContext:e}={canParkContext:!0}){let n=t.paymentMethods,a=[];return n.includes("card")&&a.push({key:"card",title:"Card",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("paypal")&&t.paypalClientId&&a.push({key:"paypal",title:"PayPal",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL \xB7 CARDS"})}),n.includes("afterpay")&&a.push({key:"afterpay",title:"Afterpay",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 \xD7 INTEREST-FREE"})}),n.includes("square")&&t.squareApplicationId&&t.squareLocationId&&a.push({key:"square",title:"Card (Square)",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("gocardless")&&e&&a.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),n.includes("zip")&&a.push({key:"zip",title:"Zip",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),n.includes("klarna")&&e&&a.push({key:"klarna",title:"Klarna",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),a.push({key:"bank",title:"Bank transfer",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),a}function ct({site:t,logo:e,preview:n=!1}){let{items:a,totals:o,coupon:s,refuseCoupon:l,deliveryOptions:d,shippingMethodId:p,setShippingMethodId:u,identify:v,clearCapturedCart:b}=Je(),f=d.find(i=>i.id===p)?.pickupLocation??null,{country:h,countries:A,activeCountry:k,formatMoney:C}=oe(),[S,D]=g(()=>jn(t)[0].key),[O,J]=g(!0);z(()=>{J(It(H))},[]);let[V,me]=g(!1),[ne,Ne]=g(""),[re,Ee]=g(""),[fe,Re]=g(""),[ge,Q]=g(""),[ee,M]=g(""),[ye,ce]=g(""),[I,he]=g(""),[_,ae]=g(""),[U,le]=g(()=>h||A[0]?.code||""),[w,B]=g(""),[ve,be]=g([]),Mn=Ke(()=>A.find(i=>i.code===U)??k,[A,U,k])?.postalLabel||"Postal Code",Un=ve[0]?.divisionType||"State / Province";z(()=>{if(!U){be([]);return}let i=!1;return T.listCountrySubdivisions(U).then(m=>{i||(be(m),B(""))}),()=>{i=!0}},[U]);let[X,lt]=g(null),[ut,pt]=g([]),[Ie,Ae]=g("new"),[Be,dt]=g(!1),[mt,Wn]=g("Home"),[ft,gt]=g(null),[W]=g(()=>zt()),[Le,$]=g(null),[yt,xe]=g(null),[ht,$n]=g(null),[Kn,Yn]=g(!1),[zn,Bn]=g(!1),[G,He]=g(null),[vt,ue]=g(!1),[bt,Z]=g(null),[Hn,Vn]=g(!1),[Gn,xt]=g(!1),[Jn,Xn]=g(!1),[Zn,kt]=g(!1),Ct=se(!1);z(()=>{n||Ct.current||!a.some(Se)||(Ct.current=!0,jt({lines:a,currency:o.currency,value:o.subtotal-o.discount,coupon:s?.valid?s.code:void 0}))},[a,o,s,n]),z(()=>{v(ne,re.trim()||void 0)},[ne,re,v]);let St=se(null),[Oe,Qn]=g(null);z(()=>{let i=St.current;if(!Oe||!i)return;let m=()=>i.style.setProperty("--sf-checkout-header-h",`${Oe.offsetHeight}px`);m();let y=new ResizeObserver(m);return y.observe(Oe),()=>y.disconnect()},[Oe]),z(()=>{let i=y=>({setConfirming:y,land:$,markPaid:()=>ue(!0),note:Z,fail:xe,clearCart:b}),m={search:window.location.search,storage:H,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};ot(Ln,{...m,capture:T.captureAfterpayPayment,page:i(Vn)}),ot(On,{...m,capture:T.captureZipPayment,page:i(Xn)})},[]),z(()=>{let m=new URLSearchParams(window.location.search).get("gocardless");if(m!=="confirm"&&m!=="cancel")return;let y=H.getItem(Me);if(H.removeItem(Me),window.history.replaceState(null,"",window.location.pathname),!y)return;let R;try{R=JSON.parse(y)}catch{return}if(b(),m==="cancel"){Z("The direct debit was not set up \u2014 our team will follow up on payment."),$(R.confirmation);return}xt(!0),T.completeGocardlessPayment({idempotencyKey:R.idempotencyKey}).then(L=>{L.status==="paid"?ue(!0):L.status==="declined"?Z("The direct debit was declined \u2014 our team will follow up on payment."):Z("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{Z("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{$(R.confirmation),xt(!1)})},[]),z(()=>{let i=new URLSearchParams(window.location.search),m=i.get("klarna");if(m!=="confirm"&&m!=="cancel")return;let y=H.getItem(Ue);H.removeItem(Ue);let R=i.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!y)return;let L;try{L=JSON.parse(y)}catch{return}if(b(),m==="cancel"||!R){Z("The Klarna payment was not completed \u2014 our team will follow up on payment."),$(L.confirmation);return}kt(!0),T.captureKlarnaPayment({idempotencyKey:L.idempotencyKey,authorizationToken:R}).then(F=>{F.status==="paid"?ue(!0):F.status==="declined"?Z("Klarna declined the payment \u2014 our team will follow up on payment."):Z("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{Z("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{$(L.confirmation),kt(!1)})},[]);function wt(i){let[m,y]=Tn(i.address);Q(m),M(y),ce(i.city),he(i.zip_code),i.country&&le(i.country),i.phone&&ae(i.phone)}z(()=>{let i=!1;return(async()=>{try{let[m,y,R]=await Promise.all([pe.me(),pe.myProfile().catch(()=>null),pe.myAddresses().catch(()=>[])]);if(i)return;lt(m);let L=R.filter(ke=>ke.is_active);pt(L),Ne(m.email);let F=(y?.contact_name??"").split(/\s+/);Ee(m.first_name||F[0]||""),Re(m.last_name||F.slice(1).join(" "));let Nt=m.phone||y?.phone;Nt&&ae(Nt);let Ve=L.find(ke=>ke.id===m.default_delivery_location)??L[0];if(Ve)Ae(Ve.id),wt(Ve);else if(y){let[ke,nr]=Tn(y.address??"");Q(ke),M(nr),ce(y.city??""),he(y.zip_code??""),y.country&&le(y.country)}}catch{}})(),()=>{i=!0}},[]);function er(){pe.logout(),lt(null),pt([]),Ae("new"),dt(!1)}let Te=Ke(()=>jn(t,{canParkContext:O}),[t,O]);z(()=>{Te.some(i=>i.key===S)||D(Te[0].key)},[Te,S]);let Pt=ee.trim()?`${ge}
4
4
  ${ee.trim()}`:ge;async function tr(){if(n||V||a.length===0||o.repricing)return;let i=a.filter(Se).flatMap(m=>Tt(m.components,m.qty));if(i.length===0){xe("Pick a size on each wheel's product page before checking out.");return}me(!0),xe(null);try{let y=await(X?T.createOrderAuthed:T.createOrder)({customer:{email:ne,name:`${re} ${fe}`.trim(),phone:_.trim()||void 0,address:Pt,city:ye,state:w||void 0,zipCode:I,country:U},items:i,currency:o.currency,idempotencyKey:W,shippingMethodId:p??void 0,couponCode:Lt(s),...Nn()});if(qt({confirmation:y,lines:a,adsSendTo:t.googleAdsId&&t.googleAdsConversionLabel?`${t.googleAdsId}/${t.googleAdsConversionLabel}`:null}),An({confirmation:y,lines:a}),b(),X&&Be&&Ie==="new")try{await pe.createAddress({label:mt.trim()||"Home",contact_name:`${re} ${fe}`.trim(),phone:_.trim(),address:Pt,city:ye,zip_code:I,country:U}),gt("Address saved to your account.")}catch{gt("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}if(S==="card"&&t.paymentMethods.includes("card")){let R=await T.createPaymentIntent({idempotencyKey:W});He(y),$n(R)}else if(S==="paypal"&&t.paymentMethods.includes("paypal"))He(y),Yn(!0);else if(S==="afterpay"&&t.paymentMethods.includes("afterpay")){let R=window.location.origin,L=await T.createAfterpayCheckout({idempotencyKey:W,confirmUrl:`${R}/checkout?afterpay=confirm`,cancelUrl:`${R}/checkout?afterpay=cancel`}),F={idempotencyKey:W,confirmation:y};H.setItem(rt,JSON.stringify(F)),window.location.assign(L.redirectCheckoutUrl);return}else if(S==="square"&&t.paymentMethods.includes("square"))He(y),Bn(!0);else if(S==="gocardless"&&t.paymentMethods.includes("gocardless")){let R=window.location.origin,L=await T.createGocardlessBillingRequest({idempotencyKey:W,confirmUrl:`${R}/checkout?gocardless=confirm`,cancelUrl:`${R}/checkout?gocardless=cancel`}),F={idempotencyKey:W,confirmation:y};H.setItem(Me,JSON.stringify(F)),window.location.assign(L.authorisationUrl);return}else if(S==="zip"&&t.paymentMethods.includes("zip")){let R=window.location.origin,L=await T.createZipCheckout({idempotencyKey:W,redirectUrl:`${R}/checkout?zip=return`}),F={idempotencyKey:W,confirmation:y};H.setItem(at,JSON.stringify(F)),window.location.assign(L.redirectUrl);return}else if(S==="klarna"&&t.paymentMethods.includes("klarna")){let R=window.location.origin,L=await T.createKlarnaCheckout({idempotencyKey:W,confirmUrl:`${R}/checkout?klarna=confirm`,cancelUrl:`${R}/checkout?klarna=cancel`}),F={idempotencyKey:W,confirmation:y};H.setItem(Ue,JSON.stringify(F)),window.location.assign(L.redirectUrl);return}else $(y)}catch(m){let y=Ot(m);y?(l(y),xe(`${y} Your order has not been placed. Place it again to continue without the code.`)):xe(m instanceof je?m.message:"Could not place the order. Please try again."),me(!1)}}return Le?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:vt?"Payment received":"Order received"}),c("p",{className:"text-fg-dim",children:[vt?c(q,{children:["Thank you \u2014 your payment for order"," ",r("span",{className:"font-mono text-fg",children:Le.orderNumber})," has gone through."," "]}):c(q,{children:["Thank you \u2014 your order ",r("span",{className:"font-mono text-fg",children:Le.orderNumber})," is being reviewed by our team."," "]}),X?c(q,{children:["Track it under"," ",r(te,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):r(q,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),bt&&r("p",{className:"text-sm text-fg-dim",children:bt}),ft&&r("p",{className:"text-sm text-fg-dim",children:ft}),!X&&c("p",{className:"text-sm text-fg-dim",children:["You can also"," ",r(te,{href:`/track?order=${encodeURIComponent(Le.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),r(te,{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"})]}):Hn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):Gn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):Jn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):Zn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):ht?r(Yr,{payment:ht,onPaid:()=>{ue(!0),$(G)},onSkip:()=>$(G)}):Kn&&G?r(Hr,{confirmation:G,clientId:t.paypalClientId??"",idemKey:W,onPaid:()=>{ue(!0),$(G)},onSkip:()=>$(G)}):zn&&G?r(Gr,{confirmation:G,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:W,onPaid:()=>{ue(!0),$(G)},onSkip:()=>$(G)}):c("div",{ref:St,className:"bg-bg text-fg",children:[c("header",{ref:Qn,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-[22px] 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:[c(te,{href:"/",className:"inline-flex items-center gap-2.5 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",r("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),r(te,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:r(Wt,{variant:"header",scrolled:!0,src:e?.url??null,reverse:e?.reverse??!1,reversedSrc:e?.reversed??null,inkIsDark:e?.inkIsDark??null,size:e?.size??"medium",sizePx:e?.sizePx??null,siteName:t.name})}),t.cardPayments?c("span",{className:"flex items-center justify-end gap-2.5 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[r("span",{className:"text-green",children:"\u25CF"}),r("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):r("span",{})]}),c("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-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[r("span",{className:"inline-flex items-center bg-accent px-2.5 py-1 font-bold text-bg",children:"Checkout"}),r("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(i=>c("span",{className:["relative flex items-center gap-2 transition-colors",i.state==="pending"?"text-fg-dim":"text-fg",i.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[r("span",{className:i.state==="done"?"text-accent font-bold":"",children:i.n}),r("span",{children:i.label})]},i.n))})]}),c("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-9 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[c("div",{children:[c(We,{num:"N\xB0 01",title:"Contact",children:[r(K,{label:"Email",hint:X?c(q,{children:["Signed in \xB7"," ",r("button",{type:"button",onClick:er,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:r("input",{type:"email",value:ne,onChange:i=>Ne(i.target.value),placeholder:"you@example.com",readOnly:X!==null,className:Y+(X?" opacity-70":"")})}),c(_n,{children:[r(K,{label:"First name",children:r("input",{type:"text",value:re,onChange:i=>Ee(i.target.value),className:Y})}),r(K,{label:"Last name",children:r("input",{type:"text",value:fe,onChange:i=>Re(i.target.value),className:Y})})]})]}),c(We,{num:"N\xB0 02",title:f?"Collection":"Shipping address",children:[f?c("div",{className:"grid gap-1.5 text-[14px] leading-[1.6]",children:[r("span",{className:"font-medium",children:f.name}),[f.address,f.city,f.state,f.zipCode,f.country].filter(Boolean).length>0&&r("span",{className:"opacity-80",children:[f.address,f.city,f.state,f.zipCode,f.country].filter(Boolean).join(", ")}),f.openingHours&&r("span",{className:"opacity-80",children:f.openingHours}),f.instructions&&r("span",{className:"opacity-80",children:f.instructions}),r("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):c(q,{children:[X!==null&&ut.length>0&&c("div",{className:"grid gap-2.5",children:[ut.map(i=>r($e,{active:Ie===i.id,onClick:()=>{Ae(i.id),wt(i)},title:i.label,body:i.formatted_address,price:null},i.id)),r($e,{active:Ie==="new",onClick:()=>Ae("new"),title:"New address",body:null,price:null})]}),r(K,{label:"Address line 1",children:r("input",{type:"text",value:ge,onChange:i=>Q(i.target.value),className:Y})}),r(K,{label:"Address line 2",children:r("input",{type:"text",value:ee,onChange:i=>M(i.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:Y})}),c(_n,{cols:"three",children:[r(K,{label:"City",children:r("input",{type:"text",value:ye,onChange:i=>ce(i.target.value),className:Y})}),r(K,{label:Mn,children:r("input",{type:"text",value:I,onChange:i=>he(i.target.value),className:Y})}),r(K,{label:"Country",separate:!0,children:r(Ze,{value:U,onChange:i=>le(i.target.value),className:Y+" pr-10",style:qn,children:A.map(i=>r("option",{value:i.code,children:i.name},i.code))})})]}),r(K,{label:Un,separate:!0,children:ve.length>0?c(Ze,{value:w,onChange:i=>B(i.target.value),className:Y+" pr-10",style:qn,children:[r("option",{value:"",children:"Select\u2026"}),ve.map(i=>r("option",{value:i.code||i.name,children:i.name},i.code||i.name))]}):r("input",{type:"text",value:w,onChange:i=>B(i.target.value),className:Y})})]}),r(K,{label:"Phone",children:r("input",{type:"tel",value:_,onChange:i=>ae(i.target.value),placeholder:"+44 7700 900000",className:Y})}),!f&&X!==null&&Ie==="new"&&c(q,{children:[r(Jr,{checked:Be,onChange:dt,label:"Save this address to my account"}),Be&&r(K,{label:"Address label",children:r("input",{type:"text",value:mt,onChange:i=>Wn(i.target.value),placeholder:"Home",className:Y})})]})]}),r(We,{num:"N\xB0 03",title:"Shipping",children:c("div",{className:"grid gap-2.5",children:[d.map(i=>{let m=i.pickupLocation,y=m?[m.address,m.city,m.state,m.zipCode].filter(Boolean).join(", "):null;return r($e,{active:p===i.id,onClick:()=>u(i.id),title:m?`${i.name} \u2014 ${m.name}`:i.name,body:m?[y,m.openingHours,m.instructions,i.description].filter(Boolean).join(" \xB7 "):i.description||null,price:o.freeShipping||i.amount===0?"Free":C(i.amount,o.currency),tag:i.tag||void 0},i.id)}),d.length===0&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})}),c(We,{num:"N\xB0 04",title:"Payment",children:[r("div",{className:"grid gap-2.5",children:Te.map(i=>r($e,{active:S===i.key,onClick:()=>D(i.key),title:i.title,body:i.body,price:i.price,tag:i.tag},i.key))}),S==="card"?r("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."}):S==="paypal"?r("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."}):S==="afterpay"?r("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."}):S==="square"?r("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."}):S==="gocardless"?r("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."}):S==="zip"?r("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."}):S==="klarna"?r("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."}):r("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."})]})]}),c("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[c("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-3.5 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[r("span",{children:"Your order"}),r(te,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit \u2197"})]}),r("div",{className:"flex flex-col px-6 py-2",children:a.length===0?c("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",r(te,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):a.map(i=>r(Xr,{slug:i.slug,name:i.name,qty:i.qty,config:i.config,configSummary:Zr(i.config),price:Dt(i,o.currency)??0,currency:o.currency},i.id))}),r("div",{className:"border-t border-line px-6 pt-5",children:r(Yt,{customerEmail:ne})}),c("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[r(ie,{label:"Subtotal",value:C(o.subtotal,o.currency)}),o.discount>0&&s?.valid&&r(ie,{label:`Coupon \xB7 ${s.code}`,value:c("span",{className:"font-semibold text-green",children:["\u2212 ",C(o.discount,o.currency)]})}),s?.deferred&&r(ie,{label:`Coupon \xB7 ${s.code}`,value:At}),s?.valid&&s.effects?.gift&&r(ie,{label:`Free gift \xB7 ${s.effects.gift.partNumber}${s.effects.gift.quantity>1?` \xD7${s.effects.gift.quantity}`:""}`,value:r("span",{className:"font-semibold text-green",children:"Free"})}),r(ie,{label:"Shipping",value:o.shippingStatus==="free"?r("span",{className:"font-semibold text-green",children:"Free"}):_t(o.shippingStatus)??C(o.shipping,o.currency)}),o.tax&&(o.tax.charged?r(ie,{label:o.tax.inclusive?`${o.tax.name} included \xB7 ${o.tax.rate}%`:o.tax.name,value:C(o.tax.amount,o.currency)}):o.tax.name?r(ie,{label:o.tax.name,value:"Calculated at checkout"}):null)]}),c("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:[r("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),r("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:o.repricing?"\u2026":C(o.grand,o.currency)})]}),c("div",{className:"flex flex-col gap-2.5 px-6 pt-[18px] pb-6",children:[yt&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:yt}),o.hasUnpricedLine&&c("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",o.currency,". Remove them, or switch region, to continue."]}),r("button",{type:"button",onClick:tr,disabled:V||a.length===0||o.hasUnpricedLine||o.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",a.length===0||V||o.hasUnpricedLine||o.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:V?c(q,{children:["Building order\u2026 ",r("span",{children:"\xB7"})]}):o.repricing?c(q,{children:["Updating total\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:[S==="bank"?"Place order":"Continue to payment"," \xB7"," ",C(o.grand,o.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})]}),r("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:r("span",{children:Ut({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}var Y="w-full border-2 border-line bg-bg px-4 py-3.5 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",qn={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 We({num:t,title:e,children:n}){return c("section",{className:"mb-6 border border-line bg-bg",children:[c("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),r("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:e})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function _n({cols:t="two",children:e}){return r("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:e})}function $e({active:t,onClick:e,title:n,body:a,price:o,tag:s}){return c("button",{type:"button",onClick:e,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-[18px] border bg-bg px-[22px] py-[18px] text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&r("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),r("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&r("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),c("span",{className:"flex min-w-0 flex-col gap-1",children:[c("span",{className:"flex flex-wrap items-baseline gap-2.5 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&r("span",{className:"border px-1.5 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:s})]}),a&&r("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:a})]}),r("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:o})]})}function Yr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=oe(),o=Ke(()=>Cn(t.publishableKey),[t.publishableKey]),s=Ke(()=>{if(typeof document>"u")return;let l=getComputedStyle(document.documentElement),d=(u,v)=>l.getPropertyValue(u).trim()||v,p=document.documentElement.getAttribute("data-theme")!=="light";return{theme:p?"night":"stripe",variables:{colorPrimary:d("--accent",p?"#c9a461":"#8a6a2a"),colorBackground:d("--site-surface",p?"#131313":"#ffffff"),colorText:d("--fg",p?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:a(Number(t.amount),t.currency)})," ","by card to confirm it now."]}),r(nt,{stripe:o,options:{clientSecret:t.clientSecret,appearance:s},children:r(zr,{payment:t,onPaid:e,onSkip:n})})]})]})})}function zr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=oe(),o=fn(),s=dn(),[l,d]=g(!1),[p,u]=g(null);async function v(){if(!o||!s||l)return;d(!0),u(null);let b=await o.confirmPayment({elements:s,redirect:"if_required"});if(b.error){u(b.error.message??"Payment failed. Please try again."),d(!1);return}let f=b.paymentIntent?.status;if(f==="succeeded"||f==="processing"){e();return}u("Payment did not complete. Please try again."),d(!1)}return c("div",{className:"flex flex-col gap-4",children:[r(gn,{}),p&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:p}),r("button",{type:"button",onClick:v,disabled:!o||!s||l,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!o||!s||l?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:l?c(q,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:["Pay ",a(Number(t.amount),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:n,disabled:l,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 Fn="paypal-sdk-js",it=null;function Br(t,e){let n=`${t}|${e}`;if(it?.key===n)return it.promise;let a=new Promise((o,s)=>{document.getElementById(Fn)?.remove();let l=document.createElement("script");l.id=Fn;let d=new URLSearchParams({"client-id":t,currency:e,intent:"capture"});l.src=`https://www.paypal.com/sdk/js?${d}`,l.onload=()=>{let p=window.paypal;p?o(p):s(new Error("PayPal SDK loaded without its namespace"))},l.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(l)});return it={key:n,promise:a},a}function Hr({confirmation:t,clientId:e,idemKey:n,onPaid:a,onSkip:o}){let{formatMoney:s}=oe(),l=se(null),[d,p]=g(!1),[u,v]=g(null),b=se(a);return b.current=a,z(()=>{let f=!1,h=null;return Br(e,t.currency).then(A=>{if(!(f||!l.current))return h=A.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await T.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async k=>{try{if((await T.capturePaypalOrder({idempotencyKey:n,paypalOrderId:k.orderID})).status==="paid"){b.current();return}v("PayPal did not complete the payment. Please try again.")}catch(C){v(C instanceof je?C.message:"PayPal payment failed. Please try again.")}},onError:()=>{v("PayPal could not process the payment. Please try again.")}}),h.render(l.current).then(()=>{f||p(!0)})}).catch(()=>{f||v("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{f=!0,h?.close?.()}},[e,t.currency,n]),r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:s(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!d&&!u&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),r("div",{ref:l}),u&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:u}),r("button",{type:"button",onClick:o,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var Dn="square-web-sdk",st=null;function Vr(t){let e=t==="sandbox"?"sandbox":"production";if(st?.key===e)return st.promise;let n=new Promise((a,o)=>{document.getElementById(Dn)?.remove();let s=document.createElement("script");s.id=Dn,s.src=e==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{let l=window.Square;l?a(l):o(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>o(new Error("Square SDK failed to load")),document.head.appendChild(s)});return st={key:e,promise:n},n}function Gr({confirmation:t,applicationId:e,locationId:n,environment:a,idemKey:o,onPaid:s,onSkip:l}){let{formatMoney:d}=oe(),p=se(null),u=se(null),v=se(null),[b,f]=g(!1),[h,A]=g(!1),[k,C]=g(null);z(()=>{let D=!1,O=null;return Vr(a).then(async J=>{if(D||!p.current)return;let V=J.payments(e,n);v.current=V,O=await V.card(),await O.attach(p.current),u.current=O,D||f(!0)}).catch(()=>{D||C("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{D=!0,O?.destroy?.()}},[e,n,a]);async function S(){let D=u.current;if(!(!D||h)){A(!0),C(null);try{let O=await D.tokenize();if(O.status!=="OK"||!O.token){C(O.errors?.[0]?.message??"Please check the card details and try again."),A(!1);return}let J;try{J=(await v.current?.verifyBuyer?.(O.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await T.chargeSquare({idempotencyKey:o,sourceId:O.token,...J?{verificationToken:J}:{}})).status==="paid"){s();return}C("Square did not complete the payment. Please try again.")}catch(O){C(O instanceof je?O.message:"Square payment failed. Please try again.")}A(!1)}}return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:d(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!b&&!k&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),r("div",{ref:p}),k&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:k}),r("button",{type:"button",onClick:S,disabled:!b||h,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!b||h?"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:h?c(q,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:["Pay ",d(Number(t.grandTotal),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:l,disabled:h,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"})]})]})})}function Jr({checked:t,onChange:e,label:n,sub:a}){return c("div",{className:"flex items-start gap-3 border-t border-line py-3.5 first:border-t-0 first:pt-0",children:[r("button",{type:"button",onClick:()=>e(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&r("span",{className:"text-[13px] text-accent",children:"\u2713"})}),c("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,a&&r("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:a})]})]})}function Xr({slug:t,name:e,qty:n,config:a,configSummary:o,price:s,currency:l}){let{catalog:d}=Je(),{formatMoney:p}=oe(),u=d.find(k=>k.slug===t),v=u?.spokes??5,b=u?.mesh??!1,f=a.find(k=>k.gold)?.label,h=u?.finishes.find(k=>k.name===f&&k.src)??u?.finishes.find(k=>k.src),A=u?.finishes[0]?.color??$t;return c("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-3.5 border-b border-line py-4 last:border-b-0",children:[c("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[r("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}),h?.src?r(Et,{src:h.src,alt:`${e.lead}${e.accent} \u2014 ${h.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-1.5"}):r("div",{className:"block w-[78%]",style:{color:A},children:r(Kt,{spokes:v,mesh:b,className:"block w-full"})})]}),c("div",{className:"flex min-w-0 flex-col gap-0.5",children:[c("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[e.lead,r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:e.accent})]}),r("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:o})]}),r("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:p(s,l)})]})}function ie({label:t,value:e}){return c("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[r("span",{children:t}),r("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:e})]})}function Zr(t){return t.map(e=>e.label).join(" \xB7 ")}import{jsx as Ye}from"react/jsx-runtime";function Qr(){let{settings:t,websiteName:e}=Rt(),n=e?{...Xe,name:e}:Xe,a=t?{url:t.logoUrl,reversed:t.logoReversed??null,inkIsDark:t.logoInkIsDark??null,reverse:t.reverseLogo,size:t.logoSize,sizePx:t.logoSizePx}:null;return Ye("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:Ye(Ft,{children:Ye(Mt,{preview:!0,children:Ye(ct,{site:n,logo:a,preview:!0})})})})}export{Qr as default};
@@ -0,0 +1 @@
1
+ "use client";import{ah as t}from"./chunk-UX3A3F4A.js";import"./chunk-EZGGINPR.js";import"./chunk-UT6IGC4H.js";import"./chunk-Y6SLVHK3.js";import{jsx as e}from"react/jsx-runtime";import{default as r}from"efficient-easel/screen/components/ScreenStoreProvider";function p(o){return e(r,{...o,parts:t})}export{p as default};
@@ -1 +1 @@
1
- import{jsx as we}from"react/jsx-runtime";import{createContext as Qt,useCallback as l,useContext as en,useMemo as tn,useState as Ae}from"react";import{createContext as le,useContext as R}from"react";import{createContext as ht}from"react";var ie=ht(null);var gt=le(null),M=le({logo:null,placeholder:!1,wordmark:null});function _n(){let e=R(ie),t=R(gt),n=R(M),a=!e&&n.placeholder,o=e?e.logoUrl:n.logo?.logoUrl??t?.logoUrl??null;return{src:a?null:o,reversedSrc:e?e.logoReversed:n.logo?.logoReversed??t?.logoReversed??null,inkIsDark:e?e.logoInkIsDark:n.logo?.logoInkIsDark??t?.logoInkIsDark??null,wordmark:e?null:n.wordmark,siteName:e?.siteName??t?.siteName}}import{createPreviewSelectionContext as bn,useSelectHandler as ce}from"efficient-easel/screen/lib/puck/preview-selection-context";var wn="storefront-theme",An="sf:theme-mode",Cn="sf:theme-switch",Ln="hide",v="light";function ft(e){return e>=7&&e<18}function kn(e){let{mode:t,override:n,switchShown:a,hour:o}=e;return a&&(n==="light"||n==="dark")?n:t==="auto"?ft(o)?"light":"dark":t==="light"?"light":"dark"}var g={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},mt=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],L={selected:0,themes:mt};function de(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...L}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function D(e,t,n){let a=C(e),o=C(t);if(a===null||o===null)return e;let i=s=>Math.max(0,Math.min(255,Math.round(s))).toString(16).padStart(2,"0");return`#${a.map((s,d)=>i(s+(o[d]-s)*n)).join("")}`}var St={light:"#ffffff",dark:"#0a0a0a"},In=["light","dark"];function Hn(e,t){let n=St[t],a=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:D(e,a,.1),line:D(e,a,.22),muted:D(n,e,.35),brandInk:t}}function k(e){let t=de(e);return t.themes[t.selected]}function ue(e){return{text:e.text,accent:e.accent,background:e.background||g.background,surface:e.surface||g.surface,line:e.line||g.line,muted:e.muted||g.muted}}function C(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1].length===3?[...t[1]].map(s=>s+s).join(""):t[1],[a,o,i]=[0,2,4].map(s=>parseInt(n.slice(s,s+2),16));return[a,o,i]}function N(e){let t=C(e);if(t===null)return null;let[n,a,o]=t.map(i=>{let s=i/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4});return .2126*n+.7152*a+.0722*o}var pt=.4,_t=4.5,Et=3;function yt(e,t){let n=N(e),a=N(t);if(n===null||a===null)return null;let[o,i]=n>=a?[n,a]:[a,n];return(o+.05)/(i+.05)}var xn={good:"Good","large-only":"Large text only",hard:"Hard to read"};function Rn(e){return e>=_t?"good":e>=Et?"large-only":"hard"}var O=["#000000","#ffffff"];function I(e){let t=O[0],n=-1;for(let a of O){let o=yt(e,a);if(o===null)return O[0];o>n&&(n=o,t=a)}return t}var bt=[.25,.4,.55];function Mn(e){let t=C(e);return t===null?[]:bt.map(n=>"#"+t.map(a=>Math.round(a*(1-n)).toString(16).padStart(2,"0")).join(""))}function Dn(e){let t=k(e),n={"--theme-fg":t.text},a=N(t.text);return(a===null||a>=pt)&&(n["--overlay-fg"]=t.text),n}var Tt=82;function G(e){return`color-mix(in srgb, ${e} ${Tt}%, #000)`}function On(e){let t=k(e);return{"--theme-accent":t.accent,"--theme-accent-2":G(t.accent),"--theme-accent-ink":I(t.accent)}}function he(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Pn(e){let t=k(e),n=he(t),a=ge(t);if(n===null&&a===null)return{};let o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=G(n)),o["--theme-btn-ink"]=a??I(n),o}function ge(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Fn(e,t){return ge(e)??I(he(e)??t)}function Nn(e){let t={};return de(e).themes.forEach((n,a)=>{let o=ue(n);t[`--theme-preset-${a}-accent`]=o.accent,t[`--theme-preset-${a}-accent-2`]=G(o.accent),t[`--theme-preset-${a}-accent-ink`]=I(o.accent),t[`--theme-preset-${a}-bg`]=o.background,t[`--theme-preset-${a}-fg`]=o.text,t[`--theme-preset-${a}-surface`]=o.surface,t[`--theme-preset-${a}-surface-2`]=`color-mix(in srgb, ${o.surface} 60%, ${o.line})`,t[`--theme-preset-${a}-line`]=o.line,t[`--theme-preset-${a}-muted`]=o.muted}),t}var vn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Gn(e){let t=ue(k(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,a={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==g.surface||t.line!==g.line)&&(a["--theme-surface-2"]=n),a}var wt=["heading","body","label"];function Un(e){if(!e)return null;for(let t of wt)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var fe=["headingLarge","headingMedium","headingSmall","accent","body","label"];var U={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},At=8,Ct=200,zn=1;function Lt(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=At&&t<=Ct?t:null}function kt(e){let t={};for(let n of fe)t[n]=Lt(e?.[n]);return t}function $n(e){let t=kt(e),n={};for(let a of fe){let o=t[a];o!==null&&(n[`--size-${a}`]=`${o}px`)}return n}var It=["square","small","large"],Ht="small";function Bn(e){return It.includes(e??"")?e:Ht}var me=0,xt=40,Vn={square:0,small:null,large:16},Rt={"--sf-card-radius":1,"--sf-button-radius":.5,"--site-radius":.5,"--site-radius-xs":.25,"--site-radius-sm":.5,"--site-radius-md":.75,"--site-radius-lg":1,"--site-radius-xl":1.25,"--site-radius-2xl":1.5,"--site-radius-3xl":2,"--site-radius-4xl":2.5};function Se(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(xt,Math.max(me,Math.round(t))):null}function Mt(e){let t=Se(e);return t===null?{}:Object.fromEntries(Object.entries(Rt).map(([n,a])=>{let o=t*a/16;return[n,o===0?"0":`${o}rem`]}))}function Wn(e){return Mt(Se(e)??me)}var Dt=["none","soft","lifted"],Ot="soft",pe="none",Pt=["tight","normal","roomy"],Ft="normal",H="normal",Nt=["none","lift","highlight"],vt="lift",Gt="highlight",_e="#141416";function Ee(e){return Dt.includes(e??"")?e:Ot}function Ut(e){return Pt.includes(e??"")?e:Ft}function ye(e){return Nt.includes(e??"")?e:vt}function zt(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():_e}function Yn(e){let t=Ee(e);return t===pe?void 0:t}function Xn(e){let t=Ut(e);return t===H?void 0:t}function jn(e){let t=ye(e);return t===Gt?void 0:t}function qn(e,t,n){let a=zt(t);return a===_e?{}:Ee(e)!==pe||ye(n)==="lift"?{"--sf-shadow-color":a}:{}}var $t=["normal","tight","compressed"],y="normal";function be(e){return $t.includes(e??"")?e:y}function Kn(e){let t=be(e);return t===y?void 0:t}function Zn(e){switch(be(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}var z={case:"authored",weight:null,weightStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},P=100,F=900,Bt=24,Vt=200;function A(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function $(e){let t=A(e?.weight,P,F),n=e?.case==="sentence"?"sentence":"authored",a=i=>i==null?t:A(i,P,F),o=i=>i==="sentence"?"sentence":i==="authored"?"authored":n;return{case:n,weight:t,weightStrong:A(e?.weightStrong,P,F),maxPx:A(e?.maxPx,Bt,Vt),weight2:a(e?.weight2),weight3:a(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function Jn(e){let t=$(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function Qn(e){return $({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}function ea(e){let t=$(e);return{heading_case:t.case,heading_weight:t.weight,heading_weight_strong:t.weightStrong,heading_max_px:t.maxPx,heading_2_weight:t.weight2,heading_3_weight:t.weight3,heading_2_case:t.case2,heading_3_case:t.case3}}var B=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],u=new Map(B.map(e=>[e.key,e])),Wt={sans:"Sans",serif:"Serif",mono:"Mono"};function na(){return Object.keys(Wt).map(e=>[e,B.filter(t=>t.category===e)]).filter(([,e])=>e.length>0)}function aa(e){return u.get(e)?.italicLoaded??!1}function oa(e){return u.get(e)}var Te=["heading","heading2","heading3","body","accent","label"],ra={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},Yt=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],Xt=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,sa={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},jt={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function ia(e){let t=e?Xt.exec(e):null;return t?jt[t[1]]??null:qt(e)}function qt(e){if(!e)return null;let t=e.split(/\s+/).filter(n=>!n.slice(0,n.lastIndexOf(":")+1).includes("&")).map(n=>n.slice(n.lastIndexOf(":")+1));for(let[n,a]of Yt)if(t.includes(n))return a;return null}var Kt=["heading","heading2","heading3"];function la(e){return Kt.includes(e)}var h={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function Zt(e){let t=n=>{let a=e?.[n];if(a&&u.has(a))return a;if(n==="heading2"||n==="heading3"){let o=e?.heading;return o&&u.has(o)?o:h.heading}return h[n]};return Object.fromEntries(Te.map(n=>[n,t(n)]))}function Jt(e,t){return u.get(e[t])??u.get(h[t])}function f(e,t){return`var(${Jt(e,t).cssVar})`}var ca=[...new Set(Te.map(e=>u.get(h[e]).cssVar))],da=[...new Set(B.map(e=>e.cssVar))];function ua(e){let t=Zt(e);return{"--font-role-heading":f(t,"heading"),"--font-role-heading2":f(t,"heading2"),"--font-role-heading3":f(t,"heading3"),"--font-role-body":f(t,"body"),"--font-role-accent":f(t,"accent"),"--font-role-label":f(t,"label"),fontFamily:"var(--font-role-body)"}}var Le=Qt({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:v,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:L,setTheme:()=>{},fonts:h,setFonts:()=>{},sizes:U,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:H,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:y,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:z,setHeadingTypography:()=>{},textStyles:null,setTextStyles:()=>{},heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function Ea({children:e,websiteName:t=null,templateChrome:n=!1,templateName:a=null,chromePlaceholder:o=!1,themeMode:i=v,onThemeModeChange:s,themeSwitchShown:d=!1,onThemeSwitchShownChange:b,theme:T=L,onThemeChange:m,fonts:S=h,onFontsChange:p,sizes:_=U,onSizesChange:c,cornerRadiusPx:x=null,onCornerRadiusPxChange:w,cardShadow:Ie=null,onCardShadowChange:V,shadowColor:He=null,onShadowColorChange:W,cardGap:xe=H,onCardGapChange:Y,hoverEffect:Re=null,onHoverEffectChange:X,headingCompression:Me=y,onHeadingCompressionChange:j,siteWidth:De=null,onSiteWidthChange:q,siteGutter:Oe=null,blockGap:Pe=null,onSiteGutterChange:K,onBlockGapChange:Z,headingTypography:Fe=z,onHeadingTypographyChange:J,textStyles:Ne=null,onTextStylesChange:Q,heroBackgroundFollowsWidth:ve=null,onHeroBackgroundFollowsWidthChange:ee,photographyGrayscale:Ge=null,onPhotographyGrayscaleChange:te,themeFromDocument:Ue=!1}){let[E,ne]=Ae(null),ze=l(r=>ne(ut=>ut??r),[]),[$e,Be]=Ae(!1),Ve=l(r=>s?.(r),[s]),We=l(r=>b?.(r),[b]),Ye=l(r=>m?.(r),[m]),Xe=l(r=>p?.(r),[p]),je=l(r=>c?.(r),[c]),qe=l(r=>q?.(r),[q]),Ke=l(r=>K?.(r),[K]),Ze=l(r=>Z?.(r),[Z]),Je=l(r=>ee?.(r),[ee]),Qe=l(r=>te?.(r),[te]),et=l(r=>w?.(r),[w]),tt=l(r=>V?.(r),[V]),nt=l(r=>W?.(r),[W]),at=l(r=>Y?.(r),[Y]),ot=l(r=>X?.(r),[X]),rt=l(r=>j?.(r),[j]),st=l(r=>J?.(r),[J]),it=l(r=>Q?.(r),[Q]),{select:lt,setSelectHandler:ct}=ce(),ae=E?.logoUrl,oe=E?.logoReversed,re=E?.logoInkIsDark,se=E!==null,dt=tn(()=>({logo:se?{logoUrl:ae,logoReversed:oe,logoInkIsDark:re}:null,placeholder:n||o,wordmark:n?a:t}),[se,ae,oe,re,n,o,a,t]);return we(M.Provider,{value:dt,children:we(Le.Provider,{value:{settings:E,setSettings:ne,primeSettings:ze,websiteName:t,templateChrome:n,templateName:a,chromePlaceholder:o,themeMode:i,setThemeMode:Ve,themeSwitchShown:d,setThemeSwitchShown:We,theme:T,setTheme:Ye,fonts:S,setFonts:Xe,sizes:_,setSizes:je,cornerRadiusPx:x,setCornerRadiusPx:et,cardShadow:Ie,setCardShadow:tt,shadowColor:He,setShadowColor:nt,cardGap:xe,setCardGap:at,hoverEffect:Re,setHoverEffect:ot,headingCompression:Me,setHeadingCompression:rt,siteWidth:De,setSiteWidth:qe,siteGutter:Oe,blockGap:Pe,setSiteGutter:Ke,setBlockGap:Ze,headingTypography:Fe,setHeadingTypography:st,textStyles:Ne,setTextStyles:it,heroBackgroundFollowsWidth:ve,setHeroBackgroundFollowsWidth:Je,photographyGrayscale:Ge,setPhotographyGrayscale:Qe,themeFromDocument:Ue,selected:$e,setSelected:Be,select:lt,setSelectHandler:ct},children:e})})}var ya=()=>en(Le);var nn="Storefront";function Ta(e){return e?.trim()||nn}import{forwardRef as an}from"react";import{jsx as sn}from"react/jsx-runtime";var on={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"},rn=an(function({src:t,width:n,height:a,fill:o,priority:i,loading:s,style:d,quality:b,placeholder:T,blurDataURL:m,unoptimized:S,loader:p,overrideSrc:_,...c},x){let w=_??(typeof t=="string"?t:t.src);return sn("img",{ref:x,src:w,width:o?void 0:n,height:o?void 0:a,loading:i?"eager":s??"lazy",fetchPriority:i?"high":void 0,decoding:"async",style:o?{...on,...d}:{color:"transparent",...d},...c})}),Ca=rn;function La(e){return{props:{src:e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),sizes:e.sizes}}}import{forwardRef as ln}from"react";import{jsx as un}from"react/jsx-runtime";function cn(e){if(typeof e=="string")return e;let t=e.query?`?${new URLSearchParams(e.query).toString()}`:"",n=e.hash?e.hash.startsWith("#")?e.hash:`#${e.hash}`:"";return`${e.pathname??""}${t}${n}`}var dn=ln(function({href:t,prefetch:n,replace:a,scroll:o,shallow:i,legacyBehavior:s,passHref:d,locale:b,onClick:T,children:m,...S},p){let _=c=>{T?.(c),!(c.defaultPrevented||S.target==="_blank")&&c.preventDefault()};return un("a",{ref:p,href:cn(t),onClick:_,...S,children:m})}),xa=dn;var ke=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp","telegram","line","wechat"],hn={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp",telegram:"Telegram",line:"LINE",wechat:"WeChat"},gn={};function Da(e){if(!e||typeof e!="object")return gn;let t={};for(let n of ke){let a=e[n];if(typeof a!="string")continue;let o=a.trim();!o||!/^https?:\/\//i.test(o)||(t[n]=o)}return t}function Oa(e){return ke.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:hn[t]}]:[]})}var Pa=e=>`${e}_url`;export{Ca as a,La as b,xa as c,B as d,Wt as e,na as f,aa as g,oa as h,Te as i,ra as j,sa as k,ia as l,qt as m,la as n,h as o,Zt as p,ua as q,wn as r,An as s,Cn as t,Ln as u,v,kn as w,mt as x,de as y,In as z,Hn as A,k as B,ue as C,yt as D,xn as E,Rn as F,I as G,Mn as H,Dn as I,On as J,he as K,Pn as L,ge as M,Fn as N,Nn as O,vn as P,Gn as Q,Un as R,U as S,At as T,Ct as U,zn as V,kt as W,$n as X,Bn as Y,me as Z,xt as _,Vn as $,Se as aa,Mt as ba,Wn as ca,Dt as da,Ot as ea,pe as fa,H as ga,Nt as ha,vt as ia,Gt as ja,_e as ka,Ee as la,Ut as ma,ye as na,zt as oa,Yn as pa,Xn as qa,jn as ra,qn as sa,y as ta,be as ua,Kn as va,Zn as wa,z as xa,P as ya,F as za,Bt as Aa,Vt as Ba,$ as Ca,Jn as Da,Qn as Ea,ea as Fa,ie as Ga,_n as Ha,bn as Ia,ce as Ja,Ea as Ka,ya as La,nn as Ma,Ta as Na,ke as Oa,hn as Pa,gn as Qa,Da as Ra,Oa as Sa,Pa as Ta};
1
+ import{jsx as we}from"react/jsx-runtime";import{createContext as Qt,useCallback as l,useContext as en,useMemo as tn,useState as Ae}from"react";import{createContext as le,useContext as R}from"react";import{createContext as ht}from"react";var ie=ht(null);var gt=le(null),M=le({logo:null,placeholder:!1,wordmark:null});function _n(){let e=R(ie),t=R(gt),n=R(M),a=!e&&n.placeholder,o=e?e.logoUrl:n.logo?.logoUrl??t?.logoUrl??null;return{src:a?null:o,reversedSrc:e?e.logoReversed:n.logo?.logoReversed??t?.logoReversed??null,inkIsDark:e?e.logoInkIsDark:n.logo?.logoInkIsDark??t?.logoInkIsDark??null,wordmark:e?null:n.wordmark,siteName:e?.siteName??t?.siteName}}import{createPreviewSelectionContext as bn,useSelectHandler as ce}from"efficient-easel/screen/lib/puck/preview-selection-context";var wn="storefront-theme",An="sf:theme-mode",Cn="sf:theme-switch",Ln="hide",v="light";function ft(e){return e>=7&&e<18}function kn(e){let{mode:t,override:n,switchShown:a,hour:o}=e;return a&&(n==="light"||n==="dark")?n:t==="auto"?ft(o)?"light":"dark":t==="light"?"light":"dark"}var g={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},mt=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],L={selected:0,themes:mt};function de(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...L}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function D(e,t,n){let a=C(e),o=C(t);if(a===null||o===null)return e;let i=s=>Math.max(0,Math.min(255,Math.round(s))).toString(16).padStart(2,"0");return`#${a.map((s,d)=>i(s+(o[d]-s)*n)).join("")}`}var St={light:"#ffffff",dark:"#0a0a0a"},In=["light","dark"];function Hn(e,t){let n=St[t],a=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:D(e,a,.1),line:D(e,a,.22),muted:D(n,e,.35),brandInk:t}}function k(e){let t=de(e);return t.themes[t.selected]}function ue(e){return{text:e.text,accent:e.accent,background:e.background||g.background,surface:e.surface||g.surface,line:e.line||g.line,muted:e.muted||g.muted}}function C(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1].length===3?[...t[1]].map(s=>s+s).join(""):t[1],[a,o,i]=[0,2,4].map(s=>parseInt(n.slice(s,s+2),16));return[a,o,i]}function N(e){let t=C(e);if(t===null)return null;let[n,a,o]=t.map(i=>{let s=i/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4});return .2126*n+.7152*a+.0722*o}var pt=.4,_t=4.5,Et=3;function yt(e,t){let n=N(e),a=N(t);if(n===null||a===null)return null;let[o,i]=n>=a?[n,a]:[a,n];return(o+.05)/(i+.05)}var xn={good:"Good","large-only":"Large text only",hard:"Hard to read"};function Rn(e){return e>=_t?"good":e>=Et?"large-only":"hard"}var O=["#000000","#ffffff"];function I(e){let t=O[0],n=-1;for(let a of O){let o=yt(e,a);if(o===null)return O[0];o>n&&(n=o,t=a)}return t}var bt=[.25,.4,.55];function Mn(e){let t=C(e);return t===null?[]:bt.map(n=>"#"+t.map(a=>Math.round(a*(1-n)).toString(16).padStart(2,"0")).join(""))}function Dn(e){let t=k(e),n={"--theme-fg":t.text},a=N(t.text);return(a===null||a>=pt)&&(n["--overlay-fg"]=t.text),n}var Tt=82;function G(e){return`color-mix(in srgb, ${e} ${Tt}%, #000)`}function On(e){let t=k(e);return{"--theme-accent":t.accent,"--theme-accent-2":G(t.accent),"--theme-accent-ink":I(t.accent)}}function he(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Pn(e){let t=k(e),n=he(t),a=ge(t);if(n===null&&a===null)return{};let o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=G(n)),o["--theme-btn-ink"]=a??I(n),o}function ge(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Fn(e,t){return ge(e)??I(he(e)??t)}function Nn(e){let t={};return de(e).themes.forEach((n,a)=>{let o=ue(n);t[`--theme-preset-${a}-accent`]=o.accent,t[`--theme-preset-${a}-accent-2`]=G(o.accent),t[`--theme-preset-${a}-accent-ink`]=I(o.accent),t[`--theme-preset-${a}-bg`]=o.background,t[`--theme-preset-${a}-fg`]=o.text,t[`--theme-preset-${a}-surface`]=o.surface,t[`--theme-preset-${a}-surface-2`]=`color-mix(in srgb, ${o.surface} 60%, ${o.line})`,t[`--theme-preset-${a}-line`]=o.line,t[`--theme-preset-${a}-muted`]=o.muted}),t}var vn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Gn(e){let t=ue(k(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,a={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==g.surface||t.line!==g.line)&&(a["--theme-surface-2"]=n),a}var wt=["heading","body","label"];function Un(e){if(!e)return null;for(let t of wt)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var fe=["headingLarge","headingMedium","headingSmall","accent","body","label"];var U={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},At=8,Ct=200,zn=1;function Lt(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=At&&t<=Ct?t:null}function kt(e){let t={};for(let n of fe)t[n]=Lt(e?.[n]);return t}function $n(e){let t=kt(e),n={};for(let a of fe){let o=t[a];o!==null&&(n[`--size-${a}`]=`${o}px`)}return n}var It=["square","small","large"],Ht="small";function Bn(e){return It.includes(e??"")?e:Ht}var me=0,xt=40,Vn={square:0,small:null,large:16},Rt={"--sf-card-radius":1,"--sf-button-radius":.5,"--site-radius":.5,"--site-radius-xs":.25,"--site-radius-sm":.5,"--site-radius-md":.75,"--site-radius-lg":1,"--site-radius-xl":1.25,"--site-radius-2xl":1.5,"--site-radius-3xl":2,"--site-radius-4xl":2.5};function Se(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(xt,Math.max(me,Math.round(t))):null}function Mt(e){let t=Se(e);return t===null?{}:Object.fromEntries(Object.entries(Rt).map(([n,a])=>{let o=t*a/16;return[n,o===0?"0":`${o}rem`]}))}function Wn(e){return Mt(Se(e)??me)}var Dt=["none","soft","lifted"],Ot="soft",pe="none",Pt=["tight","normal","roomy"],Ft="normal",H="normal",Nt=["none","lift","highlight"],vt="lift",Gt="highlight",_e="#141416";function Ee(e){return Dt.includes(e??"")?e:Ot}function Ut(e){return Pt.includes(e??"")?e:Ft}function ye(e){return Nt.includes(e??"")?e:vt}function zt(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():_e}function Yn(e){let t=Ee(e);return t===pe?void 0:t}function Xn(e){let t=Ut(e);return t===H?void 0:t}function jn(e){let t=ye(e);return t===Gt?void 0:t}function qn(e,t,n){let a=zt(t);return a===_e?{}:Ee(e)!==pe||ye(n)==="lift"?{"--sf-shadow-color":a}:{}}var $t=["normal","tight","compressed"],y="normal";function be(e){return $t.includes(e??"")?e:y}function Kn(e){let t=be(e);return t===y?void 0:t}function Zn(e){switch(be(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}var z={case:"authored",weight:null,weightStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},P=100,F=900,Bt=24,Vt=200;function A(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function $(e){let t=A(e?.weight,P,F),n=e?.case==="sentence"?"sentence":"authored",a=i=>i==null?t:A(i,P,F),o=i=>i==="sentence"?"sentence":i==="authored"?"authored":n;return{case:n,weight:t,weightStrong:A(e?.weightStrong,P,F),maxPx:A(e?.maxPx,Bt,Vt),weight2:a(e?.weight2),weight3:a(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function Jn(e){let t=$(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function Qn(e){return $({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}function ea(e){let t=$(e);return{heading_case:t.case,heading_weight:t.weight,heading_weight_strong:t.weightStrong,heading_max_px:t.maxPx,heading_2_weight:t.weight2,heading_3_weight:t.weight3,heading_2_case:t.case2,heading_3_case:t.case3}}var B=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],u=new Map(B.map(e=>[e.key,e])),Wt={sans:"Sans",serif:"Serif",mono:"Mono"};function na(){return Object.keys(Wt).map(e=>[e,B.filter(t=>t.category===e)]).filter(([,e])=>e.length>0)}function aa(e){return u.get(e)?.italicLoaded??!1}function oa(e){return u.get(e)}var Te=["heading","heading2","heading3","body","accent","label"],ra={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},Yt=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],Xt=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,sa={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},jt={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function ia(e){let t=e?Xt.exec(e):null;return t?jt[t[1]]??null:qt(e)}function qt(e){if(!e)return null;let t=e.split(/\s+/).filter(n=>!n.slice(0,n.lastIndexOf(":")+1).includes("&")).map(n=>n.slice(n.lastIndexOf(":")+1));for(let[n,a]of Yt)if(t.includes(n))return a;return null}var Kt=["heading","heading2","heading3"];function la(e){return Kt.includes(e)}var h={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function Zt(e){let t=n=>{let a=e?.[n];if(a&&u.has(a))return a;if(n==="heading2"||n==="heading3"){let o=e?.heading;return o&&u.has(o)?o:h.heading}return h[n]};return Object.fromEntries(Te.map(n=>[n,t(n)]))}function Jt(e,t){return u.get(e[t])??u.get(h[t])}function f(e,t){return`var(${Jt(e,t).cssVar})`}var ca=[...new Set(Te.map(e=>u.get(h[e]).cssVar))],da=[...new Set(B.map(e=>e.cssVar))];function ua(e){let t=Zt(e);return{"--font-role-heading":f(t,"heading"),"--font-role-heading2":f(t,"heading2"),"--font-role-heading3":f(t,"heading3"),"--font-role-body":f(t,"body"),"--font-role-accent":f(t,"accent"),"--font-role-label":f(t,"label"),fontFamily:"var(--font-role-body)"}}var Le=Qt({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:v,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:L,setTheme:()=>{},fonts:h,setFonts:()=>{},sizes:U,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:H,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:y,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:z,setHeadingTypography:()=>{},textStyles:null,setTextStyles:()=>{},heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function Ea({children:e,websiteName:t=null,templateChrome:n=!1,templateName:a=null,chromePlaceholder:o=!1,themeMode:i=v,onThemeModeChange:s,themeSwitchShown:d=!1,onThemeSwitchShownChange:b,theme:T=L,onThemeChange:m,fonts:S=h,onFontsChange:p,sizes:_=U,onSizesChange:c,cornerRadiusPx:x=null,onCornerRadiusPxChange:w,cardShadow:Ie=null,onCardShadowChange:V,shadowColor:He=null,onShadowColorChange:W,cardGap:xe=H,onCardGapChange:Y,hoverEffect:Re=null,onHoverEffectChange:X,headingCompression:Me=y,onHeadingCompressionChange:j,siteWidth:De=null,onSiteWidthChange:q,siteGutter:Oe=null,blockGap:Pe=null,onSiteGutterChange:K,onBlockGapChange:Z,headingTypography:Fe=z,onHeadingTypographyChange:J,textStyles:Ne=null,onTextStylesChange:Q,heroBackgroundFollowsWidth:ve=null,onHeroBackgroundFollowsWidthChange:ee,photographyGrayscale:Ge=null,onPhotographyGrayscaleChange:te,themeFromDocument:Ue=!1}){let[E,ne]=Ae(null),ze=l(r=>ne(ut=>ut??r),[]),[$e,Be]=Ae(!1),Ve=l(r=>s?.(r),[s]),We=l(r=>b?.(r),[b]),Ye=l(r=>m?.(r),[m]),Xe=l(r=>p?.(r),[p]),je=l(r=>c?.(r),[c]),qe=l(r=>q?.(r),[q]),Ke=l(r=>K?.(r),[K]),Ze=l(r=>Z?.(r),[Z]),Je=l(r=>ee?.(r),[ee]),Qe=l(r=>te?.(r),[te]),et=l(r=>w?.(r),[w]),tt=l(r=>V?.(r),[V]),nt=l(r=>W?.(r),[W]),at=l(r=>Y?.(r),[Y]),ot=l(r=>X?.(r),[X]),rt=l(r=>j?.(r),[j]),st=l(r=>J?.(r),[J]),it=l(r=>Q?.(r),[Q]),{select:lt,setSelectHandler:ct}=ce(),ae=E?.logoUrl,oe=E?.logoReversed,re=E?.logoInkIsDark,se=E!==null,dt=tn(()=>({logo:se?{logoUrl:ae,logoReversed:oe,logoInkIsDark:re}:null,placeholder:n||o,wordmark:n?a:t}),[se,ae,oe,re,n,o,a,t]);return we(M.Provider,{value:dt,children:we(Le.Provider,{value:{settings:E,setSettings:ne,primeSettings:ze,websiteName:t,templateChrome:n,templateName:a,chromePlaceholder:o,themeMode:i,setThemeMode:Ve,themeSwitchShown:d,setThemeSwitchShown:We,theme:T,setTheme:Ye,fonts:S,setFonts:Xe,sizes:_,setSizes:je,cornerRadiusPx:x,setCornerRadiusPx:et,cardShadow:Ie,setCardShadow:tt,shadowColor:He,setShadowColor:nt,cardGap:xe,setCardGap:at,hoverEffect:Re,setHoverEffect:ot,headingCompression:Me,setHeadingCompression:rt,siteWidth:De,setSiteWidth:qe,siteGutter:Oe,blockGap:Pe,setSiteGutter:Ke,setBlockGap:Ze,headingTypography:Fe,setHeadingTypography:st,textStyles:Ne,setTextStyles:it,heroBackgroundFollowsWidth:ve,setHeroBackgroundFollowsWidth:Je,photographyGrayscale:Ge,setPhotographyGrayscale:Qe,themeFromDocument:Ue,selected:$e,setSelected:Be,select:lt,setSelectHandler:ct},children:e})})}var ya=()=>en(Le);import{forwardRef as nn}from"react";import{jsx as rn}from"react/jsx-runtime";var an={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"},on=nn(function({src:t,width:n,height:a,fill:o,priority:i,loading:s,style:d,quality:b,placeholder:T,blurDataURL:m,unoptimized:S,loader:p,overrideSrc:_,...c},x){let w=_??(typeof t=="string"?t:t.src);return rn("img",{ref:x,src:w,width:o?void 0:n,height:o?void 0:a,loading:i?"eager":s??"lazy",fetchPriority:i?"high":void 0,decoding:"async",style:o?{...an,...d}:{color:"transparent",...d},...c})}),wa=on;function Aa(e){return{props:{src:e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),sizes:e.sizes}}}import{forwardRef as sn}from"react";import{jsx as dn}from"react/jsx-runtime";function ln(e){if(typeof e=="string")return e;let t=e.query?`?${new URLSearchParams(e.query).toString()}`:"",n=e.hash?e.hash.startsWith("#")?e.hash:`#${e.hash}`:"";return`${e.pathname??""}${t}${n}`}var cn=sn(function({href:t,prefetch:n,replace:a,scroll:o,shallow:i,legacyBehavior:s,passHref:d,locale:b,onClick:T,children:m,...S},p){let _=c=>{T?.(c),!(c.defaultPrevented||S.target==="_blank")&&c.preventDefault()};return dn("a",{ref:p,href:ln(t),onClick:_,...S,children:m})}),Ia=cn;var un="Storefront";function Ra(e){return e?.trim()||un}var ke=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp","telegram","line","wechat"],hn={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp",telegram:"Telegram",line:"LINE",wechat:"WeChat"},gn={};function Da(e){if(!e||typeof e!="object")return gn;let t={};for(let n of ke){let a=e[n];if(typeof a!="string")continue;let o=a.trim();!o||!/^https?:\/\//i.test(o)||(t[n]=o)}return t}function Oa(e){return ke.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:hn[t]}]:[]})}var Pa=e=>`${e}_url`;export{wa as a,Aa as b,Ia as c,B as d,Wt as e,na as f,aa as g,oa as h,Te as i,ra as j,sa as k,ia as l,qt as m,la as n,h as o,Zt as p,ua as q,wn as r,An as s,Cn as t,Ln as u,v,kn as w,mt as x,de as y,In as z,Hn as A,k as B,ue as C,yt as D,xn as E,Rn as F,I as G,Mn as H,Dn as I,On as J,he as K,Pn as L,ge as M,Fn as N,Nn as O,vn as P,Gn as Q,Un as R,U as S,At as T,Ct as U,zn as V,kt as W,$n as X,Bn as Y,me as Z,xt as _,Vn as $,Se as aa,Mt as ba,Wn as ca,Dt as da,Ot as ea,pe as fa,H as ga,Nt as ha,vt as ia,Gt as ja,_e as ka,Ee as la,Ut as ma,ye as na,zt as oa,Yn as pa,Xn as qa,jn as ra,qn as sa,y as ta,be as ua,Kn as va,Zn as wa,z as xa,P as ya,F as za,Bt as Aa,Vt as Ba,$ as Ca,Jn as Da,Qn as Ea,ea as Fa,ie as Ga,_n as Ha,bn as Ia,ce as Ja,Ea as Ka,ya as La,un as Ma,Ra as Na,ke as Oa,hn as Pa,gn as Qa,Da as Ra,Oa as Sa,Pa as Ta};
@@ -1 +1 @@
1
- import{f as rt,i as me,r as ot,t as it,u as at,w as q}from"./chunk-OADA35KT.js";import{Ma as pe,Na as et,Qa as Me,Ra as tt}from"./chunk-P5QC7OSD.js";import{e as Ze,q as nt,s as re}from"./chunk-TNXPBHCM.js";import{createContext as Zt,useContext as en,useEffect as tn,useMemo as ge,useState as ut}from"react";function st(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function oe(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 De=4,cr=1,dr={unit:"set",spares:0,spareSide:"left"};function lt(e){return e.unit==="single"?1:De+e.spares}function pr(e,t){return[{partNumber:e.partNumber,wheels:lt(t),prices:e.prices}]}function mr(e,t){let n=lt(t)-De;if(n<=0||e.length===0)return e;let r=Xt(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function Xt(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 Jt(e,t){return t.spares>0?`${e} + spare`:e}function fr(e){return e.unit==="single"?"Single":Jt(`Set of ${De}`,e)}var gr="data-add-to-basket",Oe=9,Fe="en";function fe(e,t,n=0){return new Intl.NumberFormat(Fe,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}import{jsx as on}from"react/jsx-runtime";var ct="storefront-country",dt=Zt(null);function nn(e){return pt(e,"catalogue")}function rn(e){return pt(e,"money")}function pt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let u=n.get(i)??0;a=new Intl.NumberFormat(Fe,{style:"currency",currency:i,minimumFractionDigits:t==="money"?u:0,maximumFractionDigits:u}),r.set(i,a)}return a.format(o)}}function xr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),u=ge(()=>r||i.find(C=>C.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(C=>C.isDefault)?.code||a[0]?.code||"",[o,a]),[l,d]=ut(c),[m,P]=ut(!1);tn(()=>{let C=re.getItem(ct);C&&a.some(I=>I.code===C)&&d(C),P(!0)},[a]);function L(C){d(C),re.setItem(ct,C)}let b=ge(()=>{let C=a.find(w=>w.code===l)??null,I=C?.currency,T=I&&i.some(w=>w.code===I)?I:u,M=nn(i),x=rn(i);return{country:l,currency:T,setCountry:L,currencies:i,countries:a,activeCountry:C,formatPrice:(w,S)=>M(w,S??T),formatMoney:(w,S)=>x(w,S??T),ready:m}},[l,i,a,u,m]);return on(dt.Provider,{value:b,children:e})}function mt(){let e=en(dt);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as Cn,useCallback as k,useContext as xn,useEffect as Y,useMemo as Pt,useRef as ie,useState as A}from"react";function gt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var yt="We'll confirm this discount when you place your order.",Pr="Confirmed at checkout";function Ir(e){return e&&(e.valid||e.deferred)?e.code:void 0}var ft="coupon_code: ";function wr(e){return!(e instanceof me)||e.status!==400||!e.message.startsWith(ft)?null:e.message.slice(ft.length)}function ht(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 Pe="Price on request",sn="Request a quote";function Ue(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function $e(e,t){let n=e?.[t];return Ue(n)?n:null}function _r(e,t,n,r){let o=$e(e,n),i=$e(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function kr(e,t,n,r){if(n==null&&r==null)return!0;let o=$e(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var ln={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function un(e,t,n){if(!Ue(e))return ln;let r=Ue(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Ar(e,t,n=""){return!e.priced||e.unit==null?Pe:`${n}${fe(e.unit,t)}`}function Rr(e,t){return e.was==null?null:fe(e.was,t)}function cn(e,t,n=1){let r=oe(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,u)=>a+u.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var dn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Mr(e,t,n,r=1){let o=un(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=cn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...dn,fromSetTotal:i}}function pn(e,t){return!e.priced||e.unit==null?Pe:`${e.isFrom?"from ":""}${fe(e.unit,t)}`}function Dr(e,t){return e.was==null?null:fe(e.was,t)}function Or(e,t){return!e.priced||e.unit==null?sn:pn(e,t)}var mn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function bt(e){return mn.test(e.trim())}var Ct="sf:ga-purchases",fn=20;function St(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(St()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function gn(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:oe(e.components,t)??0,quantity:e.qty}}function qe(e,t){return e.filter(Ie).map(n=>gn(n,t))}function Kr(e){ye("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 vt(e,t){let n=qe([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Wr(e){let t=qe(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var xt=new Set;function yn(e){if(xt.has(e))return!1;xt.add(e);try{let t=JSON.parse(re.getItem(Ct)??"[]");if(t.includes(e))return!1;re.setItem(Ct,JSON.stringify([...t,e].slice(-fn)))}catch{}return!0}function Br(e){let t=e.confirmation;if(St()||!yn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:qe(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var hn="Arranged after review",bn="Calculated at checkout";function Et({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Gr(e){switch(e){case"arranged":return hn;case"pending":return bn;case"free":return"Free";case"charged":return null}}import{jsx as Pn}from"react/jsx-runtime";var Sn=400,vn=400,En=1500;function Ie(e){return(e.components?.length??0)>0}function It(e,t){return{code:e,valid:t.valid,deferred:gt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Lt(e,t){return oe(e.components,t)}function He(e,t){let n=Lt(e,t);return n===null?null:n*e.qty}function wt(e){return e!=="tyre"}var Nt=Cn(null);function oo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=mt(),[i,a]=A(t),[u,c]=A([]),[l,d]=A([]),[m,P]=A([]),[L,b]=A(!1),[C,I]=A(!1),[T,M]=A(!1),[x,w]=A(!1),[S,H]=A(null),[W,Q]=A(void 0),h=ie(r),v=ie("");h.current=h.current||r;let[p,K]=A(null),[X,z]=A(!1),[R,J]=A(null),Z=ie(void 0),D=k(()=>a(!0),[]),xe=k(()=>a(!1),[]),O=k(()=>a(s=>!s),[]);Y(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&D()},[D,t]);let Se=k(s=>{w(!0),wt(s)&&M(!0)},[]),ee=T||u.some(s=>wt(s.kind)),se=x||u.length>0;Y(()=>{if(t||!ee||L)return;let s=!0;return q.listWheels().then(f=>{s&&(d(f),b(!0))}),()=>{s=!1}},[t,ee,L]),Y(()=>{if(t||!se||C)return;let s=!0;return q.listBundles().then(f=>{s&&(P(f),I(!0))}),()=>{s=!1}},[t,se,C]);let F=S?.deliveryOptions??[];Y(()=>{F.length!==0&&J(s=>s&&F.some(f=>f.id===s)?s:F[0]?.id??null)},[S]);let G=k(()=>u.filter(Ie).flatMap(s=>st(s.components,s.qty)),[u]),le=k(async(s,f)=>{let y=s.trim().toUpperCase();if(!y)return;let g=G();if(g.length===0){K({code:y,valid:!1,message:"Add a wheel to the cart first."});return}z(!0),Z.current=f;try{let N=await q.validateCoupon({code:y,items:g,currency:n,shippingMethodId:R??void 0,customerEmail:f});K(It(y,N))}catch{K({code:y,valid:!1,message:"Could not check that code. Please try again."})}finally{z(!1)}},[G,n,R]),te=k(()=>{K(null),Z.current=void 0},[]),ve=k(s=>{if(!p)return;let{code:f}=p;K(y=>y&&y.code===f?{code:f,valid:!1,refused:!0,message:s}:y)},[p]);Y(()=>{if(!p||p.refused)return;let s=p.code,f=g=>g!==null&&g.code===s&&!g.refused,y=setTimeout(async()=>{let g=G();if(g.length===0){K(N=>f(N)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:N);return}z(!0);try{let N=await q.validateCoupon({code:s,items:g,currency:n,shippingMethodId:R??void 0,customerEmail:Z.current});K(de=>f(de)?It(s,N):de)}catch{}finally{z(!1)}},Sn);return()=>clearTimeout(y)},[u,n,R]);let ue=p&&!p.refused?p.code:void 0;Y(()=>{if(t)return;let s=!0,f=setTimeout(async()=>{let y=G();if(y.length===0){H(null),Q(void 0);return}try{let g=await q.quoteCart({items:y,currency:n,shippingMethodId:R??void 0,couponCode:ue,customerEmail:Z.current||void 0,country:h.current||void 0,subdivision:v.current||void 0});if(!s)return;H(g)}catch{if(!s)return}Q(ue)},vn);return()=>{s=!1,clearTimeout(f)}},[u,n,R,ue,r]);let E=k(s=>{c(f=>{let y=f.findIndex(g=>g.id===s.id);return y===-1?[...f,s]:f.map((g,N)=>N===y?{...g,qty:Math.min(Oe,g.qty+s.qty)}:g)}),vt(s,n)},[n]),U=k(s=>{c(f=>f.filter(y=>y.id!==s))},[]),V=k((s,f)=>{let y=Math.max(1,Math.min(Oe,f));c(g=>g.map(N=>N.id===s?{...N,qty:y}:N))},[]),Ge=k(s=>{c(s)},[]),[ce,Bt]=A(null),Ve=ie(null);Ve.current=ce;let $=ie(null),ke=ie(""),Ye=k((s,f)=>{let y=s.trim().toLowerCase();bt(y)&&Bt(g=>g&&g.email===y&&g.firstName===(f??"")?g:{email:y,firstName:f??""})},[]);Y(()=>{if(t||!ce)return;let s=ht(u.filter(Ie),g=>He(g,n)===null?Pe:o(He(g,n),n)),f={email:ce.email,firstName:ce.firstName,currency:n,items:s},y=JSON.stringify(f);if(y!==ke.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,ke.current=y,q.captureCart(f).catch(g=>{})},En),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[u,ce,n,t]);let je=k(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=Ve.current;s&&(ke.current="",q.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Qe=Pt(()=>{let s=u.reduce((_,ne)=>{let Ee=He(ne,n);return Ee===null?_:_+Ee},0),f=u.some(_=>Lt(_,n)===null),y=u.reduce((_,ne)=>_+ne.qty,0),g=p?.valid?p.effects:void 0,N=g?Math.min(s,Number(g.discountAmount)):0,de=S?.bundleDiscount??0,Gt=S?.appliedBundles??[],Ae=!!g?.freeShipping,Xe=F.find(_=>_.id===R),Je=Ae?0:S?.shipping??Xe?.amount??0,Vt=Et({quoted:S!==null,optionCount:F.length,chosenAmount:Xe?.amount,couponWaivesFreight:Ae}),Re={};for(let _ of g?.freeUnits??[])Re[_.partNumber]=(Re[_.partNumber]??0)+_.quantity;let Yt=S?.tax??null,jt=S?S.grandTotal:s-N-de+Je;return{sets:y,units:u.reduce((_,ne)=>_+(ne.components??[]).reduce((Ee,Qt)=>Ee+Qt.wheels*ne.qty,0),0),subtotal:s,hasUnpricedLine:f,discount:N,bundleDiscount:de,appliedBundles:Gt,shipping:Je,freeShipping:Ae,shippingStatus:Vt,freeUnitsByPartNumber:Re,tax:Yt,grand:jt,repricing:!!p?.refused&&S!==null&&W===p?.code,currency:n}},[u,n,p,F,R,S,W]),zt=Pt(()=>({isOpen:i,preview:t,open:D,close:xe,toggle:O,items:u,catalog:l,bundles:m,warmCatalog:Se,add:E,remove:U,setQty:V,replaceItems:Ge,identify:Ye,clearCapturedCart:je,coupon:p,applyCoupon:le,removeCoupon:te,refuseCoupon:ve,couponBusy:X,deliveryOptions:F,shippingMethodId:R,setShippingMethodId:J,totals:Qe}),[i,t,D,xe,O,u,l,m,Se,E,U,V,Ge,Ye,je,p,le,te,ve,X,F,R,Qe]);return Pn(Nt.Provider,{value:zt,children:e})}function Tt(){let e=xn(Nt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as Dn}from"react";function _t(e,t,n,r){for(;e.size>=t;){let o,i;for(let[u,c]of e){if(c.expiresAt<=r){o=u;break}i===void 0&&n(u)&&(i=u)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var In=6e4,wn=5e3,Ln=500,we=new Map;async function Nn(e){let{host:t,matchesRequestHost:n}=await ot();if(!t)return"";let r=await it();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Tn=e=>e.includes("|slug:")||e.includes("|xhost:");async function kt(e,t){if(await at()!==null)return t();let n=await Nn(e);if(!n)return t();let r=Date.now(),o=we.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",u=a?wn:In,c=we.get(n)?.lastGood,l=i.outcome.state==="ok"?i:a?c:void 0,d=a&&l?l:i;return _t(we,Ln,Tn,r),we.set(n,{load:d,expiresAt:r+u,lastGood:l}),d}var _n=404;function kn(e){if(e instanceof me&&e.status===_n)return{state:"absent"};let t=e instanceof me?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var An="[storefront:chrome-load-failed]";function Rn(e,t){console.error(`${An} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function At(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=kn(o);return i.state==="failed"&&Rn(e,i),{value:n,outcome:i}}}function Mn(e){return e==="production"?"silent":"banner"}var mo=Mn("production");function On(e,t){return e?.trim()||t}function So({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=On(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Fn={name:pe,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,mapsApiKey:null,mapsMapId:null,socialLinks:Me},vo=Dn(async()=>kt("site",()=>At("site",async()=>{let e=await q.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,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:tt(e.socialLinks)}},Fn)));var Eo={name:pe,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,mapsApiKey:null,mapsMapId:null,socialLinks:Me};import{jsx as Mt,jsxs as Dt}from"react/jsx-runtime";import{useEffect as Le,useRef as Ot,useState as Ne}from"react";var he=new Map,Un=64;async function $n(e){if(!Ze())return null;try{let t=await fetch(`${nt()}/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 Rt(e){let t=he.get(e);if(t)return t;let n=$n(e);if(he.set(e,n),he.size>Un){let r=he.keys().next();r.done||he.delete(r.value)}return n}var qn={small:54,medium:66,large:84},Hn=44,Kn=202/22,Ro=16,Mo=140,Wn=.88,Do=16,Bn="invert(1)";function Oo({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,onLightSurface:o,reversedSrc:i,inkIsDark:a,size:u="medium",sizePx:c,wordmark:l,siteName:d=pe,fitToContainer:m=!1,fitWordmarkToContainer:P=!1,fitFloorPx:L}){let b=l&&l.trim()?l.trim():d,[C,I]=Ne(!1),T=Ot(null),M=E=>{T.current=E};Le(()=>{let E=T.current?.ownerDocument??document,U=()=>{I(E.documentElement.getAttribute("data-theme")==="light")};U();let V=new MutationObserver(U);return V.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>V.disconnect()},[]);let x=n&&n.trim()?n.trim():null,w=!!x&&rt(x),S=o??(C&&t),H=r&&w&&x&&i!=null?{reversed:i,inkIsDark:a??null}:null,W=H!==null,[Q,h]=Ne(null);Le(()=>{if(!r||!x||!w||W){h(null);return}let E=!1;return h(null),Rt(x).then(U=>{E||h(U)}),()=>{E=!0}},[r,x,w,W]);let v=H??Q,p=!!v&&v.inkIsDark!==null&&(S?!v.inkIsDark:v.inkIsDark),K=r&&!!x&&!w&&!S,X=p&&v?v.reversed:x,z=X?[X]:[],[R,J]=Ne(0);Le(()=>{J(0)},[x,p]);let Z=e==="footer"?Hn:qn[u],D=c&&c>0?c:Z,xe=Math.round(D*Kn),O=R<z.length?z[R]:null,[Se,ee]=Ne(X),se=O!==null&&O===Se,F=Ot(null);Le(()=>{let E=F.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(O);return}let U=!1;return E.decode().then(()=>!U&&ee(O),()=>!U&&J(V=>V+1)),()=>{U=!0}},[O]);let G=m||P,le=`calc(100cqi / ${((b.length+1)*Wn).toFixed(2)})`,te=G&&L&&L>0?Math.min(L,D):null,ve=G?te===null?`min(${D}px, ${le})`:`clamp(${te}px, ${le}, ${D}px)`:`${D}px`,ue=Dt("span",{className:`font-display font-bold tracking-[0.18em] ${te===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ve,lineHeight:1},"aria-label":b,children:[b,Mt("span",{className:"text-accent",children:"."})]});return Dt("span",{ref:M,className:"inline-flex items-center",children:[!se&&ue,O&&Mt("img",{ref:F,src:O,alt:b,width:xe,height:D,className:"shrink-0 object-contain",style:{...se?{height:`${D}px`,width:"auto",...m?{maxWidth:"100cqi"}:{}}:{display:"none"},...K?{filter:Bn}:{}},onLoad:()=>ee(O),onError:()=>J(E=>E+1)},O)]})}import{Children as Gn,isValidElement as Vn,useEffect as Ut,useId as Yn,useLayoutEffect as jn,useRef as j,useState as $t}from"react";var Te=(e,t)=>!!e[t]&&!e[t].disabled;function Ke(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Te(e,i))return i}return t}function We(e,t){return Ke(e,t===1?-1:e.length,t)}function Be(e,t){return Te(e,t)?t:Math.max(We(e,1),0)}function Ft(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(),u=n.findIndex((c,l)=>Te(n,l)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:u>=0?u: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:Ke(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ke(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:We(n,1)}),handled:!0};case"End":return{state:i({focus:We(n,-1)}),handled:!0};case"Enter":case" ":return Te(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{Fragment as er,jsx as B,jsxs as qt}from"react/jsx-runtime";function Qn({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,u]=$t(!1),c=r!==void 0,l=c?r:a,[d,m]=$t(0),P=j({text:"",timer:0}),L=j(null),b=j(null),C=j(null),I=Yn(),T=j(null),M=e.findIndex(h=>h.value===t),x=h=>{h!==l&&(c||u(h),h?o?.():i?.())},w=h=>{let v=e[h];!v||v.disabled||(n(v.value),x(!1),b.current?.focus())},S=h=>{let v={open:l,focus:l?d:Be(e,M),typed:P.current.text},p=Ft(v,h,e);return!p.handled&&p.state.open===l?!1:(p.state.typed!==v.typed&&(P.current.text=p.state.typed,window.clearTimeout(P.current.timer),P.current.timer=window.setTimeout(()=>{P.current.text=""},500)),m(p.state.focus),p.commit!==void 0?w(p.commit):x(p.state.open),p.refocus&&b.current?.focus(),p.handled)},H=j(S);H.current=S;let W=j(()=>x(!1));W.current=()=>x(!1);let Q=h=>{l||(T.current=h.nativeEvent,H.current(h.key)&&h.preventDefault())};return Ut(()=>{if(!l)return;let h=p=>{L.current?.contains(p.target)||W.current()},v=p=>{p!==T.current&&H.current(p.key)&&p.preventDefault()};return document.addEventListener("mousedown",h),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v)}},[l]),Ut(()=>{l&&(P.current.text||m(Be(e,M)))},[l]),jn(()=>{if(!l||!C.current)return;C.current.children.item(d)?.scrollIntoView({block:"nearest"})},[d,l]),{open:l,toggle:()=>x(!l),close:()=>x(!1),focusIdx:d,setFocusIdx:m,pick:h=>w(e.findIndex(v=>v.value===h)),wrapRef:L,triggerRef:b,listRef:C,listId:I,onTriggerKeyDown:Q,activeId:l?`${I}-${d}`:void 0}}var Xn={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-2.5 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 text-[length:var(--size-label,13px)] 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 text-[length:var(--size-body,14px)] 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-3.5 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 Jn({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:u,ariaLabel:c}){let l=Xn[t];return B("ul",{ref:u,id:e,role:"listbox","aria-label":c,...l.pickerMarker?{"data-picker-menu":""}:{},className:l.list,children:n.map((d,m)=>{let P=d.value===r;return B("li",{id:`${e}-${m}`,role:"option","aria-selected":P,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(m),onMouseDown:L=>{L.preventDefault(),d.disabled||a(d.value)},className:l.item(m===o,P&&d.value!=="",!!d.disabled,m===n.length-1),style:l.itemStyle?.(P),children:d.meta===void 0?d.label:qt(er,{children:[B("span",{className:"flex-1 whitespace-nowrap",children:d.label}),B("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${m}`)})})}function Zn({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:u,"aria-label":c}){let l=Gn.toArray(r).flatMap(b=>{if(!Vn(b))return[];if(b.type!=="option")return[];let I=b.props,T=I.value!==void 0?String(I.value):"",M=I.children,x=typeof M=="string"||typeof M=="number"?String(M):T;return[{value:T,label:x,disabled:!!I.disabled}]}),d=e??"",m=Qn({items:l,value:d,onPick:b=>t?.({target:{value:b}})}),L=l.find(b=>b.value===d)?.label??l[0]?.label??"";return qt("div",{ref:m.wrapRef,className:"relative",children:[a&&B("input",{type:"hidden",name:a,value:d}),B("button",{ref:b=>{m.triggerRef.current=b},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":m.open,"aria-controls":m.open?m.listId:void 0,"aria-activedescendant":m.activeId,"aria-label":c,id:u,onClick:()=>!n&&m.toggle(),onKeyDown:b=>!n&&m.onTriggerKeyDown(b),className:`block w-full ${o??""}`,style:i,children:B("span",{className:"block w-full truncate text-left",children:L})}),m.open&&B(Jn,{id:m.listId,tone:"select",items:l,value:d,focusIdx:m.focusIdx,onFocus:m.setFocusIdx,onPick:m.pick,listRef:m.listRef})]})}var zo="#c9a461",Ht=[{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"}],Go={name:"",color:"var(--fg)",family:"silver",src:""};function tr(e,t){let n=r=>{let o=Ht.findIndex(i=>i.f===r);return o===-1?Ht.length:o};return n(e)-n(t)||e.localeCompare(t)}function Vo(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(tr)}import{jsx as be,jsxs as _e}from"react/jsx-runtime";var nr="font-mono text-[length:var(--size-label,12px)]",rr="font-semibold uppercase tracking-[0.22em] text-fg";function Kt(e){return`${e??nr} ${rr}`}function Wt(){return be("span",{className:"text-accent",children:" *"})}function or({children:e,required:t,labelFace:n}){return _e("span",{className:Kt(n),children:[e,t?be(Wt,{}):null]})}function ir({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:u}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",l=n?be("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?_e("div",{className:c,children:[_e("label",{htmlFor:o,className:Kt(i),children:[e,t?be(Wt,{}):null]}),u,l]}):_e("label",{htmlFor:o,className:c,children:[be(or,{required:t,labelFace:i,children:e}),u]})}import{jsx as Ce,jsxs as sr}from"react/jsx-runtime";function ar({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,u=[];for(let c=0;c<e;c++){let l=c/e*Math.PI*2-Math.PI/2;if(u.push({x1:a(100+Math.cos(l)*22),y1:a(100+Math.sin(l)*22),x2:a(100+Math.cos(l)*86),y2:a(100+Math.sin(l)*86),main:!0}),t){let d=l+Math.PI/e;u.push({x1:a(100+Math.cos(d)*22*1.4),y1:a(100+Math.sin(d)*22*1.4),x2:a(100+Math.cos(d)*78),y2:a(100+Math.sin(d)*78),main:!1})}}return sr("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:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),u.map((c,l)=>Ce("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},l))]})}import{useState as lr}from"react";import{jsx as ae,jsxs as ze}from"react/jsx-runtime";function ur({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Tt(),[i,a]=lr("");async function u(){o||!i.trim()||(await n(i,e),a(""))}return ze("div",{className:"flex flex-col gap-2",children:[t===null?ze("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-3.5 py-3.5 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{u()},disabled:o,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:o?"\u2026":"Apply"})]}):ze("div",{className:["flex items-center justify-between gap-3 border px-3.5 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:yt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function oi(){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)}`}export{Pr as a,Ir as b,wr as c,st as d,De as e,cr as f,dr as g,pr as h,mr as i,Xt as j,Jt as k,fr as l,gr as m,Oe as n,Fe as o,fe as p,Pe as q,sn as r,$e as s,_r as t,kr as u,un as v,Ar as w,Rr as x,cn as y,Mr as z,pn as A,Dr as B,Or as C,bt as D,Kr as E,Wr as F,Br as G,Gr as H,xr as I,mt as J,Ie as K,He as L,oo as M,Tt as N,So as O,Fn as P,Eo as Q,qn as R,Hn as S,Ro as T,Mo as U,Do as V,Oo as W,Qn as X,Jn as Y,Zn as Z,zo as _,Ht as $,Go as aa,tr as ba,Vo as ca,or as da,ir as ea,ar as fa,ur as ga,oi as ha};
1
+ import{f as rt,i as me,r as ot,t as it,u as at,w as q}from"./chunk-O624SD7C.js";import{Ma as pe,Na as et,Qa as Me,Ra as tt}from"./chunk-EZGGINPR.js";import{e as Ze,q as nt,s as re}from"./chunk-UT6IGC4H.js";import{createContext as Zt,useContext as en,useEffect as tn,useMemo as ge,useState as ut}from"react";function st(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function oe(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 De=4,cr=1,dr={unit:"set",spares:0,spareSide:"left"};function lt(e){return e.unit==="single"?1:De+e.spares}function pr(e,t){return[{partNumber:e.partNumber,wheels:lt(t),prices:e.prices}]}function mr(e,t){let n=lt(t)-De;if(n<=0||e.length===0)return e;let r=Xt(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function Xt(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 Jt(e,t){return t.spares>0?`${e} + spare`:e}function fr(e){return e.unit==="single"?"Single":Jt(`Set of ${De}`,e)}var gr="data-add-to-basket",Oe=9,Fe="en";function fe(e,t,n=0){return new Intl.NumberFormat(Fe,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}import{jsx as on}from"react/jsx-runtime";var ct="storefront-country",dt=Zt(null);function nn(e){return pt(e,"catalogue")}function rn(e){return pt(e,"money")}function pt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let u=n.get(i)??0;a=new Intl.NumberFormat(Fe,{style:"currency",currency:i,minimumFractionDigits:t==="money"?u:0,maximumFractionDigits:u}),r.set(i,a)}return a.format(o)}}function xr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),u=ge(()=>r||i.find(C=>C.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(C=>C.isDefault)?.code||a[0]?.code||"",[o,a]),[l,d]=ut(c),[m,P]=ut(!1);tn(()=>{let C=re.getItem(ct);C&&a.some(I=>I.code===C)&&d(C),P(!0)},[a]);function L(C){d(C),re.setItem(ct,C)}let b=ge(()=>{let C=a.find(w=>w.code===l)??null,I=C?.currency,T=I&&i.some(w=>w.code===I)?I:u,M=nn(i),x=rn(i);return{country:l,currency:T,setCountry:L,currencies:i,countries:a,activeCountry:C,formatPrice:(w,S)=>M(w,S??T),formatMoney:(w,S)=>x(w,S??T),ready:m}},[l,i,a,u,m]);return on(dt.Provider,{value:b,children:e})}function mt(){let e=en(dt);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as Cn,useCallback as k,useContext as xn,useEffect as Y,useMemo as Pt,useRef as ie,useState as A}from"react";function gt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var yt="We'll confirm this discount when you place your order.",Pr="Confirmed at checkout";function Ir(e){return e&&(e.valid||e.deferred)?e.code:void 0}var ft="coupon_code: ";function wr(e){return!(e instanceof me)||e.status!==400||!e.message.startsWith(ft)?null:e.message.slice(ft.length)}function ht(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 Pe="Price on request",sn="Request a quote";function Ue(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function $e(e,t){let n=e?.[t];return Ue(n)?n:null}function _r(e,t,n,r){let o=$e(e,n),i=$e(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function kr(e,t,n,r){if(n==null&&r==null)return!0;let o=$e(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var ln={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function un(e,t,n){if(!Ue(e))return ln;let r=Ue(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Ar(e,t,n=""){return!e.priced||e.unit==null?Pe:`${n}${fe(e.unit,t)}`}function Rr(e,t){return e.was==null?null:fe(e.was,t)}function cn(e,t,n=1){let r=oe(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,u)=>a+u.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var dn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Mr(e,t,n,r=1){let o=un(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=cn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...dn,fromSetTotal:i}}function pn(e,t){return!e.priced||e.unit==null?Pe:`${e.isFrom?"from ":""}${fe(e.unit,t)}`}function Dr(e,t){return e.was==null?null:fe(e.was,t)}function Or(e,t){return!e.priced||e.unit==null?sn:pn(e,t)}var mn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function bt(e){return mn.test(e.trim())}var Ct="sf:ga-purchases",fn=20;function St(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(St()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function gn(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:oe(e.components,t)??0,quantity:e.qty}}function qe(e,t){return e.filter(Ie).map(n=>gn(n,t))}function Kr(e){ye("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 vt(e,t){let n=qe([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Wr(e){let t=qe(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var xt=new Set;function yn(e){if(xt.has(e))return!1;xt.add(e);try{let t=JSON.parse(re.getItem(Ct)??"[]");if(t.includes(e))return!1;re.setItem(Ct,JSON.stringify([...t,e].slice(-fn)))}catch{}return!0}function Br(e){let t=e.confirmation;if(St()||!yn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:qe(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var hn="Arranged after review",bn="Calculated at checkout";function Et({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Gr(e){switch(e){case"arranged":return hn;case"pending":return bn;case"free":return"Free";case"charged":return null}}import{jsx as Pn}from"react/jsx-runtime";var Sn=400,vn=400,En=1500;function Ie(e){return(e.components?.length??0)>0}function It(e,t){return{code:e,valid:t.valid,deferred:gt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Lt(e,t){return oe(e.components,t)}function He(e,t){let n=Lt(e,t);return n===null?null:n*e.qty}function wt(e){return e!=="tyre"}var Nt=Cn(null);function oo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=mt(),[i,a]=A(t),[u,c]=A([]),[l,d]=A([]),[m,P]=A([]),[L,b]=A(!1),[C,I]=A(!1),[T,M]=A(!1),[x,w]=A(!1),[S,H]=A(null),[W,Q]=A(void 0),h=ie(r),v=ie("");h.current=h.current||r;let[p,K]=A(null),[X,z]=A(!1),[R,J]=A(null),Z=ie(void 0),D=k(()=>a(!0),[]),xe=k(()=>a(!1),[]),O=k(()=>a(s=>!s),[]);Y(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&D()},[D,t]);let Se=k(s=>{w(!0),wt(s)&&M(!0)},[]),ee=T||u.some(s=>wt(s.kind)),se=x||u.length>0;Y(()=>{if(t||!ee||L)return;let s=!0;return q.listWheels().then(f=>{s&&(d(f),b(!0))}),()=>{s=!1}},[t,ee,L]),Y(()=>{if(t||!se||C)return;let s=!0;return q.listBundles().then(f=>{s&&(P(f),I(!0))}),()=>{s=!1}},[t,se,C]);let F=S?.deliveryOptions??[];Y(()=>{F.length!==0&&J(s=>s&&F.some(f=>f.id===s)?s:F[0]?.id??null)},[S]);let G=k(()=>u.filter(Ie).flatMap(s=>st(s.components,s.qty)),[u]),le=k(async(s,f)=>{let y=s.trim().toUpperCase();if(!y)return;let g=G();if(g.length===0){K({code:y,valid:!1,message:"Add a wheel to the cart first."});return}z(!0),Z.current=f;try{let N=await q.validateCoupon({code:y,items:g,currency:n,shippingMethodId:R??void 0,customerEmail:f});K(It(y,N))}catch{K({code:y,valid:!1,message:"Could not check that code. Please try again."})}finally{z(!1)}},[G,n,R]),te=k(()=>{K(null),Z.current=void 0},[]),ve=k(s=>{if(!p)return;let{code:f}=p;K(y=>y&&y.code===f?{code:f,valid:!1,refused:!0,message:s}:y)},[p]);Y(()=>{if(!p||p.refused)return;let s=p.code,f=g=>g!==null&&g.code===s&&!g.refused,y=setTimeout(async()=>{let g=G();if(g.length===0){K(N=>f(N)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:N);return}z(!0);try{let N=await q.validateCoupon({code:s,items:g,currency:n,shippingMethodId:R??void 0,customerEmail:Z.current});K(de=>f(de)?It(s,N):de)}catch{}finally{z(!1)}},Sn);return()=>clearTimeout(y)},[u,n,R]);let ue=p&&!p.refused?p.code:void 0;Y(()=>{if(t)return;let s=!0,f=setTimeout(async()=>{let y=G();if(y.length===0){H(null),Q(void 0);return}try{let g=await q.quoteCart({items:y,currency:n,shippingMethodId:R??void 0,couponCode:ue,customerEmail:Z.current||void 0,country:h.current||void 0,subdivision:v.current||void 0});if(!s)return;H(g)}catch{if(!s)return}Q(ue)},vn);return()=>{s=!1,clearTimeout(f)}},[u,n,R,ue,r]);let E=k(s=>{c(f=>{let y=f.findIndex(g=>g.id===s.id);return y===-1?[...f,s]:f.map((g,N)=>N===y?{...g,qty:Math.min(Oe,g.qty+s.qty)}:g)}),vt(s,n)},[n]),U=k(s=>{c(f=>f.filter(y=>y.id!==s))},[]),V=k((s,f)=>{let y=Math.max(1,Math.min(Oe,f));c(g=>g.map(N=>N.id===s?{...N,qty:y}:N))},[]),Ge=k(s=>{c(s)},[]),[ce,Bt]=A(null),Ve=ie(null);Ve.current=ce;let $=ie(null),ke=ie(""),Ye=k((s,f)=>{let y=s.trim().toLowerCase();bt(y)&&Bt(g=>g&&g.email===y&&g.firstName===(f??"")?g:{email:y,firstName:f??""})},[]);Y(()=>{if(t||!ce)return;let s=ht(u.filter(Ie),g=>He(g,n)===null?Pe:o(He(g,n),n)),f={email:ce.email,firstName:ce.firstName,currency:n,items:s},y=JSON.stringify(f);if(y!==ke.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,ke.current=y,q.captureCart(f).catch(g=>{})},En),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[u,ce,n,t]);let je=k(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=Ve.current;s&&(ke.current="",q.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Qe=Pt(()=>{let s=u.reduce((_,ne)=>{let Ee=He(ne,n);return Ee===null?_:_+Ee},0),f=u.some(_=>Lt(_,n)===null),y=u.reduce((_,ne)=>_+ne.qty,0),g=p?.valid?p.effects:void 0,N=g?Math.min(s,Number(g.discountAmount)):0,de=S?.bundleDiscount??0,Gt=S?.appliedBundles??[],Ae=!!g?.freeShipping,Xe=F.find(_=>_.id===R),Je=Ae?0:S?.shipping??Xe?.amount??0,Vt=Et({quoted:S!==null,optionCount:F.length,chosenAmount:Xe?.amount,couponWaivesFreight:Ae}),Re={};for(let _ of g?.freeUnits??[])Re[_.partNumber]=(Re[_.partNumber]??0)+_.quantity;let Yt=S?.tax??null,jt=S?S.grandTotal:s-N-de+Je;return{sets:y,units:u.reduce((_,ne)=>_+(ne.components??[]).reduce((Ee,Qt)=>Ee+Qt.wheels*ne.qty,0),0),subtotal:s,hasUnpricedLine:f,discount:N,bundleDiscount:de,appliedBundles:Gt,shipping:Je,freeShipping:Ae,shippingStatus:Vt,freeUnitsByPartNumber:Re,tax:Yt,grand:jt,repricing:!!p?.refused&&S!==null&&W===p?.code,currency:n}},[u,n,p,F,R,S,W]),zt=Pt(()=>({isOpen:i,preview:t,open:D,close:xe,toggle:O,items:u,catalog:l,bundles:m,warmCatalog:Se,add:E,remove:U,setQty:V,replaceItems:Ge,identify:Ye,clearCapturedCart:je,coupon:p,applyCoupon:le,removeCoupon:te,refuseCoupon:ve,couponBusy:X,deliveryOptions:F,shippingMethodId:R,setShippingMethodId:J,totals:Qe}),[i,t,D,xe,O,u,l,m,Se,E,U,V,Ge,Ye,je,p,le,te,ve,X,F,R,Qe]);return Pn(Nt.Provider,{value:zt,children:e})}function Tt(){let e=xn(Nt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as Dn}from"react";function _t(e,t,n,r){for(;e.size>=t;){let o,i;for(let[u,c]of e){if(c.expiresAt<=r){o=u;break}i===void 0&&n(u)&&(i=u)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var In=6e4,wn=5e3,Ln=500,we=new Map;async function Nn(e){let{host:t,matchesRequestHost:n}=await ot();if(!t)return"";let r=await it();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Tn=e=>e.includes("|slug:")||e.includes("|xhost:");async function kt(e,t){if(await at()!==null)return t();let n=await Nn(e);if(!n)return t();let r=Date.now(),o=we.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",u=a?wn:In,c=we.get(n)?.lastGood,l=i.outcome.state==="ok"?i:a?c:void 0,d=a&&l?l:i;return _t(we,Ln,Tn,r),we.set(n,{load:d,expiresAt:r+u,lastGood:l}),d}var _n=404;function kn(e){if(e instanceof me&&e.status===_n)return{state:"absent"};let t=e instanceof me?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var An="[storefront:chrome-load-failed]";function Rn(e,t){console.error(`${An} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function At(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=kn(o);return i.state==="failed"&&Rn(e,i),{value:n,outcome:i}}}function Mn(e){return e==="production"?"silent":"banner"}var mo=Mn("production");function On(e,t){return e?.trim()||t}function So({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=On(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Fn={name:pe,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,mapsApiKey:null,mapsMapId:null,socialLinks:Me},vo=Dn(async()=>kt("site",()=>At("site",async()=>{let e=await q.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,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:tt(e.socialLinks)}},Fn)));var Eo={name:pe,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,mapsApiKey:null,mapsMapId:null,socialLinks:Me};import{jsx as Mt,jsxs as Dt}from"react/jsx-runtime";import{useEffect as Le,useRef as Ot,useState as Ne}from"react";var he=new Map,Un=64;async function $n(e){if(!Ze())return null;try{let t=await fetch(`${nt()}/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 Rt(e){let t=he.get(e);if(t)return t;let n=$n(e);if(he.set(e,n),he.size>Un){let r=he.keys().next();r.done||he.delete(r.value)}return n}var qn={small:54,medium:66,large:84},Hn=44,Kn=202/22,Ro=16,Mo=140,Wn=.88,Do=16,Bn="invert(1)";function Oo({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,onLightSurface:o,reversedSrc:i,inkIsDark:a,size:u="medium",sizePx:c,wordmark:l,siteName:d=pe,fitToContainer:m=!1,fitWordmarkToContainer:P=!1,fitFloorPx:L}){let b=l&&l.trim()?l.trim():d,[C,I]=Ne(!1),T=Ot(null),M=E=>{T.current=E};Le(()=>{let E=T.current?.ownerDocument??document,U=()=>{I(E.documentElement.getAttribute("data-theme")==="light")};U();let V=new MutationObserver(U);return V.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>V.disconnect()},[]);let x=n&&n.trim()?n.trim():null,w=!!x&&rt(x),S=o??(C&&t),H=r&&w&&x&&i!=null?{reversed:i,inkIsDark:a??null}:null,W=H!==null,[Q,h]=Ne(null);Le(()=>{if(!r||!x||!w||W){h(null);return}let E=!1;return h(null),Rt(x).then(U=>{E||h(U)}),()=>{E=!0}},[r,x,w,W]);let v=H??Q,p=!!v&&v.inkIsDark!==null&&(S?!v.inkIsDark:v.inkIsDark),K=r&&!!x&&!w&&!S,X=p&&v?v.reversed:x,z=X?[X]:[],[R,J]=Ne(0);Le(()=>{J(0)},[x,p]);let Z=e==="footer"?Hn:qn[u],D=c&&c>0?c:Z,xe=Math.round(D*Kn),O=R<z.length?z[R]:null,[Se,ee]=Ne(X),se=O!==null&&O===Se,F=Ot(null);Le(()=>{let E=F.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(O);return}let U=!1;return E.decode().then(()=>!U&&ee(O),()=>!U&&J(V=>V+1)),()=>{U=!0}},[O]);let G=m||P,le=`calc(100cqi / ${((b.length+1)*Wn).toFixed(2)})`,te=G&&L&&L>0?Math.min(L,D):null,ve=G?te===null?`min(${D}px, ${le})`:`clamp(${te}px, ${le}, ${D}px)`:`${D}px`,ue=Dt("span",{className:`font-display font-bold tracking-[0.18em] ${te===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ve,lineHeight:1},"aria-label":b,children:[b,Mt("span",{className:"text-accent",children:"."})]});return Dt("span",{ref:M,className:"inline-flex items-center",children:[!se&&ue,O&&Mt("img",{ref:F,src:O,alt:b,width:xe,height:D,className:"shrink-0 object-contain",style:{...se?{height:`${D}px`,width:"auto",...m?{maxWidth:"100cqi"}:{}}:{display:"none"},...K?{filter:Bn}:{}},onLoad:()=>ee(O),onError:()=>J(E=>E+1)},O)]})}import{Children as Gn,isValidElement as Vn,useEffect as Ut,useId as Yn,useLayoutEffect as jn,useRef as j,useState as $t}from"react";var Te=(e,t)=>!!e[t]&&!e[t].disabled;function Ke(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Te(e,i))return i}return t}function We(e,t){return Ke(e,t===1?-1:e.length,t)}function Be(e,t){return Te(e,t)?t:Math.max(We(e,1),0)}function Ft(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(),u=n.findIndex((c,l)=>Te(n,l)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:u>=0?u: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:Ke(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ke(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:We(n,1)}),handled:!0};case"End":return{state:i({focus:We(n,-1)}),handled:!0};case"Enter":case" ":return Te(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{Fragment as er,jsx as B,jsxs as qt}from"react/jsx-runtime";function Qn({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,u]=$t(!1),c=r!==void 0,l=c?r:a,[d,m]=$t(0),P=j({text:"",timer:0}),L=j(null),b=j(null),C=j(null),I=Yn(),T=j(null),M=e.findIndex(h=>h.value===t),x=h=>{h!==l&&(c||u(h),h?o?.():i?.())},w=h=>{let v=e[h];!v||v.disabled||(n(v.value),x(!1),b.current?.focus())},S=h=>{let v={open:l,focus:l?d:Be(e,M),typed:P.current.text},p=Ft(v,h,e);return!p.handled&&p.state.open===l?!1:(p.state.typed!==v.typed&&(P.current.text=p.state.typed,window.clearTimeout(P.current.timer),P.current.timer=window.setTimeout(()=>{P.current.text=""},500)),m(p.state.focus),p.commit!==void 0?w(p.commit):x(p.state.open),p.refocus&&b.current?.focus(),p.handled)},H=j(S);H.current=S;let W=j(()=>x(!1));W.current=()=>x(!1);let Q=h=>{l||(T.current=h.nativeEvent,H.current(h.key)&&h.preventDefault())};return Ut(()=>{if(!l)return;let h=p=>{L.current?.contains(p.target)||W.current()},v=p=>{p!==T.current&&H.current(p.key)&&p.preventDefault()};return document.addEventListener("mousedown",h),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v)}},[l]),Ut(()=>{l&&(P.current.text||m(Be(e,M)))},[l]),jn(()=>{if(!l||!C.current)return;C.current.children.item(d)?.scrollIntoView({block:"nearest"})},[d,l]),{open:l,toggle:()=>x(!l),close:()=>x(!1),focusIdx:d,setFocusIdx:m,pick:h=>w(e.findIndex(v=>v.value===h)),wrapRef:L,triggerRef:b,listRef:C,listId:I,onTriggerKeyDown:Q,activeId:l?`${I}-${d}`:void 0}}var Xn={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-2.5 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 text-[length:var(--size-label,13px)] 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 text-[length:var(--size-body,14px)] 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-3.5 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 Jn({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:u,ariaLabel:c}){let l=Xn[t];return B("ul",{ref:u,id:e,role:"listbox","aria-label":c,...l.pickerMarker?{"data-picker-menu":""}:{},className:l.list,children:n.map((d,m)=>{let P=d.value===r;return B("li",{id:`${e}-${m}`,role:"option","aria-selected":P,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(m),onMouseDown:L=>{L.preventDefault(),d.disabled||a(d.value)},className:l.item(m===o,P&&d.value!=="",!!d.disabled,m===n.length-1),style:l.itemStyle?.(P),children:d.meta===void 0?d.label:qt(er,{children:[B("span",{className:"flex-1 whitespace-nowrap",children:d.label}),B("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${m}`)})})}function Zn({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:u,"aria-label":c}){let l=Gn.toArray(r).flatMap(b=>{if(!Vn(b))return[];if(b.type!=="option")return[];let I=b.props,T=I.value!==void 0?String(I.value):"",M=I.children,x=typeof M=="string"||typeof M=="number"?String(M):T;return[{value:T,label:x,disabled:!!I.disabled}]}),d=e??"",m=Qn({items:l,value:d,onPick:b=>t?.({target:{value:b}})}),L=l.find(b=>b.value===d)?.label??l[0]?.label??"";return qt("div",{ref:m.wrapRef,className:"relative",children:[a&&B("input",{type:"hidden",name:a,value:d}),B("button",{ref:b=>{m.triggerRef.current=b},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":m.open,"aria-controls":m.open?m.listId:void 0,"aria-activedescendant":m.activeId,"aria-label":c,id:u,onClick:()=>!n&&m.toggle(),onKeyDown:b=>!n&&m.onTriggerKeyDown(b),className:`block w-full ${o??""}`,style:i,children:B("span",{className:"block w-full truncate text-left",children:L})}),m.open&&B(Jn,{id:m.listId,tone:"select",items:l,value:d,focusIdx:m.focusIdx,onFocus:m.setFocusIdx,onPick:m.pick,listRef:m.listRef})]})}var zo="#c9a461",Ht=[{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"}],Go={name:"",color:"var(--fg)",family:"silver",src:""};function tr(e,t){let n=r=>{let o=Ht.findIndex(i=>i.f===r);return o===-1?Ht.length:o};return n(e)-n(t)||e.localeCompare(t)}function Vo(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(tr)}import{jsx as be,jsxs as _e}from"react/jsx-runtime";var nr="font-mono text-[length:var(--size-label,12px)]",rr="font-semibold uppercase tracking-[0.22em] text-fg";function Kt(e){return`${e??nr} ${rr}`}function Wt(){return be("span",{className:"text-accent",children:" *"})}function or({children:e,required:t,labelFace:n}){return _e("span",{className:Kt(n),children:[e,t?be(Wt,{}):null]})}function ir({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:u}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",l=n?be("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?_e("div",{className:c,children:[_e("label",{htmlFor:o,className:Kt(i),children:[e,t?be(Wt,{}):null]}),u,l]}):_e("label",{htmlFor:o,className:c,children:[be(or,{required:t,labelFace:i,children:e}),u]})}import{jsx as Ce,jsxs as sr}from"react/jsx-runtime";function ar({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,u=[];for(let c=0;c<e;c++){let l=c/e*Math.PI*2-Math.PI/2;if(u.push({x1:a(100+Math.cos(l)*22),y1:a(100+Math.sin(l)*22),x2:a(100+Math.cos(l)*86),y2:a(100+Math.sin(l)*86),main:!0}),t){let d=l+Math.PI/e;u.push({x1:a(100+Math.cos(d)*22*1.4),y1:a(100+Math.sin(d)*22*1.4),x2:a(100+Math.cos(d)*78),y2:a(100+Math.sin(d)*78),main:!1})}}return sr("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:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),u.map((c,l)=>Ce("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},l))]})}import{useState as lr}from"react";import{jsx as ae,jsxs as ze}from"react/jsx-runtime";function ur({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Tt(),[i,a]=lr("");async function u(){o||!i.trim()||(await n(i,e),a(""))}return ze("div",{className:"flex flex-col gap-2",children:[t===null?ze("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-3.5 py-3.5 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{u()},disabled:o,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:o?"\u2026":"Apply"})]}):ze("div",{className:["flex items-center justify-between gap-3 border px-3.5 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:yt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function oi(){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)}`}export{Pr as a,Ir as b,wr as c,st as d,De as e,cr as f,dr as g,pr as h,mr as i,Xt as j,Jt as k,fr as l,gr as m,Oe as n,Fe as o,fe as p,Pe as q,sn as r,$e as s,_r as t,kr as u,un as v,Ar as w,Rr as x,cn as y,Mr as z,pn as A,Dr as B,Or as C,bt as D,Kr as E,Wr as F,Br as G,Gr as H,xr as I,mt as J,Ie as K,He as L,oo as M,Tt as N,So as O,Fn as P,Eo as Q,qn as R,Hn as S,Ro as T,Mo as U,Do as V,Oo as W,Qn as X,Jn as Y,Zn as Z,zo as _,Ht as $,Go as aa,tr as ba,Vo as ca,or as da,ir as ea,ar as fa,ur as ga,oi as ha};