efficient-storefront-blocks 0.125.23 → 0.126.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 +4 -0
- package/dist/chunks/{CustomHtmlCodeWindow-LITJEQFG.js → CustomHtmlCodeWindow-LBWGRQID.js} +1 -1
- package/dist/chunks/{EditorPreviewCheckout-LRPANZRI.js → EditorPreviewCheckout-PWVUKVPS.js} +1 -1
- package/dist/chunks/SiteEditorProvider-73GAIF7L.js +1 -0
- package/dist/chunks/{chunk-PVRWP47B.js → chunk-3ZZ3Z6U5.js} +1 -1
- package/dist/chunks/{chunk-YOF4KT5H.js → chunk-ADYUBBPE.js} +1 -1
- package/dist/chunks/{chunk-ZHEHF42C.js → chunk-BLDYFJQ6.js} +1 -1
- package/dist/chunks/{chunk-TT3AZYTK.js → chunk-CKAOUQ5E.js} +1 -1
- package/dist/chunks/chunk-JYZ42RYY.js +337 -0
- package/dist/chunks/{chunk-ESKHLPB5.js → chunk-SI2DLHOL.js} +1 -1
- package/dist/chunks/{chunk-TMSNT2CP.js → chunk-VUFE7ACW.js} +1 -1
- package/dist/chunks/{chunk-DQ2TQC5H.js → chunk-WR3AVDA5.js} +1 -1
- package/dist/chunks/{fitment-data-FJ3MIJXK.js → fitment-data-VOATE5L5.js} +1 -1
- package/dist/chunks/{section-css-style-JQZMV74P.js → section-css-style-42PP2TPA.js} +1 -1
- package/dist/index.js +25 -25
- package/dist/render/built-with.json +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +3 -0
- package/dist/words.js +2 -2
- package/package.json +2 -2
- package/dist/chunks/SiteEditorProvider-FT3P5QZM.js +0 -1
- package/dist/chunks/chunk-EEHSAQWF.js +0 -337
- /package/dist/chunks/{chunk-TT3AZYTK.js.LEGAL.txt → chunk-CKAOUQ5E.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-LY7GZJ6M.js → chunk-D5HXXBSX.js} +0 -0
- /package/dist/chunks/{chunk-EEHSAQWF.js.LEGAL.txt → chunk-JYZ42RYY.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-G5LEO2F2.js → chunk-OHEU7JQW.js} +0 -0
- /package/dist/chunks/{chunk-DFYWYSOT.js → chunk-ZV2GXEDX.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-OHEU7JQW.js";var x="data-sf-section-css",g="customCss";function m(t,e=g){let n=t?.[e];return typeof n=="string"&&n.trim()!==""?n:""}function u(t){switch(t.id){case"heading-1":return"font-display";case"heading-2":return"font-heading2";case"heading-3":return"font-heading3";case"body-1":return"font-body";case"body-5":return"font-mono";default:return`font-${t.id}`}}var o="var(--sf-heading-weight, 500)",p={"heading-1":{step:"headingLarge",fallbackPx:76,weight:o},"heading-2":{step:"headingMedium",fallbackPx:44,weight:`var(--sf-heading-2-weight, ${o})`},"heading-3":{step:"headingSmall",fallbackPx:30,weight:`var(--sf-heading-3-weight, ${o})`},"body-1":{step:"body",fallbackPx:16},"body-5":{step:"label",fallbackPx:12}};function C(t,e){let n=new Set;for(let a of e.matchAll(/\bclass="([^"]*)"/g))for(let s of a[1].split(/\s+/))s&&n.add(s);let i=[];for(let[a,{step:s,fallbackPx:d,weight:r}]of Object.entries(p)){let c=u({id:a});if(!n.has(c))continue;let f=`var(--size-${s}, ${d}px)`,h=r?[`font-size: min(${f}, var(--sf-heading-max, 9999px))`,`font-weight: ${r}`]:[`font-size: ${f}`];i.push(`:where(${t} .${c}) { ${h.join("; ")} }`)}return i.join(`
|
|
2
2
|
`)}function $(t){return t.replace(/<(?=\/)/g,"\\3c ")}var b={"\\":"\\\\",'"':'\\"',"\n":"\\a ","\r":"\\d ","\f":"\\c "};function E(t){return t.replace(/[\\"\n\r\f]/g,e=>l(b,e)??e)}function P(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}export{x as a,g as b,m as c,u as d,p as e,C as f,$ as g,E as h,P as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as oe,c as D,h as ae,j as L}from"./chunk-DFYWYSOT.js";import{b as W,c as se}from"./chunk-LY7GZJ6M.js";var q="".replace(/\/+$/,"");var K="x-forwarded-for";function le(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var mt="x-forwarded-host";function ce(e,t,n){let r={};return e&&(r[mt]=e),t&&n==="uncached"&&(r[K]=t),r}function ue(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 de="x-storefront-site",pe="x-storefront-host",me="x-storefront-preview";function h(e){return Array.isArray(e)?e:e?.results??[]}import{parseOption as Wt}from"efficient-shell/format";var gt="shop_access_token",ge="shop_refresh_token",J=null;function Y(){L.removeItem(gt),L.removeItem(ge)}var R={getAccess(){return J},takeLegacyRefresh(){let e=L.getItem(ge);return Y(),e},setTokens(e){J=e,Y()},clear(){J=null,Y()}};import{efficientClientOpen as qt}from"efficient-easel/screen/lib/session";function yt(e){return!!e.src}function C(e){let t=e.finishes.filter(yt);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function ht(e){return e.listable!==!1}function x(e){return e.map(C).filter(ht)}var Se=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],Pe=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),I={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]},be=12,we=/\burl\(/i,Re=new RegExp(`(?<![-\\w])(${Se.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),Ae=new RegExp(`((?:^|[;{\\s"'])(?:${Se.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),ft=/<svg\b([^>]*)>/i,St=/\bfill\s*[=:]/i;function Pt(e){let t=e.replace(Re,(n,r,o,l,p)=>{let i=ye(p);return i===null?n:`${r}${o}${l}${i}${l}`}).replace(Ae,(n,r,o)=>{let l=ye(o);return l===null?n:`${r}${l}`});return t=t.replace(ft,(n,r)=>St.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function ye(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||we.test(n)||Pe.has(n))return null;let r=n in I?[...I[n],1]:ke(n);if(!r)return null;let[o,l,p,i]=r;if(Math.max(o,l,p)-Math.min(o,l,p)>be)return null;let s=bt(255-o,255-l,255-p,i);return t?`${s} !important`:s}function bt(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let o=l=>l.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function ke(e){return e.startsWith("#")?wt(e):e.startsWith("rgb")?Rt(e):e.startsWith("hsl")?kt(e):null}function wt(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function Rt(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),o=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(o.length<3)return null;let l=o.map(i=>i.endsWith("%")?Math.round(parseFloat(i)/100*255):Math.round(parseFloat(i)));if(l.some(i=>Number.isNaN(i)))return null;let p=r?F(r):At(n);return[l[0],l[1],l[2],p]}function At(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?F(t[3]):1}function F(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function kt(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),o=n.split(/[\s,]+/).filter(Boolean);if(o.length<3)return null;let l=parseFloat(o[0]),p=parseFloat(o[1])/100,i=parseFloat(o[2])/100;if([l,p,i].some(w=>Number.isNaN(w)))return null;let s=r?F(r):o.length>=4?F(o[3]):1,[a,m,g]=Tt(l,p,i);return[a,m,g,s]}function Tt(e,t,n){let r=(1-Math.abs(2*n-1))*t,o=(e%360+360)%360/60,l=r*(1-Math.abs(o%2-1)),p=0,i=0,s=0;o<1?[p,i,s]=[r,l,0]:o<2?[p,i,s]=[l,r,0]:o<3?[p,i,s]=[0,r,l]:o<4?[p,i,s]=[0,l,r]:o<5?[p,i,s]=[l,0,r]:[p,i,s]=[r,0,l];let a=n-r/2;return[Math.round((p+a)*255),Math.round((i+a)*255),Math.round((s+a)*255)]}var he=512*1024;function Z(e){return/\.svg(\?|$)/i.test(e)}function _t(e){return`data:image/svg+xml,${encodeURIComponent(Pt(e))}`}function Ct(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||we.test(t)||Pe.has(t))return null;let n=t in I?[...I[t],1]:ke(t);if(!n)return null;let[r,o,l]=n;return Math.max(r,o,l)-Math.min(r,o,l)>be?null:(.2126*r+.7152*o+.0722*l)/255}function xt(e){let t=[],n=r=>{let o=Ct(r);o!==null&&t.push(o)};for(let r of e.matchAll(Re))n(r[4]);for(let r of e.matchAll(Ae))n(r[2]);return t.length?t.reduce((r,o)=>r+o,0)/t.length<.5:null}var fe=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Ot(e){let t=e;for(let n=fe.exec(t);n&&n[0].length>0;n=fe.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function Et(e,t){if(!Z(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>he)return null;let o=await n.text();return o.length>he?null:Ot(o)?o:null}catch{return null}}async function Te(e,t){let n=await Et(e,t);return n===null?null:{reversed:_t(n),inkIsDark:xt(n)}}import{currentEaselSession as Nt,setSessionBridgedSite as Bn,setSessionDocumentSite as Gn}from"efficient-easel/screen/lib/session";function _e(){return Nt().siteId()}var Ce={title:"Find a dealer",placeholder:"Postcode or suburb",search:"Search",searching:"Searching\u2026",none:"No dealers to show yet.",notFound:"We couldn't find that place. Check the postcode or suburb and search again.",tryAgain:"We couldn't look up that place just now. Please try again.",website:"Website",map:"Dealers on the map"},k=e=>typeof e=="string"?e:"",V=e=>typeof e=="number"&&Number.isFinite(e)?e:null,Ut=["found","not_found","try_again"];function Dt(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.name!="string"||!t.name?null:{id:k(t.id)||t.name,name:t.name,address:k(t.address),city:k(t.city),state:k(t.state),postcode:k(t.postcode),country:k(t.country),phone:k(t.phone),website:k(t.website),lat:V(t.lat),lng:V(t.lng),distanceKm:V(t.distanceKm)}}function xe(e){if(!e||typeof e!="object")return{near:null,dealers:[]};let t=e,n=typeof t.near=="string"&&Ut.includes(t.near)?t.near:null,r=Array.isArray(t.dealers)?t.dealers:[];return{near:n,dealers:r.map(Dt).filter(o=>o!==null)}}function $n(e){return e==="not_found"?Ce.notFound:e==="try_again"?Ce.tryAgain:null}function Wn(e){return e===null?null:e<10?`${e.toFixed(1)} km`:`${Math.round(e)} km`}function qn(e){return[e.city,e.state,e.postcode].filter(Boolean).join(" ")}function Kn(e){let t=e.map((a,m)=>({dealer:a,index:m})).filter(({dealer:a})=>a.lat!==null&&a.lng!==null);if(!t.length)return[];let n=t.map(({dealer:a})=>a.lat),r=t.map(({dealer:a})=>a.lng),[o,l]=[Math.min(...n),Math.max(...n)],[p,i]=[Math.min(...r),Math.max(...r)],s=(a,m,g)=>g===m?50:8+(a-m)/(g-m)*84;return t.map(({dealer:a,index:m})=>({id:a.id,index:m,left:s(a.lng,p,i),top:100-s(a.lat,o,l)}))}var Oe=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],Ee=["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLE","SOS","SRD","SSP","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VES","VND","VUV","WST","XAF","XCD","XCG","XOF","XPF","YER","ZAR","ZMW","ZWG"],Yn={AD:"EUR",AE:"AED",AF:"AFN",AL:"ALL",AM:"AMD",AO:"AOA",AR:"ARS",AT:"EUR",AU:"AUD",AW:"AWG",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BH:"BHD",BI:"BIF",BM:"BMD",BN:"BND",BO:"BOB",BR:"BRL",BS:"BSD",BT:"BTN",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CD:"CDF",CH:"CHE",CL:"CLF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DO:"DOP",DZ:"DZD",EE:"EUR",EG:"EGP",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FR:"EUR",GB:"GBP",GE:"GEL",GH:"GHS",GI:"GIP",GM:"GMD",GN:"GNF",GR:"EUR",GT:"GTQ",GY:"GYD",HK:"HKD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IN:"INR",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KM:"KMF",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MG:"MGA",MK:"MKD",MM:"MMK",MN:"MNT",MO:"MOP",MR:"MRU",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PT:"EUR",PY:"PYG",QA:"QAR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SK:"EUR",SL:"SLE",SM:"EUR",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"SVC",SY:"SYP",SZ:"SZL",TH:"THB",TJ:"TJS",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",US:"USD",UY:"UYI",UZ:"UZS",VA:"EUR",VE:"VED",VN:"VND",VU:"VUV",WS:"WST",YE:"YER",ZA:"ZAR",ZM:"ZMW",ZW:"ZWG"};import{formatDateTime as It}from"efficient-shell/format";import{knownZone as Lt}from"efficient-shell/format";var Ne=()=>new Intl.DateTimeFormat().resolvedOptions().locale;function Ue(...e){return e.find(Lt)??""}var er={firstName:"",lastName:"",email:"",company:"",slug:"",country:"",currency:""},Ft=["slug_malformed","slug_reserved","slug_taken"],j=e=>typeof e=="string"&&Ft.includes(e),tr=400,P={title:"Create your {name} workspace",freeLine:"Free to start. No card needed.",firstName:"First name",lastName:"Last name",email:"Work email",company:"Company name",address:"Workspace address",country:"Country",currency:"Currency",countryHint:"Your shop sells in this currency. The country sets its tax and shipping defaults. Both can be changed later.",checking:"Checking",available:"Available",submit:"Create workspace",sending:"Sending\u2026",agree:"By creating a workspace you agree to the {terms} and {privacy}.",terms:"Terms",privacy:"Privacy Policy",haveOne:"Already have a workspace?",find:"Find my workspace",required:"Fill this in.",companyShort:"Use at least 2 characters.",emailWrong:"Enter an email address, like name@company.com.",notOffered:"That choice is not offered. Pick another.",wrong:"Check this and try again.",slugProblem:{slug_malformed:"Use 3 to 30 lower-case letters, digits or single hyphens, starting with a letter.",slug_reserved:"That address is kept for the platform. Choose another.",slug_taken:"That address is taken. Choose another."},trouble:{closed:"Signing up is closed just now.",dailyLimit:"Too many workspaces signed up today. Try again tomorrow.",unavailable:"Signing up is not available just now. Try again later.",tooMany:"You have asked a few times in a row. Wait a minute, then try again.",unreachable:"We couldn't reach the server. Check your connection and try again.",failed:"Something went wrong and nothing was sent. Try again."},closedTitle:"Signing up is closed just now",closedBody:"New {name} workspaces cannot be made just now.",closedLeave:"Leave your email and we'll tell you when it opens.",tellMe:"Tell me when it opens",waitingDone:"Thanks. We'll email {email} when sign-up opens.",sentTitle:"Check your email",sentBody:"We sent a link to {email}. Open it to set up {company}.",sentUntil:"The link works once, until {when}. Asking again sends a new link, and the old one stops working.",sendAgain:"Send it again",sendingAgain:"Sending\u2026",sentAgain:"A new link is on its way. The old one no longer works.",change:"Change the details"};function De(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function Le(e){return e.trim().toLowerCase().replace(/_/g,"-")}function nr(e){return e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")}function rr(e,t){let n=(e??"").trim().toLowerCase().replace(/^\.+/,"").replace(/\.+$/,"");if(n)return`.${n}`;let r=t.toLowerCase().replace(/\.$/,"").replace(/^www\./,"");return r?`.${r}`:""}var A=e=>typeof e=="string"?e:"";function Ie(e,t){let n=new URLSearchParams;t&&n.set("slug",t),e&&n.set("product",e);let r=n.toString();return`/api/business-sign-ups/availability/${r?`?${r}`:""}`}var Fe="/api/business-sign-ups/",Me="/api/business-sign-ups/waiting-list/";function ir(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return n.code==="sign_up_open"?{open:!0,email:null,trouble:null}:n.code==="sign_up_waiting_list_unavailable"?{open:!1,email:null,trouble:"unavailable"}:e===400&&"email"in n?{open:!1,email:P.emailWrong,trouble:null}:e===0?{open:!1,email:null,trouble:"unreachable"}:e===429?{open:!1,email:null,trouble:"tooMany"}:{open:!1,email:null,trouble:"failed"}}function sr(e){let t=e.trim();return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?null:P.emailWrong:P.required}function ve(e){let t=e&&typeof e=="object"?e:{};return{open:t.open===!0,country:A(t.country),currency:A(t.currency),slugAvailable:typeof t.slug_available=="boolean"?t.slug_available:null,slugProblem:j(t.slug_problem)?t.slug_problem:null}}function or(e){return e.slugAvailable?{state:"available"}:e.slugProblem?{state:"problem",problem:e.slugProblem}:{state:"unknown"}}function Be(e){let t=e&&typeof e=="object"?e:{};return{slug:A(t.slug),expiresAt:A(t.expires_at)}}function ar(e,t,n){return{business_name:e.company.trim(),slug:Le(e.slug),first_name:e.firstName.trim(),last_name:e.lastName.trim(),email:e.email.trim(),...t?{product:t}:{},...n&&e.country?{country:e.country}:{},...n&&e.currency?{currency:e.currency}:{}}}function lr(e,t){let n={};e.firstName.trim()||(n.firstName=P.required);let r=e.email.trim();r?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)||(n.email=P.emailWrong):n.email=P.required;let o=e.company.trim();return o?o.length<2&&(n.company=P.companyShort):n.company=P.required,Le(e.slug)?t.state==="problem"&&(n.slug=P.slugProblem[t.problem]):n.slug=P.required,n}var Mt={business_name:"company",slug:"slug",first_name:"firstName",last_name:"lastName",email:"email",country:"country",currency:"currency"},v={self_sign_up_off:"closed",sign_up_daily_limit:"dailyLimit",sign_up_unavailable:"unavailable",sign_up_plan_missing:"unavailable"};function cr(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.code;if(j(r))return{fields:{slug:P.slugProblem[r]},trouble:null};if(typeof r=="string"&&v[r])return{fields:{},trouble:v[r]};if(e===0)return{fields:{},trouble:"unreachable"};if(e===429)return{fields:{},trouble:"tooMany"};if(e===400){let o={};for(let l of Object.keys(n)){let p=Mt[l];p&&(o[p]=p==="slug"?P.slugProblem.slug_malformed:p==="email"?P.emailWrong:p==="country"||p==="currency"?P.notOffered:P.wrong)}if(Object.keys(o).length)return{fields:o,trouble:null}}return{fields:{},trouble:"failed"}}function Ge(e,t){try{let n=new Intl.DisplayNames(t?[t]:void 0,{type:e,fallback:"code"});return r=>n.of(r)??r}catch{return n=>n}}var He=(e,t)=>t&&!e.includes(t)?[...e,t]:[...e],vt=(e,t)=>{let n=new Intl.Collator(t);return e.sort((r,o)=>n.compare(r.label,o.label))};function ur(e,t){let n=Ge("region",t);return vt(He(Oe,e).map(r=>({value:r,label:n(r)})),t)}function dr(e,t){let n=Ge("currency",t);return He(Ee,e).sort().map(r=>{let o=n(r);return{value:r,label:o===r?r:`${r} \xB7 ${o}`}})}function pr(e,t,n){let r=Ue(n??"");return!e||Number.isNaN(new Date(e).getTime())||!r?"":It(e,{locale:t||Ne(),timeZone:r,style:Bt})}var Bt={weekday:"long",day:"numeric",month:"long"},Gt=/^\/sign-up\/verify\/([^/?#]+)\/?$/;function mr(e){let t=Gt.exec(e??"");if(!t)return"";try{return decodeURIComponent(t[1])}catch{return t[1]}}var $e="/api/business-sign-ups/verifications/",Ht=["pending","provisioning","ready","failed"];function Q(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=A(n.code),o=A(n.slug);if(e===202||r==="sign_up_already_verified"){let l=A(n.provisioning_status),p=A(n.business_name);return Ht.includes(l)?l==="ready"?{kind:"ready",company:p,slug:o}:l==="failed"?{kind:"failed",company:p,slug:o}:{kind:"building",company:p,slug:o,status:l}:{kind:"gone"}}return j(r)?{kind:"taken",slug:o}:r==="sign_up_daily_limit"?{kind:"dailyLimit"}:r==="self_sign_up_off"?{kind:"closed"}:r&&v[r]?{kind:"trouble",trouble:v[r]}:e===400&&"token"in n?{kind:"gone"}:e===0?{kind:"trouble",trouble:"unreachable"}:e===429?{kind:"trouble",trouble:"tooMany"}:{kind:"trouble",trouble:"failed"}}function gr(e){return e.kind==="building"||e.kind==="trouble"&&e.trouble!=="failed"}function yr(e){return e<5?2e3:e<20?5e3:15e3}var hr=40;function fr(e,t,n){let r=e.kind==="failed"?"stopped":"running";return[{words:M.confirmed,at:"done"},{words:De(M.reserved,{address:`${e.slug}${n}`}),at:"done"},{words:M.building,at:r},...e.kind==="failed"?[]:[{words:De(M.adding,{name:t}),at:"waiting"}]]}var Sr=e=>e==="pending"?50:75,M={settingUp:"Setting up {company}",confirmed:"Email confirmed",reserved:"Address reserved: {address}",building:"Building your workspace",adding:"Adding {name}",aboutTen:"This takes about 10 seconds. You can close this page: we'll email you when it's ready.",readyTitle:"Your workspace is ready",workspace:"Workspace",address:"Address",plan:"Plan",planName:"{name} Free",readyNext:"We've emailed you a link to set your password. It's the next step.",failedBody:"We couldn't finish building your workspace. We've been told, and we'll email you when it's ready. You don't need to sign up again.",goneTitle:"This link has run out",goneBody:"This link is not right, or it has run out. Sign up again and we'll send a new one.",again:"Sign up again",takenTitle:"That address has gone",takenBody:"{address} was taken before you opened your link. Choose another address and we'll send a new link.",takenBodyBare:"That address was taken before you opened your link. Choose another address and we'll send a new link.",chooseAnother:"Choose another address",limitTitle:"Not today",limitNext:"Your link still works until it runs out. Open it again tomorrow.",checking:"Checking your link",troubleTitle:"We couldn't check your link",troubleFailed:"Something went wrong on our side. Your link still works, so nothing is lost.",tryAgain:"Try again"},We="/api/business-sign-ups/workspace-finds/",qe="/api/business-sign-ups/workspace-finds/openings/",$t=/^\/find\/([^/?#]+)\/?$/;function Pr(e){let t=$t.exec(e??"");if(!t)return"";try{return decodeURIComponent(t[1])}catch{return t[1]}}var br={title:"Find your workspace",intro:"Enter your work email. We'll send you the address of every workspace you belong to.",submit:"Email me my workspaces",newHere:"New to {name}?",create:"Create a workspace",sentTitle:"Check your email",sentBody:"If {email} belongs to a workspace, the links are on their way.",sentNote:"They work for 30 minutes. Nothing arrives if the address isn't in any workspace.",another:"Use another email",linkGone:"This link is not right, or it has run out. Ask for your workspaces again.",opening:"Opening your workspace",openFailed:"We couldn't open your workspace just now. Your link still works \u2014 try again.",retry:"Try again"};function wr(e){return e===0?"unreachable":e===429?"tooMany":"failed"}function Rr(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return n.code==="workspace_find_unavailable"?{email:null,trouble:"unavailable"}:e===400&&"email"in n?{email:P.emailWrong,trouble:null}:e===0?{email:null,trouble:"unreachable"}:e===429?{email:null,trouble:"tooMany"}:{email:null,trouble:"failed"}}function Ke(e){let t=e&&typeof e=="object"?A(e.sign_in_url):"";return/^https?:\/\/[^\s]+$/i.test(t)?t:""}var Kt="",S=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},te="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.",Jt=new Set([502,503,504]),X=0,Yt="This editor runs on its host's own backend, which does not serve this request.",Zt=5e3,Vt=15e3,jt=()=>typeof window>"u"?Zt:Vt;function it(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(jt())}var Je=e=>e instanceof Error&&e.name==="TimeoutError",Ye=(e,t)=>Jt.has(e)?te:t,Qt=["admin","venue"],st="admin";function Lr(e){st=Wt(Qt,"admin",e)}function Xt(){return st}var zt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,ot=null;function Ir(e){ot=e&&zt.test(e)?e:null}function en(){return ot}function tn(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=W();return!t||/[?&]site=/.test(e)?e:$(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:r,headers:o,audience:l,...p}=t;if(typeof window<"u"&&!qt())throw new S(X,Yt,null);if(typeof window>"u"&&r===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let i=typeof FormData<"u"&&p.body instanceof FormData,s;try{s=await fetch(`${r??Kt}${tn(e)}`,{...p,headers:{...i?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...o},signal:p.signal??it({...p,audience:l})})}catch(g){throw g instanceof TypeError||Je(g)?new S(X,te,null):g}let a;try{a=await s.text()}catch(g){throw Je(g)?new S(X,te,null):g}let m=null;if(a)try{m=JSON.parse(a)}catch{throw new S(s.status,s.ok?"Expected JSON but received a non-JSON response":Ye(s.status,s.statusText),a)}if(!s.ok){let g=(m&&typeof m=="object"&&"detail"in m&&typeof m.detail=="string"?m.detail:null)??Ye(s.status,s.statusText);throw new S(s.status,g,m)}return m}var O=null;async function at(){return O||(O=nn().finally(()=>{O=null}),O)}async function nn(){let e=R.takeLegacyRefresh(),t=await on.refresh(e??void 0);return R.setTokens(t.access),t.access}async function lt(){return R.getAccess()??at()}async function f(e,t={}){let n;try{n=await lt()}catch{throw R.clear(),new S(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(r){if(!(r instanceof S)||r.status!==401)throw r;try{let o=await at();return await c(e,{...t,token:o})}catch{throw R.clear(),r}}}var rn=100,Ze=20;function sn(e){if(!e)return null;try{return new URL(e,"http://page.invalid").searchParams.get("page")}catch{return null}}async function Ve(e,t){let[n,r=""]=e.split("?"),o=[],l="1";for(let p=0;p<Ze&&l;p++){let i=new URLSearchParams(r);i.set("page_size",String(rn)),l!=="1"&&i.set("page",l);let s=await f(`${n}?${i.toString()}`);o.push(...h(s)),l=sn(s.next)}return l&&console.warn(`[${t}] stopped at ${Ze} pages (${o.length} rows); list may be truncated`),o}async function je(e,t={}){if(R.getAccess())try{return{data:await f(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function Qe(){let e=await f("/api/auth/me/");if(e.portal!=="shop")throw R.clear(),new S(403,"This session is not valid for this shop.",null);return e}var on={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{R.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await lt();return await Qe(),e},me:Qe,updateMe:e=>f("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>f("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>f("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>f("/api/shop-portal/profile/"),updateMyProfile:e=>f("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>f("/api/shop-portal/delivery-locations/"),createAddress:e=>f("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>f(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>f(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>f("/api/products/brands/"),myOrders:()=>Ve("/api/shop-portal/orders/","api.myOrders"),myOrder:e=>f(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>f(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>Ve(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`,"api.myReturns"),createReturn:e=>f("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>f(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),f("/api/shop-portal/return-media/",{method:"POST",body:n})}};function b(e){if(typeof e=="string")return e.startsWith("/media/")?oe(e):e;if(Array.isArray(e))return e.map(b);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([o,l])=>[b(o),l])):b(r);return t}return e}var ct=typeof window>"u"&&q!=="",an=ct?q:"",ln=se,T=()=>({baseUrl:ln(),audience:null});function u(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var ut=100,Xe=50;function ie(e,t,n){let r=new URLSearchParams;for(let[o,l]of Object.entries(t))l!=null&&l!==""&&r.set(o,String(l));return r.set("pageSize",String(ut)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function cn(e,t){return ie("/wheels",{process:e},t)}var ze=ut;function un(e,t){return ie("/wheels",{slug:e.join(",")},t)}function dn(e,t,n){return ie("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function pn(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function z(e,t,n=()=>!1,r=()=>!1){let o=[],l=null;try{for(let p=0;p<Xe;p++){let i=await c(await t(l),await d());if(o.push(...h(i)),l=pn(i.next),!l)break;if(r(o))return o}l&&console.warn(`[${e}] stopped at ${Xe} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(n(p))throw p;console.warn(`[${e}] product API unavailable, returning []`,p)}return o}var et=e=>e instanceof S&&e.status===400;function tt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?x([t]):[t])}async function dt(){return(await mn()).host}async function mn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(pe)??t.get("x-forwarded-host")??t.get("host")),o=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===o}}catch{return{host:null,matchesRequestHost:!1}}}async function gn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return le((await e()).get(K))}catch{return null}}async function yn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(de)||null}catch{return null}}async function hn(){let e=await yn();if(e)return`site=${encodeURIComponent(e)}`;let t=await dt();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=W();return t?$(e,`site=${encodeURIComponent(t)}`):e}return $(e,await hn())}function $(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var fn="preview";async function Sn(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(me)}catch{return null}}async function Pn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function ee(e,t){let n=await Sn();if(n===null)return[await y(e),await d(t)];let r=$(await y(e),`${fn}=${encodeURIComponent(n)}`),{next:o,cache:l,...p}=t??{},i=await d({...p,cache:"no-store"}),s=await Pn();return s&&(i.headers={...i.headers,"user-agent":s}),[r,i]}async function bn(e){if(!ct)return;let[t,n]=await Promise.all([dt(),gn()]),r=ce(t,n,e);return Object.keys(r).length>0?r:void 0}async function d(e){let t=await bn(ue(e)),n={baseUrl:an,...e};return t&&(n.headers={...t,...e?.headers}),n}var E=typeof window>"u";function N(e,t){let n=new URLSearchParams;for(let[o,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(o,String(l));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var $r={listMakes:async e=>{if(E){let{fitmentData:n}=await import("./fitment-data-FJ3MIJXK.js");return n.makes(e)}let t=await c(N("/makes",{region:e}),T());return h(t)},listModels:async(e,t)=>{if(E){let{fitmentData:r}=await import("./fitment-data-FJ3MIJXK.js");return r.models(e,t)}let n=await c(N("/models",{make:e,region:t}),T());return h(n)},listYears:async(e,t,n)=>{if(E){let{fitmentData:o}=await import("./fitment-data-FJ3MIJXK.js");return o.years(e,t,n)}let r=await c(N("/years",{make:e,model:t,region:n}),T());return h(r)},listModifications:async(e,t,n,r)=>{if(E){let{fitmentData:l}=await import("./fitment-data-FJ3MIJXK.js");return l.modifications(e,t,n,r)}let o=await c(N("/modifications",{make:e,model:t,year:n,region:r}),T());return h(o)},getStockFitment:async(e,t,n,r,o)=>{if(E){let{fitmentData:l}=await import("./fitment-data-FJ3MIJXK.js");return l.stockFitment(e,t,n,r,o)}return c(N("/stock-fitment",{make:e,model:t,year:n,modification:r,region:o}),T())}},Wr={listWheels:async(e,t={})=>{let n=await z("products.listWheels",async r=>await y(cn(e,r)),t.throwOnFailure?()=>!0:void 0,t.maxRows===void 0?void 0:r=>x([...r]).length>=t.maxRows);return x(b(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(i=>i.trim()).filter(Boolean))];if(n.length===0)return[];let r=[];for(let i=0;i<n.length;i+=ze)r.push(n.slice(i,i+ze));let o=await Promise.all(r.map(i=>z("products.listWheelsBySlug",async s=>await y(un(i,s)),t.throwOnFailure?()=>!0:et))),l=new Set(n),p=o.flat().filter(i=>l.has(i.slug));return x(b(p))},listCatalog:async(e,t,n={})=>{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 z("products.listCatalog",async o=>await y(dn(e,t,o)),n.throwOnFailure?()=>!0:et,n.maxRows===void 0?void 0:o=>tt([...o]).length>=n.maxRows);return tt(b(r))},getWheel:async e=>C(b(await c(await y(u(`/wheels/${e}`)),await d()))),getTyre:async e=>b(await c(await y(u(`/tyres/${e}`)),await d())),listBundles:async(e={})=>{try{return await c(await y(u("/bundles")),await d())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>c(await y(u(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-TD3QJK7L.js");return b(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let o=r.toString(),l=await c(`/api/v1/gallery-builds${o?`?${o}`:""}`,T());return b(h(l))}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>c(await y(u("/site")),await d()),getSiteBySlug:async e=>c(`${u("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listPages:async()=>b(await c(await y(u("/pages")),await d())),listPopups:async()=>c(await y(u("/popups")),await d()),listProductTemplates:async()=>{try{return await c(await y(u("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${u("/dynamic-pages")}${t}`),await d())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await y(u(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await y(u(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(u("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(u("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[r,o]=await ee(u(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return b(await c(r,o))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(u("/blog-posts")+n,await d())).map(o=>({...o,coverImage:D(o.coverImage)??""}))}catch(r){if(t)throw r;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",r),[]}},getBlogPost:async e=>{let t=await c(u(`/blog-posts/${e}`),await d());return{...t,coverImage:D(t.coverImage)??""}},createOrder:async e=>c(u("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>f(u("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(u("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(u("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>c(u("/checkouts/release"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(u("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(u("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(u("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(u("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(u("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(u("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(u("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(u("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(u("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(u("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(u("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(u("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(u("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(u("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(u("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(u("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(u("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(u("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=u("/reviews"),r=t.toString();try{return await c(await y(r?`${n}?${r}`:n),await d())}catch(o){return console.warn("[products.listReviews] product API unavailable, returning []",o),[]}},submitReview:async e=>c(u("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(u(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>c(u(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(u("/shipping-methods"),await d())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(u(`/countries/${encodeURIComponent(e)}/subdivisions`),await d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=u("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await je(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await je(u("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=it({method:"GET"}),t=await c(...await ee(u("/header-settings"),{signal:e})),n=D(t.logoUrl),r=null,o=null;if(n&&Z(n)){let l=await Te(n,e);l&&(r=l.reversed,o=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:o}},getThemeSettings:async()=>c(...await ee(u("/theme-settings"))),getChatSettings:async()=>c(await y(u("/chat-settings")),await d())},qr={listServices:async()=>{try{return await c(u("/bookings/services"),await d())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(u(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await d()),create:async e=>c(u("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>c(u(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>c(u(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),reschedule:async(e,t)=>c(u(`/bookings/manage/${encodeURIComponent(e)}/reschedule`),await d({method:"POST",body:JSON.stringify({startAt:t})})),createPaymentIntent:async e=>c(u("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},ne=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},B=(e,t,n)=>{let r=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${r?`?${r}`:""}`},H=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,wn=e=>`${H(e)}currencies/`,Rn="/api/storefront/media/ingest/",re=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 An(){let e=_e();if(!e)throw new re;return`${Rn}?${new URLSearchParams({site:e})}`}var kn="X-Puck-Media-Manifest",nt=ae.contentHash,G={"X-Media-Manifest":nt,[kn]:nt},Kr=pt({});function pt(e){return(t,n={})=>{let r=en(),o=e.headers||r?{...r?{"Accept-Language":r}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...o?{headers:o}:{},audience:e.audience??Xt()})}}function Tn(e={}){let t=pt(e),n=e.siteDrafts===!0,r=i=>B("header-settings",i,n),o=i=>B("theme-settings",i,n),l=i=>B("chat-settings",i,n),p=i=>B("social-settings",i,n);return{findPageBySlug:async(i,s,a)=>{let m=new URLSearchParams({slug:i});a&&m.set("site",a);let g=await t(`/api/storefront/pages/?${m.toString()}`,{token:s}),w=h(g);if(!a&&w.length>1)throw new ne(i,w.length);return w[0]??null},getPageById:(i,s)=>t(`/api/storefront/pages/${i}/`,{token:s}),saveLayout:(i,s,a,m,g)=>t(`/api/storefront/pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s,expected_updated_at:m,...g?{client_id:g}:{}}),token:a}),duplicatePage:(i,s,a)=>t(`/api/storefront/pages/${i}/duplicate/`,{method:"POST",body:JSON.stringify({title:s.title,slug:s.slug}),token:a}),geocode:(i,s,a)=>t(`/api/storefront/geocode/?${new URLSearchParams(a?{q:i,country:a}:{q:i})}`,{token:s}),listBlockSources:i=>t("/api/storefront/block-sources/",{token:i}),listRecordTypes:i=>t("/api/storefront/record-types/",{token:i}),createPagePreviewLink:(i,s)=>t(`/api/storefront/pages/${i}/preview-link/`,{method:"POST",token:s}),claimPageEditLock:(i,s,a,m=!1)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:a,takeover:m}),token:s}),releasePageEditLock:(i,s)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"DELETE",token:s}),createTemplate:(i,s,a)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:i,layout:s}),headers:G,token:a}),getTemplate:(i,s)=>t(`/api/storefront/page-templates/${i}/`,{token:s}),saveTemplateLayout:(i,s,a)=>t(`/api/storefront/page-templates/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:G,token:a}),listTemplatePages:async(i,s)=>{let a=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}`,{token:s});return h(a)},getPageLibrary:async i=>{let s=await t("/api/storefront/page-templates/?is_page_library=true&is_active=true",{token:i});return h(s)[0]??null},getTemplateLibrary:(i,s)=>t(`/api/storefront/pages/template-library/?site=${encodeURIComponent(i)}`,{token:s}),createPageFromTemplate:(i,s)=>t(`/api/storefront/pages/from-template/${n?"?draft=1":""}`,{method:"POST",body:JSON.stringify(i),token:s}),findTemplatePageBySlug:async(i,s,a)=>{let m=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}&slug=${encodeURIComponent(s)}`,{token:a});return h(m)[0]??null},createTemplatePage:(i,s,a)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:i,...s}),headers:G,token:a}),saveTemplatePageLayout:(i,s,a)=>t(`/api/storefront/template-pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:G,token:a}),deleteTemplatePage:(i,s,a)=>t(`/api/storefront/template-pages/${i}/`,{method:"DELETE",token:s,...a?.keepalive?{keepalive:!0}:{}}),listPages:async(i,s)=>{let a=new URLSearchParams({no_page:"true"});s&&a.set("site",s);let m=await t(`/api/storefront/pages/?${a.toString()}`,{token:i});return h(m)},createPage:(i,s,a,m)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:i,slug:s,layout:a}),token:m}),deletePage:(i,s)=>t(`/api/storefront/pages/${i}/`,{method:"DELETE",token:s}),getHeaderSettings:(i,s)=>t(r(s),{token:i}),listMenus:async(i,s)=>{let a=new URLSearchParams({no_page:"true"});s&&a.set("site",s);let m=await t(`/api/storefront/menus/?${a}`,{token:i});return h(m)},listBlogPosts:async(i,s={})=>{let a=new URLSearchParams({no_page:"true"});s.visibleOnly&&a.set("is_visible","true"),s.siteId&&a.set("site",s.siteId);let m=await t(`/api/storefront/blog-posts/?${a.toString()}`,{token:i});return h(m)},listFieldUsage:async(i,s)=>{let a=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(s)}`,{token:i});return Array.isArray(a?.entries)?a.entries:[]},listCategories:async(i,s={})=>{let a=new URLSearchParams({no_page:"true"});s.visibleOnly&&a.set("is_visible","true"),s.siteId&&a.set("site",s.siteId);let m=await t(`/api/storefront/categories/?${a.toString()}`,{token:i});return[...h(m)].sort((w,U)=>w.sort_order-U.sort_order||w.name.localeCompare(U.name))},listForms:async(i,s={})=>{let a=new URLSearchParams({no_page:"true"});s.siteId&&a.set("site",s.siteId);let m=await t(`/api/storefront/forms/?${a.toString()}`,{token:i});return[...h(m)].sort((w,U)=>w.title.localeCompare(U.title))},listWheelSummaries:async(i,s={})=>{let a=new URLSearchParams;s.siteId&&a.set("site",s.siteId);let m=a.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${m?`?${m}`:""}`,{token:i});return b(g)},listProducts:async(i,s={})=>{let a=new URLSearchParams;s.kinds?.length&&a.set("kind",s.kinds.join(",")),s.siteId&&a.set("site",s.siteId);let m=a.toString(),g=await t(`/api/storefront/products/${m?`?${m}`:""}`,{token:i});return b(g)},getWheelDetail:async(i,s,a={})=>{let m=new URLSearchParams({slug:s});return a.siteId&&m.set("site",a.siteId),C(b(await t(`/api/storefront/wheel-curations/detail/?${m.toString()}`,{token:i})))},updateHeaderSettings:(i,s,a)=>t(r(a),{method:"PATCH",body:JSON.stringify(i),token:s}),getSite:(i,s)=>t(H(i),{token:s}),listSites:async i=>{let s=await t("/api/storefront/sites/?no_page=true",{token:i});return h(s)},listSiteCurrencies:async(i,s)=>{let a=await t(wn(i),{token:s});return Array.isArray(a)?a:[]},publishSite:(i,s)=>t(`${H(i)}publish/`,{method:"POST",token:s}),getSiteLiveState:(i,s)=>t(`${H(i)}live-state/`,{token:s}),getThemeSettings:(i,s)=>t(o(s),{token:i}),updateThemeSettings:(i,s,a)=>t(o(a),{method:"PATCH",body:JSON.stringify(i),token:s}),getMyPreferences:async i=>(await t("/api/auth/me/",{token:i})).preferences??{},updateMyPreferences:(i,s)=>t("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:i}),token:s}),getChatSettings:(i,s)=>t(l(s),{token:i}),updateChatSettings:(i,s,a)=>t(l(a),{method:"PATCH",body:JSON.stringify(i),token:s}),getSocialSettings:(i,s)=>t(p(s),{token:i}),updateSocialSettings:(i,s,a)=>t(p(a),{method:"PATCH",body:JSON.stringify(i),token:s}),uploadHeaderLogo:(i,s,a)=>{let m=new FormData;return m.append("logo",i),t(r(a),{method:"PATCH",body:m,token:s})},clearHeaderLogo:(i,s)=>t(r(s),{method:"PATCH",body:JSON.stringify({logo:null}),token:i}),setHeaderLogoFromAsset:(i,s,a)=>t(r(a),{method:"PATCH",body:JSON.stringify({logo_asset_id:i}),token:s}),uploadMedia:async(i,s)=>{let a=new FormData;return a.append("file",i),t(An(),{method:"POST",body:a,token:s})},listMedia:async(i,s)=>{let a=new URLSearchParams({no_page:"true"});s&&a.set("kind",s);let m=await t(`/api/storefront/media-assets/?${a.toString()}`,{token:i});return h(m)}}}var Jr=Tn({siteDrafts:!0});function _n(e){let t=e.trim();return t?`/api/v1/dealers?${new URLSearchParams({near:t}).toString()}`:"/api/v1/dealers"}async function Yr(e){return xe(await c(_n(e)))}var _={audience:null,baseUrl:""};async function Zr(e,t){return ve(await c(Ie(e,t),_))}async function Vr(e){return Be(await c(Fe,{..._,method:"POST",body:JSON.stringify(e)}))}async function jr(e){try{let t=await c($e,{..._,method:"POST",body:JSON.stringify({token:e})});return Q(202,t)}catch(t){if(t instanceof S)return Q(t.status,t.data);throw t}}async function Qr(e,t){await c(Me,{..._,method:"POST",body:JSON.stringify({email:t.trim(),...e?{product:e}:{}})})}async function Xr(e,t){await c(We,{..._,method:"POST",body:JSON.stringify({email:t.trim(),...e?{product:e}:{}})})}async function zr(e){try{return Ke(await c(qe,{..._,method:"POST",body:JSON.stringify({token:e})}))}catch(t){if(t instanceof S&&Cn.has(t.status))return"";throw t}}var Cn=new Set([400,404,410]);export{q as a,h as b,ce as c,ue as d,R as e,yt as f,Z as g,_e as h,Ce as i,$n as j,Wn as k,qn as l,Kn as m,Yn as n,Ne as o,Ue as p,er as q,tr as r,P as s,De as t,Le as u,nr as v,rr as w,ir as x,sr as y,or as z,ar as A,lr as B,cr as C,ur as D,dr as E,pr as F,mr as G,gr as H,yr as I,hr as J,fr as K,Sr as L,M,Pr as N,br as O,wr as P,Rr as Q,Kt as R,S,te as T,X as U,Lr as V,Ir as W,c as X,on as Y,dt as Z,mn as _,gn as $,yn as aa,Sn as ba,$r as ca,Wr as da,qr as ea,ne as fa,Kr as ga,Jr as ha,Yr as ia,Zr as ja,Vr as ka,jr as la,Qr as ma,Xr as na,zr as oa};
|
|
1
|
+
import{a as oe,c as D,h as ae,j as L}from"./chunk-ZV2GXEDX.js";import{b as W,c as se}from"./chunk-D5HXXBSX.js";var q="".replace(/\/+$/,"");var K="x-forwarded-for";function le(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var mt="x-forwarded-host";function ce(e,t,n){let r={};return e&&(r[mt]=e),t&&n==="uncached"&&(r[K]=t),r}function ue(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 de="x-storefront-site",pe="x-storefront-host",me="x-storefront-preview";function h(e){return Array.isArray(e)?e:e?.results??[]}import{parseOption as Wt}from"efficient-shell/format";var gt="shop_access_token",ge="shop_refresh_token",J=null;function Y(){L.removeItem(gt),L.removeItem(ge)}var R={getAccess(){return J},takeLegacyRefresh(){let e=L.getItem(ge);return Y(),e},setTokens(e){J=e,Y()},clear(){J=null,Y()}};import{efficientClientOpen as qt}from"efficient-easel/screen/lib/session";function yt(e){return!!e.src}function C(e){let t=e.finishes.filter(yt);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function ht(e){return e.listable!==!1}function x(e){return e.map(C).filter(ht)}var Se=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],Pe=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),I={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]},be=12,we=/\burl\(/i,Re=new RegExp(`(?<![-\\w])(${Se.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),Ae=new RegExp(`((?:^|[;{\\s"'])(?:${Se.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),ft=/<svg\b([^>]*)>/i,St=/\bfill\s*[=:]/i;function Pt(e){let t=e.replace(Re,(n,r,o,l,p)=>{let i=ye(p);return i===null?n:`${r}${o}${l}${i}${l}`}).replace(Ae,(n,r,o)=>{let l=ye(o);return l===null?n:`${r}${l}`});return t=t.replace(ft,(n,r)=>St.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function ye(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||we.test(n)||Pe.has(n))return null;let r=n in I?[...I[n],1]:ke(n);if(!r)return null;let[o,l,p,i]=r;if(Math.max(o,l,p)-Math.min(o,l,p)>be)return null;let s=bt(255-o,255-l,255-p,i);return t?`${s} !important`:s}function bt(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let o=l=>l.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function ke(e){return e.startsWith("#")?wt(e):e.startsWith("rgb")?Rt(e):e.startsWith("hsl")?kt(e):null}function wt(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function Rt(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),o=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(o.length<3)return null;let l=o.map(i=>i.endsWith("%")?Math.round(parseFloat(i)/100*255):Math.round(parseFloat(i)));if(l.some(i=>Number.isNaN(i)))return null;let p=r?F(r):At(n);return[l[0],l[1],l[2],p]}function At(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?F(t[3]):1}function F(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function kt(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),o=n.split(/[\s,]+/).filter(Boolean);if(o.length<3)return null;let l=parseFloat(o[0]),p=parseFloat(o[1])/100,i=parseFloat(o[2])/100;if([l,p,i].some(w=>Number.isNaN(w)))return null;let s=r?F(r):o.length>=4?F(o[3]):1,[a,m,g]=Tt(l,p,i);return[a,m,g,s]}function Tt(e,t,n){let r=(1-Math.abs(2*n-1))*t,o=(e%360+360)%360/60,l=r*(1-Math.abs(o%2-1)),p=0,i=0,s=0;o<1?[p,i,s]=[r,l,0]:o<2?[p,i,s]=[l,r,0]:o<3?[p,i,s]=[0,r,l]:o<4?[p,i,s]=[0,l,r]:o<5?[p,i,s]=[l,0,r]:[p,i,s]=[r,0,l];let a=n-r/2;return[Math.round((p+a)*255),Math.round((i+a)*255),Math.round((s+a)*255)]}var he=512*1024;function Z(e){return/\.svg(\?|$)/i.test(e)}function _t(e){return`data:image/svg+xml,${encodeURIComponent(Pt(e))}`}function Ct(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||we.test(t)||Pe.has(t))return null;let n=t in I?[...I[t],1]:ke(t);if(!n)return null;let[r,o,l]=n;return Math.max(r,o,l)-Math.min(r,o,l)>be?null:(.2126*r+.7152*o+.0722*l)/255}function xt(e){let t=[],n=r=>{let o=Ct(r);o!==null&&t.push(o)};for(let r of e.matchAll(Re))n(r[4]);for(let r of e.matchAll(Ae))n(r[2]);return t.length?t.reduce((r,o)=>r+o,0)/t.length<.5:null}var fe=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Ot(e){let t=e;for(let n=fe.exec(t);n&&n[0].length>0;n=fe.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function Et(e,t){if(!Z(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>he)return null;let o=await n.text();return o.length>he?null:Ot(o)?o:null}catch{return null}}async function Te(e,t){let n=await Et(e,t);return n===null?null:{reversed:_t(n),inkIsDark:xt(n)}}import{currentEaselSession as Nt,setSessionBridgedSite as Bn,setSessionDocumentSite as Gn}from"efficient-easel/screen/lib/session";function _e(){return Nt().siteId()}var Ce={title:"Find a dealer",placeholder:"Postcode or suburb",search:"Search",searching:"Searching\u2026",none:"No dealers to show yet.",notFound:"We couldn't find that place. Check the postcode or suburb and search again.",tryAgain:"We couldn't look up that place just now. Please try again.",website:"Website",map:"Dealers on the map"},k=e=>typeof e=="string"?e:"",V=e=>typeof e=="number"&&Number.isFinite(e)?e:null,Ut=["found","not_found","try_again"];function Dt(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.name!="string"||!t.name?null:{id:k(t.id)||t.name,name:t.name,address:k(t.address),city:k(t.city),state:k(t.state),postcode:k(t.postcode),country:k(t.country),phone:k(t.phone),website:k(t.website),lat:V(t.lat),lng:V(t.lng),distanceKm:V(t.distanceKm)}}function xe(e){if(!e||typeof e!="object")return{near:null,dealers:[]};let t=e,n=typeof t.near=="string"&&Ut.includes(t.near)?t.near:null,r=Array.isArray(t.dealers)?t.dealers:[];return{near:n,dealers:r.map(Dt).filter(o=>o!==null)}}function $n(e){return e==="not_found"?Ce.notFound:e==="try_again"?Ce.tryAgain:null}function Wn(e){return e===null?null:e<10?`${e.toFixed(1)} km`:`${Math.round(e)} km`}function qn(e){return[e.city,e.state,e.postcode].filter(Boolean).join(" ")}function Kn(e){let t=e.map((a,m)=>({dealer:a,index:m})).filter(({dealer:a})=>a.lat!==null&&a.lng!==null);if(!t.length)return[];let n=t.map(({dealer:a})=>a.lat),r=t.map(({dealer:a})=>a.lng),[o,l]=[Math.min(...n),Math.max(...n)],[p,i]=[Math.min(...r),Math.max(...r)],s=(a,m,g)=>g===m?50:8+(a-m)/(g-m)*84;return t.map(({dealer:a,index:m})=>({id:a.id,index:m,left:s(a.lng,p,i),top:100-s(a.lat,o,l)}))}var Oe=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],Ee=["AED","AFN","ALL","AMD","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLE","SOS","SRD","SSP","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VES","VND","VUV","WST","XAF","XCD","XCG","XOF","XPF","YER","ZAR","ZMW","ZWG"],Yn={AD:"EUR",AE:"AED",AF:"AFN",AL:"ALL",AM:"AMD",AO:"AOA",AR:"ARS",AT:"EUR",AU:"AUD",AW:"AWG",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BH:"BHD",BI:"BIF",BM:"BMD",BN:"BND",BO:"BOB",BR:"BRL",BS:"BSD",BT:"BTN",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CD:"CDF",CH:"CHE",CL:"CLF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DO:"DOP",DZ:"DZD",EE:"EUR",EG:"EGP",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FR:"EUR",GB:"GBP",GE:"GEL",GH:"GHS",GI:"GIP",GM:"GMD",GN:"GNF",GR:"EUR",GT:"GTQ",GY:"GYD",HK:"HKD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IN:"INR",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KM:"KMF",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MG:"MGA",MK:"MKD",MM:"MMK",MN:"MNT",MO:"MOP",MR:"MRU",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PT:"EUR",PY:"PYG",QA:"QAR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SK:"EUR",SL:"SLE",SM:"EUR",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"SVC",SY:"SYP",SZ:"SZL",TH:"THB",TJ:"TJS",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",US:"USD",UY:"UYI",UZ:"UZS",VA:"EUR",VE:"VED",VN:"VND",VU:"VUV",WS:"WST",YE:"YER",ZA:"ZAR",ZM:"ZMW",ZW:"ZWG"};import{formatDateTime as It}from"efficient-shell/format";import{knownZone as Lt}from"efficient-shell/format";var Ne=()=>new Intl.DateTimeFormat().resolvedOptions().locale;function Ue(...e){return e.find(Lt)??""}var er={firstName:"",lastName:"",email:"",company:"",slug:"",country:"",currency:""},Ft=["slug_malformed","slug_reserved","slug_taken"],j=e=>typeof e=="string"&&Ft.includes(e),tr=400,P={title:"Create your {name} workspace",freeLine:"Free to start. No card needed.",firstName:"First name",lastName:"Last name",email:"Work email",company:"Company name",address:"Workspace address",country:"Country",currency:"Currency",countryHint:"Your shop sells in this currency. The country sets its tax and shipping defaults. Both can be changed later.",checking:"Checking",available:"Available",submit:"Create workspace",sending:"Sending\u2026",agree:"By creating a workspace you agree to the {terms} and {privacy}.",terms:"Terms",privacy:"Privacy Policy",haveOne:"Already have a workspace?",find:"Find my workspace",required:"Fill this in.",companyShort:"Use at least 2 characters.",emailWrong:"Enter an email address, like name@company.com.",notOffered:"That choice is not offered. Pick another.",wrong:"Check this and try again.",slugProblem:{slug_malformed:"Use 3 to 30 lower-case letters, digits or single hyphens, starting with a letter.",slug_reserved:"That address is kept for the platform. Choose another.",slug_taken:"That address is taken. Choose another."},trouble:{closed:"Signing up is closed just now.",dailyLimit:"Too many workspaces signed up today. Try again tomorrow.",unavailable:"Signing up is not available just now. Try again later.",tooMany:"You have asked a few times in a row. Wait a minute, then try again.",unreachable:"We couldn't reach the server. Check your connection and try again.",failed:"Something went wrong and nothing was sent. Try again."},closedTitle:"Signing up is closed just now",closedBody:"New {name} workspaces cannot be made just now.",closedLeave:"Leave your email and we'll tell you when it opens.",tellMe:"Tell me when it opens",waitingDone:"Thanks. We'll email {email} when sign-up opens.",sentTitle:"Check your email",sentBody:"We sent a link to {email}. Open it to set up {company}.",sentUntil:"The link works once, until {when}. Asking again sends a new link, and the old one stops working.",sendAgain:"Send it again",sendingAgain:"Sending\u2026",sentAgain:"A new link is on its way. The old one no longer works.",change:"Change the details"};function De(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function Le(e){return e.trim().toLowerCase().replace(/_/g,"-")}function nr(e){return e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")}function rr(e,t){let n=(e??"").trim().toLowerCase().replace(/^\.+/,"").replace(/\.+$/,"");if(n)return`.${n}`;let r=t.toLowerCase().replace(/\.$/,"").replace(/^www\./,"");return r?`.${r}`:""}var A=e=>typeof e=="string"?e:"";function Ie(e,t){let n=new URLSearchParams;t&&n.set("slug",t),e&&n.set("product",e);let r=n.toString();return`/api/business-sign-ups/availability/${r?`?${r}`:""}`}var Fe="/api/business-sign-ups/",Me="/api/business-sign-ups/waiting-list/";function ir(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return n.code==="sign_up_open"?{open:!0,email:null,trouble:null}:n.code==="sign_up_waiting_list_unavailable"?{open:!1,email:null,trouble:"unavailable"}:e===400&&"email"in n?{open:!1,email:P.emailWrong,trouble:null}:e===0?{open:!1,email:null,trouble:"unreachable"}:e===429?{open:!1,email:null,trouble:"tooMany"}:{open:!1,email:null,trouble:"failed"}}function sr(e){let t=e.trim();return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?null:P.emailWrong:P.required}function ve(e){let t=e&&typeof e=="object"?e:{};return{open:t.open===!0,country:A(t.country),currency:A(t.currency),slugAvailable:typeof t.slug_available=="boolean"?t.slug_available:null,slugProblem:j(t.slug_problem)?t.slug_problem:null}}function or(e){return e.slugAvailable?{state:"available"}:e.slugProblem?{state:"problem",problem:e.slugProblem}:{state:"unknown"}}function Be(e){let t=e&&typeof e=="object"?e:{};return{slug:A(t.slug),expiresAt:A(t.expires_at)}}function ar(e,t,n){return{business_name:e.company.trim(),slug:Le(e.slug),first_name:e.firstName.trim(),last_name:e.lastName.trim(),email:e.email.trim(),...t?{product:t}:{},...n&&e.country?{country:e.country}:{},...n&&e.currency?{currency:e.currency}:{}}}function lr(e,t){let n={};e.firstName.trim()||(n.firstName=P.required);let r=e.email.trim();r?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)||(n.email=P.emailWrong):n.email=P.required;let o=e.company.trim();return o?o.length<2&&(n.company=P.companyShort):n.company=P.required,Le(e.slug)?t.state==="problem"&&(n.slug=P.slugProblem[t.problem]):n.slug=P.required,n}var Mt={business_name:"company",slug:"slug",first_name:"firstName",last_name:"lastName",email:"email",country:"country",currency:"currency"},v={self_sign_up_off:"closed",sign_up_daily_limit:"dailyLimit",sign_up_unavailable:"unavailable",sign_up_plan_missing:"unavailable"};function cr(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.code;if(j(r))return{fields:{slug:P.slugProblem[r]},trouble:null};if(typeof r=="string"&&v[r])return{fields:{},trouble:v[r]};if(e===0)return{fields:{},trouble:"unreachable"};if(e===429)return{fields:{},trouble:"tooMany"};if(e===400){let o={};for(let l of Object.keys(n)){let p=Mt[l];p&&(o[p]=p==="slug"?P.slugProblem.slug_malformed:p==="email"?P.emailWrong:p==="country"||p==="currency"?P.notOffered:P.wrong)}if(Object.keys(o).length)return{fields:o,trouble:null}}return{fields:{},trouble:"failed"}}function Ge(e,t){try{let n=new Intl.DisplayNames(t?[t]:void 0,{type:e,fallback:"code"});return r=>n.of(r)??r}catch{return n=>n}}var He=(e,t)=>t&&!e.includes(t)?[...e,t]:[...e],vt=(e,t)=>{let n=new Intl.Collator(t);return e.sort((r,o)=>n.compare(r.label,o.label))};function ur(e,t){let n=Ge("region",t);return vt(He(Oe,e).map(r=>({value:r,label:n(r)})),t)}function dr(e,t){let n=Ge("currency",t);return He(Ee,e).sort().map(r=>{let o=n(r);return{value:r,label:o===r?r:`${r} \xB7 ${o}`}})}function pr(e,t,n){let r=Ue(n??"");return!e||Number.isNaN(new Date(e).getTime())||!r?"":It(e,{locale:t||Ne(),timeZone:r,style:Bt})}var Bt={weekday:"long",day:"numeric",month:"long"},Gt=/^\/sign-up\/verify\/([^/?#]+)\/?$/;function mr(e){let t=Gt.exec(e??"");if(!t)return"";try{return decodeURIComponent(t[1])}catch{return t[1]}}var $e="/api/business-sign-ups/verifications/",Ht=["pending","provisioning","ready","failed"];function Q(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=A(n.code),o=A(n.slug);if(e===202||r==="sign_up_already_verified"){let l=A(n.provisioning_status),p=A(n.business_name);return Ht.includes(l)?l==="ready"?{kind:"ready",company:p,slug:o}:l==="failed"?{kind:"failed",company:p,slug:o}:{kind:"building",company:p,slug:o,status:l}:{kind:"gone"}}return j(r)?{kind:"taken",slug:o}:r==="sign_up_daily_limit"?{kind:"dailyLimit"}:r==="self_sign_up_off"?{kind:"closed"}:r&&v[r]?{kind:"trouble",trouble:v[r]}:e===400&&"token"in n?{kind:"gone"}:e===0?{kind:"trouble",trouble:"unreachable"}:e===429?{kind:"trouble",trouble:"tooMany"}:{kind:"trouble",trouble:"failed"}}function gr(e){return e.kind==="building"||e.kind==="trouble"&&e.trouble!=="failed"}function yr(e){return e<5?2e3:e<20?5e3:15e3}var hr=40;function fr(e,t,n){let r=e.kind==="failed"?"stopped":"running";return[{words:M.confirmed,at:"done"},{words:De(M.reserved,{address:`${e.slug}${n}`}),at:"done"},{words:M.building,at:r},...e.kind==="failed"?[]:[{words:De(M.adding,{name:t}),at:"waiting"}]]}var Sr=e=>e==="pending"?50:75,M={settingUp:"Setting up {company}",confirmed:"Email confirmed",reserved:"Address reserved: {address}",building:"Building your workspace",adding:"Adding {name}",aboutTen:"This takes about 10 seconds. You can close this page: we'll email you when it's ready.",readyTitle:"Your workspace is ready",workspace:"Workspace",address:"Address",plan:"Plan",planName:"{name} Free",readyNext:"We've emailed you a link to set your password. It's the next step.",failedBody:"We couldn't finish building your workspace. We've been told, and we'll email you when it's ready. You don't need to sign up again.",goneTitle:"This link has run out",goneBody:"This link is not right, or it has run out. Sign up again and we'll send a new one.",again:"Sign up again",takenTitle:"That address has gone",takenBody:"{address} was taken before you opened your link. Choose another address and we'll send a new link.",takenBodyBare:"That address was taken before you opened your link. Choose another address and we'll send a new link.",chooseAnother:"Choose another address",limitTitle:"Not today",limitNext:"Your link still works until it runs out. Open it again tomorrow.",checking:"Checking your link",troubleTitle:"We couldn't check your link",troubleFailed:"Something went wrong on our side. Your link still works, so nothing is lost.",tryAgain:"Try again"},We="/api/business-sign-ups/workspace-finds/",qe="/api/business-sign-ups/workspace-finds/openings/",$t=/^\/find\/([^/?#]+)\/?$/;function Pr(e){let t=$t.exec(e??"");if(!t)return"";try{return decodeURIComponent(t[1])}catch{return t[1]}}var br={title:"Find your workspace",intro:"Enter your work email. We'll send you the address of every workspace you belong to.",submit:"Email me my workspaces",newHere:"New to {name}?",create:"Create a workspace",sentTitle:"Check your email",sentBody:"If {email} belongs to a workspace, the links are on their way.",sentNote:"They work for 30 minutes. Nothing arrives if the address isn't in any workspace.",another:"Use another email",linkGone:"This link is not right, or it has run out. Ask for your workspaces again.",opening:"Opening your workspace",openFailed:"We couldn't open your workspace just now. Your link still works \u2014 try again.",retry:"Try again"};function wr(e){return e===0?"unreachable":e===429?"tooMany":"failed"}function Rr(e,t){let n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return n.code==="workspace_find_unavailable"?{email:null,trouble:"unavailable"}:e===400&&"email"in n?{email:P.emailWrong,trouble:null}:e===0?{email:null,trouble:"unreachable"}:e===429?{email:null,trouble:"tooMany"}:{email:null,trouble:"failed"}}function Ke(e){let t=e&&typeof e=="object"?A(e.sign_in_url):"";return/^https?:\/\/[^\s]+$/i.test(t)?t:""}var Kt="",S=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},te="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.",Jt=new Set([502,503,504]),X=0,Yt="This editor runs on its host's own backend, which does not serve this request.",Zt=5e3,Vt=15e3,jt=()=>typeof window>"u"?Zt:Vt;function it(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(jt())}var Je=e=>e instanceof Error&&e.name==="TimeoutError",Ye=(e,t)=>Jt.has(e)?te:t,Qt=["admin","venue"],st="admin";function Lr(e){st=Wt(Qt,"admin",e)}function Xt(){return st}var zt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,ot=null;function Ir(e){ot=e&&zt.test(e)?e:null}function en(){return ot}function tn(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=W();return!t||/[?&]site=/.test(e)?e:$(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:r,headers:o,audience:l,...p}=t;if(typeof window<"u"&&!qt())throw new S(X,Yt,null);if(typeof window>"u"&&r===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let i=typeof FormData<"u"&&p.body instanceof FormData,s;try{s=await fetch(`${r??Kt}${tn(e)}`,{...p,headers:{...i?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...o},signal:p.signal??it({...p,audience:l})})}catch(g){throw g instanceof TypeError||Je(g)?new S(X,te,null):g}let a;try{a=await s.text()}catch(g){throw Je(g)?new S(X,te,null):g}let m=null;if(a)try{m=JSON.parse(a)}catch{throw new S(s.status,s.ok?"Expected JSON but received a non-JSON response":Ye(s.status,s.statusText),a)}if(!s.ok){let g=(m&&typeof m=="object"&&"detail"in m&&typeof m.detail=="string"?m.detail:null)??Ye(s.status,s.statusText);throw new S(s.status,g,m)}return m}var O=null;async function at(){return O||(O=nn().finally(()=>{O=null}),O)}async function nn(){let e=R.takeLegacyRefresh(),t=await on.refresh(e??void 0);return R.setTokens(t.access),t.access}async function lt(){return R.getAccess()??at()}async function f(e,t={}){let n;try{n=await lt()}catch{throw R.clear(),new S(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(r){if(!(r instanceof S)||r.status!==401)throw r;try{let o=await at();return await c(e,{...t,token:o})}catch{throw R.clear(),r}}}var rn=100,Ze=20;function sn(e){if(!e)return null;try{return new URL(e,"http://page.invalid").searchParams.get("page")}catch{return null}}async function Ve(e,t){let[n,r=""]=e.split("?"),o=[],l="1";for(let p=0;p<Ze&&l;p++){let i=new URLSearchParams(r);i.set("page_size",String(rn)),l!=="1"&&i.set("page",l);let s=await f(`${n}?${i.toString()}`);o.push(...h(s)),l=sn(s.next)}return l&&console.warn(`[${t}] stopped at ${Ze} pages (${o.length} rows); list may be truncated`),o}async function je(e,t={}){if(R.getAccess())try{return{data:await f(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function Qe(){let e=await f("/api/auth/me/");if(e.portal!=="shop")throw R.clear(),new S(403,"This session is not valid for this shop.",null);return e}var on={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{R.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await lt();return await Qe(),e},me:Qe,updateMe:e=>f("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>f("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>f("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>f("/api/shop-portal/profile/"),updateMyProfile:e=>f("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>f("/api/shop-portal/delivery-locations/"),createAddress:e=>f("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>f(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>f(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>f("/api/products/brands/"),myOrders:()=>Ve("/api/shop-portal/orders/","api.myOrders"),myOrder:e=>f(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>f(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>Ve(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`,"api.myReturns"),createReturn:e=>f("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>f(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),f("/api/shop-portal/return-media/",{method:"POST",body:n})}};function b(e){if(typeof e=="string")return e.startsWith("/media/")?oe(e):e;if(Array.isArray(e))return e.map(b);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([o,l])=>[b(o),l])):b(r);return t}return e}var ct=typeof window>"u"&&q!=="",an=ct?q:"",ln=se,T=()=>({baseUrl:ln(),audience:null});function u(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var ut=100,Xe=50;function ie(e,t,n){let r=new URLSearchParams;for(let[o,l]of Object.entries(t))l!=null&&l!==""&&r.set(o,String(l));return r.set("pageSize",String(ut)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function cn(e,t){return ie("/wheels",{process:e},t)}var ze=ut;function un(e,t){return ie("/wheels",{slug:e.join(",")},t)}function dn(e,t,n){return ie("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function pn(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function z(e,t,n=()=>!1,r=()=>!1){let o=[],l=null;try{for(let p=0;p<Xe;p++){let i=await c(await t(l),await d());if(o.push(...h(i)),l=pn(i.next),!l)break;if(r(o))return o}l&&console.warn(`[${e}] stopped at ${Xe} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(n(p))throw p;console.warn(`[${e}] product API unavailable, returning []`,p)}return o}var et=e=>e instanceof S&&e.status===400;function tt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?x([t]):[t])}async function dt(){return(await mn()).host}async function mn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(pe)??t.get("x-forwarded-host")??t.get("host")),o=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===o}}catch{return{host:null,matchesRequestHost:!1}}}async function gn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return le((await e()).get(K))}catch{return null}}async function yn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(de)||null}catch{return null}}async function hn(){let e=await yn();if(e)return`site=${encodeURIComponent(e)}`;let t=await dt();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=W();return t?$(e,`site=${encodeURIComponent(t)}`):e}return $(e,await hn())}function $(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var fn="preview";async function Sn(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(me)}catch{return null}}async function Pn(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function ee(e,t){let n=await Sn();if(n===null)return[await y(e),await d(t)];let r=$(await y(e),`${fn}=${encodeURIComponent(n)}`),{next:o,cache:l,...p}=t??{},i=await d({...p,cache:"no-store"}),s=await Pn();return s&&(i.headers={...i.headers,"user-agent":s}),[r,i]}async function bn(e){if(!ct)return;let[t,n]=await Promise.all([dt(),gn()]),r=ce(t,n,e);return Object.keys(r).length>0?r:void 0}async function d(e){let t=await bn(ue(e)),n={baseUrl:an,...e};return t&&(n.headers={...t,...e?.headers}),n}var E=typeof window>"u";function N(e,t){let n=new URLSearchParams;for(let[o,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(o,String(l));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var $r={listMakes:async e=>{if(E){let{fitmentData:n}=await import("./fitment-data-VOATE5L5.js");return n.makes(e)}let t=await c(N("/makes",{region:e}),T());return h(t)},listModels:async(e,t)=>{if(E){let{fitmentData:r}=await import("./fitment-data-VOATE5L5.js");return r.models(e,t)}let n=await c(N("/models",{make:e,region:t}),T());return h(n)},listYears:async(e,t,n)=>{if(E){let{fitmentData:o}=await import("./fitment-data-VOATE5L5.js");return o.years(e,t,n)}let r=await c(N("/years",{make:e,model:t,region:n}),T());return h(r)},listModifications:async(e,t,n,r)=>{if(E){let{fitmentData:l}=await import("./fitment-data-VOATE5L5.js");return l.modifications(e,t,n,r)}let o=await c(N("/modifications",{make:e,model:t,year:n,region:r}),T());return h(o)},getStockFitment:async(e,t,n,r,o)=>{if(E){let{fitmentData:l}=await import("./fitment-data-VOATE5L5.js");return l.stockFitment(e,t,n,r,o)}return c(N("/stock-fitment",{make:e,model:t,year:n,modification:r,region:o}),T())}},Wr={listWheels:async(e,t={})=>{let n=await z("products.listWheels",async r=>await y(cn(e,r)),t.throwOnFailure?()=>!0:void 0,t.maxRows===void 0?void 0:r=>x([...r]).length>=t.maxRows);return x(b(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(i=>i.trim()).filter(Boolean))];if(n.length===0)return[];let r=[];for(let i=0;i<n.length;i+=ze)r.push(n.slice(i,i+ze));let o=await Promise.all(r.map(i=>z("products.listWheelsBySlug",async s=>await y(un(i,s)),t.throwOnFailure?()=>!0:et))),l=new Set(n),p=o.flat().filter(i=>l.has(i.slug));return x(b(p))},listCatalog:async(e,t,n={})=>{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 z("products.listCatalog",async o=>await y(dn(e,t,o)),n.throwOnFailure?()=>!0:et,n.maxRows===void 0?void 0:o=>tt([...o]).length>=n.maxRows);return tt(b(r))},getWheel:async e=>C(b(await c(await y(u(`/wheels/${e}`)),await d()))),getTyre:async e=>b(await c(await y(u(`/tyres/${e}`)),await d())),listBundles:async(e={})=>{try{return await c(await y(u("/bundles")),await d())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>c(await y(u(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-TD3QJK7L.js");return b(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let o=r.toString(),l=await c(`/api/v1/gallery-builds${o?`?${o}`:""}`,T());return b(h(l))}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>c(await y(u("/site")),await d()),getSiteBySlug:async e=>c(`${u("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listPages:async()=>b(await c(await y(u("/pages")),await d())),listPopups:async()=>c(await y(u("/popups")),await d()),listProductTemplates:async()=>{try{return await c(await y(u("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${u("/dynamic-pages")}${t}`),await d())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await y(u(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await y(u(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(u("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(u("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[r,o]=await ee(u(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return b(await c(r,o))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(u("/blog-posts")+n,await d())).map(o=>({...o,coverImage:D(o.coverImage)??""}))}catch(r){if(t)throw r;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",r),[]}},getBlogPost:async e=>{let t=await c(u(`/blog-posts/${e}`),await d());return{...t,coverImage:D(t.coverImage)??""}},createOrder:async e=>c(u("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>f(u("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(u("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(u("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>c(u("/checkouts/release"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(u("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(u("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(u("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(u("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(u("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(u("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(u("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(u("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(u("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(u("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(u("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(u("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(u("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(u("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(u("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(u("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(u("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(u("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=u("/reviews"),r=t.toString();try{return await c(await y(r?`${n}?${r}`:n),await d())}catch(o){return console.warn("[products.listReviews] product API unavailable, returning []",o),[]}},submitReview:async e=>c(u("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(u(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>c(u(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(u("/shipping-methods"),await d())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(u(`/countries/${encodeURIComponent(e)}/subdivisions`),await d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=u("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await je(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await je(u("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=it({method:"GET"}),t=await c(...await ee(u("/header-settings"),{signal:e})),n=D(t.logoUrl),r=null,o=null;if(n&&Z(n)){let l=await Te(n,e);l&&(r=l.reversed,o=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:o}},getThemeSettings:async()=>c(...await ee(u("/theme-settings"))),getChatSettings:async()=>c(await y(u("/chat-settings")),await d())},qr={listServices:async()=>{try{return await c(u("/bookings/services"),await d())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(u(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await d()),create:async e=>c(u("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>c(u(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>c(u(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),reschedule:async(e,t)=>c(u(`/bookings/manage/${encodeURIComponent(e)}/reschedule`),await d({method:"POST",body:JSON.stringify({startAt:t})})),createPaymentIntent:async e=>c(u("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},ne=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},B=(e,t,n)=>{let r=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${r?`?${r}`:""}`},H=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,wn=e=>`${H(e)}currencies/`,Rn="/api/storefront/media/ingest/",re=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 An(){let e=_e();if(!e)throw new re;return`${Rn}?${new URLSearchParams({site:e})}`}var kn="X-Puck-Media-Manifest",nt=ae.contentHash,G={"X-Media-Manifest":nt,[kn]:nt},Kr=pt({});function pt(e){return(t,n={})=>{let r=en(),o=e.headers||r?{...r?{"Accept-Language":r}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...o?{headers:o}:{},audience:e.audience??Xt()})}}function Tn(e={}){let t=pt(e),n=e.siteDrafts===!0,r=i=>B("header-settings",i,n),o=i=>B("theme-settings",i,n),l=i=>B("chat-settings",i,n),p=i=>B("social-settings",i,n);return{findPageBySlug:async(i,s,a)=>{let m=new URLSearchParams({slug:i});a&&m.set("site",a);let g=await t(`/api/storefront/pages/?${m.toString()}`,{token:s}),w=h(g);if(!a&&w.length>1)throw new ne(i,w.length);return w[0]??null},getPageById:(i,s)=>t(`/api/storefront/pages/${i}/`,{token:s}),saveLayout:(i,s,a,m,g)=>t(`/api/storefront/pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s,expected_updated_at:m,...g?{client_id:g}:{}}),token:a}),duplicatePage:(i,s,a)=>t(`/api/storefront/pages/${i}/duplicate/`,{method:"POST",body:JSON.stringify({title:s.title,slug:s.slug}),token:a}),geocode:(i,s,a)=>t(`/api/storefront/geocode/?${new URLSearchParams(a?{q:i,country:a}:{q:i})}`,{token:s}),listBlockSources:i=>t("/api/storefront/block-sources/",{token:i}),listRecordTypes:i=>t("/api/storefront/record-types/",{token:i}),createPagePreviewLink:(i,s)=>t(`/api/storefront/pages/${i}/preview-link/`,{method:"POST",token:s}),claimPageEditLock:(i,s,a,m=!1)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:a,takeover:m}),token:s}),releasePageEditLock:(i,s)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"DELETE",token:s}),createTemplate:(i,s,a)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:i,layout:s}),headers:G,token:a}),getTemplate:(i,s)=>t(`/api/storefront/page-templates/${i}/`,{token:s}),saveTemplateLayout:(i,s,a)=>t(`/api/storefront/page-templates/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:G,token:a}),listTemplatePages:async(i,s)=>{let a=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}`,{token:s});return h(a)},getPageLibrary:async i=>{let s=await t("/api/storefront/page-templates/?is_page_library=true&is_active=true",{token:i});return h(s)[0]??null},getTemplateLibrary:(i,s)=>t(`/api/storefront/pages/template-library/?site=${encodeURIComponent(i)}`,{token:s}),createPageFromTemplate:(i,s)=>t(`/api/storefront/pages/from-template/${n?"?draft=1":""}`,{method:"POST",body:JSON.stringify(i),token:s}),findTemplatePageBySlug:async(i,s,a)=>{let m=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}&slug=${encodeURIComponent(s)}`,{token:a});return h(m)[0]??null},createTemplatePage:(i,s,a)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:i,...s}),headers:G,token:a}),saveTemplatePageLayout:(i,s,a)=>t(`/api/storefront/template-pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:G,token:a}),deleteTemplatePage:(i,s,a)=>t(`/api/storefront/template-pages/${i}/`,{method:"DELETE",token:s,...a?.keepalive?{keepalive:!0}:{}}),listPages:async(i,s)=>{let a=new URLSearchParams({no_page:"true"});s&&a.set("site",s);let m=await t(`/api/storefront/pages/?${a.toString()}`,{token:i});return h(m)},createPage:(i,s,a,m)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:i,slug:s,layout:a}),token:m}),deletePage:(i,s)=>t(`/api/storefront/pages/${i}/`,{method:"DELETE",token:s}),getHeaderSettings:(i,s)=>t(r(s),{token:i}),listMenus:async(i,s)=>{let a=new URLSearchParams({no_page:"true"});s&&a.set("site",s);let m=await t(`/api/storefront/menus/?${a}`,{token:i});return h(m)},listBlogPosts:async(i,s={})=>{let a=new URLSearchParams({no_page:"true"});s.visibleOnly&&a.set("is_visible","true"),s.siteId&&a.set("site",s.siteId);let m=await t(`/api/storefront/blog-posts/?${a.toString()}`,{token:i});return h(m)},listFieldUsage:async(i,s)=>{let a=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(s)}`,{token:i});return Array.isArray(a?.entries)?a.entries:[]},listCategories:async(i,s={})=>{let a=new URLSearchParams({no_page:"true"});s.visibleOnly&&a.set("is_visible","true"),s.siteId&&a.set("site",s.siteId);let m=await t(`/api/storefront/categories/?${a.toString()}`,{token:i});return[...h(m)].sort((w,U)=>w.sort_order-U.sort_order||w.name.localeCompare(U.name))},listForms:async(i,s={})=>{let a=new URLSearchParams({no_page:"true"});s.siteId&&a.set("site",s.siteId);let m=await t(`/api/storefront/forms/?${a.toString()}`,{token:i});return[...h(m)].sort((w,U)=>w.title.localeCompare(U.title))},listWheelSummaries:async(i,s={})=>{let a=new URLSearchParams;s.siteId&&a.set("site",s.siteId);let m=a.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${m?`?${m}`:""}`,{token:i});return b(g)},listProducts:async(i,s={})=>{let a=new URLSearchParams;s.kinds?.length&&a.set("kind",s.kinds.join(",")),s.siteId&&a.set("site",s.siteId);let m=a.toString(),g=await t(`/api/storefront/products/${m?`?${m}`:""}`,{token:i});return b(g)},getWheelDetail:async(i,s,a={})=>{let m=new URLSearchParams({slug:s});return a.siteId&&m.set("site",a.siteId),C(b(await t(`/api/storefront/wheel-curations/detail/?${m.toString()}`,{token:i})))},updateHeaderSettings:(i,s,a)=>t(r(a),{method:"PATCH",body:JSON.stringify(i),token:s}),getSite:(i,s)=>t(H(i),{token:s}),listSites:async i=>{let s=await t("/api/storefront/sites/?no_page=true",{token:i});return h(s)},listSiteCurrencies:async(i,s)=>{let a=await t(wn(i),{token:s});return Array.isArray(a)?a:[]},publishSite:(i,s)=>t(`${H(i)}publish/`,{method:"POST",token:s}),getSiteLiveState:(i,s)=>t(`${H(i)}live-state/`,{token:s}),getThemeSettings:(i,s)=>t(o(s),{token:i}),updateThemeSettings:(i,s,a)=>t(o(a),{method:"PATCH",body:JSON.stringify(i),token:s}),getMyPreferences:async i=>(await t("/api/auth/me/",{token:i})).preferences??{},updateMyPreferences:(i,s)=>t("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:i}),token:s}),getChatSettings:(i,s)=>t(l(s),{token:i}),updateChatSettings:(i,s,a)=>t(l(a),{method:"PATCH",body:JSON.stringify(i),token:s}),getSocialSettings:(i,s)=>t(p(s),{token:i}),updateSocialSettings:(i,s,a)=>t(p(a),{method:"PATCH",body:JSON.stringify(i),token:s}),uploadHeaderLogo:(i,s,a)=>{let m=new FormData;return m.append("logo",i),t(r(a),{method:"PATCH",body:m,token:s})},clearHeaderLogo:(i,s)=>t(r(s),{method:"PATCH",body:JSON.stringify({logo:null}),token:i}),setHeaderLogoFromAsset:(i,s,a)=>t(r(a),{method:"PATCH",body:JSON.stringify({logo_asset_id:i}),token:s}),uploadMedia:async(i,s)=>{let a=new FormData;return a.append("file",i),t(An(),{method:"POST",body:a,token:s})},listMedia:async(i,s)=>{let a=new URLSearchParams({no_page:"true"});s&&a.set("kind",s);let m=await t(`/api/storefront/media-assets/?${a.toString()}`,{token:i});return h(m)}}}var Jr=Tn({siteDrafts:!0});function _n(e){let t=e.trim();return t?`/api/v1/dealers?${new URLSearchParams({near:t}).toString()}`:"/api/v1/dealers"}async function Yr(e){return xe(await c(_n(e)))}var _={audience:null,baseUrl:""};async function Zr(e,t){return ve(await c(Ie(e,t),_))}async function Vr(e){return Be(await c(Fe,{..._,method:"POST",body:JSON.stringify(e)}))}async function jr(e){try{let t=await c($e,{..._,method:"POST",body:JSON.stringify({token:e})});return Q(202,t)}catch(t){if(t instanceof S)return Q(t.status,t.data);throw t}}async function Qr(e,t){await c(Me,{..._,method:"POST",body:JSON.stringify({email:t.trim(),...e?{product:e}:{}})})}async function Xr(e,t){await c(We,{..._,method:"POST",body:JSON.stringify({email:t.trim(),...e?{product:e}:{}})})}async function zr(e){try{return Ke(await c(qe,{..._,method:"POST",body:JSON.stringify({token:e})}))}catch(t){if(t instanceof S&&Cn.has(t.status))return"";throw t}}var Cn=new Set([400,404,410]);export{q as a,h as b,ce as c,ue as d,R as e,yt as f,Z as g,_e as h,Ce as i,$n as j,Wn as k,qn as l,Kn as m,Yn as n,Ne as o,Ue as p,er as q,tr as r,P as s,De as t,Le as u,nr as v,rr as w,ir as x,sr as y,or as z,ar as A,lr as B,cr as C,ur as D,dr as E,pr as F,mr as G,gr as H,yr as I,hr as J,fr as K,Sr as L,M,Pr as N,br as O,wr as P,Rr as Q,Kt as R,S,te as T,X as U,Lr as V,Ir as W,c as X,on as Y,dt as Z,mn as _,gn as $,yn as aa,Sn as ba,$r as ca,Wr as da,qr as ea,ne as fa,Kr as ga,Jr as ha,Yr as ia,Zr as ja,Vr as ka,jr as la,Qr as ma,Xr as na,zr as oa};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as X,X as Bt,_ as Ht,aa as zt,ba as qt,da as W,g as $t}from"./chunk-TMSNT2CP.js";import{O as Dt,aa as et,ba as tt,da as Ft,ka as nt,la as Wt}from"./chunk-ZHEHF42C.js";import{j as q}from"./chunk-DFYWYSOT.js";import{qi as Pe,ri as Ut,uf as Ot}from"./chunk-PVRWP47B.js";import{c as Mt}from"./chunk-LY7GZJ6M.js";import{createContext as nr,useContext as Jt,useEffect as rr,useMemo as ve,useState as Qt}from"react";function Gt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ge(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 rt=4,Yo=1,jo={unit:"set",spares:0,spareSide:"left"};function Kt(e){return e.unit==="single"?1:rt+e.spares}function Yt(e,t){return[{partNumber:e.partNumber,wheels:Kt(t),prices:e.prices}]}function jt(e,t){let n=Kt(t)-rt;if(n<=0||e.length===0)return e;let r=er(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function er(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 ot(e){let t=typeof e.spares=="number"?e.spares:e.spare?1:0;return{unit:e.unit,spares:t,spareSide:e.spareSide??"left"}}function it(e,t){return t.spares>0?`${e} + spare`:e}function Xt(e){return e.unit==="single"?"Single":it(`Set of ${rt}`,e)}var Xo="data-add-to-basket",st=9,tr="en",Vt=new Map;function $e(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Vt.get(r);return o||(o=new Intl.NumberFormat(tr,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Vt.set(r,o)),o}function ee(e,t,n=0){return $e(t,0,n).format(e)}function Qo(e,t){return $e(t).format(e)}function Zo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=ee(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as ar}from"react/jsx-runtime";var or="storefront-country",Zt=or,at=nr(null);function ir(e){return en(e,"catalogue")}function sr(e){return en(e,"money")}function en(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return $e(o,t==="money"?i:0,i).format(r)}}function ri({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ve(()=>t??[],[t]),s=ve(()=>n??[],[n]),a=ve(()=>r||i.find(g=>g.isDefault)?.code||i[0]?.code||"",[r,i]),c=ve(()=>o||s.find(g=>g.isDefault)?.code||s[0]?.code||"",[o,s]),[u,m]=Qt(c),[C,p]=Qt(!1);rr(()=>{let g=q.getItem(Zt);g&&s.some(N=>N.code===g)&&m(g),p(!0)},[s]);function R(g){m(g),q.setItem(Zt,g)}let _=ve(()=>{let g=s.find(b=>b.code===u)??null,N=g?.currency,L=N&&i.some(b=>b.code===N)?N:a,D=ir(i),E=sr(i);return{country:u,currency:L,setCountry:R,currencies:i,countries:s,activeCountry:g,formatPrice:(b,F)=>D(b,F??L),formatMoney:(b,F)=>E(b,F??L),ready:C}},[u,i,s,a,C]);return ar(at.Provider,{value:_,children:e})}function tn(e){let t=Jt(at);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function oi(){return Jt(at)?.country??""}import{createContext as Yr,useCallback as k,useContext as jr,useEffect as $,useMemo as Pn,useRef as Q,useState as P}from"react";function nn(){return"/edit"}function on(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var sn="We'll confirm this discount when you place your order.",ui="Confirmed at checkout";function ci(e){return e&&(e.valid||e.deferred)?e.code:void 0}var rn="coupon_code: ";function di(e){return!(e instanceof X)||e.status!==400||!e.message.startsWith(rn)?null:e.message.slice(rn.length)}function lt(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 lr=["width","profile","rim"],mi={width:"Width",profile:"Profile",rim:"Rim"},ur=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,cr={width:[100,500],profile:[20,100],rim:[10,30]};function ut(e){let t=ur.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return lr.every(o=>{let[i,s]=cr[o];return n[o]>=i&&n[o]<=s})?n:null}function he(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function gi(e){return[he({width:e.width}),he({width:e.width,profile:e.profile}),he(e)]}function Ci(e){if(!e||e.year===null)return null;let{make:t,model:n,year:r,modification:o}=e;return!t||!n||!o?null:{make:t,model:n,year:r,modification:o}}function fr(e,t){let n=new URLSearchParams({make:t.make,model:t.model,year:String(t.year),modification:t.modification});return`/api/v1/tyres/${encodeURIComponent(e)}/fitment?${n.toString()}`}function we(e,t=""){return{vehicle:{...e,region:t},status:"unknown",oemSizes:[],variants:[]}}function pr(e,t){if(typeof t!="object"||t===null)return we(e);let n=t,r=typeof n.vehicle=="object"&&n.vehicle!==null?n.vehicle:{},o=typeof r.region=="string"?r.region:"",i=n.status;if(i!=="fits"&&i!=="doesNotFit")return we(e,o);let s=Array.isArray(n.variants)?n.variants.filter(a=>typeof a=="object"&&a!==null&&typeof a.sku=="string"&&typeof a.fits=="boolean"):[];return s.length===0?we(e,o):{vehicle:{make:typeof r.make=="string"?r.make:e.make,model:typeof r.model=="string"?r.model:e.model,year:typeof r.year=="number"?r.year:e.year,modification:typeof r.modification=="string"?r.modification:e.modification,region:o},status:i,oemSizes:Array.isArray(n.oemSizes)?n.oemSizes.filter(a=>typeof a=="string"):[],variants:s.map(a=>({sku:a.sku,size:typeof a.size=="string"?a.size:"",fits:a.fits}))}}async function Si(e,t){try{let n=await Bt(fr(e,t),{baseUrl:""});return pr(t,n)}catch(n){return n instanceof X&&n.status>=400&&n.status<500?we(t):{...we(t),failed:!0}}}function xi(e){if(!e)return[];let t=[];for(let n of[...e.frontTyres,...e.rearTyres]){let r=ut(n);if(!r)continue;let o=he(r);t.includes(o)||t.push(o)}return t}function Ei(e,t){if(t.length===0)return null;for(let n of e){let r=ut(n);if(!r)continue;let o=he(r);if(t.includes(o))return o}return null}function mr(e,t){if(!e||e.status==="unknown")return"unknown";let n=e.variants.find(r=>r.sku===t);return n?n.fits?"fits":"doesNotFit":"unknown"}var gr="/tyres";function an(e){return e?`${gr}/${e}`:null}function Be(e){let t=e.lastIndexOf(" ");return t===-1?{lead:"",accent:e}:{lead:e.slice(0,t+1),accent:e.slice(t+1)}}function hr(e,t){return Yt({partNumber:e.sku,prices:e.prices},t)}var yr="Tyre";function ln(e,t,n,r){return{id:`${e.slug}|${t.sku}|${n.unit}|${n.spares>0?"spare":"no-spare"}`,slug:e.slug,name:Be(e.name),process:e.brand||yr,positionNo:"01",config:[{label:t.size},{label:Xt(n)}],finishName:"",size:t.size,components:hr(t,n),qty:r,href:an(e.slug)??void 0,kind:"tyre",sku:t.sku,pack:n}}function Li(e){return e.kind==="tyre"}function Ni(e,t){let n=e.prices?.[t];return typeof n!="number"||!Number.isFinite(n)||n<=0?!1:e.inStock}import{parseOption as br}from"efficient-shell/format";function Cr(e){return(e.components??[]).reduce((n,r)=>n+r.wheels,0)>4}function Di(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(Cr)}var Sr=150,xr="Front + rear",Fi="L/R pair",Mi="Not handed",Er="L/R";function Pr(e){return e.et==null||e.rearEt==null?0:Math.abs(e.rearEt-e.et)}function vr(e){return Pr(e)>=Sr}function Ui(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(vr)}function un(e){return e.directional===!0}function Wi(e){return e.rearWidth!=null||e.rearEt!=null&&e.rearEt!==e.et}function $i(e){return{twoObjects:kr(e),handed:e.handed??!1,staggered:!1}}function Bi(e){let t=[e.twoObjects?xr:"",e.handed?Er:""].filter(Boolean);return t.length?t.join(" \xB7 "):null}function Hi(e){return e.handed}function wr(e){return new Set((e.components??[]).map(t=>t.partNumber)).size>1}function zi(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(wr)}function kr(e){return(e.setWheelCount??0)>4}var Rr=new Set(["boltPattern"]);function qi(e,t){return e&&Rr.has(t)}function Vi(e,t){return!e?.srcRight||!t||t!==e.src?null:e.srcRight}var Tr="per wheel";function Gi(e,t){return t?`${e} ${Tr}`:e}var _r=[{label:"Pair",value:"pair"},{label:"One wheel",value:"one"}],Lr="pair";function Ki(e){return br(_r,Lr,e)}var Nr="dually";function ct(e){let t=e.components.reduce((o,i)=>o+i.wheels,0)||4,n=e.kind,r=[n==="staggered"?"Staggered":n===Nr?"Dually":"",un(e)?"L/R":""].filter(Boolean);return r.length?`${r.join(" ")} set of ${t}`:`Set of ${t}`}function Ir(e,t){return[...new Set(e.filter(n=>!t||n.finishName===t).map(n=>n.size))]}function cn(e,t,n){if(!(!t||!n))return e.find(r=>r.finishName===t&&r.size===n)}function Ar(e){return e!=null&&e.inStock===!1}function Qi(e,t){return t?e.filter(n=>n.finishName===t&&Ar(n)):[]}function Zi(e,t,n){return t.findIndex((r,o)=>n[o]!==!1&&Ir(e,r).length>0)}function Ji(e){let t=new Set((e.sizePairs??[]).map(o=>`${o.diameter}x${o.width}`)),n=e.spec?.pcds??[],r=e.spec?.etRange??[];return t.size===1&&n.length<=1&&(r.length===0||r[0]===r[r.length-1])}var fn="alloy-wheel",Or="tyre";function He(e){return e.name||e.slug||"An item from your cart"}async function pn(e,t){let n=[],r=new Map;for(let s of e){if(!s.slug){n.push(He(s));continue}let a=s.kind??fn,c=`${a}\0${s.slug}`,u=r.get(c);u?u.snaps.push(s):r.set(c,{kind:a,slug:s.slug,snaps:[s]})}let o=await Promise.all([...r.values()].map(s=>Dr(s,t))),i=[];for(let s of o)for(let a of s)a.ok?i.push(a.line):n.push(a.name);return{lines:i,dropped:n}}function dn(e){if(e instanceof X&&e.status===404)return null;throw e}async function Dr(e,t){let n=e.snaps.map(r=>({ok:!1,name:He(r)}));if(e.kind===fn){let r=await t.getWheel(e.slug).catch(dn);return r?e.snaps.map(o=>Fr(e.slug,r,o)):n}if(e.kind===Or){let r=await t.getTyre(e.slug).catch(dn);return r?e.snaps.map(o=>Mr(r,o)):n}return n}function Fr(e,t,n){let r=cn(t.variants,n.finish,n.size);if(!r)return{ok:!1,name:He(n)};let o=n.pack?ot(n.pack):void 0,i=(o?.spares??0)>0;return{ok:!0,line:{id:`${e}|${r.finishName}|${r.size}${i?"|spare":""}|restored`,slug:e,name:Be(t.name),process:t.process,positionNo:"01",config:[{label:r.size},{label:r.finishName,gold:!0},{label:o?it(ct(r),o):ct(r)}],finishName:r.finishName,size:r.size,components:o&&i?jt(r.components,o):r.components,qty:n.qty,...i?{pack:o}:{}}}}function Mr(e,t){let n={ok:!1,name:He(t)};if(!t.pack||!t.sku)return n;let r=ot(t.pack),o=e.variants.find(i=>i.sku===t.sku);return o?{ok:!0,line:ln(e,o,r,t.qty)}:n}var ze="Price on request",ls="Request a quote",mn="from ",us="From ",cs="each",gn="Free",ds="Updating";function dt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ft(e,t){let n=e?.[t];return dt(n)?n:null}function fs(e,t,n,r){let o=ft(e,n),i=ft(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function ps(e,t,n,r){if(n==null&&r==null)return!0;let o=ft(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Ur={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function Wr(e,t,n){if(!dt(e))return Ur;let r=dt(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function ms(e,t,n=""){return!e.priced||e.unit==null?ze:`${n}${ee(e.unit,t)}`}function gs(e,t){return e.was==null?null:ee(e.was,t)}function $r(e,t,n=1){let r=ge(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,a)=>s+a.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Br={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function hs(e,t,n,r=1){let o=Wr(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=$r(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...Br,fromSetTotal:i}}function ys(e,t){return!e.priced||e.unit==null?ze:`${e.isFrom?mn:""}${ee(e.unit,t)}`}function bs(e,t){return e.was==null?null:ee(e.was,t)}function Cs(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let s=i.prices?.[t];if(typeof s!="number")return null;r+=s*i.quantity}let o=ee(r-n,t);return{was:ee(r,t),amount:e.savingIsFrom?`${mn}${o}`:o}}var Hr=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function hn(e){return Hr.test(e.trim())}var yn="sf:ga-purchases",zr=20;function Cn(){return typeof window>"u"||window.parent!==window}function ke(...e){try{if(Cn()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function qr(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:ge(e.components,t)??0,quantity:e.qty}}function pt(e,t){return e.filter(Re).map(n=>qr(n,t))}function ws(e){ke("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 Sn(e,t){let n=pt([e],t);n.length!==0&&ke("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function ks(e){let t=pt(e.lines,e.currency);t.length!==0&&ke("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var bn=new Set;function Vr(e){if(bn.has(e))return!1;bn.add(e);try{let t=JSON.parse(q.getItem(yn)??"[]");if(t.includes(e))return!1;q.setItem(yn,JSON.stringify([...t,e].slice(-zr)))}catch{}return!0}function Rs(e){let t=e.confirmation;if(Cn()||!Vr(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ke("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:pt(e.lines,n)}),e.adsSendTo&&ke("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Gr="Arranged after review",xn="Calculated at checkout",Kr=xn,Ls=xn;function En({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Ns(e){switch(e){case"arranged":return Gr;case"pending":return Kr;case"free":return gn;case"charged":return null}}import{jsx as Jr}from"react/jsx-runtime";var Xr=400,Qr=400,Zr=1500,mt="storefront-cart";function Re(e){return(e.components?.length??0)>0}function vn(e,t){return{code:e,valid:t.valid,deferred:on(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function kn(e,t){return ge(e.components,t)}function gt(e,t){let n=kn(e,t);return n===null?null:n*e.qty}function wn(e){return e!=="tyre"}var Rn=Yr(null);function Gs({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=tn(),[i,s]=P(t),[a,c]=P([]),[u,m]=P([]),[C,p]=P([]),[R,_]=P(!1),g=Q(new Set),[N,L]=P([]),[D,E]=P(!1),[b,F]=P(null),[V,re]=P(null),[de,y]=P(null),[v,S]=P(0),M=k(()=>S(l=>l+1),[]),[oe,be]=P(void 0),[G,Ie]=P(null),[w,U]=P(null),[K,ie]=P(!1),[O,fe]=P(null),se=Q(void 0),Y=k(()=>s(!0),[]),Z=k(()=>s(!1),[]),Ae=k(()=>s(l=>!l),[]);$(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&Y()},[Y,t]);let B=nn(),j=Q(B);$(()=>{j.current!==B&&(j.current=B,t||Z())},[B,t,Z]);let Oe=k(l=>{Ie(f=>f?.country===l?.country&&f?.subdivision===l?.subdivision&&f?.postcode===l?.postcode?f:l)},[]),A=k((l,f)=>{E(!0),!(!f||!wn(l))&&L(d=>d.includes(f)?d:[...d,f])},[]),De=D||a.length>0,ae=Q(!0);$(()=>(ae.current=!0,()=>{ae.current=!1}),[]),$(()=>{if(t)return;let l=[...N,...a.filter(d=>wn(d.kind)).map(d=>d.slug)],f=[...new Set(l)].filter(d=>d&&!g.current.has(d));if(f.length!==0){for(let d of f)g.current.add(d);W.listWheelsBySlug(f).then(d=>{if(!ae.current||d.length===0)return;let h=new Set(d.map(x=>x.slug));m(x=>[...x.filter(ue=>!h.has(ue.slug)),...d])})}},[t,N,a]),$(()=>{if(t||!De||R)return;let l=!0;return W.listBundles().then(f=>{l&&(p(f),_(!0))}),()=>{l=!1}},[t,De,R]);let H=b?.deliveryOptions??[],Ce=b?.courier??null;$(()=>{b&&fe(l=>l&&H.some(f=>f.id===l)?l:H[0]?.id??null)},[b]);let le=k(()=>a.filter(Re).flatMap(l=>Gt(l.components,l.qty)),[a]),Se=k(async(l,f)=>{let d=l.trim().toUpperCase();if(!d)return;let h=le();if(h.length===0){U({code:d,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),se.current=f;try{let x=await W.validateCoupon({code:d,items:h,currency:n,shippingMethodId:O??void 0,customerEmail:f});U(vn(d,x))}catch{U({code:d,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[le,n,O]),pe=k(()=>{U(null),se.current=void 0},[]),Fe=k(l=>{if(!w)return;let{code:f}=w;U(d=>d&&d.code===f?{code:f,valid:!1,refused:!0,message:l}:d)},[w]);$(()=>{if(!w||w.refused)return;let l=w.code,f=h=>h!==null&&h.code===l&&!h.refused,d=setTimeout(async()=>{let h=le();if(h.length===0){U(x=>f(x)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:x);return}ie(!0);try{let x=await W.validateCoupon({code:l,items:h,currency:n,shippingMethodId:O??void 0,customerEmail:se.current});U(ue=>f(ue)?vn(l,x):ue)}catch{}finally{ie(!1)}},Xr);return()=>clearTimeout(d)},[a,n,O]);let xe=w&&!w.refused?w.code:void 0;$(()=>{if(t)return;let l=!0,f=a,d=setTimeout(async()=>{let h=le();if(h.length===0){F(null),re(null),be(void 0);return}try{let x=await W.quoteCart({items:h,currency:n,shippingMethodId:O??void 0,couponCode:xe,customerEmail:se.current||void 0,country:G?.country||r||void 0,subdivision:G?.country&&G.subdivision||void 0,postcode:G?.country&&G.postcode||void 0});if(!l)return;F(x),re(f),y(null)}catch{if(!l)return;y(f)}be(xe)},Qr);return()=>{l=!1,clearTimeout(d)}},[a,n,O,xe,r,G,v]);let T=k(l=>{c(f=>{let d=f.findIndex(h=>h.id===l.id);return d===-1?[...f,l]:f.map((h,x)=>x===d?{...h,qty:Math.min(st,h.qty+l.qty)}:h)}),Sn(l,n)},[n]),J=k(l=>{c(f=>f.filter(d=>d.id!==l))},[]),Me=k((l,f)=>{let d=Math.max(1,Math.min(st,f));c(h=>h.map(x=>x.id===l?{...x,qty:d}:x))},[]),Ue=k(l=>{c(l)},[]),[Et,Xe]=P(!1),[Pt,Gn]=P([]),vt=Q(a);vt.current=a,$(()=>{if(t)return;let l=[];try{let d=JSON.parse(q.getItem(mt)??"[]");Array.isArray(d)&&(l=d)}catch{}if(l.length===0){Xe(!0);return}let f=!0;return pn(l,W).then(({lines:d,dropped:h})=>{f&&(vt.current.length===0&&(Ue(d),Gn(h)),Xe(!0))},d=>{f&&Xe(!0)}),()=>{f=!1}},[t,Ue]),$(()=>{if(t||!Et)return;let l=a.filter(Re);if(l.length===0){q.removeItem(mt);return}q.setItem(mt,JSON.stringify(lt(l,()=>"")))},[a,t,Et]);let[Ee,Kn]=P(null),wt=Q(null);wt.current=Ee;let z=Q(null),Qe=Q(""),kt=k((l,f)=>{let d=l.trim().toLowerCase();hn(d)&&Kn(h=>h&&h.email===d&&h.firstName===(f??"")?h:{email:d,firstName:f??""})},[]);$(()=>{if(t||!Ee)return;let l=lt(a.filter(Re),h=>gt(h,n)===null?ze:o(gt(h,n),n)),f={email:Ee.email,firstName:Ee.firstName,currency:n,items:l},d=JSON.stringify(f);if(d!==Qe.current)return z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{z.current=null,Qe.current=d,W.captureCart(f).catch(h=>{})},Zr),()=>{z.current&&(clearTimeout(z.current),z.current=null)}},[a,Ee,n,t]);let Rt=k(()=>{z.current&&(clearTimeout(z.current),z.current=null);let l=wt.current;l&&(Qe.current="",W.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Tt=Pn(()=>{let l=a.reduce((I,me)=>{let We=gt(me,n);return We===null?I:I+We},0),f=a.some(I=>kn(I,n)===null),d=a.reduce((I,me)=>I+me.qty,0),h=w?.valid?w.effects:void 0,x=h?Math.min(l,Number(h.discountAmount)):0,ue=b?.bundleDiscount??0,jn=b?.appliedBundles??[],Ze=!!h?.freeShipping,It=H.find(I=>I.id===O),At=Ze?0:b?.shipping??It?.amount??0,Xn=En({quoted:b!==null,optionCount:H.length,chosenAmount:It?.amount,couponWaivesFreight:Ze}),Je={};for(let I of h?.freeUnits??[])Je[I.partNumber]=(Je[I.partNumber]??0)+I.quantity;let Qn=b?.tax??null,Zn=b?b.grandTotal:l-x-ue+At;return{sets:d,units:a.reduce((I,me)=>I+(me.components??[]).reduce((We,Jn)=>We+Jn.wheels*me.qty,0),0),subtotal:l,hasUnpricedLine:f,discount:x,bundleDiscount:ue,appliedBundles:jn,shipping:At,freeShipping:Ze,shippingStatus:Xn,freeUnitsByPartNumber:Je,tax:Qn,grand:Zn,repricing:!!w?.refused&&b!==null&&oe===w?.code,quoted:b!==null&&V===a,serverSubtotal:b?.subtotal??null,quoteFailed:de===a,currency:n}},[a,n,w,H,O,b,oe,V,de]),_t=Q(!0),Lt=k(l=>{_t.current=l},[]),Nt=k(l=>{T(l),_t.current&&Y()},[T,Y]),Yn=Pn(()=>({isOpen:i,preview:t,open:Y,close:Z,toggle:Ae,items:a,catalog:u,bundles:C,warmCatalog:A,add:T,addAndOpen:Nt,setAutoOpen:Lt,remove:J,setQty:Me,replaceItems:Ue,restoreDropped:Pt,identify:kt,clearCapturedCart:Rt,coupon:w,applyCoupon:Se,removeCoupon:pe,refuseCoupon:Fe,couponBusy:K,deliveryOptions:H,setQuoteDestination:Oe,courier:Ce,requote:M,shippingMethodId:O,setShippingMethodId:fe,totals:Tt}),[i,t,Y,Z,Ae,a,u,C,A,T,Nt,Lt,J,Me,Ue,Pt,kt,Rt,w,Se,pe,Fe,K,H,Oe,Ce,M,O,Tt]);return Jr(Rn.Provider,{value:Yn,children:e})}function Tn(){let e=jr(Rn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as uo}from"react";function _n(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function Ln(e,t,n,r){for(;e.size>=t;){let o,i;for(let[a,c]of e){if(c.expiresAt<=r){o=a;break}i===void 0&&n(a)&&(i=a)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var eo=6e4,to=5e3,no=500,qe=new Map;async function ro(e){let{host:t,matchesRequestHost:n}=await Ht();if(!t)return"";let r=await zt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function Nn(e,t){if(await qt()!==null)return t();let n=await ro(e);if(!n)return t();let r=Date.now(),o=qe.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",a=s?to:eo,c=qe.get(n)?.lastGood,u=i.outcome.state==="ok"?i:s?c:void 0,m=s&&u?u:i;return Ln(qe,no,_n,r),qe.set(n,{load:m,expiresAt:r+a,lastGood:u}),m}var oo=404;function io(e){if(e instanceof X&&e.status===oo)return{state:"absent"};let t=e instanceof X?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var so="[storefront:chrome-load-failed]";function ao(e,t){console.error(`${so} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function In(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=io(o);return i.state==="failed"&&ao(e,i),{value:n,outcome:i}}}function lo(e){return e==="production"?"silent":"banner"}var ea=lo("production");function co(e,t){return e?.trim()||t}function la({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=co(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var fo={name:Pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:nt},ua=uo(async()=>Nn("site",()=>In("site",async()=>{let e=await W.getSite();return{name:Ut(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Wt(e.socialLinks)}},fo)));var ca={name:Pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:nt};import{jsx as po}from"react/jsx-runtime";function fa({tone:e="bad",role:t,children:n}){return po("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as _e,jsxs as ht}from"react/jsx-runtime";import{useEffect as Ve,useId as yo,useRef as On,useState as Ge}from"react";import{useRootIsDark as bo}from"efficient-shell/theme";import{efficientClientOpen as mo}from"efficient-easel/screen/lib/session";var Te=new Map,go=64;async function ho(e){if(!mo())return null;try{let t=await fetch(`${Mt()}/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 An(e){let t=Te.get(e);if(t)return t;let n=ho(e);if(Te.set(e,n),Te.size>go){let r=Te.keys().next();r.done||Te.delete(r.value)}return n}var Co=202/22,So=.88,Na=16,xo="invert(1)";function Ia({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:s,inkIsDark:a,size:c="medium",sizePx:u,sizeUnit:m,wordmark:C,siteName:p=Pe,fitToContainer:R=!1,fitWordmarkToContainer:_=!1,fitFloorPx:g,hideClass:N,hideAttrs:L,part:D}){let E=C&&C.trim()?C.trim():p,[b,F]=Ge(null),V=On(null),re=T=>{V.current=T};Ve(()=>{F(V.current?.ownerDocument??null)},[]);let de=!bo({doc:b,whenUnset:!0}),y=n&&n.trim()?n.trim():null,v=!!y&&$t(y),S=i??(de&&t),M=o&&o.trim()?o.trim():null,oe=r&&!M,be=`logo-color-${yo().replace(/[^A-Za-z0-9_-]/g,"")}`,G=oe&&v&&y&&s!=null?{reversed:s,inkIsDark:a??null}:null,Ie=G!==null,[w,U]=Ge(null);Ve(()=>{if(!oe||!y||!v||Ie){U(null);return}let T=!1;return U(null),An(y).then(J=>{T||U(J)}),()=>{T=!0}},[oe,y,v,Ie]);let K=G??w,ie=!!K&&K.inkIsDark!==null&&(S?!K.inkIsDark:K.inkIsDark),O=oe&&!!y&&!v&&!S,fe=ie&&K?K.reversed:y,se=fe?[fe]:[],[Y,Z]=Ge(0);Ve(()=>{Z(0)},[y,ie]);let Ae=e==="footer"?tt:et[c],B=u&&u>0?u:Ae,j=(u&&u>0?Ot(u,m,"size",Ft):null)??`${B}px`,Oe=Math.round(B*Co),A=Y<se.length?se[Y]:null,[De,ae]=Ge(fe),H=A!==null&&A===De,Ce=On(null);Ve(()=>{let T=Ce.current;if(!T||!T.complete)return;if(T.naturalWidth>0||T.naturalHeight>0){ae(A);return}let J=!1;return T.decode().then(()=>!J&&ae(A),()=>!J&&Z(Me=>Me+1)),()=>{J=!0}},[A]);let le=R||_,Se=`calc(100cqi / ${((E.length+1)*So).toFixed(2)})`,pe=le&&g&&g>0?j===`${B}px`?`${Math.min(g,B)}px`:`min(${g}px, ${j})`:null,Fe=le?pe===null?`min(${j}, ${Se})`:`clamp(${pe}, ${Se}, ${j})`:j,xe=ht("span",{className:`font-display font-bold tracking-[0.18em] ${pe===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Fe,lineHeight:1,...M?{color:M}:{}},"aria-label":E,children:[E,_e("span",{className:"text-accent",style:M?{color:M}:void 0,children:"."})]});return ht("span",{ref:re,className:Dt("inline-flex items-center",N??""),...L,...D,children:[!H&&xe,M&&A&&_e("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:ht("filter",{id:be,colorInterpolationFilters:"sRGB",children:[_e("feFlood",{style:{floodColor:M}}),_e("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),A&&_e("img",{ref:Ce,src:A,alt:E,width:Oe,height:B,className:"shrink-0 object-contain",style:{...H?{height:j,width:"auto",...R?{maxWidth:"100cqi"}:{}}:{display:"none"},...O?{filter:xo}:{},...M?{filter:`url(#${be})`}:{}},onLoad:()=>ae(A),onError:()=>Z(T=>T+1)},A)]})}var Oa="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",Dn="w-0 min-w-0 flex-1",Da="w-0 min-w-[7rem] flex-1";import{jsx as Le,jsxs as Po}from"react/jsx-runtime";function Eo({spokes:e,mesh:t=!1,className:n}){let s=c=>Math.round(c*1e3)/1e3,a=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(a.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;a.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 Po("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:[Le("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Le("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),a.map((c,u)=>Le("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var Wa="#c9a461",Fn=[{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"}],$a={name:"",color:"var(--fg)",family:"silver",src:""};function vo(e,t){let n=r=>{let o=Fn.findIndex(i=>i.f===r);return o===-1?Fn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Ba(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(vo)}import{useEffect as wo,useRef as Mn,useState as ko}from"react";import{jsx as ce,jsxs as yt}from"react/jsx-runtime";function Ro({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=Tn(),[s,a]=ko(""),c=Mn(!1),u=Mn(null);wo(()=>{!c.current||n===null||(c.current=!1,u.current?.focus())},[n]);async function m(){t||i||!s.trim()||(c.current=!0,await r(s,e),a(""))}return yt("div",{className:"flex flex-col gap-2",children:[n===null?yt("div",{className:"flex border border-line",children:[ce("input",{type:"text",value:s,onChange:C=>a(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),m())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:`${Dn} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),ce("button",{type:"button",onClick:()=>{m()},disabled:i||t,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:i?"\u2026":"Apply"})]}):yt("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ce("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&ce("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&ce("button",{ref:u,type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?ce("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:sn}):n&&!n.valid&&n.message&&ce("p",{role:"alert",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var bt="Ads on. Shopper can opt out.",Ke="Ads and analytics off until Accept",To={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:bt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Ke,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function _o(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function ja(e,t,n){let r=_o(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Xa={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var Lo={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var No=Lo;function el(e=No){if(e.asked)return e.ads?"granted":"denied"}function nl(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as Ao,isValidElement as Oo,useEffect as Wn,useId as Do,useLayoutEffect as Hn,useRef as te,useState as $n}from"react";var Ye=(e,t)=>!!e[t]&&!e[t].disabled;function Ct(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Ye(e,i))return i}return t}function St(e,t){return Ct(e,t===1?-1:e.length,t)}function xt(e,t){return Ye(e,t)?t:Math.max(St(e,1),0)}function Un(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(),a=n.findIndex((c,u)=>Ye(n,u)&&c.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:a>=0?a: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:Ct(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ct(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:St(n,1)}),handled:!0};case"End":return{state:i({focus:St(n,-1)}),handled:!0};case"Enter":case" ":return Ye(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Fo}from"efficient-shell/ui";import{Fragment as zo,jsx as ne,jsxs as zn}from"react/jsx-runtime";var Bn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Mo({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,a]=$n(!1),c=r!==void 0,u=c?r:s,[m,C]=$n(0),p=te({text:"",timer:0}),R=te(null),_=te(null),g=te(null),N=Do(),L=te(null),D=e.findIndex(y=>y.value===t),E=y=>{y!==u&&(c||a(y),y?o?.():i?.())},b=y=>{let v=e[y];!v||v.disabled||(n(v.value),E(!1),_.current?.focus())},F=y=>{let v={open:u,focus:u?m:xt(e,D),typed:p.current.text},S=Un(v,y,e);return!S.handled&&S.state.open===u?!1:(S.state.typed!==v.typed&&(p.current.text=S.state.typed,window.clearTimeout(p.current.timer),p.current.timer=window.setTimeout(()=>{p.current.text=""},500)),C(S.state.focus),S.commit!==void 0?b(S.commit):E(S.state.open),S.refocus&&_.current?.focus(),S.handled)},V=te(F);V.current=F;let re=te(()=>E(!1));re.current=()=>E(!1);let de=y=>{u||(L.current=y.nativeEvent,V.current(y.key)&&y.preventDefault())};return Wn(()=>{if(!u)return;let y=S=>{R.current?.contains(S.target)||re.current()},v=S=>{S!==L.current&&V.current(S.key)&&S.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",v)}},[u]),Wn(()=>{u&&(p.current.text||C(xt(e,D)))},[u]),Hn(()=>{if(!u||!g.current)return;g.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>E(!u),close:()=>E(!1),focusIdx:m,setFocusIdx:C,pick:y=>b(e.findIndex(v=>v.value===y)),wrapRef:R,triggerRef:_,listRef:g,listId:N,onTriggerKeyDown:de,activeId:u?`${N}-${m}`:void 0}}var Uo={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Bn.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Bn.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Wo(e,t){Hn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let s=n.offsetParent??n.parentElement;if(!s)return;let a=s.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-a.right)<Math.abs(c.left-a.left)?"end":"start",m=Fo({trigger:{left:a.left,right:a.right,top:a.top,bottom:a.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(m.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let p=m.top+Math.min(c.height,m.maxHeight);i.marginBottom=`${Math.max(0,a.top-p)}px`}m.maxHeight<c.height&&(i.maxHeight=`${m.maxHeight}px`,i.overflowY="auto");let C=m.left-c.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function $o(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Bo({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:a,ariaLabel:c,align:u="start"}){let m=Uo[t],C=te(null);return Wo(C,n.length),ne("ul",{ref:p=>{C.current=p,a&&(a.current=p)},id:e,role:"listbox","aria-label":c,...m.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?$o(m.list):m.list,children:n.map((p,R)=>{let _=p.value===r;return ne("li",{id:`${e}-${R}`,role:"option","aria-selected":_,"aria-disabled":p.disabled||void 0,onMouseEnter:()=>!p.disabled&&i(R),onMouseDown:g=>{g.preventDefault(),p.disabled||s(p.value)},className:m.item(R===o,_&&p.value!=="",!!p.disabled,R===n.length-1),style:m.itemStyle?.(_),children:p.meta===void 0?p.label:zn(zo,{children:[p.lead,ne("span",{className:"flex-1 whitespace-nowrap",children:p.label}),ne("span",{className:"ml-auto text-[12px] opacity-50",children:p.meta})]})},`${p.value}_${R}`)})})}function Ho({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:a,"aria-label":c,align:u}){let m=Ao.toArray(r).flatMap(g=>{if(!Oo(g))return[];if(g.type!=="option")return[];let L=g.props,D=L.value!==void 0?String(L.value):"",E=L.children,b=typeof E=="string"||typeof E=="number"?String(E):D;return[{value:D,label:b,disabled:!!L.disabled}]}),C=e??"",p=Mo({items:m,value:C,onPick:g=>t?.({target:{value:g}})}),_=m.find(g=>g.value===C)?.label??m[0]?.label??"";return zn("div",{ref:p.wrapRef,className:"relative",children:[s&&ne("input",{type:"hidden",name:s,value:C}),ne("button",{ref:g=>{p.triggerRef.current=g},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":p.open,"aria-controls":p.open?p.listId:void 0,"aria-activedescendant":p.activeId,"aria-label":c,id:a,onClick:()=>!n&&p.toggle(),onKeyDown:g=>!n&&p.onTriggerKeyDown(g),className:`block w-full ${o??""}`,style:i,children:ne("span",{className:"block w-full truncate text-left",children:_})}),p.open&&ne(Bo,{id:p.listId,tone:"select",items:m,value:C,focusIdx:p.focusIdx,onFocus:p.setFocusIdx,onPick:p.pick,listRef:p.listRef,align:u})]})}import{jsx as Ne,jsxs as je}from"react/jsx-runtime";var qo="font-mono text-[length:var(--size-label,12px)]",Vo="font-semibold uppercase tracking-[0.22em] text-fg";function qn(e){return`${e??qo} ${Vo}`}function Vn(){return Ne("span",{className:"text-accent",children:" *"})}function Go({children:e,required:t,labelFace:n}){return je("span",{className:qn(n),children:[e,t?Ne(Vn,{}):null]})}function Ko({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:s,children:a}){let c=s?`flex flex-col gap-2 ${s}`:"flex flex-col gap-2",u=n?Ne("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?je("div",{className:c,children:[je("label",{htmlFor:o,className:qn(i),children:[e,t?Ne(Vn,{}):null]}),a,u]}):je("label",{htmlFor:o,className:c,children:[Ne(Go,{required:t,labelFace:i,children:e}),a]})}export{nn as a,ui as b,ci as c,di as d,Gt as e,rt as f,Yo as g,jo as h,jt as i,er as j,it as k,Xt as l,Xo as m,st as n,$e as o,ee as p,Qo as q,Zo as r,lr as s,mi as t,ut as u,he as v,gi as w,Ci as x,we as y,Si as z,xi as A,Ei as B,mr as C,an as D,Be as E,hr as F,ln as G,Li as H,Ni as I,Cr as J,Di as K,Fi as L,Mi as M,Ui as N,un as O,Wi as P,$i as Q,Bi as R,Hi as S,zi as T,qi as U,Vi as V,Tr as W,Gi as X,_r as Y,Lr as Z,Ki as _,ct as $,cn as aa,Ar as ba,Qi as ca,Zi as da,Ji as ea,ze as fa,ls as ga,mn as ha,us as ia,cs as ja,gn as ka,ds as la,ft as ma,fs as na,ps as oa,Wr as pa,ms as qa,gs as ra,$r as sa,hs as ta,ys as ua,bs as va,Cs as wa,hn as xa,ws as ya,ks as za,Rs as Aa,Ls as Ba,Ns as Ca,ri as Da,tn as Ea,oi as Fa,Re as Ga,gt as Ha,Gs as Ia,Tn as Ja,la as Ka,fo as La,ca as Ma,Oa as Na,Dn as Oa,Da as Pa,Eo as Qa,Wa as Ra,Fn as Sa,$a as Ta,vo as Ua,Ba as Va,Ro as Wa,fa as Xa,Na as Ya,Ia as Za,To as _a,ja as $a,Xa as ab,Lo as bb,el as cb,nl as db,Mo as eb,Bo as fb,Ho as gb,Go as hb,Ko as ib};
|
|
1
|
+
import{S as X,X as Bt,_ as Ht,aa as zt,ba as qt,da as W,g as $t}from"./chunk-VUFE7ACW.js";import{O as Dt,aa as et,ba as tt,da as Ft,ka as nt,la as Wt}from"./chunk-BLDYFJQ6.js";import{j as q}from"./chunk-ZV2GXEDX.js";import{qi as Pe,ri as Ut,uf as Ot}from"./chunk-3ZZ3Z6U5.js";import{c as Mt}from"./chunk-D5HXXBSX.js";import{createContext as nr,useContext as Jt,useEffect as rr,useMemo as ve,useState as Qt}from"react";function Gt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ge(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 rt=4,Yo=1,jo={unit:"set",spares:0,spareSide:"left"};function Kt(e){return e.unit==="single"?1:rt+e.spares}function Yt(e,t){return[{partNumber:e.partNumber,wheels:Kt(t),prices:e.prices}]}function jt(e,t){let n=Kt(t)-rt;if(n<=0||e.length===0)return e;let r=er(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function er(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 ot(e){let t=typeof e.spares=="number"?e.spares:e.spare?1:0;return{unit:e.unit,spares:t,spareSide:e.spareSide??"left"}}function it(e,t){return t.spares>0?`${e} + spare`:e}function Xt(e){return e.unit==="single"?"Single":it(`Set of ${rt}`,e)}var Xo="data-add-to-basket",st=9,tr="en",Vt=new Map;function $e(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Vt.get(r);return o||(o=new Intl.NumberFormat(tr,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Vt.set(r,o)),o}function ee(e,t,n=0){return $e(t,0,n).format(e)}function Qo(e,t){return $e(t).format(e)}function Zo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=ee(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as ar}from"react/jsx-runtime";var or="storefront-country",Zt=or,at=nr(null);function ir(e){return en(e,"catalogue")}function sr(e){return en(e,"money")}function en(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return $e(o,t==="money"?i:0,i).format(r)}}function ri({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ve(()=>t??[],[t]),s=ve(()=>n??[],[n]),a=ve(()=>r||i.find(g=>g.isDefault)?.code||i[0]?.code||"",[r,i]),c=ve(()=>o||s.find(g=>g.isDefault)?.code||s[0]?.code||"",[o,s]),[u,m]=Qt(c),[C,p]=Qt(!1);rr(()=>{let g=q.getItem(Zt);g&&s.some(N=>N.code===g)&&m(g),p(!0)},[s]);function R(g){m(g),q.setItem(Zt,g)}let _=ve(()=>{let g=s.find(b=>b.code===u)??null,N=g?.currency,L=N&&i.some(b=>b.code===N)?N:a,D=ir(i),E=sr(i);return{country:u,currency:L,setCountry:R,currencies:i,countries:s,activeCountry:g,formatPrice:(b,F)=>D(b,F??L),formatMoney:(b,F)=>E(b,F??L),ready:C}},[u,i,s,a,C]);return ar(at.Provider,{value:_,children:e})}function tn(e){let t=Jt(at);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function oi(){return Jt(at)?.country??""}import{createContext as Yr,useCallback as k,useContext as jr,useEffect as $,useMemo as Pn,useRef as Q,useState as P}from"react";function nn(){return"/edit"}function on(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var sn="We'll confirm this discount when you place your order.",ui="Confirmed at checkout";function ci(e){return e&&(e.valid||e.deferred)?e.code:void 0}var rn="coupon_code: ";function di(e){return!(e instanceof X)||e.status!==400||!e.message.startsWith(rn)?null:e.message.slice(rn.length)}function lt(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 lr=["width","profile","rim"],mi={width:"Width",profile:"Profile",rim:"Rim"},ur=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,cr={width:[100,500],profile:[20,100],rim:[10,30]};function ut(e){let t=ur.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return lr.every(o=>{let[i,s]=cr[o];return n[o]>=i&&n[o]<=s})?n:null}function he(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function gi(e){return[he({width:e.width}),he({width:e.width,profile:e.profile}),he(e)]}function Ci(e){if(!e||e.year===null)return null;let{make:t,model:n,year:r,modification:o}=e;return!t||!n||!o?null:{make:t,model:n,year:r,modification:o}}function fr(e,t){let n=new URLSearchParams({make:t.make,model:t.model,year:String(t.year),modification:t.modification});return`/api/v1/tyres/${encodeURIComponent(e)}/fitment?${n.toString()}`}function we(e,t=""){return{vehicle:{...e,region:t},status:"unknown",oemSizes:[],variants:[]}}function pr(e,t){if(typeof t!="object"||t===null)return we(e);let n=t,r=typeof n.vehicle=="object"&&n.vehicle!==null?n.vehicle:{},o=typeof r.region=="string"?r.region:"",i=n.status;if(i!=="fits"&&i!=="doesNotFit")return we(e,o);let s=Array.isArray(n.variants)?n.variants.filter(a=>typeof a=="object"&&a!==null&&typeof a.sku=="string"&&typeof a.fits=="boolean"):[];return s.length===0?we(e,o):{vehicle:{make:typeof r.make=="string"?r.make:e.make,model:typeof r.model=="string"?r.model:e.model,year:typeof r.year=="number"?r.year:e.year,modification:typeof r.modification=="string"?r.modification:e.modification,region:o},status:i,oemSizes:Array.isArray(n.oemSizes)?n.oemSizes.filter(a=>typeof a=="string"):[],variants:s.map(a=>({sku:a.sku,size:typeof a.size=="string"?a.size:"",fits:a.fits}))}}async function Si(e,t){try{let n=await Bt(fr(e,t),{baseUrl:""});return pr(t,n)}catch(n){return n instanceof X&&n.status>=400&&n.status<500?we(t):{...we(t),failed:!0}}}function xi(e){if(!e)return[];let t=[];for(let n of[...e.frontTyres,...e.rearTyres]){let r=ut(n);if(!r)continue;let o=he(r);t.includes(o)||t.push(o)}return t}function Ei(e,t){if(t.length===0)return null;for(let n of e){let r=ut(n);if(!r)continue;let o=he(r);if(t.includes(o))return o}return null}function mr(e,t){if(!e||e.status==="unknown")return"unknown";let n=e.variants.find(r=>r.sku===t);return n?n.fits?"fits":"doesNotFit":"unknown"}var gr="/tyres";function an(e){return e?`${gr}/${e}`:null}function Be(e){let t=e.lastIndexOf(" ");return t===-1?{lead:"",accent:e}:{lead:e.slice(0,t+1),accent:e.slice(t+1)}}function hr(e,t){return Yt({partNumber:e.sku,prices:e.prices},t)}var yr="Tyre";function ln(e,t,n,r){return{id:`${e.slug}|${t.sku}|${n.unit}|${n.spares>0?"spare":"no-spare"}`,slug:e.slug,name:Be(e.name),process:e.brand||yr,positionNo:"01",config:[{label:t.size},{label:Xt(n)}],finishName:"",size:t.size,components:hr(t,n),qty:r,href:an(e.slug)??void 0,kind:"tyre",sku:t.sku,pack:n}}function Li(e){return e.kind==="tyre"}function Ni(e,t){let n=e.prices?.[t];return typeof n!="number"||!Number.isFinite(n)||n<=0?!1:e.inStock}import{parseOption as br}from"efficient-shell/format";function Cr(e){return(e.components??[]).reduce((n,r)=>n+r.wheels,0)>4}function Di(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(Cr)}var Sr=150,xr="Front + rear",Fi="L/R pair",Mi="Not handed",Er="L/R";function Pr(e){return e.et==null||e.rearEt==null?0:Math.abs(e.rearEt-e.et)}function vr(e){return Pr(e)>=Sr}function Ui(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(vr)}function un(e){return e.directional===!0}function Wi(e){return e.rearWidth!=null||e.rearEt!=null&&e.rearEt!==e.et}function $i(e){return{twoObjects:kr(e),handed:e.handed??!1,staggered:!1}}function Bi(e){let t=[e.twoObjects?xr:"",e.handed?Er:""].filter(Boolean);return t.length?t.join(" \xB7 "):null}function Hi(e){return e.handed}function wr(e){return new Set((e.components??[]).map(t=>t.partNumber)).size>1}function zi(e){return e.kind==="alloy-wheel"&&(e.source.variants??[]).some(wr)}function kr(e){return(e.setWheelCount??0)>4}var Rr=new Set(["boltPattern"]);function qi(e,t){return e&&Rr.has(t)}function Vi(e,t){return!e?.srcRight||!t||t!==e.src?null:e.srcRight}var Tr="per wheel";function Gi(e,t){return t?`${e} ${Tr}`:e}var _r=[{label:"Pair",value:"pair"},{label:"One wheel",value:"one"}],Lr="pair";function Ki(e){return br(_r,Lr,e)}var Nr="dually";function ct(e){let t=e.components.reduce((o,i)=>o+i.wheels,0)||4,n=e.kind,r=[n==="staggered"?"Staggered":n===Nr?"Dually":"",un(e)?"L/R":""].filter(Boolean);return r.length?`${r.join(" ")} set of ${t}`:`Set of ${t}`}function Ir(e,t){return[...new Set(e.filter(n=>!t||n.finishName===t).map(n=>n.size))]}function cn(e,t,n){if(!(!t||!n))return e.find(r=>r.finishName===t&&r.size===n)}function Ar(e){return e!=null&&e.inStock===!1}function Qi(e,t){return t?e.filter(n=>n.finishName===t&&Ar(n)):[]}function Zi(e,t,n){return t.findIndex((r,o)=>n[o]!==!1&&Ir(e,r).length>0)}function Ji(e){let t=new Set((e.sizePairs??[]).map(o=>`${o.diameter}x${o.width}`)),n=e.spec?.pcds??[],r=e.spec?.etRange??[];return t.size===1&&n.length<=1&&(r.length===0||r[0]===r[r.length-1])}var fn="alloy-wheel",Or="tyre";function He(e){return e.name||e.slug||"An item from your cart"}async function pn(e,t){let n=[],r=new Map;for(let s of e){if(!s.slug){n.push(He(s));continue}let a=s.kind??fn,c=`${a}\0${s.slug}`,u=r.get(c);u?u.snaps.push(s):r.set(c,{kind:a,slug:s.slug,snaps:[s]})}let o=await Promise.all([...r.values()].map(s=>Dr(s,t))),i=[];for(let s of o)for(let a of s)a.ok?i.push(a.line):n.push(a.name);return{lines:i,dropped:n}}function dn(e){if(e instanceof X&&e.status===404)return null;throw e}async function Dr(e,t){let n=e.snaps.map(r=>({ok:!1,name:He(r)}));if(e.kind===fn){let r=await t.getWheel(e.slug).catch(dn);return r?e.snaps.map(o=>Fr(e.slug,r,o)):n}if(e.kind===Or){let r=await t.getTyre(e.slug).catch(dn);return r?e.snaps.map(o=>Mr(r,o)):n}return n}function Fr(e,t,n){let r=cn(t.variants,n.finish,n.size);if(!r)return{ok:!1,name:He(n)};let o=n.pack?ot(n.pack):void 0,i=(o?.spares??0)>0;return{ok:!0,line:{id:`${e}|${r.finishName}|${r.size}${i?"|spare":""}|restored`,slug:e,name:Be(t.name),process:t.process,positionNo:"01",config:[{label:r.size},{label:r.finishName,gold:!0},{label:o?it(ct(r),o):ct(r)}],finishName:r.finishName,size:r.size,components:o&&i?jt(r.components,o):r.components,qty:n.qty,...i?{pack:o}:{}}}}function Mr(e,t){let n={ok:!1,name:He(t)};if(!t.pack||!t.sku)return n;let r=ot(t.pack),o=e.variants.find(i=>i.sku===t.sku);return o?{ok:!0,line:ln(e,o,r,t.qty)}:n}var ze="Price on request",ls="Request a quote",mn="from ",us="From ",cs="each",gn="Free",ds="Updating";function dt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ft(e,t){let n=e?.[t];return dt(n)?n:null}function fs(e,t,n,r){let o=ft(e,n),i=ft(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function ps(e,t,n,r){if(n==null&&r==null)return!0;let o=ft(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Ur={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function Wr(e,t,n){if(!dt(e))return Ur;let r=dt(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function ms(e,t,n=""){return!e.priced||e.unit==null?ze:`${n}${ee(e.unit,t)}`}function gs(e,t){return e.was==null?null:ee(e.was,t)}function $r(e,t,n=1){let r=ge(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,a)=>s+a.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Br={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function hs(e,t,n,r=1){let o=Wr(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=$r(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...Br,fromSetTotal:i}}function ys(e,t){return!e.priced||e.unit==null?ze:`${e.isFrom?mn:""}${ee(e.unit,t)}`}function bs(e,t){return e.was==null?null:ee(e.was,t)}function Cs(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let s=i.prices?.[t];if(typeof s!="number")return null;r+=s*i.quantity}let o=ee(r-n,t);return{was:ee(r,t),amount:e.savingIsFrom?`${mn}${o}`:o}}var Hr=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function hn(e){return Hr.test(e.trim())}var yn="sf:ga-purchases",zr=20;function Cn(){return typeof window>"u"||window.parent!==window}function ke(...e){try{if(Cn()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function qr(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:ge(e.components,t)??0,quantity:e.qty}}function pt(e,t){return e.filter(Re).map(n=>qr(n,t))}function ws(e){ke("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 Sn(e,t){let n=pt([e],t);n.length!==0&&ke("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function ks(e){let t=pt(e.lines,e.currency);t.length!==0&&ke("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var bn=new Set;function Vr(e){if(bn.has(e))return!1;bn.add(e);try{let t=JSON.parse(q.getItem(yn)??"[]");if(t.includes(e))return!1;q.setItem(yn,JSON.stringify([...t,e].slice(-zr)))}catch{}return!0}function Rs(e){let t=e.confirmation;if(Cn()||!Vr(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ke("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:pt(e.lines,n)}),e.adsSendTo&&ke("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Gr="Arranged after review",xn="Calculated at checkout",Kr=xn,Ls=xn;function En({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Ns(e){switch(e){case"arranged":return Gr;case"pending":return Kr;case"free":return gn;case"charged":return null}}import{jsx as Jr}from"react/jsx-runtime";var Xr=400,Qr=400,Zr=1500,mt="storefront-cart";function Re(e){return(e.components?.length??0)>0}function vn(e,t){return{code:e,valid:t.valid,deferred:on(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function kn(e,t){return ge(e.components,t)}function gt(e,t){let n=kn(e,t);return n===null?null:n*e.qty}function wn(e){return e!=="tyre"}var Rn=Yr(null);function Gs({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=tn(),[i,s]=P(t),[a,c]=P([]),[u,m]=P([]),[C,p]=P([]),[R,_]=P(!1),g=Q(new Set),[N,L]=P([]),[D,E]=P(!1),[b,F]=P(null),[V,re]=P(null),[de,y]=P(null),[v,S]=P(0),M=k(()=>S(l=>l+1),[]),[oe,be]=P(void 0),[G,Ie]=P(null),[w,U]=P(null),[K,ie]=P(!1),[O,fe]=P(null),se=Q(void 0),Y=k(()=>s(!0),[]),Z=k(()=>s(!1),[]),Ae=k(()=>s(l=>!l),[]);$(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&Y()},[Y,t]);let B=nn(),j=Q(B);$(()=>{j.current!==B&&(j.current=B,t||Z())},[B,t,Z]);let Oe=k(l=>{Ie(f=>f?.country===l?.country&&f?.subdivision===l?.subdivision&&f?.postcode===l?.postcode?f:l)},[]),A=k((l,f)=>{E(!0),!(!f||!wn(l))&&L(d=>d.includes(f)?d:[...d,f])},[]),De=D||a.length>0,ae=Q(!0);$(()=>(ae.current=!0,()=>{ae.current=!1}),[]),$(()=>{if(t)return;let l=[...N,...a.filter(d=>wn(d.kind)).map(d=>d.slug)],f=[...new Set(l)].filter(d=>d&&!g.current.has(d));if(f.length!==0){for(let d of f)g.current.add(d);W.listWheelsBySlug(f).then(d=>{if(!ae.current||d.length===0)return;let h=new Set(d.map(x=>x.slug));m(x=>[...x.filter(ue=>!h.has(ue.slug)),...d])})}},[t,N,a]),$(()=>{if(t||!De||R)return;let l=!0;return W.listBundles().then(f=>{l&&(p(f),_(!0))}),()=>{l=!1}},[t,De,R]);let H=b?.deliveryOptions??[],Ce=b?.courier??null;$(()=>{b&&fe(l=>l&&H.some(f=>f.id===l)?l:H[0]?.id??null)},[b]);let le=k(()=>a.filter(Re).flatMap(l=>Gt(l.components,l.qty)),[a]),Se=k(async(l,f)=>{let d=l.trim().toUpperCase();if(!d)return;let h=le();if(h.length===0){U({code:d,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),se.current=f;try{let x=await W.validateCoupon({code:d,items:h,currency:n,shippingMethodId:O??void 0,customerEmail:f});U(vn(d,x))}catch{U({code:d,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[le,n,O]),pe=k(()=>{U(null),se.current=void 0},[]),Fe=k(l=>{if(!w)return;let{code:f}=w;U(d=>d&&d.code===f?{code:f,valid:!1,refused:!0,message:l}:d)},[w]);$(()=>{if(!w||w.refused)return;let l=w.code,f=h=>h!==null&&h.code===l&&!h.refused,d=setTimeout(async()=>{let h=le();if(h.length===0){U(x=>f(x)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:x);return}ie(!0);try{let x=await W.validateCoupon({code:l,items:h,currency:n,shippingMethodId:O??void 0,customerEmail:se.current});U(ue=>f(ue)?vn(l,x):ue)}catch{}finally{ie(!1)}},Xr);return()=>clearTimeout(d)},[a,n,O]);let xe=w&&!w.refused?w.code:void 0;$(()=>{if(t)return;let l=!0,f=a,d=setTimeout(async()=>{let h=le();if(h.length===0){F(null),re(null),be(void 0);return}try{let x=await W.quoteCart({items:h,currency:n,shippingMethodId:O??void 0,couponCode:xe,customerEmail:se.current||void 0,country:G?.country||r||void 0,subdivision:G?.country&&G.subdivision||void 0,postcode:G?.country&&G.postcode||void 0});if(!l)return;F(x),re(f),y(null)}catch{if(!l)return;y(f)}be(xe)},Qr);return()=>{l=!1,clearTimeout(d)}},[a,n,O,xe,r,G,v]);let T=k(l=>{c(f=>{let d=f.findIndex(h=>h.id===l.id);return d===-1?[...f,l]:f.map((h,x)=>x===d?{...h,qty:Math.min(st,h.qty+l.qty)}:h)}),Sn(l,n)},[n]),J=k(l=>{c(f=>f.filter(d=>d.id!==l))},[]),Me=k((l,f)=>{let d=Math.max(1,Math.min(st,f));c(h=>h.map(x=>x.id===l?{...x,qty:d}:x))},[]),Ue=k(l=>{c(l)},[]),[Et,Xe]=P(!1),[Pt,Gn]=P([]),vt=Q(a);vt.current=a,$(()=>{if(t)return;let l=[];try{let d=JSON.parse(q.getItem(mt)??"[]");Array.isArray(d)&&(l=d)}catch{}if(l.length===0){Xe(!0);return}let f=!0;return pn(l,W).then(({lines:d,dropped:h})=>{f&&(vt.current.length===0&&(Ue(d),Gn(h)),Xe(!0))},d=>{f&&Xe(!0)}),()=>{f=!1}},[t,Ue]),$(()=>{if(t||!Et)return;let l=a.filter(Re);if(l.length===0){q.removeItem(mt);return}q.setItem(mt,JSON.stringify(lt(l,()=>"")))},[a,t,Et]);let[Ee,Kn]=P(null),wt=Q(null);wt.current=Ee;let z=Q(null),Qe=Q(""),kt=k((l,f)=>{let d=l.trim().toLowerCase();hn(d)&&Kn(h=>h&&h.email===d&&h.firstName===(f??"")?h:{email:d,firstName:f??""})},[]);$(()=>{if(t||!Ee)return;let l=lt(a.filter(Re),h=>gt(h,n)===null?ze:o(gt(h,n),n)),f={email:Ee.email,firstName:Ee.firstName,currency:n,items:l},d=JSON.stringify(f);if(d!==Qe.current)return z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{z.current=null,Qe.current=d,W.captureCart(f).catch(h=>{})},Zr),()=>{z.current&&(clearTimeout(z.current),z.current=null)}},[a,Ee,n,t]);let Rt=k(()=>{z.current&&(clearTimeout(z.current),z.current=null);let l=wt.current;l&&(Qe.current="",W.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Tt=Pn(()=>{let l=a.reduce((I,me)=>{let We=gt(me,n);return We===null?I:I+We},0),f=a.some(I=>kn(I,n)===null),d=a.reduce((I,me)=>I+me.qty,0),h=w?.valid?w.effects:void 0,x=h?Math.min(l,Number(h.discountAmount)):0,ue=b?.bundleDiscount??0,jn=b?.appliedBundles??[],Ze=!!h?.freeShipping,It=H.find(I=>I.id===O),At=Ze?0:b?.shipping??It?.amount??0,Xn=En({quoted:b!==null,optionCount:H.length,chosenAmount:It?.amount,couponWaivesFreight:Ze}),Je={};for(let I of h?.freeUnits??[])Je[I.partNumber]=(Je[I.partNumber]??0)+I.quantity;let Qn=b?.tax??null,Zn=b?b.grandTotal:l-x-ue+At;return{sets:d,units:a.reduce((I,me)=>I+(me.components??[]).reduce((We,Jn)=>We+Jn.wheels*me.qty,0),0),subtotal:l,hasUnpricedLine:f,discount:x,bundleDiscount:ue,appliedBundles:jn,shipping:At,freeShipping:Ze,shippingStatus:Xn,freeUnitsByPartNumber:Je,tax:Qn,grand:Zn,repricing:!!w?.refused&&b!==null&&oe===w?.code,quoted:b!==null&&V===a,serverSubtotal:b?.subtotal??null,quoteFailed:de===a,currency:n}},[a,n,w,H,O,b,oe,V,de]),_t=Q(!0),Lt=k(l=>{_t.current=l},[]),Nt=k(l=>{T(l),_t.current&&Y()},[T,Y]),Yn=Pn(()=>({isOpen:i,preview:t,open:Y,close:Z,toggle:Ae,items:a,catalog:u,bundles:C,warmCatalog:A,add:T,addAndOpen:Nt,setAutoOpen:Lt,remove:J,setQty:Me,replaceItems:Ue,restoreDropped:Pt,identify:kt,clearCapturedCart:Rt,coupon:w,applyCoupon:Se,removeCoupon:pe,refuseCoupon:Fe,couponBusy:K,deliveryOptions:H,setQuoteDestination:Oe,courier:Ce,requote:M,shippingMethodId:O,setShippingMethodId:fe,totals:Tt}),[i,t,Y,Z,Ae,a,u,C,A,T,Nt,Lt,J,Me,Ue,Pt,kt,Rt,w,Se,pe,Fe,K,H,Oe,Ce,M,O,Tt]);return Jr(Rn.Provider,{value:Yn,children:e})}function Tn(){let e=jr(Rn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as uo}from"react";function _n(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function Ln(e,t,n,r){for(;e.size>=t;){let o,i;for(let[a,c]of e){if(c.expiresAt<=r){o=a;break}i===void 0&&n(a)&&(i=a)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var eo=6e4,to=5e3,no=500,qe=new Map;async function ro(e){let{host:t,matchesRequestHost:n}=await Ht();if(!t)return"";let r=await zt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function Nn(e,t){if(await qt()!==null)return t();let n=await ro(e);if(!n)return t();let r=Date.now(),o=qe.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",a=s?to:eo,c=qe.get(n)?.lastGood,u=i.outcome.state==="ok"?i:s?c:void 0,m=s&&u?u:i;return Ln(qe,no,_n,r),qe.set(n,{load:m,expiresAt:r+a,lastGood:u}),m}var oo=404;function io(e){if(e instanceof X&&e.status===oo)return{state:"absent"};let t=e instanceof X?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var so="[storefront:chrome-load-failed]";function ao(e,t){console.error(`${so} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function In(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=io(o);return i.state==="failed"&&ao(e,i),{value:n,outcome:i}}}function lo(e){return e==="production"?"silent":"banner"}var ea=lo("production");function co(e,t){return e?.trim()||t}function la({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=co(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var fo={name:Pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:nt},ua=uo(async()=>Nn("site",()=>In("site",async()=>{let e=await W.getSite();return{name:Ut(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Wt(e.socialLinks)}},fo)));var ca={name:Pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:nt};import{jsx as po}from"react/jsx-runtime";function fa({tone:e="bad",role:t,children:n}){return po("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as _e,jsxs as ht}from"react/jsx-runtime";import{useEffect as Ve,useId as yo,useRef as On,useState as Ge}from"react";import{useRootIsDark as bo}from"efficient-shell/theme";import{efficientClientOpen as mo}from"efficient-easel/screen/lib/session";var Te=new Map,go=64;async function ho(e){if(!mo())return null;try{let t=await fetch(`${Mt()}/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 An(e){let t=Te.get(e);if(t)return t;let n=ho(e);if(Te.set(e,n),Te.size>go){let r=Te.keys().next();r.done||Te.delete(r.value)}return n}var Co=202/22,So=.88,Na=16,xo="invert(1)";function Ia({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:s,inkIsDark:a,size:c="medium",sizePx:u,sizeUnit:m,wordmark:C,siteName:p=Pe,fitToContainer:R=!1,fitWordmarkToContainer:_=!1,fitFloorPx:g,hideClass:N,hideAttrs:L,part:D}){let E=C&&C.trim()?C.trim():p,[b,F]=Ge(null),V=On(null),re=T=>{V.current=T};Ve(()=>{F(V.current?.ownerDocument??null)},[]);let de=!bo({doc:b,whenUnset:!0}),y=n&&n.trim()?n.trim():null,v=!!y&&$t(y),S=i??(de&&t),M=o&&o.trim()?o.trim():null,oe=r&&!M,be=`logo-color-${yo().replace(/[^A-Za-z0-9_-]/g,"")}`,G=oe&&v&&y&&s!=null?{reversed:s,inkIsDark:a??null}:null,Ie=G!==null,[w,U]=Ge(null);Ve(()=>{if(!oe||!y||!v||Ie){U(null);return}let T=!1;return U(null),An(y).then(J=>{T||U(J)}),()=>{T=!0}},[oe,y,v,Ie]);let K=G??w,ie=!!K&&K.inkIsDark!==null&&(S?!K.inkIsDark:K.inkIsDark),O=oe&&!!y&&!v&&!S,fe=ie&&K?K.reversed:y,se=fe?[fe]:[],[Y,Z]=Ge(0);Ve(()=>{Z(0)},[y,ie]);let Ae=e==="footer"?tt:et[c],B=u&&u>0?u:Ae,j=(u&&u>0?Ot(u,m,"size",Ft):null)??`${B}px`,Oe=Math.round(B*Co),A=Y<se.length?se[Y]:null,[De,ae]=Ge(fe),H=A!==null&&A===De,Ce=On(null);Ve(()=>{let T=Ce.current;if(!T||!T.complete)return;if(T.naturalWidth>0||T.naturalHeight>0){ae(A);return}let J=!1;return T.decode().then(()=>!J&&ae(A),()=>!J&&Z(Me=>Me+1)),()=>{J=!0}},[A]);let le=R||_,Se=`calc(100cqi / ${((E.length+1)*So).toFixed(2)})`,pe=le&&g&&g>0?j===`${B}px`?`${Math.min(g,B)}px`:`min(${g}px, ${j})`:null,Fe=le?pe===null?`min(${j}, ${Se})`:`clamp(${pe}, ${Se}, ${j})`:j,xe=ht("span",{className:`font-display font-bold tracking-[0.18em] ${pe===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Fe,lineHeight:1,...M?{color:M}:{}},"aria-label":E,children:[E,_e("span",{className:"text-accent",style:M?{color:M}:void 0,children:"."})]});return ht("span",{ref:re,className:Dt("inline-flex items-center",N??""),...L,...D,children:[!H&&xe,M&&A&&_e("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:ht("filter",{id:be,colorInterpolationFilters:"sRGB",children:[_e("feFlood",{style:{floodColor:M}}),_e("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),A&&_e("img",{ref:Ce,src:A,alt:E,width:Oe,height:B,className:"shrink-0 object-contain",style:{...H?{height:j,width:"auto",...R?{maxWidth:"100cqi"}:{}}:{display:"none"},...O?{filter:xo}:{},...M?{filter:`url(#${be})`}:{}},onLoad:()=>ae(A),onError:()=>Z(T=>T+1)},A)]})}var Oa="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",Dn="w-0 min-w-0 flex-1",Da="w-0 min-w-[7rem] flex-1";import{jsx as Le,jsxs as Po}from"react/jsx-runtime";function Eo({spokes:e,mesh:t=!1,className:n}){let s=c=>Math.round(c*1e3)/1e3,a=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(a.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;a.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 Po("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:[Le("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Le("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),a.map((c,u)=>Le("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var Wa="#c9a461",Fn=[{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"}],$a={name:"",color:"var(--fg)",family:"silver",src:""};function vo(e,t){let n=r=>{let o=Fn.findIndex(i=>i.f===r);return o===-1?Fn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Ba(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(vo)}import{useEffect as wo,useRef as Mn,useState as ko}from"react";import{jsx as ce,jsxs as yt}from"react/jsx-runtime";function Ro({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=Tn(),[s,a]=ko(""),c=Mn(!1),u=Mn(null);wo(()=>{!c.current||n===null||(c.current=!1,u.current?.focus())},[n]);async function m(){t||i||!s.trim()||(c.current=!0,await r(s,e),a(""))}return yt("div",{className:"flex flex-col gap-2",children:[n===null?yt("div",{className:"flex border border-line",children:[ce("input",{type:"text",value:s,onChange:C=>a(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),m())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:`${Dn} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),ce("button",{type:"button",onClick:()=>{m()},disabled:i||t,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:i?"\u2026":"Apply"})]}):yt("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ce("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&ce("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&ce("button",{ref:u,type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?ce("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:sn}):n&&!n.valid&&n.message&&ce("p",{role:"alert",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var bt="Ads on. Shopper can opt out.",Ke="Ads and analytics off until Accept",To={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:bt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Ke,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function _o(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function ja(e,t,n){let r=_o(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Xa={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var Lo={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var No=Lo;function el(e=No){if(e.asked)return e.ads?"granted":"denied"}function nl(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as Ao,isValidElement as Oo,useEffect as Wn,useId as Do,useLayoutEffect as Hn,useRef as te,useState as $n}from"react";var Ye=(e,t)=>!!e[t]&&!e[t].disabled;function Ct(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Ye(e,i))return i}return t}function St(e,t){return Ct(e,t===1?-1:e.length,t)}function xt(e,t){return Ye(e,t)?t:Math.max(St(e,1),0)}function Un(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(),a=n.findIndex((c,u)=>Ye(n,u)&&c.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:a>=0?a: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:Ct(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ct(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:St(n,1)}),handled:!0};case"End":return{state:i({focus:St(n,-1)}),handled:!0};case"Enter":case" ":return Ye(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Fo}from"efficient-shell/ui";import{Fragment as zo,jsx as ne,jsxs as zn}from"react/jsx-runtime";var Bn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Mo({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,a]=$n(!1),c=r!==void 0,u=c?r:s,[m,C]=$n(0),p=te({text:"",timer:0}),R=te(null),_=te(null),g=te(null),N=Do(),L=te(null),D=e.findIndex(y=>y.value===t),E=y=>{y!==u&&(c||a(y),y?o?.():i?.())},b=y=>{let v=e[y];!v||v.disabled||(n(v.value),E(!1),_.current?.focus())},F=y=>{let v={open:u,focus:u?m:xt(e,D),typed:p.current.text},S=Un(v,y,e);return!S.handled&&S.state.open===u?!1:(S.state.typed!==v.typed&&(p.current.text=S.state.typed,window.clearTimeout(p.current.timer),p.current.timer=window.setTimeout(()=>{p.current.text=""},500)),C(S.state.focus),S.commit!==void 0?b(S.commit):E(S.state.open),S.refocus&&_.current?.focus(),S.handled)},V=te(F);V.current=F;let re=te(()=>E(!1));re.current=()=>E(!1);let de=y=>{u||(L.current=y.nativeEvent,V.current(y.key)&&y.preventDefault())};return Wn(()=>{if(!u)return;let y=S=>{R.current?.contains(S.target)||re.current()},v=S=>{S!==L.current&&V.current(S.key)&&S.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",v)}},[u]),Wn(()=>{u&&(p.current.text||C(xt(e,D)))},[u]),Hn(()=>{if(!u||!g.current)return;g.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>E(!u),close:()=>E(!1),focusIdx:m,setFocusIdx:C,pick:y=>b(e.findIndex(v=>v.value===y)),wrapRef:R,triggerRef:_,listRef:g,listId:N,onTriggerKeyDown:de,activeId:u?`${N}-${m}`:void 0}}var Uo={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Bn.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Bn.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Wo(e,t){Hn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let s=n.offsetParent??n.parentElement;if(!s)return;let a=s.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-a.right)<Math.abs(c.left-a.left)?"end":"start",m=Fo({trigger:{left:a.left,right:a.right,top:a.top,bottom:a.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(m.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let p=m.top+Math.min(c.height,m.maxHeight);i.marginBottom=`${Math.max(0,a.top-p)}px`}m.maxHeight<c.height&&(i.maxHeight=`${m.maxHeight}px`,i.overflowY="auto");let C=m.left-c.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function $o(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Bo({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:a,ariaLabel:c,align:u="start"}){let m=Uo[t],C=te(null);return Wo(C,n.length),ne("ul",{ref:p=>{C.current=p,a&&(a.current=p)},id:e,role:"listbox","aria-label":c,...m.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?$o(m.list):m.list,children:n.map((p,R)=>{let _=p.value===r;return ne("li",{id:`${e}-${R}`,role:"option","aria-selected":_,"aria-disabled":p.disabled||void 0,onMouseEnter:()=>!p.disabled&&i(R),onMouseDown:g=>{g.preventDefault(),p.disabled||s(p.value)},className:m.item(R===o,_&&p.value!=="",!!p.disabled,R===n.length-1),style:m.itemStyle?.(_),children:p.meta===void 0?p.label:zn(zo,{children:[p.lead,ne("span",{className:"flex-1 whitespace-nowrap",children:p.label}),ne("span",{className:"ml-auto text-[12px] opacity-50",children:p.meta})]})},`${p.value}_${R}`)})})}function Ho({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:a,"aria-label":c,align:u}){let m=Ao.toArray(r).flatMap(g=>{if(!Oo(g))return[];if(g.type!=="option")return[];let L=g.props,D=L.value!==void 0?String(L.value):"",E=L.children,b=typeof E=="string"||typeof E=="number"?String(E):D;return[{value:D,label:b,disabled:!!L.disabled}]}),C=e??"",p=Mo({items:m,value:C,onPick:g=>t?.({target:{value:g}})}),_=m.find(g=>g.value===C)?.label??m[0]?.label??"";return zn("div",{ref:p.wrapRef,className:"relative",children:[s&&ne("input",{type:"hidden",name:s,value:C}),ne("button",{ref:g=>{p.triggerRef.current=g},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":p.open,"aria-controls":p.open?p.listId:void 0,"aria-activedescendant":p.activeId,"aria-label":c,id:a,onClick:()=>!n&&p.toggle(),onKeyDown:g=>!n&&p.onTriggerKeyDown(g),className:`block w-full ${o??""}`,style:i,children:ne("span",{className:"block w-full truncate text-left",children:_})}),p.open&&ne(Bo,{id:p.listId,tone:"select",items:m,value:C,focusIdx:p.focusIdx,onFocus:p.setFocusIdx,onPick:p.pick,listRef:p.listRef,align:u})]})}import{jsx as Ne,jsxs as je}from"react/jsx-runtime";var qo="font-mono text-[length:var(--size-label,12px)]",Vo="font-semibold uppercase tracking-[0.22em] text-fg";function qn(e){return`${e??qo} ${Vo}`}function Vn(){return Ne("span",{className:"text-accent",children:" *"})}function Go({children:e,required:t,labelFace:n}){return je("span",{className:qn(n),children:[e,t?Ne(Vn,{}):null]})}function Ko({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:s,children:a}){let c=s?`flex flex-col gap-2 ${s}`:"flex flex-col gap-2",u=n?Ne("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?je("div",{className:c,children:[je("label",{htmlFor:o,className:qn(i),children:[e,t?Ne(Vn,{}):null]}),a,u]}):je("label",{htmlFor:o,className:c,children:[Ne(Go,{required:t,labelFace:i,children:e}),a]})}export{nn as a,ui as b,ci as c,di as d,Gt as e,rt as f,Yo as g,jo as h,jt as i,er as j,it as k,Xt as l,Xo as m,st as n,$e as o,ee as p,Qo as q,Zo as r,lr as s,mi as t,ut as u,he as v,gi as w,Ci as x,we as y,Si as z,xi as A,Ei as B,mr as C,an as D,Be as E,hr as F,ln as G,Li as H,Ni as I,Cr as J,Di as K,Fi as L,Mi as M,Ui as N,un as O,Wi as P,$i as Q,Bi as R,Hi as S,zi as T,qi as U,Vi as V,Tr as W,Gi as X,_r as Y,Lr as Z,Ki as _,ct as $,cn as aa,Ar as ba,Qi as ca,Zi as da,Ji as ea,ze as fa,ls as ga,mn as ha,us as ia,cs as ja,gn as ka,ds as la,ft as ma,fs as na,ps as oa,Wr as pa,ms as qa,gs as ra,$r as sa,hs as ta,ys as ua,bs as va,Cs as wa,hn as xa,ws as ya,ks as za,Rs as Aa,Ls as Ba,Ns as Ca,ri as Da,tn as Ea,oi as Fa,Re as Ga,gt as Ha,Gs as Ia,Tn as Ja,la as Ka,fo as La,ca as Ma,Oa as Na,Dn as Oa,Da as Pa,Eo as Qa,Wa as Ra,Fn as Sa,$a as Ta,vo as Ua,Ba as Va,Ro as Wa,fa as Xa,Na as Ya,Ia as Za,To as _a,ja as $a,Xa as ab,Lo as bb,el as cb,nl as db,Mo as eb,Bo as fb,Ho as gb,Go as hb,Ko as ib};
|