efficient-storefront-blocks 0.48.0 → 0.50.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 +37 -0
- package/dist/chunks/EditorPreviewCheckout-ZQ7BVKSR.js +4 -0
- package/dist/chunks/{SiteEditorProvider-QS2PKQJ6.js → SiteEditorProvider-3HVJ4V32.js} +1 -1
- package/dist/chunks/chunk-BVN2LFII.js +1 -0
- package/dist/chunks/{chunk-HOORZY5J.js → chunk-C7MFEEPZ.js} +1 -1
- package/dist/chunks/chunk-KP37LMOP.js +1 -0
- package/dist/chunks/chunk-O5Q5ETQG.js +255 -0
- package/dist/chunks/{chunk-5P3HGIOR.js → chunk-SEJFFUSI.js} +1 -1
- package/dist/chunks/{fitment-data-ZOKPAVMT.js → fitment-data-GCO32HAV.js} +1 -1
- package/dist/consent.d.ts +47 -0
- package/dist/consent.js +1 -0
- package/dist/editor.css +1 -1
- package/dist/index.js +64 -59
- package/dist/words.d.ts +10 -2
- package/dist/words.js +4 -4
- package/package.json +9 -2
- package/dist/chunks/EditorPreviewCheckout-KOPGAH7L.js +0 -4
- package/dist/chunks/chunk-MTNZH7OX.js +0 -255
- package/dist/chunks/chunk-S3SSECGB.js +0 -1
- package/dist/chunks/chunk-VIRWFFWD.js +0 -1
- /package/dist/chunks/{SectionEditorShell-KMWXI5OZ.js → SectionEditorShell-2BUHUZDQ.js} +0 -0
- /package/dist/chunks/{chunk-MTNZH7OX.js.LEGAL.txt → chunk-O5Q5ETQG.js.LEGAL.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.50.0 — 2026-10-20
|
|
6
|
+
|
|
7
|
+
- **A picked set shows its part's own pictures** (render axes; Lewis through GG, 2026-10-20). The backend sends each set component's `renderKey` (its lug count, hand and dually position together) and each finish's `axisRenderings` (key → URLs, matched by the backend's one rule). The product hero looks the picked set's left wheel up there (`axisRenderingsFor` in `lib/wheels/cover-rendering`), never parsing the key. No key (an older backend) or no list for it keeps the car ladder, then the finish's angles, as before. A part's own pictures print no reference note. `lib/api/types.ts` gains both fields (the storefront contract gains them in the same change).
|
|
8
|
+
- Guard: `scripts/test-part-axis-renders.tsx`.
|
|
9
|
+
- **The consent hooks are apart from the consent provider.** `components/ConsentContext` now holds only the contexts, `useConsent` and `useConsentControls`; `ConsentProvider` (which draws the banner and the choices panel) is `components/ConsentProvider`. `LegalLine` reads the hooks, so a footer no longer imports the choices panel and its level-2 heading, and the storefront's page outline stops seeing a heading the footer never draws (its `test-heading-outline-covers-catalog`). A host imports `ConsentProvider` from `@/components/ConsentProvider`.
|
|
10
|
+
|
|
11
|
+
## 0.49.0 — 2026-10-20
|
|
12
|
+
|
|
13
|
+
- **Consent by country** (efficient-backend docs/adr/0065; design approved by Lewis 2026-10-20). A site that asks (`consentEnabled`) works out each visitor's region in the browser, from the time zone and the country they picked (the stricter wins), and tells the tags what they may do.
|
|
14
|
+
- US, Australia, New Zealand: the tags run; the visitor can say no. Canada, the UK, the EU and every other country: analytics and ads wait for "Accept all". Global Privacy Control is a no to ads everywhere.
|
|
15
|
+
- `ConsentProvider` / `useConsent` (`components/ConsentContext`): nothing is allowed before the region is known, so the server render allows no tag. Off the provider, or on a site that does not ask, everything is allowed, as before.
|
|
16
|
+
- `ConsentBanner` (Layout Bar or Card, a bottom sheet on a phone; Reject all is the same button as Accept all) and `ConsentPanel` (the site popup's frame, Necessary · Analytics · Advertising). The optional notice in opt-out countries (`consentNoticeOptOut`).
|
|
17
|
+
- `LegalLine` draws the country's link ("Do Not Sell or Share My Personal Information", "Privacy choices" or "Cookie settings") as a button that opens the panel. Privacy · Terms · Cookies stay plain text.
|
|
18
|
+
- The checkout sends `adConsent` (`granted` / `denied`) and no ad-click ids after a no; absent when the site does not ask.
|
|
19
|
+
- `lib/consent/rules` (regions, words) and `lib/consent/choice` (kept in `sf:consent`, one store, Google Consent Mode values).
|
|
20
|
+
- `SiteSwitch`: the listing's "In stock only" switch moved out of `PlpInStockToggle`, which now uses it. Same markup.
|
|
21
|
+
- The site identity carries `consentEnabled`, `consentPrivacyPage` and `consentNoticeOptOut`; `lib/api/types.ts` regenerated from the storefront contract with them and `OrderRequest.adConsent`. The chrome reads gain `consentBanner`.
|
|
22
|
+
- Editor: the `consent-banner` system page is "Cookie banner" under Popups, with one Layout row (efficient-shell `PictureTiles`, two pictures) and a note; its preview draws the banner.
|
|
23
|
+
- **New light entry `efficient-storefront-blocks/consent`**: the rules by country (`CONSENT_RULES`, `CONSENT_GPC_RULE`, `rulesForCountries`, `regionOfCountry`), plain data, no import, for the admin's Marketing › Privacy table.
|
|
24
|
+
- Guards: `scripts/test-consent-by-country.tsx` (regions, no tag before a yes, GPC, `adConsent`, nothing before the region is known, Reject all as Accept all, GPC in the panel); `scripts/test-web-package.mjs` checks the consent entry.
|
|
25
|
+
|
|
26
|
+
- **The Header panel draws the shell's tab strip, like the section panel and Site styles** (SSOT, harness UI-24; the look Lewis approved for Site styles, 2026-10-20). Its four tabs (Logo, Menu, Tools, Look) are efficient-shell's `Tabs`: the underline strip with equal shares, a glyph on each tab, and `labelsFit` (each word beside its glyph while the words fit, then only the open tab's word, then glyphs only). A hidden word still names its tab, and the tab's Tooltip says it. It replaces efficient-easel's deprecated `SettingsTabs`; no file in the blocks uses `SettingsTabs` now.
|
|
27
|
+
- **efficient-shell `^8.2.0`** (peer and dev, `package/` too; was `^7.75.0 || ^8.0.0`): `labelsFit` is new in 8.2.0.
|
|
28
|
+
- Guard: `scripts/test-one-settings-tab-strip.ts` (no `SettingsTabs` in the blocks; the Header strip is the shell's `Tabs` with `labelsFit`). `scripts/test-header-panel-tabs.tsx` renders the panel's own strip (`HeaderTabStrip`).
|
|
29
|
+
- **A wheel card's picture asks for a file as wide as its grid draws it** (card [FIX] Blurry Wheel Cards On Wide Screens). Both wheel cards (`ProductCard`, `wheels-plp/PlpCard`) declared one fixed `sizes`, `(max-width: 640px) 90vw, (max-width: 1024px) 45vw, 300px`. On inovit.com/wheels at 1920 px, 1x, the 4-up Product Grid draws the picture 395 px wide, so the browser took the 384w entry: the dealer's 400 px `_sm.webp`, soft. Now the GRID writes the value from its column counts, with one rule in `lib/sections/card-image-sizes.ts`: N columns → `calc(100vw / N - 4rem)`, at the grid's own breakpoints.
|
|
30
|
+
- The Product Grid and the product page's related grid read the counts off their own column classes (`gridClassImageSizes`) and pass the value through `ProductCardChrome.imageSizes`. The Alloy Wheels Listing computes it from its per-view counts (`plpCardImageSizes`, Auto and fixed counts) and passes `PlpCard` the `imageSizes` prop. A card in no grid declares `CARD_IMAGE_SIZES`, the Product Grid's 4-up shape.
|
|
31
|
+
- It moves no pixel and no stored value; only the `sizes` attribute changes. At 1920 px, 1x, a 4-up grid now fetches the 1200 px `_lg.webp` (156 KB) for each card where it fetched the 400 px copy (37 KB). On a 2x screen a 4-up grid stays on the 1200 px copy at 1920 and 2560. A listing on Auto at 1920 keeps the 400 px copy (its pictures are 279 px).
|
|
32
|
+
- ⚠️ A host that pins the rendered card's bytes moves with it: the storefront's `scripts/fixtures/section-style-defaults.baseline.json` (`productCard`) and `scripts/spec-wording-removal.pin.json` hold the old string.
|
|
33
|
+
- Guard: `scripts/test-card-image-sizes.tsx` renders both cards in their real grids, reads `sizes` off the markup and evaluates it at 15 viewports: the slot is at least the drawn picture for every Product Grid count (1-6) and every listing count (Auto, 1-6) and gutter, and at 1920 the file the browser picks covers the picture at 1x and 2x. Red on the old string (3 of 6: 300 px declared for a 394.5 px picture).
|
|
34
|
+
- **Builder 28.1** (peer and dev). A host must move with it: the builder range is `^28.1.0` (was `^26.2.0`). The easel range stays `^14.2.0` and the shell range `^8.2.0` (#135). The storefront, which vendors `src/`, installs builder 28.1 in the same pull request that takes this pin.
|
|
35
|
+
- The editor word catalogue is regenerated against builder 28.1.
|
|
36
|
+
- Guards: the builder's own new rows from 26.3.0 (#57: the Logo block's Alignment and Padding, the Divider's `thickness` / `lengthPct` / `hideOnMobile`) are declared gains in `test-animation-tab.tsx` and the section-style `ADDED` registry, each with its builder release. The fixture is not re-captured. `test-shell-peer-range.ts` holds the new ranges.
|
|
37
|
+
- **The render side takes easel's names from efficient-easel too, not through efficient-web-builder's re-exports** (SSOT; finishes 0.48.0's change). 0.48.0 moved the `editor/` imports of the builder's 63 easel re-exports and missed the same modules on the `render/` and `format/` sides: 72 files (83 imports, 29 of them in `src/render`) still named them. Each now names its easel subpath, all in easel's render group, so `src/render` stays inside its rules (`scripts/test-render-side.ts`). Renamed names keep their local name. No stored value and nothing on screen changes. This lets efficient-web-builder delete the 63 files.
|
|
38
|
+
- Guard: `scripts/test-easel-names-from-easel.ts` now checks every side of the builder (`editor/`, `render/`, `format/`). Guards that load easel's session at run time take it with `require`: in a guard a bare `import()` of easel loads a second copy, and the session is state (measured: `require` gives the builder's copy).
|
|
39
|
+
|
|
3
40
|
## 0.48.0 — 2026-10-20
|
|
4
41
|
|
|
5
42
|
- **A Publish the backend refuses says which part, in its words.** The site's Publish (`site.publish`) turns the backend's 400, which is keyed to the part that cannot go live (`{"Page About": {"slug": ["…"]}}`), into `WebsiteBackendError("invalid", "<part>: <first message>")`. The editor screen sends it to the host as `storefront-editor:publish-failed` with that `reason` (efficient-easel 14.2.0, #301). A 400 that names no part, and every other failure, is passed on as before.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";import{K as qt,L as _t,M as Dt,N as Ft,O as Mt,P as ie,Q as we,R as Ut,S as Wt,T as Ze,U as $t,W as Qe,Y as Kt,Z as Yt,_ as zt,a as Lt,b as Ot,c as Tt,d as jt,da as Bt,ia as Ht,ja as Gt,ma as et,oa as K,w as _e}from"./chunk-BVN2LFII.js";import{j as qe,p as de,w as T}from"./chunk-KP37LMOP.js";import{a as Rt,c as ne,za as It}from"./chunk-C7MFEEPZ.js";import{o as At,p as Se,q as H}from"./chunk-SEJFFUSI.js";import{a as Xe,b as ir}from"./chunk-Y6SLVHK3.js";var Jt=Xe((ra,Vt)=>{"use strict";var sr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Vt.exports=sr});var en=Xe((aa,Qt)=>{"use strict";var cr=Jt();function Xt(){}function Zt(){}Zt.resetWarningCache=Xt;Qt.exports=function(){function t(a,o,s,l,d,p){if(p!==cr){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Zt,resetWarningCache:Xt};return n.PropTypes=n,n}});var nn=Xe((sa,tn)=>{"use strict";tn.exports=en()();var oa,ia});import{useEffect as z,useMemo as ze,useRef as ce,useState as g}from"react";var N=ir(nn(),1);import x from"react";function rn(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function lr(t){if(Array.isArray(t))return t}function ln(t,e,n){return(e=gr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ur(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a,o,s,l,d=[],p=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(p=(a=s.call(n)).done)&&(d.push(a.value),d.length!==e);p=!0);}catch(v){u=!0,o=v}finally{try{if(!p&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return d}}function pr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function an(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function on(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?an(Object(n),!0).forEach(function(a){ln(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):an(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function dr(t,e){if(t==null)return{};var n,a,o=mr(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(a=0;a<s.length;a++)n=s[a],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function mr(t,e){if(t==null)return{};var n={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;n[a]=t[a]}return n}function un(t,e){return lr(t)||ur(t,e)||yr(t,e)||pr()}function fr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var a=n.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gr(t){var e=fr(t,"string");return typeof e=="symbol"?e:e+""}function tt(t){"@babel/helpers - typeof";return tt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tt(t)}function yr(t,e){if(t){if(typeof t=="string")return rn(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rn(t,e):void 0}}var j=function(e,n,a){var o=!!a,s=x.useRef(a);x.useEffect(function(){s.current=a},[a]),x.useEffect(function(){if(!o||!e)return function(){};var l=function(){if(s.current)return s.current.apply(s,arguments)};return e.on(n,l),function(){e.off(n,l)}},[o,n,e,s])},nt=function(e){var n=x.useRef(e);return x.useEffect(function(){n.current=e},[e]),n.current},me=function(e){return e!==null&&tt(e)==="object"},hr=function(e){return me(e)&&typeof e.then=="function"},vr=function(e){return me(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},sn="[object Object]",br=function t(e,n){if(e===n)return!0;if(!me(e)||!me(n))return e===n;var a=Array.isArray(e),o=Array.isArray(n);if(a!==o)return!1;var s=Object.prototype.toString.call(e)===sn,l=Object.prototype.toString.call(n)===sn;if(s!==l)return!1;if(!s&&!a)return e===n;var d=Object.keys(e),p=Object.keys(n);if(d.length!==p.length)return!1;for(var u={},v=0;v<d.length;v+=1)u[d[v]]=!0;for(var b=0;b<p.length;b+=1)u[p[b]]=!0;var f=Object.keys(u);if(f.length!==d.length)return!1;var y=e,A=n,k=function(S){return t(y[S],A[S])};return f.every(k)},pn=function(e,n,a){return me(e)?Object.keys(e).reduce(function(o,s){var l=!me(n)||!br(e[s],n[s]);return a.includes(s)?(l&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),o):l?on(on({},o||{}),{},ln({},s,e[s])):o},null):null},dn="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.",cn=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:dn;if(e===null||vr(e))return e;throw new Error(n)},xr=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:dn;if(hr(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(o){return cn(o,n)})};var a=cn(e,n);return a===null?{tag:"empty"}:{tag:"sync",stripe:a}},kr=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"6.12.0"}),e.registerAppInfo({name:"react-stripe-js",version:"6.12.0",url:"https://stripe.com/docs/stripe-js/react"}))},De=x.createContext(null);De.displayName="ElementsContext";var mn=function(e,n){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return e},at=function(e){var n=e.stripe,a=e.options,o=e.children,s=x.useMemo(function(){return xr(n)},[n]),l=x.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(a):null}}),d=un(l,2),p=d[0],u=d[1];x.useEffect(function(){var f=!0,y=function(k){u(function(C){return C.stripe?C:{stripe:k,elements:k.elements(a)}})};return s.tag==="async"&&!p.stripe?s.stripePromise.then(function(A){A&&f&&y(A)}):s.tag==="sync"&&!p.stripe&&y(s.stripe),function(){f=!1}},[s,p,a]);var v=nt(n);x.useEffect(function(){v!==null&&v!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[v,n]);var b=nt(a);return x.useEffect(function(){if(p.elements){var f=pn(a,b,["clientSecret","fonts"]);f&&p.elements.update(f)}},[a,b,p.elements]),x.useEffect(function(){kr(p.stripe)},[p.stripe]),x.createElement(De.Provider,{value:p},o)};at.propTypes={stripe:N.default.any,options:N.default.object};var fn=function(e){var n=x.useContext(De);return mn(n,e)},gn=function(){var e=fn("calls useElements()"),n=e.elements;return n},Cr=function(e){var n=e.children,a=fn("mounts <ElementsConsumer>");return n(a)};Cr.propTypes={children:N.default.func.isRequired};var Sr=x.createContext(null);Sr.displayName="CheckoutContext";var yn=x.createContext(null);yn.displayName="CheckoutSdkContext";var rt=function(e){var n=x.useContext(yn),a=x.useContext(De);if(n){if(a)throw new Error("You cannot wrap the part of your app that ".concat(e," in both a checkout provider and <Elements> provider."));return n}else return mn(a,e)},wr=["mode"],Pr=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},E=function(e,n,a){var o="".concat(Pr(e),"Element"),s=function(u){var v=u.id,b=u.className,f=u.options,y=f===void 0?{}:f,A=u.onBlur,k=u.onFocus,C=u.onReady,S=u.onChange,F=u.onEscape,O=u.onClick,X=u.onLoadError,G=u.onLoaderStart,fe=u.onNetworksChange,re=u.onConfirm,Ee=u.onCancel,ae=u.onShippingAddressChange,Re=u.onShippingRateChange,ge=u.onSavedPaymentMethodRemove,Ie=u.onSavedPaymentMethodUpdate,ye=u.onAvailablePaymentMethodsChange,ee=rt("mounts <".concat(o,">")),te="elements"in ee?ee.elements:null,M="checkoutSdk"in ee?ee.checkoutSdk:null,he=x.useState(null),le=un(he,2),I=le[0],ve=le[1],_=x.useRef(null),oe=x.useRef(null);j(I,"blur",A),j(I,"focus",k),j(I,"escape",F),j(I,"click",O),j(I,"loaderror",X),j(I,"loaderstart",G),j(I,"networkschange",fe),j(I,"confirm",re),j(I,"cancel",Ee),j(I,"shippingaddresschange",ae),j(I,"shippingratechange",Re),j(I,"savedpaymentmethodremove",ge),j(I,"savedpaymentmethodupdate",Ie),j(I,"availablepaymentmethodschange",ye),j(I,"change",S);var U;C&&(e==="expressCheckout"?U=C:U=function(){C(I)}),j(I,"ready",U),x.useLayoutEffect(function(){if(_.current===null&&oe.current!==null&&(te||M)){var w=null;if(M){var B=M,be=M;switch(e){case"paymentForm":w=be.createForm(y);break;case"payment":w=B.createPaymentElement(y);break;case"address":if("mode"in y){var xe=y.mode,He=dr(y,wr);if(xe==="shipping")w=B.createShippingAddressElement(He);else if(xe==="billing")w=B.createBillingAddressElement(He);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":w=B.createExpressCheckoutElement(y);break;case"currencySelector":w=M.createCurrencySelectorElement();break;case"taxId":w=B.createTaxIdElement(y);break;case"contactDetails":w=B.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in M)w=M.createLinkSignupElement(y);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":w=B.createTermsElement(y);break;default:throw new Error("<".concat(o,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else te&&(w=te.create(e,y));_.current=w,ve(w),w&&w.mount(oe.current)}},[te,M,y]);var ue=nt(y);return x.useEffect(function(){if(_.current){var w=pn(y,ue,["paymentRequest"]);w&&"update"in _.current&&_.current.update(w)}},[y,ue]),x.useLayoutEffect(function(){return function(){if(_.current&&typeof _.current.destroy=="function")try{_.current.destroy(),_.current=null}catch{}}},[]),x.createElement("div",{id:v,className:b,ref:oe})},l=function(u){rt("mounts <".concat(o,">"));var v=u.id,b=u.className;return x.createElement("div",{id:v,className:b})},d=n?l:s;return d.propTypes={id:N.default.string,className:N.default.string,onChange:N.default.func,onBlur:N.default.func,onFocus:N.default.func,onReady:N.default.func,onEscape:N.default.func,onClick:N.default.func,onLoadError:N.default.func,onLoaderStart:N.default.func,onNetworksChange:N.default.func,onConfirm:N.default.func,onCancel:N.default.func,onShippingAddressChange:N.default.func,onShippingRateChange:N.default.func,onSavedPaymentMethodRemove:N.default.func,onSavedPaymentMethodUpdate:N.default.func,onAvailablePaymentMethodsChange:N.default.func,options:N.default.object},d.displayName=o,d.__elementType=e,d},R=typeof window>"u",Nr=x.createContext(null);Nr.displayName="EmbeddedCheckoutProviderContext";var hn=function(){var e=rt("calls useStripe()"),n=e.stripe;return n},la=E("auBankAccount",R),ua=E("card",R),pa=E("cardNumber",R),da=E("cardExpiry",R),ma=E("cardCvc",R),fa=E("currencySelector",R),ga=E("iban",R),vn=E("payment",R),ya=E("expressCheckout",R),ha=E("paymentRequestButton",R),va=E("linkAuthentication",R),ba=E("linkSignup",R),xa=E("contactDetails",R),ka=E("address",R),Ca=E("shippingAddress",R),Sa=E("paymentMethodMessaging",R),wa=E("taxId",R),Pa=E("issuingCardNumberDisplay",R),Na=E("issuingCardCvcDisplay",R),Ea=E("issuingCardExpiryDisplay",R),Ra=E("issuingCardPinDisplay",R),Ia=E("issuingCardCopyButton",R),Aa=E("terms",R);function Ue(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ue=function(e){return typeof e}:Ue=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ue(t)}var kn="dahlia",Er=function(e){return e===3?"v3":e},Cn="https://js.stripe.com",Rr="".concat(Cn,"/").concat(kn,"/stripe.js"),Ir=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Ar=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,bn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Lr=function(e){return Ir.test(e)||Ar.test(e)},Or=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Cn,'"]')),n=0;n<e.length;n++){var a=e[n];if(Lr(a.src))return a}return null},xn=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",a=document.createElement("script");a.src="".concat(Rr).concat(n);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(a),a},Tr=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},Pe=null,Fe=null,Me=null,jr=function(e){return function(n){e(new Error("Failed to load Stripe.js",{cause:n}))}},qr=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},_r=function(e){return Pe!==null?Pe:(Pe=new Promise(function(n,a){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(bn),window.Stripe){n(window.Stripe);return}try{var o=Or();if(o&&e)console.warn(bn);else if(!o)o=xn(e);else if(o&&Me!==null&&Fe!==null){var s;o.removeEventListener("load",Me),o.removeEventListener("error",Fe),(s=o.parentNode)===null||s===void 0||s.removeChild(o),o=xn(e)}Me=qr(n,a),Fe=jr(a),o.addEventListener("load",Me),o.addEventListener("error",Fe)}catch(l){a(l);return}}),Pe.catch(function(n){return Pe=null,Promise.reject(n)}))},Dr=function(e,n,a){if(e===null)return null;var o=n[0];if(typeof o!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(Ue(o)," instead."));var s=o.match(/^pk_test/),l=Er(e.version),d=kn;s&&l!==d&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(d,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var p=e.apply(void 0,n);return Tr(p,a),p},Ne,Sn=!1,wn=function(){return Ne||(Ne=_r(null).catch(function(e){return Ne=null,Promise.reject(e)}),Ne)};Promise.resolve().then(function(){return wn()}).catch(function(t){Sn||console.warn(t)});var Pn=function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];Sn=!0;var o=Date.now();return wn().then(function(s){return Dr(s,n,o)})};var Fr="sf:gclid",Mr="sf:fbclid",Ur=2160*60*60*1e3;function Rn(){return typeof window<"u"}function Nn(t){let e=Se.getItem(t);if(!e)return"";try{let{v:n,t:a}=JSON.parse(e);return!n||typeof a!="number"||Date.now()-a>Ur?"":n}catch{return""}}function En(t){if(!Rn())return"";let e=t.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function In(){if(!Rn())return{};let t=Nn(Fr),e=Nn(Mr),n=En("_fbp"),a=En("_fbc");!a&&e&&(a=`fb.1.${Date.now()}.${e}`);let o={};return t&&(o.gclid=t),e&&(o.fbclid=e),n&&(o.fbp=n),a&&(o.fbc=a),o}var An="sf:meta-purchases",Wr=20;function On(){return typeof window>"u"||window.parent!==window}function $r(...t){try{if(On()||typeof window.fbq!="function")return;window.fbq(...t)}catch{}}var Ln=new Set;function Kr(t){if(Ln.has(t))return!1;Ln.add(t);try{let e=JSON.parse(Se.getItem(An)??"[]");if(e.includes(t))return!1;Se.setItem(An,JSON.stringify([...e,t].slice(-Wr)))}catch{}return!0}function Yr(t){return[...new Set(t.filter(we).flatMap(e=>e.components.map(n=>n.partNumber)))]}function Tn(t){let e=t.confirmation;On()||!Kr(e.orderNumber)||$r("track","Purchase",{value:Number(e.grandTotal),currency:e.currency,content_type:"product",content_ids:Yr(t.lines)},{eventID:e.orderNumber})}var ot="checkout-afterpay-context",We="checkout-gocardless-context",it="checkout-zip-context",$e="checkout-klarna-context";function zr({evidence:t,parked:e}){return t?{action:"capture",evidence:t,parked:e}:e?{action:"settle",parked:e}:{action:"ignore"}}function Br(t,e){let n=t.getItem(e);if(t.removeItem(e),!n)return null;try{return JSON.parse(n)}catch{return null}}var jn={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:ot,evidenceFrom(t,e){return e==="cancel"||(t.get("status")??"").toUpperCase()==="CANCELLED"?null:t.get("orderToken")},requestFrom:t=>({token:t})},qn={name:"Zip",legParam:"zip",legValues:["return"],storageKey:it,evidenceFrom(t){let e=(t.get("result")??"").toLowerCase();return e==="cancelled"||e==="declined"?null:t.get("checkoutId")},requestFrom:t=>({checkoutId:t})};async function st(t,e){let n=new URLSearchParams(e.search),a=n.get(t.legParam);if(!a||!t.legValues.includes(a))return;let o=Br(e.storage,t.storageKey),s=t.evidenceFrom(n,a);e.scrubQuery();let l=zr({evidence:s,parked:o});if(l.action!=="ignore"){if(e.page.clearCart(),l.action==="settle"){e.page.note(`The ${t.name} payment was not completed \u2014 our team will follow up on payment.`),e.page.land(l.parked.confirmation);return}e.page.setConfirming(!0);try{let d=await e.capture(t.requestFrom(l.evidence));d.status==="paid"?e.page.markPaid():e.page.note(`${t.name} declined the payment \u2014 our team will follow up on payment.`),e.page.land(l.parked?.confirmation??d)}catch{l.parked?(e.page.note(`We could not confirm the ${t.name} payment \u2014 our team will follow up on payment.`),e.page.land(l.parked.confirmation)):e.page.fail(`We could not confirm your ${t.name} payment. Please contact us before trying again \u2014 your payment may already have been taken.`)}finally{e.page.setConfirming(!1)}}}import{Fragment as q,jsx as r,jsxs as c}from"react/jsx-runtime";function _n(t){let e=t.indexOf(`
|
|
3
|
+
`);return e===-1?[t,""]:[t.slice(0,e),t.slice(e+1)]}function Dn(t,{canParkContext:e}={canParkContext:!0}){let n=t.paymentMethods,a=[];return n.includes("card")&&a.push({key:"card",title:"Card",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("paypal")&&t.paypalClientId&&a.push({key:"paypal",title:"PayPal",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL \xB7 CARDS"})}),n.includes("afterpay")&&a.push({key:"afterpay",title:"Afterpay",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 \xD7 INTEREST-FREE"})}),n.includes("square")&&t.squareApplicationId&&t.squareLocationId&&a.push({key:"square",title:"Card (Square)",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("gocardless")&&e&&a.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),n.includes("zip")&&a.push({key:"zip",title:"Zip",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),n.includes("klarna")&&e&&a.push({key:"klarna",title:"Klarna",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),a.push({key:"bank",title:"Bank transfer",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),a}function ut({site:t,logo:e,preview:n=!1}){let{items:a,totals:o,coupon:s,refuseCoupon:l,deliveryOptions:d,shippingMethodId:p,setShippingMethodId:u,identify:v,clearCapturedCart:b}=Ze(),f=d.find(i=>i.id===p)?.pickupLocation??null,{country:y,countries:A,activeCountry:k,formatMoney:C}=ie(),[S,F]=g(()=>Dn(t)[0].key),[O,X]=g(!0);z(()=>{X(At(H))},[]);let[G,fe]=g(!1),[re,Ee]=g(""),[ae,Re]=g(""),[ge,Ie]=g(""),[ye,ee]=g(""),[te,M]=g(""),[he,le]=g(""),[I,ve]=g(""),[_,oe]=g(""),[U,ue]=g(()=>y||A[0]?.code||""),[w,B]=g(""),[be,xe]=g([]),$n=ze(()=>A.find(i=>i.code===U)??k,[A,U,k])?.postalLabel||"Postal Code",Kn=be[0]?.divisionType||"State / Province";z(()=>{if(!U){xe([]);return}let i=!1;return T.listCountrySubdivisions(U).then(m=>{i||(xe(m),B(""))}),()=>{i=!0}},[U]);let[Z,pt]=g(null),[dt,mt]=g([]),[Ae,Le]=g("new"),[Ge,ft]=g(!1),[gt,Yn]=g("Home"),[yt,ht]=g(null),[W]=g(()=>Gt()),[Oe,$]=g(null),[vt,ke]=g(null),[bt,zn]=g(null),[Bn,Hn]=g(!1),[Gn,Vn]=g(!1),[V,Ve]=g(null),[xt,pe]=g(!1),[kt,Q]=g(null),[Jn,Xn]=g(!1),[Zn,Ct]=g(!1),[Qn,er]=g(!1),[tr,St]=g(!1),wt=ce(!1);z(()=>{n||wt.current||!a.some(we)||(wt.current=!0,qt({lines:a,currency:o.currency,value:o.subtotal-o.discount,coupon:s?.valid?s.code:void 0}))},[a,o,s,n]),z(()=>{v(re,ae.trim()||void 0)},[re,ae,v]);let Pt=ce(null),[Te,nr]=g(null);z(()=>{let i=Pt.current;if(!Te||!i)return;let m=()=>i.style.setProperty("--sf-checkout-header-h",`${Te.offsetHeight}px`);m();let h=new ResizeObserver(m);return h.observe(Te),()=>h.disconnect()},[Te]),z(()=>{let i=h=>({setConfirming:h,land:$,markPaid:()=>pe(!0),note:Q,fail:ke,clearCart:b}),m={search:window.location.search,storage:H,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};st(jn,{...m,capture:T.captureAfterpayPayment,page:i(Xn)}),st(qn,{...m,capture:T.captureZipPayment,page:i(er)})},[]),z(()=>{let m=new URLSearchParams(window.location.search).get("gocardless");if(m!=="confirm"&&m!=="cancel")return;let h=H.getItem(We);if(H.removeItem(We),window.history.replaceState(null,"",window.location.pathname),!h)return;let L;try{L=JSON.parse(h)}catch{return}if(b(),m==="cancel"){Q("The direct debit was not set up \u2014 our team will follow up on payment."),$(L.confirmation);return}Ct(!0),T.completeGocardlessPayment({idempotencyKey:L.idempotencyKey}).then(P=>{P.status==="paid"?pe(!0):P.status==="declined"?Q("The direct debit was declined \u2014 our team will follow up on payment."):Q("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{Q("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{$(L.confirmation),Ct(!1)})},[]),z(()=>{let i=new URLSearchParams(window.location.search),m=i.get("klarna");if(m!=="confirm"&&m!=="cancel")return;let h=H.getItem($e);H.removeItem($e);let L=i.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!h)return;let P;try{P=JSON.parse(h)}catch{return}if(b(),m==="cancel"||!L){Q("The Klarna payment was not completed \u2014 our team will follow up on payment."),$(P.confirmation);return}St(!0),T.captureKlarnaPayment({idempotencyKey:P.idempotencyKey,authorizationToken:L}).then(D=>{D.status==="paid"?pe(!0):D.status==="declined"?Q("Klarna declined the payment \u2014 our team will follow up on payment."):Q("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{Q("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{$(P.confirmation),St(!1)})},[]);function Nt(i){let[m,h]=_n(i.address);ee(m),M(h),le(i.city),ve(i.zip_code),i.country&&ue(i.country),i.phone&&oe(i.phone)}z(()=>{let i=!1;return(async()=>{try{let[m,h,L]=await Promise.all([de.me(),de.myProfile().catch(()=>null),de.myAddresses().catch(()=>[])]);if(i)return;pt(m);let P=L.filter(Ce=>Ce.is_active);mt(P),Ee(m.email);let D=(h?.contact_name??"").split(/\s+/);Re(m.first_name||D[0]||""),Ie(m.last_name||D.slice(1).join(" "));let J=m.phone||h?.phone;J&&oe(J);let Je=P.find(Ce=>Ce.id===m.default_delivery_location)??P[0];if(Je)Le(Je.id),Nt(Je);else if(h){let[Ce,or]=_n(h.address??"");ee(Ce),M(or),le(h.city??""),ve(h.zip_code??""),h.country&&ue(h.country)}}catch{}})(),()=>{i=!0}},[]);function rr(){de.logout(),pt(null),mt([]),Le("new"),ft(!1)}let je=ze(()=>Dn(t,{canParkContext:O}),[t,O]);z(()=>{je.some(i=>i.key===S)||F(je[0].key)},[je,S]);let Et=te.trim()?`${ye}
|
|
4
|
+
${te.trim()}`:ye;async function ar(){if(n||G||a.length===0||o.repricing)return;let i=a.filter(we).flatMap(m=>jt(m.components,m.qty));if(i.length===0){ke("Pick a size on each wheel's product page before checking out.");return}fe(!0),ke(null);try{let m=Z?T.createOrderAuthed:T.createOrder,h=Ht(),L=await m({customer:{email:re,name:`${ae} ${ge}`.trim(),phone:_.trim()||void 0,address:Et,city:he,state:w||void 0,zipCode:I,country:U},items:i,currency:o.currency,idempotencyKey:W,shippingMethodId:p??void 0,couponCode:Ot(s),...h==="denied"?{}:In(),...h?{adConsent:h}:{}});if(_t({confirmation:L,lines:a,adsSendTo:t.googleAdsId&&t.googleAdsConversionLabel?`${t.googleAdsId}/${t.googleAdsConversionLabel}`:null}),Tn({confirmation:L,lines:a}),b(),Z&&Ge&&Ae==="new")try{await de.createAddress({label:gt.trim()||"Home",contact_name:`${ae} ${ge}`.trim(),phone:_.trim(),address:Et,city:he,zip_code:I,country:U}),ht("Address saved to your account.")}catch{ht("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}if(S==="card"&&t.paymentMethods.includes("card")){let P=await T.createPaymentIntent({idempotencyKey:W});Ve(L),zn(P)}else if(S==="paypal"&&t.paymentMethods.includes("paypal"))Ve(L),Hn(!0);else if(S==="afterpay"&&t.paymentMethods.includes("afterpay")){let P=window.location.origin,D=await T.createAfterpayCheckout({idempotencyKey:W,confirmUrl:`${P}/checkout?afterpay=confirm`,cancelUrl:`${P}/checkout?afterpay=cancel`}),J={idempotencyKey:W,confirmation:L};H.setItem(ot,JSON.stringify(J)),window.location.assign(D.redirectCheckoutUrl);return}else if(S==="square"&&t.paymentMethods.includes("square"))Ve(L),Vn(!0);else if(S==="gocardless"&&t.paymentMethods.includes("gocardless")){let P=window.location.origin,D=await T.createGocardlessBillingRequest({idempotencyKey:W,confirmUrl:`${P}/checkout?gocardless=confirm`,cancelUrl:`${P}/checkout?gocardless=cancel`}),J={idempotencyKey:W,confirmation:L};H.setItem(We,JSON.stringify(J)),window.location.assign(D.authorisationUrl);return}else if(S==="zip"&&t.paymentMethods.includes("zip")){let P=window.location.origin,D=await T.createZipCheckout({idempotencyKey:W,redirectUrl:`${P}/checkout?zip=return`}),J={idempotencyKey:W,confirmation:L};H.setItem(it,JSON.stringify(J)),window.location.assign(D.redirectUrl);return}else if(S==="klarna"&&t.paymentMethods.includes("klarna")){let P=window.location.origin,D=await T.createKlarnaCheckout({idempotencyKey:W,confirmUrl:`${P}/checkout?klarna=confirm`,cancelUrl:`${P}/checkout?klarna=cancel`}),J={idempotencyKey:W,confirmation:L};H.setItem($e,JSON.stringify(J)),window.location.assign(D.redirectUrl);return}else $(L)}catch(m){let h=Tt(m);h?(l(h),ke(`${h} Your order has not been placed. Place it again to continue without the code.`)):ke(m instanceof qe?m.message:"Could not place the order. Please try again."),fe(!1)}}return Oe?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:xt?"Payment received":"Order received"}),c("p",{className:"text-fg-dim",children:[xt?c(q,{children:["Thank you \u2014 your payment for order"," ",r("span",{className:"font-mono text-fg",children:Oe.orderNumber})," has gone through."," "]}):c(q,{children:["Thank you \u2014 your order ",r("span",{className:"font-mono text-fg",children:Oe.orderNumber})," is being reviewed by our team."," "]}),Z?c(q,{children:["Track it under"," ",r(ne,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):r(q,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),kt&&r("p",{className:"text-sm text-fg-dim",children:kt}),yt&&r("p",{className:"text-sm text-fg-dim",children:yt}),!Z&&c("p",{className:"text-sm text-fg-dim",children:["You can also"," ",r(ne,{href:`/track?order=${encodeURIComponent(Oe.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),r(ne,{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"})]}):Jn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):Zn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):Qn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):tr?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):bt?r(Hr,{payment:bt,onPaid:()=>{pe(!0),$(V)},onSkip:()=>$(V)}):Bn&&V?r(Jr,{confirmation:V,clientId:t.paypalClientId??"",idemKey:W,onPaid:()=>{pe(!0),$(V)},onSkip:()=>$(V)}):Gn&&V?r(Zr,{confirmation:V,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:W,onPaid:()=>{pe(!0),$(V)},onSkip:()=>$(V)}):c("div",{ref:Pt,className:"bg-bg text-fg",children:[c("header",{ref:nr,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:[c(ne,{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",r("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),r(ne,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:r(Kt,{variant:"header",scrolled:!0,src:e?.url??null,reverse:e?.reverse??!1,reversedSrc:e?.reversed??null,inkIsDark:e?.inkIsDark??null,size:e?.size??"medium",sizePx:e?.sizePx??null,siteName:t.name})}),t.cardPayments?c("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[r("span",{className:"text-green",children:"\u25CF"}),r("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):r("span",{})]}),c("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[r("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),r("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(i=>c("span",{className:["relative flex items-center gap-2 transition-colors",i.state==="pending"?"text-fg-dim":"text-fg",i.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[r("span",{className:i.state==="done"?"text-accent font-bold":"",children:i.n}),r("span",{children:i.label})]},i.n))})]}),c("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[c("div",{children:[c(Ke,{num:"N\xB0 01",title:"Contact",children:[r(K,{label:"Email",hint:Z?c(q,{children:["Signed in \xB7"," ",r("button",{type:"button",onClick:rr,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:r("input",{type:"email",value:re,onChange:i=>Ee(i.target.value),placeholder:"you@example.com",readOnly:Z!==null,className:Y+(Z?" opacity-70":"")})}),c(Mn,{children:[r(K,{label:"First name",children:r("input",{type:"text",value:ae,onChange:i=>Re(i.target.value),className:Y})}),r(K,{label:"Last name",children:r("input",{type:"text",value:ge,onChange:i=>Ie(i.target.value),className:Y})})]})]}),c(Ke,{num:"N\xB0 02",title:f?"Collection":"Shipping address",children:[f?c("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[r("span",{className:"font-medium",children:f.name}),[f.address,f.city,f.state,f.zipCode,f.country].filter(Boolean).length>0&&r("span",{className:"opacity-80",children:[f.address,f.city,f.state,f.zipCode,f.country].filter(Boolean).join(", ")}),f.openingHours&&r("span",{className:"opacity-80",children:f.openingHours}),f.instructions&&r("span",{className:"opacity-80",children:f.instructions}),r("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):c(q,{children:[Z!==null&&dt.length>0&&c("div",{className:"grid gap-3",children:[dt.map(i=>r(Ye,{active:Ae===i.id,onClick:()=>{Le(i.id),Nt(i)},title:i.label,body:i.formatted_address,price:null},i.id)),r(Ye,{active:Ae==="new",onClick:()=>Le("new"),title:"New address",body:null,price:null})]}),r(K,{label:"Address line 1",children:r("input",{type:"text",value:ye,onChange:i=>ee(i.target.value),className:Y})}),r(K,{label:"Address line 2",children:r("input",{type:"text",value:te,onChange:i=>M(i.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:Y})}),c(Mn,{cols:"three",children:[r(K,{label:"City",children:r("input",{type:"text",value:he,onChange:i=>le(i.target.value),className:Y})}),r(K,{label:$n,children:r("input",{type:"text",value:I,onChange:i=>ve(i.target.value),className:Y})}),r(K,{label:"Country",separate:!0,children:r(et,{value:U,onChange:i=>ue(i.target.value),className:Y+" pr-10",style:Fn,children:A.map(i=>r("option",{value:i.code,children:i.name},i.code))})})]}),r(K,{label:Kn,separate:!0,children:be.length>0?c(et,{value:w,onChange:i=>B(i.target.value),className:Y+" pr-10",style:Fn,children:[r("option",{value:"",children:"Select\u2026"}),be.map(i=>r("option",{value:i.code||i.name,children:i.name},i.code||i.name))]}):r("input",{type:"text",value:w,onChange:i=>B(i.target.value),className:Y})})]}),r(K,{label:"Phone",children:r("input",{type:"tel",value:_,onChange:i=>oe(i.target.value),placeholder:"+44 7700 900000",className:Y})}),!f&&Z!==null&&Ae==="new"&&c(q,{children:[r(Qr,{checked:Ge,onChange:ft,label:"Save this address to my account"}),Ge&&r(K,{label:"Address label",children:r("input",{type:"text",value:gt,onChange:i=>Yn(i.target.value),placeholder:"Home",className:Y})})]})]}),r(Ke,{num:"N\xB0 03",title:"Shipping",children:c("div",{className:"grid gap-3",children:[d.map(i=>{let m=i.pickupLocation,h=m?[m.address,m.city,m.state,m.zipCode].filter(Boolean).join(", "):null;return r(Ye,{active:p===i.id,onClick:()=>u(i.id),title:m?`${i.name} \u2014 ${m.name}`:i.name,body:m?[h,m.openingHours,m.instructions,i.description].filter(Boolean).join(" \xB7 "):i.description||null,price:o.freeShipping||i.amount===0?_e:C(i.amount,o.currency),tag:i.tag||void 0},i.id)}),d.length===0&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})}),c(Ke,{num:"N\xB0 04",title:"Payment",children:[r("div",{className:"grid gap-3",children:je.map(i=>r(Ye,{active:S===i.key,onClick:()=>F(i.key),title:i.title,body:i.body,price:i.price,tag:i.tag},i.key))}),S==="card"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):S==="paypal"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll approve the payment with PayPal on the payment step after placing the order."}):S==="afterpay"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):S==="square"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):S==="gocardless"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):S==="zip"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Zip to approve four instalments, then brought straight back."}):S==="klarna"?r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Klarna to choose how to pay, then brought straight back."}):r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."})]})]}),c("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[c("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[r("span",{children:"Your order"}),r(ne,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit \u2197"})]}),r("div",{className:"flex flex-col px-6 py-2",children:a.length===0?c("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",r(ne,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):a.map(i=>r(ea,{slug:i.slug,name:i.name,qty:i.qty,config:i.config,configSummary:ta(i.config),price:Ut(i,o.currency)??0,currency:o.currency},i.id))}),r("div",{className:"border-t border-line px-6 pt-5",children:r(Bt,{customerEmail:re})}),c("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[r(se,{label:"Subtotal",value:C(o.subtotal,o.currency)}),o.discount>0&&s?.valid&&r(se,{label:`Coupon \xB7 ${s.code}`,value:c("span",{className:"font-semibold text-green",children:["\u2212 ",C(o.discount,o.currency)]})}),s?.deferred&&r(se,{label:`Coupon \xB7 ${s.code}`,value:Lt}),s?.valid&&s.effects?.gift&&r(se,{label:`Free gift \xB7 ${s.effects.gift.partNumber}${s.effects.gift.quantity>1?` \xD7${s.effects.gift.quantity}`:""}`,value:r("span",{className:"font-semibold text-green",children:_e})}),r(se,{label:"Shipping",value:o.shippingStatus==="free"?r("span",{className:"font-semibold text-green",children:_e}):Ft(o.shippingStatus)??C(o.shipping,o.currency)}),o.tax&&(o.tax.charged?r(se,{label:o.tax.inclusive?`${o.tax.name} included \xB7 ${o.tax.rate}%`:o.tax.name,value:C(o.tax.amount,o.currency)}):o.tax.name?r(se,{label:o.tax.name,value:Dt}):null)]}),c("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[r("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),r("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:o.repricing?"\u2026":C(o.grand,o.currency)})]}),c("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[vt&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:vt}),o.hasUnpricedLine&&c("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",o.currency,". Remove them, or switch region, to continue."]}),r("button",{type:"button",onClick:ar,disabled:G||a.length===0||o.hasUnpricedLine||o.repricing,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",a.length===0||G||o.hasUnpricedLine||o.repricing?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:G?c(q,{children:["Building order\u2026 ",r("span",{children:"\xB7"})]}):o.repricing?c(q,{children:["Updating total\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:[S==="bank"?"Place order":"Continue to payment"," \xB7"," ",C(o.grand,o.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})]}),r("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:r("span",{children:$t({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}var Y="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",Fn={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 Ke({num:t,title:e,children:n}){return c("section",{className:"mb-6 border border-line bg-bg",children:[c("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),r("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:e})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function Mn({cols:t="two",children:e}){return r("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:e})}function Ye({active:t,onClick:e,title:n,body:a,price:o,tag:s}){return c("button",{type:"button",onClick:e,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&r("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),r("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&r("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),c("span",{className:"flex min-w-0 flex-col gap-1",children:[c("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&r("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})]}),a&&r("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:a})]}),r("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:o})]})}function Hr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=ie(),o=ze(()=>Pn(t.publishableKey),[t.publishableKey]),s=ze(()=>{if(typeof document>"u")return;let l=getComputedStyle(document.documentElement),d=(u,v)=>l.getPropertyValue(u).trim()||v,p=document.documentElement.getAttribute("data-theme")!=="light";return{theme:p?"night":"stripe",variables:{colorPrimary:d("--accent",p?"#c9a461":"#8a6a2a"),colorBackground:d("--site-surface",p?"#131313":"#ffffff"),colorText:d("--fg",p?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:a(Number(t.amount),t.currency)})," ","by card to confirm it now."]}),r(at,{stripe:o,options:{clientSecret:t.clientSecret,appearance:s},children:r(Gr,{payment:t,onPaid:e,onSkip:n})})]})]})})}function Gr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=ie(),o=hn(),s=gn(),[l,d]=g(!1),[p,u]=g(null);async function v(){if(!o||!s||l)return;d(!0),u(null);let b=await o.confirmPayment({elements:s,redirect:"if_required"});if(b.error){u(b.error.message??"Payment failed. Please try again."),d(!1);return}let f=b.paymentIntent?.status;if(f==="succeeded"||f==="processing"){e();return}u("Payment did not complete. Please try again."),d(!1)}return c("div",{className:"flex flex-col gap-4",children:[r(vn,{}),p&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:p}),r("button",{type:"button",onClick:v,disabled:!o||!s||l,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!o||!s||l?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:l?c(q,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:["Pay ",a(Number(t.amount),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:n,disabled:l,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})}var Un="paypal-sdk-js",ct=null;function Vr(t,e){let n=`${t}|${e}`;if(ct?.key===n)return ct.promise;let a=new Promise((o,s)=>{document.getElementById(Un)?.remove();let l=document.createElement("script");l.id=Un;let d=new URLSearchParams({"client-id":t,currency:e,intent:"capture"});l.src=`https://www.paypal.com/sdk/js?${d}`,l.onload=()=>{let p=window.paypal;p?o(p):s(new Error("PayPal SDK loaded without its namespace"))},l.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(l)});return ct={key:n,promise:a},a}function Jr({confirmation:t,clientId:e,idemKey:n,onPaid:a,onSkip:o}){let{formatMoney:s}=ie(),l=ce(null),[d,p]=g(!1),[u,v]=g(null),b=ce(a);return b.current=a,z(()=>{let f=!1,y=null;return Vr(e,t.currency).then(A=>{if(!(f||!l.current))return y=A.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await T.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async k=>{try{if((await T.capturePaypalOrder({idempotencyKey:n,paypalOrderId:k.orderID})).status==="paid"){b.current();return}v("PayPal did not complete the payment. Please try again.")}catch(C){v(C instanceof qe?C.message:"PayPal payment failed. Please try again.")}},onError:()=>{v("PayPal could not process the payment. Please try again.")}}),y.render(l.current).then(()=>{f||p(!0)})}).catch(()=>{f||v("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{f=!0,y?.close?.()}},[e,t.currency,n]),r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:s(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!d&&!u&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),r("div",{ref:l}),u&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:u}),r("button",{type:"button",onClick:o,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var Wn="square-web-sdk",lt=null;function Xr(t){let e=t==="sandbox"?"sandbox":"production";if(lt?.key===e)return lt.promise;let n=new Promise((a,o)=>{document.getElementById(Wn)?.remove();let s=document.createElement("script");s.id=Wn,s.src=e==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{let l=window.Square;l?a(l):o(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>o(new Error("Square SDK failed to load")),document.head.appendChild(s)});return lt={key:e,promise:n},n}function Zr({confirmation:t,applicationId:e,locationId:n,environment:a,idemKey:o,onPaid:s,onSkip:l}){let{formatMoney:d}=ie(),p=ce(null),u=ce(null),v=ce(null),[b,f]=g(!1),[y,A]=g(!1),[k,C]=g(null);z(()=>{let F=!1,O=null;return Xr(a).then(async X=>{if(F||!p.current)return;let G=X.payments(e,n);v.current=G,O=await G.card(),await O.attach(p.current),u.current=O,F||f(!0)}).catch(()=>{F||C("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{F=!0,O?.destroy?.()}},[e,n,a]);async function S(){let F=u.current;if(!(!F||y)){A(!0),C(null);try{let O=await F.tokenize();if(O.status!=="OK"||!O.token){C(O.errors?.[0]?.message??"Please check the card details and try again."),A(!1);return}let X;try{X=(await v.current?.verifyBuyer?.(O.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await T.chargeSquare({idempotencyKey:o,sourceId:O.token,...X?{verificationToken:X}:{}})).status==="paid"){s();return}C("Square did not complete the payment. Please try again.")}catch(O){C(O instanceof qe?O.message:"Square payment failed. Please try again.")}A(!1)}}return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:d(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!b&&!k&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),r("div",{ref:p}),k&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:k}),r("button",{type:"button",onClick:S,disabled:!b||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",!b||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?c(q,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:["Pay ",d(Number(t.grandTotal),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:l,disabled: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"})]})]})})}function Qr({checked:t,onChange:e,label:n,sub:a}){return c("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[r("button",{type:"button",onClick:()=>e(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&r("span",{className:"text-[13px] text-accent",children:"\u2713"})}),c("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,a&&r("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:a})]})]})}function ea({slug:t,name:e,qty:n,config:a,configSummary:o,price:s,currency:l}){let{catalog:d}=Ze(),{formatMoney:p}=ie(),u=d.find(k=>k.slug===t),v=u?.spokes??5,b=u?.mesh??!1,f=a.find(k=>k.gold)?.label,y=u?.finishes.find(k=>k.name===f&&k.src)??u?.finishes.find(k=>k.src),A=u?.finishes[0]?.color??zt;return c("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[c("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[r("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n}),y?.src?r(Rt,{src:y.src,alt:`${e.lead}${e.accent} \u2014 ${y.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):r("div",{className:"block w-[78%]",style:{color:A},children:r(Yt,{spokes:v,mesh:b,className:"block w-full"})})]}),c("div",{className:"flex min-w-0 flex-col gap-0.5",children:[c("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[e.lead,r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:e.accent})]}),r("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:o})]}),r("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:p(s,l)})]})}function se({label:t,value:e}){return c("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[r("span",{children:t}),r("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:e})]})}function ta(t){return t.map(e=>e.label).join(" \xB7 ")}import{jsx as Be}from"react/jsx-runtime";function na(){let{settings:t,websiteName:e}=It(),n=e?{...Qe,name:e}:Qe,a=t?{url:t.logoUrl,reversed:t.logoReversed??null,inkIsDark:t.logoInkIsDark??null,reverse:t.reverseLogo,size:t.logoSize,sizePx:t.logoSizePx}:null;return Be("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:Be(Mt,{children:Be(Wt,{preview:!0,children:Be(ut,{site:n,logo:a,preview:!0})})})})}export{na as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{si as t}from"./chunk-O5Q5ETQG.js";import"./chunk-C7MFEEPZ.js";import"./chunk-SEJFFUSI.js";import"./chunk-Y6SLVHK3.js";import{jsx as e}from"react/jsx-runtime";import{default as r}from"efficient-easel/screen/components/ScreenStoreProvider";function p(o){return e(r,{...o,parts:t})}export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as ct,j as me,r as dt,t as ft,u as pt,w as B}from"./chunk-KP37LMOP.js";import{Aa as pe,Ba as st,Ea as $e,Fa as lt,Ia as Be,Ja as We}from"./chunk-C7MFEEPZ.js";import{c as at,n as ut,p as oe}from"./chunk-SEJFFUSI.js";import{createContext as ln,useContext as un,useEffect as cn,useMemo as he,useState as ht}from"react";function mt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Ke=4,Pr=1,wr={unit:"set",spares:0,spareSide:"left"};function gt(e){return e.unit==="single"?1:Ke+e.spares}function _r(e,t){return[{partNumber:e.partNumber,wheels:gt(t),prices:e.prices}]}function Rr(e,t){let n=gt(t)-Ke;if(n<=0||e.length===0)return e;let r=an(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function an(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function sn(e,t){return t.spares>0?`${e} + spare`:e}function Nr(e){return e.unit==="single"?"Single":sn(`Set of ${Ke}`,e)}var Lr="data-add-to-basket",qe=9,Ne="en";function ge(e,t,n=0){return new Intl.NumberFormat(Ne,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function Ir(e,t){return new Intl.NumberFormat(Ne,{style:"currency",currency:t}).format(e)}import{jsx as mn}from"react/jsx-runtime";var dn="storefront-country",yt=dn,bt=ln(null);function fn(e){return Ct(e,"catalogue")}function pn(e){return Ct(e,"money")}function Ct(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let s=n.get(i)??0;a=new Intl.NumberFormat(Ne,{style:"currency",currency:i,minimumFractionDigits:t==="money"?s:0,maximumFractionDigits:s}),r.set(i,a)}return a.format(o)}}function Mr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=he(()=>t??[],[t]),a=he(()=>n??[],[n]),s=he(()=>r||i.find(y=>y.isDefault)?.code||i[0]?.code||"",[r,i]),c=he(()=>o||a.find(y=>y.isDefault)?.code||a[0]?.code||"",[o,a]),[u,f]=ht(c),[d,S]=ht(!1);cn(()=>{let y=oe.getItem(yt);y&&a.some(w=>w.code===y)&&f(y),S(!0)},[a]);function R(y){f(y),oe.setItem(yt,y)}let C=he(()=>{let y=a.find(v=>v.code===u)??null,w=y?.currency,O=w&&i.some(v=>v.code===w)?w:s,M=fn(i),L=pn(i);return{country:u,currency:O,setCountry:R,currencies:i,countries:a,activeCountry:y,formatPrice:(v,x)=>M(v,x??O),formatMoney:(v,x)=>L(v,x??O),ready:d}},[u,i,a,s,d]);return mn(bt.Provider,{value:C,children:e})}function xt(){let e=un(bt);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as Ln,useCallback as T,useContext as In,useEffect as j,useMemo as kt,useRef as ae,useState as k}from"react";function vt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Et="We'll confirm this discount when you place your order.",Hr="Confirmed at checkout";function $r(e){return e&&(e.valid||e.deferred)?e.code:void 0}var St="coupon_code: ";function Br(e){return!(e instanceof me)||e.status!==400||!e.message.startsWith(St)?null:e.message.slice(St.length)}function Pt(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Le="Price on request",hn="Request a quote",yn="from ",Gr="From ",zr="each",wt="Free";function Ge(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ze(e,t){let n=e?.[t];return Ge(n)?n:null}function Xr(e,t,n,r){let o=ze(e,n),i=ze(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Yr(e,t,n,r){if(n==null&&r==null)return!0;let o=ze(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var bn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function Cn(e,t,n){if(!Ge(e))return bn;let r=Ge(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Vr(e,t,n=""){return!e.priced||e.unit==null?Le:`${n}${ge(e.unit,t)}`}function jr(e,t){return e.was==null?null:ge(e.was,t)}function xn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,s)=>a+s.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Sn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Qr(e,t,n,r=1){let o=Cn(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=xn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Sn,fromSetTotal:i}}function vn(e,t){return!e.priced||e.unit==null?Le:`${e.isFrom?yn:""}${ge(e.unit,t)}`}function Zr(e,t){return e.was==null?null:ge(e.was,t)}function Jr(e,t){return!e.priced||e.unit==null?hn:vn(e,t)}var En=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function _t(e){return En.test(e.trim())}var Rt="sf:ga-purchases",Pn=20;function Lt(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(Lt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function wn(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ie(e.components,t)??0,quantity:e.qty}}function Xe(e,t){return e.filter(Ie).map(n=>wn(n,t))}function io(e){ye("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function It(e,t){let n=Xe([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function ao(e){let t=Xe(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var Nt=new Set;function _n(e){if(Nt.has(e))return!1;Nt.add(e);try{let t=JSON.parse(oe.getItem(Rt)??"[]");if(t.includes(e))return!1;oe.setItem(Rt,JSON.stringify([...t,e].slice(-Pn)))}catch{}return!0}function so(e){let t=e.confirmation;if(Lt()||!_n(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Xe(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Rn="Arranged after review",At="Calculated at checkout",Nn=At,co=At;function Tt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function fo(e){switch(e){case"arranged":return Rn;case"pending":return Nn;case"free":return wt;case"charged":return null}}import{jsx as On}from"react/jsx-runtime";var An=400,Tn=400,kn=1500;function Ie(e){return(e.components?.length??0)>0}function Ot(e,t){return{code:e,valid:t.valid,deferred:vt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Dt(e,t){return ie(e.components,t)}function Ye(e,t){let n=Dt(e,t);return n===null?null:n*e.qty}function Mt(e){return e!=="tyre"}var Ft=Ln(null);function Po({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=xt(),[i,a]=k(t),[s,c]=k([]),[u,f]=k([]),[d,S]=k([]),[R,C]=k(!1),[y,w]=k(!1),[O,M]=k(!1),[L,v]=k(!1),[x,W]=k(null),[I,K]=k(void 0),b=ae(r),_=ae("");b.current=b.current||r;let[p,q]=k(null),[Q,F]=k(!1),[D,ve]=k(null),G=ae(void 0),Y=T(()=>a(!0),[]),le=T(()=>a(!1),[]),Z=T(()=>a(l=>!l),[]);j(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&Y()},[Y,t]);let Ee=T(l=>{v(!0),Mt(l)&&M(!0)},[]),U=O||s.some(l=>Mt(l.kind)),Pe=L||s.length>0;j(()=>{if(t||!U||R)return;let l=!0;return B.listWheels().then(m=>{l&&(f(m),C(!0))}),()=>{l=!1}},[t,U,R]),j(()=>{if(t||!Pe||y)return;let l=!0;return B.listBundles().then(m=>{l&&(S(m),w(!0))}),()=>{l=!1}},[t,Pe,y]);let P=x?.deliveryOptions??[];j(()=>{P.length!==0&&ve(l=>l&&P.some(m=>m.id===l)?l:P[0]?.id??null)},[x]);let J=T(()=>s.filter(Ie).flatMap(l=>mt(l.components,l.qty)),[s]),ee=T(async(l,m)=>{let h=l.trim().toUpperCase();if(!h)return;let g=J();if(g.length===0){q({code:h,valid:!1,message:"Add a wheel to the cart first."});return}F(!0),G.current=m;try{let N=await B.validateCoupon({code:h,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:m});q(Ot(h,N))}catch{q({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{F(!1)}},[J,n,D]),ue=T(()=>{q(null),G.current=void 0},[]),ce=T(l=>{if(!p)return;let{code:m}=p;q(h=>h&&h.code===m?{code:m,valid:!1,refused:!0,message:l}:h)},[p]);j(()=>{if(!p||p.refused)return;let l=p.code,m=g=>g!==null&&g.code===l&&!g.refused,h=setTimeout(async()=>{let g=J();if(g.length===0){q(N=>m(N)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:N);return}F(!0);try{let N=await B.validateCoupon({code:l,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:G.current});q(fe=>m(fe)?Ot(l,N):fe)}catch{}finally{F(!1)}},An);return()=>clearTimeout(h)},[s,n,D]);let te=p&&!p.refused?p.code:void 0;j(()=>{if(t)return;let l=!0,m=setTimeout(async()=>{let h=J();if(h.length===0){W(null),K(void 0);return}try{let g=await B.quoteCart({items:h,currency:n,shippingMethodId:D??void 0,couponCode:te,customerEmail:G.current||void 0,country:b.current||void 0,subdivision:_.current||void 0});if(!l)return;W(g)}catch{if(!l)return}K(te)},Tn);return()=>{l=!1,clearTimeout(m)}},[s,n,D,te,r]);let de=T(l=>{c(m=>{let h=m.findIndex(g=>g.id===l.id);return h===-1?[...m,l]:m.map((g,N)=>N===h?{...g,qty:Math.min(qe,g.qty+l.qty)}:g)}),It(l,n)},[n]),ne=T(l=>{c(m=>m.filter(h=>h.id!==l))},[]),we=T((l,m)=>{let h=Math.max(1,Math.min(qe,m));c(g=>g.map(N=>N.id===l?{...N,qty:h}:N))},[]),_e=T(l=>{c(l)},[]),[E,H]=k(null),V=ae(null);V.current=E;let $=ae(null),Fe=ae(""),tt=T((l,m)=>{let h=l.trim().toLowerCase();_t(h)&&H(g=>g&&g.email===h&&g.firstName===(m??"")?g:{email:h,firstName:m??""})},[]);j(()=>{if(t||!E)return;let l=Pt(s.filter(Ie),g=>Ye(g,n)===null?Le:o(Ye(g,n),n)),m={email:E.email,firstName:E.firstName,currency:n,items:l},h=JSON.stringify(m);if(h!==Fe.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Fe.current=h,B.captureCart(m).catch(g=>{})},kn),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[s,E,n,t]);let nt=T(()=>{$.current&&(clearTimeout($.current),$.current=null);let l=V.current;l&&(Fe.current="",B.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(m=>{}))},[n]),rt=kt(()=>{let l=s.reduce((A,re)=>{let Re=Ye(re,n);return Re===null?A:A+Re},0),m=s.some(A=>Dt(A,n)===null),h=s.reduce((A,re)=>A+re.qty,0),g=p?.valid?p.effects:void 0,N=g?Math.min(l,Number(g.discountAmount)):0,fe=x?.bundleDiscount??0,en=x?.appliedBundles??[],Ue=!!g?.freeShipping,ot=P.find(A=>A.id===D),it=Ue?0:x?.shipping??ot?.amount??0,tn=Tt({quoted:x!==null,optionCount:P.length,chosenAmount:ot?.amount,couponWaivesFreight:Ue}),He={};for(let A of g?.freeUnits??[])He[A.partNumber]=(He[A.partNumber]??0)+A.quantity;let nn=x?.tax??null,rn=x?x.grandTotal:l-N-fe+it;return{sets:h,units:s.reduce((A,re)=>A+(re.components??[]).reduce((Re,on)=>Re+on.wheels*re.qty,0),0),subtotal:l,hasUnpricedLine:m,discount:N,bundleDiscount:fe,appliedBundles:en,shipping:it,freeShipping:Ue,shippingStatus:tn,freeUnitsByPartNumber:He,tax:nn,grand:rn,repricing:!!p?.refused&&x!==null&&I===p?.code,currency:n}},[s,n,p,P,D,x,I]),Jt=kt(()=>({isOpen:i,preview:t,open:Y,close:le,toggle:Z,items:s,catalog:u,bundles:d,warmCatalog:Ee,add:de,remove:ne,setQty:we,replaceItems:_e,identify:tt,clearCapturedCart:nt,coupon:p,applyCoupon:ee,removeCoupon:ue,refuseCoupon:ce,couponBusy:Q,deliveryOptions:P,shippingMethodId:D,setShippingMethodId:ve,totals:rt}),[i,t,Y,le,Z,s,u,d,Ee,de,ne,we,_e,tt,nt,p,ee,ue,ce,Q,P,D,rt]);return On(Ft.Provider,{value:Jt,children:e})}function Ut(){let e=In(Ft);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as Gn}from"react";function Ht(e,t,n,r){for(;e.size>=t;){let o,i;for(let[s,c]of e){if(c.expiresAt<=r){o=s;break}i===void 0&&n(s)&&(i=s)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Mn=6e4,Dn=5e3,Fn=500,Ae=new Map;async function Un(e){let{host:t,matchesRequestHost:n}=await dt();if(!t)return"";let r=await ft();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Hn=e=>e.includes("|slug:")||e.includes("|xhost:");async function $t(e,t){if(await pt()!==null)return t();let n=await Un(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",s=a?Dn:Mn,c=Ae.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,f=a&&u?u:i;return Ht(Ae,Fn,Hn,r),Ae.set(n,{load:f,expiresAt:r+s,lastGood:u}),f}var $n=404;function Bn(e){if(e instanceof me&&e.status===$n)return{state:"absent"};let t=e instanceof me?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Wn="[storefront:chrome-load-failed]";function Kn(e,t){console.error(`${Wn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Bt(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=Bn(o);return i.state==="failed"&&Kn(e,i),{value:n,outcome:i}}}function qn(e){return e==="production"?"silent":"banner"}var To=qn("production");function zn(e,t){return e?.trim()||t}function $o({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=zn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Xn={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,mapsApiKey:null,mapsMapId:null,socialLinks:$e},Bo=Gn(async()=>$t("site",()=>Bt("site",async()=>{let e=await B.getSite();return{name:st(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:lt(e.socialLinks)}},Xn)));var Wo={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,mapsApiKey:null,mapsMapId:null,socialLinks:$e};import{jsx as Ce,jsxs as Ve}from"react/jsx-runtime";import{useEffect as Te,useId as jn,useRef as Kt,useState as ke}from"react";var be=new Map,Yn=64;async function Vn(e){if(!at())return null;try{let t=await fetch(`${ut()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function Wt(e){let t=be.get(e);if(t)return t;let n=Vn(e);if(be.set(e,n),be.size>Yn){let r=be.keys().next();r.done||be.delete(r.value)}return n}var Qn=202/22,Zn=.88,ri=16,Jn="invert(1)";function oi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:s,size:c="medium",sizePx:u,wordmark:f,siteName:d=pe,fitToContainer:S=!1,fitWordmarkToContainer:R=!1,fitFloorPx:C}){let y=f&&f.trim()?f.trim():d,[w,O]=ke(!1),M=Kt(null),L=E=>{M.current=E};Te(()=>{let E=M.current?.ownerDocument??document,H=()=>{O(E.documentElement.getAttribute("data-theme")==="light")};H();let V=new MutationObserver(H);return V.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>V.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&ct(v),W=i??(w&&t),I=o&&o.trim()?o.trim():null,K=r&&!I,b=`logo-color-${jn().replace(/[^A-Za-z0-9_-]/g,"")}`,_=K&&x&&v&&a!=null?{reversed:a,inkIsDark:s??null}:null,p=_!==null,[q,Q]=ke(null);Te(()=>{if(!K||!v||!x||p){Q(null);return}let E=!1;return Q(null),Wt(v).then(H=>{E||Q(H)}),()=>{E=!0}},[K,v,x,p]);let F=_??q,D=!!F&&F.inkIsDark!==null&&(W?!F.inkIsDark:F.inkIsDark),ve=K&&!!v&&!x&&!W,G=D&&F?F.reversed:v,Y=G?[G]:[],[le,Z]=ke(0);Te(()=>{Z(0)},[v,D]);let Ee=e==="footer"?We:Be[c],U=u&&u>0?u:Ee,Pe=Math.round(U*Qn),P=le<Y.length?Y[le]:null,[J,ee]=ke(G),ue=P!==null&&P===J,ce=Kt(null);Te(()=>{let E=ce.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(P);return}let H=!1;return E.decode().then(()=>!H&&ee(P),()=>!H&&Z(V=>V+1)),()=>{H=!0}},[P]);let te=S||R,de=`calc(100cqi / ${((y.length+1)*Zn).toFixed(2)})`,ne=te&&C&&C>0?Math.min(C,U):null,we=te?ne===null?`min(${U}px, ${de})`:`clamp(${ne}px, ${de}, ${U}px)`:`${U}px`,_e=Ve("span",{className:`font-display font-bold tracking-[0.18em] ${ne===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:we,lineHeight:1,...I?{color:I}:{}},"aria-label":y,children:[y,Ce("span",{className:"text-accent",style:I?{color:I}:void 0,children:"."})]});return Ve("span",{ref:L,className:"inline-flex items-center",children:[!ue&&_e,I&&P&&Ce("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Ve("filter",{id:b,colorInterpolationFilters:"sRGB",children:[Ce("feFlood",{style:{floodColor:I}}),Ce("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),P&&Ce("img",{ref:ce,src:P,alt:y,width:Pe,height:U,className:"shrink-0 object-contain",style:{...ue?{height:`${U}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...ve?{filter:Jn}:{},...I?{filter:`url(#${b})`}:{}},onLoad:()=>ee(P),onError:()=>Z(E=>E+1)},P)]})}import{jsx as xe,jsxs as tr}from"react/jsx-runtime";function er({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,s=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(s.push({x1:a(100+Math.cos(u)*22),y1:a(100+Math.sin(u)*22),x2:a(100+Math.cos(u)*86),y2:a(100+Math.sin(u)*86),main:!0}),t){let f=u+Math.PI/e;s.push({x1:a(100+Math.cos(f)*22*1.4),y1:a(100+Math.sin(f)*22*1.4),x2:a(100+Math.cos(f)*78),y2:a(100+Math.sin(f)*78),main:!1})}}return tr("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[xe("circle",{cx:100,cy:100,r:92,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),xe("circle",{cx:100,cy:100,r:22,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),s.map((c,u)=>xe("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var li="#c9a461",qt=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],ui={name:"",color:"var(--fg)",family:"silver",src:""};function nr(e,t){let n=r=>{let o=qt.findIndex(i=>i.f===r);return o===-1?qt.length:o};return n(e)-n(t)||e.localeCompare(t)}function ci(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(nr)}import{useState as rr}from"react";import{jsx as se,jsxs as je}from"react/jsx-runtime";function or({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Ut(),[i,a]=rr("");async function s(){o||!i.trim()||(await n(i,e),a(""))}return je("div",{className:"flex flex-col gap-2",children:[t===null?je("div",{className:"flex border border-line",children:[se("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),s())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),se("button",{type:"button",onClick:()=>{s()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[se("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),se("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Et}):t&&!t.valid&&t.message&&se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var Qe="Ads on. Shopper can opt out.",Oe="Ads and analytics off until Accept",ir={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:Qe,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Oe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:Qe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:Qe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function ar(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function yi(e,t,n){let r=ar(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var bi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var sr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var lr=sr;function vi(e=lr){if(e.asked)return e.ads?"granted":"denied"}function Pi(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as cr,isValidElement as dr,useEffect as zt,useId as fr,useLayoutEffect as Vt,useRef as z,useState as Xt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Ze(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function Je(e,t){return Ze(e,t===1?-1:e.length,t)}function et(e,t){return Me(e,t)?t:Math.max(Je(e,1),0)}function Gt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),s=n.findIndex((c,u)=>Me(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:s>=0?s:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:Ze(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ze(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:Je(n,1)}),handled:!0};case"End":return{state:i({focus:Je(n,-1)}),handled:!0};case"Enter":case" ":return Me(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as pr}from"efficient-shell/ui";import{Fragment as Cr,jsx as X,jsxs as jt}from"react/jsx-runtime";var Yt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function mr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,s]=Xt(!1),c=r!==void 0,u=c?r:a,[f,d]=Xt(0),S=z({text:"",timer:0}),R=z(null),C=z(null),y=z(null),w=fr(),O=z(null),M=e.findIndex(b=>b.value===t),L=b=>{b!==u&&(c||s(b),b?o?.():i?.())},v=b=>{let _=e[b];!_||_.disabled||(n(_.value),L(!1),C.current?.focus())},x=b=>{let _={open:u,focus:u?f:et(e,M),typed:S.current.text},p=Gt(_,b,e);return!p.handled&&p.state.open===u?!1:(p.state.typed!==_.typed&&(S.current.text=p.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(p.state.focus),p.commit!==void 0?v(p.commit):L(p.state.open),p.refocus&&C.current?.focus(),p.handled)},W=z(x);W.current=x;let I=z(()=>L(!1));I.current=()=>L(!1);let K=b=>{u||(O.current=b.nativeEvent,W.current(b.key)&&b.preventDefault())};return zt(()=>{if(!u)return;let b=p=>{R.current?.contains(p.target)||I.current()},_=p=>{p!==O.current&&W.current(p.key)&&p.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",_)}},[u]),zt(()=>{u&&(S.current.text||d(et(e,M)))},[u]),Vt(()=>{if(!u||!y.current)return;y.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,u]),{open:u,toggle:()=>L(!u),close:()=>L(!1),focusIdx:f,setFocusIdx:d,pick:b=>v(e.findIndex(_=>_.value===b)),wrapRef:R,triggerRef:C,listRef:y,listId:w,onTriggerKeyDown:K,activeId:u?`${w}-${f}`:void 0}}var gr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Yt.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Yt.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function hr(e,t){Vt(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let a=n.offsetParent??n.parentElement;if(!a)return;let s=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-s.right)<Math.abs(c.left-s.left)?"end":"start",f=pr({trigger:{left:s.left,right:s.right,top:s.top,bottom:s.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=f.top+Math.min(c.height,f.maxHeight);i.marginBottom=`${Math.max(0,s.top-S)}px`}f.maxHeight<c.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let d=f.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function yr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:s,ariaLabel:c}){let u=gr[t],f=z(null);return hr(f,n.length),X("ul",{ref:d=>{f.current=d,s&&(s.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let R=d.value===r;return X("li",{id:`${e}-${S}`,role:"option","aria-selected":R,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,R&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(R),children:d.meta===void 0?d.label:jt(Cr,{children:[d.lead,X("span",{className:"flex-1 whitespace-nowrap",children:d.label}),X("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function br({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:s,"aria-label":c}){let u=cr.toArray(r).flatMap(C=>{if(!dr(C))return[];if(C.type!=="option")return[];let w=C.props,O=w.value!==void 0?String(w.value):"",M=w.children,L=typeof M=="string"||typeof M=="number"?String(M):O;return[{value:O,label:L,disabled:!!w.disabled}]}),f=e??"",d=mr({items:u,value:f,onPick:C=>t?.({target:{value:C}})}),R=u.find(C=>C.value===f)?.label??u[0]?.label??"";return jt("div",{ref:d.wrapRef,className:"relative",children:[a&&X("input",{type:"hidden",name:a,value:f}),X("button",{ref:C=>{d.triggerRef.current=C},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:s,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:X("span",{className:"block w-full truncate text-left",children:R})}),d.open&&X(yr,{id:d.listId,tone:"select",items:u,value:f,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as Se,jsxs as De}from"react/jsx-runtime";var xr="font-mono text-[length:var(--size-label,12px)]",Sr="font-semibold uppercase tracking-[0.22em] text-fg";function Qt(e){return`${e??xr} ${Sr}`}function Zt(){return Se("span",{className:"text-accent",children:" *"})}function vr({children:e,required:t,labelFace:n}){return De("span",{className:Qt(n),children:[e,t?Se(Zt,{}):null]})}function Er({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:s}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?Se("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:Qt(i),children:[e,t?Se(Zt,{}):null]}),s,u]}):De("label",{htmlFor:o,className:c,children:[Se(vr,{required:t,labelFace:i,children:e}),s]})}export{Hr as a,$r as b,Br as c,mt as d,Ke as e,Pr as f,wr as g,_r as h,Rr as i,an as j,sn as k,Nr as l,Lr as m,qe as n,Ne as o,ge as p,Ir as q,Le as r,hn as s,yn as t,Gr as u,zr as v,wt as w,ze as x,Xr as y,Yr as z,Cn as A,Vr as B,jr as C,xn as D,Qr as E,vn as F,Zr as G,Jr as H,_t as I,io as J,ao as K,so as L,co as M,fo as N,Mr as O,xt as P,Ie as Q,Ye as R,Po as S,Ut as T,$o as U,Xn as V,Wo as W,ri as X,oi as Y,er as Z,li as _,qt as $,ui as aa,nr as ba,ci as ca,or as da,ir as ea,yi as fa,bi as ga,sr as ha,vi as ia,Pi as ja,mr as ka,yr as la,br as ma,vr as na,Er as oa};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as we}from"react/jsx-runtime";import{createContext as tn,useCallback as i,useContext as nn,useMemo as an,useState as Ae}from"react";import{createContext as le,useContext as x}from"react";import{createContext as mt}from"react";var ie=mt(null);var St=le(null),O=le({logo:null,placeholder:!1,wordmark:null});function bn(){let e=x(ie),t=x(St),n=x(O),a=!e&&n.placeholder,o=e?e.logoUrl:n.logo?.logoUrl??t?.logoUrl??null;return{src:a?null:o,reversedSrc:e?e.logoReversed:n.logo?.logoReversed??t?.logoReversed??null,inkIsDark:e?e.logoInkIsDark:n.logo?.logoInkIsDark??t?.logoInkIsDark??null,wordmark:e?null:n.wordmark,siteName:e?.siteName??t?.siteName}}import{useSelectHandler as on}from"efficient-easel/draw/client";var wn="storefront-theme",An="sf:theme-mode",Ln="sf:theme-switch",Cn="hide",v="light";function pt(e){return e>=7&&e<18}function kn(e){let{mode:t,override:n,switchShown:a,hour:o}=e;return a&&(n==="light"||n==="dark")?n:t==="auto"?pt(o)?"light":"dark":t==="light"?"light":"dark"}var h={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},_t=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],k={selected:0,themes:_t};function ce(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...k}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function M(e,t,n){let a=C(e),o=C(t);if(a===null||o===null)return e;let l=r=>Math.max(0,Math.min(255,Math.round(r))).toString(16).padStart(2,"0");return`#${a.map((r,u)=>l(r+(o[u]-r)*n)).join("")}`}var yt={light:"#ffffff",dark:"#0a0a0a"},In=["light","dark"];function Hn(e,t){let n=yt[t],a=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:M(e,a,.1),line:M(e,a,.22),muted:M(n,e,.35),brandInk:t}}function E(e){let t=ce(e);return t.themes[t.selected]}function ue(e){return{text:e.text,accent:e.accent,background:e.background||h.background,surface:e.surface||h.surface,line:e.line||h.line,muted:e.muted||h.muted}}function C(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1].length===3?[...t[1]].map(r=>r+r).join(""):t[1],[a,o,l]=[0,2,4].map(r=>parseInt(n.slice(r,r+2),16));return[a,o,l]}function N(e){let t=C(e);if(t===null)return null;let[n,a,o]=t.map(l=>{let r=l/255;return r<=.04045?r/12.92:((r+.055)/1.055)**2.4});return .2126*n+.7152*a+.0722*o}var Et=.4,bt=4.5,Tt=3;function wt(e,t){let n=N(e),a=N(t);if(n===null||a===null)return null;let[o,l]=n>=a?[n,a]:[a,n];return(o+.05)/(l+.05)}var Rn={good:"Good","large-only":"Large text only",hard:"Hard to read"};function xn(e){return e>=bt?"good":e>=Tt?"large-only":"hard"}var D=["#000000","#ffffff"];function I(e){let t=D[0],n=-1;for(let a of D){let o=wt(e,a);if(o===null)return D[0];o>n&&(n=o,t=a)}return t}var At=[.25,.4,.55];function On(e){let t=C(e);return t===null?[]:At.map(n=>"#"+t.map(a=>Math.round(a*(1-n)).toString(16).padStart(2,"0")).join(""))}function Mn(e){let t=E(e),n={"--theme-fg":t.text},a=N(t.text);return(a===null||a>=Et)&&(n["--overlay-fg"]=t.text),n}var Lt=82;function G(e){return`color-mix(in srgb, ${e} ${Lt}%, #000)`}function Dn(e){let t=E(e);return{"--theme-accent":t.accent,"--theme-accent-2":G(t.accent),"--theme-accent-ink":I(t.accent)}}function U(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Pn(e){let t=E(e),n=U(t),a=de(t);if(n===null&&a===null)return{};let o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=G(n)),o["--theme-btn-ink"]=a??I(n),o}function de(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Ct(e,t){return de(e)??I(U(e)??t)}function Fn(e){let t=E(e);return{fill:U(t)??t.accent.toLowerCase(),ink:Ct(t,t.accent)}}function Nn(e){let t={};return ce(e).themes.forEach((n,a)=>{let o=ue(n);t[`--theme-preset-${a}-accent`]=o.accent,t[`--theme-preset-${a}-accent-2`]=G(o.accent),t[`--theme-preset-${a}-accent-ink`]=I(o.accent),t[`--theme-preset-${a}-bg`]=o.background,t[`--theme-preset-${a}-fg`]=o.text,t[`--theme-preset-${a}-surface`]=o.surface,t[`--theme-preset-${a}-surface-2`]=`color-mix(in srgb, ${o.surface} 60%, ${o.line})`,t[`--theme-preset-${a}-line`]=o.line,t[`--theme-preset-${a}-muted`]=o.muted}),t}var vn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Gn(e){let t=ue(E(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,a={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==h.surface||t.line!==h.line)&&(a["--theme-surface-2"]=n),a}var kt=["heading","body","label"];function Un(e){if(!e)return null;for(let t of kt)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var he=["headingLarge","headingMedium","headingSmall","accent","body","label"];var B={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},It=8,Ht=200;function Rt(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=It&&t<=Ht?t:null}function xt(e){let t={};for(let n of he)t[n]=Rt(e?.[n]);return t}function Bn(e){let t=xt(e),n={};for(let a of he){let o=t[a];o!==null&&(n[`--size-${a}`]=`${o}px`)}return n}var Ot=["square","small","large"],Mt="small";function zn(e){return Ot.includes(e??"")?e:Mt}var ge=0,Dt=40,$n={square:0,small:null,large:16},Pt={"--sf-card-radius":1,"--sf-button-radius":.5,"--site-radius":.5,"--site-radius-xs":.25,"--site-radius-sm":.5,"--site-radius-md":.75,"--site-radius-lg":1,"--site-radius-xl":1.25,"--site-radius-2xl":1.5,"--site-radius-3xl":2,"--site-radius-4xl":2.5};function fe(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(Dt,Math.max(ge,Math.round(t))):null}function Ft(e){let t=fe(e);return t===null?{}:Object.fromEntries(Object.entries(Pt).map(([n,a])=>{let o=t*a/16;return[n,o===0?"0":`${o}rem`]}))}function Vn(e){return Ft(fe(e)??ge)}var Nt=["none","soft","lifted"],vt="soft",me="none",Gt=["tight","normal","roomy"],Ut="normal",H="normal",Bt=["none","lift","highlight"],zt="lift",$t="highlight",Se="#141416";function pe(e){return Nt.includes(e??"")?e:vt}function Vt(e){return Gt.includes(e??"")?e:Ut}function _e(e){return Bt.includes(e??"")?e:zt}function Wt(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():Se}function Wn(e){let t=pe(e);return t===me?void 0:t}function Yn(e){let t=Vt(e);return t===H?void 0:t}function Xn(e){let t=_e(e);return t===$t?void 0:t}function qn(e,t,n){let a=Wt(t);return a===Se?{}:pe(e)!==me||_e(n)==="lift"?{"--sf-shadow-color":a}:{}}var Yt=["normal","tight","compressed"],b="normal";function ye(e){return Yt.includes(e??"")?e:b}function jn(e){let t=ye(e);return t===b?void 0:t}function Kn(e){switch(ye(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}var z={case:"authored",weight:null,weightStrong:null,italicStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},P=100,F=900,Xt=24,qt=200;function L(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function Ee(e){let t=L(e?.weight,P,F),n=e?.case==="sentence"?"sentence":"authored",a=l=>l==null?t:L(l,P,F),o=l=>l==="sentence"?"sentence":l==="authored"?"authored":n;return{case:n,weight:t,weightStrong:L(e?.weightStrong,P,F),italicStrong:typeof e?.italicStrong=="boolean"?e.italicStrong:null,maxPx:L(e?.maxPx,Xt,qt),weight2:a(e?.weight2),weight3:a(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function Zn(e){let t=Ee(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function Jn(e){return Ee({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,italicStrong:e?.accent_italic,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}var be=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"assistant",label:"Assistant",cssVar:"--font-assistant",category:"sans",italic:!1,italicLoaded:!1},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],f=new Map(be.map(e=>[e.key,e]));function ea(e){return f.get(e)}var Te=["heading","heading2","heading3","body","accent","label"],ta={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},jt=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],Kt=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,na={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},Zt={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function aa(e){let t=e?Kt.exec(e):null;return t?Zt[t[1]]??null:Jt(e)}function Jt(e){if(!e)return null;let t=e.split(/\s+/).filter(n=>!n.slice(0,n.lastIndexOf(":")+1).includes("&")).map(n=>n.slice(n.lastIndexOf(":")+1));for(let[n,a]of jt)if(t.includes(n))return a;return null}var d={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function Qt(e){let t=n=>{let a=e?.[n];if(a&&f.has(a))return a;if(n==="heading2"||n==="heading3"){let o=e?.heading;return o&&f.has(o)?o:d.heading}return d[n]};return Object.fromEntries(Te.map(n=>[n,t(n)]))}function en(e,t){return f.get(e[t])??f.get(d[t])}function g(e,t){return`var(${en(e,t).cssVar})`}var oa=[...new Set(Te.map(e=>f.get(d[e]).cssVar))],sa=[...new Set(be.map(e=>e.cssVar))];function ra(e){let t=Qt(e);return{"--font-role-heading":g(t,"heading"),"--font-role-heading2":g(t,"heading2"),"--font-role-heading3":g(t,"heading3"),"--font-role-body":g(t,"body"),"--font-role-accent":g(t,"accent"),"--font-role-label":g(t,"label"),fontFamily:"var(--font-role-body)"}}var Ce=tn({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:v,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:k,setTheme:()=>{},fonts:d,setFonts:()=>{},sizes:B,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:H,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:b,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:z,setHeadingTypography:()=>{},textStyles:null,setTextStyles:()=>{},wordStyles:null,heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},shareButtonOnPosts:null,setShareButtonOnPosts:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function fa({children:e,websiteName:t=null,templateChrome:n=!1,templateName:a=null,chromePlaceholder:o=!1,themeMode:l=v,onThemeModeChange:r,themeSwitchShown:u=!1,onThemeSwitchShownChange:T,theme:w=k,onThemeChange:m,fonts:S=d,onFontsChange:p,sizes:_=B,onSizesChange:c,cornerRadiusPx:R=null,onCornerRadiusPxChange:A,cardShadow:Ie=null,onCardShadowChange:$,shadowColor:He=null,onShadowColorChange:V,cardGap:Re=H,onCardGapChange:W,hoverEffect:xe=null,onHoverEffectChange:Y,headingCompression:Oe=b,onHeadingCompressionChange:X,siteWidth:Me=null,onSiteWidthChange:q,siteGutter:De=null,blockGap:Pe=null,onSiteGutterChange:j,onBlockGapChange:K,headingTypography:Fe=z,onHeadingTypographyChange:Z,textStyles:Ne=null,onTextStylesChange:J,wordStyles:ve=null,heroBackgroundFollowsWidth:Ge=null,onHeroBackgroundFollowsWidthChange:Q,photographyGrayscale:Ue=null,onPhotographyGrayscaleChange:ee,shareButtonOnPosts:Be=null,onShareButtonOnPostsChange:te,themeFromDocument:ze=!1}){let[y,ne]=Ae(null),$e=i(s=>ne(ft=>ft??s),[]),[Ve,We]=Ae(!1),Ye=i(s=>r?.(s),[r]),Xe=i(s=>T?.(s),[T]),qe=i(s=>m?.(s),[m]),je=i(s=>p?.(s),[p]),Ke=i(s=>c?.(s),[c]),Ze=i(s=>q?.(s),[q]),Je=i(s=>j?.(s),[j]),Qe=i(s=>K?.(s),[K]),et=i(s=>Q?.(s),[Q]),tt=i(s=>ee?.(s),[ee]),nt=i(s=>te?.(s),[te]),at=i(s=>A?.(s),[A]),ot=i(s=>$?.(s),[$]),st=i(s=>V?.(s),[V]),rt=i(s=>W?.(s),[W]),it=i(s=>Y?.(s),[Y]),lt=i(s=>X?.(s),[X]),ct=i(s=>Z?.(s),[Z]),ut=i(s=>J?.(s),[J]),{select:dt,setSelectHandler:ht}=on(),ae=y?.logoUrl,oe=y?.logoReversed,se=y?.logoInkIsDark,re=y!==null,gt=an(()=>({logo:re?{logoUrl:ae,logoReversed:oe,logoInkIsDark:se}:null,placeholder:n||o,wordmark:n?a:t}),[re,ae,oe,se,n,o,a,t]);return we(O.Provider,{value:gt,children:we(Ce.Provider,{value:{settings:y,setSettings:ne,primeSettings:$e,websiteName:t,templateChrome:n,templateName:a,chromePlaceholder:o,themeMode:l,setThemeMode:Ye,themeSwitchShown:u,setThemeSwitchShown:Xe,theme:w,setTheme:qe,fonts:S,setFonts:je,sizes:_,setSizes:Ke,cornerRadiusPx:R,setCornerRadiusPx:at,cardShadow:Ie,setCardShadow:ot,shadowColor:He,setShadowColor:st,cardGap:Re,setCardGap:rt,hoverEffect:xe,setHoverEffect:it,headingCompression:Oe,setHeadingCompression:lt,siteWidth:Me,setSiteWidth:Ze,siteGutter:De,blockGap:Pe,setSiteGutter:Je,setBlockGap:Qe,headingTypography:Fe,setHeadingTypography:ct,textStyles:Ne,setTextStyles:ut,wordStyles:ve,heroBackgroundFollowsWidth:Ge,setHeroBackgroundFollowsWidth:et,photographyGrayscale:Ue,setPhotographyGrayscale:tt,shareButtonOnPosts:Be,setShareButtonOnPosts:nt,themeFromDocument:ze,selected:Ve,setSelected:We,select:dt,setSelectHandler:ht},children:e})})}var ma=()=>nn(Ce);import{forwardRef as sn}from"react";import{jsx as cn}from"react/jsx-runtime";var rn={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"},ln=sn(function({src:t,width:n,height:a,fill:o,priority:l,loading:r,style:u,quality:T,placeholder:w,blurDataURL:m,unoptimized:S,loader:p,overrideSrc:_,...c},R){let A=_??(typeof t=="string"?t:t.src);return cn("img",{ref:R,src:A,width:o?void 0:n,height:o?void 0:a,loading:l?"eager":r??"lazy",fetchPriority:l?"high":void 0,decoding:"async",style:o?{...rn,...u}:{color:"transparent",...u},...c})}),_a=ln;function ya(e){return{props:{src:e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),sizes:e.sizes}}}import{forwardRef as un}from"react";import{jsx as gn}from"react/jsx-runtime";function dn(e){if(typeof e=="string")return e;let t=e.query?`?${new URLSearchParams(e.query).toString()}`:"",n=e.hash?e.hash.startsWith("#")?e.hash:`#${e.hash}`:"";return`${e.pathname??""}${t}${n}`}var hn=un(function({href:t,prefetch:n,replace:a,scroll:o,shallow:l,legacyBehavior:r,passHref:u,locale:T,onClick:w,children:m,...S},p){let _=c=>{w?.(c),!(c.defaultPrevented||S.target==="_blank")&&c.preventDefault()};return gn("a",{ref:p,href:dn(t),onClick:_,...S,children:m})}),wa=hn;var fn="Storefront";function Ca(e){return e?.trim()||fn}var ke=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp","telegram","line","wechat"],mn={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp",telegram:"Telegram",line:"LINE",wechat:"WeChat"},Sn={};function Ia(e){if(!e||typeof e!="object")return Sn;let t={};for(let n of ke){let a=e[n];if(typeof a!="string")continue;let o=a.trim();!o||!/^https?:\/\//i.test(o)||(t[n]=o)}return t}function Ha(e){return ke.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:mn[t]}]:[]})}var Ra=e=>`${e}_url`;export{_a as a,ya as b,wa as c,be as d,ea as e,Te as f,ta as g,na as h,aa as i,Jt as j,d as k,Qt as l,ra as m,wn as n,An as o,Ln as p,Cn as q,v as r,kn as s,h as t,_t as u,ce as v,In as w,Hn as x,E as y,ue as z,wt as A,Rn as B,xn as C,I as D,On as E,Mn as F,Dn as G,U as H,Pn as I,de as J,Ct as K,Fn as L,Nn as M,vn as N,Gn as O,Un as P,B as Q,xt as R,Bn as S,zn as T,ge as U,Dt as V,$n as W,fe as X,Ft as Y,Vn as Z,Nt as _,vt as $,me as aa,H as ba,Bt as ca,zt as da,$t as ea,Se as fa,pe as ga,Vt as ha,_e as ia,Wt as ja,Wn as ka,Yn as la,Xn as ma,qn as na,b as oa,ye as pa,jn as qa,Kn as ra,z as sa,Ee as ta,Zn as ua,Jn as va,ie as wa,bn as xa,fa as ya,ma as za,fn as Aa,Ca as Ba,ke as Ca,mn as Da,Sn as Ea,Ia as Fa,Ha as Ga,Ra as Ha};
|
|
1
|
+
import{jsx as Ae}from"react/jsx-runtime";import{createContext as tn,useCallback as i,useContext as nn,useMemo as an,useState as we}from"react";import{createContext as le,useContext as R}from"react";import{createContext as mt}from"react";var ie=mt(null);var St=le(null),x=le({logo:null,placeholder:!1,wordmark:null});function Tn(){let e=R(ie),t=R(St),n=R(x),a=!e&&n.placeholder,o=e?e.logoUrl:n.logo?.logoUrl??t?.logoUrl??null;return{src:a?null:o,reversedSrc:e?e.logoReversed:n.logo?.logoReversed??t?.logoReversed??null,inkIsDark:e?e.logoInkIsDark:n.logo?.logoInkIsDark??t?.logoInkIsDark??null,wordmark:e?null:n.wordmark,siteName:e?.siteName??t?.siteName}}import{useSelectHandler as on}from"efficient-easel/draw/client";var wn="storefront-theme",Ln="sf:theme-mode",Cn="sf:theme-switch",kn="hide",G="light";function pt(e){return e>=7&&e<18}function In(e){let{mode:t,override:n,switchShown:a,hour:o}=e;return a&&(n==="light"||n==="dark")?n:t==="auto"?pt(o)?"light":"dark":t==="light"?"light":"dark"}var h={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},_t=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],k={selected:0,themes:_t};function ce(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...k}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function M(e,t,n){let a=C(e),o=C(t);if(a===null||o===null)return e;let l=r=>Math.max(0,Math.min(255,Math.round(r))).toString(16).padStart(2,"0");return`#${a.map((r,u)=>l(r+(o[u]-r)*n)).join("")}`}var Et={light:"#ffffff",dark:"#0a0a0a"},On=["light","dark"];function Hn(e,t){let n=Et[t],a=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:M(e,a,.1),line:M(e,a,.22),muted:M(n,e,.35),brandInk:t}}function y(e){let t=ce(e);return t.themes[t.selected]}function ue(e){return{text:e.text,accent:e.accent,background:e.background||h.background,surface:e.surface||h.surface,line:e.line||h.line,muted:e.muted||h.muted}}function C(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1].length===3?[...t[1]].map(r=>r+r).join(""):t[1],[a,o,l]=[0,2,4].map(r=>parseInt(n.slice(r,r+2),16));return[a,o,l]}function N(e){let t=C(e);if(t===null)return null;let[n,a,o]=t.map(l=>{let r=l/255;return r<=.04045?r/12.92:((r+.055)/1.055)**2.4});return .2126*n+.7152*a+.0722*o}var yt=.4,bt=4.5,Tt=3;function At(e,t){let n=N(e),a=N(t);if(n===null||a===null)return null;let[o,l]=n>=a?[n,a]:[a,n];return(o+.05)/(l+.05)}var Rn={good:"Good","large-only":"Large text only",hard:"Hard to read"};function xn(e){return e>=bt?"good":e>=Tt?"large-only":"hard"}var P=["#000000","#ffffff"];function I(e){let t=P[0],n=-1;for(let a of P){let o=At(e,a);if(o===null)return P[0];o>n&&(n=o,t=a)}return t}var wt=[.25,.4,.55];function Mn(e){let t=C(e);return t===null?[]:wt.map(n=>"#"+t.map(a=>Math.round(a*(1-n)).toString(16).padStart(2,"0")).join(""))}function Pn(e){let t=y(e),n={"--theme-fg":t.text},a=N(t.text);return(a===null||a>=yt)&&(n["--overlay-fg"]=t.text),n}var Lt=82;function v(e){return`color-mix(in srgb, ${e} ${Lt}%, #000)`}function Dn(e){let t=y(e);return{"--theme-accent":t.accent,"--theme-accent-2":v(t.accent),"--theme-accent-ink":I(t.accent)}}function U(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Fn(e){let t=y(e),n=U(t),a=de(t);if(n===null&&a===null)return{};let o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=v(n)),o["--theme-btn-ink"]=a??I(n),o}function de(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Ct(e,t){return de(e)??I(U(e)??t)}function Nn(e){let t=y(e);return{fill:U(t)??t.accent.toLowerCase(),ink:Ct(t,t.accent)}}function Gn(e){let t={};return ce(e).themes.forEach((n,a)=>{let o=ue(n);t[`--theme-preset-${a}-accent`]=o.accent,t[`--theme-preset-${a}-accent-2`]=v(o.accent),t[`--theme-preset-${a}-accent-ink`]=I(o.accent),t[`--theme-preset-${a}-bg`]=o.background,t[`--theme-preset-${a}-fg`]=o.text,t[`--theme-preset-${a}-surface`]=o.surface,t[`--theme-preset-${a}-surface-2`]=`color-mix(in srgb, ${o.surface} 60%, ${o.line})`,t[`--theme-preset-${a}-line`]=o.line,t[`--theme-preset-${a}-muted`]=o.muted}),t}var vn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Un(e){let t=ue(y(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,a={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==h.surface||t.line!==h.line)&&(a["--theme-surface-2"]=n),a}var kt=["heading","body","label"];function Bn(e){if(!e)return null;for(let t of kt)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var he=["headingLarge","headingMedium","headingSmall","accent","body","label"];var B={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},It=8,Ot=200;function Ht(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=It&&t<=Ot?t:null}function Rt(e){let t={};for(let n of he)t[n]=Ht(e?.[n]);return t}function zn(e){let t=Rt(e),n={};for(let a of he){let o=t[a];o!==null&&(n[`--size-${a}`]=`${o}px`)}return n}var xt=["square","small","large"],Mt="small";function $n(e){return xt.includes(e??"")?e:Mt}var ge=0,Pt=40,Vn={square:0,small:null,large:16},Dt={"--sf-card-radius":1,"--sf-button-radius":.5,"--site-radius":.5,"--site-radius-xs":.25,"--site-radius-sm":.5,"--site-radius-md":.75,"--site-radius-lg":1,"--site-radius-xl":1.25,"--site-radius-2xl":1.5,"--site-radius-3xl":2,"--site-radius-4xl":2.5};function fe(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(Pt,Math.max(ge,Math.round(t))):null}function Ft(e){let t=fe(e);return t===null?{}:Object.fromEntries(Object.entries(Dt).map(([n,a])=>{let o=t*a/16;return[n,o===0?"0":`${o}rem`]}))}function Wn(e){return Ft(fe(e)??ge)}var Nt=["none","soft","lifted"],Gt="soft",me="none",vt=["tight","normal","roomy"],Ut="normal",O="normal",Bt=["none","lift","highlight"],zt="lift",$t="highlight",Se="#141416";function pe(e){return Nt.includes(e??"")?e:Gt}function Vt(e){return vt.includes(e??"")?e:Ut}function _e(e){return Bt.includes(e??"")?e:zt}function Wt(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():Se}function Yn(e){let t=pe(e);return t===me?void 0:t}function Xn(e){let t=Vt(e);return t===O?void 0:t}function qn(e){let t=_e(e);return t===$t?void 0:t}function jn(e,t,n){let a=Wt(t);return a===Se?{}:pe(e)!==me||_e(n)==="lift"?{"--sf-shadow-color":a}:{}}var Yt=["normal","tight","compressed"],b="normal";function Ee(e){return Yt.includes(e??"")?e:b}function Kn(e){let t=Ee(e);return t===b?void 0:t}function Zn(e){switch(Ee(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}var z={case:"authored",weight:null,weightStrong:null,italicStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},D=100,F=900,Xt=24,qt=200;function L(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function ye(e){let t=L(e?.weight,D,F),n=e?.case==="sentence"?"sentence":"authored",a=l=>l==null?t:L(l,D,F),o=l=>l==="sentence"?"sentence":l==="authored"?"authored":n;return{case:n,weight:t,weightStrong:L(e?.weightStrong,D,F),italicStrong:typeof e?.italicStrong=="boolean"?e.italicStrong:null,maxPx:L(e?.maxPx,Xt,qt),weight2:a(e?.weight2),weight3:a(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function Jn(e){let t=ye(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function Qn(e){return ye({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,italicStrong:e?.accent_italic,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}var be=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"assistant",label:"Assistant",cssVar:"--font-assistant",category:"sans",italic:!1,italicLoaded:!1},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],f=new Map(be.map(e=>[e.key,e]));function ta(e){return f.get(e)}var Te=["heading","heading2","heading3","body","accent","label"],na={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},jt=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],Kt=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,aa={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},Zt={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function oa(e){let t=e?Kt.exec(e):null;return t?Zt[t[1]]??null:Jt(e)}function Jt(e){if(!e)return null;let t=e.split(/\s+/).filter(n=>!n.slice(0,n.lastIndexOf(":")+1).includes("&")).map(n=>n.slice(n.lastIndexOf(":")+1));for(let[n,a]of jt)if(t.includes(n))return a;return null}var d={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function Qt(e){let t=n=>{let a=e?.[n];if(a&&f.has(a))return a;if(n==="heading2"||n==="heading3"){let o=e?.heading;return o&&f.has(o)?o:d.heading}return d[n]};return Object.fromEntries(Te.map(n=>[n,t(n)]))}function en(e,t){return f.get(e[t])??f.get(d[t])}function g(e,t){return`var(${en(e,t).cssVar})`}var sa=[...new Set(Te.map(e=>f.get(d[e]).cssVar))],ra=[...new Set(be.map(e=>e.cssVar))];function ia(e){let t=Qt(e);return{"--font-role-heading":g(t,"heading"),"--font-role-heading2":g(t,"heading2"),"--font-role-heading3":g(t,"heading3"),"--font-role-body":g(t,"body"),"--font-role-accent":g(t,"accent"),"--font-role-label":g(t,"label"),fontFamily:"var(--font-role-body)"}}var Ce=tn({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:G,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:k,setTheme:()=>{},fonts:d,setFonts:()=>{},sizes:B,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:O,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:b,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:z,setHeadingTypography:()=>{},textStyles:null,setTextStyles:()=>{},wordStyles:null,heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},shareButtonOnPosts:null,setShareButtonOnPosts:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function ma({children:e,websiteName:t=null,templateChrome:n=!1,templateName:a=null,chromePlaceholder:o=!1,themeMode:l=G,onThemeModeChange:r,themeSwitchShown:u=!1,onThemeSwitchShownChange:T,theme:A=k,onThemeChange:m,fonts:S=d,onFontsChange:p,sizes:_=B,onSizesChange:c,cornerRadiusPx:H=null,onCornerRadiusPxChange:w,cardShadow:Ie=null,onCardShadowChange:$,shadowColor:Oe=null,onShadowColorChange:V,cardGap:He=O,onCardGapChange:W,hoverEffect:Re=null,onHoverEffectChange:Y,headingCompression:xe=b,onHeadingCompressionChange:X,siteWidth:Me=null,onSiteWidthChange:q,siteGutter:Pe=null,blockGap:De=null,onSiteGutterChange:j,onBlockGapChange:K,headingTypography:Fe=z,onHeadingTypographyChange:Z,textStyles:Ne=null,onTextStylesChange:J,wordStyles:Ge=null,heroBackgroundFollowsWidth:ve=null,onHeroBackgroundFollowsWidthChange:Q,photographyGrayscale:Ue=null,onPhotographyGrayscaleChange:ee,shareButtonOnPosts:Be=null,onShareButtonOnPostsChange:te,themeFromDocument:ze=!1}){let[E,ne]=we(null),$e=i(s=>ne(ft=>ft??s),[]),[Ve,We]=we(!1),Ye=i(s=>r?.(s),[r]),Xe=i(s=>T?.(s),[T]),qe=i(s=>m?.(s),[m]),je=i(s=>p?.(s),[p]),Ke=i(s=>c?.(s),[c]),Ze=i(s=>q?.(s),[q]),Je=i(s=>j?.(s),[j]),Qe=i(s=>K?.(s),[K]),et=i(s=>Q?.(s),[Q]),tt=i(s=>ee?.(s),[ee]),nt=i(s=>te?.(s),[te]),at=i(s=>w?.(s),[w]),ot=i(s=>$?.(s),[$]),st=i(s=>V?.(s),[V]),rt=i(s=>W?.(s),[W]),it=i(s=>Y?.(s),[Y]),lt=i(s=>X?.(s),[X]),ct=i(s=>Z?.(s),[Z]),ut=i(s=>J?.(s),[J]),{select:dt,setSelectHandler:ht}=on(),ae=E?.logoUrl,oe=E?.logoReversed,se=E?.logoInkIsDark,re=E!==null,gt=an(()=>({logo:re?{logoUrl:ae,logoReversed:oe,logoInkIsDark:se}:null,placeholder:n||o,wordmark:n?a:t}),[re,ae,oe,se,n,o,a,t]);return Ae(x.Provider,{value:gt,children:Ae(Ce.Provider,{value:{settings:E,setSettings:ne,primeSettings:$e,websiteName:t,templateChrome:n,templateName:a,chromePlaceholder:o,themeMode:l,setThemeMode:Ye,themeSwitchShown:u,setThemeSwitchShown:Xe,theme:A,setTheme:qe,fonts:S,setFonts:je,sizes:_,setSizes:Ke,cornerRadiusPx:H,setCornerRadiusPx:at,cardShadow:Ie,setCardShadow:ot,shadowColor:Oe,setShadowColor:st,cardGap:He,setCardGap:rt,hoverEffect:Re,setHoverEffect:it,headingCompression:xe,setHeadingCompression:lt,siteWidth:Me,setSiteWidth:Ze,siteGutter:Pe,blockGap:De,setSiteGutter:Je,setBlockGap:Qe,headingTypography:Fe,setHeadingTypography:ct,textStyles:Ne,setTextStyles:ut,wordStyles:Ge,heroBackgroundFollowsWidth:ve,setHeroBackgroundFollowsWidth:et,photographyGrayscale:Ue,setPhotographyGrayscale:tt,shareButtonOnPosts:Be,setShareButtonOnPosts:nt,themeFromDocument:ze,selected:Ve,setSelected:We,select:dt,setSelectHandler:ht},children:e})})}var Sa=()=>nn(Ce);import{forwardRef as sn}from"react";import{jsx as cn}from"react/jsx-runtime";var rn={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"},ln=sn(function({src:t,width:n,height:a,fill:o,priority:l,loading:r,style:u,quality:T,placeholder:A,blurDataURL:m,unoptimized:S,loader:p,overrideSrc:_,...c},H){let w=_??(typeof t=="string"?t:t.src);return cn("img",{ref:H,src:w,width:o?void 0:n,height:o?void 0:a,loading:l?"eager":r??"lazy",fetchPriority:l?"high":void 0,decoding:"async",style:o?{...rn,...u}:{color:"transparent",...u},...c})}),Ea=ln;function ya(e){return{props:{src:e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),sizes:e.sizes}}}import{forwardRef as un}from"react";import{jsx as gn}from"react/jsx-runtime";function dn(e){if(typeof e=="string")return e;let t=e.query?`?${new URLSearchParams(e.query).toString()}`:"",n=e.hash?e.hash.startsWith("#")?e.hash:`#${e.hash}`:"";return`${e.pathname??""}${t}${n}`}var hn=un(function({href:t,prefetch:n,replace:a,scroll:o,shallow:l,legacyBehavior:r,passHref:u,locale:T,onClick:A,children:m,...S},p){let _=c=>{A?.(c),!(c.defaultPrevented||S.target==="_blank")&&c.preventDefault()};return gn("a",{ref:p,href:dn(t),onClick:_,...S,children:m})}),wa=hn;var fn="Storefront";function ka(e){return e?.trim()||fn}var ke=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp","telegram","line","wechat"],mn={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp",telegram:"Telegram",line:"LINE",wechat:"WeChat"},Sn={};function Oa(e){if(!e||typeof e!="object")return Sn;let t={};for(let n of ke){let a=e[n];if(typeof a!="string")continue;let o=a.trim();!o||!/^https?:\/\//i.test(o)||(t[n]=o)}return t}function Ha(e){return ke.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:mn[t]}]:[]})}var Ra=e=>`${e}_url`;var Ma={small:54,medium:66,large:84},pn=44,Pa=16,Da=140,Fa=pn*4;export{Ea as a,ya as b,wa as c,be as d,ta as e,Te as f,na as g,aa as h,oa as i,Jt as j,d as k,Qt as l,ia as m,wn as n,Ln as o,Cn as p,kn as q,G as r,In as s,h as t,_t as u,ce as v,On as w,Hn as x,y,ue as z,At as A,Rn as B,xn as C,I as D,Mn as E,Pn as F,Dn as G,U as H,Fn as I,de as J,Ct as K,Nn as L,Gn as M,vn as N,Un as O,Bn as P,B as Q,Rt as R,zn as S,$n as T,ge as U,Pt as V,Vn as W,fe as X,Ft as Y,Wn as Z,Nt as _,Gt as $,me as aa,O as ba,Bt as ca,zt as da,$t as ea,Se as fa,pe as ga,Vt as ha,_e as ia,Wt as ja,Yn as ka,Xn as la,qn as ma,jn as na,b as oa,Ee as pa,Kn as qa,Zn as ra,z as sa,ye as ta,Jn as ua,Qn as va,ie as wa,Tn as xa,ma as ya,Sa as za,fn as Aa,ka as Ba,ke as Ca,mn as Da,Sn as Ea,Oa as Fa,Ha as Ga,Ra as Ha,Ma as Ia,pn as Ja,Pa as Ka,Da as La,Fa as Ma};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as V,f as z,h as T,m as $,n as j,p as O}from"./chunk-SEJFFUSI.js";var B="".replace(/\/+$/,"");var U="x-forwarded-for";function Z(e){let t=(e??"").split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Fe="x-forwarded-host";function Q(e,t,r){let n={};return e&&(n[Fe]=e),t&&r==="uncached"&&(n[U]=t),n}function X(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 Y="x-storefront-site",ee="x-storefront-host",te="x-storefront-preview";var re={contentHash:"81f2e3c31abcbfd9",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"],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"],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","imageFocal","imageFocal2","imageFocal2Phone","imageFocalPhone"]};var qe="shop_access_token",ne="shop_refresh_token",L=null;function N(){O.removeItem(qe),O.removeItem(ne)}var w={getAccess(){return L},takeLegacyRefresh(){let e=O.getItem(ne);return N(),e},setTokens(e){L=e,N()},clear(){L=null,N()}};import{efficientClientOpen as Qe}from"efficient-easel/screen/lib/session";function $e(e){return!!e.src}function A(e){let t=e.finishes.filter($e);if(t.length===e.finishes.length)return e;let r=e.defaultFinish&&t.some(n=>n.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:r}}function Be(e){return e.listable!==!1}function M(e){return e.map(A).filter(Be)}var ae=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ce=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]},le=12,ue=/\burl\(/i,me=new RegExp(`(?<![-\\w])(${ae.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),de=new RegExp(`((?:^|[;{\\s"'])(?:${ae.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ue=/<svg\b([^>]*)>/i,Le=/\bfill\s*[=:]/i;function Ne(e){let t=e.replace(me,(r,n,a,l,p)=>{let i=se(p);return i===null?r:`${n}${a}${l}${i}${l}`}).replace(de,(r,n,a)=>{let l=se(a);return l===null?r:`${n}${l}`});return t=t.replace(Ue,(r,n)=>Le.test(n)?r:`<svg fill="#ffffff"${n}>`),t}function se(e){let t=/!important/i.test(e),r=e.replace(/!important/gi,"").trim().toLowerCase();if(!r||ue.test(r)||ce.has(r))return null;let n=r in v?[...v[r],1]:pe(r);if(!n)return null;let[a,l,p,i]=n;if(Math.max(a,l,p)-Math.min(a,l,p)>le)return null;let s=Me(255-a,255-l,255-p,i);return t?`${s} !important`:s}function Me(e,t,r,n){if(n<1)return`rgba(${e}, ${t}, ${r}, ${n})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(r)}`}function pe(e){return e.startsWith("#")?He(e):e.startsWith("rgb")?De(e):e.startsWith("hsl")?We(e):null}function He(e){let t=e.slice(1),r=1;if(t.length===3||t.length===4)t.length===4&&(r=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(n=>n+n).join("");else if(t.length===6||t.length===8)t.length===8&&(r=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),r]:null}function De(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),a=r.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(i=>i.endsWith("%")?Math.round(parseFloat(i)/100*255):Math.round(parseFloat(i)));if(l.some(i=>Number.isNaN(i)))return null;let p=n?I(n):Je(r);return[l[0],l[1],l[2],p]}function Je(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?I(t[3]):1}function I(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function We(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),a=r.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),p=parseFloat(a[1])/100,i=parseFloat(a[2])/100;if([l,p,i].some(P=>Number.isNaN(P)))return null;let s=n?I(n):a.length>=4?I(a[3]):1,[o,u,g]=Ge(l,p,i);return[o,u,g,s]}function Ge(e,t,r){let n=(1-Math.abs(2*r-1))*t,a=(e%360+360)%360/60,l=n*(1-Math.abs(a%2-1)),p=0,i=0,s=0;a<1?[p,i,s]=[n,l,0]:a<2?[p,i,s]=[l,n,0]:a<3?[p,i,s]=[0,n,l]:a<4?[p,i,s]=[0,l,n]:a<5?[p,i,s]=[l,0,n]:[p,i,s]=[n,0,l];let o=r-n/2;return[Math.round((p+o)*255),Math.round((i+o)*255),Math.round((s+o)*255)]}var ie=512*1024;function H(e){return/\.svg(\?|$)/i.test(e)}function Ke(e){return`data:image/svg+xml,${encodeURIComponent(Ne(e))}`}function Ve(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||ue.test(t)||ce.has(t))return null;let r=t in v?[...v[t],1]:pe(t);if(!r)return null;let[n,a,l]=r;return Math.max(n,a,l)-Math.min(n,a,l)>le?null:(.2126*n+.7152*a+.0722*l)/255}function ze(e){let t=[],r=n=>{let a=Ve(n);a!==null&&t.push(a)};for(let n of e.matchAll(me))r(n[4]);for(let n of e.matchAll(de))r(n[2]);return t.length?t.reduce((n,a)=>n+a,0)/t.length<.5:null}var oe=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function je(e){let t=e;for(let r=oe.exec(t);r&&r[0].length>0;r=oe.exec(t))t=t.slice(r[0].length);return/^<svg[\s>/]/i.test(t)}async function Ze(e,t){if(!H(e))return null;try{let r=await fetch(e,{signal:t,redirect:"manual"});if(!r.ok)return null;let n=Number(r.headers.get("content-length"));if(Number.isFinite(n)&&n>ie)return null;let a=await r.text();return a.length>ie?null:je(a)?a:null}catch{return null}}async function ge(e,t){let r=await Ze(e,t);return r===null?null:{reversed:Ke(r),inkIsDark:ze(r)}}function he(){return V().siteId()}var Xe="",f=class extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n}},W="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.",Ye=new Set([502,503,504]),D=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,rt=15e3,nt=()=>typeof window>"u"?tt:rt;function Re(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(nt())}var ye=e=>e instanceof Error&&e.name==="TimeoutError",fe=(e,t)=>Ye.has(e)?W:t,st=["admin","venue"],_e="admin";function Yt(e){_e=st.includes(e)?e:"admin"}function it(){return _e}var ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,Ce=null;function er(e){Ce=e&&ot.test(e)?e:null}function at(){return Ce}function ct(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=$();return!t||/[?&]site=/.test(e)?e:q(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:r,baseUrl:n,headers:a,audience:l,...p}=t;if(typeof window<"u"&&!Qe())throw new f(D,et,null);if(typeof window>"u"&&n===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 i=typeof FormData<"u"&&p.body instanceof FormData,s;try{s=await fetch(`${n??Xe}${ct(e)}`,{...p,headers:{...i?{}:{"Content-Type":"application/json"},...r?{Authorization:`Bearer ${r}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:p.signal??Re({...p,audience:l})})}catch(g){throw g instanceof TypeError||ye(g)?new f(D,W,null):g}let o;try{o=await s.text()}catch(g){throw ye(g)?new f(D,W,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(s.status,s.ok?"Expected JSON but received a non-JSON response":fe(s.status,s.statusText),o)}if(!s.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??fe(s.status,s.statusText);throw new f(s.status,g,u)}return u}var R=null;async function xe(){return R||(R=lt().finally(()=>{R=null}),R)}async function lt(){let e=w.takeLegacyRefresh(),t=await ut.refresh(e??void 0);return w.setTokens(t.access),t.access}async function ke(){return w.getAccess()??xe()}async function h(e,t={}){let r;try{r=await ke()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:r})}catch(n){if(!(n instanceof f)||n.status!==401)throw n;try{let a=await xe();return await c(e,{...t,token:a})}catch{throw w.clear(),n}}}async function Se(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(r){if(!(r instanceof f)||r.status!==401)throw r}return{data:await c(e,t),asShopper:!1}}async function Pe(){let e=await h("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new f(403,"This session is not valid for this shop.",null);return e}var ut={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 ke();return await Pe(),e},me:Pe,updateMe:e=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:e=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:e=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>h(`/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,r)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:r})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>h(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>h(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>h(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>h(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let r=new FormData;return r.append("claim_item",e),r.append("file",t),r.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:r})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?z(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=r==="captions"&&n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).map(([a,l])=>[S(a),l])):S(n);return t}return e}var Te=typeof window>"u"&&B!=="",mt=Te?B:"",dt=j,b=()=>({baseUrl:dt(),audience:null});function m(e,t){let r=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${r}`}var pt=100,we=50;function Oe(e,t,r){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&n.set(a,String(l));return n.set("pageSize",String(pt)),r&&n.set("cursor",r),`/api/v1${e}?${n.toString()}`}function gt(e,t){return Oe("/wheels",{process:e},t)}function ht(e,t,r){return Oe("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},r)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function be(e,t,r=()=>!1){let n=[],a=null;try{for(let l=0;l<we;l++){let p=await c(await t(a),await d());if(n.push(...p.results),a=yt(p.next),!a)break}a&&console.warn(`[${e}] stopped at ${we} pages (${n.length} rows); catalog may be truncated`)}catch(l){if(r(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return n}var ft=e=>e instanceof f&&e.status===400;function St(e){return e.flatMap(t=>t.kind==="alloy-wheel"?M([t]):[t])}async function ve(){return(await Pt()).host}async function Pt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),r=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,n=r(t.get(ee)??t.get("x-forwarded-host")??t.get("host")),a=r(t.get("host"));return{host:n,matchesRequestHost:n!==null&&n===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Z((await e()).get(U))}catch{return null}}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(Y)||null}catch{return null}}async function At(){let e=await bt();if(e)return`site=${encodeURIComponent(e)}`;let t=await ve();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=$();return t?q(e,`site=${encodeURIComponent(t)}`):e}return q(e,await At())}function q(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var Rt="preview";async function _t(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(te)}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 r=await _t();if(r===null)return[await y(e),await d(t)];let n=q(await y(e),`${Rt}=${encodeURIComponent(r)}`),{next:a,cache:l,...p}=t??{},i=await d({...p,cache:"no-store"}),s=await Ct();return s&&(i.headers={...i.headers,"user-agent":s}),[n,i]}async function xt(e){if(!Te)return;let[t,r]=await Promise.all([ve(),wt()]),n=Q(t,r,e);return Object.keys(n).length>0?n:void 0}async function d(e){let t=await xt(X(e)),r={baseUrl:mt,...e};return t&&(r.headers={...t,...e?.headers}),r}var _=typeof window>"u";function C(e,t){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&r.set(a,String(l));let n=r.toString();return`/api/v1/fitment${e}${n?`?${n}`:""}`}var ir={listMakes:async e=>{if(_){let{fitmentData:r}=await import("./fitment-data-GCO32HAV.js");return r.makes(e)}return(await c(C("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:n}=await import("./fitment-data-GCO32HAV.js");return n.models(e,t)}return(await c(C("/models",{make:e,region:t}),b())).results},listYears:async(e,t,r)=>{if(_){let{fitmentData:a}=await import("./fitment-data-GCO32HAV.js");return a.years(e,t,r)}return(await c(C("/years",{make:e,model:t,region:r}),b())).results},listModifications:async(e,t,r,n)=>{if(_){let{fitmentData:l}=await import("./fitment-data-GCO32HAV.js");return l.modifications(e,t,r,n)}return(await c(C("/modifications",{make:e,model:t,year:r,region:n}),b())).results},getStockFitment:async(e,t,r,n,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-GCO32HAV.js");return l.stockFitment(e,t,r,n,a)}return c(C("/stock-fitment",{make:e,model:t,year:r,modification:n,region:a}),b())}},or={listWheels:async e=>{let t=await be("products.listWheels",async r=>await y(gt(e,r)));return M(S(t))},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 r=await be("products.listCatalog",async n=>await y(ht(e,t,n)),ft);return St(S(r))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await d()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await d())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await d())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:r=null}=e;if(typeof window>"u"){let{listGalleryBuilds:n}=await import("./gallery-builds-data-TD3QJK7L.js");return S(n(t,r))}try{let n=new URLSearchParams;t&&n.set("process",t),r&&n.set("wheelSlug",r);let a=n.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(n){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",n),[]}},getSite:async()=>c(await y(m("/site")),await d()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listBrands:async()=>{try{return(await c(await y(m("/brands")),await d())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await c(`${m("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0)).results??[],listPages:async()=>S(await c(await y(m("/pages")),await d())),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await d())}catch(r){if(r instanceof f&&r.status===404)return[];throw r}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(r){if(r instanceof f&&r.status===404)return null;throw r}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(r=>typeof r=="string"&&r!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let r=t.record?`?record=${encodeURIComponent(t.record)}`:"",[n,a]=await J(m(`/pages/${e}`)+r,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(n,a))},listBlogPosts:async()=>{try{return(await c(m("/blog-posts"),await d())).map(t=>({...t,coverImage:T(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await d());return{...t,coverImage:T(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let r=m("/reviews"),n=t.toString();try{return await c(await y(n?`${r}?${n}`:r),await d())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await d())}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 d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),r=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Se(t,r)).data:c(t,r)},validateCoupon:async e=>{let{data:t,asShopper:r}=await Se(m("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:r}},getHeaderSettings:async()=>{let e=Re({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),r=T(t.logoUrl),n=null,a=null;if(r&&H(r)){let l=await ge(r,e);l&&(n=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:r,logoReversed:n,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await d())},ar={listServices:async()=>{try{return await c(m("/bookings/services"),await d())}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 d()),create:async e=>c(m("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(r,n){super(`Slug "${r}" exists on ${n} websites; a site is required to pick one.`);this.slug=r;this.count=n;this.name="AmbiguousPageSlugError"}},F=(e,t,r)=>{let n=new URLSearchParams({...t?{site:t}:{},...r?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${n?`?${n}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,kt=e=>`${x(e)}currencies/`,Tt="/api/storefront/media/ingest/",K=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 Ot(){let e=he();if(!e)throw new K;return`${Tt}?${new URLSearchParams({site:e})}`}var E={"X-Puck-Media-Manifest":re.contentHash},cr=Ie({});function Ie(e){return(t,r={})=>{let n=at(),a=e.headers||n?{...n?{"Accept-Language":n}:{},...e.headers,...r.headers}:void 0;return c(t,{...r,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function vt(e={}){let t=Ie(e),r=e.siteDrafts===!0,n=i=>F("header-settings",i,r),a=i=>F("theme-settings",i,r),l=i=>F("chat-settings",i,r),p=i=>F("social-settings",i,r);return{findPageBySlug:async(i,s,o)=>{let u=new URLSearchParams({slug:i});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:s}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(i,P.length);return P[0]??null},getPageById:(i,s)=>t(`/api/storefront/pages/${i}/`,{token:s}),saveLayout:(i,s,o,u,g)=>t(`/api/storefront/pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),createPagePreviewLink:(i,s)=>t(`/api/storefront/pages/${i}/preview-link/`,{method:"POST",token:s}),claimPageEditLock:(i,s,o,u=!1)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:s}),releasePageEditLock:(i,s)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"DELETE",token:s}),createTemplate:(i,s,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:i,layout:s}),headers:E,token:o}),getTemplate:(i,s)=>t(`/api/storefront/page-templates/${i}/`,{token:s}),saveTemplateLayout:(i,s,o)=>t(`/api/storefront/page-templates/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:E,token:o}),listTemplatePages:async(i,s)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(i,s,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}&slug=${encodeURIComponent(s)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(i,s,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:i,...s}),headers:E,token:o}),saveTemplatePageLayout:(i,s,o)=>t(`/api/storefront/template-pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:E,token:o}),deleteTemplatePage:(i,s,o)=>t(`/api/storefront/template-pages/${i}/`,{method:"DELETE",token:s,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("site",s);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]},createPage:(i,s,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:i,slug:s,layout:o}),token:u}),deletePage:(i,s)=>t(`/api/storefront/pages/${i}/`,{method:"DELETE",token:s}),getHeaderSettings:(i,s)=>t(n(s),{token:i}),listMenus:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("site",s);let u=await t(`/api/storefront/menus/?${o}`,{token:i});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.visibleOnly&&o.set("is_visible","true"),s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(i,s)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.visibleOnly&&o.set("is_visible","true"),s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:i});return[...Array.isArray(u)?u:u.results??[]].sort((P,k)=>P.sort_order-k.sort_order||P.name.localeCompare(k.name))},listForms:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:i});return[...Array.isArray(u)?u:u.results??[]].sort((P,k)=>P.title.localeCompare(k.title))},listWheelSummaries:async(i,s={})=>{let o=new URLSearchParams;s.siteId&&o.set("site",s.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:i});return S(g)},listProducts:async(i,s={})=>{let o=new URLSearchParams;s.kinds?.length&&o.set("kind",s.kinds.join(",")),s.siteId&&o.set("site",s.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:i});return S(g)},getWheelDetail:async(i,s,o={})=>{let u=new URLSearchParams({slug:s});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:i})))},updateHeaderSettings:(i,s,o)=>t(n(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getSite:(i,s)=>t(x(i),{token:s}),listSites:async i=>{let s=await t("/api/storefront/sites/?no_page=true",{token:i});return Array.isArray(s)?s:s.results??[]},listSiteCurrencies:async(i,s)=>{let o=await t(kt(i),{token:s});return Array.isArray(o)?o:[]},publishSite:(i,s)=>t(`${x(i)}publish/`,{method:"POST",token:s}),getSiteLiveState:(i,s)=>t(`${x(i)}live-state/`,{token:s}),updateSite:(i,s,o)=>t(x(i),{method:"PATCH",body:JSON.stringify(s),token:o}),getThemeSettings:(i,s)=>t(a(s),{token:i}),updateThemeSettings:(i,s,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getChatSettings:(i,s)=>t(l(s),{token:i}),updateChatSettings:(i,s,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getSocialSettings:(i,s)=>t(p(s),{token:i}),updateSocialSettings:(i,s,o)=>t(p(o),{method:"PATCH",body:JSON.stringify(i),token:s}),uploadHeaderLogo:(i,s,o)=>{let u=new FormData;return u.append("logo",i),t(n(o),{method:"PATCH",body:u,token:s})},clearHeaderLogo:(i,s)=>t(n(s),{method:"PATCH",body:JSON.stringify({logo:null}),token:i}),setHeaderLogoFromAsset:(i,s,o)=>t(n(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:i}),token:s}),uploadMedia:async(i,s)=>{let o=new FormData;return o.append("file",i),t(Ot(),{method:"POST",body:o,token:s})},listMedia:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("kind",s);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]}}}var lr=vt({siteDrafts:!0});export{re as a,B as b,Q as c,X as d,w as e,$e as f,H as g,he as h,Xe as i,f as j,W as k,D as l,Yt as m,er as n,c as o,ut as p,ve as q,Pt as r,wt as s,bt as t,_t as u,ir as v,or as w,ar as x,G as y,cr as z,lr as A};
|