PageSourceSearch

https://benscycle.com/_next/static/chunks/29l_w0nb1c1pu.js

js benscycle.com collected 2026-09-26 04:50:03 UTC 200,930 bytes, 39 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,7496,e=>{"use strict";var t=e.i(43476),r=e.i(71645),l=e.i(18566),a=e.i(84802),s=e.i(83642),o=e.i(93052),n=e.i(30374),i=e.i(67881),c=e.i(20865),d=e.i(78344),u=e.i(32781),h=e.i(99847),m=e.i(75183),g=e.i(67363),p=e.i(4737),x=e.i(16410),f=e.i(31769);let b=e=>{if(e)return"@primary"===e?"hsl(var(--primary))":"@accent"===e?"hsl(var(--accent))":"transparent"===e?"transparent":`hsl(${e})`};function v(e,t,r,l){let a=Math.sin((r-e)*Math.PI/180/2)**2+Math.cos(e*Math.PI/180)*Math.cos(r*Math.PI/180)*Math.sin((l-t)*Math.PI/180/2)**2;return 7918*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}let y=new Map;async function j(e){let t=new URLSearchParams({format:"json",limit:"1",countrycodes:"us",...e}).toString();if(y.has(t))return y.get(t)??null;try{let e=await fetch(`https://nominatim.openstreetmap.org/search?${t}`,{headers:{"User-Agent":"Masterlinq-Beta/1.0"}});if(e.ok){let r=await e.json();if(r.length){let e={lat:parseFloat(r[0].lat),lng:parseFloat(r[0].lon)};return y.set(t,e),e}}}catch(e){console.error("Geocoding error:",e)}return y.set(t,null),null}e.s(["InlineLocationPrompt",0,function(){let{user:e}=(0,s.useAuth)(),{guestLocation:r,setShowLocationPrompt:l}=(0,a.useGuestLocation)();return e||r?null:(0,t.jsxs)("button",{onClick:()=>l(!0),className:"w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-primary/10 hover:bg-primary/15 border border-primary/20 rounded-lg text-sm font-medium text-primary transition-colors",children:[(0,t.jsx)(c.MapPin,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"Get accurate delivery dates for your area"})]})},"LocationIndicator",0,function(){let{user:e}=(0,s.useAuth)(),{guestLocation:r,setShowLocationPrompt:l}=(0,a.useGuestLocation)();return e?null:r?(0,t.jsxs)("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,t.jsx)(c.MapPin,{className:"w-3 h-3"}),(0,t.jsxs)("span",{children:["Delivering to ",r.city||r.postalCode]})]}):(0,t.jsxs)("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-accent hover:text-accent/80 transition-colors",children:[(0,t.jsx)(c.MapPin,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:"Set delivery location"})]})},"LocationPrompt",0,function({open:e,onOpenChange:s,tenant:y}){let w=(0,l.usePathname)(),{guestLocation:N,isLoading:C,locationStatus:k,error:S,requestGeolocation:$,setPostalCode:T,clearLocation:B,showLocationPrompt:E,setShowLocationPrompt:M}=(0,a.useGuestLocation)(),{preferredStoreId:P,setPreferredStore:L,clearPreferredStore:I}=(0,o.usePreferredStore)(),[H,D]=(0,r.useState)(""),[A,O]=(0,r.useState)(!1),F=void 0!==e?e:E,U=s||M,[R,z]=(0,r.useState)([]),[V,W]=(0,r.useState)(!1),[q,_]=(0,r.useState)(null),[G,X]=(0,r.useState)(new Map),[Y,K]=(0,r.useState)(null),[J,Z]=(0,r.useState)(null),[Q,ee]=(0,r.useState)(null),[et,er]=(0,r.useState)(null),[el,ea]=(0,r.useState)("divider"),[es,eo]=(0,r.useState)(null),[en,ei]=(0,r.useState)(null),[ec,ed]=(0,r.useState)(null),[eu,eh]=(0,r.useState)("We're neighbors! Choose a store for pickup."),[em,eg]=(0,r.useState)("Choose a store for pickup."),[ep,ex]=(0,r.useState)("If you're ever in the area, stop by and say hi!");(0,r.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--location-dialog-bg").trim();t&&K(t);let r=e.getPropertyValue("--location-dialog-text-color").trim();r&&Z(r);let l=e.getPropertyValue("--location-dialog-button-color").trim();l&&ee(l);let a=e.getPropertyValue("--location-dialog-header-bg").trim();a&&er(a);let s=e.getPropertyValue("--location-dialog-column-style").trim();s&&ea(s);let o=e.getPropertyValue("--location-dialog-divider-color").trim();o&&eo(o);let n=e.getPropertyValue("--location-dialog-card-bg").trim();n&&ei(n);let i=e.getPropertyValue("--location-dialog-card-border").trim();i&&ed(i);let c=e.getPropertyValue("--location-dialog-pickup-msg-close").trim();c&&eh(c);let d=e.getPropertyValue("--location-dialog-pickup-msg-medium").trim();d&&eg(d);let u=e.getPropertyValue("--location-dialog-pickup-msg-far").trim();u&&ex(u)};e();let t=new MutationObserver(e);t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]});let r=()=>e();return window.addEventListener("theme-applied",r),()=>{t.disconnect(),window.removeEventListener("theme-applied",r)}},[]);let ef=(0,r.useRef)(!1);(0,r.useEffect)(()=>
1{if(!y||!F||ef.current)return;let e=!1;return async function(){W(!0);try{let t=await (0,f.getStoreLocations)(y);if(!e){let e=(t.locations||[]).filter(e=>e.pickupEnabled);z(e),ef.current=!0}}catch{e||z([])}finally{e||W(!1)}}(),()=>{e=!0}},[y,F]),(0,r.useEffect)(()=>{if(!N?.postalCode)return void _(null);let e=!1;return j({postalcode:N.postalCode}).then(t=>{e||_(t)}),()=>{e=!0}},[N?.postalCode]),(0,r.useEffect)(()=>{if(0===R.length)return void X(new Map);let e=new Map,t=[];for(let r of R)null!=r.latitude&&null!=r.longitude?e.set(r.id,{lat:r.latitude,lng:r.longitude}):t.push(r);if(0===t.length)return void X(e);let r=!1;return async function(){await Promise.all(t.map(async t=>{let r=`${t.addressLine1}, ${t.city}, ${t.state} ${t.zipcode}`,l=await j({q:r});l&&e.set(t.id,l)})),r||X(new Map(e))}(),()=>{r=!0}},[R]);let eb=(0,r.useMemo)(()=>{let e=q&&0!==G.size?[...R].sort((e,t)=>{let r=G.get(e.id),l=G.get(t.id);return(r?v(q.lat,q.lng,r.lat,r.lng):1/0)-(l?v(q.lat,q.lng,l.lat,l.lng):1/0)}):[...R];if(P){let t=e.findIndex(e=>e.id===P);if(t>0){let[r]=e.splice(t,1);e.unshift(r)}}return e},[R,q,G,P]),ev=(0,r.useCallback)(e=>{if(!q)return null;let t=G.get(e);return t?v(q.lat,q.lng,t.lat,t.lng):null},[q,G]),ey=w?.startsWith("/password")||w?.startsWith("/checkout")||w?.startsWith("/order-confirmation")||w?.startsWith("/preview"),ej=void 0!==e||!ey;(0,r.useEffect)(()=>{!ej&&F&&U(!1)},[ej,F,U]);let ew=async()=>{await $(),"denied"===k&&O(!0)},eN=async e=>{e.preventDefault(),H.length>=5&&await T(H)},eC=b(Q),ek=eC?{backgroundColor:eC}:void 0,eS=J&&"auto"!==J?b(J):Y?(0,x.getContrastColor)(Y):void 0,e$=!!Y&&(0,x.isDarkBackground)(Y),eT="@primary"===en||"@accent"===en,eB="cards"===el&&en&&"transparent"!==en&&!eT?en:null,eE=(()=>{if(eB&&(!J||"auto"===J))return(0,x.getContrastColor)(eB)})(),eM=!!eB&&(0,x.isDarkBackground)(eB),eP="cards"===el?{...en&&"transparent"!==en?{backgroundColor:b(en)}:{},...ec&&"transparent"!==ec?{borderColor:b(ec),borderWidth:"1px",borderStyle:"solid"}:{},...eE?{color:eE}:{},...eM?{"--foreground":"0 0% 98%","--muted-foreground":"0 0% 70%","--border":"0 0% 30%","--input":"0 0% 30%","--ring":"0 0% 60%"}:eB?{"--foreground":"0 0% 3.9%","--muted-foreground":"0 0% 45.1%","--border":"0 0% 89.8%","--input":"0 0% 89.8%","--ring":"0 0% 3.9%"}:{}}:void 0,eL=(0,t.jsxs)("div",{className:`flex-1 p-6 space-y-4 ${"cards"===el?"rounded-lg m-3 sm:ml-3 sm:mr-1.5 mt-3":""}`,style:eP,children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold mb-1 flex items-center gap-2",children:[(0,t.jsx)(g.Truck,{className:"w-[1.2rem] h-[1.2rem]"}),"Delivery"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Set a delivery location for shipping estimates while you shop."}),N?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-accent/30 bg-accent/5",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:N.city?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"text-xl font-semibold leading-tight",children:[N.city,", ",N.state]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5",children:N.postalCode})]}):(0,t.jsx)("p",{className:"text-2xl font-semibold tracking-wide",children:N.postalCode})}),(0,t.jsx)("button",{onClick:()=>{B(),D(""),O(!1)},className:"shrink-0 text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:"Change"})]}),(0,t.jsx)(i.Button,{className:"w-full h-12 text-base",style:ek,onClick:()=>U(!1),children:"Keep Shopping"})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[S&&(0,t.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-red-50 border border-red-200 rounded-md text-sm text-red-700",children:[(0,t.jsx)(h.AlertCircle,{className:"w-4 h-4 mt-0.5 shrink-0"}),(0,t.jsx)("span",{children:S})]}),"denied"!==k&&!A&&(0,t.jsx)(i.Button,{onClick:ew,disabled:C,className:"w-full h-12 text-base",variant:"default",style:ek,children:C?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Loader2,{className:"w-5 h-5 animate-spin"}),"Detecting location..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Navigation,{className:"w-5 h-5"}),"Use My Location"]})}),"denied"!==k&&!A&&(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,t.jsx)("span",{className:"w-full border-t"})}),(0,t.jsx)("div",{className:"relative flex justify-center text-xs uppercase",children:(0,t.jsx)("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[!A&&"denied"!==k&&(0,t.jsx)("button",{onClick:()=>O(!0),className:"w-full text-sm text-accent hover:text-accent/80 transition-colors",children:"Enter ZIP code manually"}),(A||"denied"===k)&&(0,t.jsx)("form",{onSubmit:eN,className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(c.MapPin,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),(0,t.jsx)("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:5,placeholder:"Enter ZIP code",value:H,onChange:e=>D(e.target.value.replace(/\D/g,"")),className:"w-full h-12 pl-10 pr-4 border rounded-md text-base focus:outline-none focus:ring-2 focus:ring-accent focus:border-accent",autoFocus:"denied"===k})]}),(0,t.jsx)(i.Button,{type:"submit",disabled:C||H.length<5,className:"h-12 px-6",
1style:ek,children:C?(0,t.jsx)(u.Loader2,{className:"w-5 h-5 animate-spin"}):"Go"})]})})]})]})})]}),eI=(0,r.useMemo)(()=>{if(!q||0===G.size)return em;let e=1/0;return(G.forEach(t=>{let r=v(q.lat,q.lng,t.lat,t.lng);r<e&&(e=r)}),e<5)?eu:e<=100?em:ep},[q,G,eu,em,ep]),eH=(0,t.jsxs)("div",{className:`flex-1 p-6 space-y-4 ${"cards"===el?"rounded-lg m-3 sm:mr-3 sm:ml-1.5 mt-3":""}`,style:eP,children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold mb-1 flex items-center gap-2",children:[(0,t.jsx)(m.Store,{className:"w-5 h-5"}),"Pickup"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:eI}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"space-y-3 max-h-65 overflow-y-auto scrollbar-hide pb-6",children:V?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(u.Loader2,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):0===R.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No pickup locations available."}):eb.map(e=>{let r=P===e.id,l=ev(e.id);return(0,t.jsx)("div",{className:`p-3 rounded-lg border transition-colors ${r?"border-accent bg-accent/5":"border-border hover:border-accent/50"}`,children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name}),null!==l&&(0,t.jsx)("span",{className:"text-xs font-bold text-accent shrink-0",children:l<5?`${l.toFixed(1)} mi`:`${Math.round(l)} mi`})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[e.addressLine1,(0,t.jsx)("br",{}),e.city,", ",e.state," ",e.zipcode]})]}),(0,t.jsx)("div",{className:"shrink-0 pt-0.5",children:r?(0,t.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 text-xs font-medium text-accent",children:[(0,t.jsx)(p.Check,{className:"w-4 h-4"}),"My Store"]}),(0,t.jsx)("button",{onClick:I,className:"text-[10px] text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:"Clear"})]}):(0,t.jsx)(i.Button,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:()=>{L(e.id,e.name,e.posLocationId,e.posLocationName)},children:"Select"})})]})},e.id)})}),(0,t.jsx)("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-6",style:{background:`linear-gradient(to top, ${"cards"===el&&en&&"transparent"!==en?b(en)??"hsl(var(--background))":Y?b(Y)??"hsl(var(--background))":"hsl(var(--background))"}, transparent)`}})]})]});return(0,t.jsx)(n.Dialog,{open:ej&&F,onOpenChange:U,children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-4xl overflow-hidden",onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),style:{...b(Y)?{backgroundColor:b(Y)}:{},...eS?{color:eS}:{},...e$?{"--foreground":"0 0% 98%","--muted-foreground":"0 0% 70%","--border":"0 0% 30%","--input":"0 0% 30%","--ring":"0 0% 60%"}:{}},children:[(0,t.jsxs)(n.DialogHeader,{style:et&&"transparent"!==et?{backgroundColor:b(et)}:void 0,className:et&&"transparent"!==et?"-mx-6 -mt-6 px-6 pt-6 pb-4 rounded-t-lg":"-mt-2",children:[(0,t.jsx)(n.DialogTitle,{className:"text-base! font-semibold",children:"Choose Your Location"}),(0,t.jsx)(n.DialogDescription,{className:"sr-only",children:"Set your delivery location or select a store for pickup."})]}),(0,t.jsxs)("div",{className:`flex flex-col sm:flex-row -mx-6 ${"cards"!==el?"border-t border-border":""}
1`,children:[eL,"divider"===el&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"hidden sm:block w-px self-stretch mt-6",style:es&&"transparent"!==es?{backgroundColor:b(es)}:{backgroundColor:"hsl(var(--border) / 0.3)"}}),(0,t.jsx)("div",{className:"block sm:hidden h-px w-full",style:es&&"transparent"!==es?{backgroundColor:b(es)}:{backgroundColor:"hsl(var(--border))"}})]}),eH]})]})})}])},88736,77689,54773,86024,70472,e=>{"use strict";var t=e.i(43476),r=e.i(9390),l=e.i(99738),a=e.i(63448),s=e.i(56420);let o=(0,s.default)("shopping-basket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]),n=(0,s.default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);var i=e.i(1279);let c=(0,s.default)("circle-user",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);var d=e.i(65649),u=e.i(66595),h=e.i(67881),m=e.i(76381),g=e.i(83642),p=e.i(5132),x=e.i(20865),f=e.i(75183),b=e.i(67363),v=e.i(84802),y=e.i(93052);function j({variant:e,foregroundColor:r,showLabels:l=!1,guestOnly:a=!1,className:s,showBackground:o=!0,showDelivery:n=!0,showPickup:i=!0}){let{user:c,loading:d}=(0,g.useAuth)(),{guestLocation:u,setShowLocationPrompt:h}=(0,v.useGuestLocation)(),{preferredStoreName:m}=(0,y.usePreferredStore)();if(a&&!d&&c||a&&d||!n&&!i)return null;let p=n&&!!u,w=i&&!!m,N=r?`hsl(${r})`:void 0,C=r?`hsl(${r} / 0.05)`:void 0,k=()=>h(!0);return"icon"===e?o&&(p||w)?(0,t.jsx)("div",{className:`flex items-center rounded-lg transition-colors ${s??""}`,style:{gap:"calc(var(--ml-grid-gap) / 3)",padding:"calc(var(--ml-card-padding) / 2) calc(var(--ml-card-padding) / 1)",backgroundColor:C,color:N},children:(0,t.jsxs)("button",{onClick:k,className:"flex items-center transition-colors hover:opacity-80",style:{gap:"calc(var(--ml-grid-gap) / 1.5)"},children:[p&&(0,t.jsxs)("span",{className:"flex flex-col items-center",children:[(0,t.jsx)(b.Truck,{className:"h-5 w-5"}),l&&(0,t.jsx)("span",{className:"text-xs mt-1",children:u.postalCode})]}),w&&(0,t.jsxs)("span",{className:"flex flex-col items-center",children:[(0,t.jsx)(f.Store,{className:"h-5 w-5"}),l&&(0,t.jsx)("span",{className:"text-xs mt-1",children:m})]})]})}):(0,t.jsxs)("button",{onClick:k,className:`flex flex-col items-center transition-colors hover:opacity-80 ${s??""}`,style:{color:N},"aria-label":"Set delivery location",title:"Set delivery location",children:[(0,t.jsx)(x.MapPin,{className:"h-6 w-6"}),l&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Set Location"})]}):"compact"===e?(0,t.jsxs)("button",{onClick:k,className:`flex items-center gap-1.5 text-xs transition-colors hover:opacity-80 ${s??""}`,style:{color:N},title:p?`Delivering to ${u.postalCode}`:w?`Pickup at ${m}`:"Set your location",children:[p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.Truck,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u.postalCode})]}),p&&w&&(0,t.jsx)("span",{className:"mx-0.5 opacity-40",children:"·"}),w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.Store,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:m})]}),!p&&!w&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.MapPin,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:"Set Location"})]})]}):(0,t.jsx)("div",{className:`flex items-center rounded-lg transition-colors ${s??""}`,style:{gap:"calc(var(--ml-grid-gap) / 3)",padding:"calc(var(--ml-card-padding) / 2) calc(var(--ml-card-padding) / 1)",backgroundColor:C,color:N},children:(0,t.jsxs)("button",{onClick:k,className:"flex items-center transition-colors hover:opacity-80",style:{gap:"calc(var(--ml-grid-gap) / 1.5)"},children:[p&&(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(b.Truck,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-sm",children:w?(0,t.jsx)("span",{className:"font-semibold",children:u.postalCode}):(0,t.jsxs)(t.Fragment,{children:["Delivering to ",(0,t.jsx)("span",{className:"font-semibold",children:u.postalCode})]})})]}),w&&(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(f.Store,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-sm",children:p?(0,t.jsx)("span",{className:"font-semibold",children:m}):(0,t.jsxs)(t.Fragment,{children:["Pickup at ",(0,t.jsx)("span",{className:"font-semibold",children:m})]})})]}),!p&&!w&&(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(x.MapPin,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-sm",children:"Set delivery location"})]})]})})}var w=e.i(79786),N=e.i(71645),C=e.i(18566),k=e.i(57688),S=e.i(63676),$=e.i(68877),T=e.i(28623),B=e.i(74544),E=e.i(67927);let M=(0,s.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);var P=e.i(26091),L=e.i(32781),I=e.i(61664);let H=(0,I.getApiBaseUrl)();async function D(e,t=8,r){let l=await fetch(`${H}/api/ecom/search/unified`,{method:"POST",headers:{"Content-Type":"application/json","X-Account-Code":r},body:JSON.stringify({query:e,limit:t})});if(!l.ok){let e=await l.text();throw console.error("Unified search failed:",l.status,e),Error(`Search failed: ${l.status}`)}return l.json()}var A=e.i(47163),O=e.i(91291),F=e.i(74804),U=e.i(78929);async function R(e,t=8){if(!e)return[];try{let r=await fetch(`${(0,I.getApiBaseUrl)()}/api/ecom/search-analytics/trending?limit=${t}`,{method:"GET",headers:{"X-Account-Code":e},next:{revalidate:60}});if(!r.ok)return[];return await r.json()}catch{return[]}}async function z(e,t,r=3){if(!e||!t?.trim())return[];try{let l=`${(0,I.getApiBaseUrl)()}/api/ecom/search-analytics/did-you-mean?q=${encodeURIComponent(t)}&limit=${r}`,a=await fetch(l,{method:"GET",headers:{"X-Account-Code":e}});if(!a.ok)return[];return await a.json()}catch{return[]}}var V=e.i(52917),W=e.i(30374),q=e.i(16410),_=e.i(30593),G=e.i(91750);let X=e=>"number"==typeof e.price&&"number"==typeof e.maxPrice&&e.maxPrice>e.price,Y="masterlinq_recent_searches",K=()=>{try{return JSON.parse(localStorage.getItem(Y)||"[]")}catch{return[]}},J=e=>{if(e.trim())try{let t=K(),r=[e.trim(),...t.filter(t=>t.toLowerCase()!==e.trim().toLowerCase())].slice(0,5);localStorage.setItem(Y,JSON.stringify(r))}catch{}};function Z({tenant:e,className:l="",isMobile:a=!1,autoFocus:s=!1,searchStyle:o="attached",buttonColor:n="@primary",placeholder:i="Search products...",icon:c="search",buttonMode:d="icon",buttonText:h="Search",borderColor:m="0 0% 90%",categoryLinks:g=[],disableInternalModal:p=!1,inputRef:x,isOpen:f,onClose:b,onOpen:v,useOverlay:y=!1}){let j=(0,C.useRouter)(),w=(0,_.useIsMobile)(),[k,I]=(0,N.useState)(""),[H,ee]=(0,N.useState)(""),[et,er]=(0,N.useState)({products:[],categories:[],pages:[]}),[el,ea]=(0,N.useState)(!1),[es,eo]=(0,N.useState)(!1),[en,ei]=(0,N.useState)([]),[ec,ed]=(0,N.useState)([]),[eu,eh]=(0,N.useState)(!1),[em,eg]=(0,N.useState)([]),ep=(a||y)&&(void 0!==f?f:es);(0,G.useFloatingWidgetSuppressor)(ep);let ex=(0,N.useRef)(null),ef=(0,N.useCallback)(e=>{ex.current=e,x&&(x.current=e)},[x]),eb=(0,N.useRef)(null),ev=(0,N.useRef)(null),[ey,ej]=(0,N.useState)("drawer"),[ew,eN]=(0,N.useState)("medium"),[eC,ek]=(0,N.useState)(50),[eS,e$]=(0,N.useState)(null),[eT,eB]=(0,N.useState)(null),[eE,eM]=(0,N.useState)(null),[eP,eL]=(0,N.useState)(null),[eI,eH]=(0,N.useState)(null),[eD,eA]=(0,N.useState)("Search products..."),[eO,eF]=(0,N.useState)("card"),[eU,eR]=(0,N.useState)(!0),[ez,eV]=(0,N.useState)(!0),[eW,eq]=(0,N.useState)(!0),[e_,eG]=(0,N.useState)(9);(0,N.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement),t=t=>
1e.getPropertyValue(t).trim(),r=t("--search-overlay-style");("dialog"===r||"drawer"===r)&&ej(r);let l=t("--search-dialog-width");l&&eN(l);let a=t("--search-dialog-overlay-opacity");a&&ek(parseInt(a,10)||50);let s=t("--search-dialog-header-bg");s&&e$(s);let o=t("--search-dialog-header-text-color");o&&eB(o);let n=t("--search-dialog-button-color");n&&eM(n);let i=t("--search-drawer-header-bg");i&&eL(i);let c=t("--search-drawer-header-text-color");c&&eH(c);let d=t("--search-placeholder");d&&eA(d.replace(/^"|"$/g,""));let u=t("--search-result-style");("card"===u||"list"===u)&&eF(u);let h=t("--search-show-recent");("0"===h||"1"===h)&&eR("1"===h);let m=t("--search-show-images");("0"===m||"1"===m)&&eV("1"===m);let g=t("--search-show-prices");("0"===g||"1"===g)&&eq("1"===g);let p=t("--search-max-results");p&&eG(parseInt(p,10)||9)};e();let t=new MutationObserver(()=>e());return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("theme-applied",e),()=>{t.disconnect(),window.removeEventListener("theme-applied",e)}},[]),(0,N.useEffect)(()=>{ei(K())},[]),(0,N.useEffect)(()=>{s&&ex.current&&ex.current.focus()},[s]),(0,N.useEffect)(()=>{let e=setTimeout(()=>{ee(k)},300);return()=>clearTimeout(e)},[k]),(0,N.useEffect)(()=>{H.length>=2?eX(H):er({products:[],categories:[],pages:[]})},[H]),(0,N.useEffect)(()=>{if(a)return;let e=e=>{ev.current&&!ev.current.contains(e.target)&&eo(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]),(0,N.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(eo(!1),ex.current?.blur())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,N.useEffect)(()=>(a&&es?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[a,es]);let eX=async t=>{ea(!0);try{let r=await D(t,24,e);er({products:r.products,categories:r.categories,pages:r.pages}),(0,U.logSearchExecuted)(e,{query:t,resultCount:(r.products?.length??0)+(r.categories?.length??0)+(r.pages?.length??0),source:"autocomplete"})}catch(e){console.error("Search error:",e),er({products:[],categories:[],pages:[]})}finally{ea(!1)}};(0,N.useEffect)(()=>{eu||es&&(eh(!0),(async()=>{ed(await R(e,8))})())},[es,eu,e]),(0,N.useEffect)(()=>{if(!(H.length>=2&&!el&&0===et.products.length&&0===et.categories.length&&0===et.pages.length)){em.length>0&&eg([]);return}let t=!1;return(async()=>{let r=await z(e,H,3);t||eg(r)})(),()=>{t=!0}},[H,el,et.products.length,et.categories.length,et.pages.length,e]);let eY=(0,N.useCallback)((t,r,l,a,s)=>{J(k),ei(K()),eo(!1),I(""),b?.(),(0,U.logSearchClick)(e,{query:k,productId:t,productTitle:r,variantSku:l,position:a??1,source:"autocomplete"});let o=(0,O.createProductSlug)(r),n=l&&!s?`&variant=${encodeURIComponent(l)}`:"";j.push((0,F.withEditMode)(`/products/${o}?id=${t}${n}`))},[j,k,b,e]),eK=e=>{if(e.preventDefault(),k.trim()){let e=k.trim();J(e),ei(K()),eo(!1),I(""),b?.(),j.push((0,F.withEditMode)(`/search?q=${encodeURIComponent(e)}`))}},eJ=()=>{eo(!1),I(""),b?.()},eZ=()=>{I(""),er({products:[],categories:[],pages:[]}),ex.current?.focus()},eQ=el?(0,t.jsx)(L.Loader2,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(S.X,{className:"h-4 w-4"}),e0=()=>{y?v?.():eo(!0)},e1=()=>{let e=k.trim();J(e),ei(K()),eo(!1),I(""),b?.(),j.push((0,F.withEditMode)(`/search?q=${encodeURIComponent(e)}`))},e2=()=>{try{localStorage.removeItem(Y)}catch{}ei([])},e5=k.length<2,e4=k.length>=2,e3=et.products.length>0||et.categories.length>0||et.pages.length>0,e6=e4&&!el&&!e3&&H===k,e8=eU?en:[],e7=e8.length>0||g.length>0,e9="@primary"===n?"hsl(var(--primary))":"@accent"===n?"hsl(var(--accent))":`hsl(${n})`,te=(0,q.getContrastColor)(n)||"hsl(0 0% 100%)",tt="@primary"===m?"hsl(var(--primary))":"@accent"===m?"hsl(var(--accent))":`hsl(${m})`,tr=e=>{switch(d){case"text":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"lg:hidden",children:tl(e)}),(0,t.jsx)("span",{className:"hidden lg:inline font-medium",children:h})]});case"icon-text":return(0,t.jsxs)(t.Fragment,{children:[tl(e),(0,t.jsx)("span",{className:"hidden lg:inline font-medium ml-2",children:h})]});default:return tl(e)}},tl=e=>{switch(c){case"arrow-right":return(0,t.jsx)($.ArrowRight,{className:e});case"sparkles":return(0,t.jsx)(T.Sparkles,{className:e});default:return(0,t.jsx)(u.Search,{className:e})}},[ta,ts]=(0,N.useState)("attached"===o||"detached"===o);if((0,N.useEffect)(()=>{"collapsed"===o?ts(!1):ts(!0)},[o]),"collapsed"===o&&!ta){let e="icon"===d?a?"h-10 w-10":"h-11 w-11":a?"h-10 px-4":"h-11 px-4";return(0,t.jsx)("button",{onClick:()=>
1{if("collapsed"===o){if(y&&v)return void v();ts(!0),setTimeout(()=>ex.current?.focus(),100)}},"aria-label":"Search",className:`flex items-center justify-center gap-2 rounded-lg transition-colors ${e}`,style:{backgroundColor:e9,color:te},children:tr(a?"h-4 w-4":"h-5 w-5")})}let to=()=>{"collapsed"===o&&(ts(!1),I(""),eo(!1))},tn=()=>(0,t.jsxs)(t.Fragment,{children:[el&&e4&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-accent"}),(0,t.jsx)("span",{className:"ml-3 text-sm text-muted-foreground",children:"Searching..."})]}),!el&&e5&&(0,t.jsxs)("div",{className:"p-4",children:[ec.length>=3&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Trending Now"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-2",children:ec.slice(0,6).map(e=>(0,t.jsxs)(r.default,{href:`/products/${(0,O.createProductSlug)(e.title)}?id=${encodeURIComponent(e.productId)}${e.sku?`&variant=${encodeURIComponent(e.sku)}`:""}`,onClick:eJ,className:"flex items-center gap-3 px-3 py-2 hover:bg-muted rounded-lg transition-colors",children:[e.image?(0,t.jsx)("img",{src:e.image,alt:e.title,className:"h-10 w-10 object-cover rounded flex-shrink-0"}):(0,t.jsx)("div",{className:"h-10 w-10 rounded bg-muted flex-shrink-0"}),(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,t.jsx)("span",{className:"text-sm text-foreground truncate",children:e.title}),"number"==typeof e.price&&e.price>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,A.formatPrice)(e.price)})]})]},e.productId))})]}),e8.length>0&&(0,t.jsxs)("div",{className:g.length>0?"mb-4":"",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Recent Searches"}),(0,t.jsx)("button",{type:"button",onClick:e2,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Clear"})]}),(0,t.jsx)("div",{className:"space-y-1",children:e8.map((e,r)=>(0,t.jsxs)("button",{type:"button",onClick:()=>{I(e),ee(e),eX(e)},className:"flex items-center gap-2 w-full px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors text-left",children:[(0,t.jsx)(B.Clock,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{children:e})]},r))})]}),g.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Popular Categories"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-1",children:g.slice(0,6).map((e,l)=>(0,t.jsxs)(r.default,{href:e.url,onClick:eJ,className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-3 w-3 text-muted-foreground ml-auto"})]},l))})]})]}),!el&&e4&&e3&&(0,t.jsxs)("div",{className:`${"dialog"===ey&&"wide"===ew?"flex":a?"":"flex"}`,children:[(et.categories.length>0||et.pages.length>0)&&(0,t.jsxs)("div",{className:`${"dialog"===ey&&"wide"===ew?"w-1/4 border-r border-border shrink-0":a?"border-b border-border":"w-56 border-r border-border shrink-0"}`,children:[et.categories.length>0&&(0,t.jsxs)("div",{className:et.pages.length>0?"border-b border-border":"",children:[(0,t.jsx)("div",{className:"px-4 py-2 bg-muted/50",children:(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Categories"})}),(0,t.jsx)("div",{className:"p-2",children:et.categories.map((e,l)=>(0,t.jsxs)(r.default,{href:e.url,onClick:eJ,className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",children:[(0,t.jsx)(M,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-4 w-4 text-muted-foreground ml-auto shrink-0"})]},l))})]}),et.pages.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-4 py-2 bg-muted/50",children:(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Pages"})}),(0,t.jsx)("div",{className:"p-2",children:et.pages.map((e,l)=>(0,t.jsxs)(r.default,{href:e.url,onClick:eJ,className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",children:[(0,t.jsx)(P.FileText,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-4 w-4 text-muted-foreground ml-auto shrink-0"})]},l))})]})]}),et.products.length>0&&(0,t.jsx)("div",{className:`${"dialog"===ey&&"wide"===ew?et.categories.length>0||et.pages.length>0?"w-3/4":"w-full":"flex-1"} min-w-0`,children:(0,t.jsx)("div",{className:"list"===eO?"p-2":"px-4 pb-4 pt-2",children:"list"===eO?(0,t.jsx)("div",{className:"space-y-1",children:et.products.slice(0,e_).map((e,r)=>(0,t.jsx)(Q,{product:e,onClick:()=>eY(e.id,e.title,e.sku,r+1,X(e)),showImages:ez,showPrices:eW,style:"list"},e.sku||e.id))}):(0,t.jsx)("div",{className:`grid gap-2 ${w?"grid-cols-2":"dialog"===ey?"narrow"===ew?"grid-cols-2":"medium"===ew||et.categories.length>0||et.pages.length>0?"grid-cols-3":"grid-cols-4":a?"grid-cols-2":et.categories.length>0||et.pages.length>0?"grid-cols-3":"grid-cols-4"}`,children:et.products.slice(0,e_).map((e,r)=>(0,t.jsx)(Q,{product:e,onClick:()=>eY(e.id,e.title,e.sku,r+1,X(e)),showImages:ez,showPrices:eW,style:"card"},e.sku||e.id))})})})]}),e6&&(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)(u.Search,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),(0,t.jsxs)("h3",{className:"text-base font-semibold text-foreground mb-1",children:['No results for "',k,'"']}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Try different keywords or browse our categories"})]}),em.length>0&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Did you mean?"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:em.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{I(e.query),ee(e.query)},className:"inline-flex items-center px-3 py-1.5 text-sm rounded-full bg-muted hover:bg-accent hover:text-accent-foreground transition-colors",children:e.query},e.query))})]}),g.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Browse Categories"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-1",children:g.slice(0,6).map((e,l)=>(0,t.jsxs)(r.default,{href:e.url,onClick:eJ,className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-3 w-3 text-muted-foreground ml-auto"})]},l))})]})]}),e4&&et.products.length>0&&(0,t.jsx)("div",{className:"border-t border-border p-3",children:(0,t.jsxs)("button",{type:"button",onClick:e1,className:"w-full flex items-center justify-center gap-2 h-10 rounded-lg font-medium hover:opacity-90 transition-opacity text-sm",style:{backgroundColor:eE?(0,q.getBackgroun
1dColor)(eE):void 0,color:eE?(0,q.getTextColor)("auto",eE):void 0},children:['View all results for "',k,'"',(0,t.jsx)($.ArrowRight,{className:"h-4 w-4"})]})})]});if(a){if(p)return(0,t.jsxs)("div",{ref:ev,className:`relative w-full ${l}`,children:[(0,t.jsx)("form",{onSubmit:eK,className:"relative w-full",children:(0,t.jsxs)("div",{className:`relative w-full flex ${"detached"===o?"gap-2":""}`,children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)("input",{ref:ef,type:"search",placeholder:i,value:k,onChange:e=>I(e.target.value),onFocus:e0,className:`w-full bg-white focus:border-accent focus:outline-none text-foreground h-10 px-4 [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden ${"attached"===o?"pr-24 rounded-lg":"pr-10 rounded-lg"}`,style:{borderRadius:"attached"===o?void 0:"var(--radius)",borderWidth:"1px",borderStyle:"solid",borderColor:tt}}),k&&(0,t.jsx)("button",{type:"button",onClick:eZ,"aria-label":el?"Searching":"Clear search",className:`absolute top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors z-10 ${"attached"===o?"right-12":"right-3"}`,children:eQ}),"attached"===o&&(0,t.jsx)("button",{type:y?"button":"submit",onClick:y?()=>v?.():void 0,"aria-label":"Search",className:"absolute right-0 top-0 rounded-r-lg hover:opacity-90 transition-opacity flex items-center h-10 px-3",style:{backgroundColor:e9,color:te},children:tr("h-4 w-4")})]}),"detached"===o&&(0,t.jsx)("button",{type:y?"button":"submit",onClick:y?()=>v?.():void 0,"aria-label":"Search",className:"flex items-center justify-center rounded-lg hover:opacity-90 transition-opacity h-10 px-3",style:{backgroundColor:e9,color:te},children:tr("h-4 w-4")})]})}),es&&(e5&&e7||e4)&&(0,t.jsx)("div",{ref:eb,className:"absolute top-full left-0 right-0 mt-1 bg-white border border-border rounded-lg shadow-xl z-50 max-h-[60vh] overflow-y-auto animate-in fade-in slide-in-from-top-2 duration-150",children:tn()})]});let e=void 0!==f?f:es,a=()=>{void 0!==f?(b?.(),I("")):setTimeout(()=>{eo(!1),I("")},300)};return void 0===f||f?(0,t.jsxs)(t.Fragment,{children:[void 0===f&&(0,t.jsx)("form",{onSubmit:eK,className:`relative w-full ${l}`,children:(0,t.jsxs)("div",{className:`relative w-full flex ${"detached"===o?"gap-2":""}`,children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)("input",{ref:ef,type:"search",placeholder:i,value:k,onChange:e=>I(e.target.value),onFocus:e0,className:`w-full bg-white focus:border-accent focus:outline-none text-foreground h-10 px-4 [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden ${"attached"===o?"pr-24 rounded-lg":"pr-10 rounded-lg"}`,style:{borderRadius:"attached"===o?void 0:"var(--radius)",borderWidth:"1px",borderStyle:"solid",borderColor:tt}}),k&&(0,t.jsx)("button",{type:"button",onClick:eZ,"aria-label":el?"Searching":"Clear search",className:`absolute top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors z-10 ${"attached"===o?"right-12":"right-3"}`,children:eQ}),"attached"===o&&(0,t.jsx)("button",{type:y?"button":"submit",onClick:y?()=>v?.():void 0,"aria-label":"Search",className:"absolute right-0 top-0 rounded-r-lg hover:opacity-90 transition-opacity flex items-center h-10 px-3",style:{backgroundColor:e9,color:te},children:tr("h-4 w-4")})]}),"detached"===o&&(0,t.jsx)("button",{type:y?"button":"submit",onClick:y?()=>v?.():void 0,"aria-label":"Search",className:"flex items-center justify-center rounded-lg hover:opacity-90 transition-opacity h-10 px-3",style:{backgroundColor:e9,color:te},children:tr("h-4 w-4")}),"collapsed"===o&&ta&&(0,t.jsx)("button",{type:"button",onClick:to,"aria-label":"Close search",className:"flex items-center justify-center rounded-lg hover:bg-muted transition-colors h-10 w-10",children:(0,t.jsx)(S.X,{className:"h-4 w-4"})})]})}),w||"dialog"!==ey?(0,t.jsx)(V.Sheet,{open:e,onOpenChange:e=>!e&&a(),children:(0,t.jsxs)(V.SheetContent,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col [&>button]:hidden bg-background",onPointerDown:e=>{let t=e.currentTarget,r=e.clientY,l=r,s=e=>{let a=(l=e.clientY)-r;a>0&&(t.style.transform=`translateY(${a}px)`,t.style.transition="none")},o=()=>{l-r>120?(t.style.transform="translateY(100%)",t.style.transition="transform 0.2s ease-out",setTimeout(()=>{a(),t.style.transform="",t.style.transition=""},200)):(t.style.transform="",t.style.transition="transform 0.2s ease-out",setTimeout(()=>{t.style.transition=""},200)),document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",o)},children:[(0,t.jsx)(V.SheetTitle,{className:"sr-only",children:"Search"}),(0,t.jsxs)("div",{className:"shrink-0",style:{backgroundColor:eP?(0,q.getBackgroun
1dColor)(eP):void 0,color:(0,q.getTextColor)(eI??void 0,eP??void 0)},children:[(0,t.jsx)("div",{className:"flex justify-center pt-2 pb-0 sm:hidden",children:(0,t.jsx)("div",{className:"w-10 h-1 rounded-full bg-current opacity-30"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)("form",{onSubmit:eK,className:"relative flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(u.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 opacity-60"}),(0,t.jsx)("input",{type:"search",value:k,onChange:e=>I(e.target.value),placeholder:"Search products...",autoFocus:!0,className:"w-full h-11 pl-10 pr-10 border border-border rounded-lg bg-muted/50 text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none transition-colors [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"}),k&&(0,t.jsx)("button",{type:"button",onClick:eZ,"aria-label":el?"Searching":"Clear search",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:eQ})]}),(0,t.jsx)("button",{type:"button",onClick:a,"aria-label":"Close search",className:"shrink-0 p-2 rounded-lg transition-colors opacity-80 hover:opacity-100",style:{color:(0,q.getTextColor)(eI??void 0,eP??void 0)},children:(0,t.jsx)(S.X,{className:"h-5 w-5"})})]})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:tn()})]})}):(0,t.jsx)(W.Dialog,{open:e,onOpenChange:e=>!e&&a(),children:(0,t.jsxs)(W.DialogContent,{className:"p-0 flex flex-col overflow-hidden min-h-[400px] max-h-[70vh] bg-background top-[15%]! translate-y-0! border-0",style:{width:(e=>{switch(e){case"narrow":return"640px";case"medium":default:return"1000px";case"wide":return"1200px"}})(ew),maxWidth:"90vw"},overlayStyle:{backgroundColor:`rgba(0, 0, 0, ${eC/100})`},showCloseButton:!1,children:[(0,t.jsx)(W.DialogTitle,{className:"sr-only",children:"Search"}),(0,t.jsx)("div",{className:"shrink-0 p-4",style:{backgroundColor:eS?(0,q.getBackgroundColor)(eS):void 0,color:(0,q.getTextColor)(eT??void 0,eS??void 0)},children:(0,t.jsx)("form",{onSubmit:eK,className:"relative flex items-center gap-2",children:(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(u.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5",style:{color:"hsl(0 0% 40%)"}}),(0,t.jsx)("input",{type:"search",value:k,onChange:e=>I(e.target.value),placeholder:"Search products...",autoFocus:!0,className:"w-full h-11 pl-10 pr-10 border border-border rounded-lg bg-background/80 text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none transition-colors [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden",style:{backgroundColor:eS?"rgba(255,255,255,0.9)":void 0,color:eS?"hsl(0 0% 10%)":void 0}}),k&&(0,t.jsx)("button",{type:"button",onClick:eZ,"aria-label":el?"Searching":"Clear search",className:"absolute right-3 top-1/2 -translate-y-1/2 transition-colors hover:opacity-70",style:{color:"hsl(0 0% 40%)"},children:eQ})]})})}),("wide"===ew||"medium"===ew)&&e4&&e3?(0,t.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,t.jsxs)("div",{className:"w-1/4 shrink-0 flex flex-col bg-white",children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[et.categories.length>0&&(0,t.jsxs)("div",{className:et.pages.length>0?"border-b border-border":"",children:[(0,t.jsx)("div",{className:"px-4 py-2",children:(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Categories"})}),(0,t.jsx)("div",{className:"p-2",children:et.categories.map((e,l)=>(0,t.jsxs)(r.default,{href:e.url,onClick:eJ,className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",children:[(0,t.jsx)(M,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-4 w-4 text-muted-foreground ml-auto shrink-0"})]},l))})]}),et.pages.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-4 py-2",children:(0,t.jsx)("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Pages"})}),(0,t.jsx)("div",{className:"p-2",children:et.pages.map((e,l)=>(0,t.jsxs)(r.default,{href:e.url,onClick:eJ,className:"flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",children:[(0,t.jsx)(P.FileText,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-4 w-4 text-muted-foreground ml-auto shrink-0"})]},l))})]}),0===et.categories.length&&0===et.pages.length&&(0,t.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:"No matching categories"})]}),et.products.length>0&&(0,t.jsx)("div",{className:"shrink-0 p-3",children:(0,t.jsxs)("button",{type:"button",onClick:e1,className:"w-full flex items-center justify-center gap-2 h-10 rounded-lg font-medium hover:opacity-90 transition-opacity text-sm",style:{backgroundColor:eE?(0,q.getBackgroun
1dColor)(eE):void 0,color:eE?(0,q.getTextColor)("auto",eE):void 0},children:["View all results",(0,t.jsx)($.ArrowRight,{className:"h-4 w-4"})]})})]}),(0,t.jsx)("div",{className:"w-3/4 flex flex-col min-w-0",children:(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:et.products.length>0?(0,t.jsx)("div",{className:"list"===eO?"p-2":"px-4 pb-4 pt-2",children:"list"===eO?(0,t.jsx)("div",{className:"space-y-1",children:et.products.slice(0,e_).map((e,r)=>(0,t.jsx)(Q,{product:e,onClick:()=>eY(e.id,e.title,e.sku,r+1,X(e)),showImages:ez,showPrices:eW,style:"list"},e.sku||e.id))}):(0,t.jsx)("div",{className:`grid gap-2 ${"wide"===ew?"grid-cols-4":"grid-cols-3"}`,children:et.products.slice(0,e_).map((e,r)=>(0,t.jsx)(Q,{product:e,onClick:()=>eY(e.id,e.title,e.sku,r+1,X(e)),showImages:ez,showPrices:eW,style:"card"},e.sku||e.id))})}):(0,t.jsx)("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No products found"})})})]}):(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:tn()})]})})]}):null}return(0,t.jsxs)("div",{ref:ev,className:`relative w-full ${l}`,children:[(0,t.jsx)("form",{onSubmit:eK,className:"relative w-full",children:(0,t.jsxs)("div",{className:`relative w-full flex ${"detached"===o?"gap-2":""}`,children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)("input",{ref:ef,type:"search",placeholder:i,value:k,onChange:e=>I(e.target.value),onFocus:e0,onBlur:()=>{"collapsed"===o&&setTimeout(()=>{k||to()},200)},className:`w-full bg-white focus:border-accent focus:outline-none text-foreground h-11 px-4 [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden ${"attached"===o?"pr-24 rounded-lg":"pr-10 rounded-lg"}`,style:{borderRadius:"attached"===o?void 0:"var(--radius)",borderWidth:"1px",borderStyle:"solid",borderColor:tt}}),k&&(0,t.jsx)("button",{type:"button",onClick:eZ,"aria-label":el?"Searching":"Clear search",className:`absolute top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors z-10 ${"attached"===o?"right-14":"right-3"}`,children:eQ}),"attached"===o&&(0,t.jsx)("button",{type:y?"button":"submit",onClick:y?()=>v?.():void 0,"aria-label":"Search",className:"absolute right-0 top-0 rounded-r-lg hover:opacity-90 transition-opacity flex items-center h-11 px-4",style:{backgroundColor:e9,color:te},children:tr("h-5 w-5")})]}),"detached"===o&&(0,t.jsx)("button",{type:y?"button":"submit",onClick:y?()=>v?.():void 0,"aria-label":"Search",className:"flex items-center justify-center rounded-lg hover:opacity-90 transition-opacity h-11 px-4",style:{backgroundColor:e9,color:te},children:tr("h-5 w-5")}),"collapsed"===o&&ta&&(0,t.jsx)("button",{type:"button",onClick:to,"aria-label":"Close search",className:"flex items-center justify-center rounded-lg hover:bg-muted transition-colors h-11 w-11",children:(0,t.jsx)(S.X,{className:"h-5 w-5"})})]})}),!y&&es&&(e5&&e7||e4)&&(0,t.jsx)("div",{ref:eb,className:"absolute top-full left-0 right-0 mt-1 bg-white border border-border rounded-lg shadow-xl z-50 max-h-[70vh] overflow-y-auto animate-in fade-in slide-in-from-top-2 duration-150",children:tn()})]})}function Q({product:e,onClick:r,showImages:l=!0,showPrices:a=!0,style:s="card"}){let[o,n]=(0,N.useState)(!1),i=e.compareAtPrice&&e.price&&e.compareAtPrice>e.price,c=i&&e.compareAtPrice&&e.price?Math.round((e.compareAtPrice-e.price)/e.compareAtPrice*100):0,d="number"==typeof e.price&&"number"==typeof e.maxPrice&&e.maxPrice>e.price;return"list"===s?(0,t.jsxs)("button",{onClick:r,className:"group flex items-center gap-3 w-full p-2 text-left hover:bg-muted rounded-lg transition-colors",children:[l&&(0,t.jsx)("div",{className:"relative w-12 h-12 rounded-md bg-muted/30 overflow-hidden shrink-0",children:e.image&&!o?(0,t.jsx)(k.default,{src:e.image,alt:e.title,fill:!0,className:"object-contain p-1",sizes:"48px",onError:()=>n(!0)}):(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsx)(u.Search,{className:"h-4 w-4 text-muted-foreground/30"})})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[e.vendor&&(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wide truncate",children:e.vendor}),(0,t.jsx)("h4",{className:"text-sm font-medium text-foreground truncate group-hover:text-accent transition-colors",children:e.title})]}),a&&(0,t.jsxs)("div",{className:"text-right shrink-0",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-foreground",children:e.price?d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-normal text-xs text-muted-foreground mr-0.5",children:"From"}),(0,A.formatPrice)(e.price)]}):(0,A.formatPrice)(e.price):"—"}),i&&e.compareAtPrice&&(0,t.jsx)("span",{className:"block text-xs text-muted-foreground line-through",children:(0,A.formatPrice)(e.compareAtPrice)})]})]}):(0,t.jsxs)("button",{onClick:r,className:"group text-left bg-white rounded-xl border border-border hover:border-accent hover:shadow-lg transition-all duration-200 overflow-hidden",children:[l&&(0,t.jsxs)("div",{className:"relative aspect-[5/3] bg-white overflow-hidden",children:[e.image&&!o?(0,t.jsx)(k.default,{src:e.image,alt:e.title,fill:!0,className:"object-contain p-2 group-hover:scale-105 transition-transform duration-300",sizes:"(max-width: 640px) 50vw, (max-width: 768px) 33vw, 25vw",onError:()=>n(!0)}):(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsx)(u.Search,{className:"h-8 w-8 text-muted-foreground
1/30"})}),a&&c>=5&&(0,t.jsxs)("div",{className:"absolute top-2 right-2 bg-accent text-white text-xs font-bold px-2 py-1 rounded",children:[c,"% OFF"]})]}),(0,t.jsxs)("div",{className:"px-2 pt-1.5 pb-2",children:[e.vendor&&(0,t.jsx)("p",{className:"text-[9px] text-muted-foreground uppercase tracking-wide mb-0.5 truncate",children:e.vendor}),(0,t.jsx)("p",{className:`text-sm leading-snug font-light text-foreground line-clamp-3 group-hover:text-accent transition-colors ${l?"min-h-8":""}`,children:e.title}),a&&(0,t.jsxs)("div",{className:"flex items-baseline gap-1.5 mt-1",children:[(0,t.jsx)("span",{className:`font-bold text-base ${i?"text-primary":"text-foreground"}`,children:e.price?d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-normal text-xs text-muted-foreground mr-0.5",children:"From"}),(0,A.formatPrice)(e.price)]}):(0,A.formatPrice)(e.price):"—"}),i&&e.compareAtPrice&&(0,t.jsx)("span",{className:"text-base text-muted-foreground line-through",children:(0,A.formatPrice)(e.compareAtPrice)})]})]})]})}let ee=(0,s.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);function et(e){switch(e){case"pill":return{radius:"9999px",isUnderline:!1,submitRadius:"9999px"};case"rounded":return{radius:"10px",isUnderline:!1,submitRadius:"6px"};case"square":return{radius:"0px",isUnderline:!1,submitRadius:"6px"};case"underline":return{radius:"0px",isUnderline:!0,submitRadius:"6px"}}}let er="hsl(var(--search-v2-accent))",el="hsl(var(--search-v2-text) / 0.65)",ea="hsl(var(--search-v2-text) / 0.55)",es="hsl(var(--search-v2-text) / 0.15)";function eo(e,t){let r=`0 0 0 2px ${er}, 0 8px 28px rgba(0,0,0,0.08)`,l=`0 0 0 1px ${er}, 0 0 0 4px hsl(var(--search-v2-accent) / 0.19)`;if(t)return{background:"#ffffff",boxShadow:"outlined"===e?l:r,iconColor:"#52525b",placeholderColor:"#71717a",dividerColor:"#e4e4e7",useAccent:!1};switch(e){case"soft":return{background:"#ffffff",boxShadow:"none",iconColor:el,placeholderColor:ea,dividerColor:es,useAccent:!1};case"blended":return{background:"hsl(var(--search-v2-accent) / 0.1)",boxShadow:"inset 0 0 0 1px hsl(var(--search-v2-accent) / 0.25)",iconColor:er,placeholderColor:er,dividerColor:es,useAccent:!0};case"outlined":return{background:"#ffffff",boxShadow:"inset 0 0 0 1px #a1a1aa",iconColor:el,placeholderColor:ea,dividerColor:es,useAccent:!1};case"tonal":return{background:"color-mix(in oklab, hsl(var(--header-bg)) 92%, hsl(var(--foreground)))",boxShadow:"none",iconColor:el,placeholderColor:ea,dividerColor:es,useAccent:!1};case"ghost":return{background:"transparent",boxShadow:"inset 0 0 0 1px transparent",iconColor:el,placeholderColor:ea,dividerColor:es,useAccent:!1}}}let en={regular:{heightClass:"h-11",textClass:"text-[14px]",underlineTextClass:"text-[15px]",iconClass:"w-4 h-4",submitWrapperClass:"w-7 h-7",submitIconClass:"w-3.5 h-3.5",caretClass:"h-4",paddingClass:"px-4"},large:{heightClass:"h-14",textClass:"text-[16px]",underlineTextClass:"text-[18px]",iconClass:"w-5 h-5",submitWrapperClass:"w-9 h-9",submitIconClass:"w-4 h-4",caretClass:"h-5",paddingClass:"px-5"}},ei=(0,s.default)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),ec="masterlinq_recent_searches",ed="hsl(var(--search-v2-popup-text, 0 0% 10%))",eu="hsl(var(--search-v2-popup-text, 0 0% 10%) / 0.8)",eh="hsl(var(--search-v2-popup-cta, var(--primary)))",em=["New arrivals","Bestsellers","On sale","Gift ideas","Accessories","Apparel"];function eg(){try{return JSON.parse(localStorage.getItem(ec)||"[]")}catch{return[]}}function ep({query:e,open:r,tenant:l,shape:a,onSelect:s}){let[o,n]=(0,N.useState)(null),[i,c]=(0,N.useState)([]),[d,u]=(0,N.useState)([]),[h,m]=(0,N.useState)(!1),g=(0,N.useMemo)(()=>new Set(d.map(e=>e.productId)),[d]),[p,x]=(0,N.useState)([]),f=(0,N.useRef)("");if((0,N.useEffect)(()=>{r&&c(eg())},[r]),(0,N.useEffect)(()=>{r&&!h&&(m(!0),(async()=>{u(await R(l,8))})())},[r,h,l]),(0,N.useEffect)(()=>{if(!r)return;let t=e.trim();if(!t||t.length<2){n(null),f.current="";return}if(t===f.current)return;let a=setTimeout(async()=>{try{let e=await D(t,8,l);f.current=t,n(e),(0,U.logSearchExecuted)(l,{query:t,resultCount:(e.products?.length??0)+(e.categories?.length??0)+(e.pages?.length??0),source:"autocomplete"})}catch(e){console.warn("[SearchTypeaheadV2] search failed",e),n(null)}},300);return()=>clearTimeout(a)},[r,e,l]),(0,N.useEffect)(()=>
1{if(!r)return;let t=e.trim();if(null===o||t!==f.current||(o?.products.length??0)!==0||(o?.categories.length??0)!==0||(o?.pages.length??0)!==0||!t){p.length>0&&x([]);return}let a=!1;return(async()=>{let e=await z(l,t,3);a||x(e)})(),()=>{a=!0}},[r,e,o,l]),!r)return null;let b=e.trim(),v=b.length>=2,y=null!==o&&b===f.current,j=o?.products??[],w=o?.categories??[],C=o?.pages??[],k=j.length,S=e=>{if(e.trim())try{let t=eg(),r=[e.trim(),...t.filter(t=>t.toLowerCase()!==e.trim().toLowerCase())].slice(0,5);localStorage.setItem(ec,JSON.stringify(r))}catch{}s((0,F.withEditMode)(`/search?q=${encodeURIComponent(e)}`),e)};return(0,t.jsxs)("div",{className:"absolute top-[calc(100%+10px)] z-[60] overflow-hidden",style:{borderRadius:"square"===a?"0":"16px",width:"var(--search-v2-popup-width, auto)",left:"var(--search-v2-popup-left, 0)",right:"var(--search-v2-popup-right, 0)",transform:"var(--search-v2-popup-transform, none)",background:"rgb(255 255 255 / calc(var(--search-v2-popup-bg-opacity, 100) * 1%))",backdropFilter:"blur(var(--search-v2-popup-bg-blur, 0px))",WebkitBackdropFilter:"blur(var(--search-v2-popup-bg-blur, 0px))",border:"var(--search-v2-popup-border, 1px solid hsl(0 0% 90%))",boxShadow:"var(--search-v2-popup-shadow, 0 24px 60px rgba(0,0,0,0.12))"},onMouseDown:e=>e.preventDefault(),children:[(v||d.length>=3)&&(0,t.jsxs)("div",{className:"px-6 pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em]",style:{color:eu},children:v?(0,t.jsxs)(t.Fragment,{children:["Products",y&&` \xb7 ${k} matches`," for"," ",(0,t.jsxs)("span",{className:"normal-case tracking-normal",style:{color:ed},children:["“",b,"”"]})]}):"Trending now"}),(j.length>0||v)&&(0,t.jsxs)("button",{type:"button",onClick:()=>S(v?b:""),className:"text-xs font-medium flex items-center gap-1.5",style:{color:eh},children:["View all results ",(0,t.jsx)($.ArrowRight,{className:"w-3.5 h-3.5"})]})]}),v&&j.length>0?(0,t.jsx)("div",{className:"grid grid-cols-4 gap-2",children:j.map((e,r)=>(0,t.jsxs)("div",{className:"relative",children:[g.has(e.id)&&(0,t.jsx)(ef,{}),(0,t.jsx)(ex,{product:e,onClick:()=>{(0,U.logSearchClick)(l,{query:b,productId:e.id,productTitle:e.title,variantSku:e.sku,position:r+1,source:"autocomplete"});let t="number"==typeof e.price&&"number"==typeof e.maxPrice&&e.maxPrice>e.price,a=e.sku&&!t?`&variant=${encodeURIComponent(e.sku)}`:"";s((0,F.withEditMode)(`/products/${(0,O.createProductSlug)(e.title)}?id=${e.id}${a}`))}})]},e.id))}):v&&y?(0,t.jsxs)("div",{className:"py-6",children:[(0,t.jsxs)("div",{className:"text-sm text-center mb-3",style:{color:eu},children:["No products found for “",b,"”."]}),p.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em]",style:{color:eu},children:"Did you mean"}),p.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>S(e.query),className:"px-2.5 py-1 rounded-full bg-white border border-zinc-200 hover:border-zinc-400 text-[11px]",style:{color:ed},children:e.query},e.query))]})]}):v?(0,t.jsx)("div",{className:"py-6 text-sm text-center",style:{color:eu},children:"Searching…"}):(0,t.jsx)("div",{className:"flex gap-6 overflow-x-auto -mx-6 px-6 pb-1 [scrollbar-width:thin]",children:d.slice(0,8).map(e=>(0,t.jsxs)("div",{className:"relative flex-shrink-0 w-36",children:[(0,t.jsx)(ef,{}),(0,t.jsx)(ex,{product:{id:e.productId,title:e.title,vendor:e.vendor,productType:e.productType,image:e.image,price:e.price,sku:e.sku},onClick:()=>{let t=e.sku?`&variant=${encodeURIComponent(e.sku)}`:"";s((0,F.withEditMode)(`/products/${(0,O.createProductSlug)(e.title)}?id=${e.productId}${t}`))}})]},e.productId))})]}),(0,t.jsx)("div",{className:"px-6 pt-4 pb-5 border-t border-zinc-100 bg-zinc-50/40 grid grid-cols-[auto_1fr] gap-x-5 gap-y-3 items-start",children:v?(0,t.jsx)(eb,{query:b,categories:w,pages:C,onSelect:s}):(0,t.jsx)(ev,{recent:i,trending:em,onPick:e=>S(e)})})]})}function ex({product:e,onClick:r}){let l="number"==typeof e.price?(0,A.formatPrice)(e.price):null;return(0,t.jsx)("button",{type:"button",onClick:r,className:"group text-left h-full w-full",children:(0,t.jsxs)("div",{className:"h-full rounded-md bg-white p-3 border border-zinc-100",children:[(0,t.jsx)("div",{className:"relative aspect-square w-full overflow-hidden",children:e.image?(0,t.jsx)(k.default,{src:e.image,alt:e.title,fill:!0,sizes:"(max-width: 768px) 25vw, 160px",className:"object-contain transition-transform group-hover:scale-[1.02]"}):null}),e.vendor&&(0,t.jsx)("div",{className:"mt-2 text-[11px] tracking-[0.08em] uppercase truncate",style:{color:eu},children:e.vendor}),(0,t.jsx)("div",{className:"text-[14px] font-medium leading-tight mt-0.5 line-clamp-2",style:{color:ed},children:e.title}),l&&(0,t.jsx)("div",{className:"text-[14px] mt-1",style:{color:ed},children:l})]})})}function ef(){return(0,t.jsx)("div",{className:"absolute top-1.5 right-1.5 z-10 flex items-center justify-center w-5 h-5 rounded-full bg-white/90 border border-zinc-200 shadow-sm pointer-events-none",title:"Trending","aria-label":"Trending",children:(0,t.jsx)(ei,{className:"w-3 h-3",style:{color:eh}})})}function eb({query:e,categories:l,pages:a,onSelect:s}){return l.length>0||a.length>0?(0,t.jsxs)(t.Fragment,{children:[l.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] pt-1.5",style:{color:eu},children:"Categories"}),(0,t.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:l.map(l=>(0,t.jsx)(r.default,{href:(0,F.withEditMode)(l.url),onClick:()=>s((0,F.withEditMode)(l.url)),className:"px-2.5 py-1 rounded-full bg-white border border-zinc-200 hover:border-zinc-400 text-[11px] inline-flex items-center",style:{color:eu},children:(0,t.jsx)(ey,{text:l.label,query:e})},l.id))})]}),a.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] pt-1.5",style:{color:eu},children:"Pages"}),(0,t.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:a.map(l
1=>(0,t.jsx)(r.default,{href:(0,F.withEditMode)(l.url),onClick:()=>s((0,F.withEditMode)(l.url)),className:"px-2.5 py-1 rounded-full bg-white border border-zinc-200 hover:border-zinc-400 text-[11px] inline-flex items-center",style:{color:eu},children:(0,t.jsx)(ey,{text:l.label,query:e})},l.id))})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] pt-1.5",style:{color:eu},children:"Suggestions"}),(0,t.jsx)("div",{className:"text-sm",style:{color:eu},children:"No matching categories or pages."})]})}function ev({recent:e,trending:r,onPick:l}){return(0,t.jsxs)(t.Fragment,{children:[e.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-[10px] uppercase tracking-[0.18em] pt-1.5 inline-flex items-center gap-1.5",style:{color:eu},children:[(0,t.jsx)(B.Clock,{className:"w-3 h-3"})," Recent"]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:e.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>l(e),className:"px-2.5 py-1 rounded-full bg-white border border-zinc-200 hover:border-zinc-400 text-[11px]",style:{color:eu},children:e},e))})]}),(0,t.jsxs)("span",{className:"text-[10px] uppercase tracking-[0.18em] pt-1.5 inline-flex items-center gap-1.5",style:{color:eu},children:[(0,t.jsx)(ei,{className:"w-3 h-3"})," Trending"]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:r.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>l(e),className:"px-2.5 py-1 rounded-full bg-white border border-zinc-200 hover:border-zinc-400 text-zinc-800 text-[11px]",children:e},e))})]})}function ey({text:e,query:r}){let l=(0,N.useMemo)(()=>{if(!r)return null;let t=e.toLowerCase().indexOf(r.toLowerCase());return t<0?null:{before:e.slice(0,t),hit:e.slice(t,t+r.length),after:e.slice(t+r.length)}},[e,r]);return l?(0,t.jsxs)("span",{style:{color:eu},children:[l.before,(0,t.jsx)("span",{className:"font-semibold",style:{color:ed},children:l.hit}),l.after]}):(0,t.jsx)("span",{style:{color:eu},children:e})}function ej({tenant:e,placeholder:r,onOpenOverlay:l}){let a,s,o=(0,C.useRouter)(),{shape:n,style:i,showSubmit:c,typewriter:d,placeholders:h,height:m,showAsButton:g}=(0,w.useSearchV2Config)(),p=(0,w.useSearchOverlayExperience)(),x=function(){let[e,t]=(0,N.useState)(!1);return(0,N.useEffect)(()=>{let e=window.matchMedia("(prefers-reduced-motion: reduce)");t(e.matches);let r=e=>t(e.matches);return e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),f="v2"===p,b=!f&&!!l,[v,y]=(0,N.useState)(""),[j,k]=(0,N.useState)(!1),[S,$]=(0,N.useState)(!1),[T,B]=(0,N.useState)(!1),E=(0,N.useRef)(null),M=(0,N.useRef)(null),P=g&&!S;(0,N.useEffect)(()=>{S&&!b&&M.current?.focus()},[S,b]),(0,N.useEffect)(()=>{g&&$(!1)},[g]);let L=(0,N.useMemo)(()=>{let e=(h??"").split("\n").map(e=>e.trim()).filter(Boolean);return e.length>0?e:r?.trim()?[r.trim()]:["Search products..."]},[h,r]),I=d&&!x&&L.length>1&&""===v&&!j,H=function(e,t=!0,r=55,l=1400){let[a,s]=(0,N.useState)(""),[o,n]=(0,N.useState)("typing"),[i,c]=(0,N.useState)(0);return(0,N.useEffect)(()=>{let d;if(!t)return;let u=e[i%e.length];return"typing"===o?d=a.length<u.length?setTimeout(()=>s(u.slice(0,a.length+1)),r):setTimeout(()=>n("erasing"),l):"erasing"===o&&(a.length>0?d=setTimeout(()=>s(u.slice(0,a.length-1)),Math.max(20,.5*r)):(n("typing"),c(e=>e+1))),()=>{d&&clearTimeout(d)}},[a,o,i,t,e,r,l]),a}(L,I),D=L[0],A=et(n),O=en[m];(0,N.useEffect)(()=>{if(c)return;let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),b?l?.():M.current?.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,b,l]);let U=()=>{let e=v.trim();e&&(B(!1),y(""),M.current?.blur(),o.push((0,F.withEditMode)(`/search?q=${encodeURIComponent(e)}`)))},R=e=>{(e.preventDefault(),b)?l?.():U()},z=e=>{if(b){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l?.());return}if("Escape"===e.key){e.preventDefault(),B(!1),M.current?.blur();return}"Enter"===e.key&&(e.preventDefault(),U())};(0,N.useEffect)(()=>{if(!f||!T)return;let e=e=>{let t=e.target;E.current&&t&&!E.current.contains(t)&&B(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[f,T]),(0,N.useEffect)(()=>
1{if(!f)return;let e=e=>{let t=e.detail;t?.overlay==="overlay-search-modal"&&t?.open&&(M.current?.focus(),B(!0))};return window.addEventListener("editor-toggle-overlay",e),()=>window.removeEventListener("editor-toggle-overlay",e)},[f]);let V=()=>{k(!0),f&&B(!0)},W=e=>{B(!1),y(""),M.current?.blur(),o.push(e)},q=e=>{b&&(e.preventDefault(),l?.())},_="flex-1 min-w-0 bg-transparent outline-none placeholder:text-transparent";if(P){let e=eo(i,!1);return(0,t.jsx)("form",{onSubmit:R,role:"search",className:"inline-flex",children:(0,t.jsx)("button",{type:"button",onClick:()=>{b?l?.():$(!0)},"aria-label":"Open search",className:`${O.heightClass} aspect-square flex items-center justify-center shrink-0 hover:opacity-90 transition`,style:{background:e.background,borderRadius:A.radius,boxShadow:e.boxShadow},children:(0,t.jsx)(u.Search,{className:O.iconClass,style:{color:e.iconColor},strokeWidth:2})})})}if(A.isUnderline)return(0,t.jsxs)("form",{ref:E,onSubmit:R,className:"relative w-full",role:"search",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 pb-2 border-b-2",style:{borderBottomColor:j?er:"#a1a1aa",transition:"border-color 180ms ease-out"},onMouseDown:b?q:void 0,children:[(0,t.jsx)(u.Search,{className:`${O.iconClass} shrink-0`,style:{color:j?"hsl(var(--search-v2-accent))":"hsl(var(--search-v2-text) / 0.65)"},strokeWidth:2}),(0,t.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,t.jsx)("input",{ref:M,type:"text",value:v,onChange:e=>y(e.target.value),onFocus:V,onBlur:()=>k(!1),onKeyDown:z,placeholder:"","aria-label":"Search products",className:`${_} ${O.underlineTextClass} w-full`,style:{color:j?"#27272a":"hsl(var(--search-v2-text) / 0.65)"}}),""===v&&!j&&(0,t.jsxs)("span",{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center ${O.underlineTextClass} select-none`,style:{color:"hsl(var(--search-v2-text) / 0.55)"},children:[I?H:D,I&&(0,t.jsx)("span",{className:`ml-px inline-block w-px ${O.caretClass} animate-[caret-blink_1s_steps(1)_infinite]`,style:{background:"hsl(var(--search-v2-text) / 0.55)"}})]})]}),(0,t.jsx)("button",{type:"button","aria-label":"Voice search",className:"hover:opacity-80 transition-opacity",style:{color:"hsl(var(--search-v2-text) / 0.55)"},children:(0,t.jsx)(ee,{className:O.iconClass,strokeWidth:2})})]}),f&&(0,t.jsx)(ep,{query:v,open:T,tenant:e,shape:n,onSelect:W})]});let G=eo(i,j);return(0,t.jsxs)("form",{ref:E,onSubmit:R,className:"relative w-full",role:"search",children:[(0,t.jsxs)("div",{className:`relative flex items-center gap-3 ${O.paddingClass} ${O.heightClass}`,style:(a=et(n),{background:(s=eo(i,j)).background,borderRadius:a.radius,boxShadow:s.boxShadow,transition:"background 180ms ease-out, box-shadow 180ms ease-out"}),onMouseDown:b?q:void 0,children:[(0,t.jsx)(u.Search,{className:`${O.iconClass} shrink-0`,style:{color:G.iconColor},strokeWidth:2}),(0,t.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,t.jsx)("input",{ref:M,type:"text",value:v,onChange:e=>y(e.target.value),onFocus:V,onBlur:()=>k(!1),onKeyDown:z,placeholder:"","aria-label":"Search products",className:`${_} ${O.textClass} w-full`,style:{color:j?"#27272a":G.placeholderColor}}),""===v&&!j&&(0,t.jsxs)("span",{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center ${O.textClass} select-none`,style:{color:G.placeholderColor},children:[I?H:D,I&&(0,t.jsx)("span",{className:`ml-px inline-block w-px ${O.caretClass} animate-[caret-blink_1s_steps(1)_infinite]`,style:{background:G.placeholderColor}})]})]}),(0,t.jsx)("button",{type:"button","aria-label":"Voice search",className:"hover:opacity-80 transition-opacity",style:{color:G.useAccent?"hsl(var(--search-v2-accent))":G.placeholderColor},children:(0,t.jsx)(ee,{className:O.iconClass,strokeWidth:2})}),c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"w-px h-5",style:{background:G.dividerColor}}),(0,t.jsx)("button",{type:"submit","aria-label":"Submit search",className:`${O.submitWrapperClass} flex items-center justify-center shrink-0`,style:{background:"hsl(var(--search-v2-accent))",color:"hsl(var(--search-v2-accent-foreground, 0 0% 100%))",borderRadius:A.submitRadius},children:(0,t.jsx)(u.Search,{className:O.submitIconClass,strokeWidth:2.25})})]}):(0,t.jsx)("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-zinc-100 text-zinc-500 select-none",children:"⌘K"})]}),f&&(0,t.jsx)(ep,{query:v,open:T,tenant:e,shape:n,onSelect:W})]})}function ew(e){let r=(0,w.useSearchExperience)(),l=(0,w.useSearchOverlayExperience)(),a=(0,_.useIsMobile)();return void 0!==e.isOpen?"v2"!==l||a?(0,t.jsx)(Z,{...e}):null:"v2"===r?(0,t.jsx)(ej,{tenant:e.tenant,placeholder:e.placeholder,onOpenOverlay:e.onOpen}):(0,t.jsx)(Z,{...e})}var eN=e.i(74080),eC=e.i(3636),ek=e.i(86253),ek=ek;function eS(e){let t=new Map,r=[];
1e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{let l=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(l):r.push(l)});let l=e=>(e.sort((e,t)=>e.order-t.order),e.forEach(e=>{e.children.length>0&&l(e.children)}),e);return l(r)}function e$(e){switch(e.type){case"page":var t;if(e.url)return e.url.startsWith("/")?e.url:`/${e.url}`;return e.pageId?({home:"/",about:"/about",contact:"/contact",faq:"/faq","privacy-policy":"/privacy-policy","terms-of-service":"/terms-of-service","shipping-returns":"/shipping-returns",cart:"/cart",checkout:"/checkout",account:"/account",wishlist:"/wishlist"})[t=e.pageId]||`/${t}`:"/";case"category":if(e.url)return e.url.startsWith("/")?e.url:`/${e.url}`;return e.categoryId?`/categories/${e.categoryId}`:"/categories";case"location":return e.locationSlug?`/locations/${e.locationSlug}`:"/locations";case"policy":return e.policyType?`/policies/${e.policyType}`:"/policies";case"product":if(!e.productId)return"/products";if("rental"===e.productType)return`/rentals/${e.productId}`;if("giftcard"===e.productType)return`/gift-cards/${e.productId}`;return`/products/${e.productId}`;case"brand":return e.brandName?`/brands/${encodeURIComponent(e.brandName)}`:"/brands";case"blog":if(e.blogArticleId)return`/blog/${e.blogSlug||e.blogArticleId}`;return e.url||"/blog";case"helpCenter":if(e.helpArticleId)return`/help-center/${e.helpArticleSlug||e.helpArticleId}`;if(e.helpCategoryId&&e.helpCategorySlug)return`/help-center?category=${e.helpCategorySlug}`;return e.url||"/help-center";case"custom":{let t=e.url||"#";if("#"===t||t.startsWith("/")||t.startsWith("http"))return t;return`/${t}`}default:return"#"}}function eT({tenant:e,navigation:l,items:a,compact:s,alignEnd:o,textColor:n,hoverColor:i,hoverStyle:c,backgroundColor:d,menuStyle:u,onOpenDrawer:h,drawerChevron:m="right"}){let g="drawer"===u,[p,x]=(0,N.useState)(null),[f,b]=(0,N.useState)(!1),[v,y]=(0,N.useState)(0),j=(0,N.useRef)(null),w=(0,N.useRef)(null),[C,k]=(0,N.useState)(""),[S,$]=(0,N.useState)("badge"),[T,B]=(0,N.useState)(""),[E,M]=(0,N.useState)(),[P,L]=(0,N.useState)(),[I,H]=(0,N.useState)(),[D,O]=(0,N.useState)("357 98% 37%"),[F,U]=(0,N.useState)();(0,N.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--highlight-link-text").replace(/^["']|["']$/g,"").trim(),r=e.getPropertyValue("--highlight-link-style").trim(),l=e.getPropertyValue("--highlight-link-color").trim();k(t),r&&$(r),B(l);let a=e.getPropertyValue("--nav-text-color").trim(),s=e.getPropertyValue("--nav-hover-color").trim(),o=e.getPropertyValue("--nav-hover-style").trim(),n=e.getPropertyValue("--accent").trim();a&&M(a),s&&L(s),o&&H(o),n&&O(n);let i=e.getPropertyValue("--logo-center-navigation-color").trim()||e.getPropertyValue("--nav-color").trim();i&&U(i)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[]);let R=e=>{if(!e||!T)return{};switch(S){case"badge":return{backgroundColor:`hsl(${T})`,color:(0,q.getContrastColor)(T)||"white",borderRadius:"var(--radius, 0.5rem)"};case"underline":return{borderBottom:`2px solid hsl(${T})`,paddingBottom:"2px",borderRadius:0};case"border":return{border:`2px solid hsl(${T})`,borderRadius:"var(--radius, 0.5rem)"};case"text":return{color:`hsl(${T})`,fontWeight:700};default:return{}}},z=(0,N.useMemo)(()=>{let e=E||n;if(!e||"auto"===e){let e=(0,q.getTextColor)("auto",F||d||"0 0% 100%");return e?.startsWith("hsl(")?e.slice(4,-1):"0 0% 10%"}return e},[E,n,F,d]),V=(0,N.useMemo)(()=>{let e=P||i;return e&&"auto"!==e?e:D},[P,i,D]),W=(0,N.useMemo)(()=>I||c||"text",[I,c]),_=(0,N.useMemo)(()=>{if(a)return a;if(!l)return[];let e=l.menus.find(e=>"main"===e.handle);return e?eS(e.items):[]},[l,a]),G=(0,N.useMemo)(()=>_.filter(e=>e.children.length>0&&e.children.some(e=>e.children.length>0)),[_]);(0,N.useEffect)(()=>{let e=setTimeout(()=>b(!0),0);return()=>clearTimeout(e)},[]);let X=e=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{w.current&&y(w.current.getBoundingClientRect().bottom+window.scrollY),x(e)},100)},Y=()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>x(null),150)},K=()=>{x(null)};(0,N.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p&&K()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p]);let J=G.find(e=>e.id===p),Z={"--nav-link-color":`hsl(${z})`,"--nav-link-hover-color":`hsl(${V})`,color:`hsl(${z})`},Q=(0,N.useId)(),ee=`nav-${Q.replace(/:/g,"")}`;return(0,t.jsxs)("div",{className:"relative z-50",children:[(0,t.jsx)("style",{dangerouslySetInnerHTML:{__html:(()=>{let e=`hsl(${V})`,t=`hsl(${V} / 0.1)`;switch(W){case"badge":return`
2          #${ee} .nav-item:hover {
3            background-color: ${t};
4            color: ${e} !important;
5          }
6          #${ee} .nav-item.active {
7            background-color: ${t};
8          }
9        `;case"underline":return`
10          #${ee} .nav-item {
11            position: relative;
12          }
13          #${ee} .nav-item::after {
14            content: '';
15            position: absolute;
16            bottom: 0;
17            left: 50%;
18            width: 0;
19            height: 2px;
20            background-color: ${e};
21            transition: width 0.2s ease, left 0.2s ease;
22          }
23          #${ee} .nav-item:hover::after,
24          #${ee} .nav-item.active::after {
25            width: 100%;
26            left: 0;
27          }
28          #${ee} .nav-item:hover {
29            color: ${e} !important;
30          }
31        `;default:return`
32          #${ee} .nav-item:hover {
33            color: ${e} !important;
34          }
35        `}})()}}),(0,t.jsx)("nav",{id:ee,className:(0,A.cn)("flex flex-wrap items-center nav
35-links-container",s?"gap-0":"gap-1",o&&"justify-end"),"aria-label":"Main navigation",ref:w,style:Z,children:_.map(e=>{let l,a=e.children.length>0&&e.children.some(e=>e.children.length>0),s=e.children.length>0&&!e.children.some(e=>e.children.length>0),o=C&&e.label.toLowerCase()===C.toLowerCase();if(g&&(a||s))return(0,t.jsxs)("button",{type:"button",onClick:()=>h?.(e.id),className:(0,A.cn)("inline-flex h-9 items-center justify-center px-4 py-2 font-bold rounded transition-colors whitespace-nowrap cursor-pointer",!o&&"nav-item"),style:R(!!o),"aria-haspopup":"dialog",children:[e.label,"right"===m&&(0,t.jsx)(ek.default,{className:"ml-1 h-3 w-3"}),"down"===m&&(0,t.jsx)(eC.ChevronDownIcon,{className:"ml-1 h-3 w-3"})]},e.id);if(a)return(0,t.jsx)("div",{className:"relative",onMouseEnter:()=>X(e.id),onMouseLeave:Y,children:(0,t.jsxs)(r.default,{href:e$(e),className:(0,A.cn)("inline-flex h-9 items-center justify-center px-4 py-2 font-bold rounded transition-colors whitespace-nowrap",!o&&"nav-item",!o&&p===e.id&&"active"),style:R(!!o),"aria-expanded":p===e.id,"aria-haspopup":"true",children:[e.label,(0,t.jsx)(eC.ChevronDownIcon,{className:(0,A.cn)("ml-1 h-3 w-3 transition-transform duration-200",p===e.id&&"rotate-180")})]})},e.id);if(!s)return(0,t.jsx)(r.default,{href:e$(e),className:(0,A.cn)("inline-flex h-9 items-center justify-center px-4 py-2 font-bold rounded transition-colors whitespace-nowrap",!o&&"nav-item"),style:R(!!o),children:e.label},e.id);return(0,t.jsxs)("div",{className:"relative",onMouseEnter:()=>X(e.id),onMouseLeave:Y,children:[(0,t.jsxs)(r.default,{href:e$(e),className:(0,A.cn)("inline-flex h-9 items-center justify-center px-4 py-2 font-bold rounded transition-colors whitespace-nowrap",!o&&"nav-item",!o&&p===e.id&&"active"),style:R(!!o),"aria-expanded":p===e.id,"aria-haspopup":"true",children:[e.label,(0,t.jsx)(eC.ChevronDownIcon,{className:(0,A.cn)("ml-1 h-3 w-3 transition-transform duration-200",p===e.id&&"rotate-180")})]}),p===e.id&&((l=e.children)&&0!==l.length?(0,t.jsx)("div",{className:"absolute left-0 z-50 mt-1 min-w-[200px]",onMouseEnter:()=>X(e.id),onMouseLeave:Y,role:"menu","aria-label":`${e.label} menu`,children:(0,t.jsx)("div",{className:"bg-white rounded-md shadow-lg border border-border py-2 animate-in fade-in slide-in-from-top-2 duration-200",children:l.map(e=>(0,t.jsx)(r.default,{href:e$(e),className:"block px-4 py-2 text-sm text-foreground hover:bg-accent/10 hover:text-accent transition-colors",onClick:K,role:"menuitem",children:e.label},e.id))})}):null)]},e.id)})}),f&&p&&J&&(0,eN.createPortal)((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{"data-ml-first-party":"",className:"fixed inset-0 z-40 bg-black/50 animate-in fade-in duration-200",onClick:K,"aria-hidden":"true"}),(e=>{let l=e.children;if(!l||0===l.length)return null;let a=l.length<=5?`grid-cols-${l.length}`:"grid-cols-6";return(0,t.jsx)("div",{"data-ml-first-party":"",className:"absolute left-0 right-0 z-50",style:{to
35p:`${v+8}px`},onMouseEnter:()=>X(e.id),onMouseLeave:Y,role:"region","aria-label":`${e.label} menu`,children:(0,t.jsx)("div",{className:"bg-white shadow-2xl animate-in fade-in slide-in-from-top-2 duration-200 pt-10 pb-15 border-t border-border",children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsx)("div",{className:(0,A.cn)("grid gap-12",a),children:l.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)(r.default,{href:e$(e),className:"block mb-3 text-foreground tracking-wide font-semibold hover:text-accent transition-colors",onClick:K,children:e.label}),(0,t.jsx)("ul",{className:"space-y-2",children:e.children.map((l,a)=>(0,t.jsx)("li",{children:(0,t.jsx)(r.default,{href:e$(l),className:"block text-sm text-muted-foreground hover:text-accent transition-colors py-1",onClick:K,children:l.label})},`${e.id}-${l.id}-${a}`))})]},e.id))})})})})})(J)]}),document.body)]})}function eB({tenant:e,config:s,navigation:x,onOpenMobileMenu:f,onOpenNavDrawerSection:b,onOpenLoginDialog:v,onOpenSearch:y}){let{cart:w,isInitialized:N}=(0,m.useCart)(),{user:C,loading:k}=(0,g.useAuth)(),{openMiniCart:S}=(0,p.useMiniCart)(),$=function(e){let t=e.replace(/%/g,"").split(/\s+/).map(Number);if(t.length<3)return"0 0% 100%";let{r,g:l,b:a}=(0,q.hslToRgb)(t[0],t[1],t[2]),s=(0,q.getRelativeLuminance)(r,l,a);return"white"===(0,q.getBestContrastText)(s)?"0 0% 100%":"0 0% 10%"}(s.headerColor),T="narrow"===s.searchWidth?"max-w-sm":"medium"===s.searchWidth?"max-w-md":"max-w-2xl",B=s.searchBarPosition||"center",E=()=>{let e=`clamp(${.6*s.logoHeight}px, ${.04*s.logoHeight}vw + ${.5*s.logoHeight}px, ${s.logoHeight}px)`,l=e=>`clamp(${s.logoHeight*e*.6}px, ${s.logoHeight*e*.04}vw + ${s.logoHeight*e*.5}px, ${s.logoHeight*e}px)`;return"text"===s.logoType?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:e},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${$})`,fontSize:l(.5),lineHeight:e},children:s.logoText})}):"mark-text"===s.logoType?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center",style:{gap:`clamp(${.2*s.logoHeight*.6}px, ${.2*s.logoHeight*.04}vw + ${.2*s.logoHeight*.5}px, ${.2*s.logoHeight}px)`,height:e},children:[s.logoMarkUrl?(0,t.jsx)("img",{src:s.logoMarkUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:Math.round(.8*s.logoHeight),height:Math.round(.8*s.logoHeight),loading:"eager",style:{height:l(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:l(.8),width:l(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:l(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${$})`,fontSize:l(.4),lineHeight:e},children:s.logoText})]}):"full"===s.logoType&&s.logoUrl?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:e},children:(0,t.jsx)("img",{src:s.logoUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:2*s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:e,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:e},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${$})`,fontSize:l(.5),lineHeight:e},children:s.logoText})})},M=()=>{switch(s.accountIcon){case"user-circle":return(0,t.jsx)(c,{className:"h-6 w-6"});case"person":return(0,t.jsx)(d.UserRound,{className:"h-6 w-6"});default:return(0,t.jsx)(i.User,{className:"h-6 w-6"})}},P=()=>(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[(0,t.jsx)(j,{variant:"badge",foregroundColor:$,className:"hidden md:flex",showDelivery:s.locationShowDelivery,showPickup:s.locationShowPickup}
35),s.showAccount&&(k?(0,t.jsx)("div",{className:"hidden md:flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-muted animate-pulse"})}):C?(0,t.jsxs)(r.default,{href:"/account",className:"hidden md:flex flex-col items-center transition-colors hover:opacity-80",style:{color:`hsl(${$})`},"aria-label":"Account",children:[M(),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:C.firstName||C.email.split("@")[0]})]}):(0,t.jsxs)("button",{onClick:v,className:"hidden md:flex flex-col items-center transition-colors hover:opacity-80",style:{color:`hsl(${$})`},"aria-label":"Sign In",children:[M(),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Sign In"})]})),s.showSearch&&(0,t.jsx)("button",{type:"button",className:"md:hidden flex items-center justify-center transition-colors",style:{color:`hsl(${$})`},"aria-label":"Search",onClick:y,children:(0,t.jsx)(u.Search,{className:"h-6 w-6"})}),s.showCart&&(0,t.jsxs)("button",{onClick:S,className:"flex flex-col items-center justify-center transition-colors hover:opacity-80 relative",style:{color:`hsl(${$})`},"aria-label":"Cart",children:[(0,t.jsxs)("div",{className:"relative",children:[(()=>{switch(s.cartIcon){case"shopping-bag":return(0,t.jsx)(a.ShoppingBag,{className:"h-6 w-6"});case"basket":return(0,t.jsx)(o,{className:"h-6 w-6"});default:return(0,t.jsx)(l.ShoppingCart,{className:"h-6 w-6"})}})(),N&&w.itemCount>0&&(0,t.jsx)("span",{className:"absolute -top-2 -right-2 h-5 w-5 rounded-full text-xs flex items-center justify-center font-bold cart-badge",style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:w.itemCount})]}),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Cart"})]}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"md:hidden",style:{color:`hsl(${$})`},"aria-label":"Menu",onClick:f,children:(0,t.jsx)(n,{className:"h-6 w-6"})})]}),L=()=>{let e,i,c,d,h,m,g;return(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)("div",{style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center justify-between",style:{paddingTop:"inline"===s.navPosition?"calc(var(--ml-header-padding-y, 1.35rem) * 0.75)":"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"inline"===s.navPosition?"calc(var(--ml-header-padding-y, 1.35rem) * 0.75)":"var(--ml-header-padding-y, 1.35rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[(e="same"!==s.mobileLogoType&&s.mobileLogoType?s.mobileLogoType:s.logoType,i=s.mobileLogoHeight||Math.round(.7*s.logoHeight),c=s.mobileLogoUrl||s.logoUrl,d=s.mobileLogoMarkUrl||s.logoMarkUrl,h=e=>`${i*e}px`,"text"===e?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${i}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${$})`,fontSize:h(.5),lineHeight:`${i}px`},children:s.logoText})}):"mark-text"===e?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center",style:{gap:`${.2*i}px`,height:`${i}px`},children:[d?(0,t.jsx)("img",{src:d,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:Math.round(.8*i),height:Math.round(.8*i),loading:"eager",style:{height:h(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:h(.8),width:h(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:h(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${$})`,fontSize:h(.4),lineHeight:`${i}px`},children:s.logoText})]}):"full"===e&&c?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${i}px`},children:(0,t.jsx)("img",{src:c,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:2*i,height:i,loading:"eager",style:{height:`${i}px`,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${i}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${$})`,fontSize:h(.5),lineHeight:`${i}px`},children:s.logoText})})),(g="small"===(m=s.mobileButtonSize||"medium")?"h-5 w-5":"large"===m?"h-7 w-7":"h-6 w-6",(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[s.showSearch&&(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(${$})`},"aria-label":"Search",onClick:y,children:(0,t.jsx)(u.Search,{className:g})}),s.showCart&&(0,t.jsx)("button",{onClick:S,className:"flex items-center justify-center transition-colors relative p-1",style:{color:`hsl(${$})`},"aria-label":"Cart",children:(0,t.jsxs)("div",{className:"relative",children:["shopping-bag"===s.cartIcon?(0,t.jsx)(a.ShoppingBag,{className:g}):"basket"===s.cartIcon?(0,t.jsx)(o,{className:g}):(0,t.jsx)(l.ShoppingCart,{className:g}),N&&w.itemCount>0&&(0,t.jsx)("span",{className:`absolute ${"small"===m?"h-4 w-4 text-[10px] -top-1.5 -right-1.5":"large"===m?"h-6 w-6 text-sm -top-2.5 -right-2.5":"h-5 w-5 text-xs -top-2 -right-2"} rounded-full flex items-center justify-center font-bold cart-badge`,style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:w.itemCount})]})}),(0,t.jsx)("button",{className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(${$})`},"aria-label":"Menu",onClick:f,children:(0,t.jsx)(n,{className:g})})]}))]})})})})},I=s.navigationTopBorder?`${s.navigationTopBorderThickness}px solid hsl(${s.navigationTopBorderColor})`:"none",H="full"===s.navigationTopBorderWidth;return"below"===s.navPosition?(0,t.jsxs)(t.Fragment,{children:[L(),(0,t.jsx)("div",{className:"hidden md:block border-0",style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`,borderBottom:H?I:"none"},children:(0,t.jsx)("div",{className:"mx-auto px-4 border-0",style:{maxWidth:"var(--ml-content-width, 1536px)",borderBottom:H?"none":I},children:(0,t.jsxs)("div",{className:"flex items-center justify-between",style:{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[E(),(()=>{if(!s.showSearch)return null;let r="collapsed"===s.searchStyle,l="hidden md:flex",a={};return r?"left"===B?l+=" flex-1 justify-start":"right"===B?l+=" flex-1 justify-end":l+=" flex-1 justify-center":(l+=` flex-1 ${T}`,a="left"===B?{marginRight:"auto"}:"right"===B?{marginLeft:"auto"}:{marginLeft:"var(--ml-grid-gap)",marginRight:"var(--ml-grid-gap)"}),(0,t.jsx)("div",{className:l,style:a,children:(0,t.jsx)(ew,{tenant:e,searchStyle:s.searchStyle,buttonColor:s.searchButtonColor,placeholder:s.searchPlaceholder,icon:s.searchIcon,buttonMode:s.searchButtonMode,buttonText:s.searchButtonText,borderColor:s.searchBorderColor,useOverlay:!0,onOpen:y})})})(),P()]})})}),(0,t.jsx)("div",{className:"hidden md:block border-0",style:{backgroundColor:`hsl(var(--nav-color, ${s.navigationColor}))`},children:(0,t.jsx)("div",{className:`mx-auto px-4 xl:px-0 py-2 flex items-center border-0 ${"center"===s.navigationAlignment?"justify-center":"justify-start"}`,style:{maxWidth:"var(--ml-content-width, 1536px)",minHeight:"var(--ml-section-padding-y, 3rem)"},children:(0,t.jsx)("div",{className:"tracking-wide",style:{fontSize:"0.975rem"},children:(0,t.jsx)(eT,{tenant:e,navigation:x,textColor:s.navigationTextColor,hoverColor:s.navigationHoverColor,hoverStyle:s.navigationHoverStyle,menuStyle:s.navigationMenuStyle,drawerChevron:s.navigationDrawerChevron,onOpenDrawer:b,backgroundColor:s.navigationColor})})})})]}):(0,t.jsxs)(t.Fragment,{children:[L(),(0,t.jsx)("div",{className:"hidden md:block",style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center",style:{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[E(),(0,t.jsx)("div",{className:"flex items-center text-sm font-semibold uppercase tracking-wide",children:(0,t.jsx)(eT,{tenant:e,navigation:x,textColor:s.navigationTextColor,hoverColor:s.navigationHoverColor,hoverStyle:s.navigationHoverStyle,menuStyle:s.navigationMenuStyle,drawerChevron:s.navigationDrawerChevron,onOpenDrawer:b,backgroundColor:s.headerColor})}),(0,t.jsx)("div",{className:`flex flex-1 ${T}`,style:{marginLeft:"var(--ml-grid-gap)",marginRight:"var(--ml-grid-gap)"},children:(0,t.jsx)(ew,{tenant:e,searchStyle:s.searchStyle,buttonColor:s.searchButtonColor,placeholder:s.searchPlaceholder,icon:s.searchIcon,buttonMode:"icon",buttonText:s.searchButtonText,borderColor:s.searchBorderColor,useOverlay:!0,onOpen:y})}),P()]})})})]})}function eE({tenant:e,config:s,navigation:x,onOpenMobileMenu:f,onOpenNavDrawerSection:b,onOpenSearch:v,onOpenLoginDialog:y}){let w,C,k,S,$,T,B,E,M,P,L,I,H,D,A,O,F,U,{cart:R,isInitialized:z}=(0,m.useCart)(),{user:V,loading:W}=(0,g.useAuth)(),{openMiniCart:_}=(0,p.useMiniCart)(),G=function(e){let t=e.replace(/%/g,"").split(/\s+/).map(Number);if(t.length<3)return"0 0% 100%";let{r,g:l,b:a}=(0,q.hslToRgb)(t[0],t[1],t[2]),s=(0,q.getRelativeLuminance)(r,l,a);
35return"white"===(0,q.getBestContrastText)(s)?"0 0% 100%":"0 0% 10%"}(s.headerColor),X=s.logoHeight,Y=s.hamburgerText||"Shop",K=(0,N.useRef)(null),[J,Z]=(0,N.useState)({width:0,height:0});(0,N.useEffect)(()=>{if(!K.current)return;let e=()=>{if(K.current){let e=K.current.getBoundingClientRect();e.width>0&&e.height>0&&Z(t=>t.width!==e.width||t.height!==e.height?{width:e.width,height:e.height}:t)}},t=setTimeout(e,100),r=new ResizeObserver(e);return r.observe(K.current),()=>{clearTimeout(t),r.disconnect()}},[s.logoHeight,s.logoType,s.logoText]);let Q=()=>{let e=`clamp(${.6*X}px, ${.04*X}vw + ${.5*X}px, ${X}px)`,l=e=>`clamp(${X*e*.6}px, ${X*e*.04}vw + ${X*e*.5}px, ${X*e}px)`,a=s.logoBackgroundShape&&"none"!==s.logoBackgroundShape,o=parseInt(s.logoBackgroundBorderWidth||"0"),n=s.logoBackgroundHeight||120,i=(()=>{let{width:e}=J;return 0===e?3*X+48:e+48})(),c=e=>a?(J.height,(0,t.jsxs)("div",{className:"relative",style:{width:`${i}px`},children:[(0,t.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",style:{width:`${i}px`,height:`${n}px`,top:0,backgroundColor:`hsl(${s.logoBackgroundColor||"0 0% 100%"})`,borderRadius:"square"===s.logoBackgroundShape?"0":"pill"===s.logoBackgroundShape?`0 0 ${i/2}px ${i/2}px`:"0 0 16px 16px",boxShadow:o>0?`${o}px 0 0 0 hsl(${s.logoBackgroundBorderColor||"0 0% 90%"}), -${o}px 0 0 0 hsl(${s.logoBackgroundBorderColor||"0 0% 90%"}), 0 ${o}px 0 0 hsl(${s.logoBackgroundBorderColor||"0 0% 90%"})`:"none",filter:"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06))",clipPath:"inset(0 -20px -20px -20px)"}}),(0,t.jsx)("div",{className:"relative z-10 flex items-center justify-center",style:{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)"},children:e})]})):e;return c("text"===s.logoType?(0,t.jsx)(r.default,{ref:K,href:"/",className:"flex items-center",style:{height:e},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${G})`,fontSize:l(.5),lineHeight:e},children:s.logoText})}):"mark-text"===s.logoType?(0,t.jsxs)(r.default,{ref:K,href:"/",className:"flex items-center",style:{gap:`clamp(${.2*X*.6}px, ${.2*X*.04}vw + ${.2*X*.5}px, ${.2*X}px)`,height:e},children:[s.logoMarkUrl?(0,t.jsx)("img",{src:s.logoMarkUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:l(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:l(.8),width:l(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:l(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${G})`,fontSize:l(.4),lineHeight:e},children:s.logoText})]}):"full"===s.logoType&&s.logoUrl?(0,t.jsx)(r.default,{ref:K,href:"/",className:"flex items-center",style:{height:e},children:(0,t.jsx)("img",{src:s.logoUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:3*s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:e,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{ref:K,href:"/",className:"flex items-center",style:{height:e},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${G})`,fontSize:l(.5),lineHeight:e},children:s.logoText})}))},ee=()=>{switch(s.accountIcon){case"user-circle":return(0,t.jsx)(c,{className:"h-6 w-6"});case"person":return(0,t.jsx)(d.UserRound,{className:"h-6 w-6"});default:return(0,t.jsx)(i.User,{className:"h-6 w-6"})}},et=()=>{switch(s.cartIcon){case"shopping-bag":return(0,t.jsx)(a.ShoppingBag,{className:"h-6 w-6"});case"basket":return(0,t.jsx)(o,{className:"h-6 w-6"});default:return(0,t.jsx)(l.ShoppingCart,{className:"h-6 w-6"})}},er=s.logoBackgroundShape&&"none"!==s.logoBackgroundShape;return(0,t.jsxs)(t.Fragment,{children:[(C="small"===(w=s.mobileButtonSize||"medium")?"h-5 w-5":"large"===w?"h-7 w-7":"h-6 w-6",S=(k=s.logoBackgroundShape&&"none"!==s.logoBackgroundShape)?{paddingTop:"0.75rem",paddingBottom:"0.75rem"}:{},(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)("div",{className:"relative",style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`,overflow:k?"visible":void 0,zIndex:k?10:void 0},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"grid items-center",style:{gridTemplateColumns:"1fr auto 1fr",gap:"var(--ml-grid-gap, 1rem)",...k?{}:{paddingTop:"0.75rem",paddingBottom:"0.75rem"}},children:[(0,t.jsx)("div",{className:"flex justify-start items-center",style:S,children:s.showSearch&&(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(${G})`},"aria-label":"Search",onClick:v,children:(0,t.jsx)(u.Search,{className:C})})}),(0,t.jsx)("div",{className:`flex justify-center ${k?"self-start":""}`,children:($="same"!==s.mobileLogoType&&s.mobileLogoType?s.mobileLogoType:s.logoType,T=s.mobileLogoHeight||Math.round(.7*s.logoHeight),B=s.mobileLogoUrl||s.logoUrl,E=s.mobileLogoMarkUrl||s.logoMarkUrl,M=e=>`${T*e}
35px`,P=s.logoBackgroundShape&&"none"!==s.logoBackgroundShape,L=parseInt(s.logoBackgroundBorderWidth||"0"),I=s.mobileLogoBackgroundHeight||70,H=(()=>{if("full"===$)return 1.8*T+0;{if("mark-text"===$)return 2*T+0;let e=.3*T;return s.logoText.length*e+0}})(),(e=>P?(0,t.jsxs)("div",{className:"relative",style:{width:`${H}px`},children:[(0,t.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",style:{width:`${H}px`,height:`${I}px`,top:0,backgroundColor:`hsl(${s.logoBackgroundColor||"0 0% 100%"})`,borderRadius:(()=>{switch(s.logoBackgroundShape){case"square":return"0";case"pill":return`0 0 ${H/2}px ${H/2}px`;default:return"0 0 12px 12px"}})(),boxShadow:L>0?`${L}px 0 0 0 hsl(${s.logoBackgroundBorderColor||"0 0% 90%"}), -${L}px 0 0 0 hsl(${s.logoBackgroundBorderColor||"0 0% 90%"}), 0 ${L}px 0 0 hsl(${s.logoBackgroundBorderColor||"0 0% 90%"})`:"none",filter:"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06))",clipPath:"inset(0 -20px -20px -20px)"}}),(0,t.jsx)("div",{className:"relative z-10 flex items-center justify-center",style:{paddingTop:"0.5rem",paddingBottom:"0.5rem",paddingLeft:"0px",paddingRight:"0px"},children:e})]}):e)("text"===$?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${T}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${G})`,fontSize:M(.5),lineHeight:`${T}px`},children:s.logoText})}):"mark-text"===$?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center",style:{gap:`${.2*T}px`,height:`${T}px`},children:[E?(0,t.jsx)("img",{src:E,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:M(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:M(.8),width:M(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:M(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${G})`,fontSize:M(.4),lineHeight:`${T}px`},children:s.logoText})]}):"full"===$&&B?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${T}px`},children:(0,t.jsx)("img",{src:B,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:3*T,height:T,loading:"eager",style:{height:`${T}px`,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${T}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${G})`,fontSize:M(.5),lineHeight:`${T}px`},children:s.logoText})})))}),(0,t.jsxs)("div",{className:"flex justify-end items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)",...S},children:[s.showCart&&(0,t.jsx)("button",{onClick:_,className:"flex items-center justify-center transition-colors relative p-1",style:{color:`hsl(${G})`},"aria-label":"Cart",children:(0,t.jsxs)("div",{className:"relative",children:["shopping-bag"===s.cartIcon?(0,t.jsx)(a.ShoppingBag,{className:C}):"basket"===s.cartIcon?(0,t.jsx)(o,{className:C}):(0,t.jsx)(l.ShoppingCart,{className:C}),z&&R.itemCount>0&&(0,t.jsx)("span",{className:`absolute ${"small"===w?"h-4 w-4 text-[10px] -top-1.5 -right-1.5":"large"===w?"h-6 w-6 text-sm -top-2.5 -right-2.5":"h-5 w-5 text-xs -top-2 -right-2"} rounded-full flex items-center justify-center font-bold cart-badge`,style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:R.itemCount})]})}),(0,t.jsx)("button",{className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(${G})`},"aria-label":"Menu",onClick:f,children:(0,t.jsx)(n,{className:C})})]})]})})})})),(0,t.jsx)("div",{className:"hidden md:block relative",style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`,overflow:er?"visible":void 0,zIndex:er?10:void 0},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"}
35,children:(A=(D=s.logoBackgroundShape&&"none"!==s.logoBackgroundShape)?{}:{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)"},O=D?{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)"}:{},F=()=>D?(0,t.jsx)("div",{className:"flex justify-center relative",children:Q()}):(0,t.jsx)("div",{className:"flex justify-center",children:Q()}),"below"===s.navPosition?(0,t.jsxs)("div",{className:"hidden md:grid items-center",style:{gridTemplateColumns:"1fr auto 1fr",gap:"var(--ml-grid-gap, 1.5rem)",...A},children:[(0,t.jsx)("div",{className:"flex justify-start items-center",style:O,children:(()=>{if(!s.showSearch)return null;let r="collapsed"===s.searchStyle?"attached":s.searchStyle;return(0,t.jsx)("div",{className:"hidden md:block flex-1 max-w-xs",children:(0,t.jsx)(ew,{tenant:e,searchStyle:r,buttonColor:s.searchButtonColor,placeholder:s.searchPlaceholder,icon:s.searchIcon,buttonMode:s.searchButtonMode,buttonText:s.searchButtonText,borderColor:s.searchBorderColor,useOverlay:!0,onOpen:v})})})()}),(0,t.jsx)("div",{className:D?"self-start":"",children:F()}),(0,t.jsx)("div",{className:"flex justify-end items-center",style:O,children:(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[(0,t.jsx)(j,{variant:"icon",foregroundColor:G,showLabels:s.actionButtonsShowLabels,className:"hidden md:flex",showDelivery:s.locationShowDelivery,showPickup:s.locationShowPickup}
35),s.showAccount&&(W?(0,t.jsx)("div",{className:"hidden md:flex items-center",children:(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-muted animate-pulse"})}):V?(0,t.jsxs)(r.default,{href:"/account",className:"hidden md:flex flex-col items-center transition-colors hover:opacity-80",style:{color:`hsl(${G})`},"aria-label":"Account",children:[ee(),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:V.firstName||V.email.split("@")[0]})]}):(0,t.jsxs)("button",{onClick:y,className:"hidden md:flex flex-col items-center transition-colors hover:opacity-80",style:{color:`hsl(${G})`},"aria-label":"Sign In",children:[ee(),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Sign In"})]})),s.showCart&&(0,t.jsxs)("button",{onClick:_,className:"flex flex-col items-center justify-center transition-colors hover:opacity-80 relative",style:{color:`hsl(${G})`},"aria-label":"Cart",children:[(0,t.jsxs)("div",{className:"relative",children:[et(),z&&R.itemCount>0&&(0,t.jsx)("span",{className:"absolute -top-2 -right-2 h-5 w-5 rounded-full text-xs flex items-center justify-center font-bold cart-badge",style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:R.itemCount})]}),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Cart"})]}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"md:hidden",style:{color:`hsl(${G})`},"aria-label":"Menu",onClick:f,children:(0,t.jsx)(n,{className:"h-6 w-6"})})]})})]}):(0,t.jsxs)("div",{className:"hidden md:grid items-center",style:{gridTemplateColumns:"1fr auto 1fr",gap:"var(--ml-grid-gap, 1.5rem)",...A},children:[(0,t.jsx)("div",{className:"flex justify-start items-center",style:O,children:(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[(0,t.jsxs)("button",{onClick:f,className:"hidden md:flex items-center gap-2 transition-colors hover:opacity-80",style:{color:`hsl(${G})`},children:[(0,t.jsx)(n,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium uppercase tracking-wide",children:Y})]}),s.showSearch&&(0,t.jsx)("div",{className:"hidden md:block",children:(0,t.jsx)(ew,{tenant:e,searchStyle:s.searchStyle,buttonColor:s.searchButtonColor,placeholder:s.searchPlaceholder,icon:s.searchIcon,buttonMode:s.searchButtonMode,buttonText:s.searchButtonText,borderColor:s.searchBorderColor,useOverlay:!0,onOpen:v})})]})}),(0,t.jsx)("div",{className:D?"self-start":"",children:F()}),(0,t.jsx)("div",{className:"flex justify-end items-center",style:O,children:(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[(0,t.jsx)(j,{variant:"icon",foregroundColor:G,showLabels:s.actionButtonsShowLabels,className:"hidden md:flex",showDelivery:s.locationShowDelivery,showPickup:s.locationShowPickup}
35),s.showAccount&&(W?(0,t.jsx)("div",{className:"hidden md:flex items-center",children:(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-muted animate-pulse"})}):V?(0,t.jsxs)(r.default,{href:"/account",className:"hidden md:flex flex-col items-center transition-colors hover:opacity-80",style:{color:`hsl(${G})`},"aria-label":"Account",children:[ee(),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:V.firstName||V.email.split("@")[0]})]}):(0,t.jsxs)("button",{onClick:y,className:"hidden md:flex flex-col items-center transition-colors hover:opacity-80",style:{color:`hsl(${G})`},"aria-label":"Sign In",children:[ee(),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Sign In"})]})),s.showSearch&&(0,t.jsx)("button",{className:"md:hidden flex items-center justify-center transition-colors",style:{color:`hsl(${G})`},"aria-label":"Search",children:(0,t.jsx)(u.Search,{className:"h-6 w-6"})}),s.showCart&&(0,t.jsxs)("button",{onClick:_,className:"flex flex-col items-center justify-center transition-colors hover:opacity-80 relative",style:{color:`hsl(${G})`},"aria-label":"Cart",children:[(0,t.jsxs)("div",{className:"relative",children:[et(),z&&R.itemCount>0&&(0,t.jsx)("span",{className:"absolute -top-2 -right-2 h-5 w-5 rounded-full text-xs flex items-center justify-center font-bold cart-badge",style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:R.itemCount})]}),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-xs mt-1",children:"Cart"})]}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"md:hidden",style:{color:`hsl(${G})`},"aria-label":"Menu",onClick:f,children:(0,t.jsx)(n,{className:"h-6 w-6"})})]})})]}))})}),"below"===s.navPosition&&(U=({left:"justify-start",center:"justify-center",right:"justify-end"})[s.navigationAlignment||"center"],(0,t.jsx)("div",{className:"hidden md:block",style:{backgroundColor:`hsl(var(--logo-center-navigation-color, ${s.navigationColor||s.headerColor}))`},children:(0,t.jsx)("div",{className:`mx-auto px-4 flex items-center ${U}`,style:{maxWidth:"var(--ml-content-width, 1536px)",paddingTop:"0.75rem",paddingBottom:"0.75rem"},children:(0,t.jsx)(eT,{tenant:e,navigation:x,textColor:s.navigationTextColor,hoverColor:s.navigationHoverColor,hoverStyle:s.navigationHoverStyle,menuStyle:s.navigationMenuStyle,drawerChevron:s.navigationDrawerChevron,onOpenDrawer:b,backgroundColor:s.navigationColor})})}))]})}function eM({tenant:e,config:s,navigation:h,onOpenMobileMenu:x,onOpenSearch:f,onOpenLoginDialog:b}){let v,y,w,N,C,k,S,$,T,{cart:B,isInitialized:E}=(0,m.useCart)(),{user:M,loading:P}=(0,g.useAuth)(),{openMiniCart:L}=(0,p.useMiniCart)(),I=function(e){let t=e.replace(/%/g,"").split(/\s+/).map(Number);if(t.length<3)return"0 0% 100%";let{r,g:l,b:a}=(0,q.hslToRgb)(t[0],t[1],t[2]),s=(0,q.getRelativeLuminance)(r,l,a);return"white"===(0,q.getBestContrastText)(s)?"0 0% 100%":"0 0% 10%"}(s.headerColor),H="medium"===s.searchWidth?"w-[400px] max-w-[50%]":"full"===s.searchWidth?"flex-1":"w-[600px] max-w-[65%]",D=()=>{switch(s.accountIcon){case"user-circle":return(0,t.jsx)(c,{className:"h-5 w-5"});case"person":return(0,t.jsx)(d.UserRound,{className:"h-5 w-5"});default:return(0,t.jsx)(i.User,{className:"h-5 w-5"})}},A=s.searchAlignment||"left",O="full"===s.searchWidth;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)("div",{style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center justify-between",style:{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[(v="same"!==s.mobileLogoType&&s.mobileLogoType?s.mobileLogoType:s.logoType,y=s.mobileLogoHeight||Math.round(.7*s.logoHeight),w=s.mobileLogoUrl||s.logoUrl,N=s.mobileLogoMarkUrl||s.logoMarkUrl,C=e=>`${y*e}px`,"text"===v?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${y}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${I})`,fontSize:C(.5),lineHeight:`${y}px`},children:s.logoText})}):"mark-text"===v?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center",style:{gap:`${.2*y}px`,height:`${y}px`},children:[N?(0,t.jsx)("img",{src:N,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:y,height:y,loading:"eager",style:{height:C(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:C(.8),width:C(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:C(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${I})`,fontSize:C(.4),lineHeight:`${y}px`},children:s.logoText})]}):"full"===v&&w?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${y}px`},children:(0,t.jsx)("img",{src:w,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:3*y,height:y,loading:"eager",style:{height:`${y}px`,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${y}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${I})`,fontSize:C(.5),lineHeight:`${y}px`},children:s.logoText})})),(S="small"===(k=s.mobileButtonSize||"medium")?"h-5 w-5":"large"===k?"h-7 w-7":"h-6 w-6",(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[s.showSearch&&(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(${I})`},"aria-label":"Search",onClick:f,children:(0,t.jsx)(u.Search,{className:S})}),s.showCart&&(0,t.jsx)("button",{onClick:L,className:"flex items-center justify-center transition-colors relative p-1",style:{color:`hsl(${I})`},"aria-label":"Cart",children:(0,t.jsxs)("div",{className:"relative",children:["shopping-bag"===s.cartIcon?(0,t.jsx)(a.ShoppingBag,{className:S}):"basket"===s.cartIcon?(0,t.jsx)(o,{className:S}):(0,t.jsx)(l.ShoppingCart,{className:S}),E&&B.itemCount>0&&(0,t.jsx)("span",{className:`absolute ${"small"===k?"h-4 w-4 text-[10px] -top-1.5 -right-1.5":"large"===k?"h-6 w-6 text-sm -top-2.5 -right-2.5":"h-5 w-5 text-xs -top-2 -right-2"} rounded-full flex items-center justify-center font-bold cart-badge`,style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:B.itemCount})]})}),(0,t.jsx)("button",{className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(${I})`},"aria-label":"Menu",onClick:x,children:(0,t.jsx)(n,{className:S})})]}))]})})})}),(0,t.jsx)("div",{className:"hidden md:block",style:{backgroundColor:`hsl(var(--header-bg, ${s.headerColor}))`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center",style:{paddingTop:"var(--ml-header-padding-y, 1.35rem)",paddingBottom:"var(--ml-header-padding-y, 1.35rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[(0,t.jsx)("div",{className:"shrink-0",children:($=`clamp(${.6*s.logoHeight}px, ${.04*s.logoHeight}vw + ${.5*s.logoHeight}px, ${s.logoHeight}px)`,T=e=>`clamp(${s.logoHeight*e*.6}px, ${s.logoHeight*e*.04}vw + ${s.logoHeight*e*.5}px, ${s.logoHeight*e}px)`,"text"===s.logoType?(0,t.jsx)(r.default,{href:"/",className:"flex items-center shrink-0",style:{height:$},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${I})`,fontSize:T(.5),lineHeight:$},children:s.logoText})}):"mark-text"===s.logoType?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center shrink-0",style:{gap:`clamp(${.2*s.logoHeight*.6}
35px, ${.2*s.logoHeight*.04}vw + ${.2*s.logoHeight*.5}px, ${.2*s.logoHeight}px)`,height:$},children:[s.logoMarkUrl?(0,t.jsx)("img",{src:s.logoMarkUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:T(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:T(.8),width:T(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:T(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap hidden sm:block",style:{color:`hsl(${I})`,fontSize:T(.4),lineHeight:$},children:s.logoText})]}):"full"===s.logoType&&s.logoUrl?(0,t.jsx)(r.default,{href:"/",className:"flex items-center shrink-0",style:{height:$},children:(0,t.jsx)("img",{src:s.logoUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:3*s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:$,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center shrink-0",style:{height:$},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(${I})`,fontSize:T(.5),lineHeight:$},children:s.logoText})}))}),!O&&"left"!==A&&(0,t.jsx)("div",{className:"flex-1"}),s.showSearch?(0,t.jsx)("div",{className:`${H}`,children:(0,t.jsx)(ew,{tenant:e,searchStyle:s.searchStyle,buttonColor:s.searchButtonColor,placeholder:s.searchPlaceholder,icon:s.searchIcon,buttonMode:s.searchButtonMode,buttonText:s.searchButtonText,borderColor:s.searchBorderColor,useOverlay:!0,onOpen:f})}):null,!O&&"right"!==A&&(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center shrink-0",style:{gap:"calc(var(--ml-grid-gap) / 1.5)"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>x?.(),className:"flex items-center gap-1.5 transition-colors hover:opacity-80",style:{color:`hsl(${I})`},"aria-label":"Open menu",children:(()=>{switch(s.hamburgerStyle){case"text":return(0,t.jsx)("span",{className:"text-sm font-medium",children:"Menu"});case"icon-text":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Menu"})]});default:return(0,t.jsx)(n,{className:"h-5 w-5"})}})()}),(0,t.jsx)(j,{variant:"icon",foregroundColor:I,showBackground:!1,showDelivery:s.locationShowDelivery,showPickup:s.locationShowPickup}
35),s.showAccount&&(P?(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-muted animate-pulse"}):M?(0,t.jsx)(r.default,{href:"/account",className:"flex items-center transition-colors hover:opacity-80",style:{color:`hsl(${I})`},"aria-label":"Account",children:D()}):(0,t.jsx)("button",{onClick:b,className:"flex items-center transition-colors hover:opacity-80",style:{color:`hsl(${I})`},"aria-label":"Sign in",children:D()})),s.showCart&&(0,t.jsx)("button",{onClick:L,className:"flex items-center justify-center transition-colors hover:opacity-80 relative",style:{color:`hsl(${I})`},"aria-label":"Cart",children:(0,t.jsxs)("div",{className:"relative",children:[(()=>{switch(s.cartIcon){case"shopping-bag":return(0,t.jsx)(a.ShoppingBag,{className:"h-5 w-5"});case"basket":return(0,t.jsx)(o,{className:"h-5 w-5"});default:return(0,t.jsx)(l.ShoppingCart,{className:"h-5 w-5"})}})(),E&&B.itemCount>0&&(0,t.jsx)("span",{className:"absolute -top-1.5 -right-1.5 h-4 w-4 rounded-full text-[10px] flex items-center justify-center font-bold",style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:B.itemCount})]})})]})]})})})]})}function eP(e){let t=e.replace(/%/g,"").split(/\s+/).map(Number);if(t.length<3)return"0 0% 100%";let{r,g:l,b:a}=(0,q.hslToRgb)(t[0],t[1],t[2]),s=(0,q.getRelativeLuminance)(r,l,a);return"white"===(0,q.getBestContrastText)(s)?"0 0% 100%":"0 0% 10%"}function eL({tenant:e,config:s,navigation:h,onOpenMobileMenu:x,onOpenNavDrawerSection:f,onOpenLoginDialog:b,onOpenSearch:v}){let y,w,C,k,S,$,T,B,E,M,P,L,I,{cart:H,isInitialized:D}=(0,m.useCart)(),{user:A,loading:O}=(0,g.useAuth)(),{openMiniCart:F}=(0,p.useMiniCart)(),[U,R]=(0,N.useState)(null),[z,V]=(0,N.useState)(null),[W,_]=(0,N.useState)(null),[G,X]=(0,N.useState)("220 70% 50%"),[Y,K]=(0,N.useState)(null),[J,Z]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--double-bar-utility-text-color").trim(),r=e.getPropertyValue("--double-bar-utility-hover-color").trim(),l=e.getPropertyValue("--accent").trim(),a=e.getPropertyValue("--header-foreground").trim(),s=e.getPropertyValue("--header-bg").trim(),o=e.getPropertyValue("--double-bar-utility-menu-handle").trim().replace(/^["']|["']$/g,"");t&&R(t),r&&V(r),l&&X(l),a&&K(a),s&&Z(s),_(o||null)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("theme-applied",e),()=>{t.disconnect(),window.removeEventListener("theme-applied",e)}},[]);let Q=W||s.utilityMenuHandle,ee=Q?function(e,t){if(e)return e.menus.find(e=>e.handle===t)}(h,Q):void 0,et=eP(s.utilityBarColor),er=eP(s.mainBarColor||s.headerColor),el=(0,N.useMemo)(()=>{if(!U||"auto"===U){let e=s.utilityBarColor||"0 0% 96%",t=(0,q.getTextColor)("auto",e);return t?.startsWith("hsl(")?t.slice(4,-1):et}return U},[U,s.utilityBarColor,et]),ea=(0,N.useMemo)(()=>z&&"auto"!==z?z:G,[z,G]),es=J||s.mainBarColor||s.headerColor,eo="narrow"===s.searchWidth?"250px":"wide"===s.searchWidth?"450px":"350px",en=(e="h-4 w-4")=>{switch(s.accountIcon){case"user-circle":return(0,t.jsx)(c,{className:e});case"person":return(0,t.jsx)(d.UserRound,{className:e});default:return(0,t.jsx)(i.User,{className:e})}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"md:hidden",children:[(y=eP(s.utilityBarColor),w=ee?.items?[...ee.items].filter(e=>!e.parentId).sort((e,t)=>e.order-t.order).slice(0,3):[],(0,t.jsx)("div",{style:{backgroundColor:`hsl(var(--double-bar-utility-color, ${s.utilityBarColor}))`,color:`hsl(${y})`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center justify-between py-1.5 text-xs",children:[w.length>0?(0,t.jsx)("div",{className:"flex items-center gap-3 overflow-x-auto scrollbar-hide",children:w.map(e=>(0,t.jsx)(r.default,{href:e$(e),className:"hover:opacity-80 whitespace-nowrap",target:e.openInNewTab?"_blank":void 0,rel:e.openInNewTab?"noopener noreferrer":void 0,children:e.label},e.id))}):(0,t.jsx)(j,{variant:"compact",foregroundColor:y,guestOnly:!1,showDelivery:s.locationShowDelivery,showPickup:s.locationShowPickup}
35),O||A?A?(0,t.jsxs)(r.default,{href:"/account",className:"flex items-center gap-1 hover:opacity-80",children:[en("h-3.5 w-3.5"),(0,t.jsxs)("span",{children:["Hi, ",A.firstName||"there"]})]}):null:(0,t.jsxs)("button",{onClick:b,className:"flex items-center gap-1 hover:opacity-80",children:[en("h-3.5 w-3.5"),(0,t.jsx)("span",{children:"Sign In"})]})]})})})),(0,t.jsx)("div",{style:{backgroundColor:`hsl(var(--header-bg, ${es}))`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center justify-between",style:{paddingTop:"var(--ml-header-padding-y, 1rem)",paddingBottom:"var(--ml-header-padding-y, 1rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[(C="same"!==s.mobileLogoType&&s.mobileLogoType?s.mobileLogoType:s.logoType,k=s.mobileLogoHeight||Math.round(.7*s.logoHeight),S=s.mobileLogoUrl||s.logoUrl,$=s.mobileLogoMarkUrl||s.logoMarkUrl,T=e=>`${k*e}px`,"text"===C?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${k}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(var(--header-foreground, ${er}))`,fontSize:T(.5),lineHeight:`${k}px`},children:s.logoText})}):"mark-text"===C?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center",style:{gap:`${.2*k}px`,height:`${k}px`},children:[$?(0,t.jsx)("img",{src:$,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:k,height:k,loading:"eager",style:{height:T(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:T(.8),width:T(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:T(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(var(--header-foreground, ${er}))`,fontSize:T(.4),lineHeight:`${k}px`},children:s.logoText})]}):"full"===C&&S?(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${k}px`},children:(0,t.jsx)("img",{src:S,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:3*k,height:k,loading:"eager",style:{height:`${k}px`,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center",style:{height:`${k}px`},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(var(--header-foreground, ${er}))`,fontSize:T(.5),lineHeight:`${k}px`},children:s.logoText})})),(E="small"===(B=s.mobileButtonSize||"medium")?"h-5 w-5":"large"===B?"h-7 w-7":"h-6 w-6",(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"calc(var(--ml-grid-gap) / 2)"},children:[s.showSearch&&(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(var(--header-foreground, ${er}))`},"aria-label":"Search",onClick:v,children:(0,t.jsx)(u.Search,{className:E})}),s.showCart&&(0,t.jsx)("button",{onClick:F,className:"flex items-center justify-center transition-colors relative p-1",style:{color:`hsl(var(--header-foreground, ${er}))`},"aria-label":"Cart",children:(0,t.jsxs)("div",{className:"relative",children:["shopping-bag"===s.cartIcon?(0,t.jsx)(a.ShoppingBag,{className:E}):"basket"===s.cartIcon?(0,t.jsx)(o,{className:E}):(0,t.jsx)(l.ShoppingCart,{className:E}),D&&H.itemCount>0&&(0,t.jsx)("span",{className:`absolute ${"small"===B?"h-4 w-4 text-[10px] -top-1.5 -right-1.5":"large"===B?"h-6 w-6 text-sm -top-2.5 -right-2.5":"h-5 w-5 text-xs -top-2 -right-2"} rounded-full flex items-center justify-center font-bold cart-badge`,style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:H.itemCount})]})}),(0,t.jsx)("button",{className:"flex items-center justify-center transition-colors p-1",style:{color:`hsl(var(--header-foreground, ${er}))`},"aria-label":"Menu",onClick:x,children:(0,t.jsx)(n,{className:E})})]}))]})})})]}),(M=ee?.items?[...ee.items].filter(e=>!e.parentId).sort((e,t)=>e.order-t.order):[],P={"--utility-text-color":`hsl(${el})`,"--utility-hover-color":`hsl(${ea})`,color:`hsl(${el})`},(0,t.jsxs)("div",{className:"hidden md:block",style:{backgroundColor:`hsl(var(--double-bar-utility-color, ${s.utilityBarColor}))`,backfaceVisibility:"hidden"},children:[(0,t.jsx)("style",{children:`
36          .utility-link:hover {
37            color: var(--utility-hover-color) !important;
38          }
39        `}),(0,t.jsxs)("div",{className:"mx-auto px-4 flex items-center justify-end",style:{maxWidth:"var(--ml-content-width, 1536px)",height:"36px",gap:"var(--ml-grid-gap, 1.5rem)"},children:[M.map(e=>(0,t.jsx)(r.default,{href:e$(e),className:"utility-link flex items-center gap-1.5 text-xs transition-colors",style:P,target:e.openInNewTab?"_blank":void 0,rel:e.openInNewTab?"noopener noreferrer":void 0,children:(0,t.jsx)("span",{children:e.label})},e.id)),M.length>0&&(0,t.jsx)("span",{className:"text-xs opacity-40",style:{color:`hsl(${el})`},children:"|"}),O?(0,t.jsx)("div",{className:"w-16 h-4 bg-muted animate-pulse rounded"}):A?(0,t.jsxs)(r.default,{href:"/account",className:"utility-link flex items-center gap-1.5 text-xs transition-colors",style:P,children:[en(),(0,t.jsxs)("span",{children:["Hi, ",A.firstName||A.email.split("@")[0]]})]}):(0,t.jsxs)("button",{onClick:b,className:"utility-link flex items-center gap-1.5 text-xs transition-colors",style:P,children:[en(),(0,t.jsx)("span",{children:"Sign In / Register"})]}),(0,t.jsx)(j,{variant:"compact",foregroundColor:el,guestOnly:!1,showDelivery:s.locationShowDelivery,showPickup:s.locationShowPickup,className:"utility-link"})]})]})),(0,t.jsx)("div",{className:"hidden md:block",style:{backgroundColor:`hsl(var(--header-bg, ${es}))`},children:(0,t.jsx)("div",{className:"mx-auto px-4",style:{maxWidth:"var(--ml-content-width, 1536px)"},children:(0,t.jsxs)("div",{className:"flex items-center",style:{paddingTop:"var(--ml-header-padding-y, 1rem)",paddingBottom:"var(--ml-header-padding-y, 1rem)",gap:"var(--ml-grid-gap, 1.5rem)"},children:[(L=`clamp(${.6*s.logoHeight}px, ${.04*s.logoHeight}vw + ${.5*s.logoHeight}px, ${s.logoHeight}px)`,I=e=>`clamp(${s.logoHeight*e*.6}px, ${s.logoHeight*e*.04}vw + ${s.logoHeight*e*.5}px, ${s.logoHeight*e}px)`,"text"===s.logoType?(0,t.jsx)(r.default,{href:"/",className:"flex items-center shrink-0",style:{height:L},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(var(--header-foreground, ${er}))`,fontSize:I(.5),lineHeight:L},children:s.logoText})}):"mark-text"===s.logoType?(0,t.jsxs)(r.default,{href:"/",className:"flex items-center shrink-0",style:{gap:`clamp(${.2*s.logoHeight*.6}
39px, ${.2*s.logoHeight*.04}vw + ${.2*s.logoHeight*.5}px, ${.2*s.logoHeight}px)`,height:L},children:[s.logoMarkUrl?(0,t.jsx)("img",{src:s.logoMarkUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:I(.8),width:"auto",objectFit:"contain"}}):(0,t.jsx)("div",{className:"bg-primary rounded flex items-center justify-center",style:{height:I(.8),width:I(.8)},children:(0,t.jsx)("span",{className:"text-primary-foreground font-bold",style:{fontSize:I(.4)},children:s.logoText.charAt(0)})}),(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(var(--header-foreground, ${er}))`,fontSize:I(.4),lineHeight:L},children:s.logoText})]}):"full"===s.logoType&&s.logoUrl?(0,t.jsx)(r.default,{href:"/",className:"flex items-center shrink-0",style:{height:L},children:(0,t.jsx)("img",{src:s.logoUrl,alt:`${s.logoText} logo`,title:`${s.logoText} logo`,width:3*s.logoHeight,height:s.logoHeight,loading:"eager",style:{height:L,width:"auto",objectFit:"contain"}})}):(0,t.jsx)(r.default,{href:"/",className:"flex items-center shrink-0",style:{height:L},children:(0,t.jsx)("span",{className:"font-bold tracking-tight whitespace-nowrap",style:{color:`hsl(var(--header-foreground, ${er}))`,fontSize:I(.5),lineHeight:L},children:s.logoText})})),(0,t.jsx)("div",{className:"flex-1 min-w-0",style:{color:`hsl(var(--header-foreground, ${er}))`},children:(0,t.jsx)(eT,{tenant:e,navigation:h,textColor:s.navigationTextColor,hoverColor:s.navigationHoverColor,hoverStyle:s.navigationHoverStyle,menuStyle:s.navigationMenuStyle,drawerChevron:s.navigationDrawerChevron,onOpenDrawer:f,backgroundColor:es})}),s.showSearch&&(0,t.jsx)("div",{className:"shrink min-w-[180px]",style:{maxWidth:eo},children:(0,t.jsx)(ew,{tenant:e,searchStyle:s.searchStyle,buttonColor:s.searchButtonColor,placeholder:s.searchPlaceholder,icon:s.searchIcon,buttonMode:s.searchButtonMode,buttonText:s.searchButtonText,borderColor:s.searchBorderColor,useOverlay:!0,onOpen:v})}),s.showCart&&(0,t.jsxs)("button",{onClick:F,className:"flex items-center gap-2 transition-colors hover:opacity-80 shrink-0",style:{color:`hsl(var(--header-foreground, ${er}))`},"aria-label":"Cart",children:[(0,t.jsxs)("div",{className:"relative",children:[(()=>{switch(s.cartIcon){case"shopping-bag":return(0,t.jsx)(a.ShoppingBag,{className:"h-5 w-5"});case"basket":return(0,t.jsx)(o,{className:"h-5 w-5"});default:return(0,t.jsx)(l.ShoppingCart,{className:"h-5 w-5"})}})(),D&&H.itemCount>0&&(0,t.jsx)("span",{className:"absolute -top-1.5 -right-1.5 h-4 w-4 rounded-full text-[10px] flex items-center justify-center font-bold",style:{backgroundColor:"var(--cart-badge-bg, hsl(var(--accent)))",color:"var(--cart-badge-fg, hsl(var(--accent-foreground)))"},children:H.itemCount})]}),s.actionButtonsShowLabels&&(0,t.jsx)("span",{className:"text-sm font-medium",children:"Cart"})]})]})})})]})}e.s(["buildNavigationTree",0,eS,"getNavItemUrl",0,e$],77689);let eI={headerColor:"0 0% 100%",logoType:"text",logoText:"Shop",logoHeight:40,showSearch:!0,showCart:!0,showAccount:!0,searchStyle:"attached",searchButtonColor:"200 100% 11%",searchPlaceholder:"Search products...",searchIcon:"search",searchButtonMode:"icon",searchButtonText:"Search",searchBorderColor:"0 0% 90%",actionButtonsShowLabels:!0,accountIcon:"user",cartIcon:"shopping-cart"};function eH(e){let t={...eI};for(let[r,l]of Object.entries(e))void 0!==l&&r in eI&&(t[r]=l);return t.logoUrl=e.logoUrl,t.logoMarkUrl=e.logoMarkUrl,t.cartBadgeColor=e.cartBadgeColor,t.mobileLogoType=e.mobileLogoType,t.mobileLogoHeight=e.mobileLogoHeight,t.mobileLogoUrl=e.mobileLogoUrl,t.mobileLogoMarkUrl=e.mobileLogoMarkUrl,t.mobileButtonSize=e.mobileButtonSize,t.navigationTextColor=e.navigationTextColor,t.navigationHoverColor=e.navigationHoverColor,t.navigationHoverStyle=e.navigationHoverStyle,t.navigationMenuStyle=e.navigationMenuStyle,t.navigationDrawerChevron=e.navigationDrawerChevron,t.locationShowDelivery=e.locationShowDelivery,t.locationShowPickup=e.locationShowPickup,t}function eD(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||void 0}function eA(e){let t=eD(e);return t?.replace(/^["']|["']$/g,"")||void 0}function eO(e){let t=eD(e);if(!t)return;let r=parseInt(t.replace("px",""),10);return isNaN(r)?void 0:r}function eF({tenant:e,layoutType:r,config:l,navigation:a,onOpenMobileMenu:s,onOpenNavDrawerSection:o,onOpenLoginDialog:n,onOpenSearch:i}){let[c,d]=(0,N.useState)(r),[u,h]=(0,N.useState)({});(0,N.useEffect)(()=>{d(r)},[r]),(0,N.useEffect)(()=>{let e=()=>{let e,t,r,l,a,s,o,n,i,c,u,m,g,p,x,f,b,v,y,j,w,N,C,k,S,$,T,B,E,M,P,L,I,H,D,A,O,F,U,R,z,V,W,q,_,G,X,Y,K,J,Z,Q,ee,et,er,el,ea,es,eo=eD("--header-layout-type");("classic-left"===eo||"logo-center"===eo||"minimal"===eo||"double-bar"===eo)&&d(eo),h((e={},("full"===(t=eD("--logo-type"))||"mark-text"===t||"text"===t)&&(e.logoType=t),(r=eA("--logo-text"))&&(e.logoText=r),void 0!==(l=eO("--logo-height"))&&(e.logoHeight=l),(a=eA("--logo-url"))&&(e.logoUrl=a),(s=eA("--logo-mark-url"))&&(e.logoMarkUrl=s),("same"===(o=eD("--mobile-logo-type"))||"full"===o||"mark-text"===o||"text"===o)&&(e.mobileLogoType=o),void 0!==(n=eO("--mobile-logo-height"))&&(e.mobileLogoHeight=n),(i=eA("--mobile-logo-url"))&&(e.mobileLogoUrl=i),(c=eA("--mobile-logo-mark-url"))&&(e.mobileLogoMarkUrl=c),("small"===(u=eD("--mobile-button-size"))||"medium"===u||"large"===u)&&(e.mobileButtonSize=u),(m=eD("--header-bg"))&&(e.headerColor=m),("below"===(g=eD("--nav-position"))||"inline"===g)&&(e.navPosition=g),("narrow"===(p=eD("--search-width"))||"medium"===p||"wide"===p||"full"===p)&&(e.searchWidth=p),("left"===(x=eD("--search-bar-position"))||"center"===x||"right"===x)&&(e.searchBarPosition=x),("left"===(f=eD("--search-alignment"))||"center"===f||"right"===f)&&(e.searchAlignment=f),("attached"===(b=eD("--search-style"))||"detached"===b||"collapsed"===b)&&(e.searchStyle=b),(v=eD("--search-button-color"))&&(e.searchButtonColor=v),(y=eA("--search-placeholder"))&&(e.searchPlaceholder=y),("search"===(j=eD("--search-icon"))||"arrow-right"===j||"sparkles"===j)&&(e.searchIcon=j),("icon"===(w=eD("--search-button-mode"))||"icon-text"===w||"text"===w)&&(e.searchButtonMode=w),(N=eA("--search-button-text"))&&(e.searchButtonText=N),(C=eD("--search-border-color"))&&(e.searchBorderColor=C),("inline"===(k=eD("--logo-center-nav-position"))||"below"===k)&&(e.logoCenterNavPosition=k),("compact"===(S=eD("--nav-spacing"))||"normal"===S||"spread"===S)&&(e.navSpacing=S),("none"===($=eD("--logo-background-shape"))||"square"===$||"rounded"===$||"pill"===$)&&(e.logoBackgroun
39dShape=$),(T=eD("--logo-background-color"))&&(e.logoBackgroundColor=T),(B=eD("--logo-background-border-color"))&&(e.logoBackgroundBorderColor=B),("0"===(E=eD("--logo-background-border-width"))||"1"===E||"2"===E||"3"===E)&&(e.logoBackgroundBorderWidth=E),void 0!==(M=eO("--logo-background-height"))&&(e.logoBackgroundHeight=M),void 0!==(P=eO("--mobile-logo-background-height"))&&(e.mobileLogoBackgroundHeight=P),("left"===(L=eD("--logo-center-navigation-alignment"))||"center"===L||"right"===L)&&(e.logoCenterNavigationAlignment=L),(I=eD("--logo-center-navigation-color"))&&(e.logoCenterNavigationColor=I),(H=eA("--hamburger-text"))&&(e.hamburgerText=H),("icon"===(D=eD("--hamburger-style"))||"text"===D||"icon-text"===D)&&(e.hamburgerStyle=D),(A=eD("--double-bar-utility-color"))&&(e.utilityBarColor=A),(O=eD("--main-bar-color"))&&(e.mainBarColor=O),(F=eA("--double-bar-utility-menu-handle")||eA("--utility-menu-handle"))&&(e.utilityMenuHandle=F),(U=eD("--nav-color"))&&(e.navigationColor=U),("page"===(R=eD("--navigation-top-border-width"))||"full"===R)&&(e.navigationTopBorderWidth=R),("left"===(z=eD("--navigation-alignment"))||"center"===z)&&(e.navigationAlignment=z),("true"===(V=eD("--navigation-top-border"))||"false"===V)&&(e.navigationTopBorder="true"===V),(W=eD("--navigation-top-border-color"))&&(e.navigationTopBorderColor=W),("1"===(q=eD("--navigation-top-border-thickness"))||"2"===q||"3"===q)&&(e.navigationTopBorderThickness=q),("text"===(_=eD("--nav-hover-style"))||"badge"===_||"underline"===_)&&(e.navigationHoverStyle=_),(G=eD("--nav-text-color"))&&(e.navigationTextColor=G),(X=eD("--nav-hover-color"))&&(e.navigationHoverColor=X),("mega"===(Y=eD("--nav-menu-style"))||"drawer"===Y)&&(e.navigationMenuStyle=Y),("right"===(K=eD("--nav-drawer-chevron"))||"down"===K||"none"===K)&&(e.navigationDrawerChevron=K),("flex"===(J=eD("--show-search"))||"none"===J)&&(e.showSearch="flex"===J),("flex"===(Z=eD("--show-cart"))||"none"===Z)&&(e.showCart="flex"===Z),("flex"===(Q=eD("--show-account"))||"none"===Q)&&(e.showAccount="flex"===Q),("true"===(ee=eD("--action-buttons-show-labels"))||"false"===ee)&&(e.actionButtonsShowLabels="true"===ee),("user"===(et=eD("--account-icon"))||"user-circle"===et||"person"===et)&&(e.accountIcon=et),("shopping-cart"===(er=eD("--cart-icon"))||"shopping-bag"===er||"basket"===er)&&(e.cartIcon=er),(el=eD("--cart-badge-color"))&&(e.cartBadgeColor=el),("show"===(ea=eD("--location-show-delivery"))||"hide"===ea)&&(e.locationShowDelivery="show"===ea),("show"===(es=eD("--location-show-pickup"))||"hide"===es)&&(e.locationShowPickup="show"===es),e))};return window.addEventListener("theme-applied",e),e(),()=>window.removeEventListener("theme-applied",e)},[]);let m={...l,...u};switch(c){case"classic-left":default:return(0,t.jsx)(eB,{tenant:e,config:{...eH(m),navPosition:m.navPosition??"below",searchWidth:m.searchWidth??"wide",searchBarPosition:m.searchBarPosition??"center",navigationAlignment:m.navigationAlignment??"left",navigationTopBorder:m.n
39avigationTopBorder??!0,navigationTopBorderColor:m.navigationTopBorderColor??"0 0% 90%",navigationTopBorderThickness:m.navigationTopBorderThickness??"1",navigationTopBorderWidth:m.navigationTopBorderWidth??"page",navigationColor:m.navigationColor??"0 0% 100%"},navigation:a,onOpenMobileMenu:s,onOpenNavDrawerSection:o,onOpenLoginDialog:n,onOpenSearch:i});case"logo-center":return(0,t.jsx)(eE,{tenant:e,config:{...eH(m),navPosition:m.logoCenterNavPosition??"inline",navigationAlignment:m.logoCenterNavigationAlignment??"center",navigationColor:m.logoCenterNavigationColor??m.navigationColor??m.headerColor??"0 0% 100%",hamburgerText:m.hamburgerText??"Shop",logoBackgroundShape:m.logoBackgroundShape??"none",logoBackgroundColor:m.logoBackgroundColor??"0 0% 100%",logoBackgroundBorderColor:m.logoBackgroundBorderColor??"0 0% 90%",logoBackgroundBorderWidth:m.logoBackgroundBorderWidth??"0",logoBackgroundHeight:m.logoBackgroundHeight??120,mobileLogoBackgroundHeight:m.mobileLogoBackgroundHeight??70,searchStyle:m.searchStyle??"collapsed",searchButtonMode:m.searchButtonMode??"icon",actionButtonsShowLabels:m.actionButtonsShowLabels??!1},navigation:a,onOpenMobileMenu:s,onOpenNavDrawerSection:o,onOpenSearch:i,onOpenLoginDialog:n});case"minimal":return(0,t.jsx)(eM,{tenant:e,config:{...eH(m),searchWidth:m.searchWidth??"wide",searchAlignment:m.searchAlignment??"left",hamburgerStyle:m.hamburgerStyle??"icon",actionButtonsShowLabels:m.actionButtonsShowLabels??!1},navigation:a,onOpenMobileMenu:s,onOpenSearch:i,onOpenLoginDialog:n});case"double-bar":return(0,t.jsx)(eL,{tenant:e,config:{...eH(m),utilityBarColor:m.utilityBarColor??"0 0% 96%",utilityBarItems:m.utilityBarItems??[],utilityMenuHandle:m.utilityMenuHandle,mainBarColor:m.mainBarColor??m.headerColor??eI.headerColor,searchWidth:m.searchWidth??"medium"},navigation:a,onOpenMobileMenu:s,onOpenNavDrawerSection:o,onOpenLoginDialog:n,onOpenSearch:i})}}e.s(["HeaderWrapper",0,eF],54773);var eU=e.i(9627);function eR(e){if(!e)return null;if("string"==typeof e)return e||null;if("object"==typeof e)switch(e.type){case"page":return e.pageUrl||(e.pageId?`/${e.pageId}`:null);case"group":return e.groupSlug?`/categories/${e.groupSlug}`:e.groupId?`/categories/${e.groupId}`:null;case"brand":return e.brandName?`/brands/${e.brandName}`:null;case"custom":return e.customUrl||null;case"product":return e.productId?`/products/${e.productId}`:null;case"location":return e.locationSlug?`/locations/${e.locationSlug}`:e.locationId?`/locations/${e.locationId}`:null;case"policy":return e.policyType?`/policies/${e.policyType}`:null}return null}function ez({tenant:e,className:l,initialConfig:a,sectionId:s,settings:o}){let{freeShippingThreshold:n}=(0,eU.useShippingSettings)(e),i=(0,N.useCallback)((e,t,r)=>"@primary"===e?t:"@accent"===e?r:e,[]),c=(0,N.useCallback)((e,t)=>{if(t&&"@primary"!==t&&"@accent"!==t)return t;let r=(0,q.getContrastColor)(e),l=r?.match(/hsl\(([^)]+)\)/);return l?.[1]??"0 0% 98%"},[]),[d,u]=(0,N.useState)(a?.primaryColor??"200 100% 11%"),[h,m]=(0,N.useState)(a?.accentColor??"357 98% 37%");(0,N.useEffect)(()=>{if(!s)return;let e=()=>{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--primary").trim(),r=e.getPropertyValue("--accent").trim();t&&u(t),r&&m(r)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[s]);let g=(0,N.useMemo)(()=>{let e=o?.banners??a?.alertBanners;return e?.length?e.filter(e=>e.enabled).sort((e,t)=>e.order-t.order).map(e=>{let t=i(e.backgroundColor,d,h),r=e.foregroundColor&&"auto"!==e.foregroundColor?i(e.foregroundColor,d,h):c(t),l=null!==n?e.text.replace("{threshold}",`$${n}`):e.text.replace(/free shipping.*?\{threshold\}/gi,"").replace("{threshold}","");return{id:e.id,text:l,backgroundColor:t,foregroundColor:r,textAlign:e.textAlign||"center",link:eR(e.link)}}):[]},[o,a,n,i,c,d,h]),[p,x]=(0,N.useState)(g),[f,b]=(0,N.useState)(0),[v,y]=(0,N.useState)(o?.rotationStyle??a?.rotationStyle??"carousel"),[j,w]=(0,N.useState)(o?.rotationTiming??a?.rotationTiming??5),[C,k]=(0,N.useState)(!1),[S,$]=(0,N.useState)("idle"),[T,B]=(0,N.useState)(!0),E=(0,N.useCallback)(e=>null!==n?e.text.replace("{threshold}",`$${n}`):e.text.replace(/free shipping.*?\{threshold\}/gi,"").replace("{threshold}",""),[n]);if((0,N.useEffect)(()=>{s&&o&&(x(g),y(o.rotationStyle??a?.rotationStyle??"carousel"),w(o.rotationTiming??a?.rotationTiming??5))},[s,o,g,a]),(0,N.useEffect)(()=>
39{if(s)return;let e=()=>{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--primary").trim(),r=e.getPropertyValue("--accent").trim(),l=e.getPropertyValue("--alert-banners").trim(),a=[];try{let e=l.replace(/^['"]|['"]$/g,"");e&&"[]"!==e&&(a=JSON.parse(e))}catch{a=[]}x(a.filter(e=>e.enabled).sort((e,t)=>e.order-t.order).map(e=>{let l=i(e.backgroundColor,t,r),a=e.foregroundColor?i(e.foregroundColor,t,r):c(l);return{id:e.id,text:E(e),backgroundColor:l,foregroundColor:a,textAlign:e.textAlign||"center",link:eR(e.link)}}));let s=e.getPropertyValue("--alert-banner-rotation-style").trim();s&&y(s);let o=parseInt(e.getPropertyValue("--alert-banner-rotation-timing").trim());!isNaN(o)&&o>0&&w(o);let n=e.getPropertyValue("--alert-banner-visible").trim();n&&B("1"===n)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[i,c,E]),(0,N.useEffect)(()=>{if(p.length<=1||"none"===v)return;let e=setInterval(()=>{"carousel"===v?($("slide-out"),setTimeout(()=>{b(e=>(e+1)%p.length),$("reset"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{$("slide-in"),setTimeout(()=>{$("idle")},350)})})},300)):"fade"===v&&(k(!0),setTimeout(()=>{b(e=>(e+1)%p.length),k(!1)},300))},1e3*j);return()=>clearInterval(e)},[p.length,v,j]),0===p.length||!T)return null;let M=p[f],P=M.text,L=M.backgroundColor,I=M.foregroundColor,H=M.textAlign,D=M.link,O=(0,t.jsx)("div",{className:(0,A.cn)("mx-auto","text-md","font-medium","fade"===v&&"transition-opacity duration-300","fade"===v&&C&&"opacity-0","fade"===v&&!C&&"opacity-100"),style:{maxWidth:"var(--ml-content-width, 1536px)",..."carousel"===v?{transform:"slide-out"===S?"translateX(-100%)":"reset"===S?"translateX(100%)":"translateX(0)",transition:"slide-out"===S||"slide-in"===S?"transform 300ms ease-in-out":"none"}:{}},children:P}),F=(0,A.cn)("w-full","center"===H?"text-center":"text-left","relative","overflow-hidden",l),U={backgroundColor:`hsl(${L})`,color:`hsl(${I})`,paddingTop:"var(--ml-alert-banner-padding-y, 0.5rem)",paddingBottom:"var(--ml-alert-banner-padding-y, 0.5rem)",paddingLeft:"var(--ml-alert-banner-padding-x, 0.75rem)",paddingRight:"var(--ml-alert-banner-padding-x, 0.75rem)"};return D?(0,t.jsx)(r.default,{href:D,className:(0,A.cn)(F,"block no-underline hover:opacity-90 transition-opacity"),style:U,children:O}):(0,t.jsx)("div",{className:F,style:U,children:O})}function eV(e){if(!e)return"/";if("string"==typeof e)return e||"/";if("object"==typeof e)switch(e.type){case"page":return e.pageUrl||(e.pageId?`/${e.pageId}`:"/");case"group":return e.groupSlug?`/categories/${e.groupSlug}`:e.groupId?`/categories/${e.groupId}`:"/";case"brand":return e.brandName?`/brands/${e.brandName}`:"/";case"custom":return e.customUrl||"/";case"product":return e.productId?`/products/${e.productId}`:"/";case"location":return e.locationSlug?`/locations/${e.locationSlug}`:e.locationId?`/locations/${e.locationId}`:"/";case"policy":return e.policyType?`/policies/${e.policyType}`:"/";case"blog":return e.blogArticleId?`/blog/${e.blogSlug||e.blogArticleId}`:"/blog"}return"/"}function eW({className:e,initialConfig:l,sectionId:a,settings:s}){let o=(0,N.useCallback)((e,t,r)=>e?"@primary"===e?t||"0 0% 15%":"@accent"===e?r||"0 0% 15%":e:r||"0 0% 15%",[]),n=(0,N.useCallback)(e=>{let t=(0,q.getContrastColor)(e),r=t?.match(/hsl\(([^)]+)\)/);return r?.[1]??"0 0% 98%"},[]),[i,c]=(0,N.useState)(l?.primaryColor??"200 100% 11%"),[d,u]=(0,N.useState)(l?.accentColor??"357 98% 37%");(0,N.useEffect)(()=>{if(!a)return;let e=()=>{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--primary").trim(),r=e.getPropertyValue("--accent").trim();t&&c(t),r&&u(r)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[a]);let h=(0,N.useMemo)(()=>{let e,t=s?.promos??l?.promoBanner?.promos,r=s?.backgroundColor??l?.promoBanner?.backgroundColor,a=s?.textColor??l?.promoBanner?.textColor,c=s?.dividerStyle??l?.promoBanner?.dividerStyle,u=s?.padding??l?.promoBanner?.padding;if(!t||0===t.length)return{hasConfig:!1,promos:[],backgroundColor:"0 0% 15%",textColor:"0 0% 98%",dividerStyle:"line",padding:"standard"};let h=t.filter(e=>e&&!1!==e.enabled).sort((e,t)=>
39(e.order||0)-(t.order||0)).map(e=>({id:e.id||crypto.randomUUID(),title:e.title||"",subtitle:e.subtitle||"",link:eV(e.link)})),m=o(r,i,d);return e=a&&"auto"!==a?o(a,i,d):n(m),{hasConfig:h.length>0,promos:h,backgroundColor:m,textColor:e,dividerStyle:c||"line",padding:u||"standard"}},[s,l,o,n,i,d]),[m,g]=(0,N.useState)(h.promos),[p,x]=(0,N.useState)(h.backgroundColor),[f,b]=(0,N.useState)(h.textColor),[v,y]=(0,N.useState)(h.dividerStyle),[j,w]=(0,N.useState)(h.padding),[C,k]=(0,N.useState)(h.hasConfig),[S,$]=(0,N.useState)(!0),[T,B]=(0,N.useState)(0);if((0,N.useEffect)(()=>{a&&s&&(g(h.promos),x(h.backgroundColor),b(h.textColor),y(h.dividerStyle),w(h.padding),k(h.hasConfig))},[a,s,h]),(0,N.useEffect)(()=>{if(a)return;let e=()=>{try{let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--primary").trim()||"200 100% 11%",r=e.getPropertyValue("--accent").trim()||"357 98% 37%",l=e.getPropertyValue("--promo-banner").trim();if(!l||"null"===l||"'null'"===l){k(!1),g([]);return}let a=null;try{let e=l.replace(/^['"]|['"]$/g,"");e&&"null"!==e&&(a=JSON.parse(e))}catch(e){console.warn("[PromoBanner] Failed to parse config:",e),k(!1),g([]);return}if(!a||!Array.isArray(a.promos)){k(!1),g([]);return}k(!0);let s=a.promos.filter(e=>e&&!1!==e.enabled).sort((e,t)=>(e.order||0)-(t.order||0)).map(e=>({id:e.id||crypto.randomUUID(),title:e.title||"",subtitle:e.subtitle||"",link:eV(e.link)}));g(s);let i=o(a.backgroundColor,t,r);x(i),a.textColor&&"auto"!==a.textColor?b(a.textColor):b(n(i)),y(a.dividerStyle||"line"),w(a.padding||"standard");let c=e.getPropertyValue("--promo-banner-visible").trim();c&&$("1"===c)}catch(e){console.warn("[PromoBanner] Error updating from CSS vars:",e),k(!1),g([])}};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[o,n]),(0,N.useEffect)(()=>{if(m.length<=1)return;let e=setInterval(()=>{B(e=>(e+1)%m.length)},4e3);return()=>clearInterval(e)},[m.length]),!C||0===m.length||!S)return null;let E={compact:"py-2",standard:"py-3",spacious:"py-4"};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,A.cn)("md:hidden",e),style:{backgroundColor:`hsl(${p})`},children:(0,t.jsx)("div",{className:"relative overflow-hidden",children:(0,t.jsx)("div",{className:"flex transition-transform duration-500 ease-in-out",style:{transform:`translateX(-${100*T}%)`},children:m.map(e=>(0,t.jsx)(r.default,{href:e.link,className:(0,A.cn)("w-full shrink-0 text-center px-4 flex items-center justify-center cursor-pointer",E[j]),children:(0,t.jsx)("span",{className:"text-sm font-bold",style:{color:`hsl(${f})`},children:e.title})},e.id))})})}),(0,t.jsx)("div",{className:(0,A.cn)("hidden md:block",e),style:{backgroundColor:`hsl(${p})`},children:(0,t.jsx)("div",{className:(0,A.cn)("mx-auto px-4 grid","line"===v?"divide-x-2 divide-white/40":"fade"===v?"divide-x divide-white/20":""),style:{maxWidth:"var(--ml-content-width, 1536px)",gridTemplateColumns:`repeat(${m.length}, 1fr)`},children:m.map(e=>(0,t.jsxs)(r.default,{href:e.link,className:(0,A.cn)("text-center hover:bg-white/10 transition-colors flex flex-col cursor-pointer",E[j]),children:[(0,t.jsx)("span",{className:"text-sm font-bold",style:{color:`hsl(${f})`},children:e.title}),(0,t.jsx)("span",{className:"text-xs underline",style:{color:`hsl(${f} / 0.8)`}
39,children:e.subtitle})]},e.id))})})]})}var eq=e.i(84483),e_=e.i(7496),eG=e.i(47925),eX=e.i(99847),eY=e.i(49882),eK=e.i(82625),eJ=e.i(64569),eZ=e.i(79258),eQ=e.i(13192),e0=e.i(61096),e1=e.i(10497),e2=e.i(75047),e5=e.i(17877),e4=e.i(75424),e3=e.i(57199),e6=e.i(36359);function e8(e,t){if(!t)return e>=1&&e<=5;switch(e){case 0:return t.sunday?.isOpen??!1;case 1:return t.monday?.isOpen??!0;case 2:return t.tuesday?.isOpen??!0;case 3:return t.wednesday?.isOpen??!0;case 4:return t.thursday?.isOpen??!0;case 5:return t.friday?.isOpen??!0;case 6:return t.saturday?.isOpen??!1;default:return!1}}function e7(e,t,r){let l,a=new Date,s=15,o=0;if(e){let t=e.split(":");s=parseInt(t[0],10),o=t.length>1?parseInt(t[1],10):0}try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t||"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(a),r=t=>e.find(e=>e.type===t)?.value||"0";l=new Date(parseInt(r("year")),parseInt(r("month"))-1,parseInt(r("day")),parseInt(r("hour")),parseInt(r("minute")),parseInt(r("second")))}catch{let e=a.getTimezoneOffset();l=new Date(a.getTime()+(e+-480)*6e4)}let n=l.getDay(),i=l.getHours(),c=l.getMinutes(),d=l.getSeconds(),u=60*i+c,h=60*s+o,m=e8(n,r),g=u<h,p=0,x=0,f=0;if(m&&g){let e=h-u;p=Math.floor(e/60),x=e%60,60==(f=60-d)?f=0:x>0?x-=1:p>0&&(p-=1,x=59)}else{let e=new Date(l);m&&!g&&e.setDate(e.getDate()+1);let t=0;for(;!e8(e.getDay(),r)&&t<7;)e.setDate(e.getDate()+1),t++;e.setHours(s,o,0,0);let a=Math.floor((e.getTime()-l.getTime())/1e3);p=Math.floor(a/3600),x=Math.floor(a%3600/60),f=a%60}return{hoursLeft:Math.max(0,p),minutesLeft:Math.max(0,x),secondsLeft:Math.max(0,f),isBeforeCutoff:m&&g}}function e9(){let e=e7(),t=new Date,r=t.getTimezoneOffset(),l=new Date(new Date(t.getTime()+(r+-480)*6e4)),a=e.isBeforeCutoff?4:5,s=0;for(;s<a;)l.setDate(l.getDate()+1),0!==l.getDay()&&6!==l.getDay()&&s++;let o=l.toLocaleDateString("en-US",{weekday:"long"}),n=l.toLocaleDateString("en-US",{month:"long",day:"numeric"});return{deliveryDate:`${o}, ${n}`,...e}}function te({tenant:e,isOpen:l,onClose:s}){let{cart:o,removeFromCart:n,updateQuantity:i,updateCustomField:c,sweepExpiredFlashDeals:d,expiredFlashDealTitles:u,clearExpiredFlashDealNotice:p}=(0,m.useCart)(),{qualifiesForFreeShipping:f}=(0,e6.useCartFreeShipping)(e),[b,y]=(0,N.useState)(null),[j,w]=(0,N.useState)(null),[C,T]=(0,N.useState)(null),[B,E]=(0,N.useState)(null),[M,P]=(0,N.useState)(null),[L,I]=(0,N.useState)(null),[H,D]=(0,N.useState)(null),[O,F]=(0,N.useState)(null),[U,R]=(0,N.useState)(null),[z,W]=(0,N.useState)(null),[_,X]=(0,N.useState)(null),[Y,K]=(0,N.useState)(null),[J,Z]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement),t=t=>e.getPropertyValue(t).trim(),r=t("--cart-header-bg");r&&y(r);let l=t("--cart-header-text-color");l&&w(l);let a=t("--cart-card-bg");a&&T(a);let s=t("--cart-card-border");s&&E(s);let o=t("--cart-card-padding");o&&P(o);let n=t("--cart-card-image-size");n&&I(n);let i=t("--cart-price-color");i&&D(i);let c=t("--radius");if(c){let e=parseFloat(c.replace("rem",""));isNaN(e)||Z(e)}let d=t("--cart-edit-button-color");d&&F(d);let u=t("--cart-edit-button-border-color");u&&R(u);let h=t("--cart-checkout-button-color");h&&W(h);let m=t("--cart-checkout-button-border-color");m&&X(m);let g=t("--cart-checkout-button-width");g&&K(g)};e();let t=new MutationObserver(()=>e());return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("theme-applied",e),()=>{t.disconnect(),window.removeEventListener("theme-applied",e)}},[]);let Q=(0,N.useCallback)(()=>{if(!b||"transparent"===b){let e=(0,q.getTextColor)(j??void 0,void 0);return e?{color:e}:{}}return{backgroundColor:(0,q.getBackgroundColor)(b),color:(0,q.getTextColor)(j??void 0,b)}},[b,j]),ee=(0,N.useCallback)(()=>!!C&&"transparent"!==C&&(0,q.isDarkBackground)(C),[C]),et=(0,N.useCallback)(()=>{if(C&&"transparent"!==C)return ee()?"hsl(0 0% 100% / 0.6)":"hsl(0 0% 10% / 0.6)"},[C,ee]),er=(0,N.useCallback)(()=>{let e={};if("transparent"===C)e.backgroundColor="transparent",e.boxShadow="none";
39else if(C){let t=(0,q.getBackgroundColor)(C);t&&(e.backgroundColor=t,e.color=(0,q.getTextColor)("auto",C))}else e.backgroundColor="white";if(B&&"transparent"!==B){let t=(0,q.getBackgroundColor)(B);t&&(e.border=`1px solid ${t}`,e.boxShadow="none")}let t={sm:8,md:12,lg:16}[M||"md"]??12;if(e.padding=`${t}px`,null!==J){let t=.7*J;e.borderRadius=`${t}rem`}return e},[C,B,M,J]),el=(0,N.useCallback)(()=>{let e=et();return e?{color:e}:{}},[et]),ea=(0,N.useCallback)(()=>{if(!C||"transparent"===C)return{};let e=ee();return{color:e?"hsl(0 0% 100%)":"hsl(0 0% 10%)",borderColor:e?"hsl(0 0% 100% / 0.3)":"hsl(0 0% 10% / 0.3)"}},[C,ee]),es=(0,N.useCallback)(()=>C&&"transparent"!==C?{color:ee()?"hsl(0 0% 100%)":"hsl(0 0% 10%)"}:{},[C,ee]),eo=(0,N.useCallback)(()=>{if(H&&"auto"!==H){let e=(0,q.getBackgroundColor)(H);if(e)return{color:e}}return C&&"transparent"!==C?{color:ee()?"hsl(0 0% 100%)":"hsl(0 0% 10%)"}:{}},[H,C,ee]),en="transparent"===C,ei=()=>{switch(L){case"sm":return"w-16 h-16";case"lg":return"w-24 h-24";default:return"w-20 h-20"}},ec=()=>{switch(L){case"sm":return"64px";case"lg":return"96px";default:return"80px"}},ed=(0,N.useCallback)(()=>{let e={};if(O&&"transparent"!==O){let t=(0,q.getBackgroundColor)(O);t&&(e.backgroundColor=t,e.color=(0,q.getTextColor)("auto",O))}if(U&&"transparent"!==U){let t=(0,q.getBackgroundColor)(U);t&&(e.borderColor=t,e.borderWidth="1px",e.borderStyle="solid")}return e},[O,U]),eu=(0,N.useCallback)(()=>{let e={};if(z){let t=(0,q.getBackgroundColor)(z);t&&(e.backgroundColor=t,e.color=(0,q.getTextColor)("auto",z))}if(_&&"transparent"!==_){let t=(0,q.getBackgroundColor)(_);t&&(e.borderColor=t,e.borderWidth="1px",e.borderStyle="solid")}return e},[z,_]),eh=(0,N.useCallback)(()=>"full"===Y,[Y]),em=(0,N.useCallback)(t=>{let r=o.items.find(e=>e.id===t);r?.productId&&(0,eQ.trackRemoveFromCart)(e,{productId:r.productId,quantity:r.quantity}),n(t)},[o.items,e,n]),{user:eg,token:ep}=(0,g.useAuth)(),{guestLocation:ex}=(0,v.useGuestLocation)(),ef=!ep&&ex?.postalCode?ex.postalCode:void 0,[eb,ev]=(0,N.useState)(()=>e7()),[ey,ej]=(0,N.useState)(()=>e9()),[ew,eN]=(0,N.useState)(!1),[eC,ek]=(0,N.useState)(null),[eS,e$]=(0,N.useState)(!1),eT=(()=>{if(!eg?.addresses||0===eg.addresses.length)return null;if(eg.defaultAddressId){let e=eg.addresses.find(e=>e.id===eg.defaultAddressId);if(e)return e}let e=eg.addresses.find(e=>e.isDefault);return e||eg.addresses[0]})();(0,G.useFloatingWidgetSuppressor)(l),(0,N.useEffect)(()=>{if(!l)return;let e=()=>{if(eC)ev(e7(eC.cutoffTime,eC.cutoffTimezone,eC.hoursOfOperation));else{let e=e9();ej(e),ev({hoursLeft:e.hoursLeft,minutesLeft:e.minutesLeft,secondsLeft:e.secondsLeft,isBeforeCutoff:e.isBeforeCutoff})}};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[l,eC]);let eB=(0,N.useCallback)(async()=>
39{let t=o.items.filter(e=>"product"===e.itemType&&e.productId);if(0===t.length)return void ek(null);e$(!0);try{let r=t.map(e=>e.productId),l=t.filter(e=>e.productId&&e.sku).map(e=>({productId:e.productId,sku:e.sku})),a=await (0,e3.getCartDeliveryEstimate)(e,r,ep||void 0,l.length>0?l:void 0,ef);ek(a)}catch(e){console.error("Error fetching cart delivery estimate:",e),ek(null)}finally{e$(!1)}},[o.items,e,ep,ef]);(0,N.useEffect)(()=>{l&&o.items.length>0&&eB()},[l,o.items.length,eB]);let eE=eC?.hideEstimate?null:eC?.deliveryDateFormatted?eC.deliveryDateFormatted:ey.deliveryDate,eM=eC?.addressCity,eP=eC?.isPersonalized??!1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V.Sheet,{open:l,onOpenChange:s,children:(0,t.jsxs)(V.SheetContent,{className:"w-full sm:max-w-md flex flex-col h-full p-0 border-l-0 [&>button]:hidden",children:[(0,t.jsxs)(V.SheetHeader,{className:"p-4 border-b border-border",style:Q(),children:[(0,t.jsx)(V.SheetTitle,{className:"sr-only",children:"Shopping Cart"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"text-lg font-semibold tracking-wide",children:["Shopping Cart (",o.itemCount,")"]}),(0,t.jsx)("button",{onClick:s,className:"opacity-80 hover:opacity-100 transition-opacity","aria-label":"Close cart",children:(0,t.jsx)(S.X,{className:"h-6 w-6"})})]})]}),0===o.items.length?(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center p-8 text-center",children:[(0,t.jsx)(a.ShoppingBag,{className:"h-16 w-16 text-muted-foreground mb-4"}),(0,t.jsx)("p",{className:"text-lg font-semibold mb-2",children:"Your cart is empty"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:"Add some products to get started!"}),(0,t.jsx)(h.Button,{onClick:s,asChild:!0,children:(0,t.jsx)(r.default,{href:"/categories/all",children:"Continue Shopping"})})]}):(0,t.jsxs)(t.Fragment,{children:["pickup"!==o.deliveryMethod&&(0,t.jsx)("div",{className:"px-5 pb-2",children:(0,t.jsx)(e0.FreeShippingProgress,{tenant:e})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-1 space-y-3",children:[u.length>0&&(0,t.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[(0,t.jsx)(eX.AlertCircle,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),(0,t.jsx)("div",{className:"flex-1 text-xs text-amber-800",children:u.map(e=>(0,t.jsxs)("p",{children:["Your flash deal on ",(0,t.jsx)("span",{className:"font-semibold",children:e})," ","expired — it's now at the regular price."]},e))}),(0,t.jsx)("button",{onClick:p,className:"shrink-0 text-amber-600 hover:text-amber-800 transition-colors","aria-label":"Dismiss flash deal notice",children:(0,t.jsx)(S.X,{className:"h-4 w-4"})})]}),o.items.filter(e=>"serviceplan"!==e.itemType).map(l=>{let a;return(0,t.jsxs)("div",{className:`flex gap-3 ${en?"":"shadow-sm"}`,style:er(),children:["product"===l.itemType?(0,t.jsx)(r.default,{href:`/products/${l.productSlug}?id=${l.productId}`,className:`relative ${ei()} shrink-0 overflow-hidden hover:border-accent transition-colors`,onClick:s,children:l.image?(0,t.jsx)(k.default,{src:l.image,alt:l.title,fill:!0,className:"object-contain p-1",sizes:ec()}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-muted/40",children:(0,t.jsx)(eZ.Package,{className:"h-8 w-8 text-muted-foreground/50","aria-hidden":!0})})}):"rental"===l.itemType?(0,t.jsxs)(r.default,{href:`/rentals/${l.rentalItemId}`,className:`relative ${ei()} shrink-0 overflow-hidden rounded hover:border-accent transition-colors`,onClick:s,children:[l.image?(0,t.jsx)(k.default,{src:l.image,alt:l.title,fill:!0,className:"object-cover",sizes:ec()}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-linear-to-br from-accent to-accent/80 text-white",children:(0,t.jsx)(eY.Calendar,{className:"h-8 w-8"})}),(0,t.jsx)("div",{className:"absolute bottom-0 left-0 right-0 bg-accent/90 text-white text-[8px] font-medium text-center py-0.5",children:"RENTAL"})]}):"giftcard"===l.itemType?(0,t.jsxs)(r.default,{href:`/gift-cards/${l.giftCardProductId}`,className:`relative ${ei()} shrink-0 overflow-hidden rounded hover:border-accent transition-colors`,onClick:s,children:[l.image?(0,t.jsx)(k.default,{src:l.image,alt:l.title,fill:!0,className:"object-contain p-1",sizes:ec()}):(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-linear-to-br from-accent/10 to-accent/5",children:(0,t.jsx)(eK.Gift,{className:"h-8 w-8 text-accent/40"})}),(0,t.jsx)("div",{className:"absolute bottom-0 left-0 right-0 bg-accent/90 text-white text-[8px] font-medium text-center py-0.5",children:"GIFT CARD"})]}):(0,t.jsxs)("div",{className:`${ei()} shrink-0 bg-linear-to-br from-primary to-primary/80 rounded flex flex-col items-center justify-center text-white`,children:[(0,t.jsx)(eG.Wrench,{className:"h-8 w-8 mb-1"}),(0,t.jsx)("span",{className:"text-[10px] font-medium",children:"Service"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:["product"===l.itemType?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.default,{href:`/products/${l.productSlug}?id=${l.productId}`,className:"hover:text-accent transition-colors",onClick:s,children:(0,t.jsx)("p",{className:"font-semibold text-sm line-clamp-2 mb-1",children:l.options&&Object.values(l.options).some(e=>"default title"!==e.toLowerCase())?l.title:l.variantTitle&&"default title"!==l.variantTitle.toLowerCase()?l.variantTitle:l.title})}),0===(a=l.options?Object.values(l.options).filter(e=>"default title"!==e.toLowerCase()):[]).length?null:(0,t.jsx)("p",{className:"text-xs mb-1",style:el(),children:a.join(" / ")}),(0,t.jsxs)("p",{className:"text-xs mb-1",style:el(),children:["SKU: ",l.sku]}),l.preOrder?.isPreOrder&&(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-amber-100 text-amber-800",children:l.preOrder.badgeText||"Pre-order"})}),l.flashDeal&&(0,t.jsx)("div",{className:"mb-1",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-semibold bg-accent text-accent-foreground",children:[(0,t.jsx)(eJ.Zap,{className:"h-2.5 w-2.5"}),"Flash Deal"]})}),l.shippingProfileMessage&&(0,t.jsxs)("div",{className:"flex items-start gap-1 mb-1",children:[(0,t.jsx)(eX.AlertCircle,{className:"w-3 h-3 text-amber-600 shrink-0 mt-0.5"}),(0,t.jsx)("p",{className:"text-[10px] text-amber-700 line-clamp-2",children:l.shippingProfileMessage})]}),l.itemFee?.showOnCartPage&&(0,t.jsxs)("div",{className:"text-[10px] mb-1",style:el(),children:[(0,t.jsxs)("span",{children:["+ ",(0,A.formatPrice)(l.itemFee.amount)," ",l.itemFee.feeName]}),l.itemFee.customMessage&&(0,t.jsxs)("span",{className:"ml-1 text-amber-600",children:["(",l.itemFee.customMessage,")"]})]}
39),(0,t.jsx)(e1.ProductCustomFields,{density:"compact",schema:l.customFieldSchema,values:l.customFields,onChange:(e,t)=>c(l.id,e,t),className:"mb-3"})]}):"rental"===l.itemType?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.default,{href:`/rentals/${l.rentalItemId}`,className:"hover:opacity-70 transition-opacity",onClick:s,children:(0,t.jsx)("p",{className:"font-semibold text-sm line-clamp-2 mb-1",children:l.title})}),(0,t.jsx)("p",{className:"text-xs mb-1",style:el(),children:l.rentalStartDate&&l.rentalEndDate&&(0,t.jsxs)(t.Fragment,{children:[(0,A.formatRentalDate)(l.rentalStartDate),l.rentalPickupTime&&` ${(0,A.formatRentalTime)(l.rentalPickupTime)}`," - ",(0,A.formatRentalDate)(l.rentalEndDate),l.rentalReturnTime&&` ${(0,A.formatRentalTime)(l.rentalReturnTime)}`," ","(",l.rentalPeriods??l.rentalDays," ",l.rentalPeriods?1===l.rentalPeriods?"period":"periods":1!==l.rentalDays?"days":"day",")"]})}),l.rentalSize&&(0,t.jsxs)("p",{className:"text-xs mb-1",style:el(),children:["Size: ",l.rentalSize]}),l.rentalLocationName&&(0,t.jsxs)("p",{className:"text-xs mb-1",style:el(),children:["Pickup: ",l.rentalLocationName]}),l.rentalOptions&&l.rentalOptions.length>0&&(0,t.jsx)("div",{className:"text-[10px] mb-1",style:el(),children:l.rentalOptions.map(e=>(0,t.jsxs)("div",{children:[e.optionName,": ",e.displayValue,e.price>0&&` (+${(0,A.formatPrice)(e.price)})`]},e.optionId))})]}):"giftcard"===l.itemType?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(r.default,{href:`/gift-cards/${l.giftCardProductId}`,className:"hover:opacity-70 transition-opacity",onClick:s,children:(0,t.jsxs)("p",{className:"font-semibold text-sm line-clamp-2 mb-1",children:[l.title,l.variantTitle?` - ${l.variantTitle}`:""]})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-semibold text-sm line-clamp-2 mb-1",children:l.title}),(0,t.jsx)("p",{className:"text-xs mb-2",style:el(),children:"Service"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:["product"===l.itemType?(0,t.jsxs)("div",{className:"flex flex-col gap-1 items-start",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:()=>i(l.id,l.quantity-1),className:"h-6 w-6 rounded border hover:opacity-70 flex items-center justify-center text-sm font-semibold",style:ea(),disabled:l.quantity<=1,children:"−"}),(0,t.jsx)("span",{className:"text-sm font-semibold w-6 text-center",children:l.quantity}),(0,t.jsx)("button",{onClick:()=>i(l.id,l.quantity+1),className:"h-6 w-6 rounded border hover:opacity-70 flex items-center justify-center text-sm font-semibold",style:ea(),children:"+"})]}),(0,t.jsx)("button",{onClick:()=>em(l.id),className:"text-xs hover:underline transition-colors w-[86px] text-center",style:es(),children:"Remove"})]}):"rental"===l.itemType?(0,t.jsxs)("div",{className:"flex flex-col gap-1 items-start",children:[(0,t.jsx)("span",{className:"text-xs",style:el(),children:"Qty: 1"}),(0,t.jsx)("button",{onClick:()=>em(l.id),className:"text-xs hover:underline transition-colors",style:es(),children:"Remove"})]}):"giftcard"===l.itemType?(0,t.jsxs)("div",{className:"flex flex-col gap-1 items-start",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:()=>i(l.id,l.quantity-1),className:"h-6 w-6 rounded border hover:opacity-70 flex items-center justify-center text-sm font-semibold",style:ea(),disabled:l.quantity<=1,children:"−"}),(0,t.jsx)("span",{className:"text-sm font-semibold w-6 text-center",children:l.quantity}),(0,t.jsx)("button",{onClick:()=>i(l.id,l.quantity+1),className:"h-6 w-6 rounded border hover:opacity-70 flex items-center justify-center text-sm font-semibold",style:ea(),children:"+"})]}),(0,t.jsx)("button",{onClick:()=>em(l.id),className:"text-xs hover:underline transition-colors w-[86px] text-center",style:es(),children:"Remove"})]}):(0,t.jsxs)("div",{className:"flex flex-col gap-1 items-start",children:[(0,t.jsx)("span",{className:"text-xs",style:el(),children:"Qty: 1"}),(0,t.jsx)("button",{onClick:()=>em(l.id),className:"text-xs hover:underline transition-colors",style:es(),children:"Remove"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-end",children:[(0,t.jsx)("span",{className:"font-bold text-sm",style:eo(),children:(0,A.formatPrice)(l.price*l.quantity)}),l.compareAtPrice&&l.compareAtPrice>l.price&&(0,t.jsx)("span",{className:"text-xs line-through",style:el(),children:(0,A.formatPrice)(l.compareAtPrice*l.quantity)}),l.flashDeal&&(0,t.jsx)(e2.FlashDealEndsIn,{endsAt:l.flashDeal.expiresAt,clockOffsetMs:(0,e4.getFlashClockOffsetMs)(),onExpire:d,className:"text-[10px] text-accent font-medium"})]})]}),"product"===l.itemType&&(0,t.jsx)(e5.CartServicePlanOffer,{tenant:e,item:l})]})]},l.id)})]}),eE&&(0,t.jsx)("div",{className:`text-xs text-center ${eb.isBeforeCutoff?"text-green-900":"text-blue-900"}`,children:eS?(0,t.jsx)("div",{className:"font-bold pb-1",children:"Calculating delivery..."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"font-bold pb-1",children:[f?"Free ":"","Delivery"," ",eP&&eM?`to ${eM} `:"","By ",eE,"."]}),(0,t.jsxs)("div",{children:["Order within"," ",(0,t.jsxs)("span",{className:"font-semibold tabular-nums",children:[eb.hoursLeft,"h ",eb.minutesLeft,"m"," ",eb.secondsLeft,"s"]})," ","to get it on time."]})]})}),(0,t.jsxs)("div",{className:"border-t border-border px-5 pt-3 pb-6 space-y-3 bg-muted/30",children:[(0,t.jsxs)("div",{className:"flex justify-between items-baseline",children:[(0,t.jsx)("span",{className:"text-base font-semibold",children:"Subtotal:"}),(0,t.jsx)("span",{className:"text-2xl font-bold",children:(0,A.formatPrice)(o.subtotal)})]}),(0,t.jsxs)("div",{className:`flex gap-3 pb-2 ${eh()?"flex-col":""}`,children:[(0,t.jsx)(h.Button,{asChild:!0,variant:"outline",className:eh()?"w-full":"flex-1",onClick:s,style:ed(),children:(0,t.jsx)(r.default,{href:"/cart",className:"flex items-center justify-center gap-2",children:"Edit Cart"})}),(0,t.jsx)(h.Button,{asChild:!0,size:eh()?"lg":"default",className:`btn-primary ${eh()?"w-full":"flex-1"}`,onClick:s,style:eu(),children:(0,t.jsxs)(r.default,{href:"/checkout",className:"flex items-center justify-center gap-2",children:["Checkout",(0,t.jsx)($.ArrowRight,{className:"h-4 w-4"})]})})]})]})]})]})}),ew&&eT&&(0,t.jsxs)("div",{className:"fixed inset-0 z-100 flex items-center justify-center",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:()=>eN(!1)}),(0,t.jsxs)("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(x.MapPin,{className:"h-5 w-5 text-accent"}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Default Shipping Address"})]}),(0,t.jsx)("button",{onClick:()=>eN(!1),className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,t.jsx)("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"space-y-3 mb-6",children:[eT.label&&(0,t.jsx)("div",{className:"inline-block px-2 py-1 bg-accent/10 text-accent text-sm font-medium rounded-lg",children:eT.label}),(0,t.jsxs)("div",{className:"text-gray-700",children:[(0,t.jsx)("p",{className:"font-medium",children:eT.line1}),eT.line2&&(0,t.jsx)("p",{children:eT.line2}),(0,t.jsxs)("p",{children:[eT.city,", ",eT.state," ",eT.postalCode]}),(0,t.jsx)("p",{className:"text-gray-600",children:eT.country})]})]}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)(r.default,{href:"/account/addresses",onClick:()=>{eN(!1),s()},className:"flex-1 px-4 py-2 bg-accent text-white text-center font-medium rounded-lg hover:bg-accent/90 transition-colors",children:"Manage Addresses"}),(0,t.jsx)("button",{onClick:()=>eN(!1),className:"px-4 py-2 bg-gray-200 text-gray-700 font-medium rounded-lg hover:bg-gray-300 transition-colors",children:"Close"})]})]})]})]})}var tt=e.i(24071);let tr=(0,s.default)("chevrons-down-up",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);function tl({tenant:e,isOpen:l,onClose:a,onOpenLoginDialog:s,navigation:o,initialPage:n,logoType:c="text",logoText:d="Shop",logoUrl:u,logoMarkUrl:h,logoHeight:m=48,mobileLogoType:p,mobileLogoHeight:x,mobileLogoUrl:j,mobileLogoMarkUrl:w}){let C,k,$,T,B,M,P,L,I,H,D,A,O,F,U,R,z,W,_,X,{user:Y,loading:K}=(0,g.useAuth)(),{guestLocation:J,setShowLocationPrompt:Z}=(0,v.useGuestLocation)(),{preferredStoreName:Q}=(0,y.usePreferredStore)();(0,G.useFloatingWidgetSuppressor)(l);let[ee,et]=(0,N.useState)("main"),[er,el]=(0,N.useState)(["main"]),[ea,es]=(0,N.useState)(new Set),[eo,en]=(0,N.useState)(null),[ei,ec]=(0,N.useState)(null),[ed,eu]=(0,N.useState)(null),[eh,em]=(0,N.useState)(null),[eg,ep]=(0,N.useState)(null),[ex,ef]=(0,N.useState)(null),[eb,ev]=(0,N.useState)(null),[ey,ej]=(0,N.useState)(null),[ew,eN]=(0,N.useState)(null),[eC,ek]=(0,N.useState)(null),[eS,eT]=(0,N.useState)(null),[eB,eE]=(0,N.useState)(null),[eM,eP]=(0,N.useState)(!0),[eL,eI]=(0,N.useState)(null),[eH,eD]=(0,N.useState)(null),[eA,eO]=(0,N.useState)(null),[eF,eU]=(0,N.useState)(null),[eR,ez]=(0,N.useState)(null),[eV,eW]=(0,N.useState)(null),[eq,e_]=(0,N.useState)(null),[eG,eX]=(0,N.useState)(null),[eY,eK]=(0,N.useState)(null),[eJ,eZ]=(0,N.useState)(null),[eQ,e0]=(0,N.useState)(null),[e1,e2]=(0,N.useState)(null),[e5,e4]=(0,N.useState)(null),[e3,e6]=(0,N.useState)(null),[e8,e7]=(0,N.useState)(null),[e9,te]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement),t=t=>
39e.getPropertyValue(t).trim(),r=t("--logo-type");("full"===r||"mark-text"===r||"text"===r)&&en(r);let l=t("--logo-text").replace(/^["']|["']$/g,"");l&&ec(l);let a=t("--logo-url").replace(/^["']|["']$/g,"");a&&eu(a);let s=t("--logo-mark-url").replace(/^["']|["']$/g,"");s&&em(s);let o=t("--logo-height");if(o){let e=parseInt(o,10);isNaN(e)||ep(e)}let n=t("--mobile-logo-type");("same"===n||"full"===n||"mark-text"===n||"text"===n)&&ef(n);let i=t("--mobile-logo-height");if(i){let e=parseInt(i,10);isNaN(e)||ev(e)}let c=t("--mobile-logo-url").replace(/^["']|["']$/g,"");c&&ej(c);let d=t("--mobile-logo-mark-url").replace(/^["']|["']$/g,"");d&&eN(d);let u=t("--mobile-menu-header-bg");u&&ek(u);let h=t("--mobile-menu-header-text-color");h&&eT(h);let m=t("--mobile-menu-title-type");("text"===m||"logo"===m)&&eI(m);let g=t("--mobile-menu-title-text").replace(/^["']|["']$/g,"");g&&eD(g);let p=t("--mobile-menu-logo-source");("header"===p||"custom"===p)&&eO(p),eU(t("--mobile-menu-custom-logo-url").replace(/^["']|["']$/g,"")||null);let x=t("--mobile-menu-logo-height");if(x){let e=parseInt(x,10);isNaN(e)||ez(e)}let f=t("--mobile-menu-bg");f&&eE(f);let b=t("--mobile-menu-show-account");("0"===b||"1"===b)&&eP("1"===b);let v=t("--mobile-menu-control-style");("icons"===v||"text"===v)&&eW(v);let y=t("--mobile-menu-icons-color");y&&e_(y);let j=t("--mobile-menu-nav-style");("drill"===j||"accordion"===j)&&eX(j);let w=t("--mobile-menu-nav-item-style");("text"===w||"filled"===w||"divider"===w)&&eK(w);let N=t("--mobile-menu-nav-item-font-size");if(N){let e=parseInt(N,10);isNaN(e)||eZ(e)}let C=t("--mobile-menu-nav-item-font-weight");C&&e0(C);let k=t("--mobile-menu-nav-item-color");k&&e2(k);let S=t("--mobile-menu-nav-item-background-color");S&&e4(S);let $=t("--mobile-menu-nav-item-hover-color");$&&e6($);let T=t("--mobile-menu-nav-item-divider-color");T&&e7(T)};e();let t=new MutationObserver(()=>{e()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]});let r=()=>{e()};return window.addEventListener("theme-applied",r),()=>{t.disconnect(),window.removeEventListener("theme-applied",r)}},[]);let ta=ei||d,ts=ex||p,to=(0,N.useCallback)(()=>({backgroundColor:(0,q.getBackgroundColor)(eC??"@primary"),color:(0,q.getTextColor)(eS??"auto",eC??void 0)}),[eC,eS]),tn=eY||"text",ti="accordion"===eG,tc=(0,N.useCallback)(()=>e1&&"auto"!==e1?(0,q.getBackgroundColor)(e1)||"hsl(0 0% 10%)":eB&&(0,q.getTextColor)("auto",eB)||"hsl(0 0% 10%)",[e1,eB]),td=(0,N.useCallback)(()=>(0,q.getBackgroundColor)(e3??"@accent")||"hsl(357 98% 37%)",[e3]),tu=(0,N.useCallback)(()=>e5&&(0,q.getBackgroundColor)(e5)||"hsl(0 0% 95%)",[e5]),th=(0,N.useCallback)((e,t=!1,r=!1)=>{let l={},a=r&&"filled"===tn?"text":tn;"filled"===a?(l.padding="0.75rem 1rem 0.75rem 1.25rem",l.marginBottom=t?"0":"0.5rem"):l.padding="0.75rem 0.5rem",eJ&&(l.fontSize=`${eJ}px`),eQ&&(l.fontWeight=({normal:400,medium:500,semibold:600,bold:700})[eQ]||500);let s=e9===e,o=td();if("filled"===a){let e=tu();s?(l.backgroundColor=o,l.color=(0,q.getTextColor)("auto",e3??"@accent")||"white"):(l.backgroundColor=e,l.color=(0,q.getTextColor)("auto",e5??"0 0% 95%")||"hsl(0 0% 10%)")}else l.color=tc(),s&&(l.color=o);return"divider"!==a||t||(l.borderBottomWidth="1px",l.borderBottomStyle="solid",l.borderBottomColor=e8?`hsl(${e8})`:"hsl(0 0% 90%)"),l},[eJ,eQ,tc,e9,tn,td,e8,tu,e5,e3]),tm=(0,N.useCallback)((e=!1)=>{let t="transition-colors";return"divider"===(e&&"filled"===tn?"text":tn)?t:`${t} rounded-md`},[tn]);(0,N.useEffect)(()=>{l?n&&(et(n),el(["main",n]),es(new Set([n]))):(et("main"),el(["main"]),es(new Set))},[l,n]);let tg=e=>{es(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},tp=(0,N.useMemo)(()=>{var e;let t,r,l;if(!o?.menus)return[];let a=o.menus.find(e=>"main"===e.handle);return a?.items?(e=a.items,t=new Map,r=[],e.forEach(e=>{t.set(e.id,{...e,children:[]})}),e.forEach(e=>{let l=t.get(e.id);e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(l):e.parentId||r.push(l)}),l=(e,t)=>
39e.order-t.order,r.sort(l),r.forEach(e=>{e.children&&e.children.sort(l)}),r):[]},[o]),tx=(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.children){let e=tx(r.children,t);if(e)return e}}return null},tf="main"!==ee?tx(tp,ee):null,tb=e=>{et(e),el([...er,e])},tv=()=>{a()},ty=(e,l)=>e.map((a,s)=>{let o=a.children??[],n=o.length>0,i=s===e.length-1,c=l>0?{marginLeft:`${+l}rem`}:{};if(!n)return(0,t.jsx)(r.default,{href:e$(a),onClick:tj,onMouseEnter:()=>te(a.id),onMouseLeave:()=>te(null),className:`block ${tm()}`,style:{...th(a.id,i),...c},children:a.label},a.id);let d=ea.has(a.id);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>tg(a.id),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),tg(a.id))},onMouseEnter:()=>te(a.id),onMouseLeave:()=>te(null),className:`group flex items-center justify-between w-full cursor-pointer select-none ${tm()}`,style:{...th(a.id,i&&!d),...c},"aria-expanded":d,children:[(0,t.jsxs)("span",{className:"flex items-center gap-3 min-w-0",children:[(0,t.jsx)("span",{className:"truncate",children:a.label}),(0,t.jsx)(r.default,{href:e$(a),onClick:e=>{e.stopPropagation(),tj()},className:`text-xs font-medium whitespace-nowrap hover:underline opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 ${d?"[@media(hover:none)]:opacity-100":""}`,style:{color:td()},tabIndex:0,children:"View all"})]}),(0,t.jsx)(E.ChevronRight,{className:`h-5 w-5 shrink-0 transition-transform duration-200 ${d?"rotate-90":""}`})]}),d&&(0,t.jsx)("div",{children:ty(o,l+1)})]},a.id)}),tj=()=>{a()},tw=()=>{a(),Z(!0)};return(0,t.jsx)(V.Sheet,{open:l,onOpenChange:a,children:(0,t.jsxs)(V.SheetContent,{side:"right",className:"w-full sm:max-w-md p-0 [&>button]:hidden",style:eB?{backgroundColor:`hsl(${eB})`}:void 0,children:[(0,t.jsx)(V.SheetTitle,{className:"sr-only",children:"Navigation Menu"}),(C=eL||"text",k=eH||"Menu",$=eA||"header",T=eR??32,B="same"!==ts&&ts?ts:eo||c,M=eb||x||Math.round(.7*(eg||m)),P=ey||j||ed||u,L=ew||w||eh||h,I=(e,t)=>`${e*t}px`,H=()=>"text"===C?(0,t.jsx)("span",{className:"font-semibold text-lg",style:{color:"inherit"},children:k}):"custom"===$&&eF?(0,t.jsx)("img",{src:eF,alt:"Logo",style:{height:`${T}px`,width:"auto",maxWidth:"160px",objectFit:"contain"}}):"full"===B&&P?(0,t.jsx)("img",{src:P,alt:`${ta} logo`,style:{height:`${T}px`,width:"auto",maxWidth:"160px",objectFit:"contain"}}):"mark-text"===B&&L?(0,t.jsxs)("div",{className:"flex items-center",style:{gap:`${.2*T}px`},children:[(0,t.jsx)("img",{src:L,alt:`${ta} logo`,style:{height:I(T,.8),width:"auto"}}),(0,t.jsx)("span",{className:"font-bold",style:{color:"inherit",fontSize:I(T,.4),lineHeight:`${T}px`},children:ta})]}):(0,t.jsx)("span",{className:"font-bold",style:{color:"inherit",fontSize:I(T,.5),lineHeight:`${T}px`},children:ta}),D="logo"===C?T:M,(0,t.jsxs)("div",{className:"p-4 flex items-center justify-between",style:to(),children:["logo"===C?(0,t.jsx)(r.default,{href:"/",onClick:tv,className:"flex items-center",style:{height:`${D}px`},children:H()}):(0,t.jsx)("div",{className:"flex items-center",style:{height:`${D}px`},children:H()}),(0,t.jsxs)("div",{className:"flex items-center",children:[ti&&ea.size>0&&(0,t.jsx)("button",{onClick:()=>es(new Set),className:"hover:opacity-80 p-2 transition-opacity",style:{color:"inherit"},"aria-label":"Collapse all sections",title:"Collapse all",children:(0,t.jsx)(tr,{className:"h-5 w-5"})}),(0,t.jsx)("button",{onClick:tv,className:"hover:opacity-80 p-2 transition-opacity",style:{color:"inherit"},"aria-label":"Close menu",children:(0,t.jsx)(S.X,{className:"h-6 w-6"})})]})]})),(0,t.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto flex flex-col gap-4",children:[(0,t.jsxs)("nav",{className:"px-4",children:[ti&&ty(tp,0),!ti&&"main"===ee&&(0,t.jsx)(t.Fragment,{children:tp.map((e,l)=>{let a=e.children&&e.children.length>0,s=l===tp.length-1;return a?(0,t.jsxs)("button",{onClick:()=>tb(e.id),onMouseEnter:()=>te(e.id),onMouseLeave:()=>te(null),className:`flex items-center justify-between w-full ${tm()}`,style:th(e.id,s),children:[e.label,(0,t.jsx)(E.ChevronRight,{className:"h-5 w-5 shrink-0"})]},e.id):(0,t.jsx)(r.default,{href:e$(e),onClick:tj,onMouseEnter:()=>te(e.id),onMouseLeave:()=>te(null),className:`block ${tm()}`,style:th(e.id,s),children:e.label},e.id)})}),!ti&&"main"!==ee&&tf&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{onClick:()=>
39{if(er.length>1){let e=[...er];e.pop(),el(e),et(e[e.length-1])}},onMouseEnter:()=>te("back-button"),onMouseLeave:()=>te(null),className:`flex items-center gap-2 mb-4 ${tm(!0)}`,style:th("back-button",!0,!0),children:[(0,t.jsx)(tt.ChevronLeft,{className:"h-5 w-5 shrink-0"}),"Back"]}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3 px-2",children:[(0,t.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:tf.label}),(0,t.jsx)(r.default,{href:e$(tf),onClick:tj,className:"text-xs font-medium text-accent hover:underline",children:"View All"})]}),tf.children?.map((e,l)=>{let a=e.children&&e.children.length>0,s=l===(tf.children?.length??0)-1;return a?(0,t.jsxs)("button",{onClick:()=>tb(e.id),onMouseEnter:()=>te(e.id),onMouseLeave:()=>te(null),className:`flex items-center justify-between w-full ${tm()}`,style:th(e.id,s),children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)(E.ChevronRight,{className:"h-5 w-5 shrink-0"})]},e.id):(0,t.jsx)(r.default,{href:e$(e),onClick:tj,onMouseEnter:()=>te(e.id),onMouseLeave:()=>te(null),className:`block ${tm()}`,style:th(e.id,s),children:e.label},e.id)})]})]}),eM&&(A="text"!==eV,O=(0,q.getBackgroundColor)(eq??"@accent"),F=A?{backgroundColor:`color-mix(in srgb, ${O} 10%, transparent)`}:{},(0,t.jsx)("div",{className:"border-t border-border p-4 pb-2",children:K?(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[A&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-muted animate-pulse"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"w-24 h-4 rounded bg-muted animate-pulse mb-1"}),(0,t.jsx)("div",{className:"w-16 h-3 rounded bg-muted animate-pulse"})]})]}):Y?(0,t.jsxs)(r.default,{href:"/account",onClick:tj,onMouseEnter:()=>te("account-link"),onMouseLeave:()=>te(null),className:"flex items-center gap-3",children:[A&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{backgroundColor:O},children:(0,t.jsx)("span",{className:"text-white font-semibold",children:Y.firstName?Y.firstName.charAt(0).toUpperCase():Y.email.charAt(0).toUpperCase()})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold transition-colors",style:{color:"account-link"===e9?td():void 0},children:Y.firstName||Y.email.split("@")[0]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"View Account"})]})]}):(0,t.jsxs)("button",{onClick:()=>{a(),s()},onMouseEnter:()=>te("sign-in-button"),onMouseLeave:()=>te(null),className:"flex items-center gap-3 w-full",children:[A&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:F,children:(0,t.jsx)(i.User,{className:"h-5 w-5",style:{color:O}})}),(0,t.jsxs)("div",{className:"text-left",children:[(0,t.jsx)("p",{className:"font-semibold transition-colors",style:{color:"sign-in-button"===e9?td():void 0},children:"Sign In"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Access your account"})]})]})})),(U="text"!==eV,R=(0,q.getBackgroundColor)(eq??"@accent"),z=U?{backgroundColor:`color-mix(in srgb, ${R} 10%, transparent)`}:{},W=!!J,_=!!Q,X=W||_,(0,t.jsx)("div",{className:"border-t border-border p-4 pt-2",children:X?(0,t.jsxs)("div",{className:"flex flex-col gap-2 w-full",children:[W&&(0,t.jsxs)("button",{onClick:tw,onMouseEnter:()=>te("delivering-to-button"),onMouseLeave:()=>te(null),className:"flex items-center gap-3 w-full",children:[U&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:z,children:(0,t.jsx)(b.Truck,{className:"h-5 w-5",style:{color:R}})}),(0,t.jsxs)("p",{className:"transition-colors",style:{color:"delivering-to-button"===e9?td():void 0},children:["Delivering to ",(0,t.jsx)("span",{className:"font-semibold",children:J.postalCode})]})]}),_&&(0,t.jsxs)("button",{onClick:tw,onMouseEnter:()=>te("pickup-store-button"),onMouseLeave:()=>te(null),className:"flex items-center gap-3 w-full",children:[U&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:z,children:(0,t.jsx)(f.Store,{className:"h-5 w-5",style:{color:R}})}),(0,t.jsxs)("p",{className:"transition-colors",style:{color:"pickup-store-button"===e9?td():void 0},children:["Pickup at ",(0,t.jsx)("span",{className:"font-semibold",children:Q})]})]})]}):(0,t.jsxs)("button",{onClick:tw,onMouseEnter:()=>te("set-location-button"),onMouseLeave:()=>te(null),className:"flex items-center gap-3 w-full",children:[U&&(0,t.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:z,children:(0,t.jsx)(b.Truck,{className:"h-5 w-5",style:{color:R}})}),(0,t.jsxs)("div",{className:"text-left",children:[(0,t.jsx)("p",{className:"font-semibold transition-colors",style:{color:"set-location-button"===e9?td():void 0},children:"Set delivery location"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get accurate shipping estimates"})]})]})}))]})]})})}var ta=e.i(23750);let ts=(0,I.getApiBaseUrl)();async function to(e,t){try{let r=await fetch(`${ts}/api/ecom/customers/opt-in`,{method:"POST",headers:{"Content-Type":"application/json","X-Account-Code":e},body:JSON.stringify(t)});if(!r.ok){let e=await r.json().catch(()=>({}));return{error:e.error||e.message||`Failed to subscribe: ${r.statusText}`}}return{data:await r.json()}}catch(e){return console.error("Error creating opt-in customer:",e),{error:"An unexpected error occurred while subscribing"}}}e.s(["createOptInCustomer",0,to],86024);let tn="masterlinq_popup_dismissed";function ti(){return"u"<typeof document||document.cookie.includes(tn)}let tc=e=>{if(e)return"@primary"===e?"hsl(var(--primary))":"@accent"===e?"hsl(var(--accent))":"transparent"===e?"transparent":`hsl(${e})`},td={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg"},tu={sm:"sm:max-w-3xl",md:"sm:max-w-4xl",lg:"sm:max-w-5xl"};function th({isOpen:e,onClose:r,tenant:l}){let[a,s]=(0,N.useState)(!1),[o,n]=(0,N.useState)(""),[i,c]=(0,N.useState)(""),[d,u]=(0,N.useState)(""),[m,g]=(0,N.useState)(""),[p,x]=(0,N.useState)(!1),[f,b]=(0,N.useState)(!1),[v,y]=(0,N.useState)("simple"),[j,w]=(0,N.useState)("off"),[C,k]=(0,N.useState)(""),[S,$]=(0,N.useState)(""),[T,B]=(0,N.useState)(!1),[E,M]=(0,N.useState)(null),[P,L]=(0,N.useState)(null),[I,H]=(0,N.useState)(null),[D,A]=(0,N.useState)("md"),[O,F]=(0,N.useState)("<h3>Stay in the loop!</h3><p>Subscribe to our newsletter for exclusive deals and updates.</p>"),[U,R]=(0,N.useState)("Subscribe"),[z,V]=(0,N.useState)("You are signing up to receive communication via email and can unsubscribe at any time."),[_,G]=(0,N.useState)(null),[X,Y]=(0,N.useState)("side"),[K,J]=(0,N.useState)("fill"),[Z,Q]=(0,N.useState)(40),[ee,et]=(0,N.useState)(!1);(0,N.useEffect)(()=>{s(window.self!==window.top)},[]),(0,N.useEffect)(()=>
39{if(window.self!==window.top||"1"===new URLSearchParams(window.location.search).get("cardPreview")||ti())return;let e=getComputedStyle(document.documentElement);if("disabled"===e.getPropertyValue("--popup-mode").trim())return;let t=e.getPropertyValue("--popup-delay").trim(),r=t?Number(t):5;if(r<=0)return;let l=setTimeout(()=>{ti()||document.querySelector('[data-slot="dialog-overlay"][data-state="open"], [data-slot="sheet-overlay"][data-state="open"]')||et(!0)},1e3*r);return()=>clearTimeout(l)},[]),(0,N.useEffect)(()=>{let e=e=>e.replace(/^["']|["']$/g,"").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\\\/g,"\\"),t=()=>{let t=getComputedStyle(document.documentElement),r=t.getPropertyValue("--popup-bg").trim();r&&M(r);let l=t.getPropertyValue("--popup-text-color").trim();l&&L(l);let a=t.getPropertyValue("--popup-button-color").trim();a&&H(a);let s=t.getPropertyValue("--popup-width").trim();s&&A(s);let o=e(t.getPropertyValue("--popup-content").trim());o&&F(o);let n=e(t.getPropertyValue("--popup-button-text").trim());n&&R(n);let i=e(t.getPropertyValue("--popup-disclaimer").trim());i&&V(i),G(e(t.getPropertyValue("--popup-image").trim())||null);let c=t.getPropertyValue("--popup-image-placement").trim();c&&Y(c);let d=t.getPropertyValue("--popup-image-fit").trim();d&&J(d);let u=t.getPropertyValue("--popup-image-size").trim();u&&Q(Number(u)||40);let h=t.getPropertyValue("--popup-mode").trim();h&&y(h);let m=t.getPropertyValue("--popup-collect-phone").trim();m&&w(m);let g=e(t.getPropertyValue("--popup-discount-code").trim());g&&k(g);let p=t.getPropertyValue("--popup-discount-code-id").trim();p&&$(p),B("true"===t.getPropertyValue("--popup-preview-confirmation").trim())};t();let r=new MutationObserver(t);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),window.addEventListener("theme-applied",t),()=>{r.disconnect(),window.removeEventListener("theme-applied",t)}},[]);let er=()=>{let e;et(!1),e=new Date(Date.now()+6048e5).toUTCString(),document.cookie=`${tn}=1; expires=${e}; path=/`,x(!1),n(""),c(""),u(""),g(""),r()},el=async e=>{if(e.preventDefault(),a)return;b(!0);let t=await to(l,{firstName:o,lastName:i,email:d,..."off"!==j&&m.trim()?{phone:m.trim()}:{},..."discount"===v&&C?{discountCode:C,discountCodeId:S}:{}});b(!1),t.error&&console.error("Subscriber error:",t.error),x(!0),"simple"===v&&setTimeout(()=>{er()},2e3)},ea=!!_,es="side"===X&&ea,eo=tc(I),en=eo?{backgroundColor:eo}:void 0,ei=P&&"auto"!==P?tc(P):E?(0,q.getContrastColor)(E):void 0,ec=!!E&&(0,q.isDarkBackground)(E),ed=(0,t.jsx)(t.Fragment,{children:(a?T:p)?"discount"===v&&C?(0,t.jsxs)("div",{className:"text-center py-6 space-y-3",children:[(0,t.jsx)("p",{className:"text-lg font-semibold",children:"Here's your discount!"}),(0,t.jsx)("div",{className:"inline-block border-2 border-dashed rounded-lg px-6 py-3",style:{borderColor:eo||"currentColor"},children:(0,t.jsx)("p",{className:"text-2xl font-bold tracking-wider",children:C})}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Use this code at checkout"}),(0,t.jsx)(h.Button,{onClick:()=>navigator.clipboard.writeText(C),className:"h-12 text-base mt-2",style:en,children:"Copy Code"})]}):(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("p",{className:"text-lg font-semibold",children:"Thank you!"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"You've been subscribed."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"popup-content prose prose-sm max-w-none [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-1 [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:mb-1 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-1 [&_p]:text-muted-foreground [&_p]:text-sm [&_p]:mb-0",dangerouslySetInnerHTML:{__html:O}}),(0,t.jsxs)("form",{onSubmit:el,className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(ta.Input,{type:"text",placeholder:"First name",value:o,onChange:e=>n(e.target.value),required:!0,className:"h-12 text-base px-4"}),(0,t.jsx)(ta.Input,{type:"text",placeholder:"Last name",value:i,onChange:e=>c(e.target.value),required:!0,className:"h-12 text-base px-4"})]}),(0,t.jsx)(ta.Input,{type:"email",placeholder:"Enter your email",value:d,onChange:e=>u(e.target.value),required:!0,className:"h-12 text-base px-4"}),"off"!==j&&(0,t.jsx)(ta.Input,{type:"tel",placeholder:"required"===j?"Phone number":"Phone number (optional)",value:m,onChange:e=>g(e.target.value),required:"required"===j,className:"h-12 text-base px-4"}),(0,t.jsx)(h.Button,{type:"submit",className:"w-full h-12 text-base",style:en,disabled:f,children:f?"
39Submitting...":U}),(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)("button",{type:"button",onClick:er,className:"text-sm text-muted-foreground hover:text-foreground transition-colors underline",children:"No, thanks"})})]}),z&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:z})]})}),eu="fit"===K,eh=(0,t.jsx)(t.Fragment,{children:es?(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row",children:[eu?(0,t.jsx)("div",{className:"relative shrink-0 overflow-hidden self-stretch flex items-center justify-center",style:{width:"50%",aspectRatio:"1/1"},children:(0,t.jsx)("img",{src:_,alt:"",className:"object-contain",style:{width:`${Z}%`,height:`${Z}%`}})}):(0,t.jsx)("div",{className:"relative shrink-0 overflow-hidden self-stretch",style:{width:"50%"},children:(0,t.jsx)("img",{src:_,alt:"",className:"absolute inset-0 w-full h-full object-cover"})}),(0,t.jsx)("div",{className:"flex-1 p-8 space-y-4",children:ed})]}):(0,t.jsxs)(t.Fragment,{children:[ea&&"above"===X&&(eu?(0,t.jsx)("div",{className:"relative w-full overflow-hidden flex items-center justify-center",style:{aspectRatio:"4/3"},children:(0,t.jsx)("img",{src:_,alt:"",className:"object-contain rounded-t-lg",style:{width:`${Z}%`,height:`${Z}%`}})}):(0,t.jsx)("div",{className:"relative w-full overflow-hidden",children:(0,t.jsx)("img",{src:_,alt:"",className:"w-full object-cover rounded-t-lg"})})),(0,t.jsx)("div",{className:ea&&"above"===X?"p-6 pt-4 space-y-4":"",children:ed})]})});return"disabled"!==v||a?(0,t.jsx)(W.Dialog,{open:e||ee,onOpenChange:e=>!e&&er(),modal:!a,children:(0,t.jsxs)(W.DialogContent,{className:es?`${tu[D]||tu.md} p-0 overflow-y-auto overflow-x-hidden border-0`:ea&&"above"===X?`${td[D]||td.md} border-0 p-0 overflow-y-auto overflow-x-hidden gap-0`:`${td[D]||td.md} border-0`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),style:{...tc(E)?{backgroundColor:tc(E)}:{},...ei?{color:ei}:{},...ec?{"--foreground":"0 0% 98%","--muted-foreground":"0 0% 70%","--border":"0 0% 30%","--input":"0 0% 30%","--ring":"0 0% 60%"}:{}},children:[(0,t.jsx)(W.DialogTitle,{className:"sr-only",children:"Newsletter Signup"}),eh]})}):null}var tm=e.i(77527);let tg=["http://localhost:5173","https://retailer.masterlinq.io","https://retailer.masterlinq.net","https://retailer.experimental.masterlinq.net"],tp=["header-topbar","header-main","header-promo-banner"];e.s(["HeaderContainer",0,function({tenant:e,layoutType:r,headerConfig:l,alertBannerConfig:a,promoBannerConfig:s,headerSections:o,navigation:n}){let[i,c]=(0,N.useState)(!1),[d,u]=(0,N.useState)(!1),[h,m]=(0,N.useState)(!1),[g,x]=(0,N.useState)(!1),[f,b]=(0,N.useState)(null),v=(0,N.useCallback)(e=>{b(e??null),x(!0)},[]),[y,j]=(0,N.useState)(!1),{isOpen:w,openMiniCart:C,closeMiniCart:k}=(0,p.useMiniCart)(),[S,$]=(0,N.useState)(!0),[T,B]=(0,N.useState)(!1),E=(0,N.useRef)(null),M=(0,N.useCallback)(e=>{E.current=e},[]),[P,L]=(0,N.useState)(o||[]),[I,H]=(0,N.useState)(tp),D=P.length>0;return(0,N.useEffect)(()=>{let e=()=>{let e=getComputedStyle(document.documentElement);$("static"!==e.getPropertyValue("--header-position").trim());let t=e.getPropertyValue("--header-section-order").trim();if(t)try{let e=t.replace(/^['"]|['"]$/g,"");if(e&&"null"!==e){let t=JSON.parse(e);Array.isArray(t)&&t.length>0&&H(t)}}catch{}};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[]),(0,N.useEffect)(()=>{let e=()=>{B(window.scrollY>10)};return e(),window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[]),(0,N.useEffect)(()=>{let e=E.current,t=document.documentElement,r=()=>{e&&S?t.style.setProperty("--header-height",`${e.offsetHeight}px`):t.style.setProperty("--header-height","0px")};if(r(),!e)return;let l=new ResizeObserver(r);return l.observe(e),()=>{l.disconnect(),t.style.removeProperty("--header-height")}},[S]),(0,N.useEffect)(()=>{if(window.self===window.top)return;let e=e=>{tg.includes(e.origin)&&e.data?.type==="updateTheme"&&Array.isArray(e.data?.theme?.globalSections)&&L(e.data.theme.globalSections.filter(e=>"string"==typeof e?.sectionType&&e.sectionType.startsWith("header-")&&!0===e.enabled).sort((e,t)=>
39(e?.order??0)-(t?.order??0)))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),(0,N.useEffect)(()=>{if(window.self===window.top)return;let e=e=>{let{overlay:t,open:r}=e.detail;if(x(!1),b(null),j(!1),k(),c(!1),u(!1),m(!1),r&&t)switch(t){case"overlay-cart-drawer":C();break;case"overlay-mobile-menu":x(!0);break;case"overlay-search-modal":j(!0);break;case"overlay-login-dialog":c(!0);break;case"overlay-location-dialog":u(!0);break;case"overlay-popup-optin":m(!0)}};return window.addEventListener(tm.EDITOR_TOGGLE_OVERLAY_EVENT,e),()=>window.removeEventListener(tm.EDITOR_TOGGLE_OVERLAY_EVENT,e)},[k,C]),(0,t.jsxs)(t.Fragment,{children:[D?P.map(o=>(o=>{let{id:i,sectionType:d,settings:u}=o;switch(d){case"header-topbar":return(0,t.jsx)("div",{"data-section-id":i,"data-section-type":d,className:"w-full",role:"region","aria-label":"Store announcements",children:(0,t.jsx)(ez,{tenant:e,sectionId:i,settings:u,initialConfig:a})},i);case"header-main":return(0,t.jsx)("div",{ref:M,"data-section-id":i,"data-section-type":d,className:`w-full top-0 z-50 transition-shadow duration-200 ${S&&T?"shadow-md":""}`,style:{position:"var(--header-position, sticky)"},children:(0,t.jsx)("header",{className:"w-full",children:(0,t.jsx)(eF,{tenant:e,layoutType:r,config:l,navigation:n,onOpenMobileMenu:()=>v(),onOpenNavDrawerSection:v,onOpenLoginDialog:()=>c(!0),onOpenSearch:()=>j(!0)})})},i);case"header-promo-banner":return(0,t.jsx)("div",{"data-section-id":i,"data-section-type":d,className:"w-full",role:"region","aria-label":"Promotional offers",children:(0,t.jsx)(eW,{sectionId:i,settings:u,initialConfig:s||void 0})},i);default:return null}})(o)):I.map(o=>(o=>{switch(o){case"header-topbar":return(0,t.jsx)("div",{"data-section-type":"header-topbar",className:"w-full",role:"region","aria-label":"Store announcements",children:(0,t.jsx)(ez,{tenant:e,initialConfig:a})},"header-topbar");case"header-main":return(0,t.jsx)("div",{ref:M,"data-section-type":"header-main",className:`w-full top-0 z-50 transition-shadow duration-200 ${S&&T?"shadow-md":""}`,style:{position:"var(--header-position, sticky)"},children:(0,t.jsx)("header",{className:"w-full",children:(0,t.jsx)(eF,{tenant:e,layoutType:r,config:l,navigation:n,onOpenMobileMenu:()=>v(),onOpenNavDrawerSection:v,onOpenLoginDialog:()=>c(!0),onOpenSearch:()=>j(!0)})})},"header-main");case"header-promo-banner":return(0,t.jsx)("div",{"data-section-type":"header-promo-banner",className:"w-full",role:"region","aria-label":"Promotional offers",children:(0,t.jsx)(eW,{initialConfig:s||void 0})},"header-promo-banner");default:return null}})(o)),(0,t.jsx)(eq.LoginDialog,{isOpen:i,onClose:()=>c(!1)}),(0,t.jsx)(e_.LocationPrompt,{open:d,onOpenChange:u,tenant:e}),(0,t.jsx)(te,{tenant:e,isOpen:w,onClose:k}),(0,t.jsx)(tl,{tenant:e,isOpen:g,onClose:()=>x(!1),onOpenLoginDialog:()=>{x(!1),c(!0)},navigation:n,initialPage:f,logoType:l.logoType,logoText:l.logoText,logoUrl:l.logoUrl,logoMarkUrl:l.logoMarkUrl,logoHeight:l.logoHeight,mobileLogoType:l.mobileLogoType,mobileLogoHeight:l.mobileLogoHeight,mobileLogoUrl:l.mobileLogoUrl,mobileLogoMarkUrl:l.mobileLogoMarkUrl}),(0,t.jsx)(ew,{tenant:e,isMobile:!0,isOpen:y,onClose:()=>j(!1)}),(0,t.jsx)(th,{isOpen:h,onClose:()=>m(!1),tenant:e})]})}],70472),e.s([],88736)},79786,e=>{"use strict";var t=e.i(43476),r=e.i(71645);let l={shape:"rounded",style:"soft",showSubmit:!0,typewriter:!0,placeholders:"Search products...\nTry a category\nBrowse brands",height:"regular",showAsButton:!1},a=(0,r.createContext)(null),s="searchExperienceUpdate",o="searchOverlayExperienceUpdate",n="searchV2ConfigUpdate";e.s(["SEARCH_EXPERIENCE_UPDATE_EVENT",0,s,"SEARCH_OVERLAY_EXPERIENCE_UPDATE_EVENT",0,o,"SEARCH_V2_CONFIG_UPDATE_EVENT",0,n,"SearchExperienceProvider",0,function({initialExperience:e="v1",initialOverlayExperience:i="v1",initialV2Config:c,children:d}){let[u,h]=(0,r.useState)(e),[m,g]=(0,r.useState)(i),[p,x]=(0,r.useState)({...l,...c});return(0,r.useEffect)(()=>{let e=e=>{(e.detail?.experience==="v1"||e.detail?.experience==="v2")&&h(e.detail.experience)},t=e=>
39{(e.detail?.experience==="v1"||e.detail?.experience==="v2")&&g(e.detail.experience)},r=e=>{x(t=>{let r={...t};return e.detail?.shape&&(r.shape=e.detail.shape),e.detail?.style&&(r.style=e.detail.style),e.detail?.showSubmit!==void 0&&(r.showSubmit=e.detail.showSubmit),e.detail?.typewriter!==void 0&&(r.typewriter=e.detail.typewriter),e.detail?.placeholders!==void 0&&(r.placeholders=e.detail.placeholders),e.detail?.height&&(r.height=e.detail.height),e.detail?.showAsButton!==void 0&&(r.showAsButton=e.detail.showAsButton),r})};return window.addEventListener(s,e),window.addEventListener(o,t),window.addEventListener(n,r),()=>{window.removeEventListener(s,e),window.removeEventListener(o,t),window.removeEventListener(n,r)}},[]),(0,t.jsx)(a.Provider,{value:{experience:u,overlayExperience:m,v2:p},children:d})},"useSearchExperience",0,function(){let e=(0,r.useContext)(a);return e?.experience??"v1"},"useSearchOverlayExperience",0,function(){let e=(0,r.useContext)(a);return e?.overlayExperience??"v1"},"useSearchV2Config",0,function(){let e=(0,r.useContext)(a);return e?.v2??l}])}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.