@mapfirst.ai/react 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import L from"react";import{MapFirstCore as ot}from"@mapfirst.ai/core";import{processApiFilters as $r,convertToApiFilters as Ur}from"@mapfirst.ai/core";import{useCallback as ce}from"react";import xe from"react";import Le from"react";import{jsx as T,jsxs as Z}from"react/jsx-runtime";var de=({className:e,style:t})=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[T("circle",{cx:"11",cy:"11",r:"8"}),T("path",{d:"m21 21-4.35-4.35"})]}),me=({className:e,style:t})=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[T("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),V=({className:e,style:t})=>Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[T("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),T("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),Y=({className:e,style:t})=>T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:T("polyline",{points:"9 18 15 12 9 6"})}),ge=({className:e,style:t,fill:c="none"})=>T("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:c,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:T("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})});import{jsx as ye}from"react/jsx-runtime";var we={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},Ee={width:"17px",height:"17px"},N=({onClick:e,style:t})=>{let[c,o]=Le.useState(!1);return ye("button",{style:{...we,backgroundColor:c?"#e5e5e5":"white",...t},onClick:e,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"aria-label":"Remove filter",children:ye(me,{style:Ee})})};import{jsx as j,jsxs as Be}from"react/jsx-runtime";var Me={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},X=({label:e,icon:t,remove:c,style:o})=>Be("div",{style:{...Me,...o},children:[t&&j("span",{style:{display:"flex",alignItems:"center"},children:t}),j("span",{style:{whiteSpace:"nowrap"},children:e}),j(N,{onClick:c})]});import{useState as He}from"react";import{useCallback as fe,useState as Ie}from"react";var Te={"smartFilter.typingPrompt":"Search for hotels, restaurants, or attractions...","smartFilter.nav.previous":"Previous filters","smartFilter.nav.next":"Next filters","smartFilter.toast.locationRequired":"Please select a location first","smartFilter.clearAll":"Clear all","smartFilter.minRating.suffix":"+","smartFilter.minRating.label":"{{value}}+","smartFilter.minRating.remove":"Remove rating filter","smartFilter.minRating.setTo":"Set rating to {{rating}}","smartFilter.priceRange.label":"Price Range","smartFilter.priceRange.remove":"Remove price filter","smartFilter.priceRange.edit":"Edit price","smartFilter.transformedQuery.remove":"Remove search query","smartFilter.transformedQuery.edit":"Edit search query","smartFilter.restaurantPriceLevel.label":"Price Level","smartFilter.restaurantPriceLevel.remove":"Remove price level filter","smartFilter.restaurantPriceLevel.none":"Any","smartFilter.restaurantPriceLevel.options.cheapEats":"Cheap Eats","smartFilter.restaurantPriceLevel.options.midRange":"Mid Range","smartFilter.restaurantPriceLevel.options.fineDining":"Fine Dining"},Ne=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),I=(e,t)=>{let[c,o]=Ie("en"),l=fe((b,s)=>{let p={...Te,...e}[b]||b;return s&&Object.keys(s).forEach(u=>{p=p.replace(new RegExp(`{{${u}}}`,"g"),String(s[u]))}),p},[e]),m=fe((b,s)=>t?t(b,s):Ne(b,s),[t]);return{t:l,locale:c,setLocale:o,formatCurrency:m}};import{jsx as q,jsxs as De}from"react/jsx-runtime";var Ae=e=>{let t=[],c=Math.floor(e),o=e%1!==0,l={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},m={...l,backgroundColor:"#03852e"},b={...l,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let i=0;i<c;i+=1)t.push(q("span",{style:m},`full-${i}`));o&&t.push(q("span",{style:b},"half"));let s=Math.max(0,5-Math.ceil(e));for(let i=0;i<s;i+=1)t.push(q("span",{style:l},`empty-${i}`));return t},ht=(e,t)=>De("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[q("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:Ae(e)})," ",t]}),J=e=>e.toFixed(1),bt=(e,t,c,o)=>`${o(e,c)} - ${o(t!=null?t:0,c)}`;import{jsx as z,jsxs as $}from"react/jsx-runtime";var ze={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",gap:"8px",alignItems:"center",justifyContent:"center",flexShrink:0,height:"34px"},Oe={display:"flex",gap:"1px",userSelect:"none"},ee={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},K={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},U=({rating:e,onChange:t,onRemove:c,star:o=!1})=>{let[l,m]=He(null),{t:b}=I(),s=l!=null?l:e,i=h=>o&&h?h.toString():b("smartFilter.minRating.label",{value:J(h)}),p=b("smartFilter.minRating.remove"),u=h=>b("smartFilter.minRating.setTo",{rating:J(h)}),x=h=>{let v=h+1;return s>=v?"full":s>=v-.5?"half":"empty"},f=h=>{m(null),h!==e&&t(h)},R=h=>{var S;let v=h.relatedTarget;(!v||!((S=h.currentTarget.closest("[data-min-rating-chip]"))!=null&&S.contains(v)))&&m(null)};return $("div",{style:ze,"data-min-rating-chip":!0,children:[$("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>m(null),children:[z("div",{style:Oe,children:Array.from({length:5}).map((h,v)=>{let S=x(v),w=v+1,n=w-.5;if(o)return $("div",{style:{position:"relative",width:"16px",height:"16px"},children:[z(ge,{fill:s>=w?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),z("button",{type:"button",style:{...K,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>m(n),onFocus:()=>m(n),onBlur:R,onClick:()=>f(n),"aria-label":u(n),title:i(n)}),z("button",{type:"button",style:{...K,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>m(w),onFocus:()=>m(w),onBlur:R,onClick:()=>f(w),"aria-label":u(w),title:i(w)})]},v);let B=S==="full"?{...ee,backgroundColor:"#03852e"}:ee,D={...ee,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return $("div",{style:{position:"relative",width:"12px",height:"12px"},children:[z("span",{style:S==="half"?D:B}),z("button",{type:"button",style:{...K,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(n),onFocus:()=>m(n),onBlur:R,onClick:()=>f(n),"aria-label":u(n),title:i(n)}),z("button",{type:"button",style:{...K,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(w),onFocus:()=>m(w),onBlur:R,onClick:()=>f(w),"aria-label":u(w),title:i(w)})]},v)})}),z("span",{style:{whiteSpace:"nowrap"},children:i(s)})]}),z(N,{onClick:c})]})};import{useEffect as _e,useState as te}from"react";import{Fragment as qe,jsx as A,jsxs as re}from"react/jsx-runtime";var We={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},Qe={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},Ve={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},he=({boundary:e,label:t,value:c,placeholder:o,currency:l,isOptional:m=!1,showRemoveButton:b=!1,removeLabel:s,editLabel:i,showAddWhenEmpty:p=!1,onCommit:u,onRemove:x})=>{let[f,R]=te(c!==void 0?String(c):""),[h,v]=te(!1),[S,w]=te(!1),n=c!==void 0;_e(()=>{R(c!==void 0?String(c):""),v(!1)},[c]);let B=()=>{R(c!==void 0?String(c):"")},D=()=>{if(f.trim()===""){if(m){u(void 0),R("");return}B();return}let a=Number(f);if(!Number.isFinite(a)){B();return}let P=Math.max(0,a);if(P===c){B();return}u(P)};return re("div",{style:We,children:[A("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),h?A("input",{value:f,onChange:a=>{let P=a.target.value.replace(/[^\d]/g,"");R(P)},onBlur:()=>{D(),v(!1)},onKeyDown:a=>{if(a.key==="Enter"){a.preventDefault(),a.currentTarget.blur(),v(!1);return}if(a.key==="Escape"){a.preventDefault(),B(),a.currentTarget.blur(),v(!1);return}a.key.length===1&&/[0-9]/.test(a.key)||a.key==="Backspace"||a.key==="Delete"||a.key==="Tab"||a.key==="ArrowLeft"||a.key==="ArrowRight"||a.key==="Home"||a.key==="End"||a.preventDefault()},placeholder:o,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:Qe,autoFocus:!0}):n?re("span",{style:{fontSize:"16px"},children:[l,c]}):p?A("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>v(!0),"aria-label":i,children:"+"}):A("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!p||p&&h)&&A("span",{style:{color:"#737373",fontSize:"12px"},children:l}),!h&&(!p||n)&&A("button",{type:"button",style:{...Ve,backgroundColor:S?"#e5e5e5":"transparent"},"aria-label":i,title:i,onClick:()=>v(!0),onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:A(V,{})}),b&&A(N,{onClick:x})]})},ne=({priceRange:e,currency:t,onChange:c,onRemove:o})=>{let{t:l}=I(),m="Min",b="Max",s=l("smartFilter.priceRange.remove"),i=l("smartFilter.priceRange.edit"),p=(u,x)=>{let f={min:e.min,max:e.max};u==="min"?(f.min=x,x!==void 0&&e.max!==void 0&&x>e.max&&(f.max=x)):(f.max=x,x!==void 0&&e.min!==void 0&&x<e.min&&(f.min=x)),(f.min!==e.min||f.max!==e.max)&&c(f)};return re(qe,{children:[A(he,{boundary:"min",label:m,value:e.min,currency:t,editLabel:i,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:u=>p("min",u),onRemove:o}),A(he,{boundary:"max",label:b,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:s,editLabel:i,showAddWhenEmpty:!0,onCommit:u=>p("max",u),onRemove:o})]})};import{jsx as Q,jsxs as G}from"react/jsx-runtime";var Ke={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"16px",flexShrink:0,height:"34px"},be=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],oe=({values:e,onChange:t,onRemove:c})=>{let{t:o}=I(),l=o("smartFilter.restaurantPriceLevel.label"),m=o("smartFilter.restaurantPriceLevel.remove"),b=o("smartFilter.restaurantPriceLevel.none"),s=i=>{let{value:p,checked:u}=i.target,x=p,f=new Set(e);u?f.add(x):f.delete(x);let R=be.filter(h=>f.has(h.value)).map(h=>h.value);t(R)};return G("div",{style:Ke,children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[Q("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:l}),G("div",{style:{display:"flex",gap:"12px"},children:[be.map(i=>{let p=o(`smartFilter.restaurantPriceLevel.options.${i.key}`),u=`price-level-${i.key}`;return G("label",{htmlFor:u,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[Q("input",{id:u,type:"checkbox",value:i.value,checked:e.includes(i.value),onChange:s,style:{accentColor:"#03852e",cursor:"pointer"}}),Q("span",{children:p})]},i.value)}),e.length===0&&Q("span",{style:{fontSize:"12px",color:"#737373"},children:b})]})]}),Q(N,{onClick:c})]})};import{useEffect as $e,useRef as Ue,useState as ie}from"react";import{jsx as _,jsxs as je}from"react/jsx-runtime";var Ge={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,userSelect:"none",height:"34px"},Ye={backgroundColor:"#ececec",borderRadius:"2px",padding:"2px 8px",outline:"none",fontSize:"16px",minWidth:"8ch",border:"none"},Ze={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",color:"#737373",border:"none",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},ae=({value:e,onChange:t,onRemove:c})=>{let o=Ue(null),[l,m]=ie(e),[b,s]=ie(!1),[i,p]=ie(!1),{t:u}=I(),x=u("smartFilter.transformedQuery.remove"),f=u("smartFilter.transformedQuery.edit");$e(()=>{m(e),s(!1)},[e]);let R=()=>{let S=l.trim();if(!S.length){m(e);return}S!==e&&t(S)};return je("div",{style:Ge,children:[_(de,{style:{width:"16px",height:"16px",color:"#03852e"}}),b?_("input",{ref:o,value:l,onChange:S=>{m(S.target.value)},onBlur:()=>{R(),s(!1)},onKeyDown:S=>{if(S.key==="Enter"){S.preventDefault(),S.currentTarget.blur();return}if(S.key==="Escape"){S.preventDefault(),m(e),S.currentTarget.blur();return}},"aria-label":f,style:Ye,autoFocus:!0}):_("span",{style:{fontSize:"16px"},children:e}),!b&&_("button",{type:"button",style:{...Ze,backgroundColor:i?"#e5e5e5":"transparent"},"aria-label":f,title:f,onClick:()=>s(!0),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:_(V,{})}),_(N,{onClick:c})]})};import{useCallback as Se,useEffect as Xe,useRef as Je,useState as Ce}from"react";var se=e=>{let t=Je(null),[c,o]=Ce(!0),[l,m]=Ce(!0),b=Se(()=>{let i=t.current;if(!i){o(!0),m(!0);return}let{scrollLeft:p,scrollWidth:u,clientWidth:x}=i;o(p<=0),m(p+x>=u-1)},[]);Xe(()=>{let i=t.current;if(b(),!i)return;let p=()=>b();return i.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",b),()=>{i.removeEventListener("scroll",p),window.removeEventListener("resize",b)}},[e,b]);let s=Se(i=>{let p=t.current;if(!p)return;let u=p.clientWidth*.7;p.scrollBy({left:i==="next"?u:-u,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:c,atEnd:l,scrollByDir:s}};import{jsx as M,jsxs as Fe}from"react/jsx-runtime";var et={position:"relative",width:"100%"},tt={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},ve={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},ke={position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"white",color:"#003c30",border:"1px solid #003c30",padding:"4px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",cursor:"pointer"},le=({filters:e,currency:t,minRatingSuffix:c,clearAllLabel:o,previousFiltersLabel:l,nextFiltersLabel:m,formatCurrency:b,onFilterChange:s,onResetFilters:i,onClearAll:p})=>{let{scrollerRef:u,atStart:x,atEnd:f,scrollByDir:R}=se(e.length),[h,v]=xe.useState(null),[S,w]=xe.useState(!1);return Fe("div",{style:et,children:[Fe("div",{ref:u,style:{...tt,padding:"8px",WebkitOverflowScrolling:"touch"},children:[M("style",{children:`
1
+ import R from"react";import{MapFirstCore as Ge}from"@mapfirst.ai/core";import{processApiFilters as Dr,convertToApiFilters as Hr}from"@mapfirst.ai/core";import{useCallback as re}from"react";import de from"react";import he from"react";import{jsx as M,jsxs as V}from"react/jsx-runtime";var ne=({className:e,style:t})=>V("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[M("circle",{cx:"11",cy:"11",r:"8"}),M("path",{d:"m21 21-4.35-4.35"})]}),oe=({className:e,style:t})=>V("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[M("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),M("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),D=({className:e,style:t})=>V("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[M("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),M("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),Q=({className:e,style:t})=>M("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:M("polyline",{points:"9 18 15 12 9 6"})}),ie=({className:e,style:t,fill:p="none"})=>M("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:p,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:M("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})});import{jsx as ae}from"react/jsx-runtime";var be={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},Ce={width:"17px",height:"17px"},E=({onClick:e,style:t})=>{let[p,i]=he.useState(!1);return ae("button",{style:{...be,backgroundColor:p?"#e5e5e5":"white",...t},onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-label":"Remove filter",children:ae(oe,{style:Ce})})};import{jsx as q,jsxs as ve}from"react/jsx-runtime";var xe={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},K=({label:e,icon:t,remove:p,style:i})=>ve("div",{style:{...xe,...i},children:[t&&q("span",{style:{display:"flex",alignItems:"center"},children:t}),q("span",{style:{whiteSpace:"nowrap"},children:e}),q(E,{onClick:p})]});import{useState as Le}from"react";import{useCallback as se,useState as Se}from"react";var ke={"smartFilter.typingPrompt":"Search for hotels, restaurants, or attractions...","smartFilter.nav.previous":"Previous filters","smartFilter.nav.next":"Next filters","smartFilter.toast.locationRequired":"Please select a location first","smartFilter.clearAll":"Clear all","smartFilter.minRating.suffix":"+","smartFilter.minRating.label":"{{value}}+","smartFilter.minRating.remove":"Remove rating filter","smartFilter.minRating.setTo":"Set rating to {{rating}}","smartFilter.priceRange.label":"Price Range","smartFilter.priceRange.remove":"Remove price filter","smartFilter.priceRange.edit":"Edit price","smartFilter.transformedQuery.remove":"Remove search query","smartFilter.transformedQuery.edit":"Edit search query","smartFilter.restaurantPriceLevel.label":"Price Level","smartFilter.restaurantPriceLevel.remove":"Remove price level filter","smartFilter.restaurantPriceLevel.none":"Any","smartFilter.restaurantPriceLevel.options.cheapEats":"Cheap Eats","smartFilter.restaurantPriceLevel.options.midRange":"Mid Range","smartFilter.restaurantPriceLevel.options.fineDining":"Fine Dining"},Fe=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),w=(e,t)=>{let[p,i]=Se("en"),c=se((h,s)=>{let m={...ke,...e}[h]||h;return s&&Object.keys(s).forEach(g=>{m=m.replace(new RegExp(`{{${g}}}`,"g"),String(s[g]))}),m},[e]),y=se((h,s)=>t?t(h,s):Fe(h,s),[t]);return{t:c,locale:p,setLocale:i,formatCurrency:y}};import{jsx as H,jsxs as Pe}from"react/jsx-runtime";var Re=e=>{let t=[],p=Math.floor(e),i=e%1!==0,c={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},y={...c,backgroundColor:"#03852e"},h={...c,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let a=0;a<p;a+=1)t.push(H("span",{style:y},`full-${a}`));i&&t.push(H("span",{style:h},"half"));let s=Math.max(0,5-Math.ceil(e));for(let a=0;a<s;a+=1)t.push(H("span",{style:c},`empty-${a}`));return t},st=(e,t)=>Pe("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[H("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:Re(e)})," ",t]}),$=e=>e.toFixed(1),lt=(e,t,p,i)=>`${i(e,p)} - ${i(t!=null?t:0,p)}`;import{jsx as T,jsxs as O}from"react/jsx-runtime";var we={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",gap:"8px",alignItems:"center",justifyContent:"center",flexShrink:0,height:"34px"},Me={display:"flex",gap:"1px",userSelect:"none"},U={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},z={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},_=({rating:e,onChange:t,onRemove:p,star:i=!1})=>{let[c,y]=Le(null),{t:h}=w(),s=c!=null?c:e,a=b=>i&&b?b.toString():h("smartFilter.minRating.label",{value:$(b)}),m=h("smartFilter.minRating.remove"),g=b=>h("smartFilter.minRating.setTo",{rating:$(b)}),x=b=>{let C=b+1;return s>=C?"full":s>=C-.5?"half":"empty"},f=b=>{y(null),b!==e&&t(b)},k=b=>{var v;let C=b.relatedTarget;(!C||!((v=b.currentTarget.closest("[data-min-rating-chip]"))!=null&&v.contains(C)))&&y(null)};return O("div",{style:we,"data-min-rating-chip":!0,children:[O("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>y(null),children:[T("div",{style:Me,children:Array.from({length:5}).map((b,C)=>{let v=x(C),l=C+1,n=l-.5;if(i)return O("div",{style:{position:"relative",width:"16px",height:"16px"},children:[T(ie,{fill:s>=l?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),T("button",{type:"button",style:{...z,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>y(n),onFocus:()=>y(n),onBlur:k,onClick:()=>f(n),"aria-label":g(n),title:a(n)}),T("button",{type:"button",style:{...z,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>y(l),onFocus:()=>y(l),onBlur:k,onClick:()=>f(l),"aria-label":g(l),title:a(l)})]},C);let S=v==="full"?{...U,backgroundColor:"#03852e"}:U,u={...U,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return O("div",{style:{position:"relative",width:"12px",height:"12px"},children:[T("span",{style:v==="half"?u:S}),T("button",{type:"button",style:{...z,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>y(n),onFocus:()=>y(n),onBlur:k,onClick:()=>f(n),"aria-label":g(n),title:a(n)}),T("button",{type:"button",style:{...z,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>y(l),onFocus:()=>y(l),onBlur:k,onClick:()=>f(l),"aria-label":g(l),title:a(l)})]},C)})}),T("span",{style:{whiteSpace:"nowrap"},children:a(s)})]}),T(E,{onClick:p})]})};import{useEffect as Ee,useState as G}from"react";import{Fragment as Ne,jsx as I,jsxs as Y}from"react/jsx-runtime";var Ie={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},Te={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},Be={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},le=({boundary:e,label:t,value:p,placeholder:i,currency:c,isOptional:y=!1,showRemoveButton:h=!1,removeLabel:s,editLabel:a,showAddWhenEmpty:m=!1,onCommit:g,onRemove:x})=>{let[f,k]=G(p!==void 0?String(p):""),[b,C]=G(!1),[v,l]=G(!1),n=p!==void 0;Ee(()=>{k(p!==void 0?String(p):""),C(!1)},[p]);let S=()=>{k(p!==void 0?String(p):"")},u=()=>{if(f.trim()===""){if(y){g(void 0),k("");return}S();return}let r=Number(f);if(!Number.isFinite(r)){S();return}let F=Math.max(0,r);if(F===p){S();return}g(F)};return Y("div",{style:Ie,children:[I("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),b?I("input",{value:f,onChange:r=>{let F=r.target.value.replace(/[^\d]/g,"");k(F)},onBlur:()=>{u(),C(!1)},onKeyDown:r=>{if(r.key==="Enter"){r.preventDefault(),r.currentTarget.blur(),C(!1);return}if(r.key==="Escape"){r.preventDefault(),S(),r.currentTarget.blur(),C(!1);return}r.key.length===1&&/[0-9]/.test(r.key)||r.key==="Backspace"||r.key==="Delete"||r.key==="Tab"||r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="Home"||r.key==="End"||r.preventDefault()},placeholder:i,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:Te,autoFocus:!0}):n?Y("span",{style:{fontSize:"16px"},children:[c,p]}):m?I("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>C(!0),"aria-label":a,children:"+"}):I("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!m||m&&b)&&I("span",{style:{color:"#737373",fontSize:"12px"},children:c}),!b&&(!m||n)&&I("button",{type:"button",style:{...Be,backgroundColor:v?"#e5e5e5":"transparent"},"aria-label":a,title:a,onClick:()=>C(!0),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:I(D,{})}),h&&I(E,{onClick:x})]})},Z=({priceRange:e,currency:t,onChange:p,onRemove:i})=>{let{t:c}=w(),y="Min",h="Max",s=c("smartFilter.priceRange.remove"),a=c("smartFilter.priceRange.edit"),m=(g,x)=>{let f={min:e.min,max:e.max};g==="min"?(f.min=x,x!==void 0&&e.max!==void 0&&x>e.max&&(f.max=x)):(f.max=x,x!==void 0&&e.min!==void 0&&x<e.min&&(f.min=x)),(f.min!==e.min||f.max!==e.max)&&p(f)};return Y(Ne,{children:[I(le,{boundary:"min",label:y,value:e.min,currency:t,editLabel:a,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:g=>m("min",g),onRemove:i}),I(le,{boundary:"max",label:h,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:s,editLabel:a,showAddWhenEmpty:!0,onCommit:g=>m("max",g),onRemove:i})]})};import{jsx as A,jsxs as W}from"react/jsx-runtime";var Ae={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"16px",flexShrink:0,height:"34px"},ce=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],j=({values:e,onChange:t,onRemove:p})=>{let{t:i}=w(),c=i("smartFilter.restaurantPriceLevel.label"),y=i("smartFilter.restaurantPriceLevel.remove"),h=i("smartFilter.restaurantPriceLevel.none"),s=a=>{let{value:m,checked:g}=a.target,x=m,f=new Set(e);g?f.add(x):f.delete(x);let k=ce.filter(b=>f.has(b.value)).map(b=>b.value);t(k)};return W("div",{style:Ae,children:[W("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[A("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:c}),W("div",{style:{display:"flex",gap:"12px"},children:[ce.map(a=>{let m=i(`smartFilter.restaurantPriceLevel.options.${a.key}`),g=`price-level-${a.key}`;return W("label",{htmlFor:g,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[A("input",{id:g,type:"checkbox",value:a.value,checked:e.includes(a.value),onChange:s,style:{accentColor:"#03852e",cursor:"pointer"}}),A("span",{children:m})]},a.value)}),e.length===0&&A("span",{style:{fontSize:"12px",color:"#737373"},children:h})]})]}),A(E,{onClick:p})]})};import{useEffect as De,useRef as He,useState as X}from"react";import{jsx as N,jsxs as We}from"react/jsx-runtime";var ze={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,userSelect:"none",height:"34px"},Oe={backgroundColor:"#ececec",borderRadius:"2px",padding:"2px 8px",outline:"none",fontSize:"16px",minWidth:"8ch",border:"none"},_e={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",color:"#737373",border:"none",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},J=({value:e,onChange:t,onRemove:p})=>{let i=He(null),[c,y]=X(e),[h,s]=X(!1),[a,m]=X(!1),{t:g}=w(),x=g("smartFilter.transformedQuery.remove"),f=g("smartFilter.transformedQuery.edit");De(()=>{y(e),s(!1)},[e]);let k=()=>{let v=c.trim();if(!v.length){y(e);return}v!==e&&t(v)};return We("div",{style:ze,children:[N(ne,{style:{width:"16px",height:"16px",color:"#03852e"}}),h?N("input",{ref:i,value:c,onChange:v=>{y(v.target.value)},onBlur:()=>{k(),s(!1)},onKeyDown:v=>{if(v.key==="Enter"){v.preventDefault(),v.currentTarget.blur();return}if(v.key==="Escape"){v.preventDefault(),y(e),v.currentTarget.blur();return}},"aria-label":f,style:Oe,autoFocus:!0}):N("span",{style:{fontSize:"16px"},children:e}),!h&&N("button",{type:"button",style:{..._e,backgroundColor:a?"#e5e5e5":"transparent"},"aria-label":f,title:f,onClick:()=>s(!0),onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:N(D,{})}),N(E,{onClick:p})]})};import{useCallback as pe,useEffect as Qe,useRef as Ve,useState as ue}from"react";var ee=e=>{let t=Ve(null),[p,i]=ue(!0),[c,y]=ue(!0),h=pe(()=>{let a=t.current;if(!a){i(!0),y(!0);return}let{scrollLeft:m,scrollWidth:g,clientWidth:x}=a;i(m<=0),y(m+x>=g-1)},[]);Qe(()=>{let a=t.current;if(h(),!a)return;let m=()=>h();return a.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",h),()=>{a.removeEventListener("scroll",m),window.removeEventListener("resize",h)}},[e,h]);let s=pe(a=>{let m=t.current;if(!m)return;let g=m.clientWidth*.7;m.scrollBy({left:a==="next"?g:-g,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:p,atEnd:c,scrollByDir:s}};import{jsx as L,jsxs as ye}from"react/jsx-runtime";var qe={position:"relative",width:"100%"},Ke={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},me={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},ge={position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"white",color:"#003c30",border:"1px solid #003c30",padding:"4px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",cursor:"pointer"},te=({filters:e,currency:t,minRatingSuffix:p,clearAllLabel:i,previousFiltersLabel:c,nextFiltersLabel:y,formatCurrency:h,onFilterChange:s,onResetFilters:a,onClearAll:m})=>{let{scrollerRef:g,atStart:x,atEnd:f,scrollByDir:k}=ee(e.length),[b,C]=de.useState(null),[v,l]=de.useState(!1);return ye("div",{style:qe,children:[ye("div",{ref:g,style:{...Ke,padding:"8px",WebkitOverflowScrolling:"touch"},children:[L("style",{children:`
2
2
  div::-webkit-scrollbar {
3
3
  display: none;
4
4
  }
5
- `}),e.map(n=>{var D,O,W;let B=()=>M(X,{label:n.label,icon:n.icon,remove:()=>{s(e.filter(a=>a.id!==n.id))}},n.id);if(n.type==="minRating"){let a=(D=n.numericValue)!=null?D:Number(n.value);return Number.isFinite(a)?M(U,{rating:a,onChange:P=>{let E=e.map(H=>H.id===n.id?{...H,numericValue:P,value:String(P)}:H);s(E)},onRemove:()=>void s(e.filter(P=>P.id!==n.id))},n.id):B()}if(n.type==="starRating"){let a=(O=n.numericValue)!=null?O:Number(n.value);return Number.isFinite(a)?M(U,{star:!0,rating:a,onChange:P=>{let E=e.map(H=>H.id===n.id?{...H,numericValue:P,value:String(P)}:H);s(E)},onRemove:()=>void s(e.filter(P=>P.id!==n.id))},n.id):B()}return n.type==="priceRange"&&n.priceRange?M(ne,{priceRange:n.priceRange,currency:t,onChange:a=>{let P=e.map(E=>E.id===n.id?{...E,priceRange:a}:E);s(P)},onRemove:()=>void s(e.filter(a=>a.id!==n.id))},n.id):n.type==="transformed_query"?M(ae,{value:n.value,onChange:a=>{let P=e.map(E=>E.id===n.id?{...E,value:a}:E);s(P)},onRemove:()=>void s(e.filter(a=>a.id!==n.id))},n.id):n.type==="selected_restaurant_price_levels"?M(oe,{values:(W=n.priceLevels)!=null?W:[],onChange:a=>{let P=e.map(E=>E.id===n.id?{...E,priceLevels:a}:E);s(P)},onRemove:()=>void s(e.filter(a=>a.id!==n.id))},n.id):B()}),M("button",{style:{flexShrink:0,padding:"4px 16px",borderRadius:"9999px",cursor:"pointer",fontSize:"14px",userSelect:"none",backgroundColor:S?"#eee":"white",color:"black",border:"1px solid #03852e"},onClick:p,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:o})]}),!x&&M("div",{"aria-hidden":"true",style:{...ve,left:0,background:"linear-gradient(to right, white, transparent)"}}),!f&&M("div",{"aria-hidden":"true",style:{...ve,right:0,background:"linear-gradient(to left, white, transparent)"}}),!x&&M("button",{type:"button","aria-label":l,style:{...ke,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:h==="prev"?"#e5e5e5":"white"},onClick:()=>R("prev"),onMouseEnter:()=>v("prev"),onMouseLeave:()=>v(null),children:M(Y,{style:{width:"20px",height:"20px"}})}),!f&&M("button",{type:"button","aria-label":m,style:{...ke,right:"4px",backgroundColor:h==="next"?"#e5e5e5":"white"},onClick:()=>R("next"),onMouseEnter:()=>v("next"),onMouseLeave:()=>v(null),children:M(Y,{style:{width:"20px",height:"20px"}})})]})};import{jsx as Re}from"react/jsx-runtime";var rt={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},nt=({filters:e,isSearching:t=!1,onFilterChange:c,customTranslations:o,currency:l="USD",containerStyle:m,style:b})=>{let{t:s,formatCurrency:i}=I(o),p=s("smartFilter.minRating.suffix"),u=s("smartFilter.nav.previous"),x=s("smartFilter.nav.next"),f=s("smartFilter.clearAll"),R=ce(async(S,w)=>{if(!t)try{await c(S)}catch(n){console.error("Filter change error:",n)}},[t,c]),h=ce(()=>{R([])},[R]),v=ce(()=>{R([],!0)},[R]);return Re("div",{style:{...rt,...m},children:e.length>0&&Re(le,{filters:e,currency:l,minRatingSuffix:p,clearAllLabel:f,previousFiltersLabel:u,nextFiltersLabel:x,formatCurrency:i,onFilterChange:R,onResetFilters:h,onClearAll:v})})};function Vr(e){let t=L.useRef(null),[c,o]=L.useState(null),l=L.useRef(e);L.useEffect(()=>{l.current=e}),L.useEffect(()=>{let F=l.current,k={adapter:null,...F,callbacks:{...F.callbacks,onPropertiesChange:d=>{var r,g;o(y=>y?{...y,properties:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onPropertiesChange)==null||g.call(r,d)},onSelectedPropertyChange:d=>{var r,g;o(y=>y?{...y,selectedPropertyId:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onSelectedPropertyChange)==null||g.call(r,d)},onPrimaryTypeChange:d=>{var r,g;o(y=>y?{...y,primary:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onPrimaryTypeChange)==null||g.call(r,d)},onFiltersChange:d=>{var r,g;o(y=>y?{...y,filters:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onFiltersChange)==null||g.call(r,d)},onBoundsChange:d=>{var r,g;o(y=>y?{...y,bounds:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onBoundsChange)==null||g.call(r,d)},onPendingBoundsChange:d=>{var r,g;o(y=>y?{...y,pendingBounds:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onPendingBoundsChange)==null||g.call(r,d)},onCenterChange:(d,r)=>{var g,y;o(ue=>ue?{...ue,center:d,zoom:r}:null),(y=(g=l.current.callbacks)==null?void 0:g.onCenterChange)==null||y.call(g,d,r)},onZoomChange:d=>{var r,g;o(y=>y?{...y,zoom:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onZoomChange)==null||g.call(r,d)},onActiveLocationChange:d=>{var r,g;o(y=>y?{...y,activeLocation:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onActiveLocationChange)==null||g.call(r,d)},onLoadingStateChange:d=>{var r,g;o(y=>y?{...y,initialLoading:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onLoadingStateChange)==null||g.call(r,d)},onSearchingStateChange:d=>{var r,g;o(y=>y?{...y,isSearching:d}:null),(g=(r=l.current.callbacks)==null?void 0:r.onSearchingStateChange)==null||g.call(r,d)}}},C=new ot(k);return t.current=C,o(C.getState()),()=>{C.destroy(),t.current=null,o(null)}},[]);let m=L.useCallback(F=>{t.current&&t.current.setPrimaryType(F)},[]),b=L.useCallback(F=>{t.current&&t.current.setSelectedMarker(F)},[]),s=L.useCallback((F,k=!0)=>{t.current&&t.current.setUseApi(F,k)},[]),[i,p]=L.useState(!1),[u,x]=L.useState(null),f=L.useMemo(()=>({search:async F=>{if(!t.current){let k=new Error("MapFirst instance not available");throw x(k),k}p(!0),x(null);try{return await t.current.runPropertiesSearch({...F,onError:C=>{let d=C instanceof Error?C:new Error(String(C));x(d)}})}catch(k){let C=k instanceof Error?k:new Error(String(k));throw x(C),C}finally{p(!1)}},isLoading:i,error:u}),[i,u]),[R,h]=L.useState(!1),[v,S]=L.useState(null),w=L.useMemo(()=>({search:async F=>{if(!t.current){let k=new Error("MapFirst instance not available");throw S(k),k}h(!0),S(null);try{return await t.current.runSmartFilterSearch({...F,onError:C=>{let d=C instanceof Error?C:new Error(String(C));S(d)}})}catch(k){let C=k instanceof Error?k:new Error(String(k));throw S(C),C}finally{h(!1)}},isLoading:R,error:v}),[R,v]),[n,B]=L.useState(!1),[D,O]=L.useState(null),W=L.useMemo(()=>({perform:async()=>{if(!t.current)return null;B(!0),O(null);try{return await t.current.performBoundsSearch()}catch(F){let k=F instanceof Error?F:new Error(String(F));throw O(k),k}finally{B(!1)}},isSearching:n,error:D}),[n,D]),a=L.useRef(!1),P=L.useCallback((F,k,C)=>{t.current&&F&&!a.current&&(t.current.attachMap(F,{platform:"maplibre",maplibregl:k,onMarkerClick:C==null?void 0:C.onMarkerClick}),a.current=!0)},[]),E=L.useRef(!1),H=L.useCallback((F,k,C)=>{t.current&&F&&!E.current&&(t.current.attachMap(F,{platform:"google",google:k,onMarkerClick:C==null?void 0:C.onMarkerClick}),E.current=!0)},[]),pe=L.useRef(!1),Pe=L.useCallback((F,k,C)=>{t.current&&F&&!pe.current&&(t.current.attachMap(F,{platform:"mapbox",mapboxgl:k,onMarkerClick:C==null?void 0:C.onMarkerClick}),pe.current=!0)},[]);return{instance:t.current,state:c,setPrimaryType:m,setSelectedMarker:b,setUseApi:s,propertiesSearch:f,smartFilterSearch:w,boundsSearch:W,attachMapLibre:P,attachGoogle:H,attachMapbox:Pe}}export{X as Chip,me as CloseIcon,V as EditIcon,le as FilterChips,U as MinRatingFilterChip,Y as NextIcon,ne as PriceRangeFilterChip,oe as RestaurantPriceLevelChip,de as SearchIcon,nt as SmartFilter,ge as StarIcon,ae as TransformedQueryChip,Ur as convertToApiFilters,ht as createMinRatingFilterLabel,bt as createPriceRangeFilterLabel,J as formatRatingValue,$r as processApiFilters,Ae as renderStars,se as useFilterScroll,Vr as useMapFirst,I as useTranslation};
5
+ `}),e.map(n=>{var u,o,d;let S=()=>L(K,{label:n.label,icon:n.icon,remove:()=>{s(e.filter(r=>r.id!==n.id))}},n.id);if(n.type==="minRating"){let r=(u=n.numericValue)!=null?u:Number(n.value);return Number.isFinite(r)?L(_,{rating:r,onChange:F=>{let P=e.map(B=>B.id===n.id?{...B,numericValue:F,value:String(F)}:B);s(P)},onRemove:()=>void s(e.filter(F=>F.id!==n.id))},n.id):S()}if(n.type==="starRating"){let r=(o=n.numericValue)!=null?o:Number(n.value);return Number.isFinite(r)?L(_,{star:!0,rating:r,onChange:F=>{let P=e.map(B=>B.id===n.id?{...B,numericValue:F,value:String(F)}:B);s(P)},onRemove:()=>void s(e.filter(F=>F.id!==n.id))},n.id):S()}return n.type==="priceRange"&&n.priceRange?L(Z,{priceRange:n.priceRange,currency:t,onChange:r=>{let F=e.map(P=>P.id===n.id?{...P,priceRange:r}:P);s(F)},onRemove:()=>void s(e.filter(r=>r.id!==n.id))},n.id):n.type==="transformed_query"?L(J,{value:n.value,onChange:r=>{let F=e.map(P=>P.id===n.id?{...P,value:r}:P);s(F)},onRemove:()=>void s(e.filter(r=>r.id!==n.id))},n.id):n.type==="selected_restaurant_price_levels"?L(j,{values:(d=n.priceLevels)!=null?d:[],onChange:r=>{let F=e.map(P=>P.id===n.id?{...P,priceLevels:r}:P);s(F)},onRemove:()=>void s(e.filter(r=>r.id!==n.id))},n.id):S()}),L("button",{style:{flexShrink:0,padding:"4px 16px",borderRadius:"9999px",cursor:"pointer",fontSize:"14px",userSelect:"none",backgroundColor:v?"#eee":"white",color:"black",border:"1px solid #03852e"},onClick:m,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:i})]}),!x&&L("div",{"aria-hidden":"true",style:{...me,left:0,background:"linear-gradient(to right, white, transparent)"}}),!f&&L("div",{"aria-hidden":"true",style:{...me,right:0,background:"linear-gradient(to left, white, transparent)"}}),!x&&L("button",{type:"button","aria-label":c,style:{...ge,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:b==="prev"?"#e5e5e5":"white"},onClick:()=>k("prev"),onMouseEnter:()=>C("prev"),onMouseLeave:()=>C(null),children:L(Q,{style:{width:"20px",height:"20px"}})}),!f&&L("button",{type:"button","aria-label":y,style:{...ge,right:"4px",backgroundColor:b==="next"?"#e5e5e5":"white"},onClick:()=>k("next"),onMouseEnter:()=>C("next"),onMouseLeave:()=>C(null),children:L(Q,{style:{width:"20px",height:"20px"}})})]})};import{jsx as fe}from"react/jsx-runtime";var $e={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},Ue=({filters:e,isSearching:t=!1,onFilterChange:p,customTranslations:i,currency:c="USD",containerStyle:y,style:h})=>{let{t:s,formatCurrency:a}=w(i),m=s("smartFilter.minRating.suffix"),g=s("smartFilter.nav.previous"),x=s("smartFilter.nav.next"),f=s("smartFilter.clearAll"),k=re(async(v,l)=>{if(!t)try{await p(v)}catch(n){console.error("Filter change error:",n)}},[t,p]),b=re(()=>{k([])},[k]),C=re(()=>{k([],!0)},[k]);return fe("div",{style:{...$e,...y},children:e.length>0&&fe(te,{filters:e,currency:c,minRatingSuffix:m,clearAllLabel:f,previousFiltersLabel:g,nextFiltersLabel:x,formatCurrency:a,onFilterChange:k,onResetFilters:b,onClearAll:C})})};function Br(e){let t=R.useRef(null),[p,i]=R.useState(null),c=R.useRef(e);R.useEffect(()=>{c.current=e}),R.useEffect(()=>{let l=c.current,n={adapter:null,...l,callbacks:{...l.callbacks,onPropertiesChange:u=>{var o,d;i(r=>r?{...r,properties:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onPropertiesChange)==null||d.call(o,u)},onSelectedPropertyChange:u=>{var o,d;i(r=>r?{...r,selectedPropertyId:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onSelectedPropertyChange)==null||d.call(o,u)},onPrimaryTypeChange:u=>{var o,d;i(r=>r?{...r,primary:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onPrimaryTypeChange)==null||d.call(o,u)},onFiltersChange:u=>{var o,d;i(r=>r?{...r,filters:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onFiltersChange)==null||d.call(o,u)},onBoundsChange:u=>{var o,d;i(r=>r?{...r,bounds:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onBoundsChange)==null||d.call(o,u)},onPendingBoundsChange:u=>{var o,d;i(r=>r?{...r,pendingBounds:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onPendingBoundsChange)==null||d.call(o,u)},onCenterChange:(u,o)=>{var d,r;i(F=>F?{...F,center:u,zoom:o}:null),(r=(d=c.current.callbacks)==null?void 0:d.onCenterChange)==null||r.call(d,u,o)},onZoomChange:u=>{var o,d;i(r=>r?{...r,zoom:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onZoomChange)==null||d.call(o,u)},onActiveLocationChange:u=>{var o,d;i(r=>r?{...r,activeLocation:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onActiveLocationChange)==null||d.call(o,u)},onLoadingStateChange:u=>{var o,d;i(r=>r?{...r,initialLoading:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onLoadingStateChange)==null||d.call(o,u)},onSearchingStateChange:u=>{var o,d;i(r=>r?{...r,isSearching:u}:null),(d=(o=c.current.callbacks)==null?void 0:o.onSearchingStateChange)==null||d.call(o,u)}}},S=new Ge(n);return t.current=S,i(S.getState()),()=>{S.destroy(),t.current=null,i(null)}},[]);let y=R.useCallback(l=>{t.current&&t.current.setPrimaryType(l)},[]),h=R.useCallback(l=>{t.current&&t.current.setSelectedMarker(l)},[]),s=R.useCallback((l,n=!0)=>{t.current&&t.current.setUseApi(l,n)},[]),a=R.useMemo(()=>({search:async l=>{if(!t.current)throw new Error("MapFirst instance not available");return await t.current.runPropertiesSearch(l)}}),[]),m=R.useMemo(()=>({search:async l=>{if(!t.current)throw new Error("MapFirst instance not available");return await t.current.runSmartFilterSearch(l)}}),[]),g=R.useMemo(()=>({perform:async()=>t.current?await t.current.performBoundsSearch():null}),[]),x=R.useRef(!1),f=R.useCallback((l,n,S)=>{t.current&&l&&!x.current&&(t.current.attachMap(l,{platform:"maplibre",maplibregl:n,onMarkerClick:S==null?void 0:S.onMarkerClick}),x.current=!0)},[]),k=R.useRef(!1),b=R.useCallback((l,n,S)=>{t.current&&l&&!k.current&&(t.current.attachMap(l,{platform:"google",google:n,onMarkerClick:S==null?void 0:S.onMarkerClick}),k.current=!0)},[]),C=R.useRef(!1),v=R.useCallback((l,n,S)=>{t.current&&l&&!C.current&&(t.current.attachMap(l,{platform:"mapbox",mapboxgl:n,onMarkerClick:S==null?void 0:S.onMarkerClick}),C.current=!0)},[]);return{instance:t.current,state:p,setPrimaryType:y,setSelectedMarker:h,setUseApi:s,propertiesSearch:a,smartFilterSearch:m,boundsSearch:g,attachMapLibre:f,attachGoogle:b,attachMapbox:v}}export{K as Chip,oe as CloseIcon,D as EditIcon,te as FilterChips,_ as MinRatingFilterChip,Q as NextIcon,Z as PriceRangeFilterChip,j as RestaurantPriceLevelChip,ne as SearchIcon,Ue as SmartFilter,ie as StarIcon,J as TransformedQueryChip,Hr as convertToApiFilters,st as createMinRatingFilterLabel,lt as createPriceRangeFilterLabel,$ as formatRatingValue,Dr as processApiFilters,Re as renderStars,ee as useFilterScroll,Br as useMapFirst,w as useTranslation};
6
6
  //# sourceMappingURL=index.mjs.map