efficient-storefront-blocks 0.121.0 → 0.121.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/chunks/{EditorPreviewCheckout-EZWWWREG.js → EditorPreviewCheckout-CDSVQFZG.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-LHGHQTP7.js → SiteEditorProvider-6ZJ5MKW3.js} +1 -1
  4. package/dist/chunks/{chunk-R7AXTQVA.js → chunk-7D4OUJUE.js} +1 -1
  5. package/dist/chunks/{chunk-DRLNY2UU.js → chunk-ERY7GVI7.js} +1 -1
  6. package/dist/chunks/{chunk-RDOOARQX.js → chunk-HPCPOXEL.js} +1 -1
  7. package/dist/chunks/{chunk-4M5X72OG.js → chunk-PTRZMZVD.js} +1 -1
  8. package/dist/chunks/{fitment-data-62UVC7IY.js → fitment-data-SWQZTLG6.js} +1 -1
  9. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  10. package/dist/editor/components/MenuPicker.js +1 -1
  11. package/dist/index.js +28 -28
  12. package/dist/links.js +1 -1
  13. package/dist/render/components/BoxHeaderBar.js +1 -1
  14. package/dist/render/components/Events.js +1 -1
  15. package/dist/render/components/FitmentTable.js +1 -1
  16. package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
  17. package/dist/render/components/card-pieces/CardProductPicture.js +1 -1
  18. package/dist/render/components/useTyreCatalog.js +3 -3
  19. package/dist/render/components/useTyreDetail.d.ts +1 -0
  20. package/dist/render/components/useTyreDetail.js +1 -1
  21. package/dist/render/lib/api/index.d.ts +2 -0
  22. package/dist/render/lib/api/index.js +1 -1
  23. package/dist/render/lib/api/types.d.ts +62 -0
  24. package/dist/render/lib/content/title-look.js +1 -1
  25. package/dist/render/lib/document/card-templates.js +1 -1
  26. package/dist/render/lib/document/document-nodes.js +1 -1
  27. package/dist/render/lib/document/subscribe-content-type.js +1 -1
  28. package/dist/render/lib/sections/band-padding.d.ts +2 -0
  29. package/dist/render/lib/sections/band-padding.js +1 -1
  30. package/dist/render/lib/sections/gallery-frame.js +1 -1
  31. package/dist/render/lib/sections/hero-arrangement.d.ts +3 -1
  32. package/dist/render/lib/sections/hero-arrangement.js +1 -1
  33. package/dist/render/lib/sections/hero-gallery.js +1 -1
  34. package/dist/render/lib/sections/hero-price-placement.d.ts +2 -1
  35. package/dist/render/lib/sections/hero-price-placement.js +1 -1
  36. package/dist/render/lib/wheels/set-mode.js +1 -1
  37. package/package.json +1 -1
  38. /package/dist/chunks/{chunk-4M5X72OG.js.LEGAL.txt → chunk-PTRZMZVD.js.LEGAL.txt} +0 -0
package/dist/links.js CHANGED
@@ -1 +1 @@
1
- var y={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],pt=[...ue,"surface"];var ft={bold:y.bold.placeholder,italic:y.italic.placeholder,strike:y.strike.placeholder,code:y.code.placeholder,highlight:y.highlight.placeholder,quiet:y.quiet.placeholder,link:"link text",underline:y.underline.placeholder,sup:y.sup.placeholder,sub:y.sub.placeholder,color:"colored text",style:"styled text"};var pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var A=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],fe=["highlight","quiet"],dt=pe.map(e=>e.style).filter(e=>A.some(t=>t.kind===e)).filter(e=>!fe.includes(e)),mt=[...A,{open:"*",close:"*",kind:"accent"}],ht=[...A,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var yt=["http","https","mailto","tel"];function j(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||yt.includes(t[1].toLowerCase())}var de=["width","profile","rim"];var gt=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,bt={width:[100,500],profile:[20,100],rim:[10,30]};function W(e){let t=gt.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return de.every(o=>{let[s,i]=bt[o];return n[o]>=s&&n[o]<=i})?n:null}function _(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 me(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var x=["alloy-wheel","tyre"],he=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Cn=x.map(e=>({value:e,label:F[e]}));function ye(e){return e==null?[...he]:Array.isArray(e)?x.filter(t=>e.includes(t)):[...he]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function H(e){return m(e).brand??""}function ge(e){return m(e).prices??void 0}function be(e){return m(e).inStock!==!1}function Pe(e){let t=m(e),n=d(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function Y(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function Se(e){return Y(e).map(t=>t.family)}function ke(e){if(d(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function xe(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function we(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function Le(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function Te(e){if(d(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>W(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var G=e=>typeof e=="string"&&e?e:void 0;function V(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Oe(e,t){return Object.hasOwn(e,t)}var Ae=null;function _e(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Oe(t,r)?String(V(t,r)):n):e}function g(e,t){let n=Ae?V(Ae,e):void 0;if(typeof n=="function"){try{let r=G(n(t??{}));if(r)return r}catch{}return _e(e,t)}return _e(G(n)??e,t)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var E=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),jn=E(30,0,100,10),Wn=E(0,0,100,5),Hn=E(100,0,100,5),Yn=E(2,0,4,.5);function Fe(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Ee="homepage";var R=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function I(e){return e.offersCommerce&&e.offersService?R:R.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Re(e){return`${Z}${e}`}function Ie(e){return e.startsWith(Z)&&e.slice(Z.length).trim()||null}function b(e){return e===Ee?"/":`/${e}`}function N(e){return`/journal/${e}`}function v(e){return`/wheels/${e}`}function C(e,t){return`${b(e)}#${t}`}function M(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let s=Fe(o?.props?.anchor);if(!s)continue;let i=q(s);!i||t.has(i)||(t.add(i),n.push({slug:i,name:s}))}return n}function Ne(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var Pt=()=>({choosePage:g("Choose a page"),chooseSection:g("Choose a section"),noSections:g("No section anchors yet"),sectionHint:g("Jumps to a section on that page."),choosePost:g("Choose a post"),chooseProduct:g("Choose a product"),choosePopup:g("Choose a popup")});function K(e,t,n){if(!e)return"page";if(Ie(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ne(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function ve(e,t){let n=Pt(),r=e.pages.map(c=>({value:b(c.slug),label:c.title})),o=t?.pageOptions?t.pageOptions(r):r,s=o.map(c=>c.value),i=e.pages.map(c=>({label:c.title,options:M(...c.docs).map(u=>({value:C(c.slug,u.slug),label:u.name}))})).filter(c=>c.options.length>0),l=c=>{switch(c){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:i,placeholder:i.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:N(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Re(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=I(e.offers).map(c=>({value:c.value,label:g(c.label),target:l(c.value),...c.value==="anchor"?{hint:n.sectionHint}:{},...c.value==="blog"||c.value==="product"||c.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:a,rules:{kindOf:c=>K(c,s),targetOf:c=>c,readFilter:()=>null,withFilter:c=>c}};let p=c=>{let u=t.withFilter(c,null);return t.listingPaths.includes(u)?u:c};return{kinds:a,rules:{kindOf:c=>K(c,s,{listingPaths:t.listingPaths,targetOf:p}),targetOf:p,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:c=>t.listingPaths.includes(c)?t.filtersFor(c):null}}var Ce=Object.freeze([]);function X(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Me(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let s=o[n];if(typeof s!="number"||!Number.isFinite(s))continue;let i=r.get(o.fieldKey);(i===void 0||s<i)&&r.set(o.fieldKey,s)}return o=>o?r.get(o):void 0}function Ke(e,t,n,r){let o=new Map;for(let a of n){let p=a[r];typeof p=="number"&&o.set(a.fieldKey,p)}if(o.size===0)return e;let s=[],i=[];e.forEach((a,p)=>{let c=t(a);c&&(s.push(p),i.push({item:a,index:p,order:o.get(c)}))}),i.sort((a,p)=>a.order!==void 0&&p.order!==void 0?a.order-p.order||a.index-p.index:a.order!==void 0?-1:p.order!==void 0?1:a.index-p.index);let l=[...e];return s.forEach((a,p)=>{l[a]=i[p].item}),l.every((a,p)=>a===e[p])?e:l}function ze(e){return kt(e,"filter")}var St="collection";function Q(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":St},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function kt(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function xt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function $e(e,t){let n=e?.[t];return xt(n)?n:null}function De(e,t,n,r){if(n==null&&r==null)return!0;let o=$e(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}function Ue(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var wt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Rr=Object.keys(wt);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Lt={diameters:"tyreSizes"};function Tt(e){if(e.length===0)return[];let t=J.filter(n=>e.every(r=>ee[n].includes(r)));return t.filter(n=>{let r=Lt[n];return!r||!t.includes(r)})}function Ot(e){let t=new Set;for(let n of e)t.add(d(n));return[...t]}var Be={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function At(e,t,n,r=null,o="fail"){let s=d(e),i=l=>o==="fail"||(l==="lugs"?s==="alloy-wheel":ee[l].includes(s));if(r!=="kind"&&t.kind&&s!==t.kind)return!1;for(let l of J){if(r===l)continue;let a=t[l];if(a.length===0||!i(l))continue;let p=a.map(String);if(!je(e,l).some(c=>p.includes(c)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&i("lugs")){let l=Ue(e);if(l===null||!t.lugs.includes(l))return!1}return!(r!=="price"&&!De(ge(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!be(e))}var _t={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function je(e,t){switch(t){case"tyreSizes":return[...new Set(Te(e).flatMap(me))];case"brands":return H(e)?[H(e)]:[];case"finishes":return Se(e);case"diameters":return Pe(e).map(String);case"collections":return ke(e);case"pcds":return xe(e);case"tyreTypes":return we(e);case"speedRatings":return Le(e)}}function Ft(e){let t=new Map;for(let n of e)for(let r of Y(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function We(e,t,n,r=Ot(e),o=Ce,s="fail"){let i=u=>Rt(u,r,o),l=Ft(e),p=(s==="pass"?J.filter(u=>r.some(S=>ee[u].includes(S))):Tt(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let S=t[u].map(String),ce=new Set,B=new Map,O=new Map;for(let f of e){let P=je(f,u);for(let h of P)ce.add(h);for(let h of new Set(P))O.set(h,(O.get(h)??0)+1);if(At(f,t,n,u,s))for(let h of new Set(P))B.set(h,(B.get(h)??0)+1)}let ut=[...ce].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:B.get(f)??0,checked:S.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,P)=>{if(u==="diameters")return Number(f.value)-Number(P.value);let h=(O.get(P.value)??0)-(O.get(f.value)??0);return h!==0?h:f.value.localeCompare(P.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>Et),c=[];for(let u of p){let S=It(u.key,r,o);S!==void 0&&c.push({fieldKey:u.key,filterOrder:S})}return[...Ke(p,u=>u.key,c,"filterOrder")]}var Et=1;function He(e){return e.showCollection===!1?["collections"]:[]}function Rt(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>ze(X(n,r))(Q(e,r)))}function It(e,t,n){if(n.length===0)return;let r;for(let o of t){let s=Me(X(n,o),"filter")(Q(e,o));s!==void 0&&(r===void 0||s<r)&&(r=s)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},ne="type";var w=e=>!!e&&typeof e=="object"&&!Array.isArray(e),L=e=>w(e)&&typeof e.type=="string"&&w(e.props);var z=e=>Array.isArray(e)&&e.length>0&&e.every(L);function Nt(e){let t="";for(let n of e)t+=typeof n=="number"?`[${n}]`:t===""?n:`.${n}`;return t}function Ye(e,t){return t==="root"?e.root:e.components[t]}function Ge(e){return e?.fields??{}}function Ve(e,t){return Ge(Ye(e,t))}function qe(e,t){let n=[];return re(e,t,[],n),n}function re(e,t,n,r){for(let o of Object.keys(t)){let s=t[o];if(!s)continue;let i=[...n,o],l=e[o];if(s.type==="slot"){let a=Array.isArray(l);r.push({slot:Nt(i),segments:i,content:a?l:[],present:a})}else if(s.type==="object"&&s.objectFields&&w(l))re(l,s.objectFields,i,r);else if(s.type==="array"&&s.arrayFields&&Array.isArray(l)){let a=s.arrayFields;l.forEach((p,c)=>{w(p)&&re(p,a,[...i,c],r)})}}}function oe(e,t,n){return Ct(e,t,n).map(({slot:r,content:o})=>({slot:r,content:o}))}function $(e){let t=new TextEncoder,n=new Map(e.map(r=>[r,t.encode(r)]));return[...e].sort((r,o)=>{let s=n.get(r),i=n.get(o);if(s.length!==i.length)return s.length-i.length;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return s[l]-i[l];return 0})}function Ct(e,t,n){let r=qe(e.props,Ve(t,e.type));if(n?.order!=="stored")return r;let o=$(Object.keys(e.props)),s=i=>{let l=i.present?o.indexOf(String(i.segments[0])):-1;return l<0?Number.POSITIVE_INFINITY:l};return r.map((i,l)=>({loc:i,i:l,r:s(i)})).sort((i,l)=>i.r-l.r||i.i-l.i).map(({loc:i})=>i)}var Ze=["Text","ImageBlock","ButtonBlock","Flex"];function k(){return{type:"slot",allow:[...Ze]}}var Mt=Ze.filter(e=>e!=="ButtonBlock");function Xe(){return{type:"slot",allow:[...Mt]}}var Kt="boxes",Qe={CardList:{template:Xe()},Cards:{template:k()},FAQ:{template:k()},Flex:{rowTitle:{type:"slot",allow:["Text"]},content:{type:"slot"}},Footprint:{template:k()},Grid:{content:{type:"slot"}},Hero:{slides:{type:"slot",ownPictures:!0},strip:{type:"slot",allow:["Flex"]}},HeroGroup:{content:{type:"slot"}},HeroSingle:{boxes:{type:"slot",allow:["HeroGroup"]}},HeroSlide:{groups:{type:"slot",allow:["HeroGroup"]}},Logos:{logos:{type:"slot",allow:["LogoBlock"]},template:{type:"slot",allow:["LogoBlock"]}},OrderSummary:{template:k()},ProcessSteps:{[Kt]:{type:"slot"},template:k()}};var zt={},$t=null;function Dt(){let e=Object.fromEntries(Object.entries(Qe).map(([t,n])=>[t,{fields:n}]));return $t??={components:{...e,...zt}}}function Ut(e){let t=e.props??{},n=typeof e.type=="string"?e.type:"",r=Dt(),o=n!==""&&Object.prototype.hasOwnProperty.call(r.components,n)?oe({type:n,props:t},r).map(l=>l.slot).filter(l=>!l.includes(".")):[],s=o.filter(l=>z(t[l])),i=$(Object.keys(t).filter(l=>!o.includes(l)&&z(t[l])));return[...s,...i]}function Je(e,t){let n=null;for(let r of Ut(e)){let o=e.props[r],s=t(o,r);s!==o&&((n??={...e.props})[r]=s)}return n?{...e,props:n}:e}var et="FilterBlock";var tt="AlloyWheelsListing";function Bt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function jt(e){let t=[],n=(r,o)=>{let s=[r,...o];for(let i of r)L(i)&&(t.push({node:i,order:t.length,lists:s}),Je(i,l=>(n(l,s),l)))};for(let r of Bt(e))n(r,[]);return t}function nt(e){return jt(e).map(t=>t.node)}function rt(e){return j(e.trim())}var T="/wheels",D="Products";function ot(e,t){return t>1?`${D} \xB7 ${e}`:D}function se(...e){for(let t of[tt,et])for(let n of e){let r=nt({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function U(...e){return se(...e)!==null}function st(e,t){let n=e.filter(r=>U(...r.docs)).map(r=>b(r.slug));return t.fallback&&!n.includes(T)?[...n,T]:n}var ie=[ne,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function it(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Wt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function lt(e){let t=new URLSearchParams(it(e).query);for(let n of ie){let r=t.get(n);if(r)return{param:n,value:r}}return null}function le(e,t){let{path:n,query:r,hash:o}=it(e),s=r.split("&").filter(i=>i&&!ie.includes(Wt(i.split("=")[0])));return t?.value&&s.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${s.length?`?${s.join("&")}`:""}${o}`}function at(e,t){let n=le(e,null);return t.includes(n)?n:e}function Ht(e,t,n=[]){return K(e,t,{listingPaths:n,targetOf:r=>at(r,n)})}function Yt(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var ct="Product type",Gt="AUD";function ae(e,t){let n=t.listing??{},r=ye(n.kinds),o=e.filter(a=>r.includes(d(a))),s=He(n),i=We(o,Be,Gt,r,t.fieldUsage).filter(a=>!s.includes(a.key)).map(a=>({param:te[a.key],label:a.label,values:a.options.filter(p=>!p.value.includes(",")).map(p=>({value:p.value,label:p.label}))})).filter(a=>a.values.length>0),l=x.filter(a=>r.includes(a)&&o.some(p=>d(p)===a));return l.length>1&&i.unshift({param:ne,label:ct,values:l.map(a=>({value:a,label:F[a]}))}),i}function Vt(e){return t=>{let n=st(t,{fallback:e.offersCommerce}),r=t.filter(o=>U(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let s=o.map(i=>{let l=t.find(a=>b(a.slug)===i.value);return l&&U(...l.docs)?{...i,label:ot(l.title,r)}:i});return r===0&&e.offersCommerce&&!s.some(i=>i.value===T)&&s.push({value:T,label:D}),s},filtersFor:o=>{if(!n.includes(o))return null;let s=t.find(i=>b(i.slug)===o);return ae(e.catalogue,{listing:s?se(...s.docs):null,fieldUsage:e.fieldUsage})},readFilter:lt,withFilter:le}}}function qt(e){let t=Vt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=ve({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:v(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:rt},filtersFor:n.filtersFor??(()=>null)}}function Qo(e,t){return ae(e,t)}export{T as BUILT_IN_LISTING_PATH,R as LINK_KINDS,ie as LISTING_FILTER_PARAMS,D as LISTING_PAGE_LABEL,ct as PRODUCT_TYPE_FILTER_LABEL,C as anchorPath,Yt as fieldUsageFromAdminRows,Ht as inferLinkKind,U as isProductListingPage,rt as isSafeLink,I as linkKindsFor,qt as linkPickerSetup,Qo as listingFilterFields,se as listingNode,ot as listingPageLabel,at as listingTarget,M as pageAnchors,b as pagePath,N as postPath,st as productListingPaths,lt as readListingFilter,v as wheelPath,le as withListingFilter};
1
+ var y={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],pt=[...ue,"surface"];var ft={bold:y.bold.placeholder,italic:y.italic.placeholder,strike:y.strike.placeholder,code:y.code.placeholder,highlight:y.highlight.placeholder,quiet:y.quiet.placeholder,link:"link text",underline:y.underline.placeholder,sup:y.sup.placeholder,sub:y.sub.placeholder,color:"colored text",style:"styled text"};var pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var A=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],fe=["highlight","quiet"],dt=pe.map(e=>e.style).filter(e=>A.some(t=>t.kind===e)).filter(e=>!fe.includes(e)),mt=[...A,{open:"*",close:"*",kind:"accent"}],ht=[...A,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var yt=["http","https","mailto","tel"];function j(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||yt.includes(t[1].toLowerCase())}var de=["width","profile","rim"];var gt=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,bt={width:[100,500],profile:[20,100],rim:[10,30]};function W(e){let t=gt.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return de.every(o=>{let[s,i]=bt[o];return n[o]>=s&&n[o]<=i})?n:null}function _(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 me(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var x=["alloy-wheel","tyre"],he=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Cn=x.map(e=>({value:e,label:F[e]}));function ye(e){return e==null?[...he]:Array.isArray(e)?x.filter(t=>e.includes(t)):[...he]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function H(e){return m(e).brand??""}function ge(e){return m(e).prices??void 0}function be(e){return m(e).inStock!==!1}function Pe(e){let t=m(e),n=d(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function Y(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function Se(e){return Y(e).map(t=>t.family)}function ke(e){if(d(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function xe(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function we(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function Le(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function Te(e){if(d(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>W(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var G=e=>typeof e=="string"&&e?e:void 0;function V(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Oe(e,t){return Object.hasOwn(e,t)}var Ae=null;function _e(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Oe(t,r)?String(V(t,r)):n):e}function g(e,t){let n=Ae?V(Ae,e):void 0;if(typeof n=="function"){try{let r=G(n(t??{}));if(r)return r}catch{}return _e(e,t)}return _e(G(n)??e,t)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var E=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),jn=E(30,0,100,10),Wn=E(0,0,100,5),Hn=E(100,0,100,5),Yn=E(2,0,4,.5);function Fe(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Ee="homepage";var I=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function R(e){return e.offersCommerce&&e.offersService?I:I.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Ie(e){return`${Z}${e}`}function Re(e){return e.startsWith(Z)&&e.slice(Z.length).trim()||null}function b(e){return e===Ee?"/":`/${e}`}function N(e){return`/journal/${e}`}function v(e){return`/wheels/${e}`}function C(e,t){return`${b(e)}#${t}`}function M(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let s=Fe(o?.props?.anchor);if(!s)continue;let i=q(s);!i||t.has(i)||(t.add(i),n.push({slug:i,name:s}))}return n}function Ne(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var Pt=()=>({choosePage:g("Choose a page"),chooseSection:g("Choose a section"),noSections:g("No section anchors yet"),sectionHint:g("Jumps to a section on that page."),choosePost:g("Choose a post"),chooseProduct:g("Choose a product"),choosePopup:g("Choose a popup")});function K(e,t,n){if(!e)return"page";if(Re(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ne(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function ve(e,t){let n=Pt(),r=e.pages.map(c=>({value:b(c.slug),label:c.title})),o=t?.pageOptions?t.pageOptions(r):r,s=o.map(c=>c.value),i=e.pages.map(c=>({label:c.title,options:M(...c.docs).map(u=>({value:C(c.slug,u.slug),label:u.name}))})).filter(c=>c.options.length>0),l=c=>{switch(c){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:i,placeholder:i.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:N(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Ie(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=R(e.offers).map(c=>({value:c.value,label:g(c.label),target:l(c.value),...c.value==="anchor"?{hint:n.sectionHint}:{},...c.value==="blog"||c.value==="product"||c.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:a,rules:{kindOf:c=>K(c,s),targetOf:c=>c,readFilter:()=>null,withFilter:c=>c}};let p=c=>{let u=t.withFilter(c,null);return t.listingPaths.includes(u)?u:c};return{kinds:a,rules:{kindOf:c=>K(c,s,{listingPaths:t.listingPaths,targetOf:p}),targetOf:p,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:c=>t.listingPaths.includes(c)?t.filtersFor(c):null}}var Ce=Object.freeze([]);function X(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Me(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let s=o[n];if(typeof s!="number"||!Number.isFinite(s))continue;let i=r.get(o.fieldKey);(i===void 0||s<i)&&r.set(o.fieldKey,s)}return o=>o?r.get(o):void 0}function Ke(e,t,n,r){let o=new Map;for(let a of n){let p=a[r];typeof p=="number"&&o.set(a.fieldKey,p)}if(o.size===0)return e;let s=[],i=[];e.forEach((a,p)=>{let c=t(a);c&&(s.push(p),i.push({item:a,index:p,order:o.get(c)}))}),i.sort((a,p)=>a.order!==void 0&&p.order!==void 0?a.order-p.order||a.index-p.index:a.order!==void 0?-1:p.order!==void 0?1:a.index-p.index);let l=[...e];return s.forEach((a,p)=>{l[a]=i[p].item}),l.every((a,p)=>a===e[p])?e:l}function ze(e){return kt(e,"filter")}var St="collection";function Q(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":St},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function kt(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function xt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function $e(e,t){let n=e?.[t];return xt(n)?n:null}function De(e,t,n,r){if(n==null&&r==null)return!0;let o=$e(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}function Ue(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var wt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Ir=Object.keys(wt);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Lt={diameters:"tyreSizes"};function Tt(e){if(e.length===0)return[];let t=J.filter(n=>e.every(r=>ee[n].includes(r)));return t.filter(n=>{let r=Lt[n];return!r||!t.includes(r)})}function Ot(e){let t=new Set;for(let n of e)t.add(d(n));return[...t]}var Be={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function At(e,t,n,r=null,o="fail"){let s=d(e),i=l=>o==="fail"||(l==="lugs"?s==="alloy-wheel":ee[l].includes(s));if(r!=="kind"&&t.kind&&s!==t.kind)return!1;for(let l of J){if(r===l)continue;let a=t[l];if(a.length===0||!i(l))continue;let p=a.map(String);if(!je(e,l).some(c=>p.includes(c)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&i("lugs")){let l=Ue(e);if(l===null||!t.lugs.includes(l))return!1}return!(r!=="price"&&!De(ge(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!be(e))}var _t={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function je(e,t){switch(t){case"tyreSizes":return[...new Set(Te(e).flatMap(me))];case"brands":return H(e)?[H(e)]:[];case"finishes":return Se(e);case"diameters":return Pe(e).map(String);case"collections":return ke(e);case"pcds":return xe(e);case"tyreTypes":return we(e);case"speedRatings":return Le(e)}}function Ft(e){let t=new Map;for(let n of e)for(let r of Y(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function We(e,t,n,r=Ot(e),o=Ce,s="fail"){let i=u=>It(u,r,o),l=Ft(e),p=(s==="pass"?J.filter(u=>r.some(S=>ee[u].includes(S))):Tt(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let S=t[u].map(String),ce=new Set,B=new Map,O=new Map;for(let f of e){let P=je(f,u);for(let h of P)ce.add(h);for(let h of new Set(P))O.set(h,(O.get(h)??0)+1);if(At(f,t,n,u,s))for(let h of new Set(P))B.set(h,(B.get(h)??0)+1)}let ut=[...ce].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:B.get(f)??0,checked:S.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,P)=>{if(u==="diameters")return Number(f.value)-Number(P.value);let h=(O.get(P.value)??0)-(O.get(f.value)??0);return h!==0?h:f.value.localeCompare(P.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>Et),c=[];for(let u of p){let S=Rt(u.key,r,o);S!==void 0&&c.push({fieldKey:u.key,filterOrder:S})}return[...Ke(p,u=>u.key,c,"filterOrder")]}var Et=1;function He(e){return e.showCollection===!1?["collections"]:[]}function It(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>ze(X(n,r))(Q(e,r)))}function Rt(e,t,n){if(n.length===0)return;let r;for(let o of t){let s=Me(X(n,o),"filter")(Q(e,o));s!==void 0&&(r===void 0||s<r)&&(r=s)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},ne="type";var w=e=>!!e&&typeof e=="object"&&!Array.isArray(e),L=e=>w(e)&&typeof e.type=="string"&&w(e.props);var z=e=>Array.isArray(e)&&e.length>0&&e.every(L);function Nt(e){let t="";for(let n of e)t+=typeof n=="number"?`[${n}]`:t===""?n:`.${n}`;return t}function Ye(e,t){return t==="root"?e.root:e.components[t]}function Ge(e){return e?.fields??{}}function Ve(e,t){return Ge(Ye(e,t))}function qe(e,t){let n=[];return re(e,t,[],n),n}function re(e,t,n,r){for(let o of Object.keys(t)){let s=t[o];if(!s)continue;let i=[...n,o],l=e[o];if(s.type==="slot"){let a=Array.isArray(l);r.push({slot:Nt(i),segments:i,content:a?l:[],present:a})}else if(s.type==="object"&&s.objectFields&&w(l))re(l,s.objectFields,i,r);else if(s.type==="array"&&s.arrayFields&&Array.isArray(l)){let a=s.arrayFields;l.forEach((p,c)=>{w(p)&&re(p,a,[...i,c],r)})}}}function oe(e,t,n){return Ct(e,t,n).map(({slot:r,content:o})=>({slot:r,content:o}))}function $(e){let t=new TextEncoder,n=new Map(e.map(r=>[r,t.encode(r)]));return[...e].sort((r,o)=>{let s=n.get(r),i=n.get(o);if(s.length!==i.length)return s.length-i.length;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return s[l]-i[l];return 0})}function Ct(e,t,n){let r=qe(e.props,Ve(t,e.type));if(n?.order!=="stored")return r;let o=$(Object.keys(e.props)),s=i=>{let l=i.present?o.indexOf(String(i.segments[0])):-1;return l<0?Number.POSITIVE_INFINITY:l};return r.map((i,l)=>({loc:i,i:l,r:s(i)})).sort((i,l)=>i.r-l.r||i.i-l.i).map(({loc:i})=>i)}var Ze=["Text","ImageBlock","ButtonBlock","Flex"];function k(){return{type:"slot",allow:[...Ze]}}var Mt=Ze.filter(e=>e!=="ButtonBlock");function Xe(){return{type:"slot",allow:[...Mt]}}var Kt="boxes",Qe={CardList:{template:Xe()},Cards:{template:k()},FAQ:{template:k()},Flex:{rowTitle:{type:"slot",allow:["Text"]},content:{type:"slot"}},Footprint:{template:k()},Grid:{content:{type:"slot"}},Hero:{slides:{type:"slot",ownPictures:!0},strip:{type:"slot",allow:["Flex"]}},HeroGroup:{content:{type:"slot"}},HeroSingle:{boxes:{type:"slot",allow:["HeroGroup"]}},HeroSlide:{groups:{type:"slot",allow:["HeroGroup"]}},Logos:{logos:{type:"slot",allow:["LogoBlock"]},template:{type:"slot",allow:["LogoBlock"]}},OrderSummary:{template:k()},ProcessSteps:{[Kt]:{type:"slot"},template:k()}};var zt={},$t=null;function Dt(){let e=Object.fromEntries(Object.entries(Qe).map(([t,n])=>[t,{fields:n}]));return $t??={components:{...e,...zt}}}function Ut(e){let t=e.props??{},n=typeof e.type=="string"?e.type:"",r=Dt(),o=n!==""&&Object.prototype.hasOwnProperty.call(r.components,n)?oe({type:n,props:t},r).map(l=>l.slot).filter(l=>!l.includes(".")):[],s=o.filter(l=>z(t[l])),i=$(Object.keys(t).filter(l=>!o.includes(l)&&z(t[l])));return[...s,...i]}function Je(e,t){let n=null;for(let r of Ut(e)){let o=e.props[r],s=t(o,r);s!==o&&((n??={...e.props})[r]=s)}return n?{...e,props:n}:e}var et="FilterBlock";var tt="AlloyWheelsListing";function Bt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function jt(e){let t=[],n=(r,o)=>{let s=[r,...o];for(let i of r)L(i)&&(t.push({node:i,order:t.length,lists:s}),Je(i,l=>(n(l,s),l)))};for(let r of Bt(e))n(r,[]);return t}function nt(e){return jt(e).map(t=>t.node)}function rt(e){return j(e.trim())}var T="/wheels",D="Products";function ot(e,t){return t>1?`${D} \xB7 ${e}`:D}function se(...e){for(let t of[tt,et])for(let n of e){let r=nt({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function U(...e){return se(...e)!==null}function st(e,t){let n=e.filter(r=>U(...r.docs)).map(r=>b(r.slug));return t.fallback&&!n.includes(T)?[...n,T]:n}var ie=[ne,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function it(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Wt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function lt(e){let t=new URLSearchParams(it(e).query);for(let n of ie){let r=t.get(n);if(r)return{param:n,value:r}}return null}function le(e,t){let{path:n,query:r,hash:o}=it(e),s=r.split("&").filter(i=>i&&!ie.includes(Wt(i.split("=")[0])));return t?.value&&s.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${s.length?`?${s.join("&")}`:""}${o}`}function at(e,t){let n=le(e,null);return t.includes(n)?n:e}function Ht(e,t,n=[]){return K(e,t,{listingPaths:n,targetOf:r=>at(r,n)})}function Yt(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var ct="Product type",Gt="AUD";function ae(e,t){let n=t.listing??{},r=ye(n.kinds),o=e.filter(a=>r.includes(d(a))),s=He(n),i=We(o,Be,Gt,r,t.fieldUsage).filter(a=>!s.includes(a.key)).map(a=>({param:te[a.key],label:a.label,values:a.options.filter(p=>!p.value.includes(",")).map(p=>({value:p.value,label:p.label}))})).filter(a=>a.values.length>0),l=x.filter(a=>r.includes(a)&&o.some(p=>d(p)===a));return l.length>1&&i.unshift({param:ne,label:ct,values:l.map(a=>({value:a,label:F[a]}))}),i}function Vt(e){return t=>{let n=st(t,{fallback:e.offersCommerce}),r=t.filter(o=>U(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let s=o.map(i=>{let l=t.find(a=>b(a.slug)===i.value);return l&&U(...l.docs)?{...i,label:ot(l.title,r)}:i});return r===0&&e.offersCommerce&&!s.some(i=>i.value===T)&&s.push({value:T,label:D}),s},filtersFor:o=>{if(!n.includes(o))return null;let s=t.find(i=>b(i.slug)===o);return ae(e.catalogue,{listing:s?se(...s.docs):null,fieldUsage:e.fieldUsage})},readFilter:lt,withFilter:le}}}function qt(e){let t=Vt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=ve({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:v(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:rt},filtersFor:n.filtersFor??(()=>null)}}function Qo(e,t){return ae(e,t)}export{T as BUILT_IN_LISTING_PATH,I as LINK_KINDS,ie as LISTING_FILTER_PARAMS,D as LISTING_PAGE_LABEL,ct as PRODUCT_TYPE_FILTER_LABEL,C as anchorPath,Yt as fieldUsageFromAdminRows,Ht as inferLinkKind,U as isProductListingPage,rt as isSafeLink,R as linkKindsFor,qt as linkPickerSetup,Qo as listingFilterFields,se as listingNode,ot as listingPageLabel,at as listingTarget,M as pageAnchors,b as pagePath,N as postPath,st as productListingPaths,lt as readListingFilter,v as wheelPath,le as withListingFilter};
@@ -1 +1 @@
1
- "use client";import{jsx as k}from"react/jsx-runtime";import{useEffect as _,useState as E}from"react";import{useRootIsDark as v}from"efficient-shell/theme";import{usePathname as y}from"next/navigation";import{useHeaderBar as T}from"./useHeaderBar.js";import{headerSolidBackground as D,isProductPage as I,resolveHeaderHeightPx as R}from"../lib/content/header-bar.js";import{headerThemeWrap as P}from"../lib/content/header-theme.js";import{HEADER_SET_HEIGHT_VAR as S}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_OVERRIDE_ATTR as A,resolveHeaderInkMode as B}from"efficient-web-builder/render/lib/document/header-ink";import{centredCap as j,SITE_WIDTH_CAP as w}from"efficient-web-builder/format/lib/content/page-width";import{HideTaker as M}from"efficient-web-builder/render/components/ViewHideRoot";const C=["none","always","on_scroll_up"],N=e=>C.includes(e)?e:"always";function O({sticky:e,topTextColor:c,heightPx:u,theme:f,bandCapped:m=!1,children:h}){const t=N(e),a=R(u),{headerRef:o,scrolled:n,navHidden:p}=T({stickyMode:t,heightPx:a}),s=B(c),g=s==="auto"?null:{[A]:s},r=P(f),d=I(y()),[b,x]=E(null);_(()=>x(o.current?.ownerDocument??null),[o]);const H=!v({doc:b,whenUnset:!0}),l=n||d,i=D(H,d);return k(M,{as:"header",ref:o,"data-scrolled":n||void 0,"data-box-header":"",...g,className:["sf-site-header",...r?[r.className]:[],"flex flex-col justify-center",t==="none"?"absolute":"fixed","inset-x-0 top-0 z-50",l?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...r?r.style:null,minHeight:`var(${S}, ${a}px)`,...m?j(w):null,...p?{transform:"translateY(-100%)"}:null,...l?{background:i,color:"var(--fg)","--sf-header-ground":i}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:h})}export{O as default,N as resolveStickyMode};
1
+ "use client";import{jsx as k}from"react/jsx-runtime";import{parseOption as _}from"efficient-web-builder/format/lib/parse-option";import{useEffect as v,useState as E}from"react";import{useRootIsDark as y}from"efficient-shell/theme";import{usePathname as T}from"next/navigation";import{useHeaderBar as D}from"./useHeaderBar.js";import{headerSolidBackground as I,isProductPage as R,resolveHeaderHeightPx as P}from"../lib/content/header-bar.js";import{headerThemeWrap as S}from"../lib/content/header-theme.js";import{HEADER_SET_HEIGHT_VAR as A}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_OVERRIDE_ATTR as B,resolveHeaderInkMode as j}from"efficient-web-builder/render/lib/document/header-ink";import{centredCap as w,SITE_WIDTH_CAP as M}from"efficient-web-builder/format/lib/content/page-width";import{HideTaker as O}from"efficient-web-builder/render/components/ViewHideRoot";const C=["none","always","on_scroll_up"],N=r=>_(C,"always",r);function W({sticky:r,topTextColor:c,heightPx:u,theme:m,bandCapped:f=!1,children:p}){const t=N(r),a=P(u),{headerRef:o,scrolled:n,navHidden:h}=D({stickyMode:t,heightPx:a}),s=j(c),g=s==="auto"?null:{[B]:s},e=S(m),d=R(T()),[b,x]=E(null);v(()=>x(o.current?.ownerDocument??null),[o]);const H=!y({doc:b,whenUnset:!0}),l=n||d,i=I(H,d);return k(O,{as:"header",ref:o,"data-scrolled":n||void 0,"data-box-header":"",...g,className:["sf-site-header",...e?[e.className]:[],"flex flex-col justify-center",t==="none"?"absolute":"fixed","inset-x-0 top-0 z-50",l?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...e?e.style:null,minHeight:`var(${A}, ${a}px)`,...f?w(M):null,...h?{transform:"translateY(-100%)"}:null,...l?{background:i,color:"var(--fg)","--sf-header-ground":i}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:p})}export{W as default,N as resolveStickyMode};
@@ -1 +1 @@
1
- import{jsx as s,jsxs as c,Fragment as Me}from"react/jsx-runtime";import{Children as De,useContext as Pe,useState as le}from"react";import{servedWords as Ue}from"../lib/content/served-lists.js";import{TAB_PILLS as B}from"../lib/content/tab-strip.js";import{useScopeClass as ze}from"../lib/use-scope-class.js";import{containerGapProps as Ve}from"efficient-web-builder/format/lib/content/container-gap";import Ye from"efficient-web-builder/render/components/SectionHeader";import A from"efficient-web-builder/render/components/PostCard";import je from"efficient-web-builder/render/components/PostDate";import Be from"efficient-web-builder/render/components/Placeholder";import{SiteLink as C}from"efficient-web-builder/render/lib/site-runtime";import{renderGold as b,renderHeadline as O}from"efficient-web-builder/render/components/goldPhrases";import{say as L}from"efficient-web-builder/format/lib/editor-words";import{cardImageShapeTokens as We}from"efficient-web-builder/format/lib/content/card-image-shape";import{SITE_COLUMN as W}from"efficient-web-builder/format/lib/content/page-width";import{fillRowCss as He}from"../lib/sections/fill-row.js";import{FRAME_120 as ce,FRAME_ROOM_COUNT as Ke,FRAME_ROOM_OWN_BOX as Ge,FRAME_ROOM_Y as Xe,framedBandPad as H,headIsEmpty as Je,withBandClasses as K}from"../lib/sections/band-padding.js";import{HideTaker as G,ViewHideContext as qe,viewHideClaim as Qe}from"efficient-web-builder/render/components/ViewHideRoot";import{CardTemplateRows as Ze,useCardRow as et}from"efficient-web-builder/render/components/CardRowContext";import{SECTION_FILL_CLASS as tt}from"efficient-web-builder/format/lib/content/section-min-height";import{postPath as de}from"efficient-web-builder/format/lib/links/page-link-rules";import{EVENTS_FEATURED_DARKEN as st,EVENTS_FEATURED_DARKEN_STYLE as nt,EVENTS_FEATURED_PLACEMENT as at}from"../lib/content/events-featured-look.js";import{PostListStarts as rt}from"./PostListStartsProvider.js";import{EVENTS_DEFAULT_LIMIT as ot,EVENTS_LAYOUT_COUNT as fe,postCap as it}from"../lib/content/post-list-continue.js";import{VIEW_TIERS as X}from"efficient-easel/screen/lib/content/view-tiers";import{hiddenKeyOf as lt}from"efficient-easel/screen/lib/content/view-hide";import{nodeHiddenEverywhere as ct,nodeViewHideWords as dt,viewHideClass as me}from"efficient-web-builder/format/lib/content/view-hide-class";const ft=4;function bs(e){return Ue(e,ft)}function Es(e){if(!e||typeof e!="object"||Array.isArray(e))return;const n={};for(const[t,a]of Object.entries(e))if(t.trim()){if(typeof a=="string")a.trim()&&(n[t]=a.trim());else if(Array.isArray(a)){const o=a.filter(d=>typeof d=="string"&&!!d.trim()).map(d=>d.trim());o.length&&(n[t]=o)}}return Object.keys(n).length?n:void 0}function pe(e,n){const t=e.facets?.[n];return t===void 0?[]:typeof t=="string"?[t]:t}const mt=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function pt(e){const n=[],t=new Map;for(const a of e)for(const o of Object.keys(a.facets??{})){t.has(o)||(n.push(o),t.set(o,new Set));for(const d of pe(a,o))t.get(o).add(d)}return n.map(a=>({label:a,values:[...t.get(a)].sort(mt.compare)}))}function ut(e,n){return Object.entries(n).every(([t,a])=>a===""||pe(e,t).includes(a))}const ue="featured",ge="tabs",he="portrait",E="spread",Ts=[{label:"Even grid",value:"even"},{label:"Featured first",value:ue},{label:"Tabs",value:ge},{label:"Photo cards",value:he},{label:"Staggered spread",value:E},{label:"Count",value:fe}],gt=[he,E],ys="even",J={min:2,max:11,step:1,fallback:7,unit:"of 12"},ht=at,xt=st,vt=nt;function Nt(e){const n=typeof e=="number"?e:Number.parseFloat(String(e??"")),t=Number.isFinite(n)?Math.min(J.max,Math.max(J.min,Math.round(n))):J.fallback;return`${t}fr ${12-t}fr`}const xe={1:"grid-cols-1",2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-2 max-view-wide:grid-cols-1"},bt={2:"grid-cols-2",3:"grid-cols-3 max-view-wide:grid-cols-2",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-2"},Et={2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-1"};function ve(e,n){return{key:e.slug,title:e.title??"",excerpt:e.excerpt??"",cover:e.cover??"",meta:e.meta??"",dateLabel:e.dateLabel??"",href:e.href||(n?"#":de(e.slug))}}function Tt(e,n){return{...ve(e,n),tags:(e.tags??[]).map(t=>({label:t}))}}const Ne=new WeakMap,yt={className:"hidden"},_t={className:tt};function be(e,n){const t=e.blockIds[0],a=e;function o(d){const h=et(),T=n&&h?.index===0;return s(a,{...d,cell:u=>u===t===T?_t:yt})}return Object.assign(o,{blockCount:1,blockIds:e.blockIds})}function wt(e,n){const t=e;if(typeof t!="function"||(t.blockCount??0)<2||!Array.isArray(t.blockIds))return e;let a=Ne.get(t);return a||(a={lead:be(t,!0),rest:be(t,!1)},Ne.set(t,a)),n?a.lead:a.rest}const At="Find by name",Ct="Nobody by that name.",Ot="Nobody matches.",Lt="Any",St="No posts in this category yet.",$t="All posts",Rt=de("").replace(/\/$/,"");function kt(e){return typeof e=="string"?e.trim():""}function It(){return c("div",{className:"flex min-h-[40vh] flex-col items-center justify-center gap-6 text-center font-mono text-[length:var(--size-label,14px)] uppercase text-fg-dim",children:[s("p",{role:"status",className:"tracking-[0.2em]",children:St}),c(C,{href:Rt,className:"inline-flex min-h-11 items-center tracking-[0.22em] hover:text-fg",children:[$t," ",s("span",{className:"text-accent",children:"→"})]})]})}function Ft(e,n){const t=o=>o.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().trim(),a=t(n);return a===""||t(e).includes(a)}function Ee({typed:e,onType:n,wide:t=!1}){return c("label",{className:`flex max-w-[360px] flex-col gap-1.5${t?" w-full":""}`,children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:At}),s("input",{type:"search",value:e,onChange:a=>n(a.target.value),autoComplete:"off",className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent"})]})}function Te({tags:e}){return s("ul",{"aria-label":"Details",className:"flex gap-1.5 overflow-hidden",children:e.map((n,t)=>s("li",{className:"shrink-0 rounded-[var(--sf-button-radius,4px)] border border-line px-2 py-0.5 text-[length:var(--size-label,12px)] text-fg-dim",children:n},`${n}-${t}`))})}function Mt({card:e,scaffold:n,lower:t=!1}){return c(C,{href:e.href||"#",className:`sf-card group relative isolate flex aspect-[3/4] overflow-hidden bg-surface${t?" min-[801px]:mt-16":""}`,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,children:[s("div",{className:"absolute inset-0 transition-transform duration-700 group-hover:scale-[1.03] motion-reduce:transition-none motion-reduce:group-hover:scale-100",children:s(Be,{label:`card-${e.slug}`,src:e.cover||void 0,sizes:"(max-width: 800px) 50vw, 25vw"})}),s("div",{"aria-hidden":!0,className:"absolute inset-0 z-0",style:{background:"linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 88%, transparent) 100%)"}}),e.meta&&s("span",{className:"absolute left-3 top-3 z-[1] rounded-[var(--sf-button-radius,999px)] bg-bg/85 px-2.5 py-1 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-accent",children:b(e.meta)}),c("div",{className:"relative z-[1] mt-auto flex w-full flex-col gap-1 p-4 max-view-wide:p-3",children:[s("h3",{className:"font-heading3 text-[length:var(--size-headingSmall,24px)] leading-[1.1] tracking-[-0.01em] text-fg",children:O(e.title,!1)}),(e.publishedAt||e.dateLabel)&&s("p",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-accent",children:e.publishedAt?s(je,{at:e.publishedAt}):b(e.dateLabel??"")}),e.tags&&e.tags.length>0&&s(Te,{tags:e.tags}),e.excerpt&&s("p",{className:"line-clamp-2 text-[length:var(--size-body,14px)] leading-[1.45] text-fg-dim",children:b(e.excerpt)})]})]})}function Dt({cards:e,scaffold:n}){return s("nav",{"aria-label":"Days",className:B.nav,children:s("ul",{className:B.list,children:e.map((t,a)=>{const o=!!t.meta;return s("li",{children:c(C,{href:t.href||"#","aria-current":o?"page":void 0,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,className:B.tab(o),children:[s("span",{className:"font-heading3 text-[length:var(--size-body,15px)] leading-[1.2]",children:O(t.title,!1)}),t.excerpt&&s("span",{className:`font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] ${o?"opacity-80":"text-fg-dim"}`,children:b(t.excerpt)})]})},`${t.slug}-${a}`)})})})}function Pt({count:e,words:n,href:t}){const a=c("span",{className:"inline-flex items-baseline gap-3",children:[s("span",{className:"font-heading text-[length:var(--size-headingLarge,64px)] leading-none text-accent",children:e}),n!==void 0&&s("span",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg",children:n})]});return t?s(C,{href:t,className:"inline-flex hover:opacity-85",children:a}):a}const q="[&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",Ut="[&>[data-sf-repeat]]:h-full [&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",ye=`relative z-[2] bg-bg ${Xe}`,_e=`relative z-[2] bg-bg ${Ge}`,zt=`relative z-[2] bg-bg ${Ke}`,Vt={top:32,bottom:32};function Yt(e){const{starts:n,posts:t}=Pe(rt),a=n[e.ownerId??""];if(!a)return s(Q,{...e,start:0});const o=t?.[e.ownerId??""]??e.posts,d=jt(a);return d.length===1?s(Q,{...e,posts:o,start:d[0].start}):s(Me,{children:d.map(({start:h,views:T})=>{const u=Bt(T,e.viewHidden);return ct(we(u))?null:s(qe.Provider,{value:Wt(u),children:s(Q,{...e,posts:o,start:h})},h)})})}function jt(e){const n=[];for(const t of X){const a=n.find(o=>o.start===e[t]);a?a.views.push(t):n.push({start:e[t],views:[t]})}return n}const Bt=(e,n)=>Object.fromEntries(X.map(t=>[t,!e.includes(t)||!!n?.[t]])),we=e=>Object.fromEntries(X.map(n=>[lt(n),e[n]])),Wt=e=>Qe(me(e),dt(we(e)),{sectionClassName:me(e,{atSectionLine:!0}),line:"section"});function Q({start:e,num:n,title:t,link:a,posts:o,servedCategory:d,columns:h,limit:T,showAll:u=!1,editing:S=!1,cardImage:Ae,gap:Ce,gapPhone:Oe,layout:g,featuredWidth:Le,listCover:Se=!0,featuredDarken:$e,omitHead:x=!1,sample:$,nameFilter:Re=!1,pads:R,template:Z,ownerId:ke=""}){const[k,ee]=le(""),[te,Ie]=le({}),y=ze("ev"),se=e>0?(o??[]).slice(e):o??[],ne=u?se.length:it({limit:T}),I=se.slice(0,ne),p=S&&I.length===0;if(I.length===0&&!S){if(!kt(d))return null;const r=H(R,ce,{noTop:x,nonNegative:!0});return s(G,{as:"section",...r.attrs,className:K(x?_e:ye,r),style:r.style,children:s("div",{className:W,children:s(It,{})})})}const ae=u?ot:ne,f=p?$?.length?$.slice(0,u?$.length:ae):Array.from({length:ae},(r,l)=>({slug:`placeholder-${l}`,title:L("Blog post title"),excerpt:L("A short summary of the post appears here."),cover:"",meta:L("Journal"),dateLabel:L("Date")})):I,i=Ve("Events",Ce,"both",Oe),w=g===ue&&f.length>1,re=Nt(Le),F=g===ge,M=g===fe,oe=gt.includes(g??""),D=Re&&!F&&!M&&!w,P=D?pt(f):[],N=D?f.filter(r=>Ft(r.title,k)&&ut(r,te)):f,_=M?H(R,Vt,{nonNegative:!0}):H(R,ce,{noTop:x,nonNegative:!0}),U=_.style,Fe=!S&&Je(n,t,a?.text),z=(Z?.blockCount??0)>0?Et:bt,V=g===E?z[3]:z[Math.min(4,Math.max(2,h??3))]??z[3],Y=xe[Math.min(4,Math.max(1,h??3))]??xe[3],ie=F||w||g===E?"":He(y,oe?V:Y,{cards:N.length}),j=(r,l,m)=>s(Ze,{ownerId:ke,ownerType:"Events",Template:wt(Z,w),rows:r.map(v=>ve(v,p)),items:r.map(v=>Tt(v,p)),fallback:l,children:v=>m(De.toArray(v))});return M?s(G,{as:"section",..._.attrs,className:K(zt,_),style:Object.keys(U).length?U:void 0,children:s("div",{className:W,children:s(Pt,{count:f.length,words:x||t===void 0?void 0:O(t,!1),href:x?void 0:a?.href})})}):s(G,{as:"section",..._.attrs,className:K(x?_e:ye,_),style:{...We(Ae),...U},children:c("div",{className:W,children:[x||Fe?null:s(Ye,{num:n!==void 0?b(n):void 0,title:t!==void 0?O(t,!1):void 0,link:a?{text:b(a.text),href:a.href}:void 0}),D&&c("div",{className:"mb-6 flex flex-col gap-2",children:[P.length===0?s(Ee,{typed:k,onType:ee}):c("div",{className:"flex flex-wrap items-end gap-3",children:[s(Ee,{typed:k,onType:ee,wide:!0}),P.map(({label:r,values:l})=>c("label",{className:"flex min-w-[140px] flex-col gap-1.5 max-view-wide:flex-1",children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:r}),c("select",{value:te[r]??"",onChange:m=>Ie(v=>({...v,[r]:m.target.value})),className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent",children:[s("option",{value:"",children:Lt}),l.map(m=>s("option",{value:m,children:m},m))]})]},r))]}),N.length===0&&s("p",{role:"status",className:"text-[length:var(--size-body,14px)] text-fg-dim",children:P.length===0?Ct:Ot})]}),ie&&s("style",{children:ie}),F?s(Dt,{cards:f,scaffold:p}):oe?j(N,s("div",{className:`${y} sf-card-grid grid${i.className} ${V}`,style:i.style,children:N.map((r,l)=>s(Mt,{card:r,scaffold:p,lower:g===E&&l%3===1},`${r.slug}-${l}`))}),r=>s("div",{className:`${y} sf-card-grid grid${i.className} ${V} ${q}`,style:i.style,children:g===E?r.map((l,m)=>s("div",{className:`${Ut}${m%3===1?" view-wide:mt-16":""}`,children:l},m)):r})):w?j(f,c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${i.className}`,style:{...i.style,"--sf-events-split":re},children:[s(A,{post:f[0],href:f[0].href,scaffold:p,layout:"cover",darken:$e??xt,darkenStyle:vt,placement:ht},`${f[0].slug}-0`),s("div",{className:`grid auto-rows-min${i.className}`,style:i.style,children:f.slice(1).map((r,l)=>s(A,{post:r,href:r.href,scaffold:p,showCover:Se},`${r.slug}-${l+1}`))})]}),r=>c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${i.className} ${q}`,style:{...i.style,"--sf-events-split":re},children:[r[0],s("div",{className:`grid auto-rows-min${i.className}`,style:i.style,children:r.slice(1)})]})):j(N,s("div",{className:`${y} sf-card-grid grid${i.className} ${Y}`,style:i.style,children:N.map((r,l)=>r.tags&&r.tags.length>0?c("div",{className:"flex flex-col gap-2",children:[s(A,{post:r,href:r.href,scaffold:p}),s(Te,{tags:r.tags})]},`${r.slug}-${l}`):s(A,{post:r,href:r.href,scaffold:p},`${r.slug}-${l}`))}),r=>s("div",{className:`${y} sf-card-grid grid${i.className} ${Y} ${q}`,style:i.style,children:r}))]})})}export{J as EVENTS_FEATURED_WIDTH,Ts as EVENTS_LAYOUTS,ys as EVENTS_LAYOUT_FALLBACK,ue as EVENTS_LAYOUT_FEATURED,he as EVENTS_LAYOUT_PORTRAIT,E as EVENTS_LAYOUT_SPREAD,ge as EVENTS_LAYOUT_TABS,gt as EVENTS_PHOTO_LAYOUTS,ft as MAX_CARD_TAGS,Yt as default,pt as facetChoices,ut as matchesFacets,Ft as matchesName,Es as readFacets,bs as readTags};
1
+ import{jsx as s,jsxs as c,Fragment as De}from"react/jsx-runtime";import{Children as Me,useContext as Pe,useState as le}from"react";import{servedWords as Ue}from"../lib/content/served-lists.js";import{TAB_PILLS as B}from"../lib/content/tab-strip.js";import{useScopeClass as ze}from"../lib/use-scope-class.js";import{containerGapProps as Ve}from"efficient-web-builder/format/lib/content/container-gap";import je from"efficient-web-builder/render/components/SectionHeader";import C from"efficient-web-builder/render/components/PostCard";import Ye from"efficient-web-builder/render/components/PostDate";import Be from"efficient-web-builder/render/components/Placeholder";import{SiteLink as A}from"efficient-web-builder/render/lib/site-runtime";import{renderGold as b,renderHeadline as L}from"efficient-web-builder/render/components/goldPhrases";import{say as O}from"efficient-web-builder/format/lib/editor-words";import{cardImageShapeTokens as He}from"efficient-web-builder/format/lib/content/card-image-shape";import{SITE_COLUMN as H}from"efficient-web-builder/format/lib/content/page-width";import{fillRowCss as We}from"../lib/sections/fill-row.js";import{FRAME_120 as ce,FRAME_ROOM_COUNT as Ke,SECTION_FRAME_INLINE as de,SECTION_FRAME_OWN_BOX as fe,framedBandPad as W,headIsEmpty as Ge,withBandClasses as K}from"../lib/sections/band-padding.js";import{HideTaker as G,ViewHideContext as Je,viewHideClaim as Xe}from"efficient-web-builder/render/components/ViewHideRoot";import{CardTemplateRows as qe,useCardRow as Qe}from"efficient-web-builder/render/components/CardRowContext";import{SECTION_FILL_CLASS as Ze}from"efficient-web-builder/format/lib/content/section-min-height";import{postPath as me}from"efficient-web-builder/format/lib/links/page-link-rules";import{EVENTS_FEATURED_DARKEN as et,EVENTS_FEATURED_DARKEN_STYLE as tt,EVENTS_FEATURED_PLACEMENT as st}from"../lib/content/events-featured-look.js";import{PostListStarts as nt}from"./PostListStartsProvider.js";import{EVENTS_DEFAULT_LIMIT as at,EVENTS_LAYOUT_COUNT as pe,postCap as rt}from"../lib/content/post-list-continue.js";import{VIEW_TIERS as J}from"efficient-easel/screen/lib/content/view-tiers";import{hiddenKeyOf as ot}from"efficient-easel/screen/lib/content/view-hide";import{nodeHiddenEverywhere as it,nodeViewHideWords as lt,viewHideClass as ue}from"efficient-web-builder/format/lib/content/view-hide-class";const ct=4;function vs(e){return Ue(e,ct)}function Ns(e){if(!e||typeof e!="object"||Array.isArray(e))return;const n={};for(const[t,a]of Object.entries(e))if(t.trim()){if(typeof a=="string")a.trim()&&(n[t]=a.trim());else if(Array.isArray(a)){const o=a.filter(d=>typeof d=="string"&&!!d.trim()).map(d=>d.trim());o.length&&(n[t]=o)}}return Object.keys(n).length?n:void 0}function ge(e,n){const t=e.facets?.[n];return t===void 0?[]:typeof t=="string"?[t]:t}const dt=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function ft(e){const n=[],t=new Map;for(const a of e)for(const o of Object.keys(a.facets??{})){t.has(o)||(n.push(o),t.set(o,new Set));for(const d of ge(a,o))t.get(o).add(d)}return n.map(a=>({label:a,values:[...t.get(a)].sort(dt.compare)}))}function mt(e,n){return Object.entries(n).every(([t,a])=>a===""||ge(e,t).includes(a))}const he="featured",xe="tabs",ve="portrait",E="spread",bs=[{label:"Even grid",value:"even"},{label:"Featured first",value:he},{label:"Tabs",value:xe},{label:"Photo cards",value:ve},{label:"Staggered spread",value:E},{label:"Count",value:pe}],pt=[ve,E],Es="even",X={min:2,max:11,step:1,fallback:7,unit:"of 12"},ut=st,gt=et,ht=tt;function xt(e){const n=typeof e=="number"?e:Number.parseFloat(String(e??"")),t=Number.isFinite(n)?Math.min(X.max,Math.max(X.min,Math.round(n))):X.fallback;return`${t}fr ${12-t}fr`}const Ne={1:"grid-cols-1",2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-2 max-view-wide:grid-cols-1"},vt={2:"grid-cols-2",3:"grid-cols-3 max-view-wide:grid-cols-2",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-2"},Nt={2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-1"};function be(e,n){return{key:e.slug,title:e.title??"",excerpt:e.excerpt??"",cover:e.cover??"",meta:e.meta??"",dateLabel:e.dateLabel??"",href:e.href||(n?"#":me(e.slug))}}function bt(e,n){return{...be(e,n),tags:(e.tags??[]).map(t=>({label:t}))}}const Ee=new WeakMap,Et={className:"hidden"},Tt={className:Ze};function Te(e,n){const t=e.blockIds[0],a=e;function o(d){const h=Qe(),T=n&&h?.index===0;return s(a,{...d,cell:u=>u===t===T?Tt:Et})}return Object.assign(o,{blockCount:1,blockIds:e.blockIds})}function yt(e,n){const t=e;if(typeof t!="function"||(t.blockCount??0)<2||!Array.isArray(t.blockIds))return e;let a=Ee.get(t);return a||(a={lead:Te(t,!0),rest:Te(t,!1)},Ee.set(t,a)),n?a.lead:a.rest}const _t="Find by name",wt="Nobody by that name.",Ct="Nobody matches.",At="Any",Lt="No posts in this category yet.",Ot="All posts",St=me("").replace(/\/$/,"");function $t(e){return typeof e=="string"?e.trim():""}function It(){return c("div",{className:"flex min-h-[40vh] flex-col items-center justify-center gap-6 text-center font-mono text-[length:var(--size-label,14px)] uppercase text-fg-dim",children:[s("p",{role:"status",className:"tracking-[0.2em]",children:Lt}),c(A,{href:St,className:"inline-flex min-h-11 items-center tracking-[0.22em] hover:text-fg",children:[Ot," ",s("span",{className:"text-accent",children:"→"})]})]})}function Rt(e,n){const t=o=>o.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().trim(),a=t(n);return a===""||t(e).includes(a)}function ye({typed:e,onType:n,wide:t=!1}){return c("label",{className:`flex max-w-[360px] flex-col gap-1.5${t?" w-full":""}`,children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:_t}),s("input",{type:"search",value:e,onChange:a=>n(a.target.value),autoComplete:"off",className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent"})]})}function _e({tags:e}){return s("ul",{"aria-label":"Details",className:"flex gap-1.5 overflow-hidden",children:e.map((n,t)=>s("li",{className:"shrink-0 rounded-[var(--sf-button-radius,4px)] border border-line px-2 py-0.5 text-[length:var(--size-label,12px)] text-fg-dim",children:n},`${n}-${t}`))})}function kt({card:e,scaffold:n,lower:t=!1}){return c(A,{href:e.href||"#",className:`sf-card group relative isolate flex aspect-[3/4] overflow-hidden bg-surface${t?" min-[801px]:mt-16":""}`,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,children:[s("div",{className:"absolute inset-0 transition-transform duration-700 group-hover:scale-[1.03] motion-reduce:transition-none motion-reduce:group-hover:scale-100",children:s(Be,{label:`card-${e.slug}`,src:e.cover||void 0,sizes:"(max-width: 800px) 50vw, 25vw"})}),s("div",{"aria-hidden":!0,className:"absolute inset-0 z-0",style:{background:"linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 88%, transparent) 100%)"}}),e.meta&&s("span",{className:"absolute left-3 top-3 z-[1] rounded-[var(--sf-button-radius,999px)] bg-bg/85 px-2.5 py-1 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-accent",children:b(e.meta)}),c("div",{className:"relative z-[1] mt-auto flex w-full flex-col gap-1 p-4 max-view-wide:p-3",children:[s("h3",{className:"font-heading3 text-[length:var(--size-headingSmall,24px)] leading-[1.1] tracking-[-0.01em] text-fg",children:L(e.title,!1)}),(e.publishedAt||e.dateLabel)&&s("p",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-accent",children:e.publishedAt?s(Ye,{at:e.publishedAt}):b(e.dateLabel??"")}),e.tags&&e.tags.length>0&&s(_e,{tags:e.tags}),e.excerpt&&s("p",{className:"line-clamp-2 text-[length:var(--size-body,14px)] leading-[1.45] text-fg-dim",children:b(e.excerpt)})]})]})}function Ft({cards:e,scaffold:n}){return s("nav",{"aria-label":"Days",className:B.nav,children:s("ul",{className:B.list,children:e.map((t,a)=>{const o=!!t.meta;return s("li",{children:c(A,{href:t.href||"#","aria-current":o?"page":void 0,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,className:B.tab(o),children:[s("span",{className:"font-heading3 text-[length:var(--size-body,15px)] leading-[1.2]",children:L(t.title,!1)}),t.excerpt&&s("span",{className:`font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] ${o?"opacity-80":"text-fg-dim"}`,children:b(t.excerpt)})]})},`${t.slug}-${a}`)})})})}function Dt({count:e,words:n,href:t}){const a=c("span",{className:"inline-flex items-baseline gap-3",children:[s("span",{className:"font-heading text-[length:var(--size-headingLarge,64px)] leading-none text-accent",children:e}),n!==void 0&&s("span",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg",children:n})]});return t?s(A,{href:t,className:"inline-flex hover:opacity-85",children:a}):a}const q="[&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",Mt="[&>[data-sf-repeat]]:h-full [&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",Pt=`relative z-[2] bg-bg ${Ke}`,Ut={top:32,bottom:32};function zt(e){const{starts:n,posts:t}=Pe(nt),a=n[e.ownerId??""];if(!a)return s(Q,{...e,start:0});const o=t?.[e.ownerId??""]??e.posts,d=Vt(a);return d.length===1?s(Q,{...e,posts:o,start:d[0].start}):s(De,{children:d.map(({start:h,views:T})=>{const u=jt(T,e.viewHidden);return it(we(u))?null:s(Je.Provider,{value:Yt(u),children:s(Q,{...e,posts:o,start:h})},h)})})}function Vt(e){const n=[];for(const t of J){const a=n.find(o=>o.start===e[t]);a?a.views.push(t):n.push({start:e[t],views:[t]})}return n}const jt=(e,n)=>Object.fromEntries(J.map(t=>[t,!e.includes(t)||!!n?.[t]])),we=e=>Object.fromEntries(J.map(n=>[ot(n),e[n]])),Yt=e=>Xe(ue(e),lt(we(e)),{sectionClassName:ue(e,{atSectionLine:!0}),line:"section"});function Q({start:e,num:n,title:t,link:a,posts:o,servedCategory:d,columns:h,limit:T,showAll:u=!1,editing:S=!1,cardImage:Ce,gap:Ae,gapPhone:Le,layout:g,featuredWidth:Oe,listCover:Se=!0,featuredDarken:$e,omitHead:x=!1,sample:$,nameFilter:Ie=!1,pads:I,template:Z,ownerId:Re=""}){const[R,ee]=le(""),[te,ke]=le({}),y=ze("ev"),se=e>0?(o??[]).slice(e):o??[],ne=u?se.length:rt({limit:T}),k=se.slice(0,ne),p=S&&k.length===0;if(k.length===0&&!S){if(!$t(d))return null;const r=W(I,ce,{noTop:x,nonNegative:!0});return s(G,{as:"section",...r.attrs,className:K(x?fe:de,r),style:r.style,children:s("div",{className:H,children:s(It,{})})})}const ae=u?at:ne,f=p?$?.length?$.slice(0,u?$.length:ae):Array.from({length:ae},(r,l)=>({slug:`placeholder-${l}`,title:O("Blog post title"),excerpt:O("A short summary of the post appears here."),cover:"",meta:O("Journal"),dateLabel:O("Date")})):k,i=Ve("Events",Ae,"both",Le),w=g===he&&f.length>1,re=xt(Oe),F=g===xe,D=g===pe,oe=pt.includes(g??""),M=Ie&&!F&&!D&&!w,P=M?ft(f):[],N=M?f.filter(r=>Rt(r.title,R)&&mt(r,te)):f,_=D?W(I,Ut,{nonNegative:!0}):W(I,ce,{noTop:x,nonNegative:!0}),U=_.style,Fe=!S&&Ge(n,t,a?.text),z=(Z?.blockCount??0)>0?Nt:vt,V=g===E?z[3]:z[Math.min(4,Math.max(2,h??3))]??z[3],j=Ne[Math.min(4,Math.max(1,h??3))]??Ne[3],ie=F||w||g===E?"":We(y,oe?V:j,{cards:N.length}),Y=(r,l,m)=>s(qe,{ownerId:Re,ownerType:"Events",Template:yt(Z,w),rows:r.map(v=>be(v,p)),items:r.map(v=>bt(v,p)),fallback:l,children:v=>m(Me.toArray(v))});return D?s(G,{as:"section",..._.attrs,className:K(Pt,_),style:Object.keys(U).length?U:void 0,children:s("div",{className:H,children:s(Dt,{count:f.length,words:x||t===void 0?void 0:L(t,!1),href:x?void 0:a?.href})})}):s(G,{as:"section",..._.attrs,className:K(x?fe:de,_),style:{...He(Ce),...U},children:c("div",{className:H,children:[x||Fe?null:s(je,{num:n!==void 0?b(n):void 0,title:t!==void 0?L(t,!1):void 0,link:a?{text:b(a.text),href:a.href}:void 0}),M&&c("div",{className:"mb-6 flex flex-col gap-2",children:[P.length===0?s(ye,{typed:R,onType:ee}):c("div",{className:"flex flex-wrap items-end gap-3",children:[s(ye,{typed:R,onType:ee,wide:!0}),P.map(({label:r,values:l})=>c("label",{className:"flex min-w-[140px] flex-col gap-1.5 max-view-wide:flex-1",children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:r}),c("select",{value:te[r]??"",onChange:m=>ke(v=>({...v,[r]:m.target.value})),className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent",children:[s("option",{value:"",children:At}),l.map(m=>s("option",{value:m,children:m},m))]})]},r))]}),N.length===0&&s("p",{role:"status",className:"text-[length:var(--size-body,14px)] text-fg-dim",children:P.length===0?wt:Ct})]}),ie&&s("style",{children:ie}),F?s(Ft,{cards:f,scaffold:p}):oe?Y(N,s("div",{className:`${y} sf-card-grid grid${i.className} ${V}`,style:i.style,children:N.map((r,l)=>s(kt,{card:r,scaffold:p,lower:g===E&&l%3===1},`${r.slug}-${l}`))}),r=>s("div",{className:`${y} sf-card-grid grid${i.className} ${V} ${q}`,style:i.style,children:g===E?r.map((l,m)=>s("div",{className:`${Mt}${m%3===1?" view-wide:mt-16":""}`,children:l},m)):r})):w?Y(f,c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${i.className}`,style:{...i.style,"--sf-events-split":re},children:[s(C,{post:f[0],href:f[0].href,scaffold:p,layout:"cover",darken:$e??gt,darkenStyle:ht,placement:ut},`${f[0].slug}-0`),s("div",{className:`grid auto-rows-min${i.className}`,style:i.style,children:f.slice(1).map((r,l)=>s(C,{post:r,href:r.href,scaffold:p,showCover:Se},`${r.slug}-${l+1}`))})]}),r=>c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${i.className} ${q}`,style:{...i.style,"--sf-events-split":re},children:[r[0],s("div",{className:`grid auto-rows-min${i.className}`,style:i.style,children:r.slice(1)})]})):Y(N,s("div",{className:`${y} sf-card-grid grid${i.className} ${j}`,style:i.style,children:N.map((r,l)=>r.tags&&r.tags.length>0?c("div",{className:"flex flex-col gap-2",children:[s(C,{post:r,href:r.href,scaffold:p}),s(_e,{tags:r.tags})]},`${r.slug}-${l}`):s(C,{post:r,href:r.href,scaffold:p},`${r.slug}-${l}`))}),r=>s("div",{className:`${y} sf-card-grid grid${i.className} ${j} ${q}`,style:i.style,children:r}))]})})}export{X as EVENTS_FEATURED_WIDTH,bs as EVENTS_LAYOUTS,Es as EVENTS_LAYOUT_FALLBACK,he as EVENTS_LAYOUT_FEATURED,ve as EVENTS_LAYOUT_PORTRAIT,E as EVENTS_LAYOUT_SPREAD,xe as EVENTS_LAYOUT_TABS,pt as EVENTS_PHOTO_LAYOUTS,ct as MAX_CARD_TAGS,zt as default,ft as facetChoices,mt as matchesFacets,Rt as matchesName,Ns as readFacets,vs as readTags};
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as l,Fragment as re}from"react/jsx-runtime";import L from"./SectionBand.js";import{useEffect as oe,useState as R}from"react";import{CardTemplateRows as B}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ae}from"efficient-web-builder/format/lib/content/page-width";import{SPEC_TABLE_BAND as I}from"../lib/sections/spec-table-band.js";import{FITMENT_HEAD_TEMPLATE_SLOT as ie,fitmentCardRow as se,fitmentHeadRow as ce}from"../lib/content/fitment-row-seed.js";import O from"efficient-web-builder/render/components/SectionHeader";import de from"./SectionFootnote.js";import{renderGold as b,renderHeadline as X}from"efficient-web-builder/render/components/goldPhrases";import me from"./fitment/FitmentRowFit.js";import{useVehicleFit as pe}from"./fitment/useVehicleFit.js";import{fitmentRowAnswer as ue}from"../lib/wheels/fitment-row-fit.js";import{fitmentColumns as fe,loadUnitFor as be}from"../lib/wheels/fitment-columns.js";import{useActiveCountry as he}from"./CurrencyContext.js";import{NO_FIELD_ANSWERS as xe}from"../lib/content/field-usage.js";import{say as H}from"efficient-web-builder/format/lib/editor-words";import{useEnglish as ge}from"./EnglishVariant.js";const a={body:"text-[length:var(--size-body,12px)]",labelXs:"text-[length:var(--size-label,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"},we="whitespace-nowrap border-b border-line px-4 py-4",j=`relative cursor-pointer border-2 px-4 py-2 font-mono ${a.labelSmall} font-semibold uppercase tracking-[0.18em] text-fg transition-colors`,P=I.inline,D=I.ownBox,h={scroll:"-mx-1 overflow-x-auto",table:`min-w-[600px] ${ae}`,head:"border-b border-line bg-surface",row:"group relative border-b border-line transition-colors hover:bg-surface"},G={background:"color-mix(in oklab, var(--accent) 14%, transparent)"},y=(i,s,c)=>s.map(x=>x.cell(i,c)).join("|");function ve({num:i,title:s,description:c,rows:x,showFilter:W=!0,tooltipDefaultOn:g=!0,footnote:K,footnoteLinkText:M,footnoteLinkHref:U,editing:S=!1,omitHead:f=!1,fieldUsage:V=xe,template:Z,headTemplate:q,nodeId:T}){const k=x??[],r=fe(V),_=ge(),u=be(he()),[w,E]=R(null),[o,$]=R(g);oe(()=>$(g),[g]);const J=pe({editing:S}),C=r.length===0;if(k.length===0||C)return S?l(L,{className:f?D:P,children:[f?null:t(O,{num:i!=null?b(i):void 0,title:s!=null?X(s,!1):void 0,description:c!=null?b(c):void 0,accent:!0}),t("p",{className:`border-t border-line py-6 font-mono ${a.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:C?H("Every fitment column is hidden in Product Types — show one to draw this table."):H("No fitment data for this wheel — pick a wheel with fitment specs.")})]}):null;const A=new Set,v=k.filter(e=>{const n=y(e,r,u);return A.has(n)?!1:(A.add(n),!0)}),N=Array.from(new Set(v.map(e=>e.diameter))).sort((e,n)=>e-n),d=w!==null&&N.includes(w)?w:null,m=d===null?v:v.filter(e=>e.diameter===d),Q=W&&N.length>1,Y=e=>{if(e===0)return!1;const n=m[e-1],p=m[e];return n.diameter!==p.diameter||n.width!==p.width},F=e=>o?t("span",{role:"tooltip",className:`pointer-events-none absolute top-1/2 right-0 z-20 hidden w-[520px] -translate-y-1/2 whitespace-normal bg-[var(--tooltip-bg)] px-3 py-2 text-right font-mono ${a.labelXs} normal-case tracking-[0.12em] text-fg shadow-lg group-hover:block max-view-tablet:!hidden`,children:t(me,{answer:ue(e,J)})}):null,ee=(e,n)=>l("div",{className:h.row,children:[e,m[n.index]?F(m[n.index]):null]}),te=t("div",{className:"-mx-1 overflow-x-auto",children:l("table",{className:`w-full border-collapse font-mono ${a.labelXl} tracking-[0.06em] text-fg`,children:[t("thead",{children:t("tr",{children:r.map(({header:e},n)=>t("th",{className:`whitespace-nowrap border-b border-line bg-surface px-4 py-4 text-left ${a.body} font-normal uppercase tracking-[0.22em] text-fg-dim`,children:_(e)},n))})}),t("tbody",{children:m.map((e,n)=>t("tr",{className:`group transition-colors hover:[&>td]:bg-surface ${Y(n)?"[&>td]:border-t [&>td]:border-line":""}`,children:r.map((p,ne)=>{const z=ne===r.length-1,le=p.fieldKey==="diameter";return l("td",{className:`${z?"relative ":""}${we}${le?" text-accent":""}`,children:[p.cell(e,u),z?F(e):null]},p.fieldKey)})},y(e,r,u)))})]})});return l(L,{className:f?D:P,children:[f?null:t(O,{num:i!=null?b(i):void 0,title:s!=null?X(s,!1):void 0,description:c!=null?b(c):void 0,accent:!0}),l("div",{className:"mb-6 flex flex-wrap items-center gap-x-2 gap-y-3",children:[Q&&l(re,{children:[t("span",{className:`mr-2 font-mono ${a.labelSmall} uppercase tracking-[0.24em] text-fg-dim max-view-tablet:mr-0 max-view-tablet:mb-1 max-view-tablet:w-full`,children:"Filter by size:"}),l("button",{type:"button",onClick:()=>E(null),className:`${j} ${d===null?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:d===null?G:void 0,children:[d===null&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),"All"]}),N.map(e=>{const n=e===d;return l("button",{type:"button",onClick:()=>E(n?null:e),className:`${j} ${n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:n?G:void 0,children:[n&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e,'"']},e)})]}),l("button",{type:"button",onClick:()=>$(e=>!e),"aria-pressed":o,"aria-label":o?"Hide vehicle tooltip":"Show vehicle tooltip",className:`ml-auto inline-flex items-center gap-3 font-mono ${a.labelSmall} uppercase tracking-[0.24em] text-fg-dim transition-colors hover:text-fg max-view-tablet:hidden`,children:[t("span",{children:"Vehicle tooltip"}),t("span",{className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 transition-colors ${o?"border-accent":"border-fg-dim/50"}`,style:o?{background:"color-mix(in oklab, var(--accent) 30%, transparent)"}:void 0,"aria-hidden":!0,children:t("span",{className:`block h-3 w-3 rounded-full transition-transform ${o?"translate-x-[18px] bg-accent":"translate-x-[2px] bg-fg-dim"}`})}),t("span",{className:o?"text-accent":"text-fg-dim",children:o?"On":"Off"})]})]}),t(B,{ownerId:T??"",ownerType:"FitmentTable",Template:Z,rows:m.map(e=>se(e,r,u,y(e,r,u))),wrapCopy:ee,fallback:te,children:e=>t("div",{className:h.scroll,children:l("div",{className:h.table,children:[t(B,{ownerId:T??"",ownerType:"FitmentTable",slot:ie,Template:q,rows:[ce(r,_)],fallback:null,children:n=>t("div",{className:h.head,children:n})}),e]})})}),t(de,{text:K,linkText:M,linkHref:U})]})}export{ve as default};
1
+ "use client";import{jsx as t,jsxs as l,Fragment as oe}from"react/jsx-runtime";import z from"./SectionBand.js";import{useEffect as ae,useState as R}from"react";import{CardTemplateRows as B}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ie}from"efficient-web-builder/format/lib/content/page-width";import{SPEC_TABLE_BAND as O}from"../lib/sections/spec-table-band.js";import{FITMENT_HEAD_TEMPLATE_SLOT as se,fitmentCardRow as ce,fitmentHeadRow as de}from"../lib/content/fitment-row-seed.js";import I from"efficient-web-builder/render/components/SectionHeader";import me from"./SectionFootnote.js";import{renderGold as b,renderHeadline as X}from"efficient-web-builder/render/components/goldPhrases";import pe from"./fitment/FitmentRowFit.js";import{useVehicleFit as ue}from"./fitment/useVehicleFit.js";import{fitmentRowAnswer as fe}from"../lib/wheels/fitment-row-fit.js";import{fitmentColumns as be,loadUnitFor as he}from"../lib/wheels/fitment-columns.js";import{useActiveCountry as xe}from"./CurrencyContext.js";import{NO_FIELD_ANSWERS as ge}from"../lib/content/field-usage.js";import{say as H}from"efficient-web-builder/format/lib/editor-words";import{useEnglish as we}from"./EnglishVariant.js";const a={body:"text-[length:var(--size-body,12px)]",labelXs:"text-[length:var(--size-label,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"},ve="whitespace-nowrap border-b border-line px-4 py-4",j=`relative cursor-pointer border-2 px-4 py-2 font-mono ${a.labelSmall} font-semibold uppercase tracking-[0.18em] text-fg transition-colors`,P=O.inline,D=O.ownBox,G="-mx-1 overflow-x-auto",h={scroll:G,table:`min-w-[600px] ${ie}`,head:"border-b border-line bg-surface",row:"group relative border-b border-line transition-colors hover:bg-surface"},W={background:"color-mix(in oklab, var(--accent) 14%, transparent)"},y=(i,s,c)=>s.map(x=>x.cell(i,c)).join("|");function Ne({num:i,title:s,description:c,rows:x,showFilter:K=!0,tooltipDefaultOn:g=!0,footnote:M,footnoteLinkText:U,footnoteLinkHref:V,editing:S=!1,omitHead:f=!1,fieldUsage:Z=ge,template:q,headTemplate:J,nodeId:T}){const k=x??[],r=be(Z),_=we(),u=he(xe()),[w,E]=R(null),[o,C]=R(g);ae(()=>C(g),[g]);const Q=ue({editing:S}),$=r.length===0;if(k.length===0||$)return S?l(z,{className:f?D:P,children:[f?null:t(I,{num:i!=null?b(i):void 0,title:s!=null?X(s,!1):void 0,description:c!=null?b(c):void 0,accent:!0}),t("p",{className:`border-t border-line py-6 font-mono ${a.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:$?H("Every fitment column is hidden in Product Types — show one to draw this table."):H("No fitment data for this wheel — pick a wheel with fitment specs.")})]}):null;const A=new Set,v=k.filter(e=>{const n=y(e,r,u);return A.has(n)?!1:(A.add(n),!0)}),N=Array.from(new Set(v.map(e=>e.diameter))).sort((e,n)=>e-n),d=w!==null&&N.includes(w)?w:null,m=d===null?v:v.filter(e=>e.diameter===d),Y=K&&N.length>1,ee=e=>{if(e===0)return!1;const n=m[e-1],p=m[e];return n.diameter!==p.diameter||n.width!==p.width},F=e=>o?t("span",{role:"tooltip",className:`pointer-events-none absolute top-1/2 right-0 z-20 hidden w-[520px] -translate-y-1/2 whitespace-normal bg-[var(--tooltip-bg)] px-3 py-2 text-right font-mono ${a.labelXs} normal-case tracking-[0.12em] text-fg shadow-lg group-hover:block max-view-tablet:!hidden`,children:t(pe,{answer:fe(e,Q)})}):null,te=(e,n)=>l("div",{className:h.row,children:[e,m[n.index]?F(m[n.index]):null]}),ne=t("div",{className:G,children:l("table",{className:`w-full border-collapse font-mono ${a.labelXl} tracking-[0.06em] text-fg`,children:[t("thead",{children:t("tr",{children:r.map(({header:e},n)=>t("th",{className:`whitespace-nowrap border-b border-line bg-surface px-4 py-4 text-left ${a.body} font-normal uppercase tracking-[0.22em] text-fg-dim`,children:_(e)},n))})}),t("tbody",{children:m.map((e,n)=>t("tr",{className:`group transition-colors hover:[&>td]:bg-surface ${ee(n)?"[&>td]:border-t [&>td]:border-line":""}`,children:r.map((p,le)=>{const L=le===r.length-1,re=p.fieldKey==="diameter";return l("td",{className:`${L?"relative ":""}${ve}${re?" text-accent":""}`,children:[p.cell(e,u),L?F(e):null]},p.fieldKey)})},y(e,r,u)))})]})});return l(z,{className:f?D:P,children:[f?null:t(I,{num:i!=null?b(i):void 0,title:s!=null?X(s,!1):void 0,description:c!=null?b(c):void 0,accent:!0}),l("div",{className:"mb-6 flex flex-wrap items-center gap-x-2 gap-y-3",children:[Y&&l(oe,{children:[t("span",{className:`mr-2 font-mono ${a.labelSmall} uppercase tracking-[0.24em] text-fg-dim max-view-tablet:mr-0 max-view-tablet:mb-1 max-view-tablet:w-full`,children:"Filter by size:"}),l("button",{type:"button",onClick:()=>E(null),className:`${j} ${d===null?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:d===null?W:void 0,children:[d===null&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),"All"]}),N.map(e=>{const n=e===d;return l("button",{type:"button",onClick:()=>E(n?null:e),className:`${j} ${n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:n?W:void 0,children:[n&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e,'"']},e)})]}),l("button",{type:"button",onClick:()=>C(e=>!e),"aria-pressed":o,"aria-label":o?"Hide vehicle tooltip":"Show vehicle tooltip",className:`ml-auto inline-flex items-center gap-3 font-mono ${a.labelSmall} uppercase tracking-[0.24em] text-fg-dim transition-colors hover:text-fg max-view-tablet:hidden`,children:[t("span",{children:"Vehicle tooltip"}),t("span",{className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 transition-colors ${o?"border-accent":"border-fg-dim/50"}`,style:o?{background:"color-mix(in oklab, var(--accent) 30%, transparent)"}:void 0,"aria-hidden":!0,children:t("span",{className:`block h-3 w-3 rounded-full transition-transform ${o?"translate-x-[18px] bg-accent":"translate-x-[2px] bg-fg-dim"}`})}),t("span",{className:o?"text-accent":"text-fg-dim",children:o?"On":"Off"})]})]}),t(B,{ownerId:T??"",ownerType:"FitmentTable",Template:q,rows:m.map(e=>ce(e,r,u,y(e,r,u))),wrapCopy:te,fallback:ne,children:e=>t("div",{className:h.scroll,children:l("div",{className:h.table,children:[t(B,{ownerId:T??"",ownerType:"FitmentTable",slot:se,Template:J,rows:[de(r,_)],fallback:null,children:n=>t("div",{className:h.head,children:n})}),e]})})}),t(me,{text:M,linkText:U,linkHref:V})]})}export{Ne as default};
@@ -1 +1 @@
1
- "use client";import{jsx as o,jsxs as m}from"react/jsx-runtime";import D from"next/link";import{useEffect as h}from"react";import{useCart as A}from"../CartContext.js";import g from"../QuoteLink.js";import{NO_HIDE as R,useTakeViewHide as B,withViewHide as S}from"efficient-web-builder/render/components/ViewHideRoot";import{useSiteTakesOrders as k}from"../SiteRecordContext.js";import w from"../wheels-plp/PlpNotifyMeDialog.js";import{DEFAULT_PURCHASE_STATE as N}from"../../lib/catalog/purchase.js";import{ADD_TO_BASKET_ATTR as C}from"../../lib/commerce.js";import{STOCK_WORDS as L}from"../../lib/content/stock-words.js";import{tyreCartLine as z}from"../../lib/tyres/tyre-purchase.js";import{UNPRICED_LABEL as H,priceIn as P,resolveWheelPrice as $}from"../../lib/wheels/price-display.js";import{isOneWheelDesign as W,setLabel as I}from"../../lib/wheels/variants.js";import{splitWheelName as V}from"../../lib/wheels/wheel-name.js";import{CARD_TEXT_SIZE as x,CardButtonRow as y}from"./card-row.js";import{TYRE_BUY_CHIPS_CLASS as j,TyreSizeChips as q}from"./CardSizes.js";import{useHeroStateOrNull as F,useProductCardStateOrNull as U,useWheelCardState as G}from"./ProductCardState.js";const O="mt-3 flex flex-col gap-2",u=`cursor-pointer bg-btn px-4 py-3 font-mono ${x.labelSmall} font-bold uppercase tracking-[0.24em] text-btn-ink transition-colors hover:bg-fg`,K=`border border-btn px-4 py-3 text-center font-mono ${x.labelSmall} font-bold uppercase tracking-[0.24em] text-btn transition-colors hover:bg-btn hover:text-btn-ink`,Y="View sizes & fitment",M="mt-3 block font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.18em] text-accent underline-offset-4 group-hover:underline";function X({wheel:e,sel:t,price:n,editing:r}){const{addAndOpen:i,warmCatalog:s}=A();h(()=>{r||s(void 0,e.slug)},[r,s,e.slug]);const{arm:c}=t;h(()=>{c()},[c]);function d(){const a=t.selectedVariant;!a||!t.canAdd||n.priced&&(r||i({id:`${e.slug}|${a.finishName}|${a.size}|quick`,slug:e.slug,name:V(e.name),process:e.process,positionNo:"01",config:[{label:a.size},{label:a.finishName,gold:!0},{label:I(a)}],finishName:a.finishName,size:a.size,components:a.components,qty:1}))}return o("button",{type:"button",onClick:d,[C]:"",disabled:!t.canAdd,className:t.canAdd?u:`${u} opacity-80`,children:"Add to basket"})}function Q(e,t,n){return W(e)?t.outOfStock?"notify":t.unsellable||!n||t.detailState==="ready"&&!t.canAdd?"choose":"add":"choose"}function Z({state:e,buy:t,page:n}){const{wheel:r,sel:i,price:s,editing:c,setNotifyOpen:d}=e,a=k(),l=Q(r,i,s.priced),f=t?l==="notify"?o("button",{type:"button",onClick:()=>d(!0),className:u,children:"Notify me when back"}):l==="add"?a?o(X,{wheel:r,sel:i,price:s,editing:c}):o(g,{className:u}):null:null,p=!n||f?null:m("span",{"aria-hidden":!0,className:M,children:[Y," →"]});return o(y,{children:f||p?m("div",{className:O,children:[f,p]}):null})}function J({state:e}){const{tyre:t,currency:n,pagePath:r,detail:i,variant:s,canAdd:c,detailReady:d,unsellable:a,editing:l}=e,{addAndOpen:f,warmCatalog:p}=A(),b=k();h(()=>{!l&&b&&p("tyre")},[l,b,p]);const _=$(P(t.prices,n),null).priced;function E(){!i||!s||!c||l||f(z(i,s,N.choice,N.qty))}return m(y,{children:[o("div",{className:j,children:o(q,{state:e})}),m("div",{className:O,children:[!a&&_&&!b&&o(g,{className:u}),!a&&_&&b&&o("button",{type:"button",onClick:E,[C]:"",disabled:d&&!c,className:c||!d?`${u}${c?"":" opacity-80"}`:`cursor-not-allowed border border-dashed border-accent/50 px-4 py-3 font-mono ${x.labelSmall} font-bold uppercase tracking-[0.24em] text-accent/70`,children:d&&!c?"Select a size":"Add to basket"}),r&&o(D,{href:r,className:K,children:"Open product page"})]})]})}const ee="w-full px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em]",te="w-full cursor-not-allowed border-2 border-dashed border-fg-dim/20 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-fg-dim/40";function T(e,t){return!t||e.isSet&&!e.priced?"quote":e.priced?e.outOfStock?"outOfStock":"add":"unpriced"}function v({buy:e,takesOrders:t,add:n,take:r=R}){const i=T(e,t);return i==="quote"?o(g,{className:S("w-full cursor-pointer bg-btn px-6 py-4 text-center font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg",r.className)??"",attrs:r.attrs}):i!=="add"?o("button",{type:"button",disabled:!0,"aria-disabled":!0,className:S(te,r.className),...r.attrs,children:i==="outOfStock"?L.outOfStock:H}):m("button",{type:"button",[C]:"",onClick:()=>{const s=e.lineToAdd();s&&n(s)},"aria-disabled":!e.canAdd,className:S([`${ee} transition-colors`,e.canAdd?"cursor-pointer bg-btn text-btn-ink hover:bg-fg hover:text-bg":"cursor-pointer border-2 border-dashed border-accent/50 text-accent/80 hover:border-accent hover:text-accent"].join(" "),r.className),style:e.canAdd?void 0:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},...r.attrs,children:["Add to Cart",e.totalLabel!=null?` · ${e.totalLabel}`:""]})}const re=()=>{};function ne({buy:e,take:t}){const{addAndOpen:n}=A();return o(v,{buy:e,takesOrders:!0,add:r=>n(r),take:t})}function oe({buy:e}){const t=k(),n=B();return n.scope(T(e,t)==="add"?o(ne,{buy:e,take:n}):o(v,{buy:e,takesOrders:t,add:re,take:n}))}function ae({buy:e=!0,page:t=!0}){const n=F(),r=U();if(n)return n.buy?o(oe,{buy:n.buy}):null;if(!r)throw new Error("A product card piece was drawn outside a product card (no ProductCardState).");return r.kind==="bundle"?o(y,{}):r.kind==="tyre"?o(J,{state:r}):o(Z,{state:r,buy:e,page:t})}function _e(){const{wheel:e,sel:t,editing:n,notifyOpen:r,setNotifyOpen:i}=G();return r?o(w,{wheelName:e.name,productSlug:e.slug,finishName:t.confirmedFinishName,variants:t.outOfStockVariants,initialSize:t.selectedVariant?.size,onClose:()=>i(!1),editing:n}):null}export{Y as CARD_PAGE_WORDS,_e as CardBuyDialog,v as HeroBuyButton,ae as default};
1
+ "use client";import{jsx as o,jsxs as m}from"react/jsx-runtime";import B from"next/link";import{useEffect as A}from"react";import{useCart as h}from"../CartContext.js";import C from"../QuoteLink.js";import{NO_HIDE as $,useTakeViewHide as w,withViewHide as g}from"efficient-web-builder/render/components/ViewHideRoot";import{useSiteTakesOrders as S}from"../SiteRecordContext.js";import L from"../wheels-plp/PlpNotifyMeDialog.js";import{DEFAULT_PURCHASE_STATE as x}from"../../lib/catalog/purchase.js";import{ADD_TO_BASKET_ATTR as _}from"../../lib/commerce.js";import{STOCK_WORDS as H}from"../../lib/content/stock-words.js";import{tyreCartLine as P}from"../../lib/tyres/tyre-purchase.js";import{UNPRICED_LABEL as z,priceIn as W,resolveWheelPrice as I}from"../../lib/wheels/price-display.js";import{isOneWheelDesign as V,setLabel as j}from"../../lib/wheels/variants.js";import{splitWheelName as q}from"../../lib/wheels/wheel-name.js";import{CARD_TEXT_SIZE as k,CardButtonRow as y}from"./card-row.js";import{TYRE_BUY_CHIPS_CLASS as U,TyreSizeChips as F}from"./CardSizes.js";import{useHeroStateOrNull as Y,useProductCardStateOrNull as G,useWheelCardState as K}from"./ProductCardState.js";const E="mt-3 flex flex-col gap-2",u=`cursor-pointer bg-btn px-4 py-3 font-mono ${k.labelSmall} font-bold uppercase tracking-[0.24em] text-btn-ink transition-colors hover:bg-fg`,M=`border border-btn px-4 py-3 text-center font-mono ${k.labelSmall} font-bold uppercase tracking-[0.24em] text-btn transition-colors hover:bg-btn hover:text-btn-ink`,Q="View sizes & fitment",X="mt-3 block font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.18em] text-accent underline-offset-4 group-hover:underline";function Z({wheel:t,sel:e,price:n,editing:r}){const{addAndOpen:i,warmCatalog:s}=h();A(()=>{r||s(void 0,t.slug)},[r,s,t.slug]);const{arm:c}=e;A(()=>{c()},[c]);function d(){const a=e.selectedVariant;!a||!e.canAdd||n.priced&&(r||i({id:`${t.slug}|${a.finishName}|${a.size}|quick`,slug:t.slug,name:q(t.name),process:t.process,positionNo:"01",config:[{label:a.size},{label:a.finishName,gold:!0},{label:j(a)}],finishName:a.finishName,size:a.size,components:a.components,qty:1}))}return o("button",{type:"button",onClick:d,[_]:"",disabled:!e.canAdd,className:e.canAdd?u:`${u} opacity-80`,children:"Add to basket"})}function J(t,e,n){return V(t)?e.outOfStock?"notify":e.unsellable||!n||e.detailState==="ready"&&!e.canAdd?"choose":"add":"choose"}function tt({state:t,buy:e,page:n}){const{wheel:r,sel:i,price:s,editing:c,setNotifyOpen:d}=t,a=S(),l=J(r,i,s.priced),f=e?l==="notify"?o("button",{type:"button",onClick:()=>d(!0),className:u,children:"Notify me when back"}):l==="add"?a?o(Z,{wheel:r,sel:i,price:s,editing:c}):o(C,{className:u}):null:null,p=!n||f?null:m("span",{"aria-hidden":!0,className:X,children:[Q," →"]});return o(y,{children:f||p?m("div",{className:E,children:[f,p]}):null})}function et({state:t}){const{tyre:e,currency:n,pagePath:r,detail:i,variant:s,canAdd:c,detailReady:d,unsellable:a,editing:l}=t,{addAndOpen:f,warmCatalog:p}=h(),b=S();A(()=>{!l&&b&&p("tyre")},[l,b,p]);const T=I(W(e.prices,n),null).priced;function v(){!i||!s||!c||l||f(P(i,s,x.choice,x.qty))}return m(y,{children:[o("div",{className:U,children:o(F,{state:t})}),m("div",{className:E,children:[!a&&T&&!b&&o(C,{className:u}),!a&&T&&b&&o("button",{type:"button",onClick:v,[_]:"",disabled:d&&!c,className:c||!d?`${u}${c?"":" opacity-80"}`:`cursor-not-allowed border border-dashed border-accent/50 px-4 py-3 font-mono ${k.labelSmall} font-bold uppercase tracking-[0.24em] text-accent/70`,children:d&&!c?"Select a size":"Add to basket"}),r&&o(B,{href:r,className:M,children:"Open product page"})]})]})}const O="px-6 py-4",N="font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em]",rt=`w-full ${O} ${N}`,nt=`w-full cursor-not-allowed border-2 border-dashed border-fg-dim/20 ${O} ${N} text-fg-dim/40`,ot=`w-full cursor-pointer bg-btn ${O} text-center ${N} text-btn-ink transition-colors hover:bg-fg`;function D(t,e){return!e||t.isSet&&!t.priced?"quote":t.priced?t.outOfStock?"outOfStock":"add":"unpriced"}function R({buy:t,takesOrders:e,add:n,take:r=$}){const i=D(t,e);return i==="quote"?o(C,{className:g(ot,r.className)??"",attrs:r.attrs}):i!=="add"?o("button",{type:"button",disabled:!0,"aria-disabled":!0,className:g(nt,r.className),...r.attrs,children:i==="outOfStock"?H.outOfStock:z}):m("button",{type:"button",[_]:"",onClick:()=>{const s=t.lineToAdd();s&&n(s)},"aria-disabled":!t.canAdd,className:g([`${rt} transition-colors`,t.canAdd?"cursor-pointer bg-btn text-btn-ink hover:bg-fg hover:text-bg":"cursor-pointer border-2 border-dashed border-accent/50 text-accent/80 hover:border-accent hover:text-accent"].join(" "),r.className),style:t.canAdd?void 0:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},...r.attrs,children:["Add to Cart",t.totalLabel!=null?` · ${t.totalLabel}`:""]})}const at=()=>{};function it({buy:t,take:e}){const{addAndOpen:n}=h();return o(R,{buy:t,takesOrders:!0,add:r=>n(r),take:e})}function st({buy:t}){const e=S(),n=w();return n.scope(D(t,e)==="add"?o(it,{buy:t,take:n}):o(R,{buy:t,takesOrders:e,add:at,take:n}))}function ct({buy:t=!0,page:e=!0}){const n=Y(),r=G();if(n)return n.buy?o(st,{buy:n.buy}):null;if(!r)throw new Error("A product card piece was drawn outside a product card (no ProductCardState).");return r.kind==="bundle"?o(y,{}):r.kind==="tyre"?o(et,{state:r}):o(tt,{state:r,buy:t,page:e})}function xt(){const{wheel:t,sel:e,editing:n,notifyOpen:r,setNotifyOpen:i}=K();return r?o(L,{wheelName:t.name,productSlug:t.slug,finishName:e.confirmedFinishName,variants:e.outOfStockVariants,initialSize:e.selectedVariant?.size,onClose:()=>i(!1),editing:n}):null}export{Q as CARD_PAGE_WORDS,xt as CardBuyDialog,R as HeroBuyButton,ct as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as c,Fragment as P}from"react/jsx-runtime";import A from"next/image";import{useState as re}from"react";import{HideTaker as k}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as $,CARD_INDEX_CLASS as B,parseCardIndexFormat as U}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as te,cardImageBackgroundPaints as X,resolveCardImageBackground as ae}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as v}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as ne,boxSwatchFill as le}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as oe}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as ie}from"efficient-easel/screen/lib/document/shadow-values";import{sayCount as se}from"efficient-web-builder/format/lib/editor-words";import{parseSetPicture as ce,setSecondSrc as de}from"../../lib/wheels/set-mode.js";import{coverSrcForWheel as me,parseCoverIndex as fe,resolvePaintedSrc as ue}from"../../lib/wheels/cover-rendering.js";import he from"../WheelPlaceholder.js";import pe from"../BrandPlate.js";import ge from"../TyreImage.js";import{cardSpinOf as Se}from"../card-spin.js";import{useCardHoverLayer as be,useGridCard as E}from"../GridCardTemplate.js";import I from"./CardPicture.js";import z from"./CardProductBadge.js";import{useHeldCardPicture as we}from"./useHeldCardPicture.js";import{useProductCardState as Ce}from"./ProductCardState.js";const qe=["well","full"],Fe="well",j=r=>r==="full"?"full":Fe;function xe({children:r}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:r})}function R({fill:r,badge:t,children:i}){const d=X(r);return c("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${d?"":" bg-surface"}`,style:d?{backgroundColor:r}:void 0,children:[i,t]})}function G(r,t){const i=oe();return le({[ne]:r},i?.row)??ae(t,te)}function ye(r){const t=Ce();return t.kind==="bundle"?e(Pe,{state:t,...r}):t.kind==="tyre"?e(ke,{state:t,...r}):t.kind!=="wheel"?null:e(ve,{state:t,...r})}function Pe({state:r,imageBackground:t,cardImage:i,showBadge:d,frame:S,swatch:f}){const{bundle:n}=r,{imageSizes:u}=E(),m=j(S)==="full",h=n.components.length,p=n.image?m?e(A,{alt:n.name,src:n.image,fill:!0,sizes:u,className:"object-cover",draggable:!1}):e(A,{alt:n.name,src:n.image,width:1e3,height:1e3,sizes:u,className:"block h-full w-full object-cover",draggable:!1}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:se("{n} piece","{n} pieces",h,{})}),l=e(xe,{children:p}),a=G(f,t),g=d!==!1?e(z,{edge:m}):null;return e(k,{style:v(i),children:m?e(R,{fill:a,badge:g,children:l}):c(P,{children:[g,e(I,{image:l,imageBackgroundFill:a})]})})}function ke({state:r,imageBackground:t,cardImage:i,indexBadge:d,frame:S,swatch:f}){const{tyre:n}=r,{imageSizes:u}=E(),m=G(f,t),h=U(d),p=h!=="off"?e("span",{"aria-hidden":!0,"data-format":h,className:`${B} ${$}`}):null,l=e(ge,{image:n.image,className:"h-full w-full",sizes:u,showBackground:!1}),a=e(pe,{brand:n.brand,logo:n.brandLogo});return e(k,{style:v(i),children:j(S)==="full"?c(R,{fill:m,badge:p,children:[l,a]}):c(P,{children:[p,e(I,{image:l,imageBackgroundFill:m,plate:a})]})})}function ve({state:r,imageBackground:t,cardImage:i,coverIndex:d,indexBadge:S,showBadge:f,frame:n,setPicture:u,swatch:m,shadow:h,shadowColor:p}){const{wheel:l,sel:a,isSet:g}=r,{hover:K,imageSizes:T,fit:Z,rules:w,setGridGap:q}=E(),C=Se(K),J=me(l,fe(d),a.finish?.name,a.shownSrc,Z?.holes),[D,Q]=re(()=>new Set),L=o=>{a.pictureFailed(o),Q(b=>b.has(o)?b:new Set(b).add(o))},H=ue({overrideSrc:J,hookSrc:a.shownSrc,failed:D}),O=l.rendersHaveAlpha===!0?ie(h,p):null,V=O?{...C.style,filter:O}:C.style,_=(o,b)=>e(A,{alt:b,src:o,width:1e3,height:1e3,sizes:T,className:`block h-full w-full object-contain ${C.className}`,style:V,draggable:!1,onError:()=>L(o)},o),Y=a.finish?`${l.name} — ${a.finish.name}`:l.name,F=g&&ce(u)==="pair",ee=F?de(l.finishes?.find(o=>o.name===a.finish?.name),H):null,s=we({src:H,second:ee,alt:Y,sizes:T,failed:D,onFailed:L,near:a.nearScreen,holdEmpty:a.awaitingProbe}),W=c(P,{children:[s.src?_(s.src,s.alt):e(he,{imageLabel:l.name,spin:C}),s.trial]}),N=U(S),x=N!=="off",y=G(m,t),M=be("picture",X(y)?y:void 0);if(j(n)==="full"){const o=c(P,{children:[x?e("span",{"aria-hidden":!0,"data-format":N,className:`${B} ${$}`}):null,e(z,{show:f!==!1,numbered:x,sale:w.sale,axleSets:w.axleSets,edge:!0})]});return e(k,{style:v(i),"data-set-picture":g&&!F?"one":void 0,children:c(R,{fill:y,badge:o,children:[c("div",{className:"flex h-full w-full items-center justify-center",children:[W,s.second?_(s.second,`${s.alt} — right`):null]}),M]})})}return c(k,{style:v(i),"data-set-picture":g&&!F?"one":void 0,children:[x?e("span",{"aria-hidden":!0,"data-format":N,className:`${B} ${$}`}):null,e(z,{show:f!==!1,numbered:x,sale:w.sale,axleSets:w.axleSets}),e(I,{image:W,imageSecond:s.second?_(s.second,`${s.alt} — right`):void 0,wide:F,imageBackgroundFill:y,setGridGap:q,plate:M})]})}export{Fe as DEFAULT_PICTURE_FRAME,qe as PICTURE_FRAMES,ye as default};
1
+ "use client";import{jsx as e,jsxs as c,Fragment as P}from"react/jsx-runtime";import{parseOption as re}from"efficient-web-builder/format/lib/parse-option";import A from"next/image";import{useState as te}from"react";import{HideTaker as k}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as $,CARD_INDEX_CLASS as B,parseCardIndexFormat as U}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as ae,cardImageBackgroundPaints as X,resolveCardImageBackground as ne}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as v}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as le,boxSwatchFill as oe}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as ie}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as se}from"efficient-easel/screen/lib/document/shadow-values";import{sayCount as ce}from"efficient-web-builder/format/lib/editor-words";import{parseSetPicture as de,setSecondSrc as me}from"../../lib/wheels/set-mode.js";import{coverSrcForWheel as fe,parseCoverIndex as ue,resolvePaintedSrc as he}from"../../lib/wheels/cover-rendering.js";import pe from"../WheelPlaceholder.js";import ge from"../BrandPlate.js";import Se from"../TyreImage.js";import{cardSpinOf as be}from"../card-spin.js";import{useCardHoverLayer as we,useGridCard as E}from"../GridCardTemplate.js";import I from"./CardPicture.js";import z from"./CardProductBadge.js";import{useHeldCardPicture as Ce}from"./useHeldCardPicture.js";import{useProductCardState as Fe}from"./ProductCardState.js";const xe=["well","full"],ye="well",j=r=>re(xe,ye,r);function Pe({children:r}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:r})}function R({fill:r,badge:t,children:i}){const d=X(r);return c("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${d?"":" bg-surface"}`,style:d?{backgroundColor:r}:void 0,children:[i,t]})}function G(r,t){const i=ie();return oe({[le]:r},i?.row)??ne(t,ae)}function ke(r){const t=Fe();return t.kind==="bundle"?e(ve,{state:t,...r}):t.kind==="tyre"?e(_e,{state:t,...r}):t.kind!=="wheel"?null:e(Ne,{state:t,...r})}function ve({state:r,imageBackground:t,cardImage:i,showBadge:d,frame:S,swatch:f}){const{bundle:n}=r,{imageSizes:u}=E(),m=j(S)==="full",h=n.components.length,p=n.image?m?e(A,{alt:n.name,src:n.image,fill:!0,sizes:u,className:"object-cover",draggable:!1}):e(A,{alt:n.name,src:n.image,width:1e3,height:1e3,sizes:u,className:"block h-full w-full object-cover",draggable:!1}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:ce("{n} piece","{n} pieces",h,{})}),l=e(Pe,{children:p}),a=G(f,t),g=d!==!1?e(z,{edge:m}):null;return e(k,{style:v(i),children:m?e(R,{fill:a,badge:g,children:l}):c(P,{children:[g,e(I,{image:l,imageBackgroundFill:a})]})})}function _e({state:r,imageBackground:t,cardImage:i,indexBadge:d,frame:S,swatch:f}){const{tyre:n}=r,{imageSizes:u}=E(),m=G(f,t),h=U(d),p=h!=="off"?e("span",{"aria-hidden":!0,"data-format":h,className:`${B} ${$}`}):null,l=e(Se,{image:n.image,className:"h-full w-full",sizes:u,showBackground:!1}),a=e(ge,{brand:n.brand,logo:n.brandLogo});return e(k,{style:v(i),children:j(S)==="full"?c(R,{fill:m,badge:p,children:[l,a]}):c(P,{children:[p,e(I,{image:l,imageBackgroundFill:m,plate:a})]})})}function Ne({state:r,imageBackground:t,cardImage:i,coverIndex:d,indexBadge:S,showBadge:f,frame:n,setPicture:u,swatch:m,shadow:h,shadowColor:p}){const{wheel:l,sel:a,isSet:g}=r,{hover:K,imageSizes:T,fit:Z,rules:w,setGridGap:q}=E(),C=be(K),J=fe(l,ue(d),a.finish?.name,a.shownSrc,Z?.holes),[D,Q]=te(()=>new Set),L=o=>{a.pictureFailed(o),Q(b=>b.has(o)?b:new Set(b).add(o))},O=he({overrideSrc:J,hookSrc:a.shownSrc,failed:D}),H=l.rendersHaveAlpha===!0?se(h,p):null,V=H?{...C.style,filter:H}:C.style,_=(o,b)=>e(A,{alt:b,src:o,width:1e3,height:1e3,sizes:T,className:`block h-full w-full object-contain ${C.className}`,style:V,draggable:!1,onError:()=>L(o)},o),Y=a.finish?`${l.name} — ${a.finish.name}`:l.name,F=g&&de(u)==="pair",ee=F?me(l.finishes?.find(o=>o.name===a.finish?.name),O):null,s=Ce({src:O,second:ee,alt:Y,sizes:T,failed:D,onFailed:L,near:a.nearScreen,holdEmpty:a.awaitingProbe}),W=c(P,{children:[s.src?_(s.src,s.alt):e(pe,{imageLabel:l.name,spin:C}),s.trial]}),N=U(S),x=N!=="off",y=G(m,t),M=we("picture",X(y)?y:void 0);if(j(n)==="full"){const o=c(P,{children:[x?e("span",{"aria-hidden":!0,"data-format":N,className:`${B} ${$}`}):null,e(z,{show:f!==!1,numbered:x,sale:w.sale,axleSets:w.axleSets,edge:!0})]});return e(k,{style:v(i),"data-set-picture":g&&!F?"one":void 0,children:c(R,{fill:y,badge:o,children:[c("div",{className:"flex h-full w-full items-center justify-center",children:[W,s.second?_(s.second,`${s.alt} — right`):null]}),M]})})}return c(k,{style:v(i),"data-set-picture":g&&!F?"one":void 0,children:[x?e("span",{"aria-hidden":!0,"data-format":N,className:`${B} ${$}`}):null,e(z,{show:f!==!1,numbered:x,sale:w.sale,axleSets:w.axleSets}),e(I,{image:W,imageSecond:s.second?_(s.second,`${s.alt} — right`):void 0,wide:F,imageBackgroundFill:y,setGridGap:q,plate:M})]})}export{ye as DEFAULT_PICTURE_FRAME,xe as PICTURE_FRAMES,ke as default};
@@ -1,3 +1,3 @@
1
- "use client";import{useEffect as u,useState as f}from"react";import{products as l}from"../lib/api/index.js";const h=new Map,i=new Map;function p(e){const r=e.variants.map(t=>t.specs?.tireType).filter(t=>!!t);return{coverImage:e.coverImage,tyreTypes:[...new Set(r)]}}function m(e){const r=i.get(e);if(r)return r;const t=l.getTyre(e).then(p).catch(n=>{throw i.delete(e),n});return i.set(e,t),t}function d(e){const[r,t]=f(h),n=[...new Set(e)].sort().join(`
2
- `);return u(()=>{if(!n)return;let s=!0;for(const o of n.split(`
3
- `))m(o).then(c=>{s&&t(a=>a.get(o)===c?a:new Map(a).set(o,c))}).catch(c=>{s&&console.error("[useTyreCatalog] tyre read failed",o,c)});return()=>{s=!1}},[n]),r}export{d as useTyreCatalog};
1
+ "use client";import{useEffect as c,useState as f}from"react";import{fetchTyreDetail as l}from"./useTyreDetail.js";const m=new Map,u=new WeakMap;function h(e){const t=e.variants.map(n=>n.specs?.tireType).filter(n=>!!n);return{coverImage:e.coverImage,tyreTypes:[...new Set(t)]}}function p(e){let t=u.get(e);return t||u.set(e,t=h(e)),t}function T(e){return l(e).then(p)}function w(e){const[t,n]=f(m),s=[...new Set(e)].sort().join(`
2
+ `);return c(()=>{if(!s)return;let a=!0;for(const r of s.split(`
3
+ `))T(r).then(o=>{a&&n(i=>i.get(r)===o?i:new Map(i).set(r,o))}).catch(o=>{a&&console.error("[useTyreCatalog] tyre read failed",r,o)});return()=>{a=!1}},[s]),t}export{w as useTyreCatalog};
@@ -1,5 +1,6 @@
1
1
  import { type Tyre } from "../lib/api/index.js";
2
2
  export type TyreDetailState = "idle" | "loading" | "ready" | "error";
3
+ export declare function fetchTyreDetail(slug: string): Promise<Tyre>;
3
4
  export declare function useTyreDetail(slug: string | null, enabled: boolean): {
4
5
  state: TyreDetailState;
5
6
  tyre: Tyre | null;
@@ -1 +1 @@
1
- "use client";import{useEffect as u,useState as a}from"react";import{products as d}from"../lib/api/index.js";const o=new Map;function h(e){const t=o.get(e);if(t)return t;const c=d.getTyre(e).catch(r=>{throw o.delete(e),r});return o.set(e,c),c}function p(e,t){const[c,r]=a("idle"),[i,f]=a(null);return u(()=>{if(!t||!e)return;let n=!1;return r("loading"),h(e).then(s=>{n||(f(s),r("ready"))}).catch(()=>{n||r("error")}),()=>{n=!0}},[e,t]),{state:c,tyre:i}}export{p as useTyreDetail};
1
+ "use client";import{useEffect as u,useState as a}from"react";import{products as d}from"../lib/api/index.js";const o=new Map;function h(e){const t=o.get(e);if(t)return t;const c=d.getTyre(e).catch(r=>{throw o.delete(e),r});return o.set(e,c),c}function y(e,t){const[c,r]=a("idle"),[i,f]=a(null);return u(()=>{if(!t||!e)return;let n=!1;return r("loading"),h(e).then(s=>{n||(f(s),r("ready"))}).catch(()=>{n||r("error")}),()=>{n=!0}},[e,t]),{state:c,tyre:i}}export{h as fetchTyreDetail,y as useTyreDetail};
@@ -417,6 +417,7 @@ export type BookingAvailability = components["schemas"]["BookingAvailability"];
417
417
  export type BookingRequest = components["schemas"]["BookingRequest"];
418
418
  export type BookingConfirmation = components["schemas"]["BookingConfirmation"];
419
419
  export type BookingPublic = components["schemas"]["BookingPublic"];
420
+ export type BookingRescheduleRequest = components["schemas"]["BookingRescheduleRequest"];
420
421
  export type BookingPaymentIntent = components["schemas"]["BookingPaymentIntent"];
421
422
  export declare const bookings: {
422
423
  listServices: () => Promise<BookingServiceList>;
@@ -424,6 +425,7 @@ export declare const bookings: {
424
425
  create: (body: BookingRequest) => Promise<BookingConfirmation>;
425
426
  get: (token: string) => Promise<BookingPublic>;
426
427
  cancel: (token: string) => Promise<BookingPublic>;
428
+ reschedule: (token: string, startAt: string) => Promise<BookingPublic>;
427
429
  createPaymentIntent: (manageToken: string) => Promise<BookingPaymentIntent>;
428
430
  };
429
431
  export interface AdminStorefrontPage {
@@ -1 +1 @@
1
- import{PREVIEW_TOKEN_HEADER as dt,SITE_HOST_HEADER as ut,SITE_SLUG_HEADER as lt}from"../site-headers.js";import{PRODUCT_API_BASE as pt,PRODUCT_BACKEND_URL as H}from"./origins.js";import{listRows as m}from"./list-rows.js";import{backendHopHeaders as yt,clientIpFromForwardedFor as ht,FORWARDED_FOR_HEADER as ft,hopCachingOf as gt}from"../forwarded-for.js";import mt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as O}from"../auth.js";import{efficientClientOpen as wt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as U}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as F}from"../wheels/renderable-finishes.js";const St=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class w extends Error{status;data;constructor(e,n,s){super(n),this.status=e,this.data=s}}const v="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.",Pt=new Set([502,503,504]),k=0,Ot="This editor runs on its host's own backend, which does not serve this request.",bt=5e3,Tt=15e3,At=()=>typeof window>"u"?bt:Tt;function M(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(At())}const B=t=>t instanceof Error&&t.name==="TimeoutError",q=(t,e)=>Pt.has(t)?v:e,Rt=["admin","venue"];let G="admin";function _e(t){G=Rt.includes(t)?t:"admin"}function Et(){return G}const _t=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let W=null;function Ue(t){W=t&&_t.test(t)?t:null}function Ut(){return W}function $t(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=Y();return!e||/[?&]site=/.test(t)?t:$(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:n,baseUrl:s,headers:u,audience:l,...y}=e;if(typeof window<"u"&&!wt())throw new w(k,Ot,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) 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.`);const a=typeof FormData<"u"&&y.body instanceof FormData;let r;try{r=await fetch(`${s??St}${$t(t)}`,{...y,headers:{...a?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...u},signal:y.signal??M({...y,audience:l})})}catch(h){throw h instanceof TypeError||B(h)?new w(k,v,null):h}let o;try{o=await r.text()}catch(h){throw B(h)?new w(k,v,null):h}let p=null;if(o)try{p=JSON.parse(o)}catch{throw new w(r.status,r.ok?"Expected JSON but received a non-JSON response":q(r.status,r.statusText),o)}if(!r.ok){const h=(p&&typeof p=="object"&&"detail"in p&&typeof p.detail=="string"?p.detail:null)??q(r.status,r.statusText);throw new w(r.status,h,p)}return p}let A=null;async function j(){return A||(A=Ct().finally(()=>{A=null}),A)}async function Ct(){const t=O.takeLegacyRefresh(),e=await vt.refresh(t??void 0);return O.setTokens(e.access),e.access}async function z(){return O.getAccess()??j()}async function g(t,e={}){let n;try{n=await z()}catch{throw O.clear(),new w(401,"Not signed in",null)}try{return await i(t,{...e,token:n})}catch(s){if(!(s instanceof w)||s.status!==401)throw s;try{const u=await j();return await i(t,{...e,token:u})}catch{throw O.clear(),s}}}const Nt=100,K=20;function It(t){if(!t)return null;try{return new URL(t,"http://page.invalid").searchParams.get("page")}catch{return null}}async function V(t,e){const[n,s=""]=t.split("?"),u=[];let l="1";for(let y=0;y<K&&l;y++){const a=new URLSearchParams(s);a.set("page_size",String(Nt)),l!=="1"&&a.set("page",l);const r=await g(`${n}?${a.toString()}`);u.push(...m(r)),l=It(r.next)}return l&&console.warn(`[${e}] stopped at ${K} pages (${u.length} rows); list may be truncated`),u}async function X(t,e={}){if(O.getAccess())try{return{data:await g(t,e),asShopper:!0}}catch(n){if(!(n instanceof w)||n.status!==401)throw n}return{data:await i(t,e),asShopper:!1}}async function Z(){const t=await g("/api/auth/me/");if(t.portal!=="shop")throw O.clear(),new w(403,"This session is not valid for this shop.",null);return t}const vt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{O.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await z();return await Z(),t},me:Z,updateMe:t=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>g("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>g("/api/shop-portal/profile/"),updateMyProfile:t=>g("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>g("/api/shop-portal/delivery-locations/"),createAddress:t=>g("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,n)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:n})}),brands:()=>g("/api/products/brands/"),myOrders:()=>V("/api/shop-portal/orders/","api.myOrders"),myOrder:t=>g(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>g(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>V(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`,"api.myReturns"),createReturn:t=>g("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>g(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const n=new FormData;return n.append("claim_item",t),n.append("file",e),n.append("media_type",e.type.startsWith("video/")?"video":"image"),g("/api/shop-portal/return-media/",{method:"POST",body:n})}};import{media as kt,absolutizeApiUrl as L}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Lt,isSvgUrl as Jt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as xt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Dt,webRuntimeSiteSlug as Y}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Ht}from"../sections/dealer-finder.js";import{SIGN_UP_PATH as Ft,SIGN_UP_VERIFY_PATH as Mt,SIGN_UP_WAITING_PATH as Bt,WORKSPACE_FINDS_PATH as qt,WORKSPACE_FIND_OPEN_PATH as Gt,signInUrlOf as Wt,readLinkAnswer as Q,readSignUpAvailability as jt,readSignUpSent as zt,signUpAvailabilityPath as Kt}from"../sections/sign-up.js";function S(t){if(typeof t=="string")return t.startsWith("/media/")?kt(t):t;if(Array.isArray(t))return t.map(S);if(t&&typeof t=="object"){const e={};for(const[n,s]of Object.entries(t))e[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([u,l])=>[S(u),l])):S(s);return e}return t}import{PRODUCT_API_BASE as Ve}from"./origins.js";const tt=typeof window>"u"&&H!=="",Vt=tt?H:pt,Xt=Dt,b=()=>({baseUrl:Xt(),audience:null});function c(t,e){const n=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${n}`}const et=100,at=50;function J(t,e,n){const s=new URLSearchParams;for(const[u,l]of Object.entries(e))l!=null&&l!==""&&s.set(u,String(l));return s.set("pageSize",String(et)),n&&s.set("cursor",n),`/api/v1${t}?${s.toString()}`}function Zt(t,e){return J("/wheels",{process:t},e)}const rt=et;function Yt(t,e){return J("/wheels",{slug:t.join(",")},e)}function Qt(t,e,n){return J("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},n)}function te(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function x(t,e,n=()=>!1,s=()=>!1){const u=[];let l=null;try{for(let y=0;y<at;y++){const a=await i(await e(l),await d());if(u.push(...m(a)),l=te(a.next),!l)break;if(s(u))return u}l&&console.warn(`[${t}] stopped at ${at} pages (${u.length} rows); catalog may be truncated`)}catch(y){if(n(y))throw y;console.warn(`[${t}] product API unavailable, returning []`,y)}return u}const nt=t=>t instanceof w&&t.status===400;function st(t){return t.flatMap(e=>e.kind==="alloy-wheel"?U([e]):[e])}async function ot(){return(await ee()).host}async function ee(){try{const{headers:t}=await import("next/headers"),e=await t(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(e.get(ut)??e.get("x-forwarded-host")??e.get("host")),u=n(e.get("host"));return{host:s,matchesRequestHost:s!==null&&s===u}}catch{return{host:null,matchesRequestHost:!1}}}async function ae(){try{const{headers:t}=await import("next/headers");return ht((await t()).get(ft))}catch{return null}}async function re(){try{const{headers:t}=await import("next/headers");return(await t()).get(lt)||null}catch{return null}}async function ne(){const t=await re();if(t)return`site=${encodeURIComponent(t)}`;const e=await ot();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=Y();return e?$(t,`site=${encodeURIComponent(e)}`):t}return $(t,await ne())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const se="preview";async function oe(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(dt)}catch{return null}}async function ie(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function D(t,e){const n=await oe();if(n===null)return[await f(t),await d(e)];const s=$(await f(t),`${se}=${encodeURIComponent(n)}`),{next:u,cache:l,...y}=e??{},a=await d({...y,cache:"no-store"}),r=await ie();return r&&(a.headers={...a.headers,"user-agent":r}),[s,a]}async function ce(t){if(!tt)return;const[e,n]=await Promise.all([ot(),ae()]),s=yt(e,n,t);return Object.keys(s).length>0?s:void 0}async function d(t){const e=await ce(gt(t)),n={baseUrl:Vt,...t};return e&&(n.headers={...e,...t?.headers}),n}const R=typeof window>"u";function E(t,e){const n=new URLSearchParams;for(const[u,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(u,String(l));const s=n.toString();return`/api/v1/fitment${t}${s?`?${s}`:""}`}const Le={listMakes:async t=>{if(R){const{fitmentData:n}=await import("./fitment-data.js");return n.makes(t)}const e=await i(E("/makes",{region:t}),b());return m(e)},listModels:async(t,e)=>{if(R){const{fitmentData:s}=await import("./fitment-data.js");return s.models(t,e)}const n=await i(E("/models",{make:t,region:e}),b());return m(n)},listYears:async(t,e,n)=>{if(R){const{fitmentData:u}=await import("./fitment-data.js");return u.years(t,e,n)}const s=await i(E("/years",{make:t,model:e,region:n}),b());return m(s)},listModifications:async(t,e,n,s)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.modifications(t,e,n,s)}const u=await i(E("/modifications",{make:t,model:e,year:n,region:s}),b());return m(u)},getStockFitment:async(t,e,n,s,u)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.stockFitment(t,e,n,s,u)}return i(E("/stock-fitment",{make:t,model:e,year:n,modification:s,region:u}),b())}},Je={listWheels:async(t,e={})=>{const n=await x("products.listWheels",async s=>await f(Zt(t,s)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:s=>U([...s]).length>=e.maxRows);return U(S(n))},listWheelsBySlug:async(t,e={})=>{const n=[...new Set(t.map(a=>a.trim()).filter(Boolean))];if(n.length===0)return[];const s=[];for(let a=0;a<n.length;a+=rt)s.push(n.slice(a,a+rt));const u=await Promise.all(s.map(a=>x("products.listWheelsBySlug",async r=>await f(Yt(a,r)),e.throwOnFailure?()=>!0:nt))),l=new Set(n),y=u.flat().filter(a=>l.has(a.slug));return U(S(y))},listCatalog:async(t,e,n={})=>{if(t.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` — so the call would silently return the wheel catalog instead of nothing.");const s=await x("products.listCatalog",async u=>await f(Qt(t,e,u)),n.throwOnFailure?()=>!0:nt,n.maxRows===void 0?void 0:u=>st([...u]).length>=n.maxRows);return st(S(s))},getWheel:async t=>F(S(await i(await f(c(`/wheels/${t}`)),await d()))),getTyre:async t=>S(await i(await f(c(`/tyres/${t}`)),await d())),listBundles:async(t={})=>{try{return await i(await f(c("/bundles")),await d())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(c(`/bundles/${t}`)),await d()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:n=null}=t;if(typeof window>"u"){const{listGalleryBuilds:s}=await import("./gallery-builds-data.js");return S(s(e,n))}try{const s=new URLSearchParams;e&&s.set("process",e),n&&s.set("wheelSlug",n);const u=s.toString(),l=await i(`/api/v1/gallery-builds${u?`?${u}`:""}`,b());return S(m(l))}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>i(await f(c("/site")),await d()),getSiteBySlug:async t=>i(`${c("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await d():void 0),listPages:async()=>S(await i(await f(c("/pages")),await d())),listPopups:async()=>i(await f(c("/popups")),await d()),listProductTemplates:async()=>{try{return await i(await f(c("/product-templates")),await d())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${c("/dynamic-pages")}${e}`),await d())}catch(n){if(n instanceof w&&n.status===404)return[];throw n}},getRecord:async(t,e)=>{try{return await i(await f(c(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await d())}catch(n){if(n instanceof w&&n.status===404)return null;throw n}},listRecordKeys:async t=>{try{const e=await i(await f(c(`/records/${encodeURIComponent(t)}`)),await d({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(e){if(e instanceof w&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(c("/product-type-choices")),await d())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(c("/field-usage")),await d())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const n=e.record?`?record=${encodeURIComponent(e.record)}`:"",[s,u]=await D(c(`/pages/${t}`)+n,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return S(await i(s,u))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const n=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(c("/blog-posts")+n,await d())).map(u=>({...u,coverImage:L(u.coverImage)??""}))}catch(s){if(e)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(c(`/blog-posts/${t}`),await d());return{...e,coverImage:L(e.coverImage)??""}},createOrder:async t=>i(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>g(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(c("/orders/lookup"),await d({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(c("/payments/intent"),await d({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(c("/checkouts/release"),await d({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(c("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(c("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(c("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(c("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(c("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(c("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(c("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(c("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(c("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(c("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(c("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(c("/stock-alerts"),await d({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(c("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(c("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(c("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(c("/carts"),await d({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(c("/carts/restore"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(c("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const n=c("/reviews"),s=e.toString();try{return await i(await f(s?`${n}?${s}`:n),await d())}catch(u){return console.warn("[products.listReviews] product API unavailable, returning []",u),[]}},submitReview:async t=>i(c("/reviews"),await d({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(c(`/forms/${encodeURIComponent(t)}`),await d()),submitForm:async(t,e)=>i(c(`/forms/${encodeURIComponent(t)}/submissions`),await d({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(c("/shipping-methods"),await d())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(c(`/countries/${encodeURIComponent(t)}/subdivisions`),await d())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=c("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await X(e,n)).data:i(e,n)},validateCoupon:async t=>{const{data:e,asShopper:n}=await X(c("/coupons/validate"),await d({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:n}},getHeaderSettings:async()=>{const t=M({method:"GET"}),e=await i(...await D(c("/header-settings"),{signal:t})),n=L(e.logoUrl);let s=null,u=null;if(n&&Jt(n)){const l=await Lt(n,t);l&&(s=l.reversed,u=l.inkIsDark)}return{...e,logoUrl:n,logoReversed:s,logoInkIsDark:u}},getThemeSettings:async()=>i(...await D(c("/theme-settings"))),getChatSettings:async()=>i(await f(c("/chat-settings")),await d())},xe={listServices:async()=>{try{return await i(c("/bookings/services"),await d())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(c(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await d()),create:async t=>i(c("/bookings"),await d({method:"POST",body:JSON.stringify(t)})),get:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}`),await d()),cancel:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await d({method:"POST"})),createPaymentIntent:async t=>i(c("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:t})}))};class de extends Error{slug;count;constructor(e,n){super(`Slug "${e}" exists on ${n} websites; a site is required to pick one.`),this.slug=e,this.count=n,this.name="AmbiguousPageSlugError"}}const C=(t,e,n)=>{const s=new URLSearchParams({...e?{site:e}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${s?`?${s}`:""}`},N=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,ue=t=>`${N(t)}currencies/`,le="/api/storefront/media/ingest/";class pe 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 ye(){const t=xt();if(!t)throw new pe;return`${le}?${new URLSearchParams({site:t})}`}const he="X-Puck-Media-Manifest",it=mt.contentHash,I={"X-Media-Manifest":it,[he]:it},De=ct({});function ct(t){return(e,n={})=>{const s=Ut(),u=t.headers||s?{...s?{"Accept-Language":s}:{},...t.headers,...n.headers}:void 0;return i(e,{...n,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...u?{headers:u}:{},audience:t.audience??Et()})}}function fe(t={}){const e=ct(t),n=t.siteDrafts===!0,s=a=>C("header-settings",a,n),u=a=>C("theme-settings",a,n),l=a=>C("chat-settings",a,n),y=a=>C("social-settings",a,n);return{findPageBySlug:async(a,r,o)=>{const p=new URLSearchParams({slug:a});o&&p.set("site",o);const h=await e(`/api/storefront/pages/?${p.toString()}`,{token:r}),P=m(h);if(!o&&P.length>1)throw new de(a,P.length);return P[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,o,p,h)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:p,...h?{client_id:h}:{}}),token:o}),duplicatePage:(a,r,o)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:o}),geocode:(a,r,o)=>e(`/api/storefront/geocode/?${new URLSearchParams(o?{q:a,country:o}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,o,p=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:p}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,o)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:I,token:o}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,o)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),listTemplatePages:async(a,r)=>{const o=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return m(o)},getPageLibrary:async a=>{const r=await e("/api/storefront/page-templates/?is_page_library=true&is_active=true",{token:a});return m(r)[0]??null},getTemplateLibrary:(a,r)=>e(`/api/storefront/pages/template-library/?site=${encodeURIComponent(a)}`,{token:r}),createPageFromTemplate:(a,r)=>e(`/api/storefront/pages/from-template/${n?"?draft=1":""}`,{method:"POST",body:JSON.stringify(a),token:r}),findTemplatePageBySlug:async(a,r,o)=>{const p=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:o});return m(p)[0]??null},createTemplatePage:(a,r,o)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:I,token:o}),saveTemplatePageLayout:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),deleteTemplatePage:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/pages/?${o.toString()}`,{token:a});return m(p)},createPage:(a,r,o,p)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:o}),token:p}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(s(r),{token:a}),listMenus:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/menus/?${o}`,{token:a});return m(p)},listBlogPosts:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/blog-posts/?${o.toString()}`,{token:a});return m(p)},listFieldUsage:async(a,r)=>{const o=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/categories/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.sort_order-_.sort_order||P.name.localeCompare(_.name))},listForms:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/forms/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.title.localeCompare(_.title))},listWheelSummaries:async(a,r={})=>{const o=new URLSearchParams;r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/wheel-curations/summaries/${p?`?${p}`:""}`,{token:a});return S(h)},listProducts:async(a,r={})=>{const o=new URLSearchParams;r.kinds?.length&&o.set("kind",r.kinds.join(",")),r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/products/${p?`?${p}`:""}`,{token:a});return S(h)},getWheelDetail:async(a,r,o={})=>{const p=new URLSearchParams({slug:r});return o.siteId&&p.set("site",o.siteId),F(S(await e(`/api/storefront/wheel-curations/detail/?${p.toString()}`,{token:a})))},updateHeaderSettings:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(N(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return m(r)},listSiteCurrencies:async(a,r)=>{const o=await e(ue(a),{token:r});return Array.isArray(o)?o:[]},publishSite:(a,r)=>e(`${N(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${N(a)}live-state/`,{token:r}),getThemeSettings:(a,r)=>e(u(r),{token:a}),updateThemeSettings:(a,r,o)=>e(u(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getMyPreferences:async a=>(await e("/api/auth/me/",{token:a})).preferences??{},updateMyPreferences:(a,r)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:a}),token:r}),getChatSettings:(a,r)=>e(l(r),{token:a}),updateChatSettings:(a,r,o)=>e(l(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(y(r),{token:a}),updateSocialSettings:(a,r,o)=>e(y(o),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,o)=>{const p=new FormData;return p.append("logo",a),e(s(o),{method:"PATCH",body:p,token:r})},clearHeaderLogo:(a,r)=>e(s(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const o=new FormData;return o.append("file",a),e(ye(),{method:"POST",body:o,token:r})},listMedia:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("kind",r);const p=await e(`/api/storefront/media-assets/?${o.toString()}`,{token:a});return m(p)}}}const He=fe({siteDrafts:!0});function ge(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function Fe(t){return Ht(await i(ge(t)))}const T={audience:null,baseUrl:""};async function Me(t,e){return jt(await i(Kt(t,e),T))}async function Be(t){return zt(await i(Ft,{...T,method:"POST",body:JSON.stringify(t)}))}async function qe(t){try{const e=await i(Mt,{...T,method:"POST",body:JSON.stringify({token:t})});return Q(202,e)}catch(e){if(e instanceof w)return Q(e.status,e.data);throw e}}async function Ge(t,e){await i(Bt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function We(t,e){await i(qt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function je(t){try{return Wt(await i(Gt,{...T,method:"POST",body:JSON.stringify({token:t})}))}catch(e){if(e instanceof w&&me.has(e.status))return"";throw e}}const me=new Set([400,404,410]);export{St as API_URL,de as AmbiguousPageSlugError,w as ApiError,Tt as BROWSER_READ_TIMEOUT_MS,Ot as EFFICIENT_CLIENT_CLOSED_MESSAGE,pe as MediaUploadDestinationError,se as PREVIEW_PARAM,Ve as PRODUCT_API_BASE,bt as SERVER_READ_TIMEOUT_MS,v as SERVER_UNREACHABLE_MESSAGE,k as STATUS_NETWORK_ERROR,De as adminFetch,vt as api,i as apiFetch,$ as appendSiteQuery,We as askForWorkspaces,Be as askToSignUp,xe as bookings,fe as createStorefrontAdmin,ge as dealersPath,M as defaultRequestDeadline,ye as editorMediaUploadPath,Et as editorPortalAudience,Ut as editorRequestLanguage,Fe as fetchDealers,Me as fetchSignUpAvailability,Le as fitment,Ge as joinSignUpWaitingList,qe as openSignUpLink,je as openWorkspaceFind,Je as products,At as readDeadlineMs,ae as resolveClientIp,S as resolveMediaUrls,oe as resolvePreviewToken,ot as resolveSiteHost,ee as resolveSiteHostSource,re as resolveSiteSlug,Ue as setEditorLanguage,_e as setEditorPortalAudience,He as storefrontAdmin};
1
+ import{PREVIEW_TOKEN_HEADER as dt,SITE_HOST_HEADER as ut,SITE_SLUG_HEADER as lt}from"../site-headers.js";import{PRODUCT_API_BASE as pt,PRODUCT_BACKEND_URL as H}from"./origins.js";import{listRows as m}from"./list-rows.js";import{backendHopHeaders as yt,clientIpFromForwardedFor as ht,FORWARDED_FOR_HEADER as ft,hopCachingOf as gt}from"../forwarded-for.js";import mt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as O}from"../auth.js";import{efficientClientOpen as wt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as U}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as F}from"../wheels/renderable-finishes.js";const St=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class w extends Error{status;data;constructor(e,n,s){super(n),this.status=e,this.data=s}}const v="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.",Pt=new Set([502,503,504]),k=0,Ot="This editor runs on its host's own backend, which does not serve this request.",bt=5e3,Tt=15e3,At=()=>typeof window>"u"?bt:Tt;function M(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(At())}const B=t=>t instanceof Error&&t.name==="TimeoutError",q=(t,e)=>Pt.has(t)?v:e,Rt=["admin","venue"];let G="admin";function _e(t){G=Rt.includes(t)?t:"admin"}function Et(){return G}const _t=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let W=null;function Ue(t){W=t&&_t.test(t)?t:null}function Ut(){return W}function $t(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=Y();return!e||/[?&]site=/.test(t)?t:$(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:n,baseUrl:s,headers:u,audience:l,...y}=e;if(typeof window<"u"&&!wt())throw new w(k,Ot,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) 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.`);const a=typeof FormData<"u"&&y.body instanceof FormData;let r;try{r=await fetch(`${s??St}${$t(t)}`,{...y,headers:{...a?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...u},signal:y.signal??M({...y,audience:l})})}catch(h){throw h instanceof TypeError||B(h)?new w(k,v,null):h}let o;try{o=await r.text()}catch(h){throw B(h)?new w(k,v,null):h}let p=null;if(o)try{p=JSON.parse(o)}catch{throw new w(r.status,r.ok?"Expected JSON but received a non-JSON response":q(r.status,r.statusText),o)}if(!r.ok){const h=(p&&typeof p=="object"&&"detail"in p&&typeof p.detail=="string"?p.detail:null)??q(r.status,r.statusText);throw new w(r.status,h,p)}return p}let A=null;async function j(){return A||(A=Ct().finally(()=>{A=null}),A)}async function Ct(){const t=O.takeLegacyRefresh(),e=await vt.refresh(t??void 0);return O.setTokens(e.access),e.access}async function z(){return O.getAccess()??j()}async function g(t,e={}){let n;try{n=await z()}catch{throw O.clear(),new w(401,"Not signed in",null)}try{return await i(t,{...e,token:n})}catch(s){if(!(s instanceof w)||s.status!==401)throw s;try{const u=await j();return await i(t,{...e,token:u})}catch{throw O.clear(),s}}}const Nt=100,K=20;function It(t){if(!t)return null;try{return new URL(t,"http://page.invalid").searchParams.get("page")}catch{return null}}async function V(t,e){const[n,s=""]=t.split("?"),u=[];let l="1";for(let y=0;y<K&&l;y++){const a=new URLSearchParams(s);a.set("page_size",String(Nt)),l!=="1"&&a.set("page",l);const r=await g(`${n}?${a.toString()}`);u.push(...m(r)),l=It(r.next)}return l&&console.warn(`[${e}] stopped at ${K} pages (${u.length} rows); list may be truncated`),u}async function X(t,e={}){if(O.getAccess())try{return{data:await g(t,e),asShopper:!0}}catch(n){if(!(n instanceof w)||n.status!==401)throw n}return{data:await i(t,e),asShopper:!1}}async function Z(){const t=await g("/api/auth/me/");if(t.portal!=="shop")throw O.clear(),new w(403,"This session is not valid for this shop.",null);return t}const vt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{O.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await z();return await Z(),t},me:Z,updateMe:t=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>g("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>g("/api/shop-portal/profile/"),updateMyProfile:t=>g("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>g("/api/shop-portal/delivery-locations/"),createAddress:t=>g("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,n)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:n})}),brands:()=>g("/api/products/brands/"),myOrders:()=>V("/api/shop-portal/orders/","api.myOrders"),myOrder:t=>g(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>g(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>V(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`,"api.myReturns"),createReturn:t=>g("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>g(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const n=new FormData;return n.append("claim_item",t),n.append("file",e),n.append("media_type",e.type.startsWith("video/")?"video":"image"),g("/api/shop-portal/return-media/",{method:"POST",body:n})}};import{media as kt,absolutizeApiUrl as L}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Lt,isSvgUrl as Jt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as xt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Dt,webRuntimeSiteSlug as Y}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Ht}from"../sections/dealer-finder.js";import{SIGN_UP_PATH as Ft,SIGN_UP_VERIFY_PATH as Mt,SIGN_UP_WAITING_PATH as Bt,WORKSPACE_FINDS_PATH as qt,WORKSPACE_FIND_OPEN_PATH as Gt,signInUrlOf as Wt,readLinkAnswer as Q,readSignUpAvailability as jt,readSignUpSent as zt,signUpAvailabilityPath as Kt}from"../sections/sign-up.js";function S(t){if(typeof t=="string")return t.startsWith("/media/")?kt(t):t;if(Array.isArray(t))return t.map(S);if(t&&typeof t=="object"){const e={};for(const[n,s]of Object.entries(t))e[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([u,l])=>[S(u),l])):S(s);return e}return t}import{PRODUCT_API_BASE as Ve}from"./origins.js";const tt=typeof window>"u"&&H!=="",Vt=tt?H:pt,Xt=Dt,b=()=>({baseUrl:Xt(),audience:null});function c(t,e){const n=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${n}`}const et=100,at=50;function J(t,e,n){const s=new URLSearchParams;for(const[u,l]of Object.entries(e))l!=null&&l!==""&&s.set(u,String(l));return s.set("pageSize",String(et)),n&&s.set("cursor",n),`/api/v1${t}?${s.toString()}`}function Zt(t,e){return J("/wheels",{process:t},e)}const rt=et;function Yt(t,e){return J("/wheels",{slug:t.join(",")},e)}function Qt(t,e,n){return J("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},n)}function te(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function x(t,e,n=()=>!1,s=()=>!1){const u=[];let l=null;try{for(let y=0;y<at;y++){const a=await i(await e(l),await d());if(u.push(...m(a)),l=te(a.next),!l)break;if(s(u))return u}l&&console.warn(`[${t}] stopped at ${at} pages (${u.length} rows); catalog may be truncated`)}catch(y){if(n(y))throw y;console.warn(`[${t}] product API unavailable, returning []`,y)}return u}const nt=t=>t instanceof w&&t.status===400;function st(t){return t.flatMap(e=>e.kind==="alloy-wheel"?U([e]):[e])}async function ot(){return(await ee()).host}async function ee(){try{const{headers:t}=await import("next/headers"),e=await t(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(e.get(ut)??e.get("x-forwarded-host")??e.get("host")),u=n(e.get("host"));return{host:s,matchesRequestHost:s!==null&&s===u}}catch{return{host:null,matchesRequestHost:!1}}}async function ae(){try{const{headers:t}=await import("next/headers");return ht((await t()).get(ft))}catch{return null}}async function re(){try{const{headers:t}=await import("next/headers");return(await t()).get(lt)||null}catch{return null}}async function ne(){const t=await re();if(t)return`site=${encodeURIComponent(t)}`;const e=await ot();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=Y();return e?$(t,`site=${encodeURIComponent(e)}`):t}return $(t,await ne())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const se="preview";async function oe(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(dt)}catch{return null}}async function ie(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function D(t,e){const n=await oe();if(n===null)return[await f(t),await d(e)];const s=$(await f(t),`${se}=${encodeURIComponent(n)}`),{next:u,cache:l,...y}=e??{},a=await d({...y,cache:"no-store"}),r=await ie();return r&&(a.headers={...a.headers,"user-agent":r}),[s,a]}async function ce(t){if(!tt)return;const[e,n]=await Promise.all([ot(),ae()]),s=yt(e,n,t);return Object.keys(s).length>0?s:void 0}async function d(t){const e=await ce(gt(t)),n={baseUrl:Vt,...t};return e&&(n.headers={...e,...t?.headers}),n}const R=typeof window>"u";function E(t,e){const n=new URLSearchParams;for(const[u,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(u,String(l));const s=n.toString();return`/api/v1/fitment${t}${s?`?${s}`:""}`}const Le={listMakes:async t=>{if(R){const{fitmentData:n}=await import("./fitment-data.js");return n.makes(t)}const e=await i(E("/makes",{region:t}),b());return m(e)},listModels:async(t,e)=>{if(R){const{fitmentData:s}=await import("./fitment-data.js");return s.models(t,e)}const n=await i(E("/models",{make:t,region:e}),b());return m(n)},listYears:async(t,e,n)=>{if(R){const{fitmentData:u}=await import("./fitment-data.js");return u.years(t,e,n)}const s=await i(E("/years",{make:t,model:e,region:n}),b());return m(s)},listModifications:async(t,e,n,s)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.modifications(t,e,n,s)}const u=await i(E("/modifications",{make:t,model:e,year:n,region:s}),b());return m(u)},getStockFitment:async(t,e,n,s,u)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.stockFitment(t,e,n,s,u)}return i(E("/stock-fitment",{make:t,model:e,year:n,modification:s,region:u}),b())}},Je={listWheels:async(t,e={})=>{const n=await x("products.listWheels",async s=>await f(Zt(t,s)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:s=>U([...s]).length>=e.maxRows);return U(S(n))},listWheelsBySlug:async(t,e={})=>{const n=[...new Set(t.map(a=>a.trim()).filter(Boolean))];if(n.length===0)return[];const s=[];for(let a=0;a<n.length;a+=rt)s.push(n.slice(a,a+rt));const u=await Promise.all(s.map(a=>x("products.listWheelsBySlug",async r=>await f(Yt(a,r)),e.throwOnFailure?()=>!0:nt))),l=new Set(n),y=u.flat().filter(a=>l.has(a.slug));return U(S(y))},listCatalog:async(t,e,n={})=>{if(t.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` — so the call would silently return the wheel catalog instead of nothing.");const s=await x("products.listCatalog",async u=>await f(Qt(t,e,u)),n.throwOnFailure?()=>!0:nt,n.maxRows===void 0?void 0:u=>st([...u]).length>=n.maxRows);return st(S(s))},getWheel:async t=>F(S(await i(await f(c(`/wheels/${t}`)),await d()))),getTyre:async t=>S(await i(await f(c(`/tyres/${t}`)),await d())),listBundles:async(t={})=>{try{return await i(await f(c("/bundles")),await d())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(c(`/bundles/${t}`)),await d()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:n=null}=t;if(typeof window>"u"){const{listGalleryBuilds:s}=await import("./gallery-builds-data.js");return S(s(e,n))}try{const s=new URLSearchParams;e&&s.set("process",e),n&&s.set("wheelSlug",n);const u=s.toString(),l=await i(`/api/v1/gallery-builds${u?`?${u}`:""}`,b());return S(m(l))}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>i(await f(c("/site")),await d()),getSiteBySlug:async t=>i(`${c("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await d():void 0),listPages:async()=>S(await i(await f(c("/pages")),await d())),listPopups:async()=>i(await f(c("/popups")),await d()),listProductTemplates:async()=>{try{return await i(await f(c("/product-templates")),await d())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${c("/dynamic-pages")}${e}`),await d())}catch(n){if(n instanceof w&&n.status===404)return[];throw n}},getRecord:async(t,e)=>{try{return await i(await f(c(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await d())}catch(n){if(n instanceof w&&n.status===404)return null;throw n}},listRecordKeys:async t=>{try{const e=await i(await f(c(`/records/${encodeURIComponent(t)}`)),await d({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(e){if(e instanceof w&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(c("/product-type-choices")),await d())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(c("/field-usage")),await d())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const n=e.record?`?record=${encodeURIComponent(e.record)}`:"",[s,u]=await D(c(`/pages/${t}`)+n,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return S(await i(s,u))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const n=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(c("/blog-posts")+n,await d())).map(u=>({...u,coverImage:L(u.coverImage)??""}))}catch(s){if(e)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(c(`/blog-posts/${t}`),await d());return{...e,coverImage:L(e.coverImage)??""}},createOrder:async t=>i(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>g(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(c("/orders/lookup"),await d({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(c("/payments/intent"),await d({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(c("/checkouts/release"),await d({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(c("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(c("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(c("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(c("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(c("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(c("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(c("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(c("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(c("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(c("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(c("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(c("/stock-alerts"),await d({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(c("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(c("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(c("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(c("/carts"),await d({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(c("/carts/restore"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(c("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const n=c("/reviews"),s=e.toString();try{return await i(await f(s?`${n}?${s}`:n),await d())}catch(u){return console.warn("[products.listReviews] product API unavailable, returning []",u),[]}},submitReview:async t=>i(c("/reviews"),await d({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(c(`/forms/${encodeURIComponent(t)}`),await d()),submitForm:async(t,e)=>i(c(`/forms/${encodeURIComponent(t)}/submissions`),await d({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(c("/shipping-methods"),await d())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(c(`/countries/${encodeURIComponent(t)}/subdivisions`),await d())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=c("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await X(e,n)).data:i(e,n)},validateCoupon:async t=>{const{data:e,asShopper:n}=await X(c("/coupons/validate"),await d({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:n}},getHeaderSettings:async()=>{const t=M({method:"GET"}),e=await i(...await D(c("/header-settings"),{signal:t})),n=L(e.logoUrl);let s=null,u=null;if(n&&Jt(n)){const l=await Lt(n,t);l&&(s=l.reversed,u=l.inkIsDark)}return{...e,logoUrl:n,logoReversed:s,logoInkIsDark:u}},getThemeSettings:async()=>i(...await D(c("/theme-settings"))),getChatSettings:async()=>i(await f(c("/chat-settings")),await d())},xe={listServices:async()=>{try{return await i(c("/bookings/services"),await d())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(c(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await d()),create:async t=>i(c("/bookings"),await d({method:"POST",body:JSON.stringify(t)})),get:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}`),await d()),cancel:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await d({method:"POST"})),reschedule:async(t,e)=>i(c(`/bookings/manage/${encodeURIComponent(t)}/reschedule`),await d({method:"POST",body:JSON.stringify({startAt:e})})),createPaymentIntent:async t=>i(c("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:t})}))};class de extends Error{slug;count;constructor(e,n){super(`Slug "${e}" exists on ${n} websites; a site is required to pick one.`),this.slug=e,this.count=n,this.name="AmbiguousPageSlugError"}}const C=(t,e,n)=>{const s=new URLSearchParams({...e?{site:e}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${s?`?${s}`:""}`},N=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,ue=t=>`${N(t)}currencies/`,le="/api/storefront/media/ingest/";class pe 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 ye(){const t=xt();if(!t)throw new pe;return`${le}?${new URLSearchParams({site:t})}`}const he="X-Puck-Media-Manifest",it=mt.contentHash,I={"X-Media-Manifest":it,[he]:it},De=ct({});function ct(t){return(e,n={})=>{const s=Ut(),u=t.headers||s?{...s?{"Accept-Language":s}:{},...t.headers,...n.headers}:void 0;return i(e,{...n,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...u?{headers:u}:{},audience:t.audience??Et()})}}function fe(t={}){const e=ct(t),n=t.siteDrafts===!0,s=a=>C("header-settings",a,n),u=a=>C("theme-settings",a,n),l=a=>C("chat-settings",a,n),y=a=>C("social-settings",a,n);return{findPageBySlug:async(a,r,o)=>{const p=new URLSearchParams({slug:a});o&&p.set("site",o);const h=await e(`/api/storefront/pages/?${p.toString()}`,{token:r}),P=m(h);if(!o&&P.length>1)throw new de(a,P.length);return P[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,o,p,h)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:p,...h?{client_id:h}:{}}),token:o}),duplicatePage:(a,r,o)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:o}),geocode:(a,r,o)=>e(`/api/storefront/geocode/?${new URLSearchParams(o?{q:a,country:o}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,o,p=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:p}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,o)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:I,token:o}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,o)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),listTemplatePages:async(a,r)=>{const o=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return m(o)},getPageLibrary:async a=>{const r=await e("/api/storefront/page-templates/?is_page_library=true&is_active=true",{token:a});return m(r)[0]??null},getTemplateLibrary:(a,r)=>e(`/api/storefront/pages/template-library/?site=${encodeURIComponent(a)}`,{token:r}),createPageFromTemplate:(a,r)=>e(`/api/storefront/pages/from-template/${n?"?draft=1":""}`,{method:"POST",body:JSON.stringify(a),token:r}),findTemplatePageBySlug:async(a,r,o)=>{const p=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:o});return m(p)[0]??null},createTemplatePage:(a,r,o)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:I,token:o}),saveTemplatePageLayout:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),deleteTemplatePage:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/pages/?${o.toString()}`,{token:a});return m(p)},createPage:(a,r,o,p)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:o}),token:p}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(s(r),{token:a}),listMenus:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/menus/?${o}`,{token:a});return m(p)},listBlogPosts:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/blog-posts/?${o.toString()}`,{token:a});return m(p)},listFieldUsage:async(a,r)=>{const o=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/categories/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.sort_order-_.sort_order||P.name.localeCompare(_.name))},listForms:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/forms/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.title.localeCompare(_.title))},listWheelSummaries:async(a,r={})=>{const o=new URLSearchParams;r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/wheel-curations/summaries/${p?`?${p}`:""}`,{token:a});return S(h)},listProducts:async(a,r={})=>{const o=new URLSearchParams;r.kinds?.length&&o.set("kind",r.kinds.join(",")),r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/products/${p?`?${p}`:""}`,{token:a});return S(h)},getWheelDetail:async(a,r,o={})=>{const p=new URLSearchParams({slug:r});return o.siteId&&p.set("site",o.siteId),F(S(await e(`/api/storefront/wheel-curations/detail/?${p.toString()}`,{token:a})))},updateHeaderSettings:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(N(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return m(r)},listSiteCurrencies:async(a,r)=>{const o=await e(ue(a),{token:r});return Array.isArray(o)?o:[]},publishSite:(a,r)=>e(`${N(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${N(a)}live-state/`,{token:r}),getThemeSettings:(a,r)=>e(u(r),{token:a}),updateThemeSettings:(a,r,o)=>e(u(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getMyPreferences:async a=>(await e("/api/auth/me/",{token:a})).preferences??{},updateMyPreferences:(a,r)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:a}),token:r}),getChatSettings:(a,r)=>e(l(r),{token:a}),updateChatSettings:(a,r,o)=>e(l(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(y(r),{token:a}),updateSocialSettings:(a,r,o)=>e(y(o),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,o)=>{const p=new FormData;return p.append("logo",a),e(s(o),{method:"PATCH",body:p,token:r})},clearHeaderLogo:(a,r)=>e(s(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const o=new FormData;return o.append("file",a),e(ye(),{method:"POST",body:o,token:r})},listMedia:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("kind",r);const p=await e(`/api/storefront/media-assets/?${o.toString()}`,{token:a});return m(p)}}}const He=fe({siteDrafts:!0});function ge(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function Fe(t){return Ht(await i(ge(t)))}const T={audience:null,baseUrl:""};async function Me(t,e){return jt(await i(Kt(t,e),T))}async function Be(t){return zt(await i(Ft,{...T,method:"POST",body:JSON.stringify(t)}))}async function qe(t){try{const e=await i(Mt,{...T,method:"POST",body:JSON.stringify({token:t})});return Q(202,e)}catch(e){if(e instanceof w)return Q(e.status,e.data);throw e}}async function Ge(t,e){await i(Bt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function We(t,e){await i(qt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function je(t){try{return Wt(await i(Gt,{...T,method:"POST",body:JSON.stringify({token:t})}))}catch(e){if(e instanceof w&&me.has(e.status))return"";throw e}}const me=new Set([400,404,410]);export{St as API_URL,de as AmbiguousPageSlugError,w as ApiError,Tt as BROWSER_READ_TIMEOUT_MS,Ot as EFFICIENT_CLIENT_CLOSED_MESSAGE,pe as MediaUploadDestinationError,se as PREVIEW_PARAM,Ve as PRODUCT_API_BASE,bt as SERVER_READ_TIMEOUT_MS,v as SERVER_UNREACHABLE_MESSAGE,k as STATUS_NETWORK_ERROR,De as adminFetch,vt as api,i as apiFetch,$ as appendSiteQuery,We as askForWorkspaces,Be as askToSignUp,xe as bookings,fe as createStorefrontAdmin,ge as dealersPath,M as defaultRequestDeadline,ye as editorMediaUploadPath,Et as editorPortalAudience,Ut as editorRequestLanguage,Fe as fetchDealers,Me as fetchSignUpAvailability,Le as fitment,Ge as joinSignUpWaitingList,qe as openSignUpLink,je as openWorkspaceFind,Je as products,At as readDeadlineMs,ae as resolveClientIp,S as resolveMediaUrls,oe as resolvePreviewToken,ot as resolveSiteHost,ee as resolveSiteHostSource,re as resolveSiteSlug,Ue as setEditorLanguage,_e as setEditorPortalAudience,He as storefrontAdmin};