@mapfirst.ai/react 0.0.17 → 0.0.18

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _mapfirst_ai_core from '@mapfirst.ai/core';
2
- import { PropertyType, PriceLevel, MapFirstCore, BaseMapFirstOptions, MapState, Property, MapLibreNamespace, GoogleMapsNamespace, MapboxNamespace } from '@mapfirst.ai/core';
2
+ import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, GoogleMapsNamespace, MapboxNamespace } from '@mapfirst.ai/core';
3
3
  export { ApiFiltersResponse, convertToApiFilters, processApiFilters } from '@mapfirst.ai/core';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { FunctionComponent, CSSProperties, ReactNode } from 'react';
@@ -21,19 +21,12 @@ type PriceRangeValue = {
21
21
  };
22
22
 
23
23
  interface SmartFilterProps {
24
- mapFirst: MapFirstCore | null;
25
24
  filters: Filter[];
26
- value?: string;
27
25
  isSearching?: boolean;
28
- placeholder?: string;
29
- onSearch: (query: string, filters?: Filter[]) => Promise<void> | void;
30
26
  onFilterChange: (filters: Filter[]) => Promise<void> | void;
31
- onValueChange?: (value: string) => void;
32
- showTypingPrompt?: boolean;
33
27
  customTranslations?: Record<string, string>;
34
28
  currency?: string;
35
29
  style?: CSSProperties;
36
- inputStyle?: CSSProperties;
37
30
  containerStyle?: CSSProperties;
38
31
  }
39
32
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _mapfirst_ai_core from '@mapfirst.ai/core';
2
- import { PropertyType, PriceLevel, MapFirstCore, BaseMapFirstOptions, MapState, Property, MapLibreNamespace, GoogleMapsNamespace, MapboxNamespace } from '@mapfirst.ai/core';
2
+ import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, GoogleMapsNamespace, MapboxNamespace } from '@mapfirst.ai/core';
3
3
  export { ApiFiltersResponse, convertToApiFilters, processApiFilters } from '@mapfirst.ai/core';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { FunctionComponent, CSSProperties, ReactNode } from 'react';
@@ -21,19 +21,12 @@ type PriceRangeValue = {
21
21
  };
22
22
 
23
23
  interface SmartFilterProps {
24
- mapFirst: MapFirstCore | null;
25
24
  filters: Filter[];
26
- value?: string;
27
25
  isSearching?: boolean;
28
- placeholder?: string;
29
- onSearch: (query: string, filters?: Filter[]) => Promise<void> | void;
30
26
  onFilterChange: (filters: Filter[]) => Promise<void> | void;
31
- onValueChange?: (value: string) => void;
32
- showTypingPrompt?: boolean;
33
27
  customTranslations?: Record<string, string>;
34
28
  currency?: string;
35
29
  style?: CSSProperties;
36
- inputStyle?: CSSProperties;
37
30
  containerStyle?: CSSProperties;
38
31
  }
39
32
  /**
package/dist/index.js CHANGED
@@ -1,11 +1,6 @@
1
- "use strict";var Ee=Object.create;var J=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var Ne=(e,t)=>{for(var i in t)J(e,i,{get:t[i],enumerable:!0})},Se=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ie(t))!Be.call(e,a)&&a!==i&&J(e,a,{get:()=>t[a],enumerable:!(r=Me(t,a))||r.enumerable});return e};var ue=(e,t,i)=>(i=e!=null?Ee(Te(e)):{},Se(t||!e||!e.__esModule?J(i,"default",{value:e,enumerable:!0}):i,e)),He=e=>Se(J({},"__esModule",{value:!0}),e);var lt={};Ne(lt,{Chip:()=>te,CloseIcon:()=>me,EditIcon:()=>Z,FilterChips:()=>le,MinRatingFilterChip:()=>X,NextIcon:()=>ee,PriceRangeFilterChip:()=>oe,RestaurantPriceLevelChip:()=>ie,SearchIcon:()=>de,SmartFilter:()=>Le,StarIcon:()=>ge,TransformedQueryChip:()=>ae,convertToApiFilters:()=>ce.convertToApiFilters,createMinRatingFilterLabel:()=>_e,createPriceRangeFilterLabel:()=>We,formatRatingValue:()=>re,processApiFilters:()=>ce.processApiFilters,renderStars:()=>xe,useFilterScroll:()=>se,useMapFirst:()=>st,useTranslation:()=>D});module.exports=He(lt);var L=ue(require("react")),we=require("@mapfirst.ai/core"),ce=require("@mapfirst.ai/core");var Y=require("react");var he=ue(require("react"));var Ce=ue(require("react"));var N=require("react/jsx-runtime"),de=({className:e,style:t})=>(0,N.jsxs)("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:[(0,N.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,N.jsx)("path",{d:"m21 21-4.35-4.35"})]}),me=({className:e,style:t})=>(0,N.jsxs)("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:[(0,N.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,N.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Z=({className:e,style:t})=>(0,N.jsxs)("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:[(0,N.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,N.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),ee=({className:e,style:t})=>(0,N.jsx)("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:(0,N.jsx)("polyline",{points:"9 18 15 12 9 6"})}),ge=({className:e,style:t,fill:i="none"})=>(0,N.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:i,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:(0,N.jsx)("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"})});var ye=require("react/jsx-runtime"),De={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"},Ae={width:"17px",height:"17px"},V=({onClick:e,style:t})=>{let[i,r]=Ce.default.useState(!1);return(0,ye.jsx)("button",{style:{...De,backgroundColor:i?"#e5e5e5":"white",...t},onClick:e,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),"aria-label":"Remove filter",children:(0,ye.jsx)(me,{style:Ae})})};var G=require("react/jsx-runtime"),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,height:"34px"},te=({label:e,icon:t,remove:i,style:r})=>(0,G.jsxs)("div",{style:{...ze,...r},children:[t&&(0,G.jsx)("span",{style:{display:"flex",alignItems:"center"},children:t}),(0,G.jsx)("span",{style:{whiteSpace:"nowrap"},children:e}),(0,G.jsx)(V,{onClick:i})]});var ve=require("react");var j=require("react"),Oe={"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"},Ve=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),D=(e,t)=>{let[i,r]=(0,j.useState)("en"),a=(0,j.useCallback)((f,c)=>{let d={...Oe,...e}[f]||f;return c&&Object.keys(c).forEach(u=>{d=d.replace(new RegExp(`{{${u}}}`,"g"),String(c[u]))}),d},[e]),m=(0,j.useCallback)((f,c)=>t?t(f,c):Ve(f,c),[t]);return{t:a,locale:i,setLocale:r,formatCurrency:m}};var $=require("react/jsx-runtime"),xe=e=>{let t=[],i=Math.floor(e),r=e%1!==0,a={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},m={...a,backgroundColor:"#03852e"},f={...a,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let s=0;s<i;s+=1)t.push((0,$.jsx)("span",{style:m},`full-${s}`));r&&t.push((0,$.jsx)("span",{style:f},"half"));let c=Math.max(0,5-Math.ceil(e));for(let s=0;s<c;s+=1)t.push((0,$.jsx)("span",{style:a},`empty-${s}`));return t},_e=(e,t)=>(0,$.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,$.jsx)("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:xe(e)})," ",t]}),re=e=>e.toFixed(1),We=(e,t,i,r)=>`${r(e,i)} - ${r(t!=null?t:0,i)}`;var H=require("react/jsx-runtime"),qe={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"},Qe={display:"flex",gap:"1px",userSelect:"none"},fe={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},ne={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},X=({rating:e,onChange:t,onRemove:i,star:r=!1})=>{let[a,m]=(0,ve.useState)(null),{t:f}=D(),c=a!=null?a:e,s=C=>r&&C?C.toString():f("smartFilter.minRating.label",{value:re(C)}),d=f("smartFilter.minRating.remove"),u=C=>f("smartFilter.minRating.setTo",{rating:re(C)}),P=C=>{let x=C+1;return c>=x?"full":c>=x-.5?"half":"empty"},h=C=>{m(null),C!==e&&t(C)},w=C=>{var v;let x=C.relatedTarget;(!x||!((v=C.currentTarget.closest("[data-min-rating-chip]"))!=null&&v.contains(x)))&&m(null)};return(0,H.jsxs)("div",{style:qe,"data-min-rating-chip":!0,children:[(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>m(null),children:[(0,H.jsx)("div",{style:Qe,children:Array.from({length:5}).map((C,x)=>{let v=P(x),R=x+1,n=R-.5;if(r)return(0,H.jsxs)("div",{style:{position:"relative",width:"16px",height:"16px"},children:[(0,H.jsx)(ge,{fill:c>=R?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),(0,H.jsx)("button",{type:"button",style:{...ne,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>m(n),onFocus:()=>m(n),onBlur:w,onClick:()=>h(n),"aria-label":u(n),title:s(n)}),(0,H.jsx)("button",{type:"button",style:{...ne,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>m(R),onFocus:()=>m(R),onBlur:w,onClick:()=>h(R),"aria-label":u(R),title:s(R)})]},x);let B=v==="full"?{...fe,backgroundColor:"#03852e"}:fe,A={...fe,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return(0,H.jsxs)("div",{style:{position:"relative",width:"12px",height:"12px"},children:[(0,H.jsx)("span",{style:v==="half"?A:B}),(0,H.jsx)("button",{type:"button",style:{...ne,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(n),onFocus:()=>m(n),onBlur:w,onClick:()=>h(n),"aria-label":u(n),title:s(n)}),(0,H.jsx)("button",{type:"button",style:{...ne,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(R),onFocus:()=>m(R),onBlur:w,onClick:()=>h(R),"aria-label":u(R),title:s(R)})]},x)})}),(0,H.jsx)("span",{style:{whiteSpace:"nowrap"},children:s(c)})]}),(0,H.jsx)(V,{onClick:i})]})};var U=require("react");var I=require("react/jsx-runtime"),Ke={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"},$e={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},Ge={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},ke=({boundary:e,label:t,value:i,placeholder:r,currency:a,isOptional:m=!1,showRemoveButton:f=!1,removeLabel:c,editLabel:s,showAddWhenEmpty:d=!1,onCommit:u,onRemove:P})=>{let[h,w]=(0,U.useState)(i!==void 0?String(i):""),[C,x]=(0,U.useState)(!1),[v,R]=(0,U.useState)(!1),n=i!==void 0;(0,U.useEffect)(()=>{w(i!==void 0?String(i):""),x(!1)},[i]);let B=()=>{w(i!==void 0?String(i):"")},A=()=>{if(h.trim()===""){if(m){u(void 0),w("");return}B();return}let l=Number(h);if(!Number.isFinite(l)){B();return}let k=Math.max(0,l);if(k===i){B();return}u(k)};return(0,I.jsxs)("div",{style:Ke,children:[(0,I.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),C?(0,I.jsx)("input",{value:h,onChange:l=>{let k=l.target.value.replace(/[^\d]/g,"");w(k)},onBlur:()=>{A(),x(!1)},onKeyDown:l=>{if(l.key==="Enter"){l.preventDefault(),l.currentTarget.blur(),x(!1);return}if(l.key==="Escape"){l.preventDefault(),B(),l.currentTarget.blur(),x(!1);return}l.key.length===1&&/[0-9]/.test(l.key)||l.key==="Backspace"||l.key==="Delete"||l.key==="Tab"||l.key==="ArrowLeft"||l.key==="ArrowRight"||l.key==="Home"||l.key==="End"||l.preventDefault()},placeholder:r,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:$e,autoFocus:!0}):n?(0,I.jsxs)("span",{style:{fontSize:"16px"},children:[a,i]}):d?(0,I.jsx)("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>x(!0),"aria-label":s,children:"+"}):(0,I.jsx)("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!d||d&&C)&&(0,I.jsx)("span",{style:{color:"#737373",fontSize:"12px"},children:a}),!C&&(!d||n)&&(0,I.jsx)("button",{type:"button",style:{...Ge,backgroundColor:v?"#e5e5e5":"transparent"},"aria-label":s,title:s,onClick:()=>x(!0),onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:(0,I.jsx)(Z,{})}),f&&(0,I.jsx)(V,{onClick:P})]})},oe=({priceRange:e,currency:t,onChange:i,onRemove:r})=>{let{t:a}=D(),m="Min",f="Max",c=a("smartFilter.priceRange.remove"),s=a("smartFilter.priceRange.edit"),d=(u,P)=>{let h={min:e.min,max:e.max};u==="min"?(h.min=P,P!==void 0&&e.max!==void 0&&P>e.max&&(h.max=P)):(h.max=P,P!==void 0&&e.min!==void 0&&P<e.min&&(h.min=P)),(h.min!==e.min||h.max!==e.max)&&i(h)};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ke,{boundary:"min",label:m,value:e.min,currency:t,editLabel:s,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:u=>d("min",u),onRemove:r}),(0,I.jsx)(ke,{boundary:"max",label:f,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:c,editLabel:s,showAddWhenEmpty:!0,onCommit:u=>d("max",u),onRemove:r})]})};var z=require("react/jsx-runtime"),Ue={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"},Fe=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],ie=({values:e,onChange:t,onRemove:i})=>{let{t:r}=D(),a=r("smartFilter.restaurantPriceLevel.label"),m=r("smartFilter.restaurantPriceLevel.remove"),f=r("smartFilter.restaurantPriceLevel.none"),c=s=>{let{value:d,checked:u}=s.target,P=d,h=new Set(e);u?h.add(P):h.delete(P);let w=Fe.filter(C=>h.has(C.value)).map(C=>C.value);t(w)};return(0,z.jsxs)("div",{style:Ue,children:[(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[(0,z.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:a}),(0,z.jsxs)("div",{style:{display:"flex",gap:"12px"},children:[Fe.map(s=>{let d=r(`smartFilter.restaurantPriceLevel.options.${s.key}`),u=`price-level-${s.key}`;return(0,z.jsxs)("label",{htmlFor:u,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[(0,z.jsx)("input",{id:u,type:"checkbox",value:s.value,checked:e.includes(s.value),onChange:c,style:{accentColor:"#03852e",cursor:"pointer"}}),(0,z.jsx)("span",{children:d})]},s.value)}),e.length===0&&(0,z.jsx)("span",{style:{fontSize:"12px",color:"#737373"},children:f})]})]}),(0,z.jsx)(V,{onClick:i})]})};var Q=require("react");var W=require("react/jsx-runtime"),Ye={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"},Ze={backgroundColor:"#ececec",borderRadius:"2px",padding:"2px 8px",outline:"none",fontSize:"16px",minWidth:"8ch",border:"none"},je={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:i})=>{let r=(0,Q.useRef)(null),[a,m]=(0,Q.useState)(e),[f,c]=(0,Q.useState)(!1),[s,d]=(0,Q.useState)(!1),{t:u}=D(),P=u("smartFilter.transformedQuery.remove"),h=u("smartFilter.transformedQuery.edit");(0,Q.useEffect)(()=>{m(e),c(!1)},[e]);let w=()=>{let v=a.trim();if(!v.length){m(e);return}v!==e&&t(v)};return(0,W.jsxs)("div",{style:Ye,children:[(0,W.jsx)(de,{style:{width:"16px",height:"16px",color:"#03852e"}}),f?(0,W.jsx)("input",{ref:r,value:a,onChange:v=>{m(v.target.value)},onBlur:()=>{w(),c(!1)},onKeyDown:v=>{if(v.key==="Enter"){v.preventDefault(),v.currentTarget.blur();return}if(v.key==="Escape"){v.preventDefault(),m(e),v.currentTarget.blur();return}},"aria-label":h,style:Ze,autoFocus:!0}):(0,W.jsx)("span",{style:{fontSize:"16px"},children:e}),!f&&(0,W.jsx)("button",{type:"button",style:{...je,backgroundColor:s?"#e5e5e5":"transparent"},"aria-label":h,title:h,onClick:()=>c(!0),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:(0,W.jsx)(Z,{})}),(0,W.jsx)(V,{onClick:i})]})};var _=require("react"),se=e=>{let t=(0,_.useRef)(null),[i,r]=(0,_.useState)(!0),[a,m]=(0,_.useState)(!0),f=(0,_.useCallback)(()=>{let s=t.current;if(!s){r(!0),m(!0);return}let{scrollLeft:d,scrollWidth:u,clientWidth:P}=s;r(d<=0),m(d+P>=u-1)},[]);(0,_.useEffect)(()=>{let s=t.current;if(f(),!s)return;let d=()=>f();return s.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",f),()=>{s.removeEventListener("scroll",d),window.removeEventListener("resize",f)}},[e,f]);let c=(0,_.useCallback)(s=>{let d=t.current;if(!d)return;let u=d.clientWidth*.7;d.scrollBy({left:s==="next"?u:-u,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:i,atEnd:a,scrollByDir:c}};var M=require("react/jsx-runtime"),Xe={position:"relative",width:"100%"},Je={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},Pe={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},Re={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:i,clearAllLabel:r,previousFiltersLabel:a,nextFiltersLabel:m,formatCurrency:f,onFilterChange:c,onResetFilters:s,onClearAll:d})=>{let{scrollerRef:u,atStart:P,atEnd:h,scrollByDir:w}=se(e.length),[C,x]=he.default.useState(null),[v,R]=he.default.useState(!1);return(0,M.jsxs)("div",{style:Xe,children:[(0,M.jsxs)("div",{ref:u,style:{...Je,padding:"8px",WebkitOverflowScrolling:"touch"},children:[(0,M.jsx)("style",{children:`
1
+ "use strict";var Ee=Object.create;var j=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Ne=(e,t)=>{for(var i in t)j(e,i,{get:t[i],enumerable:!0})},be=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Be(t))!Te.call(e,a)&&a!==i&&j(e,a,{get:()=>t[a],enumerable:!(o=Me(t,a))||o.enumerable});return e};var ce=(e,t,i)=>(i=e!=null?Ee(Ie(e)):{},be(t||!e||!e.__esModule?j(i,"default",{value:e,enumerable:!0}):i,e)),De=e=>be(j({},"__esModule",{value:!0}),e);var rt={};Ne(rt,{Chip:()=>J,CloseIcon:()=>ue,EditIcon:()=>U,FilterChips:()=>ae,MinRatingFilterChip:()=>Z,NextIcon:()=>X,PriceRangeFilterChip:()=>re,RestaurantPriceLevelChip:()=>ne,SearchIcon:()=>pe,SmartFilter:()=>Pe,StarIcon:()=>de,TransformedQueryChip:()=>oe,convertToApiFilters:()=>le.convertToApiFilters,createMinRatingFilterLabel:()=>We,createPriceRangeFilterLabel:()=>Qe,formatRatingValue:()=>ee,processApiFilters:()=>le.processApiFilters,renderStars:()=>Ce,useFilterScroll:()=>ie,useMapFirst:()=>tt,useTranslation:()=>D});module.exports=De(rt);var L=ce(require("react")),Le=require("@mapfirst.ai/core"),le=require("@mapfirst.ai/core");var se=require("react");var ye=ce(require("react"));var Se=ce(require("react"));var I=require("react/jsx-runtime"),pe=({className:e,style:t})=>(0,I.jsxs)("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:[(0,I.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,I.jsx)("path",{d:"m21 21-4.35-4.35"})]}),ue=({className:e,style:t})=>(0,I.jsxs)("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:[(0,I.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,I.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),U=({className:e,style:t})=>(0,I.jsxs)("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:[(0,I.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,I.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),X=({className:e,style:t})=>(0,I.jsx)("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:(0,I.jsx)("polyline",{points:"9 18 15 12 9 6"})}),de=({className:e,style:t,fill:i="none"})=>(0,I.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:i,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:(0,I.jsx)("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"})});var me=require("react/jsx-runtime"),He={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"},Ae={width:"17px",height:"17px"},z=({onClick:e,style:t})=>{let[i,o]=Se.default.useState(!1);return(0,me.jsx)("button",{style:{...He,backgroundColor:i?"#e5e5e5":"white",...t},onClick:e,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"aria-label":"Remove filter",children:(0,me.jsx)(ue,{style:Ae})})};var K=require("react/jsx-runtime"),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,height:"34px"},J=({label:e,icon:t,remove:i,style:o})=>(0,K.jsxs)("div",{style:{...ze,...o},children:[t&&(0,K.jsx)("span",{style:{display:"flex",alignItems:"center"},children:t}),(0,K.jsx)("span",{style:{whiteSpace:"nowrap"},children:e}),(0,K.jsx)(z,{onClick:i})]});var xe=require("react");var Y=require("react"),Oe={"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"},_e=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),D=(e,t)=>{let[i,o]=(0,Y.useState)("en"),a=(0,Y.useCallback)((b,l)=>{let u={...Oe,...e}[b]||b;return l&&Object.keys(l).forEach(p=>{u=u.replace(new RegExp(`{{${p}}}`,"g"),String(l[p]))}),u},[e]),m=(0,Y.useCallback)((b,l)=>t?t(b,l):_e(b,l),[t]);return{t:a,locale:i,setLocale:o,formatCurrency:m}};var V=require("react/jsx-runtime"),Ce=e=>{let t=[],i=Math.floor(e),o=e%1!==0,a={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},m={...a,backgroundColor:"#03852e"},b={...a,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let s=0;s<i;s+=1)t.push((0,V.jsx)("span",{style:m},`full-${s}`));o&&t.push((0,V.jsx)("span",{style:b},"half"));let l=Math.max(0,5-Math.ceil(e));for(let s=0;s<l;s+=1)t.push((0,V.jsx)("span",{style:a},`empty-${s}`));return t},We=(e,t)=>(0,V.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,V.jsx)("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:Ce(e)})," ",t]}),ee=e=>e.toFixed(1),Qe=(e,t,i,o)=>`${o(e,i)} - ${o(t!=null?t:0,i)}`;var T=require("react/jsx-runtime"),Ve={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"},qe={display:"flex",gap:"1px",userSelect:"none"},ge={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},te={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},Z=({rating:e,onChange:t,onRemove:i,star:o=!1})=>{let[a,m]=(0,xe.useState)(null),{t:b}=D(),l=a!=null?a:e,s=h=>o&&h?h.toString():b("smartFilter.minRating.label",{value:ee(h)}),u=b("smartFilter.minRating.remove"),p=h=>b("smartFilter.minRating.setTo",{rating:ee(h)}),k=h=>{let S=h+1;return l>=S?"full":l>=S-.5?"half":"empty"},y=h=>{m(null),h!==e&&t(h)},F=h=>{var x;let S=h.relatedTarget;(!S||!((x=h.currentTarget.closest("[data-min-rating-chip]"))!=null&&x.contains(S)))&&m(null)};return(0,T.jsxs)("div",{style:Ve,"data-min-rating-chip":!0,children:[(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>m(null),children:[(0,T.jsx)("div",{style:qe,children:Array.from({length:5}).map((h,S)=>{let x=k(S),w=S+1,n=w-.5;if(o)return(0,T.jsxs)("div",{style:{position:"relative",width:"16px",height:"16px"},children:[(0,T.jsx)(de,{fill:l>=w?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),(0,T.jsx)("button",{type:"button",style:{...te,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>m(n),onFocus:()=>m(n),onBlur:F,onClick:()=>y(n),"aria-label":p(n),title:s(n)}),(0,T.jsx)("button",{type:"button",style:{...te,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>m(w),onFocus:()=>m(w),onBlur:F,onClick:()=>y(w),"aria-label":p(w),title:s(w)})]},S);let N=x==="full"?{...ge,backgroundColor:"#03852e"}:ge,_={...ge,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return(0,T.jsxs)("div",{style:{position:"relative",width:"12px",height:"12px"},children:[(0,T.jsx)("span",{style:x==="half"?_:N}),(0,T.jsx)("button",{type:"button",style:{...te,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(n),onFocus:()=>m(n),onBlur:F,onClick:()=>y(n),"aria-label":p(n),title:s(n)}),(0,T.jsx)("button",{type:"button",style:{...te,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(w),onFocus:()=>m(w),onBlur:F,onClick:()=>y(w),"aria-label":p(w),title:s(w)})]},S)})}),(0,T.jsx)("span",{style:{whiteSpace:"nowrap"},children:s(l)})]}),(0,T.jsx)(z,{onClick:i})]})};var $=require("react");var B=require("react/jsx-runtime"),Ke={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"},$e={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},Ge={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},ve=({boundary:e,label:t,value:i,placeholder:o,currency:a,isOptional:m=!1,showRemoveButton:b=!1,removeLabel:l,editLabel:s,showAddWhenEmpty:u=!1,onCommit:p,onRemove:k})=>{let[y,F]=(0,$.useState)(i!==void 0?String(i):""),[h,S]=(0,$.useState)(!1),[x,w]=(0,$.useState)(!1),n=i!==void 0;(0,$.useEffect)(()=>{F(i!==void 0?String(i):""),S(!1)},[i]);let N=()=>{F(i!==void 0?String(i):"")},_=()=>{if(y.trim()===""){if(m){p(void 0),F("");return}N();return}let c=Number(y);if(!Number.isFinite(c)){N();return}let R=Math.max(0,c);if(R===i){N();return}p(R)};return(0,B.jsxs)("div",{style:Ke,children:[(0,B.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),h?(0,B.jsx)("input",{value:y,onChange:c=>{let R=c.target.value.replace(/[^\d]/g,"");F(R)},onBlur:()=>{_(),S(!1)},onKeyDown:c=>{if(c.key==="Enter"){c.preventDefault(),c.currentTarget.blur(),S(!1);return}if(c.key==="Escape"){c.preventDefault(),N(),c.currentTarget.blur(),S(!1);return}c.key.length===1&&/[0-9]/.test(c.key)||c.key==="Backspace"||c.key==="Delete"||c.key==="Tab"||c.key==="ArrowLeft"||c.key==="ArrowRight"||c.key==="Home"||c.key==="End"||c.preventDefault()},placeholder:o,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:$e,autoFocus:!0}):n?(0,B.jsxs)("span",{style:{fontSize:"16px"},children:[a,i]}):u?(0,B.jsx)("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>S(!0),"aria-label":s,children:"+"}):(0,B.jsx)("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!u||u&&h)&&(0,B.jsx)("span",{style:{color:"#737373",fontSize:"12px"},children:a}),!h&&(!u||n)&&(0,B.jsx)("button",{type:"button",style:{...Ge,backgroundColor:x?"#e5e5e5":"transparent"},"aria-label":s,title:s,onClick:()=>S(!0),onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:(0,B.jsx)(U,{})}),b&&(0,B.jsx)(z,{onClick:k})]})},re=({priceRange:e,currency:t,onChange:i,onRemove:o})=>{let{t:a}=D(),m="Min",b="Max",l=a("smartFilter.priceRange.remove"),s=a("smartFilter.priceRange.edit"),u=(p,k)=>{let y={min:e.min,max:e.max};p==="min"?(y.min=k,k!==void 0&&e.max!==void 0&&k>e.max&&(y.max=k)):(y.max=k,k!==void 0&&e.min!==void 0&&k<e.min&&(y.min=k)),(y.min!==e.min||y.max!==e.max)&&i(y)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ve,{boundary:"min",label:m,value:e.min,currency:t,editLabel:s,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:p=>u("min",p),onRemove:o}),(0,B.jsx)(ve,{boundary:"max",label:b,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:l,editLabel:s,showAddWhenEmpty:!0,onCommit:p=>u("max",p),onRemove:o})]})};var H=require("react/jsx-runtime"),Ue={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"},ke=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],ne=({values:e,onChange:t,onRemove:i})=>{let{t:o}=D(),a=o("smartFilter.restaurantPriceLevel.label"),m=o("smartFilter.restaurantPriceLevel.remove"),b=o("smartFilter.restaurantPriceLevel.none"),l=s=>{let{value:u,checked:p}=s.target,k=u,y=new Set(e);p?y.add(k):y.delete(k);let F=ke.filter(h=>y.has(h.value)).map(h=>h.value);t(F)};return(0,H.jsxs)("div",{style:Ue,children:[(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[(0,H.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:a}),(0,H.jsxs)("div",{style:{display:"flex",gap:"12px"},children:[ke.map(s=>{let u=o(`smartFilter.restaurantPriceLevel.options.${s.key}`),p=`price-level-${s.key}`;return(0,H.jsxs)("label",{htmlFor:p,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[(0,H.jsx)("input",{id:p,type:"checkbox",value:s.value,checked:e.includes(s.value),onChange:l,style:{accentColor:"#03852e",cursor:"pointer"}}),(0,H.jsx)("span",{children:u})]},s.value)}),e.length===0&&(0,H.jsx)("span",{style:{fontSize:"12px",color:"#737373"},children:b})]})]}),(0,H.jsx)(z,{onClick:i})]})};var Q=require("react");var W=require("react/jsx-runtime"),Ye={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"},Ze={backgroundColor:"#ececec",borderRadius:"2px",padding:"2px 8px",outline:"none",fontSize:"16px",minWidth:"8ch",border:"none"},je={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",color:"#737373",border:"none",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},oe=({value:e,onChange:t,onRemove:i})=>{let o=(0,Q.useRef)(null),[a,m]=(0,Q.useState)(e),[b,l]=(0,Q.useState)(!1),[s,u]=(0,Q.useState)(!1),{t:p}=D(),k=p("smartFilter.transformedQuery.remove"),y=p("smartFilter.transformedQuery.edit");(0,Q.useEffect)(()=>{m(e),l(!1)},[e]);let F=()=>{let x=a.trim();if(!x.length){m(e);return}x!==e&&t(x)};return(0,W.jsxs)("div",{style:Ye,children:[(0,W.jsx)(pe,{style:{width:"16px",height:"16px",color:"#03852e"}}),b?(0,W.jsx)("input",{ref:o,value:a,onChange:x=>{m(x.target.value)},onBlur:()=>{F(),l(!1)},onKeyDown:x=>{if(x.key==="Enter"){x.preventDefault(),x.currentTarget.blur();return}if(x.key==="Escape"){x.preventDefault(),m(e),x.currentTarget.blur();return}},"aria-label":y,style:Ze,autoFocus:!0}):(0,W.jsx)("span",{style:{fontSize:"16px"},children:e}),!b&&(0,W.jsx)("button",{type:"button",style:{...je,backgroundColor:s?"#e5e5e5":"transparent"},"aria-label":y,title:y,onClick:()=>l(!0),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:(0,W.jsx)(U,{})}),(0,W.jsx)(z,{onClick:i})]})};var O=require("react"),ie=e=>{let t=(0,O.useRef)(null),[i,o]=(0,O.useState)(!0),[a,m]=(0,O.useState)(!0),b=(0,O.useCallback)(()=>{let s=t.current;if(!s){o(!0),m(!0);return}let{scrollLeft:u,scrollWidth:p,clientWidth:k}=s;o(u<=0),m(u+k>=p-1)},[]);(0,O.useEffect)(()=>{let s=t.current;if(b(),!s)return;let u=()=>b();return s.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",b),()=>{s.removeEventListener("scroll",u),window.removeEventListener("resize",b)}},[e,b]);let l=(0,O.useCallback)(s=>{let u=t.current;if(!u)return;let p=u.clientWidth*.7;u.scrollBy({left:s==="next"?p:-p,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:i,atEnd:a,scrollByDir:l}};var E=require("react/jsx-runtime"),Xe={position:"relative",width:"100%"},Je={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},Fe={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},Re={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"},ae=({filters:e,currency:t,minRatingSuffix:i,clearAllLabel:o,previousFiltersLabel:a,nextFiltersLabel:m,formatCurrency:b,onFilterChange:l,onResetFilters:s,onClearAll:u})=>{let{scrollerRef:p,atStart:k,atEnd:y,scrollByDir:F}=ie(e.length),[h,S]=ye.default.useState(null),[x,w]=ye.default.useState(!1);return(0,E.jsxs)("div",{style:Xe,children:[(0,E.jsxs)("div",{ref:p,style:{...Je,padding:"8px",WebkitOverflowScrolling:"touch"},children:[(0,E.jsx)("style",{children:`
2
2
  div::-webkit-scrollbar {
3
3
  display: none;
4
4
  }
5
- `}),e.map(n=>{var A,K,q;let B=()=>(0,M.jsx)(te,{label:n.label,icon:n.icon,remove:()=>{c(e.filter(l=>l.id!==n.id))}},n.id);if(n.type==="minRating"){let l=(A=n.numericValue)!=null?A:Number(n.value);return Number.isFinite(l)?(0,M.jsx)(X,{rating:l,onChange:k=>{let E=e.map(T=>T.id===n.id?{...T,numericValue:k,value:String(k)}:T);c(E)},onRemove:()=>void c(e.filter(k=>k.id!==n.id))},n.id):B()}if(n.type==="starRating"){let l=(K=n.numericValue)!=null?K:Number(n.value);return Number.isFinite(l)?(0,M.jsx)(X,{star:!0,rating:l,onChange:k=>{let E=e.map(T=>T.id===n.id?{...T,numericValue:k,value:String(k)}:T);c(E)},onRemove:()=>void c(e.filter(k=>k.id!==n.id))},n.id):B()}return n.type==="priceRange"&&n.priceRange?(0,M.jsx)(oe,{priceRange:n.priceRange,currency:t,onChange:l=>{let k=e.map(E=>E.id===n.id?{...E,priceRange:l}:E);c(k)},onRemove:()=>void c(e.filter(l=>l.id!==n.id))},n.id):n.type==="transformed_query"?(0,M.jsx)(ae,{value:n.value,onChange:l=>{let k=e.map(E=>E.id===n.id?{...E,value:l}:E);c(k)},onRemove:()=>void c(e.filter(l=>l.id!==n.id))},n.id):n.type==="selected_restaurant_price_levels"?(0,M.jsx)(ie,{values:(q=n.priceLevels)!=null?q:[],onChange:l=>{let k=e.map(E=>E.id===n.id?{...E,priceLevels:l}:E);c(k)},onRemove:()=>void c(e.filter(l=>l.id!==n.id))},n.id):B()}),(0,M.jsx)("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:d,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:r})]}),!P&&(0,M.jsx)("div",{"aria-hidden":"true",style:{...Pe,left:0,background:"linear-gradient(to right, white, transparent)"}}),!h&&(0,M.jsx)("div",{"aria-hidden":"true",style:{...Pe,right:0,background:"linear-gradient(to left, white, transparent)"}}),!P&&(0,M.jsx)("button",{type:"button","aria-label":a,style:{...Re,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:C==="prev"?"#e5e5e5":"white"},onClick:()=>w("prev"),onMouseEnter:()=>x("prev"),onMouseLeave:()=>x(null),children:(0,M.jsx)(ee,{style:{width:"20px",height:"20px"}})}),!h&&(0,M.jsx)("button",{type:"button","aria-label":m,style:{...Re,right:"4px",backgroundColor:C==="next"?"#e5e5e5":"white"},onClick:()=>w("next"),onMouseEnter:()=>x("next"),onMouseLeave:()=>x(null),children:(0,M.jsx)(ee,{style:{width:"20px",height:"20px"}})})]})};var O=require("react/jsx-runtime"),et={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},tt={position:"relative",display:"flex",alignItems:"center",gap:"8px",width:"100%"},rt={position:"relative",display:"flex",alignItems:"center",flex:1,backgroundColor:"white",borderRadius:"24px",border:"1px solid #e5e5e5",padding:"0 16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},nt={flex:1,border:"none",outline:"none",fontSize:"16px",backgroundColor:"transparent",color:"#000",padding:"10px"},ot={position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)"},it={width:"20px",height:"20px",border:"2px solid #e5e5e5",borderTop:"2px solid #03852e",borderRadius:"50%",animation:"spin 1s linear infinite"},at={position:"absolute",padding:"10px",color:"#737373",pointerEvents:"none",fontSize:"16px"},Le=({mapFirst:e,filters:t,value:i,isSearching:r=!1,placeholder:a,onSearch:m,onFilterChange:f,onValueChange:c,showTypingPrompt:s=!0,customTranslations:d,currency:u="USD",style:P,inputStyle:h,containerStyle:w})=>{let[C,x]=(0,Y.useState)(""),v=i!==void 0?i:C,R=c||x,{t:n,formatCurrency:B}=D(d),A=n("smartFilter.minRating.suffix"),K=a||n("smartFilter.typingPrompt"),q=n("smartFilter.nav.previous"),l=n("smartFilter.nav.next"),k=n("smartFilter.clearAll"),E=async b=>{b.preventDefault();let y=v.trim();if(!(!y||r))try{await m(y)}catch(p){console.error("Search error:",p)}},T=(0,Y.useCallback)(async(b,y)=>{if(!r)try{await f(b)}catch(p){console.error("Filter change error:",p)}},[r,f]),pe=(0,Y.useCallback)(()=>{T([])},[T]),F=(0,Y.useCallback)(()=>{T([],!0),R("")},[T,R]);return(0,O.jsxs)("div",{style:{...et,...w},children:[(0,O.jsx)("style",{children:`
6
- @keyframes spin {
7
- 0% { transform: rotate(0deg); }
8
- 100% { transform: rotate(360deg); }
9
- }
10
- `}),t.length===0&&(0,O.jsx)("form",{onSubmit:E,style:{...tt,...P},children:(0,O.jsxs)("div",{style:rt,children:[(0,O.jsx)("input",{type:"text",value:v,onChange:b=>R(b.target.value),disabled:r,style:{...nt,...h},autoComplete:"off","aria-label":"Smart search"}),s&&v.length===0&&!r&&(0,O.jsx)("span",{style:at,children:K}),r&&(0,O.jsx)("div",{style:ot,children:(0,O.jsx)("div",{style:it})})]})}),t.length>0&&(0,O.jsx)(le,{filters:t,currency:u,minRatingSuffix:A,clearAllLabel:k,previousFiltersLabel:q,nextFiltersLabel:l,formatCurrency:B,onFilterChange:T,onResetFilters:pe,onClearAll:F})]})};function st(e){let t=L.default.useRef(null),[i,r]=L.default.useState(null),a=L.default.useRef(e);L.default.useEffect(()=>{a.current=e}),L.default.useEffect(()=>{let F=a.current,b={adapter:null,...F,callbacks:{...F.callbacks,onPropertiesChange:p=>{var o,g;r(S=>S?{...S,properties:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onPropertiesChange)==null||g.call(o,p)},onSelectedPropertyChange:p=>{var o,g;r(S=>S?{...S,selectedPropertyId:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onSelectedPropertyChange)==null||g.call(o,p)},onPrimaryTypeChange:p=>{var o,g;r(S=>S?{...S,primary:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onPrimaryTypeChange)==null||g.call(o,p)},onFiltersChange:p=>{var o,g;r(S=>S?{...S,filters:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onFiltersChange)==null||g.call(o,p)},onBoundsChange:p=>{var o,g;r(S=>S?{...S,bounds:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onBoundsChange)==null||g.call(o,p)},onPendingBoundsChange:p=>{var o,g;r(S=>S?{...S,pendingBounds:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onPendingBoundsChange)==null||g.call(o,p)},onCenterChange:(p,o)=>{var g,S;r(be=>be?{...be,center:p,zoom:o}:null),(S=(g=a.current.callbacks)==null?void 0:g.onCenterChange)==null||S.call(g,p,o)},onZoomChange:p=>{var o,g;r(S=>S?{...S,zoom:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onZoomChange)==null||g.call(o,p)},onActiveLocationChange:p=>{var o,g;r(S=>S?{...S,activeLocation:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onActiveLocationChange)==null||g.call(o,p)},onLoadingStateChange:p=>{var o,g;r(S=>S?{...S,initialLoading:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onLoadingStateChange)==null||g.call(o,p)},onSearchingStateChange:p=>{var o,g;r(S=>S?{...S,isSearching:p}:null),(g=(o=a.current.callbacks)==null?void 0:o.onSearchingStateChange)==null||g.call(o,p)}}},y=new we.MapFirstCore(b);return t.current=y,r(y.getState()),()=>{y.destroy(),t.current=null,r(null)}},[]);let m=L.default.useCallback(F=>{t.current&&t.current.setPrimaryType(F)},[]),f=L.default.useCallback(F=>{t.current&&t.current.setSelectedMarker(F)},[]),[c,s]=L.default.useState(!1),[d,u]=L.default.useState(null),P=L.default.useMemo(()=>({search:async F=>{if(!t.current){let b=new Error("MapFirst instance not available");throw u(b),b}s(!0),u(null);try{return await t.current.runPropertiesSearch({...F,onError:y=>{let p=y instanceof Error?y:new Error(String(y));u(p)}})}catch(b){let y=b instanceof Error?b:new Error(String(b));throw u(y),y}finally{s(!1)}},isLoading:c,error:d}),[c,d]),[h,w]=L.default.useState(!1),[C,x]=L.default.useState(null),v=L.default.useMemo(()=>({search:async F=>{if(!t.current){let b=new Error("MapFirst instance not available");throw x(b),b}w(!0),x(null);try{return await t.current.runSmartFilterSearch({...F,onError:y=>{let p=y instanceof Error?y:new Error(String(y));x(p)}})}catch(b){let y=b instanceof Error?b:new Error(String(b));throw x(y),y}finally{w(!1)}},isLoading:h,error:C}),[h,C]),[R,n]=L.default.useState(!1),[B,A]=L.default.useState(null),K=L.default.useMemo(()=>({perform:async()=>{if(!t.current)return null;n(!0),A(null);try{return await t.current.performBoundsSearch()}catch(F){let b=F instanceof Error?F:new Error(String(F));throw A(b),b}finally{n(!1)}},isSearching:R,error:B}),[R,B]),q=L.default.useRef(!1),l=L.default.useCallback((F,b,y)=>{t.current&&F&&!q.current&&(t.current.attachMap(F,{platform:"maplibre",maplibregl:b,onMarkerClick:y==null?void 0:y.onMarkerClick}),q.current=!0)},[]),k=L.default.useRef(!1),E=L.default.useCallback((F,b,y)=>{t.current&&F&&!k.current&&(t.current.attachMap(F,{platform:"google",google:b,onMarkerClick:y==null?void 0:y.onMarkerClick}),k.current=!0)},[]),T=L.default.useRef(!1),pe=L.default.useCallback((F,b,y)=>{t.current&&F&&!T.current&&(t.current.attachMap(F,{platform:"mapbox",mapboxgl:b,onMarkerClick:y==null?void 0:y.onMarkerClick}),T.current=!0)},[]);return{instance:t.current,state:i,setPrimaryType:m,setSelectedMarker:f,propertiesSearch:P,smartFilterSearch:v,boundsSearch:K,attachMapLibre:l,attachGoogle:E,attachMapbox:pe}}0&&(module.exports={Chip,CloseIcon,EditIcon,FilterChips,MinRatingFilterChip,NextIcon,PriceRangeFilterChip,RestaurantPriceLevelChip,SearchIcon,SmartFilter,StarIcon,TransformedQueryChip,convertToApiFilters,createMinRatingFilterLabel,createPriceRangeFilterLabel,formatRatingValue,processApiFilters,renderStars,useFilterScroll,useMapFirst,useTranslation});
5
+ `}),e.map(n=>{var _,G,q;let N=()=>(0,E.jsx)(J,{label:n.label,icon:n.icon,remove:()=>{l(e.filter(c=>c.id!==n.id))}},n.id);if(n.type==="minRating"){let c=(_=n.numericValue)!=null?_:Number(n.value);return Number.isFinite(c)?(0,E.jsx)(Z,{rating:c,onChange:R=>{let M=e.map(A=>A.id===n.id?{...A,numericValue:R,value:String(R)}:A);l(M)},onRemove:()=>void l(e.filter(R=>R.id!==n.id))},n.id):N()}if(n.type==="starRating"){let c=(G=n.numericValue)!=null?G:Number(n.value);return Number.isFinite(c)?(0,E.jsx)(Z,{star:!0,rating:c,onChange:R=>{let M=e.map(A=>A.id===n.id?{...A,numericValue:R,value:String(R)}:A);l(M)},onRemove:()=>void l(e.filter(R=>R.id!==n.id))},n.id):N()}return n.type==="priceRange"&&n.priceRange?(0,E.jsx)(re,{priceRange:n.priceRange,currency:t,onChange:c=>{let R=e.map(M=>M.id===n.id?{...M,priceRange:c}:M);l(R)},onRemove:()=>void l(e.filter(c=>c.id!==n.id))},n.id):n.type==="transformed_query"?(0,E.jsx)(oe,{value:n.value,onChange:c=>{let R=e.map(M=>M.id===n.id?{...M,value:c}:M);l(R)},onRemove:()=>void l(e.filter(c=>c.id!==n.id))},n.id):n.type==="selected_restaurant_price_levels"?(0,E.jsx)(ne,{values:(q=n.priceLevels)!=null?q:[],onChange:c=>{let R=e.map(M=>M.id===n.id?{...M,priceLevels:c}:M);l(R)},onRemove:()=>void l(e.filter(c=>c.id!==n.id))},n.id):N()}),(0,E.jsx)("button",{style:{flexShrink:0,padding:"4px 16px",borderRadius:"9999px",cursor:"pointer",fontSize:"14px",userSelect:"none",backgroundColor:x?"#eee":"white",color:"black",border:"1px solid #03852e"},onClick:u,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:o})]}),!k&&(0,E.jsx)("div",{"aria-hidden":"true",style:{...Fe,left:0,background:"linear-gradient(to right, white, transparent)"}}),!y&&(0,E.jsx)("div",{"aria-hidden":"true",style:{...Fe,right:0,background:"linear-gradient(to left, white, transparent)"}}),!k&&(0,E.jsx)("button",{type:"button","aria-label":a,style:{...Re,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:h==="prev"?"#e5e5e5":"white"},onClick:()=>F("prev"),onMouseEnter:()=>S("prev"),onMouseLeave:()=>S(null),children:(0,E.jsx)(X,{style:{width:"20px",height:"20px"}})}),!y&&(0,E.jsx)("button",{type:"button","aria-label":m,style:{...Re,right:"4px",backgroundColor:h==="next"?"#e5e5e5":"white"},onClick:()=>F("next"),onMouseEnter:()=>S("next"),onMouseLeave:()=>S(null),children:(0,E.jsx)(X,{style:{width:"20px",height:"20px"}})})]})};var fe=require("react/jsx-runtime"),et={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},Pe=({filters:e,isSearching:t=!1,onFilterChange:i,customTranslations:o,currency:a="USD",containerStyle:m,style:b})=>{let{t:l,formatCurrency:s}=D(o),u=l("smartFilter.minRating.suffix"),p=l("smartFilter.nav.previous"),k=l("smartFilter.nav.next"),y=l("smartFilter.clearAll"),F=(0,se.useCallback)(async(x,w)=>{if(!t)try{await i(x)}catch(n){console.error("Filter change error:",n)}},[t,i]),h=(0,se.useCallback)(()=>{F([])},[F]),S=(0,se.useCallback)(()=>{F([],!0)},[F]);return(0,fe.jsx)("div",{style:{...et,...m},children:(0,fe.jsx)(ae,{filters:e,currency:a,minRatingSuffix:u,clearAllLabel:y,previousFiltersLabel:p,nextFiltersLabel:k,formatCurrency:s,onFilterChange:F,onResetFilters:h,onClearAll:S})})};function tt(e){let t=L.default.useRef(null),[i,o]=L.default.useState(null),a=L.default.useRef(e);L.default.useEffect(()=>{a.current=e}),L.default.useEffect(()=>{let P=a.current,v={adapter:null,...P,callbacks:{...P.callbacks,onPropertiesChange:d=>{var r,g;o(f=>f?{...f,properties:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onPropertiesChange)==null||g.call(r,d)},onSelectedPropertyChange:d=>{var r,g;o(f=>f?{...f,selectedPropertyId:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onSelectedPropertyChange)==null||g.call(r,d)},onPrimaryTypeChange:d=>{var r,g;o(f=>f?{...f,primary:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onPrimaryTypeChange)==null||g.call(r,d)},onFiltersChange:d=>{var r,g;o(f=>f?{...f,filters:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onFiltersChange)==null||g.call(r,d)},onBoundsChange:d=>{var r,g;o(f=>f?{...f,bounds:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onBoundsChange)==null||g.call(r,d)},onPendingBoundsChange:d=>{var r,g;o(f=>f?{...f,pendingBounds:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onPendingBoundsChange)==null||g.call(r,d)},onCenterChange:(d,r)=>{var g,f;o(he=>he?{...he,center:d,zoom:r}:null),(f=(g=a.current.callbacks)==null?void 0:g.onCenterChange)==null||f.call(g,d,r)},onZoomChange:d=>{var r,g;o(f=>f?{...f,zoom:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onZoomChange)==null||g.call(r,d)},onActiveLocationChange:d=>{var r,g;o(f=>f?{...f,activeLocation:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onActiveLocationChange)==null||g.call(r,d)},onLoadingStateChange:d=>{var r,g;o(f=>f?{...f,initialLoading:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onLoadingStateChange)==null||g.call(r,d)},onSearchingStateChange:d=>{var r,g;o(f=>f?{...f,isSearching:d}:null),(g=(r=a.current.callbacks)==null?void 0:r.onSearchingStateChange)==null||g.call(r,d)}}},C=new Le.MapFirstCore(v);return t.current=C,o(C.getState()),()=>{C.destroy(),t.current=null,o(null)}},[]);let m=L.default.useCallback(P=>{t.current&&t.current.setPrimaryType(P)},[]),b=L.default.useCallback(P=>{t.current&&t.current.setSelectedMarker(P)},[]),[l,s]=L.default.useState(!1),[u,p]=L.default.useState(null),k=L.default.useMemo(()=>({search:async P=>{if(!t.current){let v=new Error("MapFirst instance not available");throw p(v),v}s(!0),p(null);try{return await t.current.runPropertiesSearch({...P,onError:C=>{let d=C instanceof Error?C:new Error(String(C));p(d)}})}catch(v){let C=v instanceof Error?v:new Error(String(v));throw p(C),C}finally{s(!1)}},isLoading:l,error:u}),[l,u]),[y,F]=L.default.useState(!1),[h,S]=L.default.useState(null),x=L.default.useMemo(()=>({search:async P=>{if(!t.current){let v=new Error("MapFirst instance not available");throw S(v),v}F(!0),S(null);try{return await t.current.runSmartFilterSearch({...P,onError:C=>{let d=C instanceof Error?C:new Error(String(C));S(d)}})}catch(v){let C=v instanceof Error?v:new Error(String(v));throw S(C),C}finally{F(!1)}},isLoading:y,error:h}),[y,h]),[w,n]=L.default.useState(!1),[N,_]=L.default.useState(null),G=L.default.useMemo(()=>({perform:async()=>{if(!t.current)return null;n(!0),_(null);try{return await t.current.performBoundsSearch()}catch(P){let v=P instanceof Error?P:new Error(String(P));throw _(v),v}finally{n(!1)}},isSearching:w,error:N}),[w,N]),q=L.default.useRef(!1),c=L.default.useCallback((P,v,C)=>{t.current&&P&&!q.current&&(t.current.attachMap(P,{platform:"maplibre",maplibregl:v,onMarkerClick:C==null?void 0:C.onMarkerClick}),q.current=!0)},[]),R=L.default.useRef(!1),M=L.default.useCallback((P,v,C)=>{t.current&&P&&!R.current&&(t.current.attachMap(P,{platform:"google",google:v,onMarkerClick:C==null?void 0:C.onMarkerClick}),R.current=!0)},[]),A=L.default.useRef(!1),we=L.default.useCallback((P,v,C)=>{t.current&&P&&!A.current&&(t.current.attachMap(P,{platform:"mapbox",mapboxgl:v,onMarkerClick:C==null?void 0:C.onMarkerClick}),A.current=!0)},[]);return{instance:t.current,state:i,setPrimaryType:m,setSelectedMarker:b,propertiesSearch:k,smartFilterSearch:x,boundsSearch:G,attachMapLibre:c,attachGoogle:M,attachMapbox:we}}0&&(module.exports={Chip,CloseIcon,EditIcon,FilterChips,MinRatingFilterChip,NextIcon,PriceRangeFilterChip,RestaurantPriceLevelChip,SearchIcon,SmartFilter,StarIcon,TransformedQueryChip,convertToApiFilters,createMinRatingFilterLabel,createPriceRangeFilterLabel,formatRatingValue,processApiFilters,renderStars,useFilterScroll,useMapFirst,useTranslation});
11
6
  //# sourceMappingURL=index.js.map