efficient-storefront-blocks 0.98.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/chunks/{EditorPreviewCheckout-2FW4VEOK.js → EditorPreviewCheckout-J76THKIJ.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-LW5QSBKM.js → SiteEditorProvider-YAIB64UV.js} +1 -1
- package/dist/chunks/chunk-EIBYUCDE.js +1 -0
- package/dist/chunks/chunk-GOVYQQA4.js +1 -0
- package/dist/chunks/{chunk-4QN263UJ.js → chunk-KRMWJLBM.js} +2 -2
- package/dist/chunks/{fitment-data-BRGBDG7Y.js → fitment-data-OUHMES66.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SearchBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/BookingBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBox/fields.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/popup-look-fields.d.ts +1 -0
- package/dist/editor/lib/document/popup-look-fields.js +1 -1
- package/dist/editor/lib/document/text-kind-style-rows.d.ts +5 -0
- package/dist/editor/lib/document/text-kind-style-rows.js +1 -0
- package/dist/editor/lib/storefront-editor-words.d.ts +3 -2
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +31 -31
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +136 -12
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CatalogFilterBarSection.js +1 -1
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/CurrencyContext.d.ts +3 -0
- package/dist/render/components/CurrencyContext.js +1 -1
- package/dist/render/components/FooterMenu.d.ts +5 -3
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FormBlock.d.ts +4 -1
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/HeaderToolBlocks.d.ts +4 -2
- package/dist/render/components/HeaderToolBlocks.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +7 -2
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/PhoneSheet.d.ts +16 -0
- package/dist/render/components/PhoneSheet.js +1 -0
- package/dist/render/components/PreOrderPanel.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/SectionGroupBody.d.ts +2 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/Subscribe.d.ts +1 -0
- package/dist/render/components/Subscribe.js +1 -1
- package/dist/render/components/catalog/CatalogFilterBar.d.ts +5 -1
- package/dist/render/components/catalog/CatalogFilterBar.js +1 -1
- package/dist/render/components/catalog/CatalogFilterContext.d.ts +2 -0
- package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/PriceRange.d.ts +6 -1
- package/dist/render/components/catalog/PriceRange.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/fitment/PickerField.js +1 -1
- package/dist/render/components/formSubmission.d.ts +4 -2
- package/dist/render/components/formSubmission.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +0 -3
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicWheelDiagram.js +1 -1
- package/dist/render/components/submit/SubmitRegions.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.d.ts +2 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +15 -7
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.d.ts +6 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.js +1 -1
- package/dist/render/lib/api/index.d.ts +1 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/booking/text-kinds.js +1 -1
- package/dist/render/lib/content/article-page-seed.js +1 -1
- package/dist/render/lib/content/menu-row.d.ts +16 -0
- package/dist/render/lib/content/menu-row.js +1 -1
- package/dist/render/lib/content/text-kind-vars.d.ts +4 -0
- package/dist/render/lib/content/text-kind-vars.js +1 -0
- package/dist/render/lib/document/blocks/commerce/SearchBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/service/SiteHeader/render.js +1 -1
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -1
- package/dist/render/lib/popup/text-kind-style.js +1 -1
- package/dist/render/lib/submit/text-kinds.js +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.d.ts +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.js +1 -1
- package/dist/render/lib/wheels/plp-filters.d.ts +5 -0
- package/dist/render/lib/wheels/plp-filters.js +1 -1
- package/dist/render/lib/wheels/wheel-sheet.d.ts +3 -0
- package/dist/render/lib/wheels/wheel-sheet.js +1 -0
- package/dist/words.d.ts +3 -2
- package/dist/words.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/chunk-PWSMCGXO.js +0 -1
- package/dist/chunks/chunk-SEIKSSUW.js +0 -1
- /package/dist/chunks/{chunk-XEZ7BYVZ.js → chunk-B2IYTOE3.js} +0 -0
- /package/dist/chunks/{chunk-4QN263UJ.js.LEGAL.txt → chunk-KRMWJLBM.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-GOHV3G3C.js → chunk-QP2F42DV.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as vt,i as xe,q as Et,s as Pt,t as wt,v as W}from"./chunk-SEIKSSUW.js";import{Ga as ht,ae as yt,ce as Ke,de as ze,fe as bt,se as Ce,te as xt,we as Xe,xe as St}from"./chunk-XEZ7BYVZ.js";import{c as Ct,n as ce}from"./chunk-GOHV3G3C.js";import{createContext as wn,useContext as kt,useEffect as Rn,useMemo as Se,useState as Lt}from"react";function _t(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function de(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Ve=4,qr=1,Gr={unit:"set",spares:0,spareSide:"left"};function Nt(e){return e.unit==="single"?1:Ve+e.spares}function Kr(e,t){return[{partNumber:e.partNumber,wheels:Nt(t),prices:e.prices}]}function zr(e,t){let n=Nt(t)-Ve;if(n<=0||e.length===0)return e;let r=vn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function vn(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function En(e,t){return t.spares>0?`${e} + spare`:e}function Xr(e){return e.unit==="single"?"Single":En(`Set of ${Ve}`,e)}var Vr="data-add-to-basket",Ye=9,Pn="en",Rt=new Map;function Te(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Rt.get(r);return o||(o=new Intl.NumberFormat(Pn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Rt.set(r,o)),o}function Q(e,t,n=0){return Te(t,0,n).format(e)}function Yr(e,t){return Te(t).format(e)}function Qr(e,t){let n=e.savings[t];if(n===void 0)return null;let r=Q(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as In}from"react/jsx-runtime";var _n="storefront-country",It=_n,Qe=wn(null);function Nn(e){return At(e,"catalogue")}function Ln(e){return At(e,"money")}function At(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Te(o,t==="money"?i:0,i).format(r)}}function to({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Se(()=>t??[],[t]),a=Se(()=>n??[],[n]),l=Se(()=>r||i.find(f=>f.isDefault)?.code||i[0]?.code||"",[r,i]),u=Se(()=>o||a.find(f=>f.isDefault)?.code||a[0]?.code||"",[o,a]),[c,p]=Lt(u),[C,d]=Lt(!1);Rn(()=>{let f=ce.getItem(It);f&&a.some(M=>M.code===f)&&p(f),d(!0)},[a]);function E(f){p(f),ce.setItem(It,f)}let L=Se(()=>{let f=a.find(_=>_.code===c)??null,M=f?.currency,I=M&&i.some(_=>_.code===M)?M:l,T=Nn(i),R=Ln(i);return{country:c,currency:I,setCountry:E,currencies:i,countries:a,activeCountry:f,formatPrice:(_,x)=>T(_,x??I),formatMoney:(_,x)=>R(_,x??I),ready:C}},[c,i,a,l,C]);return In(Qe.Provider,{value:L,children:e})}function Tt(){let e=kt(Qe);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function no(){return kt(Qe)?.country??""}import{createContext as Gn,useCallback as v,useContext as Kn,useEffect as j,useMemo as Vt,useRef as fe,useState as N}from"react";function Ot(){return"/edit"}function Dt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ft="We'll confirm this discount when you place your order.",so="Confirmed at checkout";function lo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Mt="coupon_code: ";function uo(e){return!(e instanceof xe)||e.status!==400||!e.message.startsWith(Mt)?null:e.message.slice(Mt.length)}function Ut(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Oe="Price on request",An="Request a quote",$t="from ",mo="From ",go="each",Ht="Free";function je(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ze(e,t){let n=e?.[t];return je(n)?n:null}function ho(e,t,n,r){let o=Ze(e,n),i=Ze(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function yo(e,t,n,r){if(n==null&&r==null)return!0;let o=Ze(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Tn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function On(e,t,n){if(!je(e))return Tn;let r=je(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function bo(e,t,n=""){return!e.priced||e.unit==null?Oe:`${n}${Q(e.unit,t)}`}function Co(e,t){return e.was==null?null:Q(e.was,t)}function Mn(e,t,n=1){let r=de(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,l)=>a+l.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Dn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function xo(e,t,n,r=1){let o=On(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=Mn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Dn,fromSetTotal:i}}function Fn(e,t){return!e.priced||e.unit==null?Oe:`${e.isFrom?$t:""}${Q(e.unit,t)}`}function So(e,t){return e.was==null?null:Q(e.was,t)}function vo(e,t){return!e.priced||e.unit==null?An:Fn(e,t)}function Eo(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let a=i.prices?.[t];if(typeof a!="number")return null;r+=a*i.quantity}let o=Q(r-n,t);return{was:Q(r,t),amount:e.savingIsFrom?`${$t}${o}`:o}}var Un=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Bt(e){return Un.test(e.trim())}var Wt="sf:ga-purchases",$n=20;function Gt(){return typeof window>"u"||window.parent!==window}function ve(...e){try{if(Gt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Hn(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:de(e.components,t)??0,quantity:e.qty}}function Je(e,t){return e.filter(Me).map(n=>Hn(n,t))}function Lo(e){ve("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function Kt(e,t){let n=Je([e],t);n.length!==0&&ve("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Io(e){let t=Je(e.lines,e.currency);t.length!==0&&ve("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var qt=new Set;function Bn(e){if(qt.has(e))return!1;qt.add(e);try{let t=JSON.parse(ce.getItem(Wt)??"[]");if(t.includes(e))return!1;ce.setItem(Wt,JSON.stringify([...t,e].slice(-$n)))}catch{}return!0}function ko(e){let t=e.confirmation;if(Gt()||!Bn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ve("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Je(e.lines,n)}),e.adsSendTo&&ve("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Wn="Arranged after review",zt="Calculated at checkout",qn=zt,Oo=zt;function Xt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Mo(e){switch(e){case"arranged":return Wn;case"pending":return qn;case"free":return Ht;case"charged":return null}}import{jsx as Yn}from"react/jsx-runtime";var zn=400,Xn=400,Vn=1500;function Me(e){return(e.components?.length??0)>0}function Yt(e,t){return{code:e,valid:t.valid,deferred:Dt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function jt(e,t){return de(e.components,t)}function et(e,t){let n=jt(e,t);return n===null?null:n*e.qty}function Qt(e){return e!=="tyre"}var Zt=Gn(null);function Vo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Tt(),[i,a]=N(t),[l,u]=N([]),[c,p]=N([]),[C,d]=N([]),[E,L]=N(!1),[f,M]=N(!1),[I,T]=N(!1),[R,_]=N(!1),[x,K]=N(null),[ie,D]=N(0),b=v(()=>D(s=>s+1),[]),[P,y]=N(void 0),[U,_e]=N(null),[S,$]=N(null),[Ne,z]=N(!1),[w,pe]=N(null),ae=fe(void 0),H=v(()=>a(!0),[]),ee=v(()=>a(!1),[]),me=v(()=>a(s=>!s),[]);j(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let X=Ot(),Le=fe(X);j(()=>{Le.current!==X&&(Le.current=X,t||ee())},[X,t,ee]);let V=v(s=>{_e(m=>m?.country===s?.country&&m?.subdivision===s?.subdivision&&m?.postcode===s?.postcode?m:s)},[]),q=v(s=>{_(!0),Qt(s)&&T(!0)},[]),Ie=I||l.some(s=>Qt(s.kind)),F=R||l.length>0;j(()=>{if(t||!Ie||E)return;let s=!0;return W.listWheels().then(m=>{s&&(p(m),L(!0))}),()=>{s=!1}},[t,Ie,E]),j(()=>{if(t||!F||f)return;let s=!0;return W.listBundles().then(m=>{s&&(d(m),M(!0))}),()=>{s=!1}},[t,F,f]);let G=x?.deliveryOptions??[],se=x?.courier??null;j(()=>{x&&pe(s=>s&&G.some(m=>m.id===s)?s:G[0]?.id??null)},[x]);let te=v(()=>l.filter(Me).flatMap(s=>_t(s.components,s.qty)),[l]),ge=v(async(s,m)=>{let h=s.trim().toUpperCase();if(!h)return;let g=te();if(g.length===0){$({code:h,valid:!1,message:"Add a wheel to the cart first."});return}z(!0),ae.current=m;try{let A=await W.validateCoupon({code:h,items:g,currency:n,shippingMethodId:w??void 0,customerEmail:m});$(Yt(h,A))}catch{$({code:h,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{z(!1)}},[te,n,w]),he=v(()=>{$(null),ae.current=void 0},[]),ye=v(s=>{if(!S)return;let{code:m}=S;$(h=>h&&h.code===m?{code:m,valid:!1,refused:!0,message:s}:h)},[S]);j(()=>{if(!S||S.refused)return;let s=S.code,m=g=>g!==null&&g.code===s&&!g.refused,h=setTimeout(async()=>{let g=te();if(g.length===0){$(A=>m(A)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:A);return}z(!0);try{let A=await W.validateCoupon({code:s,items:g,currency:n,shippingMethodId:w??void 0,customerEmail:ae.current});$(be=>m(be)?Yt(s,A):be)}catch{}finally{z(!1)}},zn);return()=>clearTimeout(h)},[l,n,w]);let ne=S&&!S.refused?S.code:void 0;j(()=>{if(t)return;let s=!0,m=setTimeout(async()=>{let h=te();if(h.length===0){K(null),y(void 0);return}try{let g=await W.quoteCart({items:h,currency:n,shippingMethodId:w??void 0,couponCode:ne,customerEmail:ae.current||void 0,country:U?.country||r||void 0,subdivision:U?.country&&U.subdivision||void 0,postcode:U?.country&&U.postcode||void 0});if(!s)return;K(g)}catch{if(!s)return}y(ne)},Xn);return()=>{s=!1,clearTimeout(m)}},[l,n,w,ne,r,U,ie]);let le=v(s=>{u(m=>{let h=m.findIndex(g=>g.id===s.id);return h===-1?[...m,s]:m.map((g,A)=>A===h?{...g,qty:Math.min(Ye,g.qty+s.qty)}:g)}),Kt(s,n)},[n]),ke=v(s=>{u(m=>m.filter(h=>h.id!==s))},[]),k=v((s,m)=>{let h=Math.max(1,Math.min(Ye,m));u(g=>g.map(A=>A.id===s?{...A,qty:h}:A))},[]),Y=v(s=>{u(s)},[]),[re,gn]=N(null),st=fe(null);st.current=re;let B=fe(null),We=fe(""),lt=v((s,m)=>{let h=s.trim().toLowerCase();Bt(h)&&gn(g=>g&&g.email===h&&g.firstName===(m??"")?g:{email:h,firstName:m??""})},[]);j(()=>{if(t||!re)return;let s=Ut(l.filter(Me),g=>et(g,n)===null?Oe:o(et(g,n),n)),m={email:re.email,firstName:re.firstName,currency:n,items:s},h=JSON.stringify(m);if(h!==We.current)return B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{B.current=null,We.current=h,W.captureCart(m).catch(g=>{})},Vn),()=>{B.current&&(clearTimeout(B.current),B.current=null)}},[l,re,n,t]);let ut=v(()=>{B.current&&(clearTimeout(B.current),B.current=null);let s=st.current;s&&(We.current="",W.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(m=>{}))},[n]),ct=Vt(()=>{let s=l.reduce((O,ue)=>{let Ae=et(ue,n);return Ae===null?O:O+Ae},0),m=l.some(O=>jt(O,n)===null),h=l.reduce((O,ue)=>O+ue.qty,0),g=S?.valid?S.effects:void 0,A=g?Math.min(s,Number(g.discountAmount)):0,be=x?.bundleDiscount??0,yn=x?.appliedBundles??[],qe=!!g?.freeShipping,mt=G.find(O=>O.id===w),gt=qe?0:x?.shipping??mt?.amount??0,bn=Xt({quoted:x!==null,optionCount:G.length,chosenAmount:mt?.amount,couponWaivesFreight:qe}),Ge={};for(let O of g?.freeUnits??[])Ge[O.partNumber]=(Ge[O.partNumber]??0)+O.quantity;let Cn=x?.tax??null,xn=x?x.grandTotal:s-A-be+gt;return{sets:h,units:l.reduce((O,ue)=>O+(ue.components??[]).reduce((Ae,Sn)=>Ae+Sn.wheels*ue.qty,0),0),subtotal:s,hasUnpricedLine:m,discount:A,bundleDiscount:be,appliedBundles:yn,shipping:gt,freeShipping:qe,shippingStatus:bn,freeUnitsByPartNumber:Ge,tax:Cn,grand:xn,repricing:!!S?.refused&&x!==null&&P===S?.code,currency:n}},[l,n,S,G,w,x,P]),dt=fe(!0),ft=v(s=>{dt.current=s},[]),pt=v(s=>{le(s),dt.current&&H()},[le,H]),hn=Vt(()=>({isOpen:i,preview:t,open:H,close:ee,toggle:me,items:l,catalog:c,bundles:C,warmCatalog:q,add:le,addAndOpen:pt,setAutoOpen:ft,remove:ke,setQty:k,replaceItems:Y,identify:lt,clearCapturedCart:ut,coupon:S,applyCoupon:ge,removeCoupon:he,refuseCoupon:ye,couponBusy:Ne,deliveryOptions:G,setQuoteDestination:V,courier:se,requote:b,shippingMethodId:w,setShippingMethodId:pe,totals:ct}),[i,t,H,ee,me,l,c,C,q,le,pt,ft,ke,k,Y,lt,ut,S,ge,he,ye,Ne,G,V,se,b,w,ct]);return Yn(Zt.Provider,{value:hn,children:e})}function Jt(){let e=Kn(Zt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as ar}from"react";function en(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,u]of e){if(u.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Qn=6e4,jn=5e3,Zn=500,De=new Map;async function Jn(e){let{host:t,matchesRequestHost:n}=await Et();if(!t)return"";let r=await Pt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var er=e=>e.includes("|slug:")||e.includes("|xhost:");async function tn(e,t){if(await wt()!==null)return t();let n=await Jn(e);if(!n)return t();let r=Date.now(),o=De.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?jn:Qn,u=De.get(n)?.lastGood,c=i.outcome.state==="ok"?i:a?u:void 0,p=a&&c?c:i;return en(De,Zn,er,r),De.set(n,{load:p,expiresAt:r+l,lastGood:c}),p}var tr=404;function nr(e){if(e instanceof xe&&e.status===tr)return{state:"absent"};let t=e instanceof xe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var rr="[storefront:chrome-load-failed]";function or(e,t){console.error(`${rr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function nn(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=nr(o);return i.state==="failed"&&or(e,i),{value:n,outcome:i}}}function ir(e){return e==="production"?"silent":"banner"}var ni=ir("production");function sr(e,t){return e?.trim()||t}function ci({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=sr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var lr={name:Ce,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:Xe},di=ar(async()=>tn("site",()=>nn("site",async()=>{let e=await W.getSite();return{name:xt(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:St(e.socialLinks)}},lr)));var fi={name:Ce,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:Xe};import{jsx as ur}from"react/jsx-runtime";function mi({tone:e="bad",role:t,children:n}){return ur("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Pe,jsxs as tt}from"react/jsx-runtime";import{useEffect as Fe,useId as pr,useRef as on,useState as Ue}from"react";import{useRootIsDark as mr}from"efficient-shell/theme";import{efficientClientOpen as cr}from"efficient-easel/screen/lib/session";var Ee=new Map,dr=64;async function fr(e){if(!cr())return null;try{let t=await fetch(`${Ct()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function rn(e){let t=Ee.get(e);if(t)return t;let n=fr(e);if(Ee.set(e,n),Ee.size>dr){let r=Ee.keys().next();r.done||Ee.delete(r.value)}return n}var gr=202/22,hr=.88,Ti=16,yr="invert(1)";function Oi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:l,size:u="medium",sizePx:c,sizeUnit:p,wordmark:C,siteName:d=Ce,fitToContainer:E=!1,fitWordmarkToContainer:L=!1,fitFloorPx:f,hideClass:M,hideAttrs:I}){let T=C&&C.trim()?C.trim():d,[R,_]=Ue(null),x=on(null),K=k=>{x.current=k};Fe(()=>{_(x.current?.ownerDocument??null)},[]);let ie=!mr({doc:R,whenUnset:!0}),D=n&&n.trim()?n.trim():null,b=!!D&&vt(D),P=i??(ie&&t),y=o&&o.trim()?o.trim():null,U=r&&!y,_e=`logo-color-${pr().replace(/[^A-Za-z0-9_-]/g,"")}`,S=U&&b&&D&&a!=null?{reversed:a,inkIsDark:l??null}:null,$=S!==null,[Ne,z]=Ue(null);Fe(()=>{if(!U||!D||!b||$){z(null);return}let k=!1;return z(null),rn(D).then(Y=>{k||z(Y)}),()=>{k=!0}},[U,D,b,$]);let w=S??Ne,pe=!!w&&w.inkIsDark!==null&&(P?!w.inkIsDark:w.inkIsDark),ae=U&&!!D&&!b&&!P,H=pe&&w?w.reversed:D,ee=H?[H]:[],[me,X]=Ue(0);Fe(()=>{X(0)},[D,pe]);let Le=e==="footer"?ze:Ke[u],V=c&&c>0?c:Le,q=(c&&c>0?ht(c,p,"size",bt,{floor:!0}):null)??`${V}px`,Ie=Math.round(V*gr),F=me<ee.length?ee[me]:null,[G,se]=Ue(H),te=F!==null&&F===G,ge=on(null);Fe(()=>{let k=ge.current;if(!k||!k.complete)return;if(k.naturalWidth>0||k.naturalHeight>0){se(F);return}let Y=!1;return k.decode().then(()=>!Y&&se(F),()=>!Y&&X(re=>re+1)),()=>{Y=!0}},[F]);let he=E||L,ye=`calc(100cqi / ${((T.length+1)*hr).toFixed(2)})`,ne=he&&f&&f>0?q===`${V}px`?`${Math.min(f,V)}px`:`min(${f}px, ${q})`:null,le=he?ne===null?`min(${q}, ${ye})`:`clamp(${ne}, ${ye}, ${q})`:q,ke=tt("span",{className:`font-display font-bold tracking-[0.18em] ${ne===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:le,lineHeight:1,...y?{color:y}:{}},"aria-label":T,children:[T,Pe("span",{className:"text-accent",style:y?{color:y}:void 0,children:"."})]});return tt("span",{ref:K,className:yt("inline-flex items-center",M??""),...I,children:[!te&&ke,y&&F&&Pe("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:tt("filter",{id:_e,colorInterpolationFilters:"sRGB",children:[Pe("feFlood",{style:{floodColor:y}}),Pe("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&Pe("img",{ref:ge,src:F,alt:T,width:Ie,height:V,className:"shrink-0 object-contain",style:{...te?{height:q,width:"auto",...E?{maxWidth:"100cqi"}:{}}:{display:"none"},...ae?{filter:yr}:{},...y?{filter:`url(#${_e})`}:{}},onLoad:()=>se(F),onError:()=>X(k=>k+1)},F)]})}import{jsx as we,jsxs as Cr}from"react/jsx-runtime";function br({spokes:e,mesh:t=!1,className:n}){let a=u=>Math.round(u*1e3)/1e3,l=[];for(let u=0;u<e;u++){let c=u/e*Math.PI*2-Math.PI/2;if(l.push({x1:a(100+Math.cos(c)*22),y1:a(100+Math.sin(c)*22),x2:a(100+Math.cos(c)*86),y2:a(100+Math.sin(c)*86),main:!0}),t){let p=c+Math.PI/e;l.push({x1:a(100+Math.cos(p)*22*1.4),y1:a(100+Math.sin(p)*22*1.4),x2:a(100+Math.cos(p)*78),y2:a(100+Math.sin(p)*78),main:!1})}}return Cr("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[we("circle",{cx:100,cy:100,r:92,strokeWidth:2}),we("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),we("circle",{cx:100,cy:100,r:22,strokeWidth:2}),we("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((u,c)=>we("line",{x1:u.x1,y1:u.y1,x2:u.x2,y2:u.y2,stroke:"currentColor",strokeWidth:u.main?6:3,strokeLinecap:"round",opacity:u.main?1:.5},c))]})}var Ui="#c9a461",an=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],$i={name:"",color:"var(--fg)",family:"silver",src:""};function xr(e,t){let n=r=>{let o=an.findIndex(i=>i.f===r);return o===-1?an.length:o};return n(e)-n(t)||e.localeCompare(t)}function Hi(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(xr)}import{useState as Sr}from"react";import{jsx as oe,jsxs as nt}from"react/jsx-runtime";function vr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Jt(),[i,a]=Sr("");async function l(){o||!i.trim()||(await n(i,e),a(""))}return nt("div",{className:"flex flex-col gap-2",children:[t===null?nt("div",{className:"flex border border-line",children:[oe("input",{type:"text",value:i,onChange:u=>a(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),oe("button",{type:"button",onClick:()=>{l()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):nt("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[oe("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred||t.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),t.unchecked&&oe("button",{type:"button",onClick:()=>{n(t.code,e)},disabled:o,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Try again"}),oe("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ft}):t&&!t.valid&&t.message&&oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var rt="Ads on. Shopper can opt out.",$e="Ads and analytics off until Accept",Er={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:rt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:$e,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:rt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:rt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Pr(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Xi(e,t,n){let r=Pr(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Vi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var wr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Rr=wr;function Zi(e=Rr){if(e.asked)return e.ads?"granted":"denied"}function ea(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as Nr,isValidElement as Lr,useEffect as ln,useId as Ir,useLayoutEffect as dn,useRef as Z,useState as un}from"react";var He=(e,t)=>!!e[t]&&!e[t].disabled;function ot(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(He(e,i))return i}return t}function it(e,t){return ot(e,t===1?-1:e.length,t)}function at(e,t){return He(e,t)?t:Math.max(it(e,1),0)}function sn(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),l=n.findIndex((u,c)=>He(n,c)&&u.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:l>=0?l:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:ot(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:ot(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:it(n,1)}),handled:!0};case"End":return{state:i({focus:it(n,-1)}),handled:!0};case"Enter":case" ":return He(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as kr}from"efficient-shell/ui";import{Fragment as Ur,jsx as J,jsxs as fn}from"react/jsx-runtime";var cn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Ar({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=un(!1),u=r!==void 0,c=u?r:a,[p,C]=un(0),d=Z({text:"",timer:0}),E=Z(null),L=Z(null),f=Z(null),M=Ir(),I=Z(null),T=e.findIndex(b=>b.value===t),R=b=>{b!==c&&(u||l(b),b?o?.():i?.())},_=b=>{let P=e[b];!P||P.disabled||(n(P.value),R(!1),L.current?.focus())},x=b=>{let P={open:c,focus:c?p:at(e,T),typed:d.current.text},y=sn(P,b,e);return!y.handled&&y.state.open===c?!1:(y.state.typed!==P.typed&&(d.current.text=y.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),C(y.state.focus),y.commit!==void 0?_(y.commit):R(y.state.open),y.refocus&&L.current?.focus(),y.handled)},K=Z(x);K.current=x;let ie=Z(()=>R(!1));ie.current=()=>R(!1);let D=b=>{c||(I.current=b.nativeEvent,K.current(b.key)&&b.preventDefault())};return ln(()=>{if(!c)return;let b=y=>{E.current?.contains(y.target)||ie.current()},P=y=>{y!==I.current&&K.current(y.key)&&y.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",P)}},[c]),ln(()=>{c&&(d.current.text||C(at(e,T)))},[c]),dn(()=>{if(!c||!f.current)return;f.current.children.item(p)?.scrollIntoView({block:"nearest"})},[p,c]),{open:c,toggle:()=>R(!c),close:()=>R(!1),focusIdx:p,setFocusIdx:C,pick:b=>_(e.findIndex(P=>P.value===b)),wrapRef:E,triggerRef:L,listRef:f,listId:M,onTriggerKeyDown:D,activeId:c?`${M}-${p}`:void 0}}var Tr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${cn.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${cn.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Or(e,t){dn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let a=n.offsetParent??n.parentElement;if(!a)return;let l=a.getBoundingClientRect(),u=n.getBoundingClientRect(),c=Math.abs(u.right-l.right)<Math.abs(u.left-l.left)?"end":"start",p=kr({trigger:{left:l.left,right:l.right,top:l.top,bottom:l.bottom},menu:{width:u.width,height:u.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:c,side:"bottom"});if(p.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=p.top+Math.min(u.height,p.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}p.maxHeight<u.height&&(i.maxHeight=`${p.maxHeight}px`,i.overflowY="auto");let C=p.left-u.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Mr(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Dr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:u,align:c="start"}){let p=Tr[t],C=Z(null);return Or(C,n.length),J("ul",{ref:d=>{C.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":u,...p.pickerMarker?{"data-picker-menu":""}:{},className:c==="end"?Mr(p.list):p.list,children:n.map((d,E)=>{let L=d.value===r;return J("li",{id:`${e}-${E}`,role:"option","aria-selected":L,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(E),onMouseDown:f=>{f.preventDefault(),d.disabled||a(d.value)},className:p.item(E===o,L&&d.value!=="",!!d.disabled,E===n.length-1),style:p.itemStyle?.(L),children:d.meta===void 0?d.label:fn(Ur,{children:[d.lead,J("span",{className:"flex-1 whitespace-nowrap",children:d.label}),J("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${E}`)})})}function Fr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":u,align:c}){let p=Nr.toArray(r).flatMap(f=>{if(!Lr(f))return[];if(f.type!=="option")return[];let I=f.props,T=I.value!==void 0?String(I.value):"",R=I.children,_=typeof R=="string"||typeof R=="number"?String(R):T;return[{value:T,label:_,disabled:!!I.disabled}]}),C=e??"",d=Ar({items:p,value:C,onPick:f=>t?.({target:{value:f}})}),L=p.find(f=>f.value===C)?.label??p[0]?.label??"";return fn("div",{ref:d.wrapRef,className:"relative",children:[a&&J("input",{type:"hidden",name:a,value:C}),J("button",{ref:f=>{d.triggerRef.current=f},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":u,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:f=>!n&&d.onTriggerKeyDown(f),className:`block w-full ${o??""}`,style:i,children:J("span",{className:"block w-full truncate text-left",children:L})}),d.open&&J(Dr,{id:d.listId,tone:"select",items:p,value:C,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:c})]})}import{jsx as Re,jsxs as Be}from"react/jsx-runtime";var $r="font-mono text-[length:var(--size-label,12px)]",Hr="font-semibold uppercase tracking-[0.22em] text-fg";function pn(e){return`${e??$r} ${Hr}`}function mn(){return Re("span",{className:"text-accent",children:" *"})}function Br({children:e,required:t,labelFace:n}){return Be("span",{className:pn(n),children:[e,t?Re(mn,{}):null]})}function Wr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:l}){let u=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",c=n?Re("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Be("div",{className:u,children:[Be("label",{htmlFor:o,className:pn(i),children:[e,t?Re(mn,{}):null]}),l,c]}):Be("label",{htmlFor:o,className:u,children:[Re(Br,{required:t,labelFace:i,children:e}),l]})}var fa="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent";export{Ot as a,so as b,lo as c,uo as d,_t as e,Ve as f,qr as g,Gr as h,Kr as i,zr as j,vn as k,En as l,Xr as m,Vr as n,Ye as o,Te as p,Q as q,Yr as r,Qr as s,Oe as t,An as u,$t as v,mo as w,go as x,Ht as y,Ze as z,ho as A,yo as B,On as C,bo as D,Co as E,Mn as F,xo as G,Fn as H,So as I,vo as J,Eo as K,Bt as L,Lo as M,Io as N,ko as O,Oo as P,Mo as Q,to as R,Tt as S,no as T,Me as U,et as V,Vo as W,Jt as X,ci as Y,lr as Z,fi as _,br as $,Ui as aa,an as ba,$i as ca,xr as da,Hi as ea,vr as fa,mi as ga,Ti as ha,Oi as ia,Er as ja,Xi as ka,Vi as la,wr as ma,Zi as na,ea as oa,Ar as pa,Dr as qa,Fr as ra,Br as sa,Wr as ta,fa as ua};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as U,c as j,f as Z,h as T,l as Q,n as O}from"./chunk-GOHV3G3C.js";var B="".replace(/\/+$/,"");var L="x-forwarded-for";function X(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ue="x-forwarded-host";function Y(e,t,n){let s={};return e&&(s[Ue]=e),t&&n==="uncached"&&(s[L]=t),s}function ee(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var te="x-storefront-site",ne="x-storefront-host",re="x-storefront-preview";var Be="shop_access_token",se="shop_refresh_token",N=null;function M(){O.removeItem(Be),O.removeItem(se)}var w={getAccess(){return N},takeLegacyRefresh(){let e=O.getItem(se);return M(),e},setTokens(e){N=e,M()},clear(){N=null,M()}};import{efficientClientOpen as tt}from"efficient-easel/screen/lib/session";function Le(e){return!!e.src}function A(e){let t=e.finishes.filter(Le);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(s=>s.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function Ne(e){return e.listable!==!1}function R(e){return e.map(A).filter(Ne)}var ce=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],le=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),v={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},ue=12,me=/\burl\(/i,de=new RegExp(`(?<![-\\w])(${ce.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),pe=new RegExp(`((?:^|[;{\\s"'])(?:${ce.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Me=/<svg\b([^>]*)>/i,De=/\bfill\s*[=:]/i;function He(e){let t=e.replace(de,(n,s,a,l,p)=>{let r=ie(p);return r===null?n:`${s}${a}${l}${r}${l}`}).replace(pe,(n,s,a)=>{let l=ie(a);return l===null?n:`${s}${l}`});return t=t.replace(Me,(n,s)=>De.test(s)?n:`<svg fill="#ffffff"${s}>`),t}function ie(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||me.test(n)||le.has(n))return null;let s=n in v?[...v[n],1]:ge(n);if(!s)return null;let[a,l,p,r]=s;if(Math.max(a,l,p)-Math.min(a,l,p)>ue)return null;let i=We(255-a,255-l,255-p,r);return t?`${i} !important`:i}function We(e,t,n,s){if(s<1)return`rgba(${e}, ${t}, ${n}, ${s})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function ge(e){return e.startsWith("#")?Je(e):e.startsWith("rgb")?Ge(e):e.startsWith("hsl")?Ve(e):null}function Je(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(s=>s+s).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function Ge(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(r=>r.endsWith("%")?Math.round(parseFloat(r)/100*255):Math.round(parseFloat(r)));if(l.some(r=>Number.isNaN(r)))return null;let p=s?E(s):Ke(n);return[l[0],l[1],l[2],p]}function Ke(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ve(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),p=parseFloat(a[1])/100,r=parseFloat(a[2])/100;if([l,p,r].some(P=>Number.isNaN(P)))return null;let i=s?E(s):a.length>=4?E(a[3]):1,[o,u,g]=ze(l,p,r);return[o,u,g,i]}function ze(e,t,n){let s=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=s*(1-Math.abs(a%2-1)),p=0,r=0,i=0;a<1?[p,r,i]=[s,l,0]:a<2?[p,r,i]=[l,s,0]:a<3?[p,r,i]=[0,s,l]:a<4?[p,r,i]=[0,l,s]:a<5?[p,r,i]=[l,0,s]:[p,r,i]=[s,0,l];let o=n-s/2;return[Math.round((p+o)*255),Math.round((r+o)*255),Math.round((i+o)*255)]}var oe=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function je(e){return`data:image/svg+xml,${encodeURIComponent(He(e))}`}function Ze(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||me.test(t)||le.has(t))return null;let n=t in v?[...v[t],1]:ge(t);if(!n)return null;let[s,a,l]=n;return Math.max(s,a,l)-Math.min(s,a,l)>ue?null:(.2126*s+.7152*a+.0722*l)/255}function Qe(e){let t=[],n=s=>{let a=Ze(s);a!==null&&t.push(a)};for(let s of e.matchAll(de))n(s[4]);for(let s of e.matchAll(pe))n(s[2]);return t.length?t.reduce((s,a)=>s+a,0)/t.length<.5:null}var ae=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Xe(e){let t=e;for(let n=ae.exec(t);n&&n[0].length>0;n=ae.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function Ye(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let s=Number(n.headers.get("content-length"));if(Number.isFinite(s)&&s>oe)return null;let a=await n.text();return a.length>oe?null:Xe(a)?a:null}catch{return null}}async function he(e,t){let n=await Ye(e,t);return n===null?null:{reversed:je(n),inkIsDark:Qe(n)}}import{currentEaselSession as et,setSessionBridgedSite as Jt,setSessionDocumentSite as Gt}from"efficient-easel/screen/lib/session";function ye(){return et().siteId()}var nt="",S=class extends Error{constructor(t,n,s){super(n),this.status=t,this.data=s}},G="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.",rt=new Set([502,503,504]),H=0,st="This editor runs on its host's own backend, which does not serve this request.",it=5e3,ot=15e3,at=()=>typeof window>"u"?it:ot;function Ce(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(at())}var fe=e=>e instanceof Error&&e.name==="TimeoutError",Se=(e,t)=>rt.has(e)?G:t,ct=["admin","venue"],Te="admin";function tn(e){Te=ct.includes(e)?e:"admin"}function lt(){return Te}var ut=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,Oe=null;function nn(e){Oe=e&&ut.test(e)?e:null}function mt(){return Oe}function dt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:$(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:s,headers:a,audience:l,...p}=t;if(typeof window<"u"&&!tt())throw new S(H,st,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let r=typeof FormData<"u"&&p.body instanceof FormData,i;try{i=await fetch(`${s??nt}${dt(e)}`,{...p,headers:{...r?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:p.signal??Ce({...p,audience:l})})}catch(g){throw g instanceof TypeError||fe(g)?new S(H,G,null):g}let o;try{o=await i.text()}catch(g){throw fe(g)?new S(H,G,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new S(i.status,i.ok?"Expected JSON but received a non-JSON response":Se(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Se(i.status,i.statusText);throw new S(i.status,g,u)}return u}var _=null;async function ve(){return _||(_=pt().finally(()=>{_=null}),_)}async function pt(){let e=w.takeLegacyRefresh(),t=await gt.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Ee(){return w.getAccess()??ve()}async function y(e,t={}){let n;try{n=await Ee()}catch{throw w.clear(),new S(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(s){if(!(s instanceof S)||s.status!==401)throw s;try{let a=await ve();return await c(e,{...t,token:a})}catch{throw w.clear(),s}}}async function Pe(e,t={}){if(w.getAccess())try{return{data:await y(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function we(){let e=await y("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new S(403,"This session is not valid for this shop.",null);return e}var gt={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Ee();return await we(),e},me:we,updateMe:e=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>y("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>y("/api/shop-portal/profile/"),updateMyProfile:e=>y("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>y("/api/shop-portal/delivery-locations/"),createAddress:e=>y("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>y("/api/products/brands/"),myOrders:()=>y("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>y(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>y(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>y(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>y("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>y(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),y("/api/shop-portal/return-media/",{method:"POST",body:n})}};function f(e){if(typeof e=="string")return e.startsWith("/media/")?Z(e):e;if(Array.isArray(e))return e.map(f);if(e&&typeof e=="object"){let t={};for(let[n,s]of Object.entries(e))t[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([a,l])=>[f(a),l])):f(s);return t}return e}var Fe=typeof window>"u"&&B!=="",ht=Fe?B:"",yt=j,b=()=>({baseUrl:yt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var Ie=100,be=50;function z(e,t,n){let s=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&s.set(a,String(l));return s.set("pageSize",String(Ie)),n&&s.set("cursor",n),`/api/v1${e}?${s.toString()}`}function ft(e,t){return z("/wheels",{process:e},t)}var Ae=Ie;function St(e,t){return z("/wheels",{slug:e.join(",")},t)}function Pt(e,t,n){return z("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function wt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function W(e,t,n=()=>!1,s=()=>!1){let a=[],l=null;try{for(let p=0;p<be;p++){let r=await c(await t(l),await d());if(a.push(...r.results),l=wt(r.next),!l)break;if(s(a))return a}l&&console.warn(`[${e}] stopped at ${be} pages (${a.length} rows); catalog may be truncated`)}catch(p){if(n(p))throw p;console.warn(`[${e}] product API unavailable, returning []`,p)}return a}var Re=e=>e instanceof S&&e.status===400;function _e(e){return e.flatMap(t=>t.kind==="alloy-wheel"?R([t]):[t])}async function qe(){return(await bt()).host}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(t.get(ne)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:s,matchesRequestHost:s!==null&&s===a}}catch{return{host:null,matchesRequestHost:!1}}}async function At(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return X((await e()).get(L))}catch{return null}}async function Rt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(te)||null}catch{return null}}async function _t(){let e=await Rt();if(e)return`site=${encodeURIComponent(e)}`;let t=await qe();return t?`host=${encodeURIComponent(t)}`:""}async function h(e){if(typeof window<"u"){let t=U();return t?$(e,`site=${encodeURIComponent(t)}`):e}return $(e,await _t())}function $(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var kt="preview";async function xt(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(re)}catch{return null}}async function Ct(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await xt();if(n===null)return[await h(e),await d(t)];let s=$(await h(e),`${kt}=${encodeURIComponent(n)}`),{next:a,cache:l,...p}=t??{},r=await d({...p,cache:"no-store"}),i=await Ct();return i&&(r.headers={...r.headers,"user-agent":i}),[s,r]}async function Tt(e){if(!Fe)return;let[t,n]=await Promise.all([qe(),At()]),s=Y(t,n,e);return Object.keys(s).length>0?s:void 0}async function d(e){let t=await Tt(ee(e)),n={baseUrl:ht,...e};return t&&(n.headers={...t,...e?.headers}),n}var k=typeof window>"u";function x(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let s=n.toString();return`/api/v1/fitment${e}${s?`?${s}`:""}`}var cn={listMakes:async e=>{if(k){let{fitmentData:n}=await import("./fitment-data-BRGBDG7Y.js");return n.makes(e)}return(await c(x("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(k){let{fitmentData:s}=await import("./fitment-data-BRGBDG7Y.js");return s.models(e,t)}return(await c(x("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(k){let{fitmentData:a}=await import("./fitment-data-BRGBDG7Y.js");return a.years(e,t,n)}return(await c(x("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,s)=>{if(k){let{fitmentData:l}=await import("./fitment-data-BRGBDG7Y.js");return l.modifications(e,t,n,s)}return(await c(x("/modifications",{make:e,model:t,year:n,region:s}),b())).results},getStockFitment:async(e,t,n,s,a)=>{if(k){let{fitmentData:l}=await import("./fitment-data-BRGBDG7Y.js");return l.stockFitment(e,t,n,s,a)}return c(x("/stock-fitment",{make:e,model:t,year:n,modification:s,region:a}),b())}},ln={listWheels:async(e,t={})=>{let n=await W("products.listWheels",async s=>await h(ft(e,s)),t.throwOnFailure?()=>!0:void 0,t.maxRows===void 0?void 0:s=>R([...s]).length>=t.maxRows);return R(f(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(r=>r.trim()).filter(Boolean))];if(n.length===0)return[];let s=[];for(let r=0;r<n.length;r+=Ae)s.push(n.slice(r,r+Ae));let a=await Promise.all(s.map(r=>W("products.listWheelsBySlug",async i=>await h(St(r,i)),t.throwOnFailure?()=>!0:Re))),l=new Set(n),p=a.flat().filter(r=>l.has(r.slug));return R(f(p))},listCatalog:async(e,t,n={})=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let s=await W("products.listCatalog",async a=>await h(Pt(e,t,a)),Re,n.maxRows===void 0?void 0:a=>_e([...a]).length>=n.maxRows);return _e(f(s))},getWheel:async e=>A(f(await c(await h(m(`/wheels/${e}`)),await d()))),getTyre:async e=>f(await c(await h(m(`/tyres/${e}`)),await d())),listBundles:async(e={})=>{try{return await c(await h(m("/bundles")),await d())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>c(await h(m(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:s}=await import("./gallery-builds-data-TD3QJK7L.js");return f(s(t,n))}try{let s=new URLSearchParams;t&&s.set("process",t),n&&s.set("wheelSlug",n);let a=s.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return f(l.results)}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>c(await h(m("/site")),await d()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listPages:async()=>f(await c(await h(m("/pages")),await d())),listPopups:async()=>c(await h(m("/popups")),await d()),listProductTemplates:async()=>{try{return await c(await h(m("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await h(`${m("/dynamic-pages")}${t}`),await d())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await h(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await h(m(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await h(m("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await h(m("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[s,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return f(await c(s,a))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+n,await d())).map(a=>({...a,coverImage:T(a.coverImage)??""}))}catch(s){if(t)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await d());return{...t,coverImage:T(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>y(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>c(m("/checkouts/release"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),s=t.toString();try{return await c(await h(s?`${n}?${s}`:n),await d())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await d())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Pe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await Pe(m("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Ce({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=T(t.logoUrl),s=null,a=null;if(n&&D(n)){let l=await he(n,e);l&&(s=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:s,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await h(m("/chat-settings")),await d())},un={listServices:async()=>{try{return await c(m("/bookings/services"),await d())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await d()),create:async e=>c(m("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},K=class extends Error{constructor(n,s){super(`Slug "${n}" exists on ${s} websites; a site is required to pick one.`);this.slug=n;this.count=s;this.name="AmbiguousPageSlugError"}},F=(e,t,n)=>{let s=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${s?`?${s}`:""}`},q=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Ot=e=>`${q(e)}currencies/`,vt="/api/storefront/media/ingest/",V=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function Et(){let e=ye();if(!e)throw new V;return`${vt}?${new URLSearchParams({site:e})}`}var Ft="X-Puck-Media-Manifest",ke=Q.contentHash,I={"X-Media-Manifest":ke,[Ft]:ke},mn=$e({});function $e(e){return(t,n={})=>{let s=mt(),a=e.headers||s?{...s?{"Accept-Language":s}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??lt()})}}function It(e={}){let t=$e(e),n=e.siteDrafts===!0,s=r=>F("header-settings",r,n),a=r=>F("theme-settings",r,n),l=r=>F("chat-settings",r,n),p=r=>F("social-settings",r,n);return{findPageBySlug:async(r,i,o)=>{let u=new URLSearchParams({slug:r});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new K(r,P.length);return P[0]??null},getPageById:(r,i)=>t(`/api/storefront/pages/${r}/`,{token:i}),saveLayout:(r,i,o,u,g)=>t(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(r,i,o)=>t(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(r,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:r,country:o}:{q:r})}`,{token:i}),listBlockSources:r=>t("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>t("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,i)=>t(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(r,i,o,u=!1)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(r,i)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(r,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:i}),headers:I,token:o}),getTemplate:(r,i)=>t(`/api/storefront/page-templates/${r}/`,{token:i}),saveTemplateLayout:(r,i,o)=>t(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:I,token:o}),listTemplatePages:async(r,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(r,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(r,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...i}),headers:I,token:o}),saveTemplatePageLayout:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:I,token:o}),deleteTemplatePage:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},createPage:(r,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:i,layout:o}),token:u}),deletePage:(r,i)=>t(`/api/storefront/pages/${r}/`,{method:"DELETE",token:i}),getHeaderSettings:(r,i)=>t(s(i),{token:r}),listMenus:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:r});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(r,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:r});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,C)=>P.sort_order-C.sort_order||P.name.localeCompare(C.name))},listForms:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,C)=>P.title.localeCompare(C.title))},listWheelSummaries:async(r,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:r});return f(g)},listProducts:async(r,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:r});return f(g)},getWheelDetail:async(r,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(f(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:r})))},updateHeaderSettings:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSite:(r,i)=>t(q(r),{token:i}),listSites:async r=>{let i=await t("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(r,i)=>{let o=await t(Ot(r),{token:i});return Array.isArray(o)?o:[]},publishSite:(r,i)=>t(`${q(r)}publish/`,{method:"POST",token:i}),getSiteLiveState:(r,i)=>t(`${q(r)}live-state/`,{token:i}),getThemeSettings:(r,i)=>t(a(i),{token:r}),updateThemeSettings:(r,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getMyPreferences:async r=>(await t("/api/auth/me/",{token:r})).preferences??{},updateMyPreferences:(r,i)=>t("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:r}),token:i}),getChatSettings:(r,i)=>t(l(i),{token:r}),updateChatSettings:(r,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSocialSettings:(r,i)=>t(p(i),{token:r}),updateSocialSettings:(r,i,o)=>t(p(o),{method:"PATCH",body:JSON.stringify(r),token:i}),uploadHeaderLogo:(r,i,o)=>{let u=new FormData;return u.append("logo",r),t(s(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(r,i)=>t(s(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:i}),uploadMedia:async(r,i)=>{let o=new FormData;return o.append("file",r),t(Et(),{method:"POST",body:o,token:i})},listMedia:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]}}}var dn=It({siteDrafts:!0});export{B as a,Y as b,ee as c,w as d,Le as e,D as f,ye as g,nt as h,S as i,G as j,H as k,tn as l,nn as m,c as n,gt as o,qe as p,bt as q,At as r,Rt as s,xt as t,cn as u,ln as v,un as w,K as x,mn as y,dn as z};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|