efficient-storefront-blocks 0.124.1 → 0.125.1

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 (90) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/chunks/{CustomHtmlCodeWindow-6QU56I6L.js → CustomHtmlCodeWindow-VRZ524JP.js} +3 -3
  3. package/dist/chunks/{EditorPreviewCheckout-TRX42H6I.js → EditorPreviewCheckout-3TKWZ44N.js} +1 -1
  4. package/dist/chunks/SiteEditorProvider-OBXLJM7I.js +1 -0
  5. package/dist/chunks/chunk-4KN3VTQU.js +7 -0
  6. package/dist/chunks/chunk-6ABZ7XWF.js +96 -0
  7. package/dist/chunks/{chunk-ESQTNC7T.js → chunk-FNCEZSDY.js} +3 -3
  8. package/dist/chunks/{chunk-S5N6H2MP.js → chunk-HQFRQZ6J.js} +1 -1
  9. package/dist/chunks/chunk-J6SPMJBT.js +337 -0
  10. package/dist/chunks/{chunk-YCL4MPLF.js → chunk-PULBLZRR.js} +1 -1
  11. package/dist/chunks/{chunk-CDKQFBBA.js → chunk-TVMCJUOE.js} +1 -1
  12. package/dist/chunks/chunk-UV27QVUD.js +2 -0
  13. package/dist/chunks/{fitment-data-MXT6XIW5.js → fitment-data-C2NHZBPR.js} +1 -1
  14. package/dist/chunks/section-css-style-BECHWIDU.js +1 -0
  15. package/dist/contract.js +1 -1
  16. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  17. package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/commerce/ProductHero/fields.js +1 -1
  19. package/dist/editor/lib/document/blocks/commerce/ProductSku/fields.d.ts +2 -0
  20. package/dist/editor/lib/document/blocks/commerce/ProductSku/fields.js +1 -0
  21. package/dist/editor/lib/document/blocks/commerce/SpecTable/fields.js +1 -1
  22. package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
  23. package/dist/editor/lib/document/blocks/commerce/index.js +1 -1
  24. package/dist/editor/lib/document/config.js +1 -1
  25. package/dist/editor/lib/document/section-text-regions.js +1 -1
  26. package/dist/editor/lib/storefront-editor-words.d.ts +5 -0
  27. package/dist/editor/lib/storefront-editor-words.js +1 -1
  28. package/dist/editor.css +1 -1
  29. package/dist/index.js +39 -30
  30. package/dist/render/built-with.json +1 -1
  31. package/dist/render/components/GalleryGrid.js +3 -3
  32. package/dist/render/components/GalleryItem.d.ts +6 -0
  33. package/dist/render/components/GalleryItem.js +1 -1
  34. package/dist/render/components/LinkedProductHero.d.ts +1 -0
  35. package/dist/render/components/ProductGallery.d.ts +1 -1
  36. package/dist/render/components/ProductGallery.js +1 -1
  37. package/dist/render/components/ProductHeroPanel.d.ts +2 -1
  38. package/dist/render/components/ProductHeroPanel.js +1 -1
  39. package/dist/render/components/card-pieces/HeadlineName.js +1 -1
  40. package/dist/render/components/card-pieces/ProductCardState.d.ts +1 -0
  41. package/dist/render/components/pdp-dynamic/DynamicProductHero.d.ts +1 -0
  42. package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +1 -0
  43. package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
  44. package/dist/render/components/product-hero/hero-view.d.ts +1 -0
  45. package/dist/render/components/product-hero/hero-view.js +1 -1
  46. package/dist/render/components/useStickyColumns.d.ts +2 -0
  47. package/dist/render/components/useStickyColumns.js +1 -0
  48. package/dist/render/lib/catalog/from-wheel.js +1 -1
  49. package/dist/render/lib/catalog/part-skus.d.ts +2 -0
  50. package/dist/render/lib/catalog/part-skus.js +1 -0
  51. package/dist/render/lib/content/hero-seed.d.ts +1 -1
  52. package/dist/render/lib/content/hero-seed.js +1 -1
  53. package/dist/render/lib/content/product-card-seed.d.ts +1 -0
  54. package/dist/render/lib/content/product-card-seed.js +1 -1
  55. package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
  56. package/dist/render/lib/document/blocks/commerce/ProductName/meta.js +1 -1
  57. package/dist/render/lib/document/blocks/commerce/ProductSku/meta.d.ts +2 -0
  58. package/dist/render/lib/document/blocks/commerce/ProductSku/meta.js +1 -0
  59. package/dist/render/lib/document/blocks/commerce/ProductSku/render.d.ts +2 -0
  60. package/dist/render/lib/document/blocks/commerce/ProductSku/render.js +1 -0
  61. package/dist/render/lib/document/blocks/commerce/SpecTable/render.js +1 -1
  62. package/dist/render/lib/document/blocks/commerce/metas.d.ts +1 -0
  63. package/dist/render/lib/document/blocks/commerce/metas.js +1 -1
  64. package/dist/render/lib/document/blocks/commerce/renders.d.ts +1 -0
  65. package/dist/render/lib/document/blocks/commerce/renders.js +1 -1
  66. package/dist/render/lib/document/card-templates.js +1 -1
  67. package/dist/render/lib/document/lazy-draws.js +1 -1
  68. package/dist/render/lib/sections/hero-gallery.d.ts +2 -2
  69. package/dist/render/lib/sections/hero-gallery.js +1 -1
  70. package/dist/render/lib/sections/hero-sticky.d.ts +4 -0
  71. package/dist/render/lib/sections/hero-sticky.js +1 -0
  72. package/dist/render/lib/sections/product-card-text-regions.d.ts +1 -0
  73. package/dist/render/lib/sections/product-card-text-regions.js +1 -1
  74. package/dist/render/lib/wheels/spec-sheet.d.ts +19 -0
  75. package/dist/render/lib/wheels/spec-sheet.js +1 -1
  76. package/dist/routine-index.json +1 -1
  77. package/dist/value-index.json +1 -1
  78. package/dist/words.d.ts +14 -0
  79. package/dist/words.js +5 -5
  80. package/package.json +4 -4
  81. package/dist/chunks/SiteEditorProvider-IBJ5A5V3.js +0 -1
  82. package/dist/chunks/chunk-EKCLPISP.js +0 -96
  83. package/dist/chunks/chunk-MC6E4ZLD.js +0 -339
  84. package/dist/chunks/chunk-O5WPKRAC.js +0 -2
  85. package/dist/chunks/chunk-T7CS442T.js +0 -4
  86. package/dist/chunks/section-css-style-ZZ3ZOGPR.js +0 -1
  87. /package/dist/chunks/{chunk-27GSFHNV.js → chunk-7UJXVH57.js} +0 -0
  88. /package/dist/chunks/{chunk-JJ5MCDPE.js → chunk-EZ5QLDA5.js} +0 -0
  89. /package/dist/chunks/{chunk-ESQTNC7T.js.LEGAL.txt → chunk-FNCEZSDY.js.LEGAL.txt} +0 -0
  90. /package/dist/chunks/{chunk-MC6E4ZLD.js.LEGAL.txt → chunk-J6SPMJBT.js.LEGAL.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.125.1 — 2026-11-22 — Accept efficient-shell 15; take efficient-web-builder 74.6 and efficient-easel 37.4
4
+
5
+ **For hosts:** the `efficient-shell` peer widens to `^14.5.1 || ^15.0.0`, so a
6
+ host may move to efficient-shell 15 (the admin portal pins `^15.1.0`). The
7
+ `efficient-web-builder` peer is now `^74.6.0` and `efficient-easel` `^37.4.0`,
8
+ the first releases that accept shell 15. Hosts on shell 14 need do nothing
9
+ else.
10
+
11
+ - **efficient-shell 15 accepted as a peer.** This repository still develops
12
+ against the floor, `^14.5.1`.
13
+ - **efficient-web-builder 74.6.0.** Takes 74.4.0's two block settings (the
14
+ Contents block can mark the current section; a FAQ question can open from a
15
+ link), both off by default, and drops this repository's ProductSku allowance
16
+ now that the builder puts the SKU part in the commerce set. The editor's word
17
+ list gains those settings' four phrases.
18
+ - **The Header settings panel's standalone Drawer drops `side` and `size`**:
19
+ efficient-shell 15 removed them (drawers come from the bottom only). The
20
+ editor mounts the panel inline in its inspector, so nothing a shopper or
21
+ editor sees changes.
22
+
23
+ ## 0.125.0 — 2026-11-22 — The product page's hero - a Stacked gallery, an SKU part, pinned columns and a collection crumb link
24
+
25
+ **For hosts:** the peers move to `efficient-web-builder ^74.3.0` and
26
+ `efficient-easel ^37.3.2`. Install those first. The storefront re-vendors
27
+ `src/` with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`.
28
+
29
+ - **The collection crumb opens the filtered list**: on a wheel page the crumb
30
+ "Home / Wheels / <collection> / <wheel>" links to `/wheels?collection=<name>`,
31
+ the collection the listing matches the wheel by. A wheel in no collection,
32
+ or only in blank ones, links to `/wheels`. The link narrows the list when
33
+ the site's `/wheels` listing has a collection filter (site data).
34
+ - **A Stacked gallery**: the Product Gallery's Gallery row is a dropdown with
35
+ a fourth mode, Stacked: from the tablet width up, the photos stand one
36
+ under another (each opens the zoom); on a phone, one photo with a swipe.
37
+ The default stays Main + thumbs.
38
+ - **An SKU part**: the Product Hero's template offers an SKU part (not
39
+ seeded). It shows the chosen set's part numbers, each once, joined " / ".
40
+ - **Pin columns while scrolling**: a toggle in the Product Hero's Arrangement, default
41
+ off, for Split and Image right. On a wide screen each column stays in view
42
+ while the other scrolls; a column taller than the screen keeps its bottom
43
+ at the screen's bottom.
44
+ - **The wheel sheet's own rows can be hidden**: the Spec Table's wheel sheet
45
+ rows each get a Display row, so a merchant hides one without hiding the
46
+ sheet.
47
+ - **The photo popup walks the whole Gallery**: opened from one photo, the
48
+ popup steps through every photo of the Gallery, not only that one.
49
+ - **The name's own size never breaks inside a word**: the Product Name is
50
+ capped to its column's fit.
51
+
3
52
  ## 0.124.1 — 2026-11-21 — Latest Posts can leave out the article's own post; the product name follows its text style
4
53
 
5
54
  **For hosts:** nothing to change. The storefront re-vendors `src/` with `node scripts/sync-storefront-blocks.mjs`. The package no longer lists the code-editor packages (`@codemirror/*`, `@lezer/*`, `prettier`) as its own peers: `efficient-shell` declares them, and a host installs them for it as before.
@@ -1,10 +1,10 @@
1
- "use client";import{b as oe,d as ne,e as ae}from"./chunk-ESQTNC7T.js";import{Ab as Z,Nd as ee,Pd as I,Rd as te,Rg as le,_j as ie,bk as ce,g as i,hk as de,mk as me,nk as ue,ok as fe,sk as he}from"./chunk-T7CS442T.js";import{e as se}from"./chunk-O5WPKRAC.js";import{Hf as J,Qg as B,_f as Y,ji as re,ka as X,wb as K}from"./chunk-EKCLPISP.js";import"./chunk-27GSFHNV.js";import"./chunk-Y6SLVHK3.js";import{jsx as n,jsxs as v,Fragment as Be}from"react/jsx-runtime";import{Suspense as Ge,useContext as Ue,useEffect as Se,useMemo as _,useRef as Te,useState as S}from"react";import{AccordionHeading as H,Banner as We,Button as D,Card as Ve,Dialog as qe,DropdownMenu as Qe,Segmented as Xe,Text as w,buttonClasses as Ke,colorFill as Je,colorSwatchClasses as Ye,fitFrameStyle as Ze,fitScale as et}from"efficient-shell/ui";import{CodeEditor as tt}from"efficient-shell/code";import{ChevronDownIcon as st}from"efficient-shell/icons/efficient";import{AlignSeparateIcon as ot}from"efficient-easel/icons";import{ScreenDocumentContext as nt}from"efficient-easel/screen/components/ScreenDocumentContext";var pe=".my-part";function ge(e,t,o,s){let a=_e(e,t);if(a)return De(e,t,o,s,a);let r=Fe(e,t);return r?Re(e,t,o,s,r):A(e,t,ve(s))}function _e(e,t){let o=/<style\b[^>]*>/gi;for(let s=o.exec(e);s;s=o.exec(e)){let a=s.index+s[0].length,r=e.toLowerCase().indexOf("</style",a),c=r<0?e.length:r;if(t>=a&&t<=c)return{start:a,end:c,close:r};o.lastIndex=c}return null}function He(e){return e.replace(/\/\*[\s\S]*?(\*\/|$)/g,t=>" ".repeat(t.length))}function De(e,t,o,s,a){let r=He(e.slice(a.start,a.end)),c=t-a.start,u=r[c-1]===" "&&e.slice(a.start,a.end)[c-1]!==" ",d=0,m="";for(let g=0;g<c;g++){let x=r[g];x==="{"?(d++,m=x):x==="}"?(d=Math.max(0,d-1),m=x):(x===";"||x===":")&&(m=x)}let p=r.slice(r.lastIndexOf(":",c-1)+1,c).trim();if(s.kind==="value"&&d>0&&m===":"&&!u&&(p===""||o>t))return{from:t,to:o,insert:s.value,selectFrom:t,selectTo:t+s.value.length};if(s.kind!=="value"){let g=a.close<0?e.length:e.indexOf(">",a.close)+1;return A(e,g-1,s.kind==="class"?ve(s):s.code)}let f=-1;if(d>0)f=ye(r,c,d);else{let g=r.slice(c).search(/[{}]/);g>=0&&r[c+g]==="{"&&(f=ye(r,c+g+1,1))}let h=f<0?t:a.start+f,b=f<0?-1:Le(r,f),$=b<0?pe:Pe(r,b)||pe,k=we(e,b<0?h:a.start+b);return A(e,h,`${k}${$} { ${s.property}: ${s.value}; }`,!0)}function ye(e,t,o){for(let s=t;s<e.length;s++)if(e[s]==="{")o++;else if(e[s]==="}"&&--o===0)return s;return-1}function Le(e,t){let o=0;for(let s=t;s>=0;s--)if(e[s]==="}")o++;else if(e[s]==="{"&&--o===0)return s;return-1}function Pe(e,t){let o=Math.max(e.lastIndexOf("}",t-1),e.lastIndexOf(";",t-1),e.lastIndexOf("{",t-1))+1;return e.slice(o,t).replace(/\s+/g," ").trim()}function Fe(e,t){let o=e.lastIndexOf("<",t-1);if(o<0||e.lastIndexOf(">",t-1)>o||/[/!?]/.test(e[o+1]??""))return null;let s=e.indexOf(">",t);return s<0?null:{lt:o,gt:s}}function Re(e,t,o,s,a){if(s.kind==="block")return A(e,a.gt,s.code);let r=s.kind==="value"?"style":"class",c=e.slice(a.lt,a.gt),u=new RegExp(`\\s${r}\\s*=\\s*(["'])([\\s\\S]*?)\\1`,"i").exec(c);if(u){let p=a.lt+u.index+u[0].length-1-u[2].length,f=p+u[2].length;if(t>=p&&t<=f){let k=e.slice(p,t);if(s.kind==="value"&&(/:\s*$/.test(k)||o>t&&/:[^;]*$/.test(k)))return M(t,o,s.value);if(s.kind==="class"&&!(/\S$/.test(k)&&/^\S/.test(e.slice(t,f)))){let g=`${/\S$/.test(k)?" ":""}${s.className}${/^\S/.test(e.slice(t,f))?" ":""}`;return M(t,t,g)}}let h=u[2].trimEnd(),b=s.kind==="value"?`${h&&!h.endsWith(";")?";":""}${h?" ":""}${s.property}: ${s.value}`:`${h?" ":""}${s.className}`,$=p+h.length;return M($,$,b)}let d=e[a.gt-1]==="/"?a.gt-1:a.gt,m=s.kind==="value"?` style="${s.property}: ${s.value}"`:` class="${s.className}"`;return M(d,d,m)}function ve(e){return e.kind==="block"?e.code:e.kind==="class"?`<p class="${e.className}">Text</p>`:`<div style="${e.property}: ${e.value}">Text</div>`}function M(e,t,o){return{from:e,to:t,insert:o,selectFrom:e,selectTo:e+o.length}}function we(e,t){let o=e.lastIndexOf(`
1
+ "use client";import{b as ee,d as te,e as se}from"./chunk-FNCEZSDY.js";import{Kk as ie,Nk as ce,Pb as oe,Tk as de,de as ne,fe as I,g as i,he as ae,nl as me,ol as ue,pl as fe,tl as he,yh as le}from"./chunk-4KN3VTQU.js";import{d as Z}from"./chunk-UV27QVUD.js";import{Jf as J,Rg as B,ag as Y,ki as re,la as X,xb as K}from"./chunk-6ABZ7XWF.js";import"./chunk-7UJXVH57.js";import"./chunk-Y6SLVHK3.js";import{jsx as n,jsxs as v,Fragment as Be}from"react/jsx-runtime";import{Suspense as Ge,useContext as Ue,useEffect as Se,useMemo as _,useRef as Te,useState as S}from"react";import{AccordionHeading as H,Banner as We,Button as D,Card as Ve,Dialog as qe,DropdownMenu as Qe,Segmented as Xe,Text as w,buttonClasses as Ke,colorFill as Je,colorSwatchClasses as Ye,fitFrameStyle as Ze,fitScale as et}from"efficient-shell/ui";import{CodeEditor as tt}from"efficient-shell/code";import{ChevronDownIcon as st}from"efficient-shell/icons/efficient";import{AlignSeparateIcon as ot}from"efficient-easel/icons";import{ScreenDocumentContext as nt}from"efficient-easel/screen/components/ScreenDocumentContext";var pe=".my-part";function ge(e,t,o,s){let a=_e(e,t);if(a)return De(e,t,o,s,a);let r=Fe(e,t);return r?Re(e,t,o,s,r):A(e,t,ve(s))}function _e(e,t){let o=/<style\b[^>]*>/gi;for(let s=o.exec(e);s;s=o.exec(e)){let a=s.index+s[0].length,r=e.toLowerCase().indexOf("</style",a),c=r<0?e.length:r;if(t>=a&&t<=c)return{start:a,end:c,close:r};o.lastIndex=c}return null}function He(e){return e.replace(/\/\*[\s\S]*?(\*\/|$)/g,t=>" ".repeat(t.length))}function De(e,t,o,s,a){let r=He(e.slice(a.start,a.end)),c=t-a.start,u=r[c-1]===" "&&e.slice(a.start,a.end)[c-1]!==" ",d=0,m="";for(let g=0;g<c;g++){let x=r[g];x==="{"?(d++,m=x):x==="}"?(d=Math.max(0,d-1),m=x):(x===";"||x===":")&&(m=x)}let p=r.slice(r.lastIndexOf(":",c-1)+1,c).trim();if(s.kind==="value"&&d>0&&m===":"&&!u&&(p===""||o>t))return{from:t,to:o,insert:s.value,selectFrom:t,selectTo:t+s.value.length};if(s.kind!=="value"){let g=a.close<0?e.length:e.indexOf(">",a.close)+1;return A(e,g-1,s.kind==="class"?ve(s):s.code)}let f=-1;if(d>0)f=ye(r,c,d);else{let g=r.slice(c).search(/[{}]/);g>=0&&r[c+g]==="{"&&(f=ye(r,c+g+1,1))}let h=f<0?t:a.start+f,b=f<0?-1:Le(r,f),$=b<0?pe:Pe(r,b)||pe,k=we(e,b<0?h:a.start+b);return A(e,h,`${k}${$} { ${s.property}: ${s.value}; }`,!0)}function ye(e,t,o){for(let s=t;s<e.length;s++)if(e[s]==="{")o++;else if(e[s]==="}"&&--o===0)return s;return-1}function Le(e,t){let o=0;for(let s=t;s>=0;s--)if(e[s]==="}")o++;else if(e[s]==="{"&&--o===0)return s;return-1}function Pe(e,t){let o=Math.max(e.lastIndexOf("}",t-1),e.lastIndexOf(";",t-1),e.lastIndexOf("{",t-1))+1;return e.slice(o,t).replace(/\s+/g," ").trim()}function Fe(e,t){let o=e.lastIndexOf("<",t-1);if(o<0||e.lastIndexOf(">",t-1)>o||/[/!?]/.test(e[o+1]??""))return null;let s=e.indexOf(">",t);return s<0?null:{lt:o,gt:s}}function Re(e,t,o,s,a){if(s.kind==="block")return A(e,a.gt,s.code);let r=s.kind==="value"?"style":"class",c=e.slice(a.lt,a.gt),u=new RegExp(`\\s${r}\\s*=\\s*(["'])([\\s\\S]*?)\\1`,"i").exec(c);if(u){let p=a.lt+u.index+u[0].length-1-u[2].length,f=p+u[2].length;if(t>=p&&t<=f){let k=e.slice(p,t);if(s.kind==="value"&&(/:\s*$/.test(k)||o>t&&/:[^;]*$/.test(k)))return M(t,o,s.value);if(s.kind==="class"&&!(/\S$/.test(k)&&/^\S/.test(e.slice(t,f)))){let g=`${/\S$/.test(k)?" ":""}${s.className}${/^\S/.test(e.slice(t,f))?" ":""}`;return M(t,t,g)}}let h=u[2].trimEnd(),b=s.kind==="value"?`${h&&!h.endsWith(";")?";":""}${h?" ":""}${s.property}: ${s.value}`:`${h?" ":""}${s.className}`,$=p+h.length;return M($,$,b)}let d=e[a.gt-1]==="/"?a.gt-1:a.gt,m=s.kind==="value"?` style="${s.property}: ${s.value}"`:` class="${s.className}"`;return M(d,d,m)}function ve(e){return e.kind==="block"?e.code:e.kind==="class"?`<p class="${e.className}">Text</p>`:`<div style="${e.property}: ${e.value}">Text</div>`}function M(e,t,o){return{from:e,to:t,insert:o,selectFrom:e,selectTo:e+o.length}}function we(e,t){let o=e.lastIndexOf(`
2
2
  `,t-1)+1;return/^[ \t]*/.exec(e.slice(o))[0]}function A(e,t,o,s=!1){let a=e.lastIndexOf(`
3
3
  `,t-1)+1,r=e.indexOf(`
4
4
  `,t);r<0&&(r=e.length);let c=we(e,t),u=s?o:o.split(`
5
5
  `).map(m=>m&&c+m).join(`
6
6
  `);if(e.slice(a,r).trim()==="")return{from:a,to:r,insert:u,selectFrom:a,selectTo:a+u.length};let d=`
7
- ${u}`;return{from:r,to:r,insert:d,selectFrom:r+1,selectTo:r+d.length}}var be="allow-same-origin",$e="CustomHTML-preview",je=e=>/[;{}<>]/.test(e)?"":e.trim(),z=e=>e.replace(/[&"<>]/g,t=>`&#${t.charCodeAt(0)};`);function xe(e){let t=[];return e.head.querySelectorAll('link[rel="stylesheet"], style').forEach(o=>{o instanceof e.defaultView.HTMLLinkElement?o.href&&t.push(`<link rel="stylesheet" href="${z(o.href)}">`):o.textContent&&t.push(`<style>${o.textContent.replace(/<\/style/gi,"<\\/style")}</style>`)}),t.join("")}function ke(e,t,o=$e){let{scoped:s,inner:a}=ae(e,o),r=Object.entries(t.vars).map(([u,d])=>[u,je(d)]).filter(([u,d])=>/^--[\w-]+$|^font-family$/.test(u)&&d).map(([u,d])=>`${u}:${d}`).join(";"),c=s?` ${oe}="${z(o)}"`:"";return`<!doctype html><html class="${z(t.htmlClass)}"><head><meta charset="utf-8">${t.head}<style>:root{${r}}body{margin:0;padding:0 24px;color:var(--fg);background:var(--bg);font-family:var(--font-role-body)}${t.css.replace(/<\/style/gi,"<\\/style")}</style></head><body class="${z(t.bodyClass)}"><div${c}>${a}</div></body></html>`}function Ce(e,t=$e){let{css:o,markup:s}=ne(e,t),a=m=>new DOMParser().parseFromString(`<body>${m}</body>`,"text/html"),r=m=>{let p=new Map,f=new Map;for(let h of Array.from(m.body.querySelectorAll("*"))){let b=`<${h.tagName.toLowerCase()}>`;p.set(b,(p.get(b)??0)+1);for(let $ of Array.from(h.attributes))f.set($.name,(f.get($.name)??0)+1)}return{tags:p,attrs:f}},c=r(a(e.replace(/<style[\s\S]*?<\/style>/gi,""))),u=r(a(s)),d=[];for(let m of["tags","attrs"])for(let[p,f]of c[m]){let h=f-(u[m].get(p)??0);h>0&&d.push(`${p} \xD7${h}`)}for(let m of o.match(/@(import|font-face|property|layer|counter-style)\b/g)??[])d.push(m);return d}var at={bg:"Background",fg:"Text",surface:"Card","surface-2":"Card 2",line:"Line",muted:"Soft text"},Ne=`${ee.Flex}px`,G=`var(${I}, ${Ne})`,rt=[{key:"heading",label:"Heading and text",code:`<h2 class="font-heading2">Title</h2>
7
+ ${u}`;return{from:r,to:r,insert:d,selectFrom:r+1,selectTo:r+d.length}}var be="allow-same-origin",$e="CustomHTML-preview",je=e=>/[;{}<>]/.test(e)?"":e.trim(),z=e=>e.replace(/[&"<>]/g,t=>`&#${t.charCodeAt(0)};`);function xe(e){let t=[];return e.head.querySelectorAll('link[rel="stylesheet"], style').forEach(o=>{o instanceof e.defaultView.HTMLLinkElement?o.href&&t.push(`<link rel="stylesheet" href="${z(o.href)}">`):o.textContent&&t.push(`<style>${o.textContent.replace(/<\/style/gi,"<\\/style")}</style>`)}),t.join("")}function ke(e,t,o=$e){let{scoped:s,inner:a}=se(e,o),r=Object.entries(t.vars).map(([u,d])=>[u,je(d)]).filter(([u,d])=>/^--[\w-]+$|^font-family$/.test(u)&&d).map(([u,d])=>`${u}:${d}`).join(";"),c=s?` ${ee}="${z(o)}"`:"";return`<!doctype html><html class="${z(t.htmlClass)}"><head><meta charset="utf-8">${t.head}<style>:root{${r}}body{margin:0;padding:0 24px;color:var(--fg);background:var(--bg);font-family:var(--font-role-body)}${t.css.replace(/<\/style/gi,"<\\/style")}</style></head><body class="${z(t.bodyClass)}"><div${c}>${a}</div></body></html>`}function Ce(e,t=$e){let{css:o,markup:s}=te(e,t),a=m=>new DOMParser().parseFromString(`<body>${m}</body>`,"text/html"),r=m=>{let p=new Map,f=new Map;for(let h of Array.from(m.body.querySelectorAll("*"))){let b=`<${h.tagName.toLowerCase()}>`;p.set(b,(p.get(b)??0)+1);for(let $ of Array.from(h.attributes))f.set($.name,(f.get($.name)??0)+1)}return{tags:p,attrs:f}},c=r(a(e.replace(/<style[\s\S]*?<\/style>/gi,""))),u=r(a(s)),d=[];for(let m of["tags","attrs"])for(let[p,f]of c[m]){let h=f-(u[m].get(p)??0);h>0&&d.push(`${p} \xD7${h}`)}for(let m of o.match(/@(import|font-face|property|layer|counter-style)\b/g)??[])d.push(m);return d}var at={bg:"Background",fg:"Text",surface:"Card","surface-2":"Card 2",line:"Line",muted:"Soft text"},Ne=`${ne.Flex}px`,G=`var(${I}, ${Ne})`,rt=[{key:"heading",label:"Heading and text",code:`<h2 class="font-heading2">Title</h2>
8
8
  <p class="font-body" style="color: var(--fg-dim)">Text</p>
9
9
  `},{key:"columns",label:"Two columns",code:`<div style="display: grid; grid-template-columns: 1fr 1fr; gap: ${G}">
10
10
  <div><h3 class="font-heading3">Left</h3><p class="font-body">Text</p></div>
@@ -23,4 +23,4 @@ ${u}`;return{from:r,to:r,insert:d,selectFrom:r+1,selectTo:r+d.length}}var be="al
23
23
  <summary class="font-heading3">Question</summary>
24
24
  <p class="font-body">Answer</p>
25
25
  </details>
26
- `}],lt=()=>import("efficient-shell/code/format").then(e=>e.prettierFormatter,()=>null);function it(e){if(typeof document>"u"||!e)return e;let t=document.createElement("span");if(t.style.color=e,!t.style.color)return e;document.body.appendChild(t);let o=getComputedStyle(t).color;t.remove();let s=document.createElement("canvas").getContext("2d");if(!s)return e;s.fillStyle=o,s.fillRect(0,0,1,1);let[a,r,c]=s.getImageData(0,0,1,1).data;return(Z(`rgb(${a}, ${r}, ${c})`)??e).toUpperCase()}function Ht({open:e,onClose:t,value:o,onChange:s,loadFormatter:a=lt}){let{theme:r,fonts:c,blockGap:u,siteLengthUnits:d}=re(),m=J(r),p=!Ue(nt)?.capabilities?.hasSiteTheme,f=fe({themeFromDocument:p,persist:()=>{}}),[h,b]=S(m.selected),[$,k]=S("desktop"),[g,x]=S(void 0),[L,U]=S(null),[W,Oe]=S(null),P=Te(null);Se(()=>{if(!e)return;let l=!0;return a().then(y=>{l&&Oe(y?{format:y.format}:null)}),()=>{l=!1}},[e,a]);let F=_(()=>{let l=Y(m),y=l[`--theme-preset-${h}-bg`]?h:m.selected,C={"--accent":l[`--theme-preset-${y}-accent`]??""};for(let E of B)C[E.token]=l[`--theme-preset-${y}-${E.role}`]??"";return C},[m,h]),V=te(p?void 0:u,d.blockGapUnit),Ee=V[I]??Ne,q=_(()=>{let l=Object.fromEntries(Object.entries(X(c)).filter(([y])=>y.startsWith("--")));return{head:typeof document>"u"?"":xe(document),htmlClass:typeof document>"u"?"":document.documentElement.className,bodyClass:typeof document>"u"?"":document.body.className,vars:{...F,...l,...V},css:ce(ie(f.saved))}},[F,c,u,d.blockGapUnit,f.saved,e]),Ie=_(()=>ke(o,q),[o,q]),R=_(()=>typeof DOMParser>"u"?[]:Ce(o),[o]),Q=Te(null),[j,Me]=S(0);Se(()=>{let l=Q.current;if(!l||typeof ResizeObserver>"u")return;let y=new ResizeObserver(()=>Me(l.clientWidth));return y.observe(l),()=>y.disconnect()},[e]);let T=$==="phone"?390:j>0?Math.max(j,K):1280,N=$==="phone"?1:et(j,T),O=async l=>{let y=await P.current?.place((C,E,ze)=>ge(C,E,ze,l));y&&U(y)},Ae=async()=>{await P.current?.format()==="formatted"&&U(null)};return n(qe,{open:e,onClose:t,size:"full",title:i("Custom HTML"),description:i("Build this section in HTML and CSS. The CSS changes this section only. Scripts do not run."),footer:n(D,{variant:"primary",onClick:t,children:i("Done")}),children:v("div",{className:"sf-code-window","data-code-window":"body",children:[v("aside",{className:"sf-code-window-styles","data-code-window":"styles",children:[n(H,{title:i("Styles"),level:2}),v("div",{className:"es-group-body sf-code-window-group",children:[n(w,{size:"xs",tone:"secondary",as:"p",children:i("Click a colour, text style or spacing to put a link to it in your code, at the cursor. If you change Styles later, this section changes with it.")}),n("div",{className:"es-editor sf-editor-tokens","data-code-window":"theme",children:n(le,{value:h,onChange:b,hint:i("Shows the preview in this Theme. It adds no code. The section uses the Theme in its own settings."),canEdit:!1})})]}),n(H,{title:i("Colours"),level:2}),n("div",{className:"es-group-body",children:n("div",{className:"sf-code-window-list",role:"list",children:B.map(l=>{let y=i(at[l.role]??l.role),C=it(F[l.token]??"");return n("div",{role:"listitem",children:v(D,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${y}: ${i("add")} var(${l.token})`,onClick:()=>{x(l.token),O({kind:"value",value:`var(${l.token})`,property:"color"})},children:[n("span",{className:Ye({size:"sm",selected:g===l.token}),"aria-hidden":"true",children:n("span",{className:"absolute inset-0",style:Je(C)})}),n(w,{size:"sm",weight:"medium",children:y}),n(w,{size:"2xs",tone:"tertiary",mono:!0,children:C}),n("span",{className:"sf-code-window-row-sub",children:n(w,{size:"2xs",tone:"secondary",mono:!0,children:l.token})})]})},l.token)})})}),n(H,{title:i("Text styles"),level:2}),n("div",{className:"es-group-body",children:n(de,{saved:f.saved,old:f.old,colours:me(m),colourNameOf:ue(m),sizeOf:he,onChange:()=>{},onPick:l=>{O({kind:"class",className:se(l)})}})}),n(H,{title:i("Spacing"),level:2}),n("div",{className:"es-group-body",children:v(D,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${i("Gap between blocks")}: ${i("add")} ${G}`,onClick:()=>{O({kind:"value",value:G,property:"padding"})},children:[n("span",{className:"sf-code-window-row-icon","aria-hidden":"true",children:n(w,{tone:"secondary",children:n(ot,{})})}),n(w,{size:"sm",weight:"medium",children:i("Gap between blocks")}),n(w,{size:"2xs",tone:"tertiary",children:Ee.replace(/(\d)px$/,"$1 px")}),n("span",{className:"sf-code-window-row-sub",children:n(w,{size:"2xs",tone:"secondary",mono:!0,children:I})})]})})]}),v("div",{className:"sf-code-window-column","data-code-window":"preview-column",children:[v("div",{className:"sf-code-window-bar",children:[n(Xe,{size:"sm",value:$,onChange:k,options:[{value:"desktop",label:i("Desktop")},{value:"phone",label:i("Phone")}]}),n(w,{size:"xs",tone:"secondary",children:`${T} px \xB7 ${Math.round(N*100)}%`})]}),n(Ve,{padding:"sm",className:"sf-code-window-fill",children:n("div",{className:"sf-code-window-fill",children:n("div",{ref:Q,className:"sf-code-window-stage es-editor sf-editor-tokens sf-center",children:n("div",{className:"sf-frame",style:{width:T*N,flex:"none"},children:n("iframe",{title:i("Preview"),sandbox:be,srcDoc:Ie,"data-code-window":"preview",style:{...Ze(T,N),height:`${100/N}%`}})})})})}),n("div",{role:"status","data-code-window":"status",children:n(We,{tone:R.length?"warning":"success",emphasis:"subtle",children:R.length?`${i("Not published")}: ${R.join(", ")}. ${i("Scripts and event attributes are removed for safety.")}`:i("Everything here is published as written.")})})]}),v("div",{className:"sf-code-window-column","data-code-window":"code",children:[v("div",{className:"sf-code-window-bar",children:[n(w,{size:"xs",weight:"semibold",children:i("Code")}),v("div",{className:"sf-code-window-actions",children:[W?n(D,{variant:"secondary",onClick:()=>{Ae()},children:i("Format code")}):null,n(Qe,{"aria-label":i("Add a ready-made part"),triggerClassName:Ke({variant:"secondary"}),align:"end",trigger:v(Be,{children:[i("Add part")," ",n(st,{size:12})]}),items:rt.map(l=>({key:l.key,label:i(l.label),onSelect:()=>{O({kind:"block",code:l.code})}}))})]})]}),L?v("div",{className:"sf-code-window-added","data-code-window":"added",children:[n(w,{size:"xs",tone:"secondary",children:`${i("Added on line")} ${L.line}:`}),n(w,{size:"2xs",mono:!0,truncate:!0,children:L.text})]}):null,n("div",{className:"sf-code-window-editor",children:n(Ge,{fallback:null,children:n(tt,{ref:P,value:o,onChange:s,label:i("Section code"),lineWrap:!0,formatter:W??void 0})})})]})]})})}export{Ht as default,lt as loadShellFormatter};
26
+ `}],lt=()=>import("efficient-shell/code/format").then(e=>e.prettierFormatter,()=>null);function it(e){if(typeof document>"u"||!e)return e;let t=document.createElement("span");if(t.style.color=e,!t.style.color)return e;document.body.appendChild(t);let o=getComputedStyle(t).color;t.remove();let s=document.createElement("canvas").getContext("2d");if(!s)return e;s.fillStyle=o,s.fillRect(0,0,1,1);let[a,r,c]=s.getImageData(0,0,1,1).data;return(oe(`rgb(${a}, ${r}, ${c})`)??e).toUpperCase()}function Ht({open:e,onClose:t,value:o,onChange:s,loadFormatter:a=lt}){let{theme:r,fonts:c,blockGap:u,siteLengthUnits:d}=re(),m=J(r),p=!Ue(nt)?.capabilities?.hasSiteTheme,f=fe({themeFromDocument:p,persist:()=>{}}),[h,b]=S(m.selected),[$,k]=S("desktop"),[g,x]=S(void 0),[L,U]=S(null),[W,Oe]=S(null),P=Te(null);Se(()=>{if(!e)return;let l=!0;return a().then(y=>{l&&Oe(y?{format:y.format}:null)}),()=>{l=!1}},[e,a]);let F=_(()=>{let l=Y(m),y=l[`--theme-preset-${h}-bg`]?h:m.selected,C={"--accent":l[`--theme-preset-${y}-accent`]??""};for(let E of B)C[E.token]=l[`--theme-preset-${y}-${E.role}`]??"";return C},[m,h]),V=ae(p?void 0:u,d.blockGapUnit),Ee=V[I]??Ne,q=_(()=>{let l=Object.fromEntries(Object.entries(X(c)).filter(([y])=>y.startsWith("--")));return{head:typeof document>"u"?"":xe(document),htmlClass:typeof document>"u"?"":document.documentElement.className,bodyClass:typeof document>"u"?"":document.body.className,vars:{...F,...l,...V},css:ce(ie(f.saved))}},[F,c,u,d.blockGapUnit,f.saved,e]),Ie=_(()=>ke(o,q),[o,q]),R=_(()=>typeof DOMParser>"u"?[]:Ce(o),[o]),Q=Te(null),[j,Me]=S(0);Se(()=>{let l=Q.current;if(!l||typeof ResizeObserver>"u")return;let y=new ResizeObserver(()=>Me(l.clientWidth));return y.observe(l),()=>y.disconnect()},[e]);let T=$==="phone"?390:j>0?Math.max(j,K):1280,N=$==="phone"?1:et(j,T),O=async l=>{let y=await P.current?.place((C,E,ze)=>ge(C,E,ze,l));y&&U(y)},Ae=async()=>{await P.current?.format()==="formatted"&&U(null)};return n(qe,{open:e,onClose:t,size:"full",title:i("Custom HTML"),description:i("Build this section in HTML and CSS. The CSS changes this section only. Scripts do not run."),footer:n(D,{variant:"primary",onClick:t,children:i("Done")}),children:v("div",{className:"sf-code-window","data-code-window":"body",children:[v("aside",{className:"sf-code-window-styles","data-code-window":"styles",children:[n(H,{title:i("Styles"),level:2}),v("div",{className:"es-group-body sf-code-window-group",children:[n(w,{size:"xs",tone:"secondary",as:"p",children:i("Click a colour, text style or spacing to put a link to it in your code, at the cursor. If you change Styles later, this section changes with it.")}),n("div",{className:"es-editor sf-editor-tokens","data-code-window":"theme",children:n(le,{value:h,onChange:b,hint:i("Shows the preview in this Theme. It adds no code. The section uses the Theme in its own settings."),canEdit:!1})})]}),n(H,{title:i("Colours"),level:2}),n("div",{className:"es-group-body",children:n("div",{className:"sf-code-window-list",role:"list",children:B.map(l=>{let y=i(at[l.role]??l.role),C=it(F[l.token]??"");return n("div",{role:"listitem",children:v(D,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${y}: ${i("add")} var(${l.token})`,onClick:()=>{x(l.token),O({kind:"value",value:`var(${l.token})`,property:"color"})},children:[n("span",{className:Ye({size:"sm",selected:g===l.token}),"aria-hidden":"true",children:n("span",{className:"absolute inset-0",style:Je(C)})}),n(w,{size:"sm",weight:"medium",children:y}),n(w,{size:"2xs",tone:"tertiary",mono:!0,children:C}),n("span",{className:"sf-code-window-row-sub",children:n(w,{size:"2xs",tone:"secondary",mono:!0,children:l.token})})]})},l.token)})})}),n(H,{title:i("Text styles"),level:2}),n("div",{className:"es-group-body",children:n(de,{saved:f.saved,old:f.old,colours:me(m),colourNameOf:ue(m),sizeOf:he,onChange:()=>{},onPick:l=>{O({kind:"class",className:Z(l)})}})}),n(H,{title:i("Spacing"),level:2}),n("div",{className:"es-group-body",children:v(D,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${i("Gap between blocks")}: ${i("add")} ${G}`,onClick:()=>{O({kind:"value",value:G,property:"padding"})},children:[n("span",{className:"sf-code-window-row-icon","aria-hidden":"true",children:n(w,{tone:"secondary",children:n(ot,{})})}),n(w,{size:"sm",weight:"medium",children:i("Gap between blocks")}),n(w,{size:"2xs",tone:"tertiary",children:Ee.replace(/(\d)px$/,"$1 px")}),n("span",{className:"sf-code-window-row-sub",children:n(w,{size:"2xs",tone:"secondary",mono:!0,children:I})})]})})]}),v("div",{className:"sf-code-window-column","data-code-window":"preview-column",children:[v("div",{className:"sf-code-window-bar",children:[n(Xe,{size:"sm",value:$,onChange:k,options:[{value:"desktop",label:i("Desktop")},{value:"phone",label:i("Phone")}]}),n(w,{size:"xs",tone:"secondary",children:`${T} px \xB7 ${Math.round(N*100)}%`})]}),n(Ve,{padding:"sm",className:"sf-code-window-fill",children:n("div",{className:"sf-code-window-fill",children:n("div",{ref:Q,className:"sf-code-window-stage es-editor sf-editor-tokens sf-center",children:n("div",{className:"sf-frame",style:{width:T*N,flex:"none"},children:n("iframe",{title:i("Preview"),sandbox:be,srcDoc:Ie,"data-code-window":"preview",style:{...Ze(T,N),height:`${100/N}%`}})})})})}),n("div",{role:"status","data-code-window":"status",children:n(We,{tone:R.length?"warning":"success",emphasis:"subtle",children:R.length?`${i("Not published")}: ${R.join(", ")}. ${i("Scripts and event attributes are removed for safety.")}`:i("Everything here is published as written.")})})]}),v("div",{className:"sf-code-window-column","data-code-window":"code",children:[v("div",{className:"sf-code-window-bar",children:[n(w,{size:"xs",weight:"semibold",children:i("Code")}),v("div",{className:"sf-code-window-actions",children:[W?n(D,{variant:"secondary",onClick:()=>{Ae()},children:i("Format code")}):null,n(Qe,{"aria-label":i("Add a ready-made part"),triggerClassName:Ke({variant:"secondary"}),align:"end",trigger:v(Be,{children:[i("Add part")," ",n(st,{size:12})]}),items:rt.map(l=>({key:l.key,label:i(l.label),onSelect:()=>{O({kind:"block",code:l.code})}}))})]})]}),L?v("div",{className:"sf-code-window-added","data-code-window":"added",children:[n(w,{size:"xs",tone:"secondary",children:`${i("Added on line")} ${L.line}:`}),n(w,{size:"2xs",mono:!0,truncate:!0,children:L.text})]}):null,n("div",{className:"sf-code-window-editor",children:n(Ge,{fallback:null,children:n(tt,{ref:P,value:o,onChange:s,label:i("Section code"),lineWrap:!0,formatter:W??void 0})})})]})]})})}export{Ht as default,lt as loadShellFormatter};
@@ -1,4 +1,4 @@
1
- "use client";import{$ as yn,O as Fr,P as _r,Q as Mr,R as Kr,S as Dr,T as ye,V as mt,W as jr,X as Ur,Y as _t,Z as Wr,aa as ne,b as Tr,c as fn,d as qr,da as $r,e as Tt,ea as Yr,ja as Br,ka as de,la as zr,ma as Hr,ra as Gr,sa as ft,va as gn,xa as ie,y as qt,z as Ft}from"./chunk-S5N6H2MP.js";import{S as ue,Y as Ze,da as $,o as Lr,p as Ir}from"./chunk-YCL4MPLF.js";import{fa as Rr,ha as Ue}from"./chunk-CDKQFBBA.js";import{i as Ar,j as pt,k as Ie}from"./chunk-JJ5MCDPE.js";import{ji as Or}from"./chunk-EKCLPISP.js";import"./chunk-27GSFHNV.js";import{a as mn,b as gi}from"./chunk-Y6SLVHK3.js";var Zr=mn((Hs,Xr)=>{"use strict";var vi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Xr.exports=vi});var no=mn((Gs,to)=>{"use strict";var ki=Zr();function Qr(){}function eo(){}eo.resetWarningCache=Qr;to.exports=function(){function e(r,a,s,d,y,f){if(f!==ki){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:eo,resetWarningCache:Qr};return n.PropTypes=n,n}});var oo=mn((Xs,ro)=>{"use strict";ro.exports=no()();var Vs,Js});import{useEffect as Oa,useMemo as wa,useRef as tt,useState as Ye}from"react";import{formatTime as hi}from"efficient-shell/format";function Vr(e,t){let n=Ir(t);return!n||Number.isNaN(new Date(e).getTime())?"":hi(e,{locale:Lr(),timeZone:n})}import{rootIsDark as bi}from"efficient-shell/format";function Jr(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,a)=>e.getPropertyValue(r).trim()||a,n=bi({whenUnset:!0});return{theme:n?"night":"stripe",variables:{colorPrimary:t("--accent",n?"#c9a461":"#8a6a2a"),colorBackground:t("--site-surface",n?"#131313":"#ffffff"),colorText:t("--fg",n?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}}import{userZone as Es,parseOption as Rs}from"efficient-shell/format";var M=gi(oo(),1);import I from"react";function ao(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xi(e){if(Array.isArray(e))return e}function uo(e,t,n){return(t=Ei(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ci(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,s,d,y=[],f=!0,p=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(f=(r=s.call(n)).done)&&(y.push(r.value),y.length!==t);f=!0);}catch(k){p=!0,a=k}finally{try{if(!f&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(p)throw a}}return y}}function Pi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ "use client";import{$ as yn,O as Fr,P as _r,Q as Mr,R as Kr,S as Dr,T as ye,V as mt,W as jr,X as Ur,Y as _t,Z as Wr,aa as ne,b as Tr,c as fn,d as qr,da as $r,e as Tt,ea as Yr,ja as Br,ka as de,la as zr,ma as Hr,ra as Gr,sa as ft,va as gn,xa as ie,y as qt,z as Ft}from"./chunk-HQFRQZ6J.js";import{S as ue,Y as Ze,da as $,o as Lr,p as Ir}from"./chunk-PULBLZRR.js";import{fa as Rr,ha as Ue}from"./chunk-TVMCJUOE.js";import{i as Ar,j as pt,k as Ie}from"./chunk-EZ5QLDA5.js";import{ki as Or}from"./chunk-6ABZ7XWF.js";import"./chunk-7UJXVH57.js";import{a as mn,b as gi}from"./chunk-Y6SLVHK3.js";var Zr=mn((Hs,Xr)=>{"use strict";var vi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Xr.exports=vi});var no=mn((Gs,to)=>{"use strict";var ki=Zr();function Qr(){}function eo(){}eo.resetWarningCache=Qr;to.exports=function(){function e(r,a,s,d,y,f){if(f!==ki){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:eo,resetWarningCache:Qr};return n.PropTypes=n,n}});var oo=mn((Xs,ro)=>{"use strict";ro.exports=no()();var Vs,Js});import{useEffect as Oa,useMemo as wa,useRef as tt,useState as Ye}from"react";import{formatTime as hi}from"efficient-shell/format";function Vr(e,t){let n=Ir(t);return!n||Number.isNaN(new Date(e).getTime())?"":hi(e,{locale:Lr(),timeZone:n})}import{rootIsDark as bi}from"efficient-shell/format";function Jr(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,a)=>e.getPropertyValue(r).trim()||a,n=bi({whenUnset:!0});return{theme:n?"night":"stripe",variables:{colorPrimary:t("--accent",n?"#c9a461":"#8a6a2a"),colorBackground:t("--site-surface",n?"#131313":"#ffffff"),colorText:t("--fg",n?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}}import{userZone as Es,parseOption as Rs}from"efficient-shell/format";var M=gi(oo(),1);import I from"react";function ao(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xi(e){if(Array.isArray(e))return e}function uo(e,t,n){return(t=Ei(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ci(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,s,d,y=[],f=!0,p=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(f=(r=s.call(n)).done)&&(y.push(r.value),y.length!==t);f=!0);}catch(k){p=!0,a=k}finally{try{if(!f&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(p)throw a}}return y}}function Pi(){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 io(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function so(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?io(Object(n),!0).forEach(function(r){uo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):io(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ni(e,t){if(e==null)return{};var n,r,a=Si(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Si(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function po(e,t){return xi(e)||Ci(e,t)||Ri(e,t)||Pi()}function wi(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ei(e){var t=wi(e,"string");return typeof t=="symbol"?t:t+""}function hn(e){"@babel/helpers - typeof";return hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hn(e)}function Ri(e,t){if(e){if(typeof e=="string")return ao(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ao(e,t):void 0}}var X=function(t,n,r){var a=!!r,s=I.useRef(r);I.useEffect(function(){s.current=r},[r]),I.useEffect(function(){if(!a||!t)return function(){};var d=function(){if(s.current)return s.current.apply(s,arguments)};return t.on(n,d),function(){t.off(n,d)}},[a,n,t,s])},bn=function(t){var n=I.useRef(t);return I.useEffect(function(){n.current=t},[t]),n.current},Qe=function(t){return t!==null&&hn(t)==="object"},Oi=function(t){return Qe(t)&&typeof t.then=="function"},Ai=function(t){return Qe(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},co="[object Object]",Li=function e(t,n){if(t===n)return!0;if(!Qe(t)||!Qe(n))return t===n;var r=Array.isArray(t),a=Array.isArray(n);if(r!==a)return!1;var s=Object.prototype.toString.call(t)===co,d=Object.prototype.toString.call(n)===co;if(s!==d)return!1;if(!s&&!r)return t===n;var y=Object.keys(t),f=Object.keys(n);if(y.length!==f.length)return!1;for(var p={},k=0;k<y.length;k+=1)p[y[k]]=!0;for(var h=0;h<f.length;h+=1)p[f[h]]=!0;var b=Object.keys(p);if(b.length!==y.length)return!1;var v=t,R=n,C=function(V){return e(v[V],R[V])};return b.every(C)},mo=function(t,n,r){return Qe(t)?Object.keys(t).reduce(function(a,s){var d=!Qe(n)||!Li(t[s],n[s]);return r.includes(s)?(d&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),a):d?so(so({},a||{}),{},uo({},s,t[s])):a},null):null},fo="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.",lo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fo;if(t===null||Ai(t))return t;throw new Error(n)},Ii=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fo;if(Oi(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return lo(a,n)})};var r=lo(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Ti=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"6.12.0"}),t.registerAppInfo({name:"react-stripe-js",version:"6.12.0",url:"https://stripe.com/docs/stripe-js/react"}))},Mt=I.createContext(null);Mt.displayName="ElementsContext";var yo=function(t,n){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return t},kn=function(t){var n=t.stripe,r=t.options,a=t.children,s=I.useMemo(function(){return Ii(n)},[n]),d=I.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(r):null}}),y=po(d,2),f=y[0],p=y[1];I.useEffect(function(){var b=!0,v=function(C){p(function(O){return O.stripe?O:{stripe:C,elements:C.elements(r)}})};return s.tag==="async"&&!f.stripe?s.stripePromise.then(function(R){R&&b&&v(R)}):s.tag==="sync"&&!f.stripe&&v(s.stripe),function(){b=!1}},[s,f,r]);var k=bn(n);I.useEffect(function(){k!==null&&k!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[k,n]);var h=bn(r);return I.useEffect(function(){if(f.elements){var b=mo(r,h,["clientSecret","fonts"]);b&&f.elements.update(b)}},[r,h,f.elements]),I.useEffect(function(){Ti(f.stripe)},[f.stripe]),I.createElement(Mt.Provider,{value:f},a)};kn.propTypes={stripe:M.default.any,options:M.default.object};var go=function(t){var n=I.useContext(Mt);return yo(n,t)},ho=function(){var t=go("calls useElements()"),n=t.elements;return n},qi=function(t){var n=t.children,r=go("mounts <ElementsConsumer>");return n(r)};qi.propTypes={children:M.default.func.isRequired};var Fi=I.createContext(null);Fi.displayName="CheckoutContext";var bo=I.createContext(null);bo.displayName="CheckoutSdkContext";var vn=function(t){var n=I.useContext(bo),r=I.useContext(Mt);if(n){if(r)throw new Error("You cannot wrap the part of your app that ".concat(t," in both a checkout provider and <Elements> provider."));return n}else return yo(r,t)},_i=["mode"],Mi=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},K=function(t,n,r){var a="".concat(Mi(t),"Element"),s=function(p){var k=p.id,h=p.className,b=p.options,v=b===void 0?{}:b,R=p.onBlur,C=p.onFocus,O=p.onReady,V=p.onChange,E=p.onEscape,P=p.onClick,Y=p.onLoadError,Z=p.onLoaderStart,pe=p.onNetworksChange,j=p.onConfirm,se=p.onCancel,Se=p.onShippingAddressChange,qe=p.onShippingRateChange,ee=p.onSavedPaymentMethodRemove,he=p.onSavedPaymentMethodUpdate,re=p.onAvailablePaymentMethodsChange,te=vn("mounts <".concat(a,">")),H="elements"in te?te.elements:null,g="checkoutSdk"in te?te.checkoutSdk:null,we=I.useState(null),Fe=po(we,2),U=Fe[0],nt=Fe[1],Q=I.useRef(null),be=I.useRef(null);X(U,"blur",R),X(U,"focus",C),X(U,"escape",E),X(U,"click",P),X(U,"loaderror",Y),X(U,"loaderstart",Z),X(U,"networkschange",pe),X(U,"confirm",j),X(U,"cancel",se),X(U,"shippingaddresschange",Se),X(U,"shippingratechange",qe),X(U,"savedpaymentmethodremove",ee),X(U,"savedpaymentmethodupdate",he),X(U,"availablepaymentmethodschange",re),X(U,"change",V);var Ee;O&&(t==="expressCheckout"?Ee=O:Ee=function(){O(U)}),X(U,"ready",Ee),I.useLayoutEffect(function(){if(Q.current===null&&be.current!==null&&(H||g)){var L=null;if(g){var oe=g,me=g;switch(t){case"paymentForm":L=me.createForm(v);break;case"payment":L=oe.createPaymentElement(v);break;case"address":if("mode"in v){var Oe=v.mode,ve=Ni(v,_i);if(Oe==="shipping")L=oe.createShippingAddressElement(ve);else if(Oe==="billing")L=oe.createBillingAddressElement(ve);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":L=oe.createExpressCheckoutElement(v);break;case"currencySelector":L=g.createCurrencySelectorElement();break;case"taxId":L=oe.createTaxIdElement(v);break;case"contactDetails":L=oe.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in g)L=g.createLinkSignupElement(v);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":L=oe.createTermsElement(v);break;default:throw new Error("<".concat(a,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else H&&(L=H.create(t,v));Q.current=L,nt(L),L&&L.mount(be.current)}},[H,g,v]);var Re=bn(v);return I.useEffect(function(){if(Q.current){var L=mo(v,Re,["paymentRequest"]);L&&"update"in Q.current&&Q.current.update(L)}},[v,Re]),I.useLayoutEffect(function(){return function(){if(Q.current&&typeof Q.current.destroy=="function")try{Q.current.destroy(),Q.current=null}catch{}}},[]),I.createElement("div",{id:k,className:h,ref:be})},d=function(p){vn("mounts <".concat(a,">"));var k=p.id,h=p.className;return I.createElement("div",{id:k,className:h})},y=n?d:s;return y.propTypes={id:M.default.string,className:M.default.string,onChange:M.default.func,onBlur:M.default.func,onFocus:M.default.func,onReady:M.default.func,onEscape:M.default.func,onClick:M.default.func,onLoadError:M.default.func,onLoaderStart:M.default.func,onNetworksChange:M.default.func,onConfirm:M.default.func,onCancel:M.default.func,onShippingAddressChange:M.default.func,onShippingRateChange:M.default.func,onSavedPaymentMethodRemove:M.default.func,onSavedPaymentMethodUpdate:M.default.func,onAvailablePaymentMethodsChange:M.default.func,options:M.default.object},y.displayName=a,y.__elementType=t,y},D=typeof window>"u",Ki=I.createContext(null);Ki.displayName="EmbeddedCheckoutProviderContext";var vo=function(){var t=vn("calls useStripe()"),n=t.stripe;return n},Qs=K("auBankAccount",D),ec=K("card",D),tc=K("cardNumber",D),nc=K("cardExpiry",D),rc=K("cardCvc",D),oc=K("currencySelector",D),ac=K("iban",D),ko=K("payment",D),ic=K("expressCheckout",D),sc=K("paymentRequestButton",D),cc=K("linkAuthentication",D),lc=K("linkSignup",D),uc=K("contactDetails",D),dc=K("address",D),pc=K("shippingAddress",D),mc=K("paymentMethodMessaging",D),fc=K("taxId",D),yc=K("issuingCardNumberDisplay",D),gc=K("issuingCardCvcDisplay",D),hc=K("issuingCardExpiryDisplay",D),bc=K("issuingCardPinDisplay",D),vc=K("issuingCardCopyButton",D),kc=K("terms",D);function jt(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?jt=function(t){return typeof t}:jt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(e)}var Po="dahlia",Di=function(t){return t===3?"v3":t},No="https://js.stripe.com",ji="".concat(No,"/").concat(Po,"/stripe.js"),Ui=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Wi=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,xo="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",$i=function(t){return Ui.test(t)||Wi.test(t)},Yi=function(){for(var t=document.querySelectorAll('script[src^="'.concat(No,'"]')),n=0;n<t.length;n++){var r=t[n];if($i(r.src))return r}return null},Co=function(t){var n=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(ji).concat(n);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},Bi=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},yt=null,Kt=null,Dt=null,zi=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},Hi=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},Gi=function(t){return yt!==null?yt:(yt=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(xo),window.Stripe){n(window.Stripe);return}try{var a=Yi();if(a&&t)console.warn(xo);else if(!a)a=Co(t);else if(a&&Dt!==null&&Kt!==null){var s;a.removeEventListener("load",Dt),a.removeEventListener("error",Kt),(s=a.parentNode)===null||s===void 0||s.removeChild(a),a=Co(t)}Dt=Hi(n,r),Kt=zi(r),a.addEventListener("load",Dt),a.addEventListener("error",Kt)}catch(d){r(d);return}}),yt.catch(function(n){return yt=null,Promise.reject(n)}))},Vi=function(t,n,r){if(t===null)return null;var a=n[0];if(typeof a!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(jt(a)," instead."));var s=a.match(/^pk_test/),d=Di(t.version),y=Po;s&&d!==y&&console.warn("Stripe.js@".concat(d," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(y,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var f=t.apply(void 0,n);return Bi(f,r),f},gt,So=!1,wo=function(){return gt||(gt=Gi(null).catch(function(t){return gt=null,Promise.reject(t)}),gt)};Promise.resolve().then(function(){return wo()}).catch(function(e){So||console.warn(e)});var Ut=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];So=!0;var a=Date.now();return wo().then(function(s){return Vi(s,n,a)})};var Wt=2;function Eo(e){return e==="card"}var Ji="checkout_unavailable",Xi="checkout_waiting",Ro="committed",Te="We could not check your payment. Please try again.",$t="Your last change was not saved. This is your order as placed.",Oo="Your bank is still waiting for you to approve this payment, so your order stays as it was. Finish the approval, or try again in a few minutes.",Ao=1e4;async function Lo(e,t=Ao){let n,r=new Promise(s=>{n=setTimeout(()=>s(void 0),t)}),a=(async()=>{try{return(await(await Ut(e.publishableKey))?.retrievePaymentIntent(e.clientSecret))?.paymentIntent?.status}catch{return}})();try{return await Promise.race([a,r])}finally{clearTimeout(n)}}var Io=new Set(["none","requires_payment_method","canceled"]);async function xn(e,t=Ao){let n,r=new Promise(a=>{n=setTimeout(()=>a(void 0),t)});try{return await Promise.race([$.releaseCheckout({idempotencyKey:e}).then(a=>a.status,()=>{}),r])}finally{clearTimeout(n)}}function To(e,t){return e instanceof ue&&typeof e.data=="object"&&e.data!==null&&e.data.code===t}function Yt(e){return To(e,Ji)}function Cn(e){return To(e,Xi)}function Pn(e){return e instanceof ue&&e.status>=400&&e.status<500&&e.status!==408}function qo(e){return JSON.stringify([e.email,e.firstName,e.lastName,e.phone,e.address,e.city,e.subdivision,e.postcode,e.country,e.lines,e.shippingMethodId,e.couponCode,e.currency,e.shopperId,e.company])}function Bt(e){return e.orderNumber||e.checkoutNumber}function Zi(e){return e.orderNumber?{kind:"placed",order:e}:{kind:e.status==="released"?"refunded":e.status==="expired"?"expired":"pending",checkoutNumber:e.checkoutNumber}}async function Fo({checkoutNumber:e,resend:t,page:n}){n.setConfirming(!0);let r;try{r=Zi(await t())}catch{r={kind:"pending",checkoutNumber:e}}r.kind==="placed"?(n.markPaid(),n.track(r.order),n.land(r.order)):n.unplaced({...r,checkoutNumber:r.checkoutNumber||e}),n.setConfirming(!1)}import{createContext as ys,useContext as gs,useEffect as z,useMemo as sa,useRef as B,useState as N}from"react";var Qi="sf:gclid",es="sf:fbclid",ts=2160*60*60*1e3;function Ko(){return typeof window<"u"}function _o(e){let t=pt.getItem(e);if(!t)return"";try{let{v:n,t:r}=JSON.parse(t);return!n||typeof r!="number"||Date.now()-r>ts?"":n}catch{return""}}function Mo(e){if(!Ko())return"";let t=e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function Do(){if(!Ko())return{};let e=_o(Qi),t=_o(es),n=Mo("_fbp"),r=Mo("_fbc");!r&&t&&(r=`fb.1.${Date.now()}.${t}`);let a={};return e&&(a.gclid=e),t&&(a.fbclid=t),n&&(a.fbp=n),r&&(a.fbc=r),a}var jo="sf:meta-purchases",ns=20;function Wo(){return typeof window>"u"||window.parent!==window}function rs(...e){try{if(Wo()||typeof window.fbq!="function")return;window.fbq(...e)}catch{}}var Uo=new Set;function os(e){if(Uo.has(e))return!1;Uo.add(e);try{let t=JSON.parse(pt.getItem(jo)??"[]");if(t.includes(e))return!1;pt.setItem(jo,JSON.stringify([...t,e].slice(-ns)))}catch{}return!0}function as(e){return[...new Set(e.filter(mt).flatMap(t=>t.components.map(n=>n.partNumber)))]}function $o(e){let t=e.confirmation;Wo()||!os(t.orderNumber)||rs("track","Purchase",{value:Number(t.grandTotal),currency:t.currency,content_type:"product",content_ids:as(e.lines)},{eventID:t.orderNumber})}var Nn="checkout-afterpay-context",Sn="checkout-gocardless-context",wn="checkout-zip-context",En="checkout-klarna-context";function is(e){return e?.lostChange===!0}function ss({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function cs(e,t){let n=e.getItem(t);if(e.removeItem(t),!n)return null;try{return JSON.parse(n)}catch{return null}}function ls(e){let t=e.words?.declined??`${e.name} declined the payment \u2014 our team will follow up on payment.`;return{settled:e.words?.settled??`The ${e.name} payment was not completed \u2014 our team will follow up on payment.`,declined:t,collecting:e.words?.collecting??t,unconfirmed:e.words?.unconfirmed??`We could not confirm the ${e.name} payment \u2014 our team will follow up on payment.`}}var Yo={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:Nn,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},Bo={name:"Zip",legParam:"zip",legValues:["return"],storageKey:wn,evidenceFrom(e){let t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})},zo={name:"GoCardless",legParam:"gocardless",legValues:["confirm","cancel"],storageKey:Sn,evidenceFrom:(e,t)=>t==="confirm"?t:null,requestFrom:(e,t)=>({idempotencyKey:t?.idempotencyKey??""}),keyedByParked:!0,words:{settled:"The direct debit was not set up \u2014 our team will follow up on payment.",declined:"The direct debit was declined \u2014 our team will follow up on payment.",collecting:"Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.",unconfirmed:"We could not confirm the direct debit \u2014 our team will follow up on payment."}},Ho={name:"Klarna",legParam:"klarna",legValues:["confirm","cancel"],storageKey:En,evidenceFrom:(e,t)=>t==="confirm"?e.get("authorization_token"):null,requestFrom:(e,t)=>({idempotencyKey:t?.idempotencyKey??"",authorizationToken:e}),keyedByParked:!0,words:{collecting:"Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly."}};async function ht(e,t){let n=new URLSearchParams(t.search),r=n.get(e.legParam);if(!r||!e.legValues.includes(r))return;let a=cs(t.storage,e.storageKey),s=e.evidenceFrom(n,r);t.scrubQuery();let d=ss({evidence:s,parked:a});if(d.action==="ignore"||e.keyedByParked&&!d.parked)return;let y=ls(e);if(t.page.clearCart(),is(d.parked)&&t.page.lostChange(),d.action==="settle"){t.page.note(y.settled,!0),t.page.land(d.parked.confirmation);return}t.page.setConfirming(!0);try{let f=await t.capture(e.requestFrom(d.evidence,d.parked));f.status==="paid"?t.page.markPaid():f.status==="collecting"?t.page.note(y.collecting,!e.words?.collecting):t.page.note(y.declined,!0),t.page.land(d.parked?.confirmation??f)}catch{d.parked?(t.page.note(y.unconfirmed,!0),t.page.land(d.parked.confirmation)):t.page.fail(`We could not confirm your ${e.name} payment. Please contact us before trying again \u2014 your payment may already have been taken.`)}finally{t.page.setConfirming(!1)}}function Go(e,t,n){let r=(t??"").trim();if(!r)return"";if(n.length===0)return r;let a=r.toUpperCase(),s=`${e.toUpperCase()}-${a}`,d=n.find(y=>y.code&&y.code.toUpperCase()===a)??n.find(y=>y.code&&y.code.toUpperCase()===s)??n.find(y=>y.name.toUpperCase()===a);return d?d.code||d.name:""}var On="checkout-memory-context",Xo="Prices have changed since this checkout started. The total shows today's prices.",Zo="We couldn't check today's prices for your basket. Try again in a moment \u2014 you can place the order once the total is confirmed.",Qo=3,us=3600*1e3;function ds(e){return{id:e.id,slug:e.slug,name:{lead:e.name?.lead,accent:e.name?.accent},process:e.process,positionNo:e.positionNo,config:(e.config??[]).map(t=>({label:t.label,gold:t.gold})),finishName:e.finishName,size:e.size,qty:e.qty,href:e.href,kind:e.kind,sku:e.sku,components:e.components.map(t=>({partNumber:t.partNumber,wheels:t.wheels,prices:{...t.prices},hand:t.hand}))}}var zt=e=>e.map(ds);function ea(e,t){let n=r=>JSON.stringify(r.map(a=>[a.id,a.qty]).sort(([a],[s])=>a<s?-1:a>s?1:0));return n(e)===n(t)}function ta(e){let t=e.customer;return{customer:{email:t.email,name:t.name,phone:t.phone,companyName:t.companyName,address:t.address,city:t.city,state:t.state,zipCode:t.zipCode,country:t.country},items:e.items.flatMap(n=>Tt([{partNumber:n.partNumber,wheels:n.quantity,prices:{}}],1)),currency:e.currency,idempotencyKey:e.idempotencyKey,shippingMethodId:e.shippingMethodId,couponCode:e.couponCode}}function An(e){return{...ta(e),payFirst:!!e.checkoutFlow}}function na(e){return ta(e)}var ps={lastPress:null,keptCardKey:null,placedShape:null,placedRequest:null,unpaidOrder:null};function Ln(e){let t=n=>typeof n=="string"?n:"";return{email:t(e.email),firstName:t(e.firstName),lastName:t(e.lastName),company:t(e.company),address1:t(e.address1),address2:t(e.address2),city:t(e.city),postcode:t(e.postcode),phone:t(e.phone),country:t(e.country),subdivision:t(e.subdivision),selectedAddressId:t(e.selectedAddressId),shippingMethodId:typeof e.shippingMethodId=="string"?e.shippingMethodId:null,couponCode:typeof e.couponCode=="string"?e.couponCode:null}}function In(e){return{orderNumber:e.orderNumber,checkoutNumber:e.checkoutNumber,expiresAt:e.expiresAt,status:e.status,total:e.total,currency:e.currency,freightCharge:e.freightCharge,discountAmount:e.discountAmount,grandTotal:e.grandTotal,shippingMethod:e.shippingMethod,couponCode:e.couponCode}}function Tn(e){return e.lastPress!==null||e.unpaidOrder!==null||e.keptCardKey!==null}function ms(e){let t=e.parkedAt+us,n=e.press.unpaidOrder,r=n&&!n.orderNumber?n.expiresAt:null,a=r?Date.parse(r):NaN;return Number.isNaN(a)?t:Math.min(t,a)}function ra(e){try{let t={...e,lines:zt(e.lines),press:aa(e.press)};Ie.setItem(On,JSON.stringify({v:Qo,...t}))}catch{}}var We=e=>!!e&&typeof e=="object"&&!Array.isArray(e),oa=e=>We(e)&&typeof e.idempotencyKey=="string"&&Array.isArray(e.items)&&e.items.every(t=>We(t)&&typeof t.partNumber=="string"&&typeof t.quantity=="number")&&We(e.customer)&&typeof e.payFirst=="boolean",Rn=e=>We(e)&&typeof e.id=="string"&&typeof e.qty=="number"&&Array.isArray(e.components);function fs(e){return We(e)&&typeof e.key=="string"&&oa(e.request)&&Array.isArray(e.lines)&&e.lines.every(Rn)&&Array.isArray(e.plainLines)&&e.plainLines.every(Rn)?{key:e.key,request:e.request,lines:zt(e.lines),goods:typeof e.goods=="string"?e.goods:"",plainPressed:e.plainPressed===!0,plainLines:zt(e.plainLines),plainGoods:typeof e.plainGoods=="string"?e.plainGoods:""}:null}var Vo=e=>typeof e=="string"?e:null,Jo={lastPress:fs,keptCardKey:Vo,placedShape:Vo,placedRequest:e=>oa(e)?e:null,unpaidOrder:e=>We(e)?In(e):null};function aa(e){let t=We(e)?e:{},n={...ps};for(let r of Object.keys(Jo))n[r]=Jo[r](t[r]);return n}function ia(){let e;try{e=Ie.getItem(On)}catch{return null}if(!e)return null;try{let t=JSON.parse(e);if(t.v!==Qo||typeof t.key!="string"||!t.key||!Array.isArray(t.lines)||!t.lines.every(Rn)||typeof t.parkedAt!="number")return null;let n={key:t.key,authed:t.authed===!0,parkedAt:t.parkedAt,press:aa(t.press),lines:zt(t.lines),form:t.form&&typeof t.form=="object"?Ln(t.form):null};return Date.now()>=ms(n)?(qn(),null):Tn(n.press)?n:null}catch{return null}}function qn(){try{Ie.removeItem(On)}catch{}}import{jsx as Ce}from"react/jsx-runtime";function ca(e){let t=e.indexOf(`
3
3
  `);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}function la(e,{canParkContext:t}={canParkContext:!0}){let n=e.paymentMethods,r=[];return n.includes("card")&&r.push({key:"card",title:"Card",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("paypal")&&e.paypalClientId&&r.push({key:"paypal",title:"PayPal",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL \xB7 CARDS"})}),n.includes("afterpay")&&r.push({key:"afterpay",title:"Afterpay",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 \xD7 INTEREST-FREE"})}),n.includes("square")&&e.squareApplicationId&&e.squareLocationId&&r.push({key:"square",title:"Card (Square)",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("gocardless")&&t&&r.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),n.includes("zip")&&r.push({key:"zip",title:"Zip",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),n.includes("klarna")&&t&&r.push({key:"klarna",title:"Klarna",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),n.includes("bank")&&r.push({key:"bank",title:"Bank transfer",body:null,price:Ce("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),r}var fa="This shop does not take payment online yet. Please contact the shop to order.",et=class extends Error{};function ua(e,t){if(!e.orderNumber&&Yt(t))return t.message;let n=t instanceof ue?` (${t.message})`:"";return e.orderNumber?`Your order ${e.orderNumber} is saved, but the payment did not start${n}. Try the payment again \u2014 your order will not be placed twice.`:`Your items are held under ${e.checkoutNumber}, but the payment did not start${n}. Try the payment again \u2014 you will not be charged twice.`}var hs=3e3,bs=.005,da=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]);function pa(){let e=Gr();return{...e==="denied"?{}:Do(),...e?{adConsent:e}:{}}}var ge=e=>JSON.parse(e),vs={lastPress:null,keptCardKey:null,placedShape:null,placedRequest:null,unpaidOrder:null},ks={lastPress:e=>e&&{key:e.key,request:An(e.request),lines:e.lines,goods:ge(e.shape)[0],plainPressed:!!e.plainMethod,plainLines:e.plainLines,plainGoods:ge(e.plainShape)[0]},keptCardKey:e=>e,placedShape:e=>e===null?null:ge(e)[0],placedRequest:e=>e&&An(e.body),unpaidOrder:e=>e&&In(e)};function ma(e,t){let n={};for(let r of Object.keys(e))n[r]=e[r](t[r]);return n}var ya="Shipping cannot be calculated right now. Please try again.";function ga(e){return`Your order is saved, so its contact, address, delivery and discount can't change here. To change any of them, contact the shop and quote ${e}.`}function xs({site:e,logo:t,preview:n=!1}){let{items:r,totals:a,coupon:s,refuseCoupon:d,deliveryOptions:y,shippingMethodId:f,setShippingMethodId:p,setQuoteDestination:k,courier:h,requote:b,identify:v,clearCapturedCart:R,replaceItems:C,removeCoupon:O,applyCoupon:V}=_t(),E=y.find(o=>o.id===f)?.pickupLocation??null,{country:P,countries:Y,activeCountry:Z,formatMoney:pe}=ye(),[j,se]=N(()=>la(e)[0]?.key??null),[Se,qe]=N(!0);z(()=>{qe(Ar(Ie))},[]);let[ee,he]=N(!1),[re,te]=N(""),[H,g]=N(""),[we,Fe]=N(""),[U,nt]=N(""),[Q,be]=N(""),[Ee,Re]=N(""),[L,oe]=N(""),[me,Oe]=N(""),[ve,rt]=N(""),[W,ot]=N(()=>P||Y[0]?.code||""),[ke,vt]=N(""),[at,Dn]=N([]),[Xt,Zt]=N(null),[kt,Be]=N(null),jn=sa(()=>Y.find(o=>o.code===W)??Z,[Y,W,Z]),Aa=jn?.postalLabel||"Postal Code",La=at[0]?.divisionType||"State / Province";z(()=>{if(!W){Dn([]),Zt(W);return}Zt(null);let o=!1;return $.listCountrySubdivisions(W).then(c=>{o||(Dn(c),Zt(W),vt(""))}),()=>{o=!0}},[W]);let Un=Q.trim()!==""&&L.trim()!==""&&me.trim()!==""&&Xt===W&&(at.length===0||ke!=="")?me.trim():"";z(()=>{k(W?{country:W,subdivision:ke,postcode:Un}:null)},[W,ke,Un,k]),z(()=>()=>k(null),[k]);let Ia=h?.status==="unavailable",Ta=b,[it,Wn]=N(null),[qa,$n]=N([]),[Qt,xt]=N("new"),[Yn,Bn]=N(!1),[en,Fa]=N("Home"),[_a,zn]=N(null),[Ma,tn]=N(null),[_e,Ct]=N(()=>ft()),Hn=B(null),[nn,ze]=N(null),[Ka,ce]=N(null),[Gn,Pt]=N(null),[Vn,Da]=N(!1),[Jn,ja]=N(!1),[Ae,He]=N(null),[Ua,Nt]=N(!1),[J,le]=N(null),Xn=!!J?.orderNumber,Wa=Xn||ee,[$a,Ya]=N(null),[Ba,za]=N(!1),[Ha,Ga]=N(!1),[Va,Ja]=N(!1),[Xa,Za]=N(!1),[Zn,Qa]=N(!1),[ei,rn]=N(!1),[st,Qn]=N(null),A=B({...vs});A.current.unpaidOrder=J;let on=B(!1),Me=B(r),er=!!(nn||st&&st.kind!=="processing"||Zn||Vn||Jn||Gn&&Ae?.orderNumber);z(()=>{er&&(C([]),O())},[er,C,O]);let tr=B(!1);z(()=>{n||tr.current||!r.some(mt)||(tr.current=!0,Fr({lines:r,currency:a.currency,value:a.subtotal-a.discount,coupon:s?.valid?s.code:void 0}))},[r,a,s,n]),z(()=>{v(re,H.trim()||void 0)},[re,H,v]);let nr=B(null),[St,ti]=N(null);z(()=>{let o=nr.current;if(!St||!o)return;let c=()=>o.style.setProperty("--sf-checkout-header-h",`${St.offsetHeight}px`);c();let m=new ResizeObserver(c);return m.observe(St),()=>m.disconnect()},[St]),z(()=>{let o=m=>({setConfirming:m,land:ze,markPaid:()=>Nt(!0),note:(w,u)=>Ya({text:w,warning:u}),fail:ce,clearCart:R,lostChange:()=>tn($t)}),c={search:window.location.search,storage:Ie,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};ht(Yo,{...c,capture:$.captureAfterpayPayment,page:o(za)}),ht(Bo,{...c,capture:$.captureZipPayment,page:o(Ja)}),ht(zo,{...c,capture:$.completeGocardlessPayment,page:o(Ga)}),ht(Ho,{...c,capture:$.captureKlarnaPayment,page:o(Za)})},[]);function rr(o){let[c,m]=ca(o.address);be(c),Re(m),oe(o.city),Oe(o.zip_code),o.country&&ot(o.country),o.phone&&rt(o.phone),Be({country:o.country||null,state:o.state??""})}z(()=>{if(kt){if((kt.country||W)!==W){Be(null);return}Xt===W&&(vt(Go(W,kt.state,at)),Be(null))}},[kt,W,Xt,at]),z(()=>{let o=!1;return(async()=>{try{let[c,m,w]=await Promise.all([Ze.me(),Ze.myProfile().catch(()=>null),Ze.myAddresses().catch(()=>[])]);if(o)return;Wn(c);let u=w.filter(_=>_.is_active);$n(u),te(c.email);let T=(m?.contact_name??"").split(/\s+/);g(c.first_name||T[0]||""),Fe(c.last_name||T.slice(1).join(" "));let F=c.phone||m?.phone;F&&rt(F);let q=u.find(_=>_.id===c.default_delivery_location)??u[0];if(q)xt(q.id),rr(q);else if(m){let[_,Xe]=ca(m.address??"");be(_),Re(Xe),oe(m.city??""),Oe(m.zip_code??""),m.country&&ot(m.country),Be({country:m.country||null,state:m.state??""})}It.current&&ur(It.current,!1)}catch{}})(),()=>{o=!0}},[]);function ni(){Ze.logout(),ct.current=!0,It.current=null,Lt.current=null,lt(),Wn(null),$n([]),xt("new"),Bn(!1),te(""),g(""),Fe(""),nt(""),be(""),Re(""),oe(""),Oe(""),rt(""),ot(P||Y[0]?.code||""),vt(""),Be(null)}let Ge=sa(()=>la(e,{canParkContext:Se}),[e,Se]);z(()=>{Ge.some(o=>o.key===j)||se(Ge[0]?.key??null)},[Ge,j]);let ri=Ge.length===0,wt=Ee.trim()?`${Q}
4
4
  ${Ee.trim()}`:Q,oi=qo({email:re,firstName:H,lastName:we,company:U.trim(),phone:ve,address:wt,city:L,subdivision:ke,postcode:me,country:W,lines:r.map(o=>[o.id,o.qty]),shippingMethodId:f,couponCode:fn(s),currency:a.currency,shopperId:it?.id??null}),ae=JSON.stringify([oi,j]),an=B(null),Et=B(!1),Le=B(!1),Ve=B(null),Rt=B(!1),fe=B(ae);fe.current=ae;let or=B(ee);or.current=ee;let Ot=B(null);z(()=>{let o=()=>{let c=Ot.current;c&&(Ot.current=null,le(c),he(!1))};return window.addEventListener("pageshow",o),()=>window.removeEventListener("pageshow",o)},[]);function At(o,c,m,w){let u={idempotencyKey:c,confirmation:m};gr()&&(u.lostChange=!0),Ie.setItem(o,JSON.stringify(u)),window.location.assign(w),Ot.current=m}async function ar(o){he(!0);try{await o()}finally{Ot.current||he(!1)}}let ir=B(!1),sr=!!(nn||st&&st.kind!=="processing");z(()=>{sr&&(ir.current=!0,lt())},[sr]);let Lt=B(null),ct=B(!1),sn=B(null);function lt(){sn.current=null,qn()}let It=B(null),[Je,ai]=N(!1);function cn(o){if(ir.current||n||ct.current)return;let c={key:o,authed:on.current,parkedAt:sn.current??=Date.now(),press:ma(ks,A.current),lines:r.length>0?r:Me.current,form:Ln({email:re,firstName:H,lastName:we,company:U,address1:Q,address2:Ee,city:L,postcode:me,phone:ve,country:W,subdivision:ke,selectedAddressId:Qt,shippingMethodId:f,couponCode:s?.valid?s.code:null})};Tn(c.press)?ra(c):lt()}let cr=B(j);cr.current=j;function ln(o){return{...na(o),...pa(),...o.payFirst?{checkoutFlow:Wt}:{}}}function ii(o,c){let m=o.request.payFirst?"":null,w=o.plainPressed?null:"",u=()=>cr.current??"";return{key:o.key,send:()=>c(ln(o.request)),request:ln(o.request),lines:o.lines,shape:JSON.stringify([o.goods,null]),get method(){return m??u()},set method(T){m=T},get plainMethod(){return w??u()},set plainMethod(T){w=T},plainLines:o.plainLines,plainShape:JSON.stringify([o.plainGoods,null])}}let[si,ci]=N(!1),lr=si?!a.quoted||a.serverSubtotal===null?"waiting":Math.abs(a.serverSubtotal-a.subtotal)<bs?"same":"changed":null,un=!J&&lr==="waiting",li=un?{...a,repricing:!0}:a,dn=un&&a.quoteFailed;z(()=>{if(!dn)return;let o=setInterval(b,hs);return()=>clearInterval(o)},[dn,b]);let ui=b;function ur(o,c=!0){te(o.email),g(o.firstName),Fe(o.lastName),nt(o.company),be(o.address1),Re(o.address2),oe(o.city),Oe(o.postcode),rt(o.phone),o.country&&ot(o.country),Be({country:o.country||null,state:o.subdivision}),xt(o.selectedAddressId),o.shippingMethodId&&p(o.shippingMethodId),c&&(Lt.current=o.couponCode)}z(()=>{let o=n?null:ia(),c=!!(o&&r.length>0);if(o&&c&&!ea(o.lines,r)&&(lt(),o=null),o){let m=o.authed?$.createOrderAuthed:$.createOrder;Ct(o.key),sn.current=o.parkedAt,on.current=o.authed;let w={lastPress:u=>u&&ii(u,m),keptCardKey:u=>u,placedShape:u=>u===null?null:JSON.stringify([u,null]),placedRequest:u=>{if(!u)return null;let T=ln(u);return{body:T,send:()=>m(T)}},unpaidOrder:u=>u};A.current=ma(w,o.press),o.press.unpaidOrder&&le(o.press.unpaidOrder),o.lines.length>0&&!c&&(C(o.lines),Me.current=o.lines,ci(!0)),o.form&&(It.current=o.form,ur(o.form))}ai(!0)},[]),z(()=>{!Je||r.length>0||A.current.unpaidOrder||ee||(ct.current=!0,lt())},[Je,r.length]),z(()=>{let o=Lt.current;!Je||!o||r.length===0||(Lt.current=null,V(o,re||void 0))},[Je,r.length]),z(()=>{!Je||ee||cn(_e)},[Je,ee,_e,J]);let Ke=B(null);z(()=>{or.current||(ae!==Ke.current&&(Ke.current=null),!(!Le.current||!J||J.orderNumber)&&(ae===A.current.placedShape||ae===Ke.current||ar(()=>dr(J))))},[ae,J]);async function dr(o){if(Rt.current)return null;Rt.current=!0;try{let c=Ve.current?await Lo(Ve.current):"none";if(c==="succeeded"||c==="processing")return Le.current=!1,le(null),xe("card"),c==="succeeded"?await De(void 0,o):xr(o),null;if(c===void 0||!Io.has(c))return Ke.current=fe.current,le(o),ce(c==="requires_action"?Oo:Te),null;let m=await xn(_e);if(m==="committed")return Le.current=!1,le(null),xe("card"),await De(void 0,o),null;if(m!=="released")return Ke.current=fe.current,le(o),ce(Te),null;Le.current=!1,Ve.current=null,Ke.current=null,ce(null),le(null);let w=ft();return Ct(w),w}finally{Rt.current=!1}}async function di(){n||ee||Rt.current||await ar(pi)}async function pi(){if(J){if((Le.current?ae!==A.current.placedShape:ut())&&!J.orderNumber){let w=await dr(J);w&&fe.current===ae&&await pr(w);return}ce(null),Et.current=!1,await pn();let c=ge(fe.current)[1],m=J.orderNumber?c:"card";if(m&&da.has(m)&&ut()&&ge(fe.current)[0]!==an.current){mr(J);return}xe(m),m!==j&&se(m),await Cr(J,m,!J.orderNumber);return}await pr(_e)}async function pr(o){if(r.length===0||a.repricing||un||!j||!Ge.some(F=>F.key===j))return;let c=r.filter(mt).flatMap(F=>Tt(F.components,F.qty));if(c.length===0){ce("Pick a size on each wheel's product page before checking out.");return}ce(null);let m,w=o,u=j,T=!1;try{let F=it?$.createOrderAuthed:$.createOrder,q={customer:{email:re,name:`${H} ${we}`.trim(),phone:ve.trim()||void 0,companyName:U.trim()||void 0,address:wt,city:L,state:ke||void 0,zipCode:me,country:W},items:c,currency:a.currency,idempotencyKey:o,shippingMethodId:f??void 0,couponCode:fn(s),...pa(),...Eo(j)?{checkoutFlow:Wt}:{}};A.current.placedRequest={body:q,send:()=>F(q)},on.current=!!it,ct.current=!1,tn(null),an.current=null,Et.current=!1,Ve.current=null,Le.current=!1,Ke.current=null,A.current.placedShape=ae,Me.current=r;let _=A.current.lastPress,Xe=_?.key===q.idempotencyKey&&(_.shape!==ae&&(!!q.checkoutFlow||!!_.method||!!_.plainMethod)||!!q.checkoutFlow&&!!_.plainMethod);Xe&&(A.current.keptCardKey=q.idempotencyKey);let Sr=br(q,F),wr=Xe||!q.checkoutFlow&&A.current.keptCardKey===q.idempotencyKey,Er=!Sr&&!wr&&!q.checkoutFlow&&!!_&&!_.method;Er&&(_.plainMethod=j,_.plainLines=r,_.plainShape=ae,cn(q.idempotencyKey));let je=await(wr?yr(q,F):F(q).then(dt=>({answer:dt,request:q})).catch(dt=>(Sr?fr(dt,q.idempotencyKey):Er&&Pn(dt)&&(_.plainMethod=""),mi(dt,q,F))));if(!je)return;m=je.answer,w=je.request.idempotencyKey,u=je.method??u,xe(u),T=ut()||u!==ge(fe.current)[1],je.method&&je.method!==j&&se(je.method),m.orderNumber&&(vr(m),R()),await pn()}catch(F){let q=qr(F);q?(d(q),ce(`${q} Your order has not been placed. Place it again to continue without the code.`)):F instanceof et?ce(Te):ce(F instanceof ue?F.message:"Could not place the order. Please try again.");return}if(u&&da.has(u)&&(T||ut())){mr(m);return}await Cr(m,u,!1,w)}function mr(o){an.current=ge(fe.current)[0],ce(`${ua(o,null)} ${$t}`),le(o)}function fr(o,c){Pn(o)&&!Cn(o)&&A.current.lastPress?.key===c&&(A.current.lastPress=null)}async function mi(o,c,m){if(Yt(o))return hr(c,m);if(!Cn(o))throw o;return A.current.keptCardKey=c.idempotencyKey,yr(c,m,!0)}async function yr(o,c,m=!1){let w=await xn(o.idempotencyKey);if(w==="released")return hr(o,c);if(w!=="committed")throw new et;let u=A.current.lastPress?.key===o.idempotencyKey?A.current.lastPress:null;if(Me.current=u?.lines??r,u?.method&&!m){A.current.keptCardKey=null,A.current.placedRequest={body:u.request,send:u.send};let Xe=await u.send().catch(()=>{throw new et});return A.current.placedShape=u.shape,{answer:Xe,request:o,method:u.method}}let T={...o,checkoutFlow:Wt},F=u&&!u.method?{body:u.request,send:u.send}:{body:T,send:()=>c(T)};A.current.placedRequest=F;let q=F.send,_=await q().catch(()=>null);if(!_&&u?.plainMethod)throw new et;return _?.orderNumber&&_.status!==Ro?(A.current.keptCardKey=null,u?.plainMethod&&(Me.current=u.plainLines),u&&(A.current.placedShape=u.plainMethod?u.plainShape:u.shape),{answer:_,request:o,method:u?.plainMethod||void 0}):(u&&(A.current.placedShape=u.shape),xe("card"),await kr("",_?async()=>_:()=>Promise.reject(new Error("The order request did not answer."))),await pn(),null)}function ut(){let o=A.current.placedShape;return o!==null&&ge(o)[0]!==ge(fe.current)[0]}function xe(o){o!==ge(fe.current)[1]&&(Et.current=!0),tn(gr()?$t:null)}function gr(){return Et.current||ut()}async function hr(o,c){let m={...o,idempotencyKey:ft()};A.current.keptCardKey=null,Ct(m.idempotencyKey),A.current.placedRequest={body:m,send:()=>c(m)},br(m,c);try{return{answer:await c(m),request:m}}catch(w){throw fr(w,m.idempotencyKey),w}}function br(o,c){return A.current.lastPress?.key===o.idempotencyKey?!1:(A.current.lastPress={key:o.idempotencyKey,send:()=>c(o),request:o,lines:r,shape:ae,method:o.checkoutFlow?"":j??"",plainMethod:"",plainLines:r,plainShape:ae},ct.current=!1,cn(o.idempotencyKey),!0)}function vr(o){_r({confirmation:o,lines:Me.current,adsSendTo:e.googleAdsId&&e.googleAdsConversionLabel?`${e.googleAdsId}/${e.googleAdsConversionLabel}`:null}),$o({confirmation:o,lines:Me.current})}async function De(o,c=Ae){if(!c)return;let m=o?async()=>o:A.current.placedRequest?.send;if(c.orderNumber||!m){Nt(!0),ze(c);return}await kr(c.checkoutNumber,m)}async function kr(o,c){R(),await Fo({checkoutNumber:o,resend:c,page:{setConfirming:Qa,land:ze,markPaid:()=>Nt(!0),track:vr,unplaced:Qn}})}function xr(o=Ae){if(o){if(o.orderNumber){ze(o);return}R(),Qn({kind:"processing",checkoutNumber:o.checkoutNumber})}}async function pn(){let o=JSON.stringify([en.trim(),H,we,ve.trim(),wt,L,ke,me,W]);if(!(!it||!Yn||Qt!=="new"||Hn.current===o))try{await Ze.createAddress({label:en.trim()||"Home",contact_name:`${H} ${we}`.trim(),phone:ve.trim(),address:wt,city:L,zip_code:me,state:ke,country:W}),Hn.current=o,zn("Address saved to your account.")}catch{zn("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}}async function Cr(o,c=j,m=!1,w=_e){le(null);try{if(c==="card"&&e.paymentMethods.includes("card")){let u=await $.createPaymentIntent({idempotencyKey:w});Ve.current=u;let T=o;if(m){let F=await A.current.placedRequest?.send().catch(()=>null);if(F?.orderNumber){xe("card"),await De(F,o);return}T=Pr(o,F)??{...o,expiresAt:null}}xe("card"),He(T),rn(!1),Pt(u)}else if(c==="paypal"&&e.paymentMethods.includes("paypal"))He(o),Da(!0);else if(c==="afterpay"&&e.paymentMethods.includes("afterpay")){let u=window.location.origin,T=await $.createAfterpayCheckout({idempotencyKey:w,confirmUrl:`${u}/checkout?afterpay=confirm`,cancelUrl:`${u}/checkout?afterpay=cancel`});At(Nn,w,o,T.redirectCheckoutUrl);return}else if(c==="square"&&e.paymentMethods.includes("square"))He(o),ja(!0);else if(c==="gocardless"&&e.paymentMethods.includes("gocardless")){let u=window.location.origin,T=await $.createGocardlessBillingRequest({idempotencyKey:w,confirmUrl:`${u}/checkout?gocardless=confirm`,cancelUrl:`${u}/checkout?gocardless=cancel`});At(Sn,w,o,T.authorisationUrl);return}else if(c==="zip"&&e.paymentMethods.includes("zip")){let u=window.location.origin,T=await $.createZipCheckout({idempotencyKey:w,redirectUrl:`${u}/checkout?zip=return`});At(wn,w,o,T.redirectUrl);return}else if(c==="klarna"&&e.paymentMethods.includes("klarna")){let u=window.location.origin,T=await $.createKlarnaCheckout({idempotencyKey:w,confirmUrl:`${u}/checkout?klarna=confirm`,cancelUrl:`${u}/checkout?klarna=cancel`});At(En,w,o,T.redirectUrl);return}else xe(c),ze(o)}catch(u){if((m||c==="card")&&u instanceof ue&&u.status===409){xe(c),await De(void 0,o);return}Nr(o,u)}}function Pr(o,c){return c&&!c.orderNumber&&c.status==="open"&&c.checkoutNumber===o.checkoutNumber?c:null}function Nr(o,c){ce(ua(o,c)),!o.orderNumber&&Yt(c)?(Le.current=!1,Ct(ft())):le(o)}async function fi(o){if(!Ae)return;let c=Ae;try{let m=await $.createPaymentIntent({idempotencyKey:_e}),w=await A.current.placedRequest?.send().catch(()=>null);if(w?.orderNumber){await De(w);return}let u=Pr(c,w);He(u??{...c,expiresAt:null}),rn(o&&u!==null),Ve.current=m,Pt(m)}catch(m){if(m instanceof ue&&m.status===409){await De();return}Pt(null),He(null),Nr(c,m)}}function yi(){Ae&&(Le.current=!0,le(Ae),Pt(null),He(null),rn(!1))}return{site:e,logo:t,items:r,totals:li,coupon:s,deliveryOptions:y,courierUnavailable:Ia,retryCourier:Ta,shippingMethodId:f,setShippingMethodId:p,pickupLocation:E,servedCountries:Y,formatMoney:pe,payChoice:j,setPayChoice:se,placing:ee,email:re,setEmail:te,firstName:H,setFirstName:g,lastName:we,setLastName:Fe,company:U,setCompany:nt,address1:Q,setAddress1:be,address2:Ee,setAddress2:Re,city:L,setCity:oe,postcode:me,setPostcode:Oe,phone:ve,setPhone:rt,country:W,setCountry:ot,subdivision:ke,setSubdivision:vt,subdivisions:at,destination:jn,postcodeLabel:Aa,subdivisionLabel:La,me:it,savedAddresses:qa,selectedAddressId:Qt,setSelectedAddressId:xt,saveAddress:Yn,setSaveAddress:Bn,saveLabel:en,setSaveLabel:Fa,addressSaveNote:_a,lostChangeNote:Ma,idemKey:_e,confirmation:nn,setConfirmation:ze,orderError:Ka,payment:Gn,paypalStep:Vn,squareStep:Jn,pendingConf:Ae,paid:Ua,setPaid:Nt,unpaidOrder:J,orderLocked:Xn,formLocked:Wa,restoredPrices:lr,quoteFailed:dn,retryQuote:ui,payNote:$a,afterpayConfirming:Ba,gocardlessConfirming:Ha,zipConfirming:Va,klarnaConfirming:Xa,cardConfirming:Zn,checkoutResult:st,confirmCardPayment:De,cardStillProcessing:xr,renewCardPayment:fi,holdRenewed:ei,leaveCardPayment:yi,checkoutRootRef:nr,setCheckoutHeaderEl:ti,fillFromAddress:rr,checkoutSignOut:ni,payOptions:Ge,noPaymentMethod:ri,placeOrder:di}}var ha=ys(null);function ba({children:e,...t}){let n=xs(t);return Ce(ha.Provider,{value:n,children:e})}function Pe(){let e=gs(ha);if(!e)throw new Error("useCheckout must be used inside CheckoutStateProvider");return e}import{useId as Fn}from"react";import{Fragment as Ne,jsx as i,jsxs as S}from"react/jsx-runtime";function ka(){let{email:e,setEmail:t,firstName:n,setFirstName:r,lastName:a,setLastName:s,company:d,setCompany:y,me:f,checkoutSignOut:p,orderLocked:k,unpaidOrder:h}=Pe(),b=Fn();return S(Vt,{num:"N\xB0 01",title:"Contact",children:[k&&h&&i(Ps,{orderNumber:h.orderNumber}),i(ie,{label:"Email",htmlFor:b,hint:f?S(Ne,{children:["Signed in \xB7"," ",i("button",{type:"button",onClick:p,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:i("input",{id:b,type:"email",value:e,onChange:v=>t(v.target.value),placeholder:"you@example.com",readOnly:f!==null,className:ne})}),S(Sa,{children:[i(ie,{label:"First name",children:i("input",{type:"text",value:n,onChange:v=>r(v.target.value),className:ne})}),i(ie,{label:"Last name",children:i("input",{type:"text",value:a,onChange:v=>s(v.target.value),className:ne})})]}),i(ie,{label:"Company (optional)",children:i("input",{type:"text",value:d,onChange:v=>y(v.target.value),autoComplete:"organization",className:ne})})]})}function xa(){let{pickupLocation:e,servedCountries:t,address1:n,setAddress1:r,address2:a,setAddress2:s,city:d,setCity:y,postcode:f,setPostcode:p,phone:k,setPhone:h,country:b,setCountry:v,subdivision:R,setSubdivision:C,subdivisions:O,destination:V,postcodeLabel:E,subdivisionLabel:P,me:Y,savedAddresses:Z,selectedAddressId:pe,setSelectedAddressId:j,saveAddress:se,setSaveAddress:Se,saveLabel:qe,setSaveLabel:ee,fillFromAddress:he,orderLocked:re}=Pe(),te=Fn(),H=Fn();return S(Vt,{num:"N\xB0 02",title:e?"Collection":"Shipping address",children:[e?S("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[i("span",{className:"font-medium",children:e.name}),[e.address,e.city,e.state,e.zipCode,e.country].filter(Boolean).length>0&&i("span",{className:"opacity-80",children:[e.address,e.city,e.state,e.zipCode,e.country].filter(Boolean).join(", ")}),e.openingHours&&i("span",{className:"opacity-80",children:e.openingHours}),e.readyIn&&i("span",{className:"opacity-80",children:e.readyIn}),e.instructions&&i("span",{className:"opacity-80",children:e.instructions}),i("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):S(Ne,{children:[Y!==null&&Z.length>0&&S("div",{className:"grid gap-3",children:[Z.map(g=>i(Ht,{active:pe===g.id,onClick:()=>{j(g.id),he(g)},title:g.label,body:g.formatted_address,price:null},g.id)),i(Ht,{active:pe==="new",onClick:()=>j("new"),title:"New address",body:null,price:null})]}),i(ie,{label:"Address line 1",children:i("input",{type:"text",value:n,onChange:g=>r(g.target.value),className:ne})}),i(ie,{label:"Address line 2",children:i("input",{type:"text",value:a,onChange:g=>s(g.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:ne})}),S(Sa,{cols:"three",children:[i(ie,{label:"City",children:i("input",{type:"text",value:d,onChange:g=>y(g.target.value),className:ne})}),i(ie,{label:E,children:i("input",{type:"text",value:f,onChange:g=>p(g.target.value),className:ne})}),i(ie,{label:"Country",separate:!0,htmlFor:te,children:i(gn,{id:te,value:b,onChange:g=>v(g.target.value),className:ne+" pr-10",style:va,children:t.map(g=>i("option",{value:g.code,children:g.name},g.code))})})]}),i(ie,{label:P,separate:!0,htmlFor:H,children:O.length>0?S(gn,{id:H,value:R,onChange:g=>C(g.target.value),className:ne+" pr-10",style:va,children:[i("option",{value:"",children:"Select\u2026"}),O.map(g=>i("option",{value:g.code||g.name,children:g.name},g.code||g.name))]}):i("input",{id:H,type:"text",value:R,onChange:g=>C(g.target.value),className:ne})})]}),i(ie,{label:"Phone",children:i("input",{type:"tel",value:k,onChange:g=>h(g.target.value),className:ne})}),!e&&Y!==null&&pe==="new"&&!re&&S(Ne,{children:[i(Ns,{checked:se,onChange:Se,label:"Save this address to my account"}),se&&i(ie,{label:"Address label",children:i("input",{type:"text",value:qe,onChange:g=>ee(g.target.value),placeholder:"Home",className:ne})})]})]})}function Ca(){let{totals:e,coupon:t,deliveryOptions:n,shippingMethodId:r,setShippingMethodId:a,pickupLocation:s,formatMoney:d,city:y,destination:f,courierUnavailable:p,retryCourier:k}=Pe();return i(Vt,{num:"N\xB0 03",title:"Shipping",children:S("div",{className:"grid gap-3",children:[n.map(h=>{let b=h.pickupLocation,v=b?[b.address,b.city,b.state,b.zipCode].filter(Boolean).join(", "):null;return i(Ht,{active:r===h.id,onClick:()=>a(h.id),title:b?`${h.name} \u2014 ${b.name}`:h.name,body:b?[v,b.openingHours,b.readyIn,b.instructions,h.description].filter(Boolean).join(" \xB7 "):h.description||null,price:e.freeShipping||h.amount===0?qt:d(h.amount,e.currency),tag:h.tag||void 0},h.id)}),p?S("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ya," ",i("button",{type:"button",onClick:k,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}):n.length===0&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Pa(){let{payChoice:e,setPayChoice:t,payment:n,payOptions:r,noPaymentMethod:a}=Pe();return S(Vt,{num:"N\xB0 04",title:"Payment",children:[a&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:fa}),i("div",{className:"grid gap-3",children:r.map(s=>i(Ht,{active:e===s.key,onClick:()=>t(s.key),title:s.title,body:s.body,price:s.price,tag:s.tag},s.key))}),e==="card"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):e==="paypal"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll approve the payment with PayPal on the payment step after placing the order."}):e==="afterpay"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):e==="square"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):e==="gocardless"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):e==="zip"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Zip to approve four instalments, then brought straight back."}):e==="klarna"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Klarna to choose how to pay, then brought straight back."}):e==="bank"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Na(){let{site:e,items:t,totals:n,coupon:r,formatMoney:a,payChoice:s,placing:d,email:y,orderError:f,payment:p,noPaymentMethod:k,unpaidOrder:h,formLocked:b,restoredPrices:v,quoteFailed:R,retryQuote:C,placeOrder:O}=Pe(),V=v==="waiting",E=v==="changed";return S("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[S("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[i("span",{children:"Your order"}),i(bt,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit \u2197"})]}),i("div",{className:"flex flex-col px-6 py-2",children:t.length===0?S("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",i(bt,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):t.map(P=>i(Ss,{slug:P.slug,name:P.name,qty:P.qty,config:P.config,configSummary:ws(P.config),price:E||V?null:jr(P,n.currency)??0,currency:n.currency},P.id))}),i(Gt,{locked:b,className:"border-t border-line px-6 pt-5",children:i(Br,{customerEmail:y,disabled:b})}),S("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[i($e,{label:"Subtotal",value:V?Ft:a(E?n.serverSubtotal??0:n.subtotal,n.currency)}),n.discount>0&&r?.valid&&i($e,{label:`Coupon \xB7 ${r.code}`,value:S("span",{className:"font-semibold text-green",children:["\u2212 ",a(n.discount,n.currency)]})}),r?.deferred&&i($e,{label:`Coupon \xB7 ${r.code}`,value:Tr}),r?.valid&&r.effects?.gift&&i($e,{label:`Free gift \xB7 ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` \xD7${r.effects.gift.quantity}`:""}`,value:i("span",{className:"font-semibold text-green",children:qt})}),i($e,{label:"Shipping",value:n.shippingStatus==="free"?i("span",{className:"font-semibold text-green",children:qt}):Kr(n.shippingStatus)??a(n.shipping,n.currency)}),n.tax&&(n.tax.charged?i($e,{label:n.tax.inclusive?`${n.tax.name} included \xB7 ${n.tax.rate}%`:n.tax.name,value:a(n.tax.amount,n.currency)}):n.tax.name?i($e,{label:n.tax.name,value:Mr}):null)]}),S("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[i("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),i("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?Ft:a(n.grand,n.currency)})]}),S("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[E&&i(de,{tone:"quiet",children:Xo}),R&&S(de,{role:"alert",children:[Zo," ",i("button",{type:"button",onClick:C,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}),f&&i(de,{role:"alert",children:f}),n.hasUnpricedLine&&S(de,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),i("button",{type:"button",onClick:O,disabled:d||!h&&(k||t.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",d||!h&&(t.length===0||k||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:d?S(Ne,{children:["Building order\u2026 ",i("span",{children:"\xB7"})]}):k?S(Ne,{children:["No online payment ",i("span",{children:"\xB7"})]}):h?S(Ne,{children:["Try payment again \xB7 ",Bt(h),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]}):R?S(Ne,{children:["Total not confirmed ",i("span",{children:"\xB7"})]}):n.repricing?S(Ne,{children:[Ft," ",i("span",{children:"\xB7"})]}):S(Ne,{children:[s==="bank"?"Place order":"Continue to payment"," \xB7"," ",a(n.grand,n.currency),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})}var Cs=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function Gt({locked:e,className:t="",children:n}){return i("fieldset",{disabled:e,className:"m-0 min-w-0 border-0 p-0 "+t+Cs,children:n})}function bt({href:e,className:t="",children:n,...r}){let{placing:a}=Pe();return a?i("span",{"aria-disabled":"true","aria-label":r["aria-label"],className:t+" pointer-events-none",children:n}):i(Ue,{href:e,"aria-label":r["aria-label"],className:t,children:n})}function Ps({orderNumber:e}){return i(de,{tone:"quiet",role:"status",children:S("span",{className:"flex items-start gap-2",children:[S("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[i("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),i("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),i("span",{children:ga(e)})]})})}var va={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 Vt({num:e,title:t,children:n}){return S("section",{className:"mb-6 border border-line bg-bg",children:[S("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[i("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e}),i("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:t})]}),i("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function Sa({cols:e="two",children:t}){return i("div",{className:["grid gap-3 max-[640px]:grid-cols-1",e==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:t})}function Ht({active:e,onClick:t,title:n,body:r,price:a,tag:s}){return S("button",{type:"button",onClick:t,"aria-pressed":e,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",e?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[e&&i("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),i("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",e?"border-accent":"border-fg-dim"].join(" "),children:e&&i("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),S("span",{className:"flex min-w-0 flex-col gap-1",children:[S("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&i("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:s})]}),r&&i("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),i("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:a})]})}function Ns({checked:e,onChange:t,label:n,sub:r}){return S("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[i("button",{type:"button",onClick:()=>t(!e),"aria-pressed":e,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",e?"border-accent":"border-line"].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:e&&i("span",{className:"text-[13px] text-accent",children:"\u2713"})}),S("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,r&&i("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:r})]})]})}function Ss({slug:e,name:t,qty:n,config:r,configSummary:a,price:s,currency:d}){let{catalog:y}=_t(),{formatMoney:f}=ye(),p=y.find(C=>C.slug===e),k=p?.spokes??5,h=p?.mesh??!1,b=r.find(C=>C.gold)?.label,v=p?.finishes.find(C=>C.name===b&&C.src)??p?.finishes.find(C=>C.src),R=p?.finishes[0]?.color??Yr;return S("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[S("div",{className:"relative aspect-square",children:[i("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:v?.src?i(Rr,{src:v.src,alt:`${t.lead}${t.accent} \u2014 ${v.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):i("div",{className:"block w-[78%]",style:{color:R},children:i($r,{spokes:k,mesh:h,className:"block w-full"})})}),i("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),S("div",{className:"flex min-w-0 flex-col gap-0.5",children:[S("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[t.lead,i("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:t.accent})]}),i("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:a})]}),i("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:s===null?null:f(s,d)})]})}function $e({label:e,value:t}){return S("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[i("span",{children:e}),i("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:t})]})}function ws(e){return e.map(t=>t.label).join(" \xB7 ")}import{Fragment as G,jsx as l,jsxs as x}from"react/jsx-runtime";function Kn(e){return l(ba,{...e,children:l(Ls,{})})}function Os({order:e,paid:t}){let{formatMoney:n}=ye();if(!e.grandTotal||!e.currency)return null;let r=d=>n(Number(d),e.currency),a=Number(e.freightCharge??0),s=Number(e.discountAmount??0);return x("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(e.shippingMethod||a>0)&&x(G,{children:[x("dt",{className:"text-fg-dim",children:["Delivery",e.shippingMethod?` \xB7 ${e.shippingMethod}`:""]}),l("dd",{className:"text-right font-mono",children:r(e.freightCharge??"0")})]}),s>0&&x(G,{children:[x("dt",{className:"text-fg-dim",children:["Discount",e.couponCode?` \xB7 ${e.couponCode}`:""]}),x("dd",{className:"text-right font-mono",children:["\u2212",r(e.discountAmount??"0")]})]}),l("dt",{className:"text-fg",children:t?"Total paid":"Order total"}),l("dd",{className:"text-right font-mono text-fg",children:r(e.grandTotal)})]})}function As({result:e,lostChangeNote:t=null}){let n=l("span",{className:"font-mono text-fg",children:e.checkoutNumber});return x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:e.kind==="refunded"||e.kind==="expired"?"Order not placed":e.kind==="processing"?"Payment processing":"Payment received"}),l("p",{className:"text-fg-dim",children:e.kind==="refunded"?x(G,{children:["An item sold out or an offer ended while you paid for checkout ",n,". Your payment goes back to your card."]}):e.kind==="expired"?x(G,{children:["The hold on checkout ",n," ran out before your payment arrived. Your payment goes back to your card."]}):e.kind==="processing"?x(G,{children:["Your payment for checkout ",n," is being processed. When it goes through, we will email your order confirmation."]}):x(G,{children:["Thank you \u2014 your payment",e.checkoutNumber?x(G,{children:[" for checkout ",n]}):null," has gone through. We will email you the order number shortly."]})}),t&&e.kind!=="refunded"&&e.kind!=="expired"&&l("p",{className:"text-sm text-fg-dim",children:t}),l(Ue,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function Ls(){let{site:e,logo:t,items:n,placing:r,formLocked:a,email:s,me:d,addressSaveNote:y,lostChangeNote:f,idemKey:p,confirmation:k,setConfirmation:h,payment:b,paypalStep:v,squareStep:R,pendingConf:C,paid:O,setPaid:V,payNote:E,afterpayConfirming:P,gocardlessConfirming:Y,zipConfirming:Z,klarnaConfirming:pe,cardConfirming:j,checkoutResult:se,confirmCardPayment:Se,cardStillProcessing:qe,renewCardPayment:ee,holdRenewed:he,leaveCardPayment:re,checkoutRootRef:te,setCheckoutHeaderEl:H}=Pe();return k?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:O?"Payment received":"Order received"}),x("p",{className:"text-fg-dim",children:[O?x(G,{children:["Thank you \u2014 your payment for order"," ",l("span",{className:"font-mono text-fg",children:k.orderNumber})," has gone through."," "]}):x(G,{children:["Thank you \u2014 your order ",l("span",{className:"font-mono text-fg",children:k.orderNumber})," is being reviewed by our team."," "]}),d?x(G,{children:["Track it under"," ",l(Ue,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):l(G,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),l(Os,{order:k,paid:O}),f&&l("p",{className:"text-sm text-fg-dim",children:f}),E&&(E.warning?l("div",{className:"w-full max-w-sm text-left",children:l(de,{tone:"bad",role:"alert",children:E.text})}):l("p",{className:"text-sm text-fg-dim",children:E.text})),y&&l("p",{className:"text-sm text-fg-dim",children:y}),!d&&x("p",{className:"text-sm text-fg-dim",children:["You can also"," ",l(Ue,{href:`/track?order=${encodeURIComponent(k.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),l(Ue,{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"})]}):se?l(As,{result:se,lostChangeNote:f}):j?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order \u2014 one moment."})]}):P?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):Y?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):Z?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):pe?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):b&&C?l(Is,{payment:b,checkout:C,holdRenewed:he,onPaid:Se,onProcessing:qe,onRenew:ee,onBack:re}):v&&C?l(_s,{confirmation:C,clientId:e.paypalClientId??"",idemKey:p,onPaid:()=>{V(!0),h(C)},onSkip:()=>h(C)}):R&&C?l(Ds,{confirmation:C,applicationId:e.squareApplicationId??"",locationId:e.squareLocationId??"",environment:e.squareEnvironment??"production",idemKey:p,onPaid:()=>{V(!0),h(C)},onSkip:()=>h(C)}):x("div",{ref:te,className:"bg-bg text-fg",children:[x("header",{ref:H,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[x(bt,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",l("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),l("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:l(bt,{href:"/","aria-label":`${e.name} home`,className:"inline-flex max-w-full items-center justify-center max-[640px]:overflow-x-clip",children:[!0,!1].map(g=>l(Hr,{hideClass:g?"min-[641px]:hidden":"max-[640px]:hidden",variant:"header",scrolled:!0,src:t?.url??null,reverse:t?.reverse??!1,reversedSrc:t?.reversed??null,inkIsDark:t?.inkIsDark??null,size:t?.size??"medium",sizePx:t?.sizePx??null,sizeUnit:t?.sizeUnit??null,siteName:e.name,fitWordmarkToContainer:g,fitFloorPx:g?zr:void 0},g?"phone":"wide"))})}),e.cardPayments?x("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[l("span",{className:"text-green",children:"\u25CF"}),l("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):l("span",{})]}),x("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[l("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),l("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(g=>x("span",{className:["relative flex items-center gap-2 transition-colors",g.state==="pending"?"text-fg-dim":"text-fg",g.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[l("span",{className:g.state==="done"?"text-accent font-bold":"",children:g.n}),l("span",{children:g.label})]},g.n))})]}),x("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[x("div",{children:[x(Gt,{locked:a,children:[l(ka,{}),l(xa,{}),l(Ca,{})]}),l(Gt,{locked:r,children:l(Pa,{})})]}),l(Na,{})]}),l("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:l("span",{children:Wr({legalName:e.legalName,foundedYear:e.foundedYear,siteName:e.name})})})]})}function Is({payment:e,checkout:t,holdRenewed:n,onPaid:r,onProcessing:a,onRenew:s,onBack:d}){let{formatMoney:y}=ye(),f=l("span",{className:"text-fg",children:y(Number(e.amount),e.currency)}),p=wa(()=>Ut(e.publishableKey),[e.publishableKey]),k=wa(()=>Jr(),[]),h=Vr(t.expiresAt??"",Es()??"");return l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:Bt(t)}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:t.orderNumber?x(G,{children:["Your order is placed. Pay ",f," by card to confirm it now."]}):n?x(G,{children:["Your hold ran out, so your items are held again",h?` until ${h}`:"",". Enter your card again, then pay ",f,"."]}):x(G,{children:["Your items are held",h?` until ${h}`:"",". Pay ",f," by card to place your order."]})}),l(kn,{stripe:p,options:{clientSecret:e.clientSecret,appearance:k},children:l(qs,{payment:e,checkout:t,onPaid:r,onProcessing:a,onRenew:s,onBack:d})},e.clientSecret)]})]})})}var Ts=5;function qs({payment:e,checkout:t,onPaid:n,onProcessing:r,onRenew:a,onBack:s}){let{formatMoney:d}=ye(),y=vo(),f=ho(),[p,k]=Ye(!1),[h,b]=Ye(null),v=tt(!1);async function R(){try{return(await y.retrievePaymentIntent(e.clientSecret)).paymentIntent?.status}catch{return}}async function C(E){let P=E;for(let Y=0;P==="processing"&&Y<Ts;Y+=1)await new Promise(Z=>setTimeout(Z,1e3)),P=await R()??P;if(P==="succeeded"){n();return}if(P==="processing"){r();return}b("Payment did not complete. Please try again."),k(!1)}async function O(){if(!y||!f||p)return;k(!0),b(null),v.current=!0;let E=await y.confirmPayment({elements:f,redirect:"if_required"}).catch(()=>null);if(!E){let P=await R();if(P==="succeeded"||P==="processing"){await C(P);return}b(P===void 0?Te:"Payment failed. Please try again."),k(!1);return}if(E.error){if(!t.orderNumber&&E.error.code==="payment_intent_unexpected_state"){let P=await R();if(P==="succeeded"||P==="processing"){await C(P);return}if(P===void 0){b(Te),k(!1);return}await a(P==="canceled"),k(!1);return}b(E.error.message??"Payment failed. Please try again."),k(!1);return}await C(E.paymentIntent?.status)}async function V(){if(p)return;if(!v.current){s();return}k(!0),b(null);let E=await R();if(E==="succeeded"||E==="processing"){await C(E);return}if(k(!1),E===void 0){b(Te);return}s()}return x("div",{className:"flex flex-col gap-4",children:[l(ko,{}),h&&l(de,{role:"alert",children:h}),l("button",{type:"button",onClick:O,disabled:!y||!f||p,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!y||!f||p?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:p?x(G,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):x(G,{children:["Pay ",d(Number(e.amount),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),!t.orderNumber&&!p&&x("button",{type:"button",onClick:V,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",l("span",{children:"Back to checkout"})]})]})}var Ea="paypal-sdk-js",_n=null;function Fs(e,t){let n=`${e}|${t}`;if(_n?.key===n)return _n.promise;let r=new Promise((a,s)=>{document.getElementById(Ea)?.remove();let d=document.createElement("script");d.id=Ea;let y=new URLSearchParams({"client-id":e,currency:t,intent:"capture"});d.src=`https://www.paypal.com/sdk/js?${y}`,d.onload=()=>{let f=window.paypal;f?a(f):s(new Error("PayPal SDK loaded without its namespace"))},d.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(d)});return _n={key:n,promise:r},r}function _s({confirmation:e,clientId:t,idemKey:n,onPaid:r,onSkip:a}){let{formatMoney:s}=ye(),d=tt(null),[y,f]=Ye(!1),[p,k]=Ye(null),h=tt(r);return h.current=r,Oa(()=>{let b=!1,v=null;return Fs(t,e.currency).then(R=>{if(!(b||!d.current))return v=R.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await $.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async C=>{try{if((await $.capturePaypalOrder({idempotencyKey:n,paypalOrderId:C.orderID})).status==="paid"){h.current();return}k("PayPal did not complete the payment. Please try again.")}catch(O){k(O instanceof ue?O.message:"PayPal payment failed. Please try again.")}},onError:()=>{k("PayPal could not process the payment. Please try again.")}}),v.render(d.current).then(()=>{b||f(!0)})}).catch(()=>{b||k("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{b=!0,v?.close?.()}},[t,e.currency,n]),l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[x("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:s(Number(e.grandTotal),e.currency)})," ","with PayPal to confirm it now."]}),!y&&!p&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),l("div",{ref:d}),p&&l(de,{role:"alert",children:p}),l("button",{type:"button",onClick:a,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var Ra="square-web-sdk",Mn=null,Ms=["sandbox","production"];function Ks(e){let t=Rs(Ms,"production",e);if(Mn?.key===t)return Mn.promise;let n=new Promise((r,a)=>{document.getElementById(Ra)?.remove();let s=document.createElement("script");s.id=Ra,s.src=t==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{let d=window.Square;d?r(d):a(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(s)});return Mn={key:t,promise:n},n}function Ds({confirmation:e,applicationId:t,locationId:n,environment:r,idemKey:a,onPaid:s,onSkip:d}){let{formatMoney:y}=ye(),f=tt(null),p=tt(null),k=tt(null),[h,b]=Ye(!1),[v,R]=Ye(!1),[C,O]=Ye(null);Oa(()=>{let E=!1,P=null;return Ks(r).then(async Y=>{if(E||!f.current)return;let Z=Y.payments(t,n);k.current=Z,P=await Z.card(),await P.attach(f.current),p.current=P,E||b(!0)}).catch(()=>{E||O("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{E=!0,P?.destroy?.()}},[t,n,r]);async function V(){let E=p.current;if(!(!E||v)){R(!0),O(null);try{let P=await E.tokenize();if(P.status!=="OK"||!P.token){O(P.errors?.[0]?.message??"Please check the card details and try again."),R(!1);return}let Y;try{Y=(await k.current?.verifyBuyer?.(P.token,{amount:String(e.grandTotal),currencyCode:e.currency,intent:"CHARGE"}))?.token}catch{}if((await $.chargeSquare({idempotencyKey:a,sourceId:P.token,...Y?{verificationToken:Y}:{}})).status==="paid"){s();return}O("Square did not complete the payment. Please try again.")}catch(P){O(P instanceof ue?P.message:"Square payment failed. Please try again.")}R(!1)}}return l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[x("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:y(Number(e.grandTotal),e.currency)})," ","by card to confirm it now."]}),!h&&!C&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),l("div",{ref:f}),C&&l(de,{role:"alert",children:C}),l("button",{type:"button",onClick:V,disabled:!h||v,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!h||v?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:v?x(G,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):x(G,{children:["Pay ",y(Number(e.grandTotal),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),l("button",{type:"button",onClick:d,disabled:v,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}import{jsx as Jt}from"react/jsx-runtime";function js(){let{settings:e,websiteName:t}=Or(),n=t?{...yn,name:t}:yn,r=e?{url:e.logoUrl,reversed:e.logoReversed??null,inkIsDark:e.logoInkIsDark??null,reverse:e.reverseLogo,size:e.logoSize,sizePx:e.logoSizePx,sizeUnit:e.logoSizeUnit??null}:null;return Jt("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:Jt(Dr,{children:Jt(Ur,{preview:!0,children:Jt(Kn,{site:n,logo:r,preview:!0})})})})}export{js as default};
@@ -0,0 +1 @@
1
+ "use client";import{Fh as r}from"./chunk-J6SPMJBT.js";import"./chunk-TVMCJUOE.js";import"./chunk-EZ5QLDA5.js";import"./chunk-4KN3VTQU.js";import"./chunk-UV27QVUD.js";import"./chunk-6ABZ7XWF.js";import"./chunk-7UJXVH57.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};