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