efficient-web-builder 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -0
- package/README.md +24 -5
- package/dist/chunks/{EditorPreviewCheckout-RALICX2M.js → EditorPreviewCheckout-YVSO4HE3.js} +3 -3
- package/dist/chunks/PreviewFooter-34YJU76X.js +1 -0
- package/dist/chunks/SectionEditorShell-CVWJ6DSU.js +1 -0
- package/dist/chunks/{SiteEditorProvider-4NZYBEVE.js → SiteEditorProvider-ECGZVKLG.js} +1 -1
- package/dist/chunks/StorefrontEditorChrome-YKEMJT3Z.js +1 -0
- package/dist/chunks/chunk-2XX3N727.js +153 -0
- package/dist/chunks/chunk-6CP4D6VJ.js +1 -0
- package/dist/chunks/chunk-7QXLVNFD.js +1 -0
- package/dist/chunks/chunk-EKKAVQJX.js +1 -0
- package/dist/chunks/chunk-FU5UZ4UY.js +1 -0
- package/dist/chunks/chunk-J5WPJJCW.js +2 -0
- package/dist/chunks/{chunk-5WIA75VU.js → chunk-MEIUD5LJ.js} +1 -1
- package/dist/chunks/chunk-N3IM4XBG.js +1 -0
- package/dist/chunks/chunk-RRHBLOH4.js +1 -0
- package/dist/chunks/chunk-TUB4O4RZ.js +15 -0
- package/dist/chunks/chunk-UM3P3PXW.js +230 -0
- package/dist/chunks/chunk-XQGZKQII.js +1 -0
- package/dist/chunks/fitment-data-6NXSKODX.js +1 -0
- package/dist/chunks/render-client-VMLB4BTY.js +1 -0
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +184 -4
- package/dist/index.js +908 -644
- package/dist/links.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/PreviewFooter-TTWVSN7F.js +0 -1
- package/dist/chunks/SectionEditorShell-QHF74BM4.js +0 -1
- package/dist/chunks/StorefrontEditorChrome-VAFMI23Y.js +0 -1
- package/dist/chunks/chunk-23HYGLAH.js +0 -1
- package/dist/chunks/chunk-2Z43RC3L.js +0 -143
- package/dist/chunks/chunk-4MT74TMP.js +0 -1
- package/dist/chunks/chunk-764WH3TY.js +0 -11
- package/dist/chunks/chunk-DN65SLZM.js +0 -1
- package/dist/chunks/chunk-FEL3RPX5.js +0 -230
- package/dist/chunks/chunk-KZIT3J33.js +0 -1
- package/dist/chunks/chunk-X2DL3VCU.js +0 -15
- package/dist/chunks/chunk-XMRSKZIR.js +0 -2
- package/dist/chunks/fitment-data-6EHBA26C.js +0 -1
- package/dist/chunks/render-client-3H6QYWG7.js +0 -1
- /package/dist/chunks/{chunk-2Z43RC3L.js.LEGAL.txt → chunk-2XX3N727.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-UBYBQ3KR.js → chunk-HVOO2GNE.js} +0 -0
- /package/dist/chunks/{chunk-X2DL3VCU.js.LEGAL.txt → chunk-TUB4O4RZ.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Symbol.for("efficient-web.efficient-backend");function E(e){return!!e&&e[h]===!0}function m(e){return e?.trim()||null}var u=null,g=new WeakMap;function _(e){u=e}function C(e=s()){if(e.hostBackend)return e.hostBackend;let t=g.get(e);if(!t){if(!u)throw new Error("efficient-web-builder: this editor was given no backend, and its host named no default one. Pass `backend`, or load the host's default backend first (the storefront's is lib/efficient-backend).");t=u(e),g.set(e,t)}return t}function T(e){if(!e.registry)throw new Error("efficient-web-builder: this editor was mounted with no block registry. Pass `registry` to createEditorSession (the storefront's is lib/puck/config).");return e.registry}function S(e={}){let t=e.backend??null,n=new Map,b={token:null,brandId:null},l={documentId:null,bridgedId:null};return{hostBackend:t,usesBridgedToken:t===null||E(t),blocks:e.blocks??null,registry:e.registry??null,chrome:e.chrome??null,documentHooks:e.documentHooks??null,auth:b,site:l,siteId:()=>l.documentId??l.bridgedId,cache(o,p){return n.has(o)||n.set(o,p()),n.get(o)},forget(o){o===void 0?n.clear():n.delete(o)}}}function D(e,t){e.site.documentId=m(t)}function L(e,t){e.site.bridgedId=m(t)}var I=S(),i=null,c=new Set;function s(){return i??I}function W(e){c.delete(e),i=e}function R(e){c.add(e),queueMicrotask(()=>{c.delete(e)&&i===e&&(i=null)})}function A(){return s().usesBridgedToken}var d="https://cdn.inovit.com"?.replace(/\/+$/,"");function a(e,t){let n=s().hostBackend?.media.resolve;if(!(!n||n===B))return n(e,t)??e}function y(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function x(e){return a(e)??k(e)}function k(e){return!d||y(e)?e:d+e.replace(/^\/media/,"")}var B=e=>k(e),v="";function P(e){if(!e)return null;let t=a(e);return t!==void 0?t:e.startsWith("/")?`${v}${e}`:e}function H(e){return/^https?:\/\//i.test(e)&&!(d&&e.startsWith(d+"/"))}function N(e){if(!e)return;let t=a(e);return t!==void 0?t:e.startsWith("/media/")?x(e):e}function O(e){let t=e.split("?")[0],n=t.substring(t.lastIndexOf("/")+1);try{return decodeURIComponent(n.replace(/^[0-9a-f]{32}_/i,""))||n}catch{return n}}var w="/videos/products/";function $(e){return!!e&&e.includes(w)}function f(e){return{getItem(t){try{return e()?.getItem(t)??null}catch{return null}},setItem(t,n){try{e()?.setItem(t,n)}catch{}},removeItem(t){try{e()?.removeItem(t)}catch{}}}}var r="__storefront_probe__";function V(e){try{e.setItem(r,r);let t=e.getItem(r)===r;return e.removeItem(r),t}catch{return!1}}var q=f(()=>typeof window>"u"?null:window.localStorage),K=f(()=>typeof window>"u"?null:window.sessionStorage);function X(e){return f(()=>e.defaultView?.localStorage??null)}export{h as a,E as b,_ as c,C as d,T as e,S as f,D as g,L as h,s as i,W as j,R as k,A as l,x as m,B as n,P as o,H as p,N as q,O as r,$ as s,V as t,q as u,K as v,X as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as I,c as K}from"./chunk-RRHBLOH4.js";import{i as W,l as G,m as V,o as T,u as k}from"./chunk-6CP4D6VJ.js";var E="x-forwarded-for";function j(e){let t=(e??"").split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var ve="x-forwarded-host";function z(e,t,r){let n={};return e&&(n[ve]=e),t&&r==="uncached"&&(n[E]=t),n}function Z(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var Q="x-storefront-site",Y="x-storefront-host";var X={contentHash:"db2b679aad5380c6",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["imageFocal"]};var Ie="shop_access_token",ee="shop_refresh_token",B=null;function q(){k.removeItem(Ie),k.removeItem(ee)}var b={getAccess(){return B},takeLegacyRefresh(){let e=k.getItem(ee);return q(),e},setTokens(e){B=e,q()},clear(){B=null,q()}};function Ee(e){return!!e.src}function A(e){let t=e.finishes.filter(Ee);if(t.length===e.finishes.length)return e;let r=e.defaultFinish&&t.some(n=>n.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:r}}function Be(e){return e.listable!==!1}function L(e){return e.map(A).filter(Be)}var se=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],oe=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),O={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},ie=12,ae=/\burl\(/i,ce=new RegExp(`(?<![-\\w])(${se.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),le=new RegExp(`((?:^|[;{\\s"'])(?:${se.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),qe=/<svg\b([^>]*)>/i,Le=/\bfill\s*[=:]/i;function $e(e){let t=e.replace(ce,(r,n,s,o,m)=>{let u=te(m);return u===null?r:`${n}${s}${o}${u}${o}`}).replace(le,(r,n,s)=>{let o=te(s);return o===null?r:`${n}${o}`});return t=t.replace(qe,(r,n)=>Le.test(n)?r:`<svg fill="#ffffff"${n}>`),t}function te(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||ae.test(n)||oe.has(n))return null;let s=n in O?[...O[n],1]:me(n);if(!s)return null;let[o,m,u,p]=s;if(Math.max(o,m,u)-Math.min(o,m,u)>ie)return null;let y=Ne(255-o,255-m,255-u,p);return t?`${y} !important`:y}function Ne(e,t,r,n){if(n<1)return`rgba(${e}, ${t}, ${r}, ${n})`;let s=o=>o.toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(r)}`}function me(e){return e.startsWith("#")?Ue(e):e.startsWith("rgb")?Me(e):e.startsWith("hsl")?De(e):null}function Ue(e){let t=e.slice(1),r=1;if(t.length===3||t.length===4)t.length===4&&(r=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(n=>n+n).join("");else if(t.length===6||t.length===8)t.length===8&&(r=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),r]:null}function Me(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),s=r.split(/[\s,]+/).filter(Boolean).slice(0,3);if(s.length<3)return null;let o=s.map(u=>u.endsWith("%")?Math.round(parseFloat(u)/100*255):Math.round(parseFloat(u)));if(o.some(u=>Number.isNaN(u)))return null;let m=n?v(n):He(r);return[o[0],o[1],o[2],m]}function He(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?v(t[3]):1}function v(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function De(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),s=r.split(/[\s,]+/).filter(Boolean);if(s.length<3)return null;let o=parseFloat(s[0]),m=parseFloat(s[1])/100,u=parseFloat(s[2])/100;if([o,m,u].some(Oe=>Number.isNaN(Oe)))return null;let p=n?v(n):s.length>=4?v(s[3]):1,[y,S,P]=Je(o,m,u);return[y,S,P,p]}function Je(e,t,r){let n=(1-Math.abs(2*r-1))*t,s=(e%360+360)%360/60,o=n*(1-Math.abs(s%2-1)),m=0,u=0,p=0;s<1?[m,u,p]=[n,o,0]:s<2?[m,u,p]=[o,n,0]:s<3?[m,u,p]=[0,n,o]:s<4?[m,u,p]=[0,o,n]:s<5?[m,u,p]=[o,0,n]:[m,u,p]=[n,0,o];let y=r-n/2;return[Math.round((m+y)*255),Math.round((u+y)*255),Math.round((p+y)*255)]}var re=512*1024;function $(e){return/\.svg(\?|$)/i.test(e)}function We(e){return`data:image/svg+xml,${encodeURIComponent($e(e))}`}function Ge(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||ae.test(t)||oe.has(t))return null;let r=t in O?[...O[t],1]:me(t);if(!r)return null;let[n,s,o]=r;return Math.max(n,s,o)-Math.min(n,s,o)>ie?null:(.2126*n+.7152*s+.0722*o)/255}function Ve(e){let t=[],r=n=>{let s=Ge(n);s!==null&&t.push(s)};for(let n of e.matchAll(ce))r(n[4]);for(let n of e.matchAll(le))r(n[2]);return t.length?t.reduce((n,s)=>n+s,0)/t.length<.5:null}var ne=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Ke(e){let t=e;for(let r=ne.exec(t);r&&r[0].length>0;r=ne.exec(t))t=t.slice(r[0].length);return/^<svg[\s>/]/i.test(t)}async function je(e,t){if(!$(e))return null;try{let r=await fetch(e,{signal:t,redirect:"manual"});if(!r.ok)return null;let n=Number(r.headers.get("content-length"));if(Number.isFinite(n)&&n>re)return null;let s=await r.text();return s.length>re?null:Ke(s)?s:null}catch{return null}}async function ue(e,t){let r=await je(e,t);return r===null?null:{reversed:We(r),inkIsDark:Ve(r)}}function pe(){return W().siteId()}var ze="",f=class extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n}},U="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",Ze=new Set([502,503,504]),N=0,Qe="This editor runs on its host's own backend, which does not serve this request.",Ye=5e3,Xe=15e3,et=()=>typeof window>"u"?Ye:Xe;function Ae(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&e.audience!=="admin"&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(et())}var de=e=>e instanceof Error&&e.name==="TimeoutError",ge=(e,t)=>Ze.has(e)?U:t;function tt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=I();return!t||/[?&]site=/.test(e)?e:M(e,`site=${encodeURIComponent(t)}`)}async function i(e,t={}){let{token:r,baseUrl:n,headers:s,audience:o,...m}=t;if(typeof window<"u"&&!G())throw new f(N,Qe,null);if(typeof window>"u"&&n===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let u=typeof FormData<"u"&&m.body instanceof FormData,p;try{p=await fetch(`${n??ze}${tt(e)}`,{...m,headers:{...u?{}:{"Content-Type":"application/json"},...r?{Authorization:`Bearer ${r}`}:{},...o===null?{}:{"X-Portal-Audience":o??"shop"},...s},signal:m.signal??Ae({...m,audience:o})})}catch(P){throw P instanceof TypeError||de(P)?new f(N,U,null):P}let y;try{y=await p.text()}catch(P){throw de(P)?new f(N,U,null):P}let S=null;if(y)try{S=JSON.parse(y)}catch{throw new f(p.status,p.ok?"Expected JSON but received a non-JSON response":ge(p.status,p.statusText),y)}if(!p.ok){let P=(S&&typeof S=="object"&&"detail"in S&&typeof S.detail=="string"?S.detail:null)??ge(p.status,p.statusText);throw new f(p.status,P,S)}return S}var R=null;async function Re(){return R||(R=rt().finally(()=>{R=null}),R)}async function rt(){let e=b.takeLegacyRefresh(),t=await nt.refresh(e??void 0);return b.setTokens(t.access),t.access}async function _e(){return b.getAccess()??Re()}async function d(e,t={}){let r;try{r=await _e()}catch{throw b.clear(),new f(401,"Not signed in",null)}try{return await i(e,{...t,token:r})}catch(n){if(!(n instanceof f)||n.status!==401)throw n;try{let s=await Re();return await i(e,{...t,token:s})}catch{throw b.clear(),n}}}async function he(e,t={}){if(b.getAccess())try{return{data:await d(e,t),asShopper:!0}}catch(r){if(!(r instanceof f)||r.status!==401)throw r}return{data:await i(e,t),asShopper:!1}}async function ye(){let e=await d("/api/auth/me/");if(e.portal!=="shop")throw b.clear(),new f(403,"This session is not valid for this shop.",null);return e}var nt={login:(e,t)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{b.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await _e();return await ye(),e},me:ye,updateMe:e=>d("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>d("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>d("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>d("/api/shop-portal/profile/"),updateMyProfile:e=>d("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>d("/api/shop-portal/delivery-locations/"),createAddress:e=>d("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>d(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>d(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,r)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:r})}),brands:()=>d("/api/products/brands/"),myOrders:()=>d("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>d(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>d(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>d(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>d("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>d(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let r=new FormData;return r.append("claim_item",e),r.append("file",t),r.append("media_type",t.type.startsWith("video/")?"video":"image"),d("/api/shop-portal/return-media/",{method:"POST",body:r})}};function h(e){if(typeof e=="string")return e.startsWith("/media/")?V(e):e;if(Array.isArray(e))return e.map(h);if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=r==="captions"&&n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).map(([s,o])=>[h(s),o])):h(n);return t}return e}var st="",xe="".replace(/\/+$/,""),Ce=typeof window>"u"&&xe!=="",ot=Ce?xe:st,it=K,w=()=>({baseUrl:it(),audience:null});function c(e,t){let r=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${r}`}var at=100,fe=50;function Te(e,t,r){let n=new URLSearchParams;for(let[s,o]of Object.entries(t))o!=null&&o!==""&&n.set(s,String(o));return n.set("pageSize",String(at)),r&&n.set("cursor",r),`/api/v1${e}?${n.toString()}`}function ct(e,t){return Te("/wheels",{process:e},t)}function lt(e,t,r){return Te("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},r)}function mt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function Se(e,t,r=()=>!1){let n=[],s=null;try{for(let o=0;o<fe;o++){let m=await i(await t(s),await a());if(n.push(...m.results),s=mt(m.next),!s)break}s&&console.warn(`[${e}] stopped at ${fe} pages (${n.length} rows); catalog may be truncated`)}catch(o){if(r(o))throw o;console.warn(`[${e}] product API unavailable, returning []`,o)}return n}var ut=e=>e instanceof f&&e.status===400;function pt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?L([t]):[t])}async function ke(){return(await dt()).host}async function dt(){try{let{headers:e}=await import("./headers-3CAQXQEY.js"),t=await e(),r=o=>o?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,n=r(t.get(Y)??t.get("x-forwarded-host")??t.get("host")),s=r(t.get("host"));return{host:n,matchesRequestHost:n!==null&&n===s}}catch{return{host:null,matchesRequestHost:!1}}}async function gt(){try{let{headers:e}=await import("./headers-3CAQXQEY.js");return j((await e()).get(E))}catch{return null}}async function ht(){try{let{headers:e}=await import("./headers-3CAQXQEY.js");return(await e()).get(Q)||null}catch{return null}}async function yt(){let e=await ht();if(e)return`site=${encodeURIComponent(e)}`;let t=await ke();return t?`host=${encodeURIComponent(t)}`:""}async function g(e){if(typeof window<"u"){let t=I();return t?M(e,`site=${encodeURIComponent(t)}`):e}return M(e,await yt())}function M(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}async function ft(e){if(!Ce)return;let[t,r]=await Promise.all([ke(),gt()]),n=z(t,r,e);return Object.keys(n).length>0?n:void 0}async function a(e){let t=await ft(Z(e)),r={baseUrl:ot,...e};return t&&(r.headers={...t,...e?.headers}),r}var _=typeof window>"u";function x(e,t){let r=new URLSearchParams;for(let[s,o]of Object.entries(t))o!==void 0&&o!==""&&r.set(s,String(o));let n=r.toString();return`/api/v1/fitment${e}${n?`?${n}`:""}`}var Gt={listMakes:async e=>{if(_){let{fitmentData:r}=await import("./fitment-data-6NXSKODX.js");return r.makes(e)}return(await i(x("/makes",{region:e}),w())).results},listModels:async(e,t)=>{if(_){let{fitmentData:n}=await import("./fitment-data-6NXSKODX.js");return n.models(e,t)}return(await i(x("/models",{make:e,region:t}),w())).results},listYears:async(e,t,r)=>{if(_){let{fitmentData:s}=await import("./fitment-data-6NXSKODX.js");return s.years(e,t,r)}return(await i(x("/years",{make:e,model:t,region:r}),w())).results},listModifications:async(e,t,r,n)=>{if(_){let{fitmentData:o}=await import("./fitment-data-6NXSKODX.js");return o.modifications(e,t,r,n)}return(await i(x("/modifications",{make:e,model:t,year:r,region:n}),w())).results},getStockFitment:async(e,t,r,n,s)=>{if(_){let{fitmentData:o}=await import("./fitment-data-6NXSKODX.js");return o.stockFitment(e,t,r,n,s)}return i(x("/stock-fitment",{make:e,model:t,year:r,modification:n,region:s}),w())}},Vt={listWheels:async e=>{let t=await Se("products.listWheels",async r=>await g(ct(e,r)));return L(h(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let r=await Se("products.listCatalog",async n=>await g(lt(e,t,n)),ut);return pt(h(r))},getWheel:async e=>A(h(await i(await g(c(`/wheels/${e}`)),await a()))),getTyre:async e=>h(await i(await g(c(`/tyres/${e}`)),await a())),listBundles:async()=>{try{return await i(await g(c("/bundles")),await a())}catch{return[]}},getBundle:async e=>i(await g(c(`/bundles/${e}`)),await a()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:r=null}=e;if(typeof window>"u"){let{listGalleryBuilds:n}=await import("./gallery-builds-data-SWA6XKFF.js");return h(n(t,r))}try{let n=new URLSearchParams;t&&n.set("process",t),r&&n.set("wheelSlug",r);let s=n.toString(),o=await i(`/api/v1/gallery-builds${s?`?${s}`:""}`,w());return h(o.results)}catch(n){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",n),[]}},getSite:async()=>i(await g(c("/site")),await a()),getSiteBySlug:async e=>i(`${c("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await a():void 0),listBrands:async()=>{try{return(await i(await g(c("/brands")),await a())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await i(`${c("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await a():void 0)).results??[],listPages:async()=>h(await i(await g(c("/pages")),await a())),listProductTemplates:async()=>{try{return await i(await g(c("/product-templates")),await a())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listProductTypeChoices:async()=>{try{return await i(await g(c("/product-type-choices")),await a())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await i(await g(c("/field-usage")),await a())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>h(await i(await g(c(`/pages/${e}`)),await a(t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0))),listBlogPosts:async()=>{try{return(await i(c("/blog-posts"),await a())).map(t=>({...t,coverImage:T(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await i(c(`/blog-posts/${e}`),await a());return{...t,coverImage:T(t.coverImage)??""}},createOrder:async e=>i(c("/orders"),await a({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>d(c("/orders"),await a({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>i(c("/orders/lookup"),await a({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>i(c("/payments/intent"),await a({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>i(c("/payments/paypal/order"),await a({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>i(c("/payments/paypal/capture"),await a({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>i(c("/payments/afterpay/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>i(c("/payments/afterpay/capture"),await a({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>i(c("/payments/square/charge"),await a({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>i(c("/payments/gocardless/billing-request"),await a({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>i(c("/payments/gocardless/complete"),await a({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>i(c("/payments/zip/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>i(c("/payments/zip/capture"),await a({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>i(c("/payments/klarna/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>i(c("/payments/klarna/capture"),await a({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>i(c("/stock-alerts"),await a({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>i(c("/pre-order-intents"),await a({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>i(c("/newsletter-subscriptions"),await a({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>i(c("/newsletter-unsubscribe"),await a({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>i(c("/carts"),await a({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>i(c("/carts/restore"),await a({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>i(c("/carts/unsubscribe"),await a({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let r=c("/reviews"),n=t.toString();try{return await i(await g(n?`${r}?${n}`:r),await a())}catch(s){return console.warn("[products.listReviews] product API unavailable, returning []",s),[]}},submitReview:async e=>i(c("/reviews"),await a({method:"POST",body:JSON.stringify(e)})),getForm:async e=>i(c(`/forms/${encodeURIComponent(e)}`),await a()),submitForm:async(e,t)=>i(c(`/forms/${encodeURIComponent(e)}/submissions`),await a({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await i(c("/shipping-methods"),await a())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await i(c(`/countries/${encodeURIComponent(e)}/subdivisions`),await a())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=c("/cart/quote"),r=await a({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await he(t,r)).data:i(t,r)},validateCoupon:async e=>{let{data:t,asShopper:r}=await he(c("/coupons/validate"),await a({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:r}},getHeaderSettings:async()=>{let e=Ae({method:"GET"}),t=await i(await g(c("/header-settings")),await a({signal:e})),r=T(t.logoUrl),n=null,s=null;if(r&&$(r)){let o=await ue(r,e);o&&(n=o.reversed,s=o.inkIsDark)}return{...t,logoUrl:r,logoReversed:n,logoInkIsDark:s}},getThemeSettings:async()=>i(await g(c("/theme-settings")),await a()),getChatSettings:async()=>i(await g(c("/chat-settings")),await a())},Kt={listServices:async()=>{try{return await i(c("/bookings/services"),await a())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>i(c(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await a()),create:async e=>i(c("/bookings"),await a({method:"POST",body:JSON.stringify(e)})),get:async e=>i(c(`/bookings/manage/${encodeURIComponent(e)}`),await a()),cancel:async e=>i(c(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await a({method:"POST"})),createPaymentIntent:async e=>i(c("/bookings/payments/intent"),await a({method:"POST",body:JSON.stringify({manageToken:e})}))},H=class extends Error{constructor(r,n){super(`Slug "${r}" exists on ${n} websites; a site is required to pick one.`);this.slug=r;this.count=n;this.name="AmbiguousPageSlugError"}},C=e=>e?`/api/storefront/header-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/header-settings/",Pe=e=>e?`/api/storefront/theme-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/theme-settings/",be=e=>e?`/api/storefront/chat-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/chat-settings/",we=e=>`/api/storefront/social-settings/?${new URLSearchParams({site:e})}`,D=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,St=e=>`${D(e)}currencies/`,Pt="/api/storefront/media/ingest/",J=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function bt(){let e=pe();if(!e)throw new J;return`${Pt}?${new URLSearchParams({site:e})}`}var F={"X-Puck-Media-Manifest":X.contentHash},l=(e,t={})=>i(e,{...t,audience:"admin"}),jt={findPageBySlug:async(e,t,r)=>{let n=new URLSearchParams({slug:e});r&&n.set("site",r);let s=await l(`/api/storefront/pages/?${n.toString()}`,{token:t}),o=Array.isArray(s)?s:s.results??[];if(!r&&o.length>1)throw new H(e,o.length);return o[0]??null},getPageById:(e,t)=>l(`/api/storefront/pages/${e}/`,{token:t}),saveLayout:(e,t,r,n,s)=>l(`/api/storefront/pages/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t,expected_updated_at:n,...s?{client_id:s}:{}}),token:r}),publishPage:(e,t,r)=>l(`/api/storefront/pages/${e}/publish/`,{method:"POST",body:r?JSON.stringify({expected_updated_at:r}):void 0,token:t}),claimPageEditLock:(e,t,r,n=!1)=>l(`/api/storefront/pages/${e}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:r,takeover:n}),token:t}),releasePageEditLock:(e,t)=>l(`/api/storefront/pages/${e}/edit-lock/`,{method:"DELETE",token:t}),createTemplate:(e,t,r)=>l("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:e,layout:t}),headers:F,token:r}),getTemplate:(e,t)=>l(`/api/storefront/page-templates/${e}/`,{token:t}),saveTemplateLayout:(e,t,r)=>l(`/api/storefront/page-templates/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t}),headers:F,token:r}),listTemplatePages:async(e,t)=>{let r=await l(`/api/storefront/template-pages/?template=${encodeURIComponent(e)}`,{token:t});return Array.isArray(r)?r:r.results??[]},findTemplatePageBySlug:async(e,t,r)=>{let n=await l(`/api/storefront/template-pages/?template=${encodeURIComponent(e)}&slug=${encodeURIComponent(t)}`,{token:r});return(Array.isArray(n)?n:n.results??[])[0]??null},createTemplatePage:(e,t,r)=>l("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:e,...t}),headers:F,token:r}),saveTemplatePageLayout:(e,t,r)=>l(`/api/storefront/template-pages/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t}),headers:F,token:r}),deleteTemplatePage:(e,t)=>l(`/api/storefront/template-pages/${e}/`,{method:"DELETE",token:t}),listPages:async(e,t)=>{let r=new URLSearchParams({no_page:"true"});t&&r.set("site",t);let n=await l(`/api/storefront/pages/?${r.toString()}`,{token:e});return Array.isArray(n)?n:n.results??[]},createPage:(e,t,r,n)=>l("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:e,slug:t,layout:r}),token:n}),deletePage:(e,t)=>l(`/api/storefront/pages/${e}/`,{method:"DELETE",token:t}),getHeaderSettings:(e,t)=>l(C(t),{token:e}),listMenus:async(e,t)=>{let r=new URLSearchParams({no_page:"true"});t&&r.set("site",t);let n=await l(`/api/storefront/menus/?${r}`,{token:e});return Array.isArray(n)?n:n.results??[]},listBlogPosts:async(e,t={})=>{let r=new URLSearchParams({no_page:"true"});t.visibleOnly&&r.set("is_visible","true"),t.siteId&&r.set("site",t.siteId);let n=await l(`/api/storefront/blog-posts/?${r.toString()}`,{token:e});return Array.isArray(n)?n:n.results??[]},listCategories:async(e,t={})=>{let r=new URLSearchParams({no_page:"true"});t.visibleOnly&&r.set("is_visible","true"),t.siteId&&r.set("site",t.siteId);let n=await l(`/api/storefront/categories/?${r.toString()}`,{token:e});return[...Array.isArray(n)?n:n.results??[]].sort((o,m)=>o.sort_order-m.sort_order||o.name.localeCompare(m.name))},listForms:async(e,t={})=>{let r=new URLSearchParams({no_page:"true"});t.siteId&&r.set("site",t.siteId);let n=await l(`/api/storefront/forms/?${r.toString()}`,{token:e});return[...Array.isArray(n)?n:n.results??[]].sort((o,m)=>o.title.localeCompare(m.title))},listWheelSummaries:async(e,t={})=>{let r=new URLSearchParams;t.siteId&&r.set("site",t.siteId);let n=r.toString(),s=await l(`/api/storefront/wheel-curations/summaries/${n?`?${n}`:""}`,{token:e});return h(s)},listProducts:async(e,t={})=>{let r=new URLSearchParams;t.kinds?.length&&r.set("kind",t.kinds.join(",")),t.siteId&&r.set("site",t.siteId);let n=r.toString(),s=await l(`/api/storefront/products/${n?`?${n}`:""}`,{token:e});return h(s)},getWheelDetail:async(e,t,r={})=>{let n=new URLSearchParams({slug:t});return r.siteId&&n.set("site",r.siteId),A(h(await l(`/api/storefront/wheel-curations/detail/?${n.toString()}`,{token:e})))},updateHeaderSettings:(e,t,r)=>l(C(r),{method:"PATCH",body:JSON.stringify(e),token:t}),getSite:(e,t)=>l(D(e),{token:t}),listSiteCurrencies:async(e,t)=>{let r=await l(St(e),{token:t});return Array.isArray(r)?r:[]},updateSite:(e,t,r)=>l(D(e),{method:"PATCH",body:JSON.stringify(t),token:r}),getThemeSettings:(e,t)=>l(Pe(t),{token:e}),updateThemeSettings:(e,t,r)=>l(Pe(r),{method:"PATCH",body:JSON.stringify(e),token:t}),getChatSettings:(e,t)=>l(be(t),{token:e}),updateChatSettings:(e,t,r)=>l(be(r),{method:"PATCH",body:JSON.stringify(e),token:t}),getSocialSettings:(e,t)=>l(we(t),{token:e}),updateSocialSettings:(e,t,r)=>l(we(r),{method:"PATCH",body:JSON.stringify(e),token:t}),uploadHeaderLogo:(e,t,r)=>{let n=new FormData;return n.append("logo",e),l(C(r),{method:"PATCH",body:n,token:t})},clearHeaderLogo:(e,t)=>l(C(t),{method:"PATCH",body:JSON.stringify({logo:null}),token:e}),setHeaderLogoFromAsset:(e,t,r)=>l(C(r),{method:"PATCH",body:JSON.stringify({logo_asset_id:e}),token:t}),uploadMedia:async(e,t)=>{let r=new FormData;return r.append("file",e),l(bt(),{method:"POST",body:r,token:t})},listMedia:async(e,t)=>{let r=new URLSearchParams({no_page:"true"});t&&r.set("kind",t);let n=await l(`/api/storefront/media-assets/?${r.toString()}`,{token:e});return Array.isArray(n)?n:n.results??[]}};export{X as a,z as b,Z as c,b as d,Ee as e,$ as f,pe as g,ze as h,f as i,U as j,N as k,i as l,nt as m,st as n,ke as o,dt as p,gt as q,ht as r,Gt as s,Vt as t,Kt as u,H as v,l as w,jt as x};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as et,i as me,p as tt,r as nt,t as q}from"./chunk-7QXLVNFD.js";import{c as Ze}from"./chunk-RRHBLOH4.js";import{La as de,Ma as Qe,Pa as ke,Qa as Je}from"./chunk-FU5UZ4UY.js";import{l as je,u as re}from"./chunk-6CP4D6VJ.js";import{createContext as Vt,useContext as Gt,useEffect as Xt,useMemo as pe,useState as it}from"react";function rt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function oe(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Ae=4,Jn=1,Zn={unit:"set",spares:0,spareSide:"left"};function ot(e){return e.unit==="single"?1:Ae+e.spares}function er(e,t){return[{partNumber:e.partNumber,wheels:ot(t),prices:e.prices}]}function tr(e,t){let n=ot(t)-Ae;if(n<=0||e.length===0)return e;let r=Bt(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function Bt(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function zt(e,t){return t.spares>0?`${e} + spare`:e}function nr(e){return e.unit==="single"?"Single":zt(`Set of ${Ae}`,e)}var rr="data-add-to-basket",Ne=9,Re="en";function fe(e,t,n=0){return new Intl.NumberFormat(Re,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}import{jsx as Qt}from"react/jsx-runtime";var st="storefront-country",at=Vt(null);function Yt(e){return lt(e,"catalogue")}function jt(e){return lt(e,"money")}function lt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let s=r.get(i);if(!s){let l=n.get(i)??0;s=new Intl.NumberFormat(Re,{style:"currency",currency:i,minimumFractionDigits:t==="money"?l:0,maximumFractionDigits:l}),r.set(i,s)}return s.format(o)}}function lr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=pe(()=>t??[],[t]),s=pe(()=>n??[],[n]),l=pe(()=>r||i.find(C=>C.isDefault)?.code||i[0]?.code||"",[r,i]),c=pe(()=>o||s.find(C=>C.isDefault)?.code||s[0]?.code||"",[o,s]),[u,m]=it(c),[f,P]=it(!1);Xt(()=>{let C=re.getItem(st);C&&s.some(L=>L.code===C)&&m(C),P(!0)},[s]);function w(C){m(C),re.setItem(st,C)}let h=pe(()=>{let C=s.find(I=>I.code===u)??null,L=C?.currency,_=L&&i.some(I=>I.code===L)?L:l,M=Yt(i),x=jt(i);return{country:u,currency:_,setCountry:w,currencies:i,countries:s,activeCountry:C,formatPrice:(I,S)=>M(I,S??_),formatMoney:(I,S)=>x(I,S??_),ready:f}},[u,i,s,l,f]);return Qt(at.Provider,{value:h,children:e})}function ut(){let e=Gt(at);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as cn,useCallback as A,useContext as dn,useEffect as B,useMemo as Ct,useRef as ie,useState as N}from"react";function dt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var mt="We'll confirm this discount when you place your order.",mr="Confirmed at checkout";function fr(e){return e&&(e.valid||e.deferred)?e.code:void 0}var ct="coupon_code: ";function pr(e){return!(e instanceof me)||e.status!==400||!e.message.startsWith(ct)?null:e.message.slice(ct.length)}function ft(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Ee="Price on request",Zt="Request a quote";function Me(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function De(e,t){let n=e?.[t];return Me(n)?n:null}function hr(e,t,n,r){let o=De(e,n),i=De(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Cr(e,t,n,r){if(n==null&&r==null)return!0;let o=De(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var en={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function tn(e,t,n){if(!Me(e))return en;let r=Me(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function xr(e,t,n=""){return!e.priced||e.unit==null?Ee:`${n}${fe(e.unit,t)}`}function Sr(e,t){return e.was==null?null:fe(e.was,t)}function nn(e,t,n=1){let r=oe(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,l)=>s+l.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var rn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function vr(e,t,n,r=1){let o=tn(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let s=nn(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...rn,fromSetTotal:i}}function on(e,t){return!e.priced||e.unit==null?Ee:`${e.isFrom?"from ":""}${fe(e.unit,t)}`}function Er(e,t){return e.was==null?null:fe(e.was,t)}function Pr(e,t){return!e.priced||e.unit==null?Zt:on(e,t)}var sn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function pt(e){return sn.test(e.trim())}var gt="sf:ga-purchases",an=20;function bt(){return typeof window>"u"||window.parent!==window}function ge(...e){try{if(bt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function ln(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:oe(e.components,t)??0,quantity:e.qty}}function Oe(e,t){return e.filter(Pe).map(n=>ln(n,t))}function kr(e){ge("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function ht(e,t){let n=Oe([e],t);n.length!==0&&ge("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Ar(e){let t=Oe(e.lines,e.currency);t.length!==0&&ge("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var yt=new Set;function un(e){if(yt.has(e))return!1;yt.add(e);try{let t=JSON.parse(re.getItem(gt)??"[]");if(t.includes(e))return!1;re.setItem(gt,JSON.stringify([...t,e].slice(-an)))}catch{}return!0}function Nr(e){let t=e.confirmation;if(bt()||!un(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ge("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Oe(e.lines,n)}),e.adsSendTo&&ge("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}import{jsx as gn}from"react/jsx-runtime";var mn=400,fn=400,pn=1500;function Pe(e){return(e.components?.length??0)>0}function xt(e,t){return{code:e,valid:t.valid,deferred:dt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function vt(e,t){return oe(e.components,t)}function Fe(e,t){let n=vt(e,t);return n===null?null:n*e.qty}function St(e){return e!=="tyre"}var Et=cn(null);function Wr({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=ut(),[i,s]=N(t),[l,c]=N([]),[u,m]=N([]),[f,P]=N([]),[w,h]=N(!1),[C,L]=N(!1),[_,M]=N(!1),[x,I]=N(!1),[S,H]=N(null),[W,j]=N(void 0),b=ie(r),v=ie("");b.current=b.current||r;let[d,K]=N(null),[Q,V]=N(!1),[R,J]=N(null),Z=ie(void 0),D=A(()=>s(!0),[]),he=A(()=>s(!1),[]),O=A(()=>s(a=>!a),[]);B(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&D()},[D,t]);let Ce=A(a=>{I(!0),St(a)&&M(!0)},[]),ee=_||l.some(a=>St(a.kind)),ae=x||l.length>0;B(()=>{if(t||!ee||w)return;let a=!0;return q.listWheels().then(p=>{a&&(m(p),h(!0))}),()=>{a=!1}},[t,ee,w]),B(()=>{if(t||!ae||C)return;let a=!0;return q.listBundles().then(p=>{a&&(P(p),L(!0))}),()=>{a=!1}},[t,ae,C]);let U=S?.deliveryOptions??[];B(()=>{U.length!==0&&J(a=>a&&U.some(p=>p.id===a)?a:U[0]?.id??null)},[S]);let G=A(()=>l.filter(Pe).flatMap(a=>rt(a.components,a.qty)),[l]),le=A(async(a,p)=>{let y=a.trim().toUpperCase();if(!y)return;let g=G();if(g.length===0){K({code:y,valid:!1,message:"Add a wheel to the cart first."});return}V(!0),Z.current=p;try{let T=await q.validateCoupon({code:y,items:g,currency:n,shippingMethodId:R??void 0,customerEmail:p});K(xt(y,T))}catch{K({code:y,valid:!1,message:"Could not check that code. Please try again."})}finally{V(!1)}},[G,n,R]),te=A(()=>{K(null),Z.current=void 0},[]),xe=A(a=>{if(!d)return;let{code:p}=d;K(y=>y&&y.code===p?{code:p,valid:!1,refused:!0,message:a}:y)},[d]);B(()=>{if(!d||d.refused)return;let a=d.code,p=g=>g!==null&&g.code===a&&!g.refused,y=setTimeout(async()=>{let g=G();if(g.length===0){K(T=>p(T)?{code:a,valid:!1,message:"Add a wheel to the cart first."}:T);return}V(!0);try{let T=await q.validateCoupon({code:a,items:g,currency:n,shippingMethodId:R??void 0,customerEmail:Z.current});K(ce=>p(ce)?xt(a,T):ce)}catch{}finally{V(!1)}},mn);return()=>clearTimeout(y)},[l,n,R]);let Se=d&&!d.refused?d.code:void 0;B(()=>{if(t)return;let a=!0,p=setTimeout(async()=>{let y=G();if(y.length===0){H(null),j(void 0);return}try{let g=await q.quoteCart({items:y,currency:n,shippingMethodId:R??void 0,couponCode:Se,customerEmail:Z.current||void 0,country:b.current||void 0,subdivision:v.current||void 0});if(!a)return;H(g)}catch{if(!a)return}j(Se)},fn);return()=>{a=!1,clearTimeout(p)}},[l,n,R,Se,r]),B(()=>{if(t||!i)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[i,t]);let E=A(a=>{c(p=>{let y=p.findIndex(g=>g.id===a.id);return y===-1?[...p,a]:p.map((g,T)=>T===y?{...g,qty:Math.min(Ne,g.qty+a.qty)}:g)}),ht(a,n)},[n]),F=A(a=>{c(p=>p.filter(y=>y.id!==a))},[]),X=A((a,p)=>{let y=Math.max(1,Math.min(Ne,p));c(g=>g.map(T=>T.id===a?{...T,qty:y}:T))},[]),We=A(a=>{c(a)},[]),[ue,Ft]=N(null),Be=ie(null);Be.current=ue;let $=ie(null),Te=ie(""),ze=A((a,p)=>{let y=a.trim().toLowerCase();pt(y)&&Ft(g=>g&&g.email===y&&g.firstName===(p??"")?g:{email:y,firstName:p??""})},[]);B(()=>{if(t||!ue)return;let a=ft(l.filter(Pe),g=>Fe(g,n)===null?Ee:o(Fe(g,n),n)),p={email:ue.email,firstName:ue.firstName,currency:n,items:a},y=JSON.stringify(p);if(y!==Te.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Te.current=y,q.captureCart(p).catch(g=>{})},pn),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[l,ue,n,t]);let Ve=A(()=>{$.current&&(clearTimeout($.current),$.current=null);let a=Be.current;a&&(Te.current="",q.captureCart({email:a.email,firstName:a.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),Ge=Ct(()=>{let a=l.reduce((k,ne)=>{let ve=Fe(ne,n);return ve===null?k:k+ve},0),p=l.some(k=>vt(k,n)===null),y=l.reduce((k,ne)=>k+ne.qty,0),g=d?.valid?d.effects:void 0,T=g?Math.min(a,Number(g.discountAmount)):0,ce=S?.bundleDiscount??0,$t=S?.appliedBundles??[],Xe=!!g?.freeShipping,qt=U.find(k=>k.id===R),Ye=Xe?0:S?.shipping??qt?.amount??0,_e={};for(let k of g?.freeUnits??[])_e[k.partNumber]=(_e[k.partNumber]??0)+k.quantity;let Ht=S?.tax??null,Kt=S?S.grandTotal:a-T-ce+Ye;return{sets:y,units:l.reduce((k,ne)=>k+(ne.components??[]).reduce((ve,Wt)=>ve+Wt.wheels*ne.qty,0),0),subtotal:a,hasUnpricedLine:p,discount:T,bundleDiscount:ce,appliedBundles:$t,shipping:Ye,freeShipping:Xe,freeUnitsByPartNumber:_e,tax:Ht,grand:Kt,repricing:!!d?.refused&&S!==null&&W===d?.code,currency:n}},[l,n,d,U,R,S,W]),Ut=Ct(()=>({isOpen:i,open:D,close:he,toggle:O,items:l,catalog:u,bundles:f,warmCatalog:Ce,add:E,remove:F,setQty:X,replaceItems:We,identify:ze,clearCapturedCart:Ve,coupon:d,applyCoupon:le,removeCoupon:te,refuseCoupon:xe,couponBusy:Q,deliveryOptions:U,shippingMethodId:R,setShippingMethodId:J,totals:Ge}),[i,D,he,O,l,u,f,Ce,E,F,X,We,ze,Ve,d,le,te,xe,Q,U,R,Ge]);return gn(Et.Provider,{value:Ut,children:e})}function Pt(){let e=dn(Et);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as In}from"react";function Lt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,c]of e){if(c.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var yn=6e4,bn=5e3,hn=500,Ue=new Map;async function Cn(e){let{host:t,matchesRequestHost:n}=await tt();if(!t)return"";let r=await nt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var xn=e=>e.includes("|slug:")||e.includes("|xhost:");async function It(e,t){let n=await Cn(e);if(!n)return t();let r=Date.now(),o=Ue.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed"?bn:yn;return Lt(Ue,hn,xn,r),Ue.set(n,{load:i,expiresAt:r+s}),i}var Sn=404;function vn(e){if(e instanceof me&&e.status===Sn)return{state:"absent"};let t=e instanceof me?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var En="[storefront:chrome-load-failed]";function Pn(e,t){console.error(`${En} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function wt(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=vn(o);return i.state==="failed"&&Pn(e,i),{value:n,outcome:i}}}function Ln(e){return e==="production"?"silent":"banner"}var Qr=Ln("production");function wn(e,t){return e?.trim()||t}function io({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=wn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Tn={name:de,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,mapsApiKey:null,mapsMapId:null,socialLinks:ke},so=In(async()=>It("site",()=>wt("site",async()=>{let e=await q.getSite();return{name:Qe(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:Je(e.socialLinks)}},Tn)));var ao={name:de,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,mapsApiKey:null,mapsMapId:null,socialLinks:ke};import{useEffect as Le,useRef as _t,useState as Ie}from"react";var ye=new Map,_n=64;async function kn(e){if(!je())return null;try{let t=await fetch(`${Ze()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function Tt(e){let t=ye.get(e);if(t)return t;let n=kn(e);if(ye.set(e,n),ye.size>_n){let r=ye.keys().next();r.done||ye.delete(r.value)}return n}import{jsx as kt,jsxs as At}from"react/jsx-runtime";var An={small:54,medium:66,large:84},Nn=44,Rn=202/22,bo=16,ho=140,Mn=.88,Co=16,Dn="invert(1)";function On({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,onLightSurface:o,reversedSrc:i,inkIsDark:s,size:l="medium",sizePx:c,wordmark:u,siteName:m=de,fitToContainer:f=!1,fitWordmarkToContainer:P=!1,fitFloorPx:w}){let h=u&&u.trim()?u.trim():m,[C,L]=Ie(!1),_=_t(null),M=E=>{_.current=E};Le(()=>{let E=_.current?.ownerDocument??document,F=()=>{L(E.documentElement.getAttribute("data-theme")==="light")};F();let X=new MutationObserver(F);return X.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>X.disconnect()},[]);let x=n&&n.trim()?n.trim():null,I=!!x&&et(x),S=o??(C&&t),H=r&&I&&x&&i!=null?{reversed:i,inkIsDark:s??null}:null,W=H!==null,[j,b]=Ie(null);Le(()=>{if(!r||!x||!I||W){b(null);return}let E=!1;return b(null),Tt(x).then(F=>{E||b(F)}),()=>{E=!0}},[r,x,I,W]);let v=H??j,d=!!v&&v.inkIsDark!==null&&(S?!v.inkIsDark:v.inkIsDark),K=r&&!!x&&!I&&!S,Q=d&&v?v.reversed:x,V=Q?[Q]:[],[R,J]=Ie(0);Le(()=>{J(0)},[x,d]);let Z=e==="footer"?Nn:An[l],D=c&&c>0?c:Z,he=Math.round(D*Rn),O=R<V.length?V[R]:null,[Ce,ee]=Ie(Q),ae=O!==null&&O===Ce,U=_t(null);Le(()=>{let E=U.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(O);return}let F=!1;return E.decode().then(()=>!F&&ee(O),()=>!F&&J(X=>X+1)),()=>{F=!0}},[O]);let G=f||P,le=`calc(100cqi / ${((h.length+1)*Mn).toFixed(2)})`,te=G&&w&&w>0?Math.min(w,D):null,xe=G?te===null?`min(${D}px, ${le})`:`clamp(${te}px, ${le}, ${D}px)`:`${D}px`;return At("span",{ref:M,className:"inline-flex items-center",children:[!ae&&At("span",{className:`font-display font-bold tracking-[0.18em] ${te===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:xe,lineHeight:1},"aria-label":h,children:[h,kt("span",{className:"text-accent",children:"."})]}),O&&kt("img",{ref:U,src:O,alt:h,width:he,height:D,className:"shrink-0 object-contain",style:{...ae?{height:`${D}px`,width:"auto",...f?{maxWidth:"100cqi"}:{}}:{display:"none"},...K?{filter:Dn}:{}},onLoad:()=>ee(O),onError:()=>J(E=>E+1)},O)]})}import{Children as Un,isValidElement as $n,useEffect as Rt,useId as qn,useLayoutEffect as Hn,useRef as Y,useState as Mt}from"react";var we=(e,t)=>!!e[t]&&!e[t].disabled;function $e(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(we(e,i))return i}return t}function qe(e,t){return $e(e,t===1?-1:e.length,t)}function He(e,t){return we(e,t)?t:Math.max(qe(e,1),0)}function Nt(e,t,n){let{open:r,focus:o}=e,i=s=>({...e,...s});if(t.length===1&&/\S/.test(t)){let s=e.typed+t.toLowerCase(),l=n.findIndex((c,u)=>we(n,u)&&c.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:l>=0?l:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:$e(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:$e(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:qe(n,1)}),handled:!0};case"End":return{state:i({focus:qe(n,-1)}),handled:!0};case"Enter":case" ":return we(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{Fragment as Vn,jsx as z,jsxs as Dt}from"react/jsx-runtime";function Kn({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,l]=Mt(!1),c=r!==void 0,u=c?r:s,[m,f]=Mt(0),P=Y({text:"",timer:0}),w=Y(null),h=Y(null),C=Y(null),L=qn(),_=Y(null),M=e.findIndex(b=>b.value===t),x=b=>{b!==u&&(c||l(b),b?o?.():i?.())},I=b=>{let v=e[b];!v||v.disabled||(n(v.value),x(!1),h.current?.focus())},S=b=>{let v={open:u,focus:u?m:He(e,M),typed:P.current.text},d=Nt(v,b,e);return!d.handled&&d.state.open===u?!1:(d.state.typed!==v.typed&&(P.current.text=d.state.typed,window.clearTimeout(P.current.timer),P.current.timer=window.setTimeout(()=>{P.current.text=""},500)),f(d.state.focus),d.commit!==void 0?I(d.commit):x(d.state.open),d.refocus&&h.current?.focus(),d.handled)},H=Y(S);H.current=S;let W=Y(()=>x(!1));W.current=()=>x(!1);let j=b=>{u||(_.current=b.nativeEvent,H.current(b.key)&&b.preventDefault())};return Rt(()=>{if(!u)return;let b=d=>{w.current?.contains(d.target)||W.current()},v=d=>{d!==_.current&&H.current(d.key)&&d.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v)}},[u]),Rt(()=>{u&&(P.current.text||f(He(e,M)))},[u]),Hn(()=>{if(!u||!C.current)return;C.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>x(!u),close:()=>x(!1),focusIdx:m,setFocusIdx:f,pick:b=>I(e.findIndex(v=>v.value===b)),wrapRef:w,triggerRef:h,listRef:C,listId:L,onTriggerKeyDown:j,activeId:u?`${L}-${m}`:void 0}}var Wn={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-2.5 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>["cursor-pointer whitespace-nowrap px-6 py-3 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.1em] transition-colors",e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>["flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left text-[length:var(--size-body,14px)] transition-colors last:border-b-0",t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-3.5 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Bn({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:l,ariaLabel:c}){let u=Wn[t];return z("ul",{ref:l,id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((m,f)=>{let P=m.value===r;return z("li",{id:`${e}-${f}`,role:"option","aria-selected":P,"aria-disabled":m.disabled||void 0,onMouseEnter:()=>!m.disabled&&i(f),onMouseDown:w=>{w.preventDefault(),m.disabled||s(m.value)},className:u.item(f===o,P&&m.value!=="",!!m.disabled,f===n.length-1),style:u.itemStyle?.(P),children:m.meta===void 0?m.label:Dt(Vn,{children:[z("span",{className:"flex-1 whitespace-nowrap",children:m.label}),z("span",{className:"ml-auto text-[12px] opacity-50",children:m.meta})]})},`${m.value}_${f}`)})})}function zn({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:l,"aria-label":c}){let u=Un.toArray(r).flatMap(h=>{if(!$n(h))return[];if(h.type!=="option")return[];let L=h.props,_=L.value!==void 0?String(L.value):"",M=L.children,x=typeof M=="string"||typeof M=="number"?String(M):_;return[{value:_,label:x,disabled:!!L.disabled}]}),m=e??"",f=Kn({items:u,value:m,onPick:h=>t?.({target:{value:h}})}),w=u.find(h=>h.value===m)?.label??u[0]?.label??"";return Dt("div",{ref:f.wrapRef,className:"relative",children:[s&&z("input",{type:"hidden",name:s,value:m}),z("button",{ref:h=>{f.triggerRef.current=h},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":f.open,"aria-controls":f.open?f.listId:void 0,"aria-activedescendant":f.activeId,"aria-label":c,id:l,onClick:()=>!n&&f.toggle(),onKeyDown:h=>!n&&f.onTriggerKeyDown(h),className:`block w-full ${o??""}`,style:i,children:z("span",{className:"block w-full truncate text-left",children:w})}),f.open&&z(Bn,{id:f.listId,tone:"select",items:u,value:m,focusIdx:f.focusIdx,onFocus:f.setFocusIdx,onPick:f.pick,listRef:f.listRef})]})}var _o="#c9a461",Ot=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],ko={name:"",color:"var(--fg)",family:"silver",src:""};function Gn(e,t){let n=r=>{let o=Ot.findIndex(i=>i.f===r);return o===-1?Ot.length:o};return n(e)-n(t)||e.localeCompare(t)}function Ao(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(Gn)}import{jsx as be,jsxs as Yn}from"react/jsx-runtime";function Xn({spokes:e,mesh:t=!1,className:n}){let s=c=>Math.round(c*1e3)/1e3,l=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(l.push({x1:s(100+Math.cos(u)*22),y1:s(100+Math.sin(u)*22),x2:s(100+Math.cos(u)*86),y2:s(100+Math.sin(u)*86),main:!0}),t){let m=u+Math.PI/e;l.push({x1:s(100+Math.cos(m)*22*1.4),y1:s(100+Math.sin(m)*22*1.4),x2:s(100+Math.cos(m)*78),y2:s(100+Math.sin(m)*78),main:!1})}}return Yn("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[be("circle",{cx:100,cy:100,r:92,strokeWidth:2}),be("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),be("circle",{cx:100,cy:100,r:22,strokeWidth:2}),be("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>be("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}import{useState as jn}from"react";import{jsx as se,jsxs as Ke}from"react/jsx-runtime";function Qn({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Pt(),[i,s]=jn("");async function l(){o||!i.trim()||(await n(i,e),s(""))}return Ke("div",{className:"flex flex-col gap-2",children:[t===null?Ke("div",{className:"flex border border-line",children:[se("input",{type:"text",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-3.5 py-3.5 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),se("button",{type:"button",onClick:()=>{l()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):Ke("div",{className:["flex items-center justify-between gap-3 border px-3.5 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[se("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),se("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:mt}):t&&!t.valid&&t.message&&se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function qo(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}export{mr as a,fr as b,pr as c,rt as d,Ae as e,Jn as f,Zn as g,er as h,tr as i,Bt as j,zt as k,nr as l,rr as m,Ne as n,Re as o,fe as p,Ee as q,Zt as r,De as s,hr as t,Cr as u,tn as v,xr as w,Sr as x,nn as y,vr as z,on as A,Er as B,Pr as C,pt as D,kr as E,Ar as F,Nr as G,lr as H,ut as I,Pe as J,Fe as K,Wr as L,Pt as M,io as N,Tn as O,ao as P,An as Q,Nn as R,bo as S,ho as T,Co as U,On as V,Kn as W,Bn as X,zn as Y,_o as Z,Ot as _,ko as $,Gn as aa,Ao as ba,Xn as ca,Qn as da,qo as ea};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as on,useCallback as s,useContext as rn,useMemo as an,useState as Ee}from"react";import{createContext as ue,useContext as L}from"react";import{createContext as ct}from"react";var se=ct(null);var dt=ue(null),I=ue({logo:null,placeholder:!1,wordmark:null});function Tn(){let e=L(se),t=L(dt),n=L(I),o=!e&&n.placeholder,r=e?e.logoUrl:n.logo?.logoUrl??t?.logoUrl??null;return{src:o?null:r,reversedSrc:e?e.logoReversed:n.logo?.logoReversed??t?.logoReversed??null,inkIsDark:e?e.logoInkIsDark:n.logo?.logoInkIsDark??t?.logoInkIsDark??null,wordmark:e?null:n.wordmark,siteName:e?.siteName??t?.siteName}}import{createContext as gt,useCallback as de,useContext as ht,useRef as pt,useState as ft}from"react";var P=0;function ce(e){P+=1;try{return e()}finally{P-=1}}function Cn(){return P>0}import{jsx as mt}from"react/jsx-runtime";function F(){let e=pt(()=>{}),t=de((...o)=>ce(()=>e.current(...o)),[]),n=de(o=>{e.current=o},[]);return{select:t,setSelectHandler:n}}function An(e){let t=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`,n=(l,u,c,d)=>({[e]:l,[t]:u,select:c,setSelectHandler:d}),o=gt(n(null,()=>{},()=>{},()=>{}));function r({children:l}){let[u,c]=ft(null),{select:d,setSelectHandler:h}=F();return mt(o.Provider,{value:n(u,c,d,h),children:l})}return{Provider:r,useSelection:()=>ht(o)}}var Ln="storefront-theme",In="sf:theme-mode",Pn="sf:theme-switch",Fn="hide",G="light";function St(e){return e>=7&&e<18}function On(e){let{mode:t,override:n,switchShown:o,hour:r}=e;return o&&(n==="light"||n==="dark")?n:t==="auto"?St(r)?"light":"dark":t==="light"?"light":"dark"}var m={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},yt=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],H={selected:0,themes:yt};function ge(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...H}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function O(e,t,n){let o=R(e),r=R(t);if(o===null||r===null)return e;let i=l=>Math.max(0,Math.min(255,Math.round(l))).toString(16).padStart(2,"0");return`#${o.map((l,u)=>i(l+(r[u]-l)*n)).join("")}`}var bt={light:"#ffffff",dark:"#0a0a0a"},Mn=["light","dark"];function Dn(e,t){let n=bt[t],o=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:O(e,o,.1),line:O(e,o,.22),muted:O(n,e,.35),brandInk:t}}function w(e){let t=ge(e);return t.themes[t.selected]}function he(e){return{text:e.text,accent:e.accent,background:e.background||m.background,surface:e.surface||m.surface,line:e.line||m.line,muted:e.muted||m.muted}}function R(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1].length===3?[...t[1]].map(l=>l+l).join(""):t[1],[o,r,i]=[0,2,4].map(l=>parseInt(n.slice(l,l+2),16));return[o,r,i]}function N(e){let t=R(e);if(t===null)return null;let[n,o,r]=t.map(i=>{let l=i/255;return l<=.04045?l/12.92:((l+.055)/1.055)**2.4});return .2126*n+.7152*o+.0722*r}var xt=.4,_t=4.5,Tt=3;function Et(e,t){let n=N(e),o=N(t);if(n===null||o===null)return null;let[r,i]=n>=o?[n,o]:[o,n];return(r+.05)/(i+.05)}var Vn={good:"Good","large-only":"Large text only",hard:"Hard to read"};function Nn(e){return e>=_t?"good":e>=Tt?"large-only":"hard"}var M=["#000000","#ffffff"];function A(e){let t=M[0],n=-1;for(let o of M){let r=Et(e,o);if(r===null)return M[0];r>n&&(n=r,t=o)}return t}var Ct=[.25,.4,.55];function Gn(e){let t=R(e);return t===null?[]:Ct.map(n=>"#"+t.map(o=>Math.round(o*(1-n)).toString(16).padStart(2,"0")).join(""))}function Un(e){let t=w(e),n={"--theme-fg":t.text},o=N(t.text);return(o===null||o>=xt)&&(n["--overlay-fg"]=t.text),n}var Rt=82;function U(e){return`color-mix(in srgb, ${e} ${Rt}%, #000)`}function zn(e){let t=w(e);return{"--theme-accent":t.accent,"--theme-accent-2":U(t.accent),"--theme-accent-ink":A(t.accent)}}function pe(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function $n(e){let t=w(e),n=pe(t),o=fe(t);if(n===null&&o===null)return{};let r={};return n!==null&&(r["--theme-btn"]=n,r["--theme-btn-2"]=U(n)),r["--theme-btn-ink"]=o??A(n),r}function fe(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Bn(e,t){return fe(e)??A(pe(e)??t)}function Yn(e){let t={};return ge(e).themes.forEach((n,o)=>{let r=he(n);t[`--theme-preset-${o}-accent`]=r.accent,t[`--theme-preset-${o}-accent-2`]=U(r.accent),t[`--theme-preset-${o}-accent-ink`]=A(r.accent),t[`--theme-preset-${o}-bg`]=r.background,t[`--theme-preset-${o}-fg`]=r.text,t[`--theme-preset-${o}-surface`]=r.surface,t[`--theme-preset-${o}-surface-2`]=`color-mix(in srgb, ${r.surface} 60%, ${r.line})`,t[`--theme-preset-${o}-line`]=r.line,t[`--theme-preset-${o}-muted`]=r.muted}),t}var Wn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Kn(e){let t=he(w(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,o={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==m.surface||t.line!==m.line)&&(o["--theme-surface-2"]=n),o}var Ht=["heading","body","label"];function Xn(e){if(!e)return null;for(let t of Ht)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var me=["headingLarge","headingMedium","headingSmall","accent","body","label"];var z={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},wt=8,At=200,qn=1;function vt(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=wt&&t<=At?t:null}function kt(e){let t={};for(let n of me)t[n]=vt(e?.[n]);return t}function Zn(e){let t=kt(e),n={};for(let o of me){let r=t[o];r!==null&&(n[`--size-${o}`]=`${r}px`)}return n}var Lt=["square","small","large"],It="small";function jn(e){return Lt.includes(e??"")?e:It}var Pt=0,Ft=40,Jn={square:0,small:null,large:16},Ot={"--sf-card-radius":1,"--sf-button-radius":.5,"--radius":.5,"--radius-xs":.25,"--radius-sm":.5,"--radius-md":.75,"--radius-lg":1,"--radius-xl":1.25,"--radius-2xl":1.5,"--radius-3xl":2,"--radius-4xl":2.5};function Mt(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(Ft,Math.max(Pt,Math.round(t))):null}function Qn(e){let t=Mt(e);return t===null?{}:Object.fromEntries(Object.entries(Ot).map(([n,o])=>{let r=t*o/16;return[n,r===0?"0":`${r}rem`]}))}var Dt=["none","soft","lifted"],Vt="soft",Se="none",Nt=["tight","normal","roomy"],Gt="normal",v="normal",Ut=["none","lift","highlight"],zt="lift",$t="highlight",ye="#141416";function be(e){return Dt.includes(e??"")?e:Vt}function Bt(e){return Nt.includes(e??"")?e:Gt}function xe(e){return Ut.includes(e??"")?e:zt}function Yt(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():ye}function eo(e){let t=be(e);return t===Se?void 0:t}function to(e){let t=Bt(e);return t===v?void 0:t}function no(e){let t=xe(e);return t===$t?void 0:t}function oo(e,t,n){let o=Yt(t);return o===ye?{}:be(e)!==Se||xe(n)==="lift"?{"--sf-shadow-color":o}:{}}var Wt=["normal","tight","compressed"],T="normal";function _e(e){return Wt.includes(e??"")?e:T}function ro(e){let t=_e(e);return t===T?void 0:t}function ao(e){switch(_e(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}var $={case:"authored",weight:null,weightStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},D=100,V=900,Kt=24,Xt=200;function C(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function B(e){let t=C(e?.weight,D,V),n=e?.case==="sentence"?"sentence":"authored",o=i=>i==null?t:C(i,D,V),r=i=>i==="sentence"?"sentence":i==="authored"?"authored":n;return{case:n,weight:t,weightStrong:C(e?.weightStrong,D,V),maxPx:C(e?.maxPx,Kt,Xt),weight2:o(e?.weight2),weight3:o(e?.weight3),case2:r(e?.case2),case3:r(e?.case3)}}function lo(e){let t=B(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function io(e){return B({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}function so(e){let t=B(e);return{heading_case:t.case,heading_weight:t.weight,heading_weight_strong:t.weightStrong,heading_max_px:t.maxPx,heading_2_weight:t.weight2,heading_3_weight:t.weight3,heading_2_case:t.case2,heading_3_case:t.case3}}var Y=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],p=new Map(Y.map(e=>[e.key,e])),qt={sans:"Sans",serif:"Serif",mono:"Mono"};function co(){return Object.keys(qt).map(e=>[e,Y.filter(t=>t.category===e)]).filter(([,e])=>e.length>0)}function go(e){return p.get(e)?.italicLoaded??!1}function ho(e){return p.get(e)}var Te=["heading","heading2","heading3","body","accent","label"],po={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},Zt=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],jt=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,fo={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},Jt={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function mo(e){let t=e?jt.exec(e):null;return t?Jt[t[1]]??null:Qt(e)}function Qt(e){if(!e)return null;let t=e.split(/\s+/).filter(n=>!n.slice(0,n.lastIndexOf(":")+1).includes("&")).map(n=>n.slice(n.lastIndexOf(":")+1));for(let[n,o]of Zt)if(t.includes(n))return o;return null}var en=["heading","heading2","heading3"];function So(e){return en.includes(e)}var f={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function tn(e){let t=n=>{let o=e?.[n];if(o&&p.has(o))return o;if(n==="heading2"||n==="heading3"){let r=e?.heading;return r&&p.has(r)?r:f.heading}return f[n]};return Object.fromEntries(Te.map(n=>[n,t(n)]))}function nn(e,t){return p.get(e[t])??p.get(f[t])}function S(e,t){return`var(${nn(e,t).cssVar})`}var yo=[...new Set(Te.map(e=>p.get(f[e]).cssVar))],bo=[...new Set(Y.map(e=>e.cssVar))];function xo(e){let t=tn(e);return{"--font-role-heading":S(t,"heading"),"--font-role-heading2":S(t,"heading2"),"--font-role-heading3":S(t,"heading3"),"--font-role-body":S(t,"body"),"--font-role-accent":S(t,"accent"),"--font-role-label":S(t,"label"),fontFamily:"var(--font-role-body)"}}import{jsx as Ce}from"react/jsx-runtime";var He=on({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:G,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:H,setTheme:()=>{},fonts:f,setFonts:()=>{},sizes:z,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:v,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:T,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:$,setHeadingTypography:()=>{},heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function wo({children:e,websiteName:t=null,templateChrome:n=!1,templateName:o=null,chromePlaceholder:r=!1,themeMode:i=G,onThemeModeChange:l,themeSwitchShown:u=!1,onThemeSwitchShownChange:c,theme:d=H,onThemeChange:h,fonts:y=f,onFontsChange:b,sizes:x=z,onSizesChange:g,cornerRadiusPx:k=null,onCornerRadiusPxChange:E,cardShadow:Ae=null,onCardShadowChange:W,shadowColor:ve=null,onShadowColorChange:K,cardGap:ke=v,onCardGapChange:X,hoverEffect:Le=null,onHoverEffectChange:q,headingCompression:Ie=T,onHeadingCompressionChange:Z,siteWidth:Pe=null,onSiteWidthChange:j,siteGutter:Fe=null,blockGap:Oe=null,onSiteGutterChange:J,onBlockGapChange:Q,headingTypography:Me=$,onHeadingTypographyChange:ee,heroBackgroundFollowsWidth:De=null,onHeroBackgroundFollowsWidthChange:te,photographyGrayscale:Ve=null,onPhotographyGrayscaleChange:ne,themeFromDocument:Ne=!1}){let[_,oe]=Ee(null),Ge=s(a=>oe(ut=>ut??a),[]),[Ue,ze]=Ee(!1),$e=s(a=>l?.(a),[l]),Be=s(a=>c?.(a),[c]),Ye=s(a=>h?.(a),[h]),We=s(a=>b?.(a),[b]),Ke=s(a=>g?.(a),[g]),Xe=s(a=>j?.(a),[j]),qe=s(a=>J?.(a),[J]),Ze=s(a=>Q?.(a),[Q]),je=s(a=>te?.(a),[te]),Je=s(a=>ne?.(a),[ne]),Qe=s(a=>E?.(a),[E]),et=s(a=>W?.(a),[W]),tt=s(a=>K?.(a),[K]),nt=s(a=>X?.(a),[X]),ot=s(a=>q?.(a),[q]),rt=s(a=>Z?.(a),[Z]),at=s(a=>ee?.(a),[ee]),{select:lt,setSelectHandler:it}=F(),re=_?.logoUrl,ae=_?.logoReversed,le=_?.logoInkIsDark,ie=_!==null,st=an(()=>({logo:ie?{logoUrl:re,logoReversed:ae,logoInkIsDark:le}:null,placeholder:n||r,wordmark:n?o:t}),[ie,re,ae,le,n,r,o,t]);return Ce(I.Provider,{value:st,children:Ce(He.Provider,{value:{settings:_,setSettings:oe,primeSettings:Ge,websiteName:t,templateChrome:n,templateName:o,chromePlaceholder:r,themeMode:i,setThemeMode:$e,themeSwitchShown:u,setThemeSwitchShown:Be,theme:d,setTheme:Ye,fonts:y,setFonts:We,sizes:x,setSizes:Ke,cornerRadiusPx:k,setCornerRadiusPx:Qe,cardShadow:Ae,setCardShadow:et,shadowColor:ve,setShadowColor:tt,cardGap:ke,setCardGap:nt,hoverEffect:Le,setHoverEffect:ot,headingCompression:Ie,setHeadingCompression:rt,siteWidth:Pe,setSiteWidth:Xe,siteGutter:Fe,blockGap:Oe,setSiteGutter:qe,setBlockGap:Ze,headingTypography:Me,setHeadingTypography:at,heroBackgroundFollowsWidth:De,setHeroBackgroundFollowsWidth:je,photographyGrayscale:Ve,setPhotographyGrayscale:Je,themeFromDocument:Ne,selected:Ue,setSelected:ze,select:lt,setSelectHandler:it},children:e})})}var Ao=()=>rn(He);var ln="Storefront";function Lo(e){return e?.trim()||ln}import{forwardRef as sn}from"react";import{jsx as dn}from"react/jsx-runtime";var un={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"},cn=sn(function({src:t,width:n,height:o,fill:r,priority:i,loading:l,style:u,quality:c,placeholder:d,blurDataURL:h,unoptimized:y,loader:b,overrideSrc:x,...g},k){let E=x??(typeof t=="string"?t:t.src);return dn("img",{ref:k,src:E,width:r?void 0:n,height:r?void 0:o,loading:i?"eager":l??"lazy",fetchPriority:i?"high":void 0,decoding:"async",style:r?{...un,...u}:{color:"transparent",...u},...g})}),Fo=cn;function Oo(e){return{props:{src:e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),sizes:e.sizes}}}import{forwardRef as gn}from"react";import{jsx as fn}from"react/jsx-runtime";function hn(e){if(typeof e=="string")return e;let t=e.query?`?${new URLSearchParams(e.query).toString()}`:"",n=e.hash?e.hash.startsWith("#")?e.hash:`#${e.hash}`:"";return`${e.pathname??""}${t}${n}`}var pn=gn(function({href:t,prefetch:n,replace:o,scroll:r,shallow:i,legacyBehavior:l,passHref:u,locale:c,onClick:d,children:h,...y},b){let x=g=>{d?.(g),!(g.defaultPrevented||y.target==="_blank")&&g.preventDefault()};return fn("a",{ref:b,href:hn(t),onClick:x,...y,children:h})}),No=pn;var we=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp"],mn={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp"},Sn={};function zo(e){if(!e||typeof e!="object")return Sn;let t={};for(let n of we){let o=e[n];if(typeof o!="string")continue;let r=o.trim();!r||!/^https?:\/\//i.test(r)||(t[n]=r)}return t}function $o(e){return we.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:mn[t]}]:[]})}var Bo=e=>`${e}_url`;export{Fo as a,Oo as b,No as c,Cn as d,F as e,An as f,Y as g,qt as h,co as i,go as j,ho as k,Te as l,po as m,fo as n,mo as o,Qt as p,So as q,f as r,tn as s,xo as t,Ln as u,In as v,Pn as w,Fn as x,G as y,On as z,yt as A,ge as B,Mn as C,Dn as D,w as E,he as F,Et as G,Vn as H,Nn as I,Gn as J,Un as K,zn as L,pe as M,$n as N,fe as O,Bn as P,Yn as Q,Wn as R,Kn as S,Xn as T,z as U,wt as V,At as W,qn as X,kt as Y,Zn as Z,jn as _,Pt as $,Ft as aa,Jn as ba,Mt as ca,Qn as da,Dt as ea,Vt as fa,Se as ga,v as ha,Ut as ia,zt as ja,$t as ka,ye as la,be as ma,Bt as na,xe as oa,Yt as pa,eo as qa,to as ra,no as sa,oo as ta,T as ua,_e as va,ro as wa,ao as xa,$ as ya,D as za,V as Aa,Kt as Ba,Xt as Ca,B as Da,lo as Ea,io as Fa,so as Ga,se as Ha,Tn as Ia,wo as Ja,Ao as Ka,ln as La,Lo as Ma,we as Na,mn as Oa,Sn as Pa,zo as Qa,$o as Ra,Bo as Sa};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ta as u}from"./chunk-TUB4O4RZ.js";import{f as x}from"./chunk-FU5UZ4UY.js";var F="inline",O=[{label:"In this section",value:"inline"},{label:"In its own box",value:"own-box"}];var N={ProductGrid:{num:"num",title:"title",description:"description",headRows:["num","title","titleSize","description","linkText","linkHref"],renderer:"ProductGridSection",padKey:"padTop",linkProp:"link"},TyreSizes:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreSizes"},FitmentFinder:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentFinder"},TyreFitment:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicTyreFitment"},BundleOffer:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicBundleOffer"},CompatibleTyres:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},RelatedProducts:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"DynamicRelatedProducts"},SpecTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"SpecTable"},FAQ:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"FAQ"},GalleryB:{num:"num",title:"title",headRows:["num","title","linkText","linkHref"],renderer:"GalleryGrid"},FitmentTable:{num:"num",title:"title",description:"description",headRows:["num","title","description"],renderer:"FitmentTable"},Events:{num:"num",title:"title",linkProp:"link",headRows:["num","title","linkText","linkHref"],renderer:"Events"},ProcessSteps:{num:"num",title:"title",description:"description",headRows:["num","title","description"],headStyle:"editorial",renderer:"ProcessSteps",padKey:"padTop"},LongRead:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"LongRead"},Series:{num:"headNum",title:"headTitle",description:"headDesc",headRows:["headNum","headTitle","headDesc"],headStyle:"editorial",renderer:"Series"},TimelineTrack:{num:"eyebrow",title:"title",description:"intro",headRows:["eyebrow","title","intro"],headStyle:"editorial",renderer:"TimelineTrack",padKey:"padTop"},StatsParagraph:{num:"eyebrow",title:"title",description:"desc",headRows:["eyebrow","title","desc"],headStyle:"editorial",renderer:"StatsParagraph"},Footprint:{num:"sectionNumber",title:"heading",description:"tagline",headRows:["sectionNumber","heading","tagline"],headStyle:"editorial",renderer:"Footprint",padKey:"padTop"},Collections:{num:"eyebrow",title:"heading",headRows:["eyebrow","heading"],renderer:"Collections"},Cards:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Cards"},Testimonials:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Testimonials"},Reviews:{num:"eyebrow",title:"title",headRows:["eyebrow","eyebrowLook","title"],headStyle:"simple",renderer:"Reviews"},Prose:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"essay",renderer:"Prose"},ReviewForm:{num:"eyebrow",title:"title",headRows:["eyebrow","title"],headStyle:"simple",renderer:"ReviewForm"},DeliveryOptions:{num:"eyebrow",title:"title",description:"body",headRows:["eyebrow","title","body"],headStyle:"natural",headRowGap:"gap-3",headDescriptionSize:"text-[15px]",renderer:"DeliveryOptions"}},ye="SectionHeader";function ge(e){return e in N}function _(e){return u(O,F,e)}var B=new Set(["Flex"]);function G(e){return!!e?.type&&B.has(e.type)}function be(e,t,o){if(!G(t))return e;let n={};for(let[r,i]of Object.entries(e))o.includes(r)||(n[r]=i);return n}function we(e,t,o){if(_(t)!=="own-box")return e;let n={};for(let[r,i]of Object.entries(e))o.includes(r)||(n[r]=i);return n}import{createContext as I,useCallback as A,useContext as D,useState as m}from"react";import{jsx as H}from"react/jsx-runtime";var k=I({footerBlock:null,setFooterBlock:()=>{},headerGroup:null,setHeaderGroup:()=>{},refreshToken:0,refreshFooter:()=>{}});function ke({children:e,editFooter:t}){let[o,n]=m(null),[r,i]=m(null),[l,s]=m(0),a=A(()=>s(c=>c+1),[]);return H(k.Provider,{value:{footerBlock:o,setFooterBlock:n,headerGroup:r,setHeaderGroup:i,editFooter:t,refreshToken:l,refreshFooter:a},children:e})}var Se=()=>D(k);import{createContext as K,useContext as M,useMemo as U,useState as Y}from"react";import{jsx as W}from"react/jsx-runtime";var S=K(null);function Te({children:e}){let[t,o]=Y(null),n=U(()=>({surface:t,setSurface:o}),[t]);return W(S.Provider,{value:n,children:e})}function ve(){return M(S)??{surface:null,setSurface:()=>{}}}var{Provider:Oe,useSelection:Ne}=x("selectedLocationPartId");function _e(e,t,o){return`${e}::${t}::${o}`}function Be(e){if(!e)return null;let t=e.split("::");if(t.length<3)return null;let o=t[t.length-1];if(o!=="image"&&o!=="map")return null;let n=Number(t[t.length-2]);if(!Number.isInteger(n)||n<0)return null;let r=t.slice(0,-2).join("::");return r?{nodeId:r,index:n,part:o}:null}var $="plain",C=[{label:"Plain",value:"plain"},{label:"Filled",value:"filled"},{label:"Line",value:"line"}],z="line",Q={KeyFeatures:"filled"};function j(e){return Q[e]??$}function Ae(e,t){return u(C,j(t),e)}function De(e){return u(C,z,e)}import{createContext as q,useContext as V}from"react";var Z=q(!1),Me=()=>V(Z);import{useSyncExternalStore as J}from"react";var f=null,y=new Set;function We(e){if(f!==e){f=e;for(let t of y)t()}}function X(e){return y.add(e),()=>{y.delete(e)}}function $e(){return J(X,()=>f,()=>null)}function ze(e){if(!e)return null;let t=e.lastIndexOf(":");return t>0?e.slice(0,t):null}import{jsx as te,jsxs as ne}from"react/jsx-runtime";function ee({label:e,blocked:t,onAdd:o,small:n=!1}){return ne("button",{type:"button",className:"sf-add-card",disabled:t!==null,title:t??void 0,onClick:o,children:[te("span",{className:n?"sf-plus sf-plus--sm":"sf-plus",children:"+"}),e]})}import{useSyncExternalStore as oe}from"react";var re={level:"groups"},P=re,g=new Set;function Ze(e){P=e;for(let t of g)t()}function ie(e){return g.add(e),()=>{g.delete(e)}}var L=()=>P;function Je(){return oe(ie,L,L)}function T(e,t,o){let n=[];return e.forEach((r,i)=>{let l=t(r),s=n.find(a=>a.key===l);s||(s={key:l,name:o(r),items:[]},n.push(s)),s.items.push({item:r,index:i})}),n}function et(e){if(e<=1)return"grid-cols-1";if(e===2)return"grid-cols-2";if(e===3)return"grid-cols-3";if(e===4)return"grid-cols-4";let t=o=>e%o||o;return t(4)>=t(3)?"grid-cols-4":"grid-cols-3"}var w=e=>String(e?.group??""),b=new WeakMap,se=0;function le(e){let t=b.get(e);return t||(t=`loc${++se}`,b.set(e,t)),t}var ot=(e,t)=>t||e||"Ungrouped",v={photo:"",group:"",groupName:"",name:"City name",state:"State",country:"Country",timezone:"GMT \xB7 UTC +0",address:`Address line one
|
|
2
|
+
Address line two`,phone:"+00 000 0000",hours:"Mon\u2013Fri 9:00\u201318:00",lat:0,lng:0,mapsUrl:""};function d(e){return T(e,w,t=>String(t?.groupName??"")).map(t=>({key:t.key,name:t.name,cards:t.items.map(o=>o.item)}))}var h=e=>e.flatMap(t=>t.cards),R=(e,t,o)=>Math.min(Math.max(e,t),o);function ae(e,t,o){let n=0;for(let r=0;r<e.length;r++)if(w(e[r])===t){if(n===o)return r;n++}return-1}function rt(e,t,o){let n=d(e);if(t<0||t>=n.length)return e;let[r]=n.splice(t,1),i=R(t<o?o-1:o,0,n.length);return n.splice(i,0,r),h(n)}function it(e,t,o,n,r){let i=d(e),l=i.find(p=>p.key===t),s=i.find(p=>p.key===n);if(!l||!s||o<0||o>=l.cards.length)return e;let[a]=l.cards.splice(o,1),c=t===n?a:{...a,group:s.key,groupName:s.name};c!==a&&b.set(c,le(a));let E=R(l===s&&o<r?r-1:r,0,s.cards.length);return s.cards.splice(E,0,c),h(i)}function st(e,t){let o=d(e),n=o.find(i=>i.key===t),r={...v,group:t,groupName:n?.name??""};return n?(n.cards.push(r),h(o)):[...e,r]}function lt(e){let t=new Set(d(e).map(r=>r.key)),o=t.size+1,n=`Group ${o}`;for(;t.has(n);)n=`Group ${++o}`;return{cards:[...e,{...v,group:n,groupName:""}],key:n}}function at(e,t){return e.filter(o=>w(o)!==t)}function ct(e,t,o){let n=ae(e,t,o);return n<0?e:e.filter((r,i)=>i!==n)}var ce="Main Pages",ue="Dynamic Pages",de="dynamic",pe="dynamic";function me(e){return e.kind===pe}function dt(e){let t=[],o=[];for(let n of e){if(me(n)){o.push(n);continue}let r=n.groupKey??(n.group?`folder:${n.group}`:"top"),i=t[t.length-1];i&&i.key===r?i.rows.push(n):t.push({key:r,label:n.group??ce,rows:[n]})}if(o.length){let n=t.findIndex(r=>r.key.startsWith("system:"));t.splice(n===-1?t.length:n,0,{key:de,label:ue,rows:o})}return t}export{N as a,ye as b,ge as c,_ as d,G as e,be as f,we as g,ke as h,Se as i,Te as j,ve as k,Oe as l,Ne as m,_e as n,Be as o,$ as p,C as q,z as r,j as s,Ae as t,De as u,Z as v,Me as w,me as x,dt as y,We as z,$e as A,ze as B,ee as C,Ze as D,Je as E,T as F,et as G,w as H,le as I,ot as J,v as K,d as L,ae as M,rt as N,it as O,st as P,lt as Q,at as R,ct as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{xg as l,zg as p}from"./chunk-TUB4O4RZ.js";import{Fragment as r,useState as d}from"react";import{Fragment as b,jsx as s,jsxs as o}from"react/jsx-runtime";function g({choices:m,onPick:c,open:i,onToggle:u}){let[f,a]=d(!1),n=i??f;return o(b,{children:[o("button",{type:"button",className:"sf-add-card","aria-expanded":n,onClick:u??(()=>a(e=>!e)),children:[s("span",{className:"sf-plus sf-plus--sm",children:"+"}),"Add block"]}),n&&s("div",{className:"sf-blockmenu",role:"menu",children:p(m).map(e=>o(r,{children:[e.group&&o("div",{className:"sf-menugroup-head",role:"presentation",children:[s("span",{className:"sf-menugroup-title",children:e.group}),s("span",{className:"sf-menugroup-count",children:e.items.length})]}),e.items.map(t=>o("button",{type:"button",className:"sf-blockmenu-item",role:"menuitem",onClick:()=>{a(!1),c(t.type)},children:[s("span",{className:"sf-chip",children:s(l,{type:t.type,size:13})}),s("span",{className:"sf-row-name",children:t.label})]},t.type))]},e.group??"all"))})]})}export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ac as l}from"./chunk-TUB4O4RZ.js";import{d as s}from"./chunk-6CP4D6VJ.js";var n=()=>Promise.reject(new l("unavailable","This editor's backend keeps no section templates.")),a={list:()=>Promise.resolve([]),get:()=>Promise.resolve(null),ensure:n,save:n,update:n,rename:n,remove:n},o=()=>s().sectionTemplates??a,p={list:()=>o().list(),get:t=>o().get(t),ensure:(t,e,r)=>o().ensure(t,e,r),save:(t,e)=>o().save(t,e),update:(t,e)=>o().update(t,e),rename:(t,e)=>o().rename(t,e),remove:t=>o().remove(t)};var i=new Map;async function c(t,e){try{return(await s().site.get({siteId:e})).slug?.trim()||null}catch(r){return console.warn("[editor-site-slug] could not resolve the site slug",r),null}}function f(t,e){let r=i.get(e);return r||(r=c(t,e),i.set(e,r),r.catch(()=>{i.get(e)===r&&i.delete(e)})),r}export{p as a,f as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={siteSlug:null,shopOrigin:""},i=t;function e(n){i={siteSlug:n.siteSlug?.trim()||null,shopOrigin:(n.shopOrigin??"").trim().replace(/\/+$/,"")}}function u(){return i.siteSlug}function r(){return i.shopOrigin}export{e as a,u as b,r as c};
|