efficient-storefront-blocks 0.68.0 → 0.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +5 -5
  3. package/dist/chunks/{EditorPreviewCheckout-HFP2TRRR.js → EditorPreviewCheckout-XI4VULPL.js} +1 -1
  4. package/dist/chunks/{SiteEditorProvider-A7YYACG3.js → SiteEditorProvider-3GKJZDL5.js} +1 -1
  5. package/dist/chunks/{chunk-EPJ5SM3A.js → chunk-QWHNN7GF.js} +1 -1
  6. package/dist/chunks/chunk-RPLNV3WM.js +1 -0
  7. package/dist/chunks/{chunk-FL3KMJAT.js → chunk-TXTTPEQA.js} +1 -1
  8. package/dist/chunks/chunk-XF2ZAVNU.js +262 -0
  9. package/dist/chunks/{fitment-data-RXCNCZLU.js → fitment-data-6GK7QQQI.js} +1 -1
  10. package/dist/contract.js +10 -2
  11. package/dist/editor/components/HeaderSettingsPanel.d.ts +4 -7
  12. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  13. package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
  14. package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
  15. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  16. package/dist/editor/lib/document/blocks/service/FooterDivider/fields.js +1 -1
  17. package/dist/editor/lib/document/blocks/service/FooterMenu/fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/service/OpeningHours/fields.d.ts +2 -0
  19. package/dist/editor/lib/document/blocks/service/OpeningHours/fields.js +1 -0
  20. package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
  21. package/dist/editor/lib/document/blocks/service/index.js +1 -1
  22. package/dist/editor/lib/document/config.js +1 -1
  23. package/dist/editor/lib/efficient-block-sources.js +1 -1
  24. package/dist/editor/lib/storefront-editor-words.d.ts +8 -5
  25. package/dist/editor/lib/storefront-editor-words.js +1 -1
  26. package/dist/editor.css +1 -1
  27. package/dist/index.d.ts +5 -3
  28. package/dist/index.js +147 -169
  29. package/dist/render/app/globals.css +41 -13
  30. package/dist/render/built-with.json +1 -1
  31. package/dist/render/components/OpeningHours.d.ts +12 -0
  32. package/dist/render/components/OpeningHours.js +1 -0
  33. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +6 -0
  34. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
  35. package/dist/render/components/pdp-dynamic/RecordPhotoGallery.d.ts +3 -2
  36. package/dist/render/components/pdp-dynamic/RecordPhotoGallery.js +1 -1
  37. package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
  38. package/dist/render/lib/document/blocks/service/OpeningHours/meta.d.ts +11 -0
  39. package/dist/render/lib/document/blocks/service/OpeningHours/meta.js +1 -0
  40. package/dist/render/lib/document/blocks/service/OpeningHours/render.d.ts +4 -0
  41. package/dist/render/lib/document/blocks/service/OpeningHours/render.js +1 -0
  42. package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
  43. package/dist/render/lib/document/blocks/service/metas.js +1 -1
  44. package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
  45. package/dist/render/lib/document/blocks/service/renders.js +1 -1
  46. package/dist/render/lib/document/blocks/text-part-shapes.json +10 -0
  47. package/dist/render/lib/document/lazy-draws.js +1 -1
  48. package/dist/render/lib/sections/opening-hours.d.ts +53 -0
  49. package/dist/render/lib/sections/opening-hours.js +1 -0
  50. package/dist/words.d.ts +11 -5
  51. package/dist/words.js +3 -3
  52. package/package.json +3 -3
  53. package/dist/chunks/chunk-CFYEYTU6.js +0 -254
  54. package/dist/chunks/chunk-YACB7UXA.js +0 -1
  55. /package/dist/chunks/{chunk-YTQS5GY6.js → chunk-SQH6XBRG.js} +0 -0
  56. /package/dist/chunks/{chunk-CFYEYTU6.js.LEGAL.txt → chunk-XF2ZAVNU.js.LEGAL.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.70.0 - 2026-10-27
4
+
5
+ **A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder` `^42.0.0` and `efficient-easel` `^22.0.0` (`efficient-shell` stays `^10.0.0`). Builder 42 and easel 22 removed every name of the retired editor library, so a host moves to those with this release.
6
+
7
+ - **The blocks say nothing of the retired editor library.** Comments, guard names and docs now speak of "the editor"; the one name kept is the legacy `X-Puck-Media-Manifest` header, still sent beside `X-Media-Manifest` because the backend accepts it and production has not yet been checked. A later release drops it.
8
+ - **`SiteThemeRow` has `card_theme_index`** (builder 42's theme row): the published declarations say so. The editor words are regenerated against builder 42's catalogue.
9
+ - Guard: `scripts/test-document-names.ts` now fails on the word anywhere in a tracked file but the changelog, the guard's own patterns, the legacy header and history notes.
10
+
11
+ - **The site sheet draws a padding's tablet value** (three-views plan 2026-10-23, PR 3a; GG 2026-10-26). `app/globals.css` gets the Tablet view's block, `@media (min-width: 720px) and (max-width: 1099.98px)`: `.sf-pad-top-tablet`, `-bottom-`, `-left-`, `-right-` read `--sf-pad-t-tablet` and its three siblings, `!important` over the inline desktop padding, as the phone block does. efficient-web-builder emits these classes only for a side whose tablet value is drawn, so no stored page changes. Guard: new `scripts/test-tablet-padding-css.ts` (red first: 12 of 28 checks).
12
+ - **The Customer Photo Grid can show the website's own pictures** (a venue's gallery; Victor Mau approved the look 2026-10-27). `GalleryB` takes a block source (`dataSource`, the "Image source" row; efficient-backend `site-pictures`, a separate pull request: the website's pictures and videos in their owner's order, up to 24, each row `key`, `cover` and, for a video, `video`). On a source the typed tiles are not drawn (they stay stored and come back with "Images typed here"): every served picture is a tile of one size, three across for a three-across layout and four otherwise (two on a phone), at most `limit` of them (new "Images to show" row, 1-24, shown on a source only), and one lightbox walks them all, looping, where a video plays with its controls and still, never by itself. Served none, a published page draws nothing; the editor draws empty boxes. `RecordPhotoGallery` gains `fit="tiles"` and `across` for it. **Editor words to translate:** "Image source", "Images typed here", "Images to show" and the empty grid's hint.
13
+ - Guard: new `scripts/test-gallery-site-pictures.tsx`.
14
+
15
+ ## 0.69.1 - 2026-10-27
16
+
17
+ - **The Header's Width row is `Full width | Content width`**, the one order every width row has (GG for Lewis, 2026-10-26): it drew `Content width | Full width` while every section's two Width rows and the Footer draw Full width first. It reads the order from efficient-web-builder's `SECTION_WIDTH_CHOICES` now, so it cannot drift again. The stored values do not change (`full`, and `page` for Content width). Guard: new `scripts/test-header-width-order.ts` (red first: the labels came in the other order).
18
+ - **Phone-only rows are rows of the phone view only, with no "mobile" in their words** (Lewis, 2026-10-27: he still saw "Show as accordion on mobile" in the desktop view; his ruling of 2026-10-08: no "(phone)" rows, a phone value is set in the phone view, on the same row). Three rows are now gated with easel's `deviceField("mobile", …)`: the footer Menu's accordion row (now `Show as accordion`), the footer Divider's hide row (now `Hide`, the builder's own word, with the builder's icon) and the popup's `On a phone` heading and its `Left panel` row. Stored values and keys are unchanged (`accordionMobile`, `hideOnMobile`, `valuePanelOnPhone`; `deviceField` only gates the paint of the same field), so no saved page changes and no stored content moves. **Editor words to translate:** `Show as accordion` is new; `Show as accordion on mobile` and `Hide on mobile` are gone.
19
+ - Guard: new `scripts/test-phone-rows-in-phone-view.tsx` (red first: 16 of 29 checks failed on main; also scans this package's editor files for a row label with a device word).
20
+ - **The page Menu's `Show links` row sits under the Menu it picks from** (Lewis, 2026-10-26: the row was the last one in the Design group, under Link alignment). Which links the block draws is what is in it, so the row is in the Content run at the top of the panel, right under `Menu`, and no longer in the Design group (Wix structure, Lewis 2026-10-08). Stored value and page unchanged. The `From` and `To` words drawn on top of the numbers ("Fro1m") are the shell number box's fixed prefix room, fixed in efficient-shell (a word prefix gets its own room). The host's installed `efficient-shell` draws that box, so no release of this package is needed for it: the host takes the shell release.
21
+ - Guard: `scripts/test-box-header-arrangement.tsx` §5 (red first: 2 checks failed on main, `linkRange` was the last field after `_dDesign`).
22
+
23
+ ## 0.69.0 - 2026-10-27
24
+
25
+ **A minor for hosts:** a new block, no peer range change. New editor words to translate: the block's rows ("Hours from") and its two shows ("Open now badge", "The week").
26
+
27
+ - **Opening hours: an "Open now" badge, or the week with today marked** (`OpeningHours`, service set; Victor Mau approved the look 2026-10-27). Its row is read as the page is served from the source `location-opening` (efficient-backend, a separate pull request) and never stored in the page; a new block names that source. At most one row, all text: `week`, `day:opens-closes` periods joined by `;` (day 0-6 from Monday, minutes from that day's local midnight, `closes` up to 2879 past midnight); `zone`, the place's IANA zone; `hours`, plain text lines. A missing key reads as "". `show` picks the draw (default `week`). The week: the title, then Monday to Sunday with each day's periods as 12-hour times, "Closed" muted, today accent-tinted and marked "· today". With no week, the `hours` lines under the title; with neither, nothing. The badge: "Open now · until 3 am", "Closed · opens today 10 am", "Closed · opens Tue 10 am" or "Closed"; no week, nothing. The time is the visitor's clock in the place's zone (an unknown zone: the browser's own), read after mount and every 30 seconds, so the server's markup has no today and an invisible badge; open now is the backend's rule (`system/opening_week.status`). A period the backend would refuse is left out. The editor draws the host's sample for `location-opening` (declared in `lib/efficient-block-sources`) or the block's own, at a fixed Monday 8 pm. The shopper's words are in one place (`OPENING_WORDS`). New `components/OpeningHours`, `lib/sections/opening-hours`. Not yet in the builder's catalogue (`scripts/registered-not-catalogued.ts`); `contained` defaults on.
28
+ - Guard: new `scripts/test-opening-hours-source.tsx`.
29
+
3
30
  ## 0.68.0 - 2026-10-27
4
31
 
5
32
  **A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder` `^41.0.0`, `efficient-easel` `^21.1.0` and `efficient-shell` `^10.0.0` (all three narrowed; builder 41 needs easel 21, which needs shell 10). A host moves to those with this release. The package is built against efficient-web-builder 41.0.0. Phase 3 of retiring the editor library's old name; nothing saved changes, and a page published before still draws.
package/README.md CHANGED
@@ -10,7 +10,7 @@ Published as `efficient-web` up to 0.3.0 and as `efficient-web-builder` from
10
10
  says how to migrate). The name `efficient-web-builder` now belongs to the
11
11
  builder alone, published from its own repository
12
12
  ([`Efficient-Pty-Ltd/efficient-web-builder`](https://github.com/Efficient-Pty-Ltd/efficient-web-builder)):
13
- the editor, the general sections and the renderer, with no storefront in it.
13
+ The editor, the general sections and the renderer, with no storefront in it.
14
14
 
15
15
  It is not a second copy of anything: `build.mjs` compiles this repository's
16
16
  `src/` (the storefront's blocks, editor session and API client), starting at
@@ -92,7 +92,7 @@ const backend: WebsiteBackend = {
92
92
  `pages.remove` (inline in the page list), `lock` (the "somebody else is
93
93
  editing" notices and take-over), `site.update` (the Maps key), `preview`
94
94
  (the Preview link; with `draftLink`, Preview opens the saved draft), `sectionTemplates`, `templates`. A missing group is never
95
- a dead button: the editor does not draw what it cannot do.
95
+ a dead button: The editor does not draw what it cannot do.
96
96
  - **Failures are kinds.** Reject with `WebsiteBackendError`: `unauthorized`,
97
97
  `changed-elsewhere` (+ `conflict`), `lock-taken` (+ `holder`), `not-found`,
98
98
  `invalid`, `unavailable`. The editor never reads a status code or a body.
@@ -301,8 +301,8 @@ const Roster: ComponentConfig = {
301
301
  label: "Roster",
302
302
  fields: { heading: { type: "text", label: "Heading" } },
303
303
  defaultProps: { heading: "On tonight" },
304
- // `puck.metadata` is whatever you hand the editor as `blocks.metadata`.
305
- render: ({ heading, puck }) => <RosterSection heading={heading} people={puck.metadata.roster} />,
304
+ // `editor.metadata` is whatever you hand the editor as `blocks.metadata`.
305
+ render: ({ heading, editor }) => <RosterSection heading={heading} people={editor.metadata.roster} />,
306
306
  };
307
307
 
308
308
  const blocks: WebsiteEditorBlocks = {
@@ -336,7 +336,7 @@ const blocks: WebsiteEditorBlocks = {
336
336
  - **Your own blocks.** Written as the engine's `ComponentConfig`, with its
337
337
  field types (`text`, `textarea`, `number`, `select`, `radio`, `array`,
338
338
  `object`, `custom`, `slot`). A type the editor already registers is refused —
339
- the editor throws when it mounts — so give yours a prefix. A block is added
339
+ The editor throws when it mounts — so give yours a prefix. A block is added
340
340
  from the Add panel, in the group `categories` names; one named in no group is
341
341
  registered and offered nowhere, and none is offered inside a Box. A
342
342
  `categories` entry whose `key` is an existing group (`content`, `structure`,
@@ -1,4 +1,4 @@
1
- "use client";import{$ as Vt,K as Ut,L as Mt,M as Wt,N as $t,O as Kt,P as le,R as Pe,S as Yt,T as zt,U as tt,V as Bt,X as nt,Z as Ht,_ as Gt,a as qt,b as _t,c as Dt,d as Ft,ea as Jt,ja as Xt,ka as Zt,na as rt,pa as z,w as Ue}from"./chunk-FL3KMJAT.js";import{i as Fe,o as ge,v as j}from"./chunk-EPJ5SM3A.js";import{a as Ot,c as ne,za as Tt}from"./chunk-YACB7UXA.js";import{k as jt,l as Se,m as H}from"./chunk-YTQS5GY6.js";import{a as et,b as pr}from"./chunk-Y6SLVHK3.js";var en=et((la,Qt)=>{"use strict";var dr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Qt.exports=dr});var an=et((ua,rn)=>{"use strict";var mr=en();function tn(){}function nn(){}nn.resetWarningCache=tn;rn.exports=function(){function t(a,o,s,l,p,m){if(m!==mr){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:nn,resetWarningCache:tn};return n.PropTypes=n,n}});var sn=et((ma,on)=>{"use strict";on.exports=an()();var pa,da});import{useEffect as _,useMemo as Ge,useRef as pe,useState as g}from"react";var w=pr(sn(),1);import k from"react";function cn(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 fr(t){if(Array.isArray(t))return t}function mn(t,e,n){return(e=xr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a,o,s,l,p=[],m=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(m=(a=s.call(n)).done)&&(p.push(a.value),p.length!==e);m=!0);}catch(h){u=!0,o=h}finally{try{if(!m&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return p}}function yr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ "use client";import{$ as Vt,K as Ut,L as Mt,M as Wt,N as $t,O as Kt,P as le,R as Pe,S as Yt,T as zt,U as tt,V as Bt,X as nt,Z as Ht,_ as Gt,a as qt,b as _t,c as Dt,d as Ft,ea as Jt,ja as Xt,ka as Zt,na as rt,pa as z,w as Ue}from"./chunk-TXTTPEQA.js";import{i as Fe,o as ge,v as j}from"./chunk-QWHNN7GF.js";import{a as Ot,c as ne,za as Tt}from"./chunk-RPLNV3WM.js";import{k as jt,l as Se,m as H}from"./chunk-SQH6XBRG.js";import{a as et,b as pr}from"./chunk-Y6SLVHK3.js";var en=et((la,Qt)=>{"use strict";var dr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Qt.exports=dr});var an=et((ua,rn)=>{"use strict";var mr=en();function tn(){}function nn(){}nn.resetWarningCache=tn;rn.exports=function(){function t(a,o,s,l,p,m){if(m!==mr){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:nn,resetWarningCache:tn};return n.PropTypes=n,n}});var sn=et((ma,on)=>{"use strict";on.exports=an()();var pa,da});import{useEffect as _,useMemo as Ge,useRef as pe,useState as g}from"react";var w=pr(sn(),1);import k from"react";function cn(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 fr(t){if(Array.isArray(t))return t}function mn(t,e,n){return(e=xr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a,o,s,l,p=[],m=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(m=(a=s.call(n)).done)&&(p.push(a.value),p.length!==e);m=!0);}catch(h){u=!0,o=h}finally{try{if(!m&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return p}}function yr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ln(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 un(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ln(Object(n),!0).forEach(function(a){mn(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ln(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function hr(t,e){if(t==null)return{};var n,a,o=vr(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 vr(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 fn(t,e){return fr(t)||gr(t,e)||kr(t,e)||yr()}function br(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 xr(t){var e=br(t,"string");return typeof e=="symbol"?e:e+""}function at(t){"@babel/helpers - typeof";return at=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},at(t)}function kr(t,e){if(t){if(typeof t=="string")return cn(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)?cn(t,e):void 0}}var q=function(e,n,a){var o=!!a,s=k.useRef(a);k.useEffect(function(){s.current=a},[a]),k.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])},ot=function(e){var n=k.useRef(e);return k.useEffect(function(){n.current=e},[e]),n.current},ye=function(e){return e!==null&&at(e)==="object"},Cr=function(e){return ye(e)&&typeof e.then=="function"},Sr=function(e){return ye(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},pn="[object Object]",Pr=function t(e,n){if(e===n)return!0;if(!ye(e)||!ye(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)===pn,l=Object.prototype.toString.call(n)===pn;if(s!==l)return!1;if(!s&&!a)return e===n;var p=Object.keys(e),m=Object.keys(n);if(p.length!==m.length)return!1;for(var u={},h=0;h<p.length;h+=1)u[p[h]]=!0;for(var C=0;C<m.length;C+=1)u[m[C]]=!0;var v=Object.keys(u);if(v.length!==p.length)return!1;var d=e,T=n,x=function(D){return t(d[D],T[D])};return v.every(x)},gn=function(e,n,a){return ye(e)?Object.keys(e).reduce(function(o,s){var l=!ye(n)||!Pr(e[s],n[s]);return a.includes(s)?(l&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),o):l?un(un({},o||{}),{},mn({},s,e[s])):o},null):null},yn="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.",dn=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yn;if(e===null||Sr(e))return e;throw new Error(n)},wr=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yn;if(Cr(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(o){return dn(o,n)})};var a=dn(e,n);return a===null?{tag:"empty"}:{tag:"sync",stripe:a}},Nr=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"}))},Me=k.createContext(null);Me.displayName="ElementsContext";var hn=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},st=function(e){var n=e.stripe,a=e.options,o=e.children,s=k.useMemo(function(){return wr(n)},[n]),l=k.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(a):null}}),p=fn(l,2),m=p[0],u=p[1];k.useEffect(function(){var v=!0,d=function(x){u(function(A){return A.stripe?A:{stripe:x,elements:x.elements(a)}})};return s.tag==="async"&&!m.stripe?s.stripePromise.then(function(T){T&&v&&d(T)}):s.tag==="sync"&&!m.stripe&&d(s.stripe),function(){v=!1}},[s,m,a]);var h=ot(n);k.useEffect(function(){h!==null&&h!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[h,n]);var C=ot(a);return k.useEffect(function(){if(m.elements){var v=gn(a,C,["clientSecret","fonts"]);v&&m.elements.update(v)}},[a,C,m.elements]),k.useEffect(function(){Nr(m.stripe)},[m.stripe]),k.createElement(Me.Provider,{value:m},o)};st.propTypes={stripe:w.default.any,options:w.default.object};var vn=function(e){var n=k.useContext(Me);return hn(n,e)},bn=function(){var e=vn("calls useElements()"),n=e.elements;return n},Er=function(e){var n=e.children,a=vn("mounts <ElementsConsumer>");return n(a)};Er.propTypes={children:w.default.func.isRequired};var Rr=k.createContext(null);Rr.displayName="CheckoutContext";var xn=k.createContext(null);xn.displayName="CheckoutSdkContext";var it=function(e){var n=k.useContext(xn),a=k.useContext(Me);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 hn(a,e)},Ir=["mode"],Ar=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},N=function(e,n,a){var o="".concat(Ar(e),"Element"),s=function(u){var h=u.id,C=u.className,v=u.options,d=v===void 0?{}:v,T=u.onBlur,x=u.onFocus,A=u.onReady,D=u.onChange,b=u.onEscape,O=u.onClick,G=u.onLoadError,re=u.onLoaderStart,ae=u.onNetworksChange,Ee=u.onConfirm,oe=u.onCancel,Re=u.onShippingAddressChange,ie=u.onShippingRateChange,Ie=u.onSavedPaymentMethodRemove,he=u.onSavedPaymentMethodUpdate,Ae=u.onAvailablePaymentMethodsChange,Q=it("mounts <".concat(o,">")),ee="elements"in Q?Q.elements:null,$="checkoutSdk"in Q?Q.checkoutSdk:null,ve=k.useState(null),de=fn(ve,2),R=de[0],be=de[1],M=k.useRef(null),se=k.useRef(null);q(R,"blur",T),q(R,"focus",x),q(R,"escape",b),q(R,"click",O),q(R,"loaderror",G),q(R,"loaderstart",re),q(R,"networkschange",ae),q(R,"confirm",Ee),q(R,"cancel",oe),q(R,"shippingaddresschange",Re),q(R,"shippingratechange",ie),q(R,"savedpaymentmethodremove",Ie),q(R,"savedpaymentmethodupdate",he),q(R,"availablepaymentmethodschange",Ae),q(R,"change",D);var ce;A&&(e==="expressCheckout"?ce=A:ce=function(){A(R)}),q(R,"ready",ce),k.useLayoutEffect(function(){if(M.current===null&&se.current!==null&&(ee||$)){var S=null;if($){var F=$,me=$;switch(e){case"paymentForm":S=me.createForm(d);break;case"payment":S=F.createPaymentElement(d);break;case"address":if("mode"in d){var te=d.mode,xe=hr(d,Ir);if(te==="shipping")S=F.createShippingAddressElement(xe);else if(te==="billing")S=F.createBillingAddressElement(xe);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":S=F.createExpressCheckoutElement(d);break;case"currencySelector":S=$.createCurrencySelectorElement();break;case"taxId":S=F.createTaxIdElement(d);break;case"contactDetails":S=F.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in $)S=$.createLinkSignupElement(d);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":S=F.createTermsElement(d);break;default:throw new Error("<".concat(o,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else ee&&(S=ee.create(e,d));M.current=S,be(S),S&&S.mount(se.current)}},[ee,$,d]);var I=ot(d);return k.useEffect(function(){if(M.current){var S=gn(d,I,["paymentRequest"]);S&&"update"in M.current&&M.current.update(S)}},[d,I]),k.useLayoutEffect(function(){return function(){if(M.current&&typeof M.current.destroy=="function")try{M.current.destroy(),M.current=null}catch{}}},[]),k.createElement("div",{id:h,className:C,ref:se})},l=function(u){it("mounts <".concat(o,">"));var h=u.id,C=u.className;return k.createElement("div",{id:h,className:C})},p=n?l:s;return p.propTypes={id:w.default.string,className:w.default.string,onChange:w.default.func,onBlur:w.default.func,onFocus:w.default.func,onReady:w.default.func,onEscape:w.default.func,onClick:w.default.func,onLoadError:w.default.func,onLoaderStart:w.default.func,onNetworksChange:w.default.func,onConfirm:w.default.func,onCancel:w.default.func,onShippingAddressChange:w.default.func,onShippingRateChange:w.default.func,onSavedPaymentMethodRemove:w.default.func,onSavedPaymentMethodUpdate:w.default.func,onAvailablePaymentMethodsChange:w.default.func,options:w.default.object},p.displayName=o,p.__elementType=e,p},E=typeof window>"u",Lr=k.createContext(null);Lr.displayName="EmbeddedCheckoutProviderContext";var kn=function(){var e=it("calls useStripe()"),n=e.stripe;return n},ga=N("auBankAccount",E),ya=N("card",E),ha=N("cardNumber",E),va=N("cardExpiry",E),ba=N("cardCvc",E),xa=N("currencySelector",E),ka=N("iban",E),Cn=N("payment",E),Ca=N("expressCheckout",E),Sa=N("paymentRequestButton",E),Pa=N("linkAuthentication",E),wa=N("linkSignup",E),Na=N("contactDetails",E),Ea=N("address",E),Ra=N("shippingAddress",E),Ia=N("paymentMethodMessaging",E),Aa=N("taxId",E),La=N("issuingCardNumberDisplay",E),Oa=N("issuingCardCvcDisplay",E),Ta=N("issuingCardExpiryDisplay",E),ja=N("issuingCardPinDisplay",E),qa=N("issuingCardCopyButton",E),_a=N("terms",E);function Ke(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ke=function(e){return typeof e}:Ke=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(t)}var wn="dahlia",Or=function(e){return e===3?"v3":e},Nn="https://js.stripe.com",Tr="".concat(Nn,"/").concat(wn,"/stripe.js"),jr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,qr=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,Sn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",_r=function(e){return jr.test(e)||qr.test(e)},Dr=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Nn,'"]')),n=0;n<e.length;n++){var a=e[n];if(_r(a.src))return a}return null},Pn=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",a=document.createElement("script");a.src="".concat(Tr).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},Fr=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},we=null,We=null,$e=null,Ur=function(e){return function(n){e(new Error("Failed to load Stripe.js",{cause:n}))}},Mr=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},Wr=function(e){return we!==null?we:(we=new Promise(function(n,a){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(Sn),window.Stripe){n(window.Stripe);return}try{var o=Dr();if(o&&e)console.warn(Sn);else if(!o)o=Pn(e);else if(o&&$e!==null&&We!==null){var s;o.removeEventListener("load",$e),o.removeEventListener("error",We),(s=o.parentNode)===null||s===void 0||s.removeChild(o),o=Pn(e)}$e=Mr(n,a),We=Ur(a),o.addEventListener("load",$e),o.addEventListener("error",We)}catch(l){a(l);return}}),we.catch(function(n){return we=null,Promise.reject(n)}))},$r=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(Ke(o)," instead."));var s=o.match(/^pk_test/),l=Or(e.version),p=wn;s&&l!==p&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(p,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var m=e.apply(void 0,n);return Fr(m,a),m},Ne,En=!1,Rn=function(){return Ne||(Ne=Wr(null).catch(function(e){return Ne=null,Promise.reject(e)}),Ne)};Promise.resolve().then(function(){return Rn()}).catch(function(t){En||console.warn(t)});var In=function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];En=!0;var o=Date.now();return Rn().then(function(s){return $r(s,n,o)})};var Kr="sf:gclid",Yr="sf:fbclid",zr=2160*60*60*1e3;function On(){return typeof window<"u"}function An(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>zr?"":n}catch{return""}}function Ln(t){if(!On())return"";let e=t.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function Tn(){if(!On())return{};let t=An(Kr),e=An(Yr),n=Ln("_fbp"),a=Ln("_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 jn="sf:meta-purchases",Br=20;function _n(){return typeof window>"u"||window.parent!==window}function Hr(...t){try{if(_n()||typeof window.fbq!="function")return;window.fbq(...t)}catch{}}var qn=new Set;function Gr(t){if(qn.has(t))return!1;qn.add(t);try{let e=JSON.parse(Se.getItem(jn)??"[]");if(e.includes(t))return!1;Se.setItem(jn,JSON.stringify([...e,t].slice(-Br)))}catch{}return!0}function Vr(t){return[...new Set(t.filter(Pe).flatMap(e=>e.components.map(n=>n.partNumber)))]}function Dn(t){let e=t.confirmation;_n()||!Gr(e.orderNumber)||Hr("track","Purchase",{value:Number(e.grandTotal),currency:e.currency,content_type:"product",content_ids:Vr(t.lines)},{eventID:e.orderNumber})}var ct="checkout-afterpay-context",Ye="checkout-gocardless-context",lt="checkout-zip-context",ze="checkout-klarna-context";function Jr({evidence:t,parked:e}){return t?{action:"capture",evidence:t,parked:e}:e?{action:"settle",parked:e}:{action:"ignore"}}function Xr(t,e){let n=t.getItem(e);if(t.removeItem(e),!n)return null;try{return JSON.parse(n)}catch{return null}}var Fn={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:ct,evidenceFrom(t,e){return e==="cancel"||(t.get("status")??"").toUpperCase()==="CANCELLED"?null:t.get("orderToken")},requestFrom:t=>({token:t})},Un={name:"Zip",legParam:"zip",legValues:["return"],storageKey:lt,evidenceFrom(t){let e=(t.get("result")??"").toLowerCase();return e==="cancelled"||e==="declined"?null:t.get("checkoutId")},requestFrom:t=>({checkoutId:t})};async function ut(t,e){let n=new URLSearchParams(e.search),a=n.get(t.legParam);if(!a||!t.legValues.includes(a))return;let o=Xr(e.storage,t.storageKey),s=t.evidenceFrom(n,a);e.scrubQuery();let l=Jr({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 p=await e.capture(t.requestFrom(l.evidence));p.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??p)}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)}}}function Mn(t,e,n){let a=(e??"").trim();if(!a)return"";if(n.length===0)return a;let o=a.toUpperCase(),s=`${t.toUpperCase()}-${o}`,l=n.find(p=>p.code&&p.code.toUpperCase()===o)??n.find(p=>p.code&&p.code.toUpperCase()===s)??n.find(p=>p.name.toUpperCase()===o);return l?l.code||l.name:""}import{Fragment as U,jsx as r,jsxs as c}from"react/jsx-runtime";function Wn(t){let e=t.indexOf(`
3
3
  `);return e===-1?[t,""]:[t.slice(0,e),t.slice(e+1)]}function $n(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 mt({site:t,logo:e,preview:n=!1}){let{items:a,totals:o,coupon:s,refuseCoupon:l,deliveryOptions:p,shippingMethodId:m,setShippingMethodId:u,setQuoteDestination:h,identify:C,clearCapturedCart:v}=tt(),d=p.find(i=>i.id===m)?.pickupLocation??null,{country:T,countries:x,activeCountry:A,formatMoney:D}=le(),[b,O]=g(()=>$n(t)[0].key),[G,re]=g(!0);_(()=>{re(jt(H))},[]);let[ae,Ee]=g(!1),[oe,Re]=g(""),[ie,Ie]=g(""),[he,Ae]=g(""),[Q,ee]=g(""),[$,ve]=g(""),[de,R]=g(""),[be,M]=g(""),[se,ce]=g(""),[I,S]=g(()=>T||x[0]?.code||""),[F,me]=g(""),[te,xe]=g([]),[ft,Je]=g(null),[Le,Oe]=g(null),Hn=Ge(()=>x.find(i=>i.code===I)??A,[x,I,A])?.postalLabel||"Postal Code",Gn=te[0]?.divisionType||"State / Province";_(()=>{if(!I){xe([]),Je(I);return}Je(null);let i=!1;return j.listCountrySubdivisions(I).then(f=>{i||(xe(f),Je(I),me(""))}),()=>{i=!0}},[I]),_(()=>{h(I?{country:I,subdivision:F}:null)},[I,F,h]),_(()=>()=>h(null),[h]);let[X,gt]=g(null),[yt,ht]=g([]),[Te,je]=g("new"),[Xe,vt]=g(!1),[bt,Vn]=g("Home"),[xt,kt]=g(null),[K]=g(()=>Zt()),[qe,Y]=g(null),[Ct,ke]=g(null),[St,Jn]=g(null),[Xn,Zn]=g(!1),[Qn,er]=g(!1),[V,Ze]=g(null),[Pt,fe]=g(!1),[wt,Z]=g(null),[tr,nr]=g(!1),[rr,Nt]=g(!1),[ar,or]=g(!1),[ir,Et]=g(!1),Rt=pe(!1);_(()=>{n||Rt.current||!a.some(Pe)||(Rt.current=!0,Ut({lines:a,currency:o.currency,value:o.subtotal-o.discount,coupon:s?.valid?s.code:void 0}))},[a,o,s,n]),_(()=>{C(oe,ie.trim()||void 0)},[oe,ie,C]);let It=pe(null),[_e,sr]=g(null);_(()=>{let i=It.current;if(!_e||!i)return;let f=()=>i.style.setProperty("--sf-checkout-header-h",`${_e.offsetHeight}px`);f();let y=new ResizeObserver(f);return y.observe(_e),()=>y.disconnect()},[_e]),_(()=>{let i=y=>({setConfirming:y,land:Y,markPaid:()=>fe(!0),note:Z,fail:ke,clearCart:v}),f={search:window.location.search,storage:H,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};ut(Fn,{...f,capture:j.captureAfterpayPayment,page:i(nr)}),ut(Un,{...f,capture:j.captureZipPayment,page:i(or)})},[]),_(()=>{let f=new URLSearchParams(window.location.search).get("gocardless");if(f!=="confirm"&&f!=="cancel")return;let y=H.getItem(Ye);if(H.removeItem(Ye),window.history.replaceState(null,"",window.location.pathname),!y)return;let L;try{L=JSON.parse(y)}catch{return}if(v(),f==="cancel"){Z("The direct debit was not set up \u2014 our team will follow up on payment."),Y(L.confirmation);return}Nt(!0),j.completeGocardlessPayment({idempotencyKey:L.idempotencyKey}).then(P=>{P.status==="paid"?fe(!0):P.status==="declined"?Z("The direct debit was declined \u2014 our team will follow up on payment."):Z("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{Z("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{Y(L.confirmation),Nt(!1)})},[]),_(()=>{let i=new URLSearchParams(window.location.search),f=i.get("klarna");if(f!=="confirm"&&f!=="cancel")return;let y=H.getItem(ze);H.removeItem(ze);let L=i.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!y)return;let P;try{P=JSON.parse(y)}catch{return}if(v(),f==="cancel"||!L){Z("The Klarna payment was not completed \u2014 our team will follow up on payment."),Y(P.confirmation);return}Et(!0),j.captureKlarnaPayment({idempotencyKey:P.idempotencyKey,authorizationToken:L}).then(W=>{W.status==="paid"?fe(!0):W.status==="declined"?Z("Klarna declined the payment \u2014 our team will follow up on payment."):Z("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{Z("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{Y(P.confirmation),Et(!1)})},[]);function At(i){let[f,y]=Wn(i.address);ee(f),ve(y),R(i.city),M(i.zip_code),i.country&&S(i.country),i.phone&&ce(i.phone),Oe({country:i.country||null,state:i.state??""})}_(()=>{if(Le){if((Le.country||I)!==I){Oe(null);return}ft===I&&(me(Mn(I,Le.state,te)),Oe(null))}},[Le,I,ft,te]),_(()=>{let i=!1;return(async()=>{try{let[f,y,L]=await Promise.all([ge.me(),ge.myProfile().catch(()=>null),ge.myAddresses().catch(()=>[])]);if(i)return;gt(f);let P=L.filter(Ce=>Ce.is_active);ht(P),Re(f.email);let W=(y?.contact_name??"").split(/\s+/);Ie(f.first_name||W[0]||""),Ae(f.last_name||W.slice(1).join(" "));let J=f.phone||y?.phone;J&&ce(J);let Qe=P.find(Ce=>Ce.id===f.default_delivery_location)??P[0];if(Qe)je(Qe.id),At(Qe);else if(y){let[Ce,ur]=Wn(y.address??"");ee(Ce),ve(ur),R(y.city??""),M(y.zip_code??""),y.country&&S(y.country),Oe({country:y.country||null,state:y.state??""})}}catch{}})(),()=>{i=!0}},[]);function cr(){ge.logout(),gt(null),ht([]),je("new"),vt(!1)}let De=Ge(()=>$n(t,{canParkContext:G}),[t,G]);_(()=>{De.some(i=>i.key===b)||O(De[0].key)},[De,b]);let Lt=$.trim()?`${Q}
4
4
  ${$.trim()}`:Q;async function lr(){if(n||ae||a.length===0||o.repricing)return;let i=a.filter(Pe).flatMap(f=>Ft(f.components,f.qty));if(i.length===0){ke("Pick a size on each wheel's product page before checking out.");return}Ee(!0),ke(null);try{let f=X?j.createOrderAuthed:j.createOrder,y=Xt(),L=await f({customer:{email:oe,name:`${ie} ${he}`.trim(),phone:se.trim()||void 0,address:Lt,city:de,state:F||void 0,zipCode:be,country:I},items:i,currency:o.currency,idempotencyKey:K,shippingMethodId:m??void 0,couponCode:_t(s),...y==="denied"?{}:Tn(),...y?{adConsent:y}:{}});if(Mt({confirmation:L,lines:a,adsSendTo:t.googleAdsId&&t.googleAdsConversionLabel?`${t.googleAdsId}/${t.googleAdsConversionLabel}`:null}),Dn({confirmation:L,lines:a}),v(),X&&Xe&&Te==="new")try{await ge.createAddress({label:bt.trim()||"Home",contact_name:`${ie} ${he}`.trim(),phone:se.trim(),address:Lt,city:de,zip_code:be,state:F,country:I}),kt("Address saved to your account.")}catch{kt("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}if(b==="card"&&t.paymentMethods.includes("card")){let P=await j.createPaymentIntent({idempotencyKey:K});Ze(L),Jn(P)}else if(b==="paypal"&&t.paymentMethods.includes("paypal"))Ze(L),Zn(!0);else if(b==="afterpay"&&t.paymentMethods.includes("afterpay")){let P=window.location.origin,W=await j.createAfterpayCheckout({idempotencyKey:K,confirmUrl:`${P}/checkout?afterpay=confirm`,cancelUrl:`${P}/checkout?afterpay=cancel`}),J={idempotencyKey:K,confirmation:L};H.setItem(ct,JSON.stringify(J)),window.location.assign(W.redirectCheckoutUrl);return}else if(b==="square"&&t.paymentMethods.includes("square"))Ze(L),er(!0);else if(b==="gocardless"&&t.paymentMethods.includes("gocardless")){let P=window.location.origin,W=await j.createGocardlessBillingRequest({idempotencyKey:K,confirmUrl:`${P}/checkout?gocardless=confirm`,cancelUrl:`${P}/checkout?gocardless=cancel`}),J={idempotencyKey:K,confirmation:L};H.setItem(Ye,JSON.stringify(J)),window.location.assign(W.authorisationUrl);return}else if(b==="zip"&&t.paymentMethods.includes("zip")){let P=window.location.origin,W=await j.createZipCheckout({idempotencyKey:K,redirectUrl:`${P}/checkout?zip=return`}),J={idempotencyKey:K,confirmation:L};H.setItem(lt,JSON.stringify(J)),window.location.assign(W.redirectUrl);return}else if(b==="klarna"&&t.paymentMethods.includes("klarna")){let P=window.location.origin,W=await j.createKlarnaCheckout({idempotencyKey:K,confirmUrl:`${P}/checkout?klarna=confirm`,cancelUrl:`${P}/checkout?klarna=cancel`}),J={idempotencyKey:K,confirmation:L};H.setItem(ze,JSON.stringify(J)),window.location.assign(W.redirectUrl);return}else Y(L)}catch(f){let y=Dt(f);y?(l(y),ke(`${y} Your order has not been placed. Place it again to continue without the code.`)):ke(f instanceof Fe?f.message:"Could not place the order. Please try again."),Ee(!1)}}return qe?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:Pt?"Payment received":"Order received"}),c("p",{className:"text-fg-dim",children:[Pt?c(U,{children:["Thank you \u2014 your payment for order"," ",r("span",{className:"font-mono text-fg",children:qe.orderNumber})," has gone through."," "]}):c(U,{children:["Thank you \u2014 your order ",r("span",{className:"font-mono text-fg",children:qe.orderNumber})," is being reviewed by our team."," "]}),X?c(U,{children:["Track it under"," ",r(ne,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):r(U,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),wt&&r("p",{className:"text-sm text-fg-dim",children:wt}),xt&&r("p",{className:"text-sm text-fg-dim",children:xt}),!X&&c("p",{className:"text-sm text-fg-dim",children:["You can also"," ",r(ne,{href:`/track?order=${encodeURIComponent(qe.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"})]}):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 Afterpay \u2014 one moment."})]}):rr?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."})]}):ar?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."})]}):ir?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."})]}):St?r(Zr,{payment:St,onPaid:()=>{fe(!0),Y(V)},onSkip:()=>Y(V)}):Xn&&V?r(ta,{confirmation:V,clientId:t.paypalClientId??"",idemKey:K,onPaid:()=>{fe(!0),Y(V)},onSkip:()=>Y(V)}):Qn&&V?r(ra,{confirmation:V,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:K,onPaid:()=>{fe(!0),Y(V)},onSkip:()=>Y(V)}):c("div",{ref:It,className:"bg-bg text-fg",children:[c("header",{ref:sr,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(Ht,{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(Be,{num:"N\xB0 01",title:"Contact",children:[r(z,{label:"Email",hint:X?c(U,{children:["Signed in \xB7"," ",r("button",{type:"button",onClick:cr,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:r("input",{type:"email",value:oe,onChange:i=>Re(i.target.value),placeholder:"you@example.com",readOnly:X!==null,className:B+(X?" opacity-70":"")})}),c(Yn,{children:[r(z,{label:"First name",children:r("input",{type:"text",value:ie,onChange:i=>Ie(i.target.value),className:B})}),r(z,{label:"Last name",children:r("input",{type:"text",value:he,onChange:i=>Ae(i.target.value),className:B})})]})]}),c(Be,{num:"N\xB0 02",title:d?"Collection":"Shipping address",children:[d?c("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[r("span",{className:"font-medium",children:d.name}),[d.address,d.city,d.state,d.zipCode,d.country].filter(Boolean).length>0&&r("span",{className:"opacity-80",children:[d.address,d.city,d.state,d.zipCode,d.country].filter(Boolean).join(", ")}),d.openingHours&&r("span",{className:"opacity-80",children:d.openingHours}),d.instructions&&r("span",{className:"opacity-80",children:d.instructions}),r("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):c(U,{children:[X!==null&&yt.length>0&&c("div",{className:"grid gap-3",children:[yt.map(i=>r(He,{active:Te===i.id,onClick:()=>{je(i.id),At(i)},title:i.label,body:i.formatted_address,price:null},i.id)),r(He,{active:Te==="new",onClick:()=>je("new"),title:"New address",body:null,price:null})]}),r(z,{label:"Address line 1",children:r("input",{type:"text",value:Q,onChange:i=>ee(i.target.value),className:B})}),r(z,{label:"Address line 2",children:r("input",{type:"text",value:$,onChange:i=>ve(i.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:B})}),c(Yn,{cols:"three",children:[r(z,{label:"City",children:r("input",{type:"text",value:de,onChange:i=>R(i.target.value),className:B})}),r(z,{label:Hn,children:r("input",{type:"text",value:be,onChange:i=>M(i.target.value),className:B})}),r(z,{label:"Country",separate:!0,children:r(rt,{value:I,onChange:i=>S(i.target.value),className:B+" pr-10",style:Kn,children:x.map(i=>r("option",{value:i.code,children:i.name},i.code))})})]}),r(z,{label:Gn,separate:!0,children:te.length>0?c(rt,{value:F,onChange:i=>me(i.target.value),className:B+" pr-10",style:Kn,children:[r("option",{value:"",children:"Select\u2026"}),te.map(i=>r("option",{value:i.code||i.name,children:i.name},i.code||i.name))]}):r("input",{type:"text",value:F,onChange:i=>me(i.target.value),className:B})})]}),r(z,{label:"Phone",children:r("input",{type:"tel",value:se,onChange:i=>ce(i.target.value),placeholder:"+44 7700 900000",className:B})}),!d&&X!==null&&Te==="new"&&c(U,{children:[r(aa,{checked:Xe,onChange:vt,label:"Save this address to my account"}),Xe&&r(z,{label:"Address label",children:r("input",{type:"text",value:bt,onChange:i=>Vn(i.target.value),placeholder:"Home",className:B})})]})]}),r(Be,{num:"N\xB0 03",title:"Shipping",children:c("div",{className:"grid gap-3",children:[p.map(i=>{let f=i.pickupLocation,y=f?[f.address,f.city,f.state,f.zipCode].filter(Boolean).join(", "):null;return r(He,{active:m===i.id,onClick:()=>u(i.id),title:f?`${i.name} \u2014 ${f.name}`:i.name,body:f?[y,f.openingHours,f.instructions,i.description].filter(Boolean).join(" \xB7 "):i.description||null,price:o.freeShipping||i.amount===0?Ue:D(i.amount,o.currency),tag:i.tag||void 0},i.id)}),p.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(Be,{num:"N\xB0 04",title:"Payment",children:[r("div",{className:"grid gap-3",children:De.map(i=>r(He,{active:b===i.key,onClick:()=>O(i.key),title:i.title,body:i.body,price:i.price,tag:i.tag},i.key))}),b==="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."}):b==="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."}):b==="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."}):b==="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."}):b==="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."}):b==="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."}):b==="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(oa,{slug:i.slug,name:i.name,qty:i.qty,config:i.config,configSummary:ia(i.config),price:Yt(i,o.currency)??0,currency:o.currency},i.id))}),r("div",{className:"border-t border-line px-6 pt-5",children:r(Jt,{customerEmail:oe})}),c("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[r(ue,{label:"Subtotal",value:D(o.subtotal,o.currency)}),o.discount>0&&s?.valid&&r(ue,{label:`Coupon \xB7 ${s.code}`,value:c("span",{className:"font-semibold text-green",children:["\u2212 ",D(o.discount,o.currency)]})}),s?.deferred&&r(ue,{label:`Coupon \xB7 ${s.code}`,value:qt}),s?.valid&&s.effects?.gift&&r(ue,{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:Ue})}),r(ue,{label:"Shipping",value:o.shippingStatus==="free"?r("span",{className:"font-semibold text-green",children:Ue}):$t(o.shippingStatus)??D(o.shipping,o.currency)}),o.tax&&(o.tax.charged?r(ue,{label:o.tax.inclusive?`${o.tax.name} included \xB7 ${o.tax.rate}%`:o.tax.name,value:D(o.tax.amount,o.currency)}):o.tax.name?r(ue,{label:o.tax.name,value:Wt}):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":D(o.grand,o.currency)})]}),c("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[Ct&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:Ct}),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:lr,disabled:ae||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||ae||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:ae?c(U,{children:["Building order\u2026 ",r("span",{children:"\xB7"})]}):o.repricing?c(U,{children:["Updating total\u2026 ",r("span",{children:"\xB7"})]}):c(U,{children:[b==="bank"?"Place order":"Continue to payment"," \xB7"," ",D(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:Bt({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}var B="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",Kn={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 Be({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 Yn({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 He({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 Zr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=le(),o=Ge(()=>In(t.publishableKey),[t.publishableKey]),s=Ge(()=>{if(typeof document>"u")return;let l=getComputedStyle(document.documentElement),p=(u,h)=>l.getPropertyValue(u).trim()||h,m=document.documentElement.getAttribute("data-theme")!=="light";return{theme:m?"night":"stripe",variables:{colorPrimary:p("--accent",m?"#c9a461":"#8a6a2a"),colorBackground:p("--site-surface",m?"#131313":"#ffffff"),colorText:p("--fg",m?"#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(st,{stripe:o,options:{clientSecret:t.clientSecret,appearance:s},children:r(Qr,{payment:t,onPaid:e,onSkip:n})})]})]})})}function Qr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=le(),o=kn(),s=bn(),[l,p]=g(!1),[m,u]=g(null);async function h(){if(!o||!s||l)return;p(!0),u(null);let C=await o.confirmPayment({elements:s,redirect:"if_required"});if(C.error){u(C.error.message??"Payment failed. Please try again."),p(!1);return}let v=C.paymentIntent?.status;if(v==="succeeded"||v==="processing"){e();return}u("Payment did not complete. Please try again."),p(!1)}return c("div",{className:"flex flex-col gap-4",children:[r(Cn,{}),m&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:m}),r("button",{type:"button",onClick:h,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(U,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(U,{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 zn="paypal-sdk-js",pt=null;function ea(t,e){let n=`${t}|${e}`;if(pt?.key===n)return pt.promise;let a=new Promise((o,s)=>{document.getElementById(zn)?.remove();let l=document.createElement("script");l.id=zn;let p=new URLSearchParams({"client-id":t,currency:e,intent:"capture"});l.src=`https://www.paypal.com/sdk/js?${p}`,l.onload=()=>{let m=window.paypal;m?o(m):s(new Error("PayPal SDK loaded without its namespace"))},l.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(l)});return pt={key:n,promise:a},a}function ta({confirmation:t,clientId:e,idemKey:n,onPaid:a,onSkip:o}){let{formatMoney:s}=le(),l=pe(null),[p,m]=g(!1),[u,h]=g(null),C=pe(a);return C.current=a,_(()=>{let v=!1,d=null;return ea(e,t.currency).then(T=>{if(!(v||!l.current))return d=T.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await j.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async x=>{try{if((await j.capturePaypalOrder({idempotencyKey:n,paypalOrderId:x.orderID})).status==="paid"){C.current();return}h("PayPal did not complete the payment. Please try again.")}catch(A){h(A instanceof Fe?A.message:"PayPal payment failed. Please try again.")}},onError:()=>{h("PayPal could not process the payment. Please try again.")}}),d.render(l.current).then(()=>{v||m(!0)})}).catch(()=>{v||h("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{v=!0,d?.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."]}),!p&&!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 Bn="square-web-sdk",dt=null;function na(t){let e=t==="sandbox"?"sandbox":"production";if(dt?.key===e)return dt.promise;let n=new Promise((a,o)=>{document.getElementById(Bn)?.remove();let s=document.createElement("script");s.id=Bn,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 dt={key:e,promise:n},n}function ra({confirmation:t,applicationId:e,locationId:n,environment:a,idemKey:o,onPaid:s,onSkip:l}){let{formatMoney:p}=le(),m=pe(null),u=pe(null),h=pe(null),[C,v]=g(!1),[d,T]=g(!1),[x,A]=g(null);_(()=>{let b=!1,O=null;return na(a).then(async G=>{if(b||!m.current)return;let re=G.payments(e,n);h.current=re,O=await re.card(),await O.attach(m.current),u.current=O,b||v(!0)}).catch(()=>{b||A("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{b=!0,O?.destroy?.()}},[e,n,a]);async function D(){let b=u.current;if(!(!b||d)){T(!0),A(null);try{let O=await b.tokenize();if(O.status!=="OK"||!O.token){A(O.errors?.[0]?.message??"Please check the card details and try again."),T(!1);return}let G;try{G=(await h.current?.verifyBuyer?.(O.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await j.chargeSquare({idempotencyKey:o,sourceId:O.token,...G?{verificationToken:G}:{}})).status==="paid"){s();return}A("Square did not complete the payment. Please try again.")}catch(O){A(O instanceof Fe?O.message:"Square payment failed. Please try again.")}T(!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:p(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!C&&!x&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),r("div",{ref:m}),x&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:x}),r("button",{type:"button",onClick:D,disabled:!C||d,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!C||d?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:d?c(U,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(U,{children:["Pay ",p(Number(t.grandTotal),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:l,disabled:d,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 aa({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 oa({slug:t,name:e,qty:n,config:a,configSummary:o,price:s,currency:l}){let{catalog:p}=tt(),{formatMoney:m}=le(),u=p.find(x=>x.slug===t),h=u?.spokes??5,C=u?.mesh??!1,v=a.find(x=>x.gold)?.label,d=u?.finishes.find(x=>x.name===v&&x.src)??u?.finishes.find(x=>x.src),T=u?.finishes[0]?.color??Vt;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}),d?.src?r(Ot,{src:d.src,alt:`${e.lead}${e.accent} \u2014 ${d.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:T},children:r(Gt,{spokes:h,mesh:C,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:m(s,l)})]})}function ue({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 ia(t){return t.map(e=>e.label).join(" \xB7 ")}import{jsx as Ve}from"react/jsx-runtime";function sa(){let{settings:t,websiteName:e}=Tt(),n=e?{...nt,name:e}:nt,a=t?{url:t.logoUrl,reversed:t.logoReversed??null,inkIsDark:t.logoInkIsDark??null,reverse:t.reverseLogo,size:t.logoSize,sizePx:t.logoSizePx}:null;return Ve("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:Ve(Kt,{children:Ve(zt,{preview:!0,children:Ve(mt,{site:n,logo:a,preview:!0})})})})}export{sa as default};
@@ -1 +1 @@
1
- "use client";import{ci as r}from"./chunk-CFYEYTU6.js";import"./chunk-YACB7UXA.js";import"./chunk-YTQS5GY6.js";import"./chunk-Y6SLVHK3.js";import{jsx as o}from"react/jsx-runtime";import e from"efficient-easel/screen/components/ScreenStoreProvider";function a(t){return o(e,{...t,parts:r})}export{a as default};
1
+ "use client";import{hi as r}from"./chunk-XF2ZAVNU.js";import"./chunk-RPLNV3WM.js";import"./chunk-SQH6XBRG.js";import"./chunk-Y6SLVHK3.js";import{jsx as o}from"react/jsx-runtime";import e from"efficient-easel/screen/components/ScreenStoreProvider";function a(t){return o(e,{...t,parts:r})}export{a as default};
@@ -1 +1 @@
1
- import{a as V,c as C,g as z,i as $,j,l as O}from"./chunk-YTQS5GY6.js";var U="".replace(/\/+$/,"");var B="x-forwarded-for";function Z(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ie="x-forwarded-host";function Q(e,t,n){let r={};return e&&(r[Ie]=e),t&&n==="uncached"&&(r[B]=t),r}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 Fe="shop_access_token",ne="shop_refresh_token",N=null;function L(){O.removeItem(Fe),O.removeItem(ne)}var w={getAccess(){return N},takeLegacyRefresh(){let e=O.getItem(ne);return L(),e},setTokens(e){N=e,L()},clear(){N=null,L()}};import{efficientClientOpen as Qe}from"efficient-easel/screen/lib/session";function qe(e){return!!e.src}function A(e){let t=e.finishes.filter(qe);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function $e(e){return e.listable!==!1}function M(e){return e.map(A).filter($e)}var oe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ae=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]},ce=12,le=/\burl\(/i,ue=new RegExp(`(?<![-\\w])(${oe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),me=new RegExp(`((?:^|[;{\\s"'])(?:${oe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ue=/<svg\b([^>]*)>/i,Be=/\bfill\s*[=:]/i;function Ne(e){let t=e.replace(ue,(n,r,a,l,d)=>{let s=re(d);return s===null?n:`${r}${a}${l}${s}${l}`}).replace(me,(n,r,a)=>{let l=re(a);return l===null?n:`${r}${l}`});return t=t.replace(Ue,(n,r)=>Be.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function re(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||le.test(n)||ae.has(n))return null;let r=n in v?[...v[n],1]:pe(n);if(!r)return null;let[a,l,d,s]=r;if(Math.max(a,l,d)-Math.min(a,l,d)>ce)return null;let i=Le(255-a,255-l,255-d,s);return t?`${i} !important`:i}function Le(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function pe(e){return e.startsWith("#")?Me(e):e.startsWith("rgb")?De(e):e.startsWith("hsl")?Je(e):null}function Me(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function De(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(s=>s.endsWith("%")?Math.round(parseFloat(s)/100*255):Math.round(parseFloat(s)));if(l.some(s=>Number.isNaN(s)))return null;let d=r?E(r):He(n);return[l[0],l[1],l[2],d]}function He(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),d=parseFloat(a[1])/100,s=parseFloat(a[2])/100;if([l,d,s].some(P=>Number.isNaN(P)))return null;let i=r?E(r):a.length>=4?E(a[3]):1,[o,u,g]=We(l,d,s);return[o,u,g,i]}function We(e,t,n){let r=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=r*(1-Math.abs(a%2-1)),d=0,s=0,i=0;a<1?[d,s,i]=[r,l,0]:a<2?[d,s,i]=[l,r,0]:a<3?[d,s,i]=[0,r,l]:a<4?[d,s,i]=[0,l,r]:a<5?[d,s,i]=[l,0,r]:[d,s,i]=[r,0,l];let o=n-r/2;return[Math.round((d+o)*255),Math.round((s+o)*255),Math.round((i+o)*255)]}var se=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function Ge(e){return`data:image/svg+xml,${encodeURIComponent(Ne(e))}`}function Ke(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||le.test(t)||ae.has(t))return null;let n=t in v?[...v[t],1]:pe(t);if(!n)return null;let[r,a,l]=n;return Math.max(r,a,l)-Math.min(r,a,l)>ce?null:(.2126*r+.7152*a+.0722*l)/255}function Ve(e){let t=[],n=r=>{let a=Ke(r);a!==null&&t.push(a)};for(let r of e.matchAll(ue))n(r[4]);for(let r of e.matchAll(me))n(r[2]);return t.length?t.reduce((r,a)=>r+a,0)/t.length<.5:null}var ie=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function ze(e){let t=e;for(let n=ie.exec(t);n&&n[0].length>0;n=ie.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function je(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>se)return null;let a=await n.text();return a.length>se?null:ze(a)?a:null}catch{return null}}async function de(e,t){let n=await je(e,t);return n===null?null:{reversed:Ge(n),inkIsDark:Ve(n)}}import{currentEaselSession as Ze,setSessionBridgedSite as Ht,setSessionDocumentSite as Jt}from"efficient-easel/screen/lib/session";function ge(){return Ze().siteId()}var Xe="",f=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},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]),H=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,nt=15e3,rt=()=>typeof window>"u"?tt:nt;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(rt())}var he=e=>e instanceof Error&&e.name==="TimeoutError",ye=(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})*$/,ke=null;function en(e){ke=e&&ot.test(e)?e:null}function at(){return ke}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:n,baseUrl:r,headers:a,audience:l,...d}=t;if(typeof window<"u"&&!Qe())throw new f(H,et,null);if(typeof window>"u"&&r===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 s=typeof FormData<"u"&&d.body instanceof FormData,i;try{i=await fetch(`${r??Xe}${ct(e)}`,{...d,headers:{...s?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:d.signal??Re({...d,audience:l})})}catch(g){throw g instanceof TypeError||he(g)?new f(H,W,null):g}let o;try{o=await i.text()}catch(g){throw he(g)?new f(H,W,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(i.status,i.ok?"Expected JSON but received a non-JSON response":ye(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??ye(i.status,i.statusText);throw new f(i.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 Te(){return w.getAccess()??xe()}async function h(e,t={}){let n;try{n=await Te()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(r){if(!(r instanceof f)||r.status!==401)throw r;try{let a=await xe();return await c(e,{...t,token:a})}catch{throw w.clear(),r}}}async function fe(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(n){if(!(n instanceof f)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function Se(){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 Te();return await Se(),e},me:Se,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,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),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 n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:n})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?V(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([a,l])=>[S(a),l])):S(r);return t}return e}var Ce=typeof window>"u"&&U!=="",mt=Ce?U:"",pt=j,b=()=>({baseUrl:pt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var dt=100,Pe=50;function Oe(e,t,n){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&r.set(a,String(l));return r.set("pageSize",String(dt)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function gt(e,t){return Oe("/wheels",{process:e},t)}function ht(e,t,n){return Oe("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function we(e,t,n=()=>!1){let r=[],a=null;try{for(let l=0;l<Pe;l++){let d=await c(await t(a),await p());if(r.push(...d.results),a=yt(d.next),!a)break}a&&console.warn(`[${e}] stopped at ${Pe} pages (${r.length} rows); catalog may be truncated`)}catch(l){if(n(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return r}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(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(ee)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Z((await e()).get(B))}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 kt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await _t();if(n===null)return[await y(e),await p(t)];let r=q(await y(e),`${Rt}=${encodeURIComponent(n)}`),{next:a,cache:l,...d}=t??{},s=await p({...d,cache:"no-store"}),i=await kt();return i&&(s.headers={...s.headers,"user-agent":i}),[r,s]}async function xt(e){if(!Ce)return;let[t,n]=await Promise.all([ve(),wt()]),r=Q(t,n,e);return Object.keys(r).length>0?r:void 0}async function p(e){let t=await xt(X(e)),n={baseUrl:mt,...e};return t&&(n.headers={...t,...e?.headers}),n}var _=typeof window>"u";function k(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var on={listMakes:async e=>{if(_){let{fitmentData:n}=await import("./fitment-data-RXCNCZLU.js");return n.makes(e)}return(await c(k("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:r}=await import("./fitment-data-RXCNCZLU.js");return r.models(e,t)}return(await c(k("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(_){let{fitmentData:a}=await import("./fitment-data-RXCNCZLU.js");return a.years(e,t,n)}return(await c(k("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,r)=>{if(_){let{fitmentData:l}=await import("./fitment-data-RXCNCZLU.js");return l.modifications(e,t,n,r)}return(await c(k("/modifications",{make:e,model:t,year:n,region:r}),b())).results},getStockFitment:async(e,t,n,r,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-RXCNCZLU.js");return l.stockFitment(e,t,n,r,a)}return c(k("/stock-fitment",{make:e,model:t,year:n,modification:r,region:a}),b())}},an={listWheels:async e=>{let t=await we("products.listWheels",async n=>await y(gt(e,n)));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 n=await we("products.listCatalog",async r=>await y(ht(e,t,r)),ft);return St(S(n))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await p()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await p())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await p())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await p()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-TD3QJK7L.js");return S(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let a=r.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>c(await y(m("/site")),await p()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await p():void 0),listPages:async()=>S(await c(await y(m("/pages")),await p())),listPopups:async()=>c(await y(m("/popups")),await p()),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await p())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await p())}catch(n){if(n instanceof f&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await p())}catch(n){if(n instanceof f&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await p({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await p())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await p())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[r,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(r,a))},listBlogPosts:async(e={})=>{let t=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+t,await p())).map(r=>({...r,coverImage:C(r.coverImage)??""}))}catch(n){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",n),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await p());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await p({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await p({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await p({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await p({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await p({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await p({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await p({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await p({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await p({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await p({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await p({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await p({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await p({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),r=t.toString();try{return await c(await y(r?`${n}?${r}`:n),await p())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await p({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await p()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await p({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await p())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await p())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await p({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await fe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await fe(m("/coupons/validate"),await p({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Re({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=C(t.logoUrl),r=null,a=null;if(n&&D(n)){let l=await de(n,e);l&&(r=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await p())},cn={listServices:async()=>{try{return await c(m("/bookings/services"),await p())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await p()),create:async e=>c(m("/bookings"),await p({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await p()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await p({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await p({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},I=(e,t,n)=>{let r=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${r?`?${r}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Tt=e=>`${x(e)}currencies/`,Ct="/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=ge();if(!e)throw new K;return`${Ct}?${new URLSearchParams({site:e})}`}var vt="X-Puck-Media-Manifest",be=z.contentHash,F={"X-Media-Manifest":be,[vt]:be},ln=Ee({});function Ee(e){return(t,n={})=>{let r=at(),a=e.headers||r?{...r?{"Accept-Language":r}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function Et(e={}){let t=Ee(e),n=e.siteDrafts===!0,r=s=>I("header-settings",s,n),a=s=>I("theme-settings",s,n),l=s=>I("chat-settings",s,n),d=s=>I("social-settings",s,n);return{findPageBySlug:async(s,i,o)=>{let u=new URLSearchParams({slug:s});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(s,P.length);return P[0]??null},getPageById:(s,i)=>t(`/api/storefront/pages/${s}/`,{token:i}),saveLayout:(s,i,o,u,g)=>t(`/api/storefront/pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(s,i,o)=>t(`/api/storefront/pages/${s}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(s,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:s,country:o}:{q:s})}`,{token:i}),listBlockSources:s=>t("/api/storefront/block-sources/",{token:s}),listRecordTypes:s=>t("/api/storefront/record-types/",{token:s}),createPagePreviewLink:(s,i)=>t(`/api/storefront/pages/${s}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(s,i,o,u=!1)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(s,i)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(s,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:s,layout:i}),headers:F,token:o}),getTemplate:(s,i)=>t(`/api/storefront/page-templates/${s}/`,{token:i}),saveTemplateLayout:(s,i,o)=>t(`/api/storefront/page-templates/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),listTemplatePages:async(s,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(s,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(s,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:s,...i}),headers:F,token:o}),saveTemplatePageLayout:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),deleteTemplatePage:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},createPage:(s,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:s,slug:i,layout:o}),token:u}),deletePage:(s,i)=>t(`/api/storefront/pages/${s}/`,{method:"DELETE",token:i}),getHeaderSettings:(s,i)=>t(r(i),{token:s}),listMenus:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:s});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(s,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.sort_order-T.sort_order||P.name.localeCompare(T.name))},listForms:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.title.localeCompare(T.title))},listWheelSummaries:async(s,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:s});return S(g)},listProducts:async(s,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:s});return S(g)},getWheelDetail:async(s,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:s})))},updateHeaderSettings:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSite:(s,i)=>t(x(s),{token:i}),listSites:async s=>{let i=await t("/api/storefront/sites/?no_page=true",{token:s});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(s,i)=>{let o=await t(Tt(s),{token:i});return Array.isArray(o)?o:[]},publishSite:(s,i)=>t(`${x(s)}publish/`,{method:"POST",token:i}),getSiteLiveState:(s,i)=>t(`${x(s)}live-state/`,{token:i}),updateSite:(s,i,o)=>t(x(s),{method:"PATCH",body:JSON.stringify(i),token:o}),getThemeSettings:(s,i)=>t(a(i),{token:s}),updateThemeSettings:(s,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getChatSettings:(s,i)=>t(l(i),{token:s}),updateChatSettings:(s,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSocialSettings:(s,i)=>t(d(i),{token:s}),updateSocialSettings:(s,i,o)=>t(d(o),{method:"PATCH",body:JSON.stringify(s),token:i}),uploadHeaderLogo:(s,i,o)=>{let u=new FormData;return u.append("logo",s),t(r(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(s,i)=>t(r(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:s}),setHeaderLogoFromAsset:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:s}),token:i}),uploadMedia:async(s,i)=>{let o=new FormData;return o.append("file",s),t(Ot(),{method:"POST",body:o,token:i})},listMedia:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]}}}var un=Et({siteDrafts:!0});export{U as a,Q as b,X as c,w as d,qe as e,D as f,ge as g,Xe as h,f as i,W as j,H as k,Yt as l,en as m,c as n,ut as o,ve as p,Pt as q,wt as r,bt as s,_t as t,on as u,an as v,cn as w,G as x,ln as y,un as z};
1
+ import{a as V,c as C,g as z,i as $,j,l as O}from"./chunk-SQH6XBRG.js";var U="".replace(/\/+$/,"");var B="x-forwarded-for";function Z(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ie="x-forwarded-host";function Q(e,t,n){let r={};return e&&(r[Ie]=e),t&&n==="uncached"&&(r[B]=t),r}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 Fe="shop_access_token",ne="shop_refresh_token",N=null;function L(){O.removeItem(Fe),O.removeItem(ne)}var w={getAccess(){return N},takeLegacyRefresh(){let e=O.getItem(ne);return L(),e},setTokens(e){N=e,L()},clear(){N=null,L()}};import{efficientClientOpen as Qe}from"efficient-easel/screen/lib/session";function qe(e){return!!e.src}function A(e){let t=e.finishes.filter(qe);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function $e(e){return e.listable!==!1}function M(e){return e.map(A).filter($e)}var oe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ae=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]},ce=12,le=/\burl\(/i,ue=new RegExp(`(?<![-\\w])(${oe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),me=new RegExp(`((?:^|[;{\\s"'])(?:${oe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ue=/<svg\b([^>]*)>/i,Be=/\bfill\s*[=:]/i;function Ne(e){let t=e.replace(ue,(n,r,a,l,d)=>{let s=re(d);return s===null?n:`${r}${a}${l}${s}${l}`}).replace(me,(n,r,a)=>{let l=re(a);return l===null?n:`${r}${l}`});return t=t.replace(Ue,(n,r)=>Be.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function re(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||le.test(n)||ae.has(n))return null;let r=n in v?[...v[n],1]:pe(n);if(!r)return null;let[a,l,d,s]=r;if(Math.max(a,l,d)-Math.min(a,l,d)>ce)return null;let i=Le(255-a,255-l,255-d,s);return t?`${i} !important`:i}function Le(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function pe(e){return e.startsWith("#")?Me(e):e.startsWith("rgb")?De(e):e.startsWith("hsl")?Je(e):null}function Me(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function De(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(s=>s.endsWith("%")?Math.round(parseFloat(s)/100*255):Math.round(parseFloat(s)));if(l.some(s=>Number.isNaN(s)))return null;let d=r?E(r):He(n);return[l[0],l[1],l[2],d]}function He(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),d=parseFloat(a[1])/100,s=parseFloat(a[2])/100;if([l,d,s].some(P=>Number.isNaN(P)))return null;let i=r?E(r):a.length>=4?E(a[3]):1,[o,u,g]=We(l,d,s);return[o,u,g,i]}function We(e,t,n){let r=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=r*(1-Math.abs(a%2-1)),d=0,s=0,i=0;a<1?[d,s,i]=[r,l,0]:a<2?[d,s,i]=[l,r,0]:a<3?[d,s,i]=[0,r,l]:a<4?[d,s,i]=[0,l,r]:a<5?[d,s,i]=[l,0,r]:[d,s,i]=[r,0,l];let o=n-r/2;return[Math.round((d+o)*255),Math.round((s+o)*255),Math.round((i+o)*255)]}var se=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function Ge(e){return`data:image/svg+xml,${encodeURIComponent(Ne(e))}`}function Ke(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||le.test(t)||ae.has(t))return null;let n=t in v?[...v[t],1]:pe(t);if(!n)return null;let[r,a,l]=n;return Math.max(r,a,l)-Math.min(r,a,l)>ce?null:(.2126*r+.7152*a+.0722*l)/255}function Ve(e){let t=[],n=r=>{let a=Ke(r);a!==null&&t.push(a)};for(let r of e.matchAll(ue))n(r[4]);for(let r of e.matchAll(me))n(r[2]);return t.length?t.reduce((r,a)=>r+a,0)/t.length<.5:null}var ie=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function ze(e){let t=e;for(let n=ie.exec(t);n&&n[0].length>0;n=ie.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function je(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>se)return null;let a=await n.text();return a.length>se?null:ze(a)?a:null}catch{return null}}async function de(e,t){let n=await je(e,t);return n===null?null:{reversed:Ge(n),inkIsDark:Ve(n)}}import{currentEaselSession as Ze,setSessionBridgedSite as Ht,setSessionDocumentSite as Jt}from"efficient-easel/screen/lib/session";function ge(){return Ze().siteId()}var Xe="",f=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},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]),H=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,nt=15e3,rt=()=>typeof window>"u"?tt:nt;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(rt())}var he=e=>e instanceof Error&&e.name==="TimeoutError",ye=(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})*$/,ke=null;function en(e){ke=e&&ot.test(e)?e:null}function at(){return ke}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:n,baseUrl:r,headers:a,audience:l,...d}=t;if(typeof window<"u"&&!Qe())throw new f(H,et,null);if(typeof window>"u"&&r===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 s=typeof FormData<"u"&&d.body instanceof FormData,i;try{i=await fetch(`${r??Xe}${ct(e)}`,{...d,headers:{...s?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:d.signal??Re({...d,audience:l})})}catch(g){throw g instanceof TypeError||he(g)?new f(H,W,null):g}let o;try{o=await i.text()}catch(g){throw he(g)?new f(H,W,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(i.status,i.ok?"Expected JSON but received a non-JSON response":ye(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??ye(i.status,i.statusText);throw new f(i.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 Te(){return w.getAccess()??xe()}async function h(e,t={}){let n;try{n=await Te()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(r){if(!(r instanceof f)||r.status!==401)throw r;try{let a=await xe();return await c(e,{...t,token:a})}catch{throw w.clear(),r}}}async function fe(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(n){if(!(n instanceof f)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function Se(){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 Te();return await Se(),e},me:Se,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,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),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 n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:n})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?V(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([a,l])=>[S(a),l])):S(r);return t}return e}var Ce=typeof window>"u"&&U!=="",mt=Ce?U:"",pt=j,b=()=>({baseUrl:pt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var dt=100,Pe=50;function Oe(e,t,n){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&r.set(a,String(l));return r.set("pageSize",String(dt)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function gt(e,t){return Oe("/wheels",{process:e},t)}function ht(e,t,n){return Oe("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function we(e,t,n=()=>!1){let r=[],a=null;try{for(let l=0;l<Pe;l++){let d=await c(await t(a),await p());if(r.push(...d.results),a=yt(d.next),!a)break}a&&console.warn(`[${e}] stopped at ${Pe} pages (${r.length} rows); catalog may be truncated`)}catch(l){if(n(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return r}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(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(ee)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Z((await e()).get(B))}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 kt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await _t();if(n===null)return[await y(e),await p(t)];let r=q(await y(e),`${Rt}=${encodeURIComponent(n)}`),{next:a,cache:l,...d}=t??{},s=await p({...d,cache:"no-store"}),i=await kt();return i&&(s.headers={...s.headers,"user-agent":i}),[r,s]}async function xt(e){if(!Ce)return;let[t,n]=await Promise.all([ve(),wt()]),r=Q(t,n,e);return Object.keys(r).length>0?r:void 0}async function p(e){let t=await xt(X(e)),n={baseUrl:mt,...e};return t&&(n.headers={...t,...e?.headers}),n}var _=typeof window>"u";function k(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var on={listMakes:async e=>{if(_){let{fitmentData:n}=await import("./fitment-data-6GK7QQQI.js");return n.makes(e)}return(await c(k("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:r}=await import("./fitment-data-6GK7QQQI.js");return r.models(e,t)}return(await c(k("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(_){let{fitmentData:a}=await import("./fitment-data-6GK7QQQI.js");return a.years(e,t,n)}return(await c(k("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,r)=>{if(_){let{fitmentData:l}=await import("./fitment-data-6GK7QQQI.js");return l.modifications(e,t,n,r)}return(await c(k("/modifications",{make:e,model:t,year:n,region:r}),b())).results},getStockFitment:async(e,t,n,r,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-6GK7QQQI.js");return l.stockFitment(e,t,n,r,a)}return c(k("/stock-fitment",{make:e,model:t,year:n,modification:r,region:a}),b())}},an={listWheels:async e=>{let t=await we("products.listWheels",async n=>await y(gt(e,n)));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 n=await we("products.listCatalog",async r=>await y(ht(e,t,r)),ft);return St(S(n))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await p()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await p())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await p())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await p()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-TD3QJK7L.js");return S(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let a=r.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>c(await y(m("/site")),await p()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await p():void 0),listPages:async()=>S(await c(await y(m("/pages")),await p())),listPopups:async()=>c(await y(m("/popups")),await p()),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await p())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await p())}catch(n){if(n instanceof f&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await p())}catch(n){if(n instanceof f&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await p({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await p())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await p())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[r,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(r,a))},listBlogPosts:async(e={})=>{let t=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+t,await p())).map(r=>({...r,coverImage:C(r.coverImage)??""}))}catch(n){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",n),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await p());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await p({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await p({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await p({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await p({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await p({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await p({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await p({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await p({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await p({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await p({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await p({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await p({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await p({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),r=t.toString();try{return await c(await y(r?`${n}?${r}`:n),await p())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await p({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await p()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await p({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await p())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await p())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await p({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await fe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await fe(m("/coupons/validate"),await p({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Re({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=C(t.logoUrl),r=null,a=null;if(n&&D(n)){let l=await de(n,e);l&&(r=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await p())},cn={listServices:async()=>{try{return await c(m("/bookings/services"),await p())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await p()),create:async e=>c(m("/bookings"),await p({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await p()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await p({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await p({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},I=(e,t,n)=>{let r=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${r?`?${r}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Tt=e=>`${x(e)}currencies/`,Ct="/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=ge();if(!e)throw new K;return`${Ct}?${new URLSearchParams({site:e})}`}var vt="X-Puck-Media-Manifest",be=z.contentHash,F={"X-Media-Manifest":be,[vt]:be},ln=Ee({});function Ee(e){return(t,n={})=>{let r=at(),a=e.headers||r?{...r?{"Accept-Language":r}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function Et(e={}){let t=Ee(e),n=e.siteDrafts===!0,r=s=>I("header-settings",s,n),a=s=>I("theme-settings",s,n),l=s=>I("chat-settings",s,n),d=s=>I("social-settings",s,n);return{findPageBySlug:async(s,i,o)=>{let u=new URLSearchParams({slug:s});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(s,P.length);return P[0]??null},getPageById:(s,i)=>t(`/api/storefront/pages/${s}/`,{token:i}),saveLayout:(s,i,o,u,g)=>t(`/api/storefront/pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(s,i,o)=>t(`/api/storefront/pages/${s}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(s,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:s,country:o}:{q:s})}`,{token:i}),listBlockSources:s=>t("/api/storefront/block-sources/",{token:s}),listRecordTypes:s=>t("/api/storefront/record-types/",{token:s}),createPagePreviewLink:(s,i)=>t(`/api/storefront/pages/${s}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(s,i,o,u=!1)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(s,i)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(s,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:s,layout:i}),headers:F,token:o}),getTemplate:(s,i)=>t(`/api/storefront/page-templates/${s}/`,{token:i}),saveTemplateLayout:(s,i,o)=>t(`/api/storefront/page-templates/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),listTemplatePages:async(s,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(s,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(s,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:s,...i}),headers:F,token:o}),saveTemplatePageLayout:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),deleteTemplatePage:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},createPage:(s,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:s,slug:i,layout:o}),token:u}),deletePage:(s,i)=>t(`/api/storefront/pages/${s}/`,{method:"DELETE",token:i}),getHeaderSettings:(s,i)=>t(r(i),{token:s}),listMenus:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:s});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(s,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.sort_order-T.sort_order||P.name.localeCompare(T.name))},listForms:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.title.localeCompare(T.title))},listWheelSummaries:async(s,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:s});return S(g)},listProducts:async(s,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:s});return S(g)},getWheelDetail:async(s,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:s})))},updateHeaderSettings:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSite:(s,i)=>t(x(s),{token:i}),listSites:async s=>{let i=await t("/api/storefront/sites/?no_page=true",{token:s});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(s,i)=>{let o=await t(Tt(s),{token:i});return Array.isArray(o)?o:[]},publishSite:(s,i)=>t(`${x(s)}publish/`,{method:"POST",token:i}),getSiteLiveState:(s,i)=>t(`${x(s)}live-state/`,{token:i}),updateSite:(s,i,o)=>t(x(s),{method:"PATCH",body:JSON.stringify(i),token:o}),getThemeSettings:(s,i)=>t(a(i),{token:s}),updateThemeSettings:(s,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getChatSettings:(s,i)=>t(l(i),{token:s}),updateChatSettings:(s,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSocialSettings:(s,i)=>t(d(i),{token:s}),updateSocialSettings:(s,i,o)=>t(d(o),{method:"PATCH",body:JSON.stringify(s),token:i}),uploadHeaderLogo:(s,i,o)=>{let u=new FormData;return u.append("logo",s),t(r(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(s,i)=>t(r(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:s}),setHeaderLogoFromAsset:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:s}),token:i}),uploadMedia:async(s,i)=>{let o=new FormData;return o.append("file",s),t(Ot(),{method:"POST",body:o,token:i})},listMedia:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]}}}var un=Et({siteDrafts:!0});export{U as a,Q as b,X as c,w as d,qe as e,D as f,ge as g,Xe as h,f as i,W as j,H as k,Yt as l,en as m,c as n,ut as o,ve as p,Pt as q,wt as r,bt as s,_t as t,on as u,an as v,cn as w,G as x,ln as y,un as z};
@@ -0,0 +1 @@
1
+ import{jsx as ke}from"react/jsx-runtime";import{createContext as hn,useCallback as r,useContext as gn,useMemo as fn,useState as Ie}from"react";import{createContext as he,useContext as M}from"react";import{createContext as Ct}from"react";var ue=Ct(null);var Lt=he(null),D=he({logo:null,placeholder:!1,wordmark:null});function Rn(){let e=M(ue),t=M(Lt),n=M(D),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 mn}from"efficient-easel/draw/client";var Dn="storefront-theme",Pn="sf:theme-mode",Fn="sf:theme-switch",Nn="hide",B="light";function kt(e){return e>=7&&e<18}function vn(e){let{mode:t,override:n,switchShown:a,hour:o}=e;return a&&(n==="light"||n==="dark")?n:t==="auto"?kt(o)?"light":"dark":t==="light"?"light":"dark"}var h={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},It=[{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"}],I={selected:0,themes:It};function ge(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...I}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function P(e,t,n){let a=k(e),o=k(t);if(a===null||o===null)return e;let l=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${a.map((i,d)=>l(i+(o[d]-i)*n)).join("")}`}var Ot={light:"#ffffff",dark:"#0a0a0a"},Gn=["light","dark"];function Bn(e,t){let n=Ot[t],a=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:P(e,a,.1),line:P(e,a,.22),muted:P(n,e,.35),brandInk:t}}function E(e){let t=ge(e);return t.themes[t.selected]}function fe(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 k(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(i=>i+i).join(""):t[1],[a,o,l]=[0,2,4].map(i=>parseInt(n.slice(i,i+2),16));return[a,o,l]}function G(e){let t=k(e);if(t===null)return null;let[n,a,o]=t.map(l=>{let i=l/255;return i<=.04045?i/12.92:((i+.055)/1.055)**2.4});return .2126*n+.7152*a+.0722*o}var Ht=.4,xt=4.5,Rt=3;function Mt(e,t){let n=G(e),a=G(t);if(n===null||a===null)return null;let[o,l]=n>=a?[n,a]:[a,n];return(o+.05)/(l+.05)}var Un={good:"Good","large-only":"Large text only",hard:"Hard to read"};function Wn(e){return e>=xt?"good":e>=Rt?"large-only":"hard"}var F=["#000000","#ffffff"];function O(e){let t=F[0],n=-1;for(let a of F){let o=Mt(e,a);if(o===null)return F[0];o>n&&(n=o,t=a)}return t}var Dt=[.25,.4,.55];function $n(e){let t=k(e);return t===null?[]:Dt.map(n=>"#"+t.map(a=>Math.round(a*(1-n)).toString(16).padStart(2,"0")).join(""))}function zn(e){let t=E(e),n={"--theme-fg":t.text},a=G(t.text);return(a===null||a>=Ht)&&(n["--overlay-fg"]=t.text),n}var Pt=82;function U(e){return`color-mix(in srgb, ${e} ${Pt}%, #000)`}function Vn(e){let t=E(e);return{"--theme-accent":t.accent,"--theme-accent-2":U(t.accent),"--theme-accent-ink":O(t.accent)}}function W(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Yn(e){let t=E(e),n=W(t),a=me(t);if(n===null&&a===null)return{};let o={};return n!==null&&(o["--theme-btn"]=n,o["--theme-btn-2"]=U(n)),o["--theme-btn-ink"]=a??O(n),o}function me(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Ft(e,t){return me(e)??O(W(e)??t)}function Xn(e){let t=E(e);return{fill:W(t)??t.accent.toLowerCase(),ink:Ft(t,t.accent)}}function jn(e){let t={};return ge(e).themes.forEach((n,a)=>{let o=fe(n);t[`--theme-preset-${a}-accent`]=o.accent,t[`--theme-preset-${a}-accent-2`]=U(o.accent),t[`--theme-preset-${a}-accent-ink`]=O(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 qn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Kn(e){let t=fe(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 Nt=["heading","body","label"];function Zn(e){if(!e)return null;for(let t of Nt)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var Se=["headingLarge","headingMedium","headingSmall","accent","body","label"];var $={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},vt=8,Gt=200;function Bt(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=vt&&t<=Gt?t:null}function Ut(e){let t={};for(let n of Se)t[n]=Bt(e?.[n]);return t}function Jn(e){let t=Ut(e),n={};for(let a of Se){let o=t[a];o!==null&&(n[`--size-${a}`]=`${o}px`)}return n}var Wt=["square","small","large"],$t="small";function Qn(e){return Wt.includes(e??"")?e:$t}var pe=0,zt=40,ea={square:0,small:null,large:16},Vt={"--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 _e(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(zt,Math.max(pe,Math.round(t))):null}function Yt(e){let t=_e(e);return t===null?{}:Object.fromEntries(Object.entries(Vt).map(([n,a])=>{let o=t*a/16;return[n,o===0?"0":`${o}rem`]}))}function ta(e){return Yt(_e(e)??pe)}var Xt=["none","soft","lifted"],jt="soft",ye="none",qt=["tight","normal","roomy"],Kt="normal",H="normal",Zt=["none","lift","highlight"],Jt="lift",Qt="highlight",Ee="#141416";function be(e){return Xt.includes(e??"")?e:jt}function en(e){return qt.includes(e??"")?e:Kt}function Te(e){return Zt.includes(e??"")?e:Jt}function tn(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():Ee}function na(e){let t=be(e);return t===ye?void 0:t}function aa(e){let t=en(e);return t===H?void 0:t}function oa(e){let t=Te(e);return t===Qt?void 0:t}function sa(e,t,n){let a=tn(t);return a===Ee?{}:be(e)!==ye||Te(n)==="lift"?{"--sf-shadow-color":a}:{}}var nn=["normal","tight","compressed"],b="normal";function Ae(e){return nn.includes(e??"")?e:b}function ra(e){let t=Ae(e);return t===b?void 0:t}function ia(e){switch(Ae(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"},N=100,v=900,an=24,on=200;function L(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function we(e){let t=L(e?.weight,N,v),n=e?.case==="sentence"?"sentence":"authored",a=l=>l==null?t:L(l,N,v),o=l=>l==="sentence"?"sentence":l==="authored"?"authored":n;return{case:n,weight:t,weightStrong:L(e?.weightStrong,N,v),italicStrong:typeof e?.italicStrong=="boolean"?e.italicStrong:null,maxPx:L(e?.maxPx,an,on),weight2:a(e?.weight2),weight3:a(e?.weight3),case2:o(e?.case2),case3:o(e?.case3)}}function la(e){let t=we(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 ca(e){return we({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 Ce=[{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(Ce.map(e=>[e.key,e]));function ua(e){return f.get(e)}var Le=["heading","heading2","heading3","body","accent","label"],ha={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},sn=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],rn=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,ga={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},ln={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function fa(e){let t=e?rn.exec(e):null;return t?ln[t[1]]??null:cn(e)}function cn(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 sn)if(t.includes(n))return a;return null}var u={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function dn(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:u.heading}return u[n]};return Object.fromEntries(Le.map(n=>[n,t(n)]))}function un(e,t){return f.get(e[t])??f.get(u[t])}function g(e,t){return`var(${un(e,t).cssVar})`}var ma=[...new Set(Le.map(e=>f.get(u[e]).cssVar))],Sa=[...new Set(Ce.map(e=>e.cssVar))];function pa(e){let t=dn(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 He=hn({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:B,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:I,setTheme:()=>{},fonts:u,setFonts:()=>{},sizes:$,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,cardThemeIndex:null,heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},sectionBackgroundWidth:null,setSectionBackgroundWidth:()=>{},sectionContentWidth:null,setSectionContentWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},shareButtonOnPosts:null,setShareButtonOnPosts:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function Ca({children:e,websiteName:t=null,templateChrome:n=!1,templateName:a=null,chromePlaceholder:o=!1,themeMode:l=B,onThemeModeChange:i,themeSwitchShown:d=!1,onThemeSwitchShownChange:T,theme:A=I,onThemeChange:m,fonts:S=u,onFontsChange:p,sizes:_=$,onSizesChange:c,cornerRadiusPx:x=null,onCornerRadiusPxChange:w,cardShadow:R=null,onCardShadowChange:C,shadowColor:Pe=null,onShadowColorChange:V,cardGap:Fe=H,onCardGapChange:Y,hoverEffect:Ne=null,onHoverEffectChange:X,headingCompression:ve=b,onHeadingCompressionChange:j,siteWidth:Ge=null,onSiteWidthChange:q,siteGutter:Be=null,blockGap:Ue=null,onSiteGutterChange:K,onBlockGapChange:Z,headingTypography:We=z,onHeadingTypographyChange:J,textStyles:$e=null,onTextStylesChange:Q,wordStyles:ze=null,cardThemeIndex:Ve=null,heroBackgroundFollowsWidth:Ye=null,onHeroBackgroundFollowsWidthChange:ee,sectionBackgroundWidth:Xe=null,onSectionBackgroundWidthChange:te,sectionContentWidth:je=null,onSectionContentWidthChange:ne,photographyGrayscale:qe=null,onPhotographyGrayscaleChange:ae,shareButtonOnPosts:Ke=null,onShareButtonOnPostsChange:oe,themeFromDocument:se=!1}){let[y,re]=Ie(null),Ze=r(s=>re(wt=>wt??s),[]),[Je,Qe]=Ie(!1),et=r(s=>i?.(s),[i]),tt=r(s=>T?.(s),[T]),nt=r(s=>m?.(s),[m]),at=r(s=>p?.(s),[p]),ot=r(s=>c?.(s),[c]),st=r(s=>q?.(s),[q]),rt=r(s=>K?.(s),[K]),it=r(s=>Z?.(s),[Z]),lt=r(s=>ee?.(s),[ee]),ct=r(s=>te?.(s),[te]),dt=r(s=>ne?.(s),[ne]),ut=r(s=>ae?.(s),[ae]),ht=r(s=>oe?.(s),[oe]),gt=r(s=>w?.(s),[w]),ft=r(s=>C?.(s),[C]),mt=r(s=>V?.(s),[V]),St=r(s=>Y?.(s),[Y]),pt=r(s=>X?.(s),[X]),_t=r(s=>j?.(s),[j]),yt=r(s=>J?.(s),[J]),Et=r(s=>Q?.(s),[Q]),{select:bt,setSelectHandler:Tt}=mn(),ie=y?.logoUrl,le=y?.logoReversed,ce=y?.logoInkIsDark,de=y!==null,At=fn(()=>({logo:de?{logoUrl:ie,logoReversed:le,logoInkIsDark:ce}:null,placeholder:n||o,wordmark:n?a:t}),[de,ie,le,ce,n,o,a,t]);return ke(D.Provider,{value:At,children:ke(He.Provider,{value:{settings:y,setSettings:re,primeSettings:Ze,websiteName:t,templateChrome:n,templateName:a,chromePlaceholder:o,themeMode:l,setThemeMode:et,themeSwitchShown:d,setThemeSwitchShown:tt,theme:A,setTheme:nt,fonts:S,setFonts:at,sizes:_,setSizes:ot,cornerRadiusPx:x,setCornerRadiusPx:gt,cardShadow:R,setCardShadow:ft,shadowColor:Pe,setShadowColor:mt,cardGap:Fe,setCardGap:St,hoverEffect:Ne,setHoverEffect:pt,headingCompression:ve,setHeadingCompression:_t,siteWidth:Ge,setSiteWidth:st,siteGutter:Be,blockGap:Ue,setSiteGutter:rt,setBlockGap:it,headingTypography:We,setHeadingTypography:yt,textStyles:$e,setTextStyles:Et,wordStyles:ze,cardThemeIndex:se?null:Ve,heroBackgroundFollowsWidth:Ye,setHeroBackgroundFollowsWidth:lt,sectionBackgroundWidth:Xe,setSectionBackgroundWidth:ct,sectionContentWidth:je,setSectionContentWidth:dt,photographyGrayscale:qe,setPhotographyGrayscale:ut,shareButtonOnPosts:Ke,setShareButtonOnPosts:ht,themeFromDocument:se,selected:Je,setSelected:Qe,select:bt,setSelectHandler:Tt},children:e})})}var La=()=>gn(He);import{forwardRef as Sn}from"react";import{imageCopyUrl as xe,imageSrcSet as Re}from"efficient-shell/image-copies";import{jsx as yn}from"react/jsx-runtime";var pn={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"};function Me(e,t,n){if(n){let a=Re(e);return a?{src:xe(e,1280),srcSet:a,sizes:n}:{src:e,sizes:n}}if(t&&t>0){let a=Re(e,{maxWidth:t*3});return a?{src:xe(e,t*2),srcSet:a,sizes:`${t}px`}:{src:e}}return{src:e}}var _n=Sn(function({src:t,width:n,height:a,fill:o,priority:l,loading:i,style:d,quality:T,placeholder:A,blurDataURL:m,unoptimized:S,loader:p,overrideSrc:_,sizes:c,...x},w){let R=_??(typeof t=="string"?t:t.src),C=Me(R,o?void 0:Number(n)||void 0,c??(o?"100vw":void 0));return yn("img",{ref:w,...C,width:o?void 0:n,height:o?void 0:a,loading:l?"eager":i??"lazy",fetchPriority:l?"high":void 0,decoding:"async",style:o?{...pn,...d}:{color:"transparent",...d},...x})}),Ha=_n;function xa(e){let t=e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),n=e.fill?void 0:Number(e.width)||void 0;return{props:Me(t,n,e.sizes??(e.fill?"100vw":void 0))}}import{forwardRef as En}from"react";import{jsx as An}from"react/jsx-runtime";function bn(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 Tn=En(function({href:t,prefetch:n,replace:a,scroll:o,shallow:l,legacyBehavior:i,passHref:d,locale:T,onClick:A,children:m,...S},p){let _=c=>{A?.(c),!(c.defaultPrevented||S.target==="_blank")&&c.preventDefault()};return An("a",{ref:p,href:bn(t),onClick:_,...S,children:m})}),Pa=Tn;var wn="Website";function va(e){return e?.trim()||wn}var De=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp","telegram","line","wechat"],Cn={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp",telegram:"Telegram",line:"LINE",wechat:"WeChat"},Ln={};function Ba(e){if(!e||typeof e!="object")return Ln;let t={};for(let n of De){let a=e[n];if(typeof a!="string")continue;let o=a.trim();!o||!/^https?:\/\//i.test(o)||(t[n]=o)}return t}function Ua(e){return De.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:Cn[t]}]:[]})}var Wa=e=>`${e}_url`;var za={small:54,medium:66,large:84},kn=44,Va=16,Ya=140,Xa=kn*4;export{Ha as a,xa as b,Pa as c,Ce as d,ua as e,Le as f,ha as g,ga as h,fa as i,cn as j,u as k,dn as l,pa as m,Dn as n,Pn as o,Fn as p,Nn as q,B as r,vn as s,h as t,It as u,ge as v,Gn as w,Bn as x,E as y,fe as z,Mt as A,Un as B,Wn as C,O as D,$n as E,zn as F,Vn as G,W as H,Yn as I,me as J,Ft as K,Xn as L,jn as M,qn as N,Kn as O,Zn as P,$ as Q,Ut as R,Jn as S,Qn as T,pe as U,zt as V,ea as W,_e as X,Yt as Y,ta as Z,Xt as _,jt as $,ye as aa,H as ba,Zt as ca,Jt as da,Qt as ea,Ee as fa,be as ga,en as ha,Te as ia,tn as ja,na as ka,aa as la,oa as ma,sa as na,b as oa,Ae as pa,ra as qa,ia as ra,z as sa,we as ta,la as ua,ca as va,ue as wa,Rn as xa,Ca as ya,La as za,wn as Aa,va as Ba,De as Ca,Cn as Da,Ln as Ea,Ba as Fa,Ua as Ga,Wa as Ha,za as Ia,kn as Ja,Va as Ka,Ya as La,Xa as Ma};