@mapfirst.ai/react 0.0.15 → 0.0.16

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,11 +1,11 @@
1
- import f from"react";import{MapFirstCore as we}from"@mapfirst.ai/core";import{processApiFilters as xn,convertToApiFilters as Cn}from"@mapfirst.ai/core";import{useCallback as de,useState as it}from"react";import ce from"react";import Le from"react";import{jsx as E,jsxs as j}from"react/jsx-runtime";var V=({className:e,style:r})=>j("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",...r},children:[E("circle",{cx:"11",cy:"11",r:"8"}),E("path",{d:"m21 21-4.35-4.35"})]}),me=({className:e,style:r})=>j("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",...r},children:[E("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),E("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),q=({className:e,style:r})=>j("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",...r},children:[E("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),E("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),Z=({className:e,style:r})=>E("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",...r},children:E("polyline",{points:"9 18 15 12 9 6"})}),fe=({className:e,style:r,fill:o="none"})=>E("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:o,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...r},children:E("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 ge}from"react/jsx-runtime";var Ee={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"},Me={width:"17px",height:"17px"},M=({onClick:e,style:r})=>{let[o,i]=Le.useState(!1);return ge("button",{style:{...Ee,backgroundColor:o?"#e5e5e5":"white",...r},onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-label":"Remove filter",children:ge(me,{style:Me})})};import{jsx as X,jsxs as Te}from"react/jsx-runtime";var Ie={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:r,remove:o,style:i})=>Te("div",{style:{...Ie,...i},children:[r&&X("span",{style:{display:"flex",alignItems:"center"},children:r}),X("span",{style:{whiteSpace:"nowrap"},children:e}),X(M,{onClick:o})]});import{useState as ze}from"react";import{useCallback as ye,useState as Be}from"react";var He={"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,r="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:r,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),R=(e,r)=>{let[o,i]=Be("en"),s=ye((u,p)=>{let n={...He,...e}[u]||u;return p&&Object.keys(p).forEach(a=>{n=n.replace(new RegExp(`{{${a}}}`,"g"),String(p[a]))}),n},[e]),d=ye((u,p)=>r?r(u,p):Ne(u,p),[r]);return{t:s,locale:o,setLocale:i,formatCurrency:d}};import{jsx as Q,jsxs as Ae}from"react/jsx-runtime";var De=e=>{let r=[],o=Math.floor(e),i=e%1!==0,s={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},d={...s,backgroundColor:"#03852e"},u={...s,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let t=0;t<o;t+=1)r.push(Q("span",{style:d},`full-${t}`));i&&r.push(Q("span",{style:u},"half"));let p=Math.max(0,5-Math.ceil(e));for(let t=0;t<p;t+=1)r.push(Q("span",{style:s},`empty-${t}`));return r},Rt=(e,r)=>Ae("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[Q("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:De(e)})," ",r]}),ee=e=>e.toFixed(1),wt=(e,r,o,i)=>`${i(e,o)} - ${i(r!=null?r:0,o)}`;import{jsx as T,jsxs as $}from"react/jsx-runtime";var Oe={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"},We={display:"flex",gap:"1px",userSelect:"none"},te={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},G=({rating:e,onChange:r,onRemove:o,star:i=!1})=>{let[s,d]=ze(null),{t:u}=R(),p=s!=null?s:e,t=g=>i&&g?g.toString():u("smartFilter.minRating.label",{value:ee(g)}),n=u("smartFilter.minRating.remove"),a=g=>u("smartFilter.minRating.setTo",{rating:ee(g)}),c=g=>{let b=g+1;return p>=b?"full":p>=b-.5?"half":"empty"},m=g=>{d(null),g!==e&&r(g)},C=g=>{var y;let b=g.relatedTarget;(!b||!((y=g.currentTarget.closest("[data-min-rating-chip]"))!=null&&y.contains(b)))&&d(null)};return $("div",{style:Oe,"data-min-rating-chip":!0,children:[$("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>d(null),children:[T("div",{style:We,children:Array.from({length:5}).map((g,b)=>{let y=c(b),h=b+1,v=h-.5;if(i)return $("div",{style:{position:"relative",width:"16px",height:"16px"},children:[T(fe,{fill:p>=h?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),T("button",{type:"button",style:{...K,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>d(v),onFocus:()=>d(v),onBlur:C,onClick:()=>m(v),"aria-label":a(v),title:t(v)}),T("button",{type:"button",style:{...K,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>d(h),onFocus:()=>d(h),onBlur:C,onClick:()=>m(h),"aria-label":a(h),title:t(h)})]},b);let F=y==="full"?{...te,backgroundColor:"#03852e"}:te,H={...te,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return $("div",{style:{position:"relative",width:"12px",height:"12px"},children:[T("span",{style:y==="half"?H:F}),T("button",{type:"button",style:{...K,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>d(v),onFocus:()=>d(v),onBlur:C,onClick:()=>m(v),"aria-label":a(v),title:t(v)}),T("button",{type:"button",style:{...K,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>d(h),onFocus:()=>d(h),onBlur:C,onClick:()=>m(h),"aria-label":a(h),title:t(h)})]},b)})}),T("span",{style:{whiteSpace:"nowrap"},children:t(p)})]}),T(M,{onClick:o})]})};import{useEffect as _e,useState as re}from"react";import{Fragment as Ke,jsx as I,jsxs as ne}from"react/jsx-runtime";var Ve={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"},Qe={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:r,value:o,placeholder:i,currency:s,isOptional:d=!1,showRemoveButton:u=!1,removeLabel:p,editLabel:t,showAddWhenEmpty:n=!1,onCommit:a,onRemove:c})=>{let[m,C]=re(o!==void 0?String(o):""),[g,b]=re(!1),[y,h]=re(!1),v=o!==void 0;_e(()=>{C(o!==void 0?String(o):""),b(!1)},[o]);let F=()=>{C(o!==void 0?String(o):"")},H=()=>{if(m.trim()===""){if(d){a(void 0),C("");return}F();return}let l=Number(m);if(!Number.isFinite(l)){F();return}let w=Math.max(0,l);if(w===o){F();return}a(w)};return ne("div",{style:Ve,children:[I("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:r}),g?I("input",{value:m,onChange:l=>{let w=l.target.value.replace(/[^\d]/g,"");C(w)},onBlur:()=>{H(),b(!1)},onKeyDown:l=>{if(l.key==="Enter"){l.preventDefault(),l.currentTarget.blur(),b(!1);return}if(l.key==="Escape"){l.preventDefault(),F(),l.currentTarget.blur(),b(!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:i,inputMode:"numeric",pattern:"[0-9]*","aria-label":r,style:qe,autoFocus:!0}):v?ne("span",{style:{fontSize:"16px"},children:[s,o]}):n?I("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>b(!0),"aria-label":t,children:"+"}):I("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!n||n&&g)&&I("span",{style:{color:"#737373",fontSize:"12px"},children:s}),!g&&(!n||v)&&I("button",{type:"button",style:{...Qe,backgroundColor:y?"#e5e5e5":"transparent"},"aria-label":t,title:t,onClick:()=>b(!0),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:I(q,{})}),u&&I(M,{onClick:c})]})},oe=({priceRange:e,currency:r,onChange:o,onRemove:i})=>{let{t:s}=R(),d="Min",u="Max",p=s("smartFilter.priceRange.remove"),t=s("smartFilter.priceRange.edit"),n=(a,c)=>{let m={min:e.min,max:e.max};a==="min"?(m.min=c,c!==void 0&&e.max!==void 0&&c>e.max&&(m.max=c)):(m.max=c,c!==void 0&&e.min!==void 0&&c<e.min&&(m.min=c)),(m.min!==e.min||m.max!==e.max)&&o(m)};return ne(Ke,{children:[I(he,{boundary:"min",label:d,value:e.min,currency:r,editLabel:t,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:a=>n("min",a),onRemove:i}),I(he,{boundary:"max",label:u,value:e.max,currency:r,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:p,editLabel:t,showAddWhenEmpty:!0,onCommit:a=>n("max",a),onRemove:i})]})};import{jsx as z,jsxs as U}from"react/jsx-runtime";var $e={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"}],ie=({values:e,onChange:r,onRemove:o})=>{let{t:i}=R(),s=i("smartFilter.restaurantPriceLevel.label"),d=i("smartFilter.restaurantPriceLevel.remove"),u=i("smartFilter.restaurantPriceLevel.none"),p=t=>{let{value:n,checked:a}=t.target,c=n,m=new Set(e);a?m.add(c):m.delete(c);let C=be.filter(g=>m.has(g.value)).map(g=>g.value);r(C)};return U("div",{style:$e,children:[U("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[z("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:s}),U("div",{style:{display:"flex",gap:"12px"},children:[be.map(t=>{let n=i(`smartFilter.restaurantPriceLevel.options.${t.key}`),a=`price-level-${t.key}`;return U("label",{htmlFor:a,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[z("input",{id:a,type:"checkbox",value:t.value,checked:e.includes(t.value),onChange:p,style:{accentColor:"#03852e",cursor:"pointer"}}),z("span",{children:n})]},t.value)}),e.length===0&&z("span",{style:{fontSize:"12px",color:"#737373"},children:u})]})]}),z(M,{onClick:o})]})};import{useEffect as Ge,useRef as Ue,useState as se}from"react";import{jsx as D,jsxs as Xe}from"react/jsx-runtime";var 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:r,onRemove:o})=>{let i=Ue(null),[s,d]=se(e),[u,p]=se(!1),[t,n]=se(!1),{t:a}=R(),c=a("smartFilter.transformedQuery.remove"),m=a("smartFilter.transformedQuery.edit");Ge(()=>{d(e),p(!1)},[e]);let C=()=>{let y=s.trim();if(!y.length){d(e);return}y!==e&&r(y)};return Xe("div",{style:Ye,children:[D(V,{style:{width:"16px",height:"16px",color:"#03852e"}}),u?D("input",{ref:i,value:s,onChange:y=>{d(y.target.value)},onBlur:()=>{C(),p(!1)},onKeyDown:y=>{if(y.key==="Enter"){y.preventDefault(),y.currentTarget.blur();return}if(y.key==="Escape"){y.preventDefault(),d(e),y.currentTarget.blur();return}},"aria-label":m,style:Ze,autoFocus:!0}):D("span",{style:{fontSize:"16px"},children:e}),!u&&D("button",{type:"button",style:{...je,backgroundColor:t?"#e5e5e5":"transparent"},"aria-label":m,title:m,onClick:()=>p(!0),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:D(q,{})}),D(M,{onClick:o})]})};import{useCallback as Se,useEffect as Je,useRef as et,useState as xe}from"react";var le=e=>{let r=et(null),[o,i]=xe(!0),[s,d]=xe(!0),u=Se(()=>{let t=r.current;if(!t){i(!0),d(!0);return}let{scrollLeft:n,scrollWidth:a,clientWidth:c}=t;i(n<=0),d(n+c>=a-1)},[]);Je(()=>{let t=r.current;if(u(),!t)return;let n=()=>u();return t.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",u),()=>{t.removeEventListener("scroll",n),window.removeEventListener("resize",u)}},[e,u]);let p=Se(t=>{let n=r.current;if(!n)return;let a=n.clientWidth*.7;n.scrollBy({left:t==="next"?a:-a,behavior:"smooth"})},[]);return{scrollerRef:r,atStart:o,atEnd:s,scrollByDir:p}};import{jsx as k,jsxs as Pe}from"react/jsx-runtime";var tt={position:"relative",width:"100%"},rt={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},Ce={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},ve={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"},pe=({filters:e,isPortrait:r,currency:o,minRatingSuffix:i,clearAllLabel:s,previousFiltersLabel:d,nextFiltersLabel:u,formatCurrency:p,onFilterChange:t,onResetFilters:n,onClearAll:a})=>{let{scrollerRef:c,atStart:m,atEnd:C,scrollByDir:g}=le(e.length),{t:b}=R(),[y,h]=ce.useState(null),[v,F]=ce.useState(!1),[H,A]=ce.useState(!1),O={...rt,padding:r?"8px 16px":"8px"};return Pe("div",{style:tt,children:[Pe("div",{ref:c,style:{...O,WebkitOverflowScrolling:"touch"},children:[k("style",{children:`
1
+ import L from"react";import{MapFirstCore as ut}from"@mapfirst.ai/core";import{processApiFilters as tn,convertToApiFilters as rn}from"@mapfirst.ai/core";import{useCallback as ue,useState as rt}from"react";import ve from"react";import Le from"react";import{jsx as H,jsxs as X}from"react/jsx-runtime";var me=({className:e,style:t})=>X("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:[H("circle",{cx:"11",cy:"11",r:"8"}),H("path",{d:"m21 21-4.35-4.35"})]}),ge=({className:e,style:t})=>X("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:[H("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),H("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Q=({className:e,style:t})=>X("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:[H("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),H("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),j=({className:e,style:t})=>H("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:H("polyline",{points:"9 18 15 12 9 6"})}),ye=({className:e,style:t,fill:p="none"})=>H("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:H("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 fe}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"},D=({onClick:e,style:t})=>{let[p,n]=Le.useState(!1);return fe("button",{style:{...we,backgroundColor:p?"#e5e5e5":"white",...t},onClick:e,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),"aria-label":"Remove filter",children:fe(ge,{style:Ee})})};import{jsx as J,jsxs as Ie}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"},ee=({label:e,icon:t,remove:p,style:n})=>Ie("div",{style:{...Me,...n},children:[t&&J("span",{style:{display:"flex",alignItems:"center"},children:t}),J("span",{style:{whiteSpace:"nowrap"},children:e}),J(D,{onClick:p})]});import{useState as Ae}from"react";import{useCallback as he,useState as Te}from"react";var Be={"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),N=(e,t)=>{let[p,n]=Te("en"),l=he((f,s)=>{let d={...Be,...e}[f]||f;return s&&Object.keys(s).forEach(u=>{d=d.replace(new RegExp(`{{${u}}}`,"g"),String(s[u]))}),d},[e]),m=he((f,s)=>t?t(f,s):Ne(f,s),[t]);return{t:l,locale:p,setLocale:n,formatCurrency:m}};import{jsx as K,jsxs as De}from"react/jsx-runtime";var He=e=>{let t=[],p=Math.floor(e),n=e%1!==0,l={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},m={...l,backgroundColor:"#03852e"},f={...l,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let i=0;i<p;i+=1)t.push(K("span",{style:m},`full-${i}`));n&&t.push(K("span",{style:f},"half"));let s=Math.max(0,5-Math.ceil(e));for(let i=0;i<s;i+=1)t.push(K("span",{style:l},`empty-${i}`));return t},Ft=(e,t)=>De("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[K("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:He(e)})," ",t]}),te=e=>e.toFixed(1),Pt=(e,t,p,n)=>`${n(e,p)} - ${n(t!=null?t:0,p)}`;import{jsx as z,jsxs as G}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"},re={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},$={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},U=({rating:e,onChange:t,onRemove:p,star:n=!1})=>{let[l,m]=Ae(null),{t:f}=N(),s=l!=null?l:e,i=C=>n&&C?C.toString():f("smartFilter.minRating.label",{value:te(C)}),d=f("smartFilter.minRating.remove"),u=C=>f("smartFilter.minRating.setTo",{rating:te(C)}),P=C=>{let x=C+1;return s>=x?"full":s>=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 G("div",{style:ze,"data-min-rating-chip":!0,children:[G("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>m(null),children:[z("div",{style:Oe,children:Array.from({length:5}).map((C,x)=>{let v=P(x),R=x+1,r=R-.5;if(n)return G("div",{style:{position:"relative",width:"16px",height:"16px"},children:[z(ye,{fill:s>=R?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),z("button",{type:"button",style:{...$,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>m(r),onFocus:()=>m(r),onBlur:w,onClick:()=>h(r),"aria-label":u(r),title:i(r)}),z("button",{type:"button",style:{...$,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:i(R)})]},x);let I=v==="full"?{...re,backgroundColor:"#03852e"}:re,B={...re,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return G("div",{style:{position:"relative",width:"12px",height:"12px"},children:[z("span",{style:v==="half"?B:I}),z("button",{type:"button",style:{...$,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>m(r),onFocus:()=>m(r),onBlur:w,onClick:()=>h(r),"aria-label":u(r),title:i(r)}),z("button",{type:"button",style:{...$,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:i(R)})]},x)})}),z("span",{style:{whiteSpace:"nowrap"},children:i(s)})]}),z(D,{onClick:p})]})};import{useEffect as Ve,useState as ne}from"react";import{Fragment as Qe,jsx as A,jsxs as oe}from"react/jsx-runtime";var _e={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"},We={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},qe={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},be=({boundary:e,label:t,value:p,placeholder:n,currency:l,isOptional:m=!1,showRemoveButton:f=!1,removeLabel:s,editLabel:i,showAddWhenEmpty:d=!1,onCommit:u,onRemove:P})=>{let[h,w]=ne(p!==void 0?String(p):""),[C,x]=ne(!1),[v,R]=ne(!1),r=p!==void 0;Ve(()=>{w(p!==void 0?String(p):""),x(!1)},[p]);let I=()=>{w(p!==void 0?String(p):"")},B=()=>{if(h.trim()===""){if(m){u(void 0),w("");return}I();return}let a=Number(h);if(!Number.isFinite(a)){I();return}let k=Math.max(0,a);if(k===p){I();return}u(k)};return oe("div",{style:_e,children:[A("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),C?A("input",{value:h,onChange:a=>{let k=a.target.value.replace(/[^\d]/g,"");w(k)},onBlur:()=>{B(),x(!1)},onKeyDown:a=>{if(a.key==="Enter"){a.preventDefault(),a.currentTarget.blur(),x(!1);return}if(a.key==="Escape"){a.preventDefault(),I(),a.currentTarget.blur(),x(!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:n,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:We,autoFocus:!0}):r?oe("span",{style:{fontSize:"16px"},children:[l,p]}):d?A("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>x(!0),"aria-label":i,children:"+"}):A("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!d||d&&C)&&A("span",{style:{color:"#737373",fontSize:"12px"},children:l}),!C&&(!d||r)&&A("button",{type:"button",style:{...qe,backgroundColor:v?"#e5e5e5":"transparent"},"aria-label":i,title:i,onClick:()=>x(!0),onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:A(Q,{})}),f&&A(D,{onClick:P})]})},ie=({priceRange:e,currency:t,onChange:p,onRemove:n})=>{let{t:l}=N(),m="Min",f="Max",s=l("smartFilter.priceRange.remove"),i=l("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)&&p(h)};return oe(Qe,{children:[A(be,{boundary:"min",label:m,value:e.min,currency:t,editLabel:i,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:u=>d("min",u),onRemove:n}),A(be,{boundary:"max",label:f,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:s,editLabel:i,showAddWhenEmpty:!0,onCommit:u=>d("max",u),onRemove:n})]})};import{jsx as q,jsxs as Y}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"},Se=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],ae=({values:e,onChange:t,onRemove:p})=>{let{t:n}=N(),l=n("smartFilter.restaurantPriceLevel.label"),m=n("smartFilter.restaurantPriceLevel.remove"),f=n("smartFilter.restaurantPriceLevel.none"),s=i=>{let{value:d,checked:u}=i.target,P=d,h=new Set(e);u?h.add(P):h.delete(P);let w=Se.filter(C=>h.has(C.value)).map(C=>C.value);t(w)};return Y("div",{style:Ke,children:[Y("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}),Y("div",{style:{display:"flex",gap:"12px"},children:[Se.map(i=>{let d=n(`smartFilter.restaurantPriceLevel.options.${i.key}`),u=`price-level-${i.key}`;return Y("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:d})]},i.value)}),e.length===0&&q("span",{style:{fontSize:"12px",color:"#737373"},children:f})]})]}),q(D,{onClick:p})]})};import{useEffect as $e,useRef as Ge,useState as se}from"react";import{jsx as W,jsxs as je}from"react/jsx-runtime";var 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:"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"},le=({value:e,onChange:t,onRemove:p})=>{let n=Ge(null),[l,m]=se(e),[f,s]=se(!1),[i,d]=se(!1),{t:u}=N(),P=u("smartFilter.transformedQuery.remove"),h=u("smartFilter.transformedQuery.edit");$e(()=>{m(e),s(!1)},[e]);let w=()=>{let v=l.trim();if(!v.length){m(e);return}v!==e&&t(v)};return je("div",{style:Ue,children:[W(me,{style:{width:"16px",height:"16px",color:"#03852e"}}),f?W("input",{ref:n,value:l,onChange:v=>{m(v.target.value)},onBlur:()=>{w(),s(!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:Ye,autoFocus:!0}):W("span",{style:{fontSize:"16px"},children:e}),!f&&W("button",{type:"button",style:{...Ze,backgroundColor:i?"#e5e5e5":"transparent"},"aria-label":h,title:h,onClick:()=>s(!0),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:W(Q,{})}),W(D,{onClick:p})]})};import{useCallback as Ce,useEffect as Xe,useRef as Je,useState as xe}from"react";var ce=e=>{let t=Je(null),[p,n]=xe(!0),[l,m]=xe(!0),f=Ce(()=>{let i=t.current;if(!i){n(!0),m(!0);return}let{scrollLeft:d,scrollWidth:u,clientWidth:P}=i;n(d<=0),m(d+P>=u-1)},[]);Xe(()=>{let i=t.current;if(f(),!i)return;let d=()=>f();return i.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",f),()=>{i.removeEventListener("scroll",d),window.removeEventListener("resize",f)}},[e,f]);let s=Ce(i=>{let d=t.current;if(!d)return;let u=d.clientWidth*.7;d.scrollBy({left:i==="next"?u:-u,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:p,atEnd:l,scrollByDir:s}};import{jsx as T,jsxs as Pe}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"},ke={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},Fe={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"},pe=({filters:e,currency:t,minRatingSuffix:p,clearAllLabel:n,previousFiltersLabel:l,nextFiltersLabel:m,formatCurrency:f,onFilterChange:s,onResetFilters:i,onClearAll:d})=>{let{scrollerRef:u,atStart:P,atEnd:h,scrollByDir:w}=ce(e.length),[C,x]=ve.useState(null),[v,R]=ve.useState(!1);return Pe("div",{style:et,children:[Pe("div",{ref:u,style:{...tt,padding:"8px",WebkitOverflowScrolling:"touch"},children:[T("style",{children:`
2
2
  div::-webkit-scrollbar {
3
3
  display: none;
4
4
  }
5
- `}),k("button",{style:{flexShrink:0,backgroundColor:v?"#03a03e":"#03852e",borderRadius:"50%",padding:"8px",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},onClick:n,onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:k(V,{style:{width:"20px",height:"20px",color:"white"}})}),e.map(l=>{var W,_,B;let w=()=>k(J,{label:l.label,icon:l.icon,remove:()=>{t(e.filter(S=>S.id!==l.id))}},l.id);if(l.type==="minRating"){let S=(W=l.numericValue)!=null?W:Number(l.value);return Number.isFinite(S)?k(G,{rating:S,onChange:P=>{let x=e.map(L=>L.id===l.id?{...L,numericValue:P,value:String(P)}:L);t(x)},onRemove:()=>void t(e.filter(P=>P.id!==l.id))},l.id):w()}if(l.type==="starRating"){let S=(_=l.numericValue)!=null?_:Number(l.value);return Number.isFinite(S)?k(G,{star:!0,rating:S,onChange:P=>{let x=e.map(L=>L.id===l.id?{...L,numericValue:P,value:String(P)}:L);t(x)},onRemove:()=>void t(e.filter(P=>P.id!==l.id))},l.id):w()}return l.type==="priceRange"&&l.priceRange?k(oe,{priceRange:l.priceRange,currency:o,onChange:S=>{let P=e.map(x=>x.id===l.id?{...x,priceRange:S}:x);t(P)},onRemove:()=>void t(e.filter(S=>S.id!==l.id))},l.id):l.type==="transformed_query"?k(ae,{value:l.value,onChange:S=>{let P=e.map(x=>x.id===l.id?{...x,value:S}:x);t(P)},onRemove:()=>void t(e.filter(S=>S.id!==l.id))},l.id):l.type==="selected_restaurant_price_levels"?k(ie,{values:(B=l.priceLevels)!=null?B:[],onChange:S=>{let P=e.map(x=>x.id===l.id?{...x,priceLevels:S}:x);t(P)},onRemove:()=>void t(e.filter(S=>S.id!==l.id))},l.id):w()}),k("button",{style:{flexShrink:0,padding:"4px 16px",borderRadius:"9999px",cursor:"pointer",fontSize:"14px",userSelect:"none",border:"none",backgroundColor:H?"#e5e5e5":"transparent",transition:"background-color 0.2s"},onClick:a,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),children:s})]}),!m&&k("div",{"aria-hidden":"true",style:{...Ce,left:0,background:"linear-gradient(to right, white, transparent)"}}),!C&&k("div",{"aria-hidden":"true",style:{...Ce,right:0,background:"linear-gradient(to left, white, transparent)"}}),!m&&k("button",{type:"button","aria-label":d,style:{...ve,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:y==="prev"?"#e5e5e5":"white"},onClick:()=>g("prev"),onMouseEnter:()=>h("prev"),onMouseLeave:()=>h(null),children:k(Z,{style:{width:"20px",height:"20px"}})}),!C&&k("button",{type:"button","aria-label":u,style:{...ve,right:"4px",backgroundColor:y==="next"?"#e5e5e5":"white"},onClick:()=>g("next"),onMouseEnter:()=>h("next"),onMouseLeave:()=>h(null),children:k(Z,{style:{width:"20px",height:"20px"}})})]})};import{useEffect as nt,useState as ot}from"react";var ue=()=>{let[e,r]=ot(typeof window!="undefined"?window.innerHeight>window.innerWidth:!1);return nt(()=>{if(typeof window=="undefined")return;let o=()=>{r(window.innerHeight>window.innerWidth)};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e};import{jsx as N,jsxs as ke}from"react/jsx-runtime";var st={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},at={position:"relative",display:"flex",alignItems:"center",gap:"8px",width:"100%"},lt={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)"},ct={flex:1,border:"none",outline:"none",fontSize:"16px",backgroundColor:"transparent",color:"#000",padding:"10px"},pt={position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)"},ut={width:"20px",height:"20px",border:"2px solid #e5e5e5",borderTop:"2px solid #03852e",borderRadius:"50%",animation:"spin 1s linear infinite"},dt={position:"absolute",padding:"10px",color:"#737373",pointerEvents:"none",fontSize:"16px"},mt=({mapFirst:e,filters:r,value:o,isSearching:i=!1,placeholder:s,onSearch:d,onFilterChange:u,onValueChange:p,showTypingPrompt:t=!0,customTranslations:n,currency:a="USD",style:c,inputStyle:m,containerStyle:C})=>{let[g,b]=it(""),y=o!==void 0?o:g,h=p||b,v=ue(),{t:F,formatCurrency:H}=R(n),A=F("smartFilter.minRating.suffix"),O=s||F("smartFilter.typingPrompt"),l=F("smartFilter.nav.previous"),w=F("smartFilter.nav.next"),W=F("smartFilter.clearAll"),_=async x=>{x.preventDefault();let L=y.trim();if(!(!L||i))try{await d(L)}catch(Y){console.error("Search error:",Y)}},B=de(async(x,L)=>{if(!i)try{await u(x)}catch(Y){console.error("Filter change error:",Y)}},[i,u]),S=de(()=>{B([])},[B]),P=de(()=>{B([],!0),h("")},[B,h]);return ke("div",{style:{...st,...C},children:[N("style",{children:`
5
+ `}),e.map(r=>{var B,V,O;let I=()=>T(ee,{label:r.label,icon:r.icon,remove:()=>{s(e.filter(a=>a.id!==r.id))}},r.id);if(r.type==="minRating"){let a=(B=r.numericValue)!=null?B:Number(r.value);return Number.isFinite(a)?T(U,{rating:a,onChange:k=>{let E=e.map(M=>M.id===r.id?{...M,numericValue:k,value:String(k)}:M);s(E)},onRemove:()=>void s(e.filter(k=>k.id!==r.id))},r.id):I()}if(r.type==="starRating"){let a=(V=r.numericValue)!=null?V:Number(r.value);return Number.isFinite(a)?T(U,{star:!0,rating:a,onChange:k=>{let E=e.map(M=>M.id===r.id?{...M,numericValue:k,value:String(k)}:M);s(E)},onRemove:()=>void s(e.filter(k=>k.id!==r.id))},r.id):I()}return r.type==="priceRange"&&r.priceRange?T(ie,{priceRange:r.priceRange,currency:t,onChange:a=>{let k=e.map(E=>E.id===r.id?{...E,priceRange:a}:E);s(k)},onRemove:()=>void s(e.filter(a=>a.id!==r.id))},r.id):r.type==="transformed_query"?T(le,{value:r.value,onChange:a=>{let k=e.map(E=>E.id===r.id?{...E,value:a}:E);s(k)},onRemove:()=>void s(e.filter(a=>a.id!==r.id))},r.id):r.type==="selected_restaurant_price_levels"?T(ae,{values:(O=r.priceLevels)!=null?O:[],onChange:a=>{let k=e.map(E=>E.id===r.id?{...E,priceLevels:a}:E);s(k)},onRemove:()=>void s(e.filter(a=>a.id!==r.id))},r.id):I()}),T("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:n})]}),!P&&T("div",{"aria-hidden":"true",style:{...ke,left:0,background:"linear-gradient(to right, white, transparent)"}}),!h&&T("div",{"aria-hidden":"true",style:{...ke,right:0,background:"linear-gradient(to left, white, transparent)"}}),!P&&T("button",{type:"button","aria-label":l,style:{...Fe,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:C==="prev"?"#e5e5e5":"white"},onClick:()=>w("prev"),onMouseEnter:()=>x("prev"),onMouseLeave:()=>x(null),children:T(j,{style:{width:"20px",height:"20px"}})}),!h&&T("button",{type:"button","aria-label":m,style:{...Fe,right:"4px",backgroundColor:C==="next"?"#e5e5e5":"white"},onClick:()=>w("next"),onMouseEnter:()=>x("next"),onMouseLeave:()=>x(null),children:T(j,{style:{width:"20px",height:"20px"}})})]})};import{jsx as _,jsxs as Re}from"react/jsx-runtime";var nt={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},ot={position:"relative",display:"flex",alignItems:"center",gap:"8px",width:"100%"},it={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)"},at={flex:1,border:"none",outline:"none",fontSize:"16px",backgroundColor:"transparent",color:"#000",padding:"10px"},st={position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)"},lt={width:"20px",height:"20px",border:"2px solid #e5e5e5",borderTop:"2px solid #03852e",borderRadius:"50%",animation:"spin 1s linear infinite"},ct={position:"absolute",padding:"10px",color:"#737373",pointerEvents:"none",fontSize:"16px"},pt=({mapFirst:e,filters:t,value:p,isSearching:n=!1,placeholder:l,onSearch:m,onFilterChange:f,onValueChange:s,showTypingPrompt:i=!0,customTranslations:d,currency:u="USD",style:P,inputStyle:h,containerStyle:w})=>{let[C,x]=rt(""),v=p!==void 0?p:C,R=s||x,{t:r,formatCurrency:I}=N(d),B=r("smartFilter.minRating.suffix"),V=l||r("smartFilter.typingPrompt"),O=r("smartFilter.nav.previous"),a=r("smartFilter.nav.next"),k=r("smartFilter.clearAll"),E=async b=>{b.preventDefault();let y=v.trim();if(!(!y||n))try{await m(y)}catch(c){console.error("Search error:",c)}},M=ue(async(b,y)=>{if(!n)try{await f(b)}catch(c){console.error("Filter change error:",c)}},[n,f]),Z=ue(()=>{M([])},[M]),F=ue(()=>{M([],!0),R("")},[M,R]);return Re("div",{style:{...nt,...w},children:[_("style",{children:`
6
6
  @keyframes spin {
7
7
  0% { transform: rotate(0deg); }
8
8
  100% { transform: rotate(360deg); }
9
9
  }
10
- `}),N("form",{onSubmit:_,style:{...at,...c},children:ke("div",{style:lt,children:[N("input",{type:"text",value:y,onChange:x=>h(x.target.value),disabled:i,style:{...ct,...m},autoComplete:"off","aria-label":"Smart search"}),t&&y.length===0&&!i&&N("span",{style:dt,children:O}),i&&N("div",{style:pt,children:N("div",{style:ut})})]})}),r.length>0&&N(pe,{filters:r,isPortrait:v,currency:a,minRatingSuffix:A,clearAllLabel:W,previousFiltersLabel:l,nextFiltersLabel:w,formatCurrency:H,onFilterChange:B,onResetFilters:S,onClearAll:P})]})};import{jsx as Fe,jsxs as Re}from"react/jsx-runtime";function on(e){let r=f.useRef(null),[o,i]=f.useState(null),s=f.useRef(e);return f.useEffect(()=>{s.current=e}),f.useEffect(()=>{let d=s.current,u={adapter:null,...d,callbacks:{...d.callbacks,onPropertiesChange:t=>{var n,a;i(c=>c?{...c,properties:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onPropertiesChange)==null||a.call(n,t)},onSelectedPropertyChange:t=>{var n,a;i(c=>c?{...c,selectedPropertyId:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onSelectedPropertyChange)==null||a.call(n,t)},onPrimaryTypeChange:t=>{var n,a;i(c=>c?{...c,primary:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onPrimaryTypeChange)==null||a.call(n,t)},onFiltersChange:t=>{var n,a;i(c=>c?{...c,filters:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onFiltersChange)==null||a.call(n,t)},onBoundsChange:t=>{var n,a;i(c=>c?{...c,bounds:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onBoundsChange)==null||a.call(n,t)},onPendingBoundsChange:t=>{var n,a;i(c=>c?{...c,pendingBounds:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onPendingBoundsChange)==null||a.call(n,t)},onCenterChange:(t,n)=>{var a,c;i(m=>m?{...m,center:t,zoom:n}:null),(c=(a=s.current.callbacks)==null?void 0:a.onCenterChange)==null||c.call(a,t,n)},onZoomChange:t=>{var n,a;i(c=>c?{...c,zoom:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onZoomChange)==null||a.call(n,t)},onActiveLocationChange:t=>{var n,a;i(c=>c?{...c,activeLocation:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onActiveLocationChange)==null||a.call(n,t)},onLoadingStateChange:t=>{var n,a;i(c=>c?{...c,initialLoading:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onLoadingStateChange)==null||a.call(n,t)},onSearchingStateChange:t=>{var n,a;i(c=>c?{...c,isSearching:t}:null),(a=(n=s.current.callbacks)==null?void 0:n.onSearchingStateChange)==null||a.call(n,t)}}},p=new we(u);return r.current=p,i(p.getState()),()=>{p.destroy(),r.current=null,i(null)}},[]),{mapFirst:r.current,state:o}}function sn(e){let[r,o]=f.useState([]);return f.useEffect(()=>{if(!e){o([]);return}o(e.getState().properties)},[e]),r}function an(e){let[r,o]=f.useState(null);return f.useEffect(()=>{if(!e){o(null);return}o(e.getState().selectedPropertyId)},[e]),r}function ln(e){let[r,o]=f.useState("Accommodation");f.useEffect(()=>{if(!e){o("Accommodation");return}o(e.getState().primary)},[e]);let i=f.useCallback(s=>{e&&(e.setPrimaryType(s),o(s))},[e]);return[r,i]}function cn(e){let[r,o]=f.useState(null);f.useEffect(()=>{if(!e){o(null);return}o(e.getState().selectedPropertyId)},[e]);let i=f.useCallback(s=>{e&&e.setSelectedMarker(s)},[e]);return[r,i]}function pn({mapFirst:e,map:r,maplibregl:o,onMarkerClick:i}){let s=f.useRef(!1);f.useEffect(()=>{!e||!r||s.current||(e.attachMap(r,{platform:"maplibre",maplibregl:o,onMarkerClick:i}),s.current=!0)},[e,r,o,i])}function un({mapFirst:e,map:r,google:o,onMarkerClick:i}){let s=f.useRef(!1);f.useEffect(()=>{!e||!r||s.current||(e.attachMap(r,{platform:"google",google:o,onMarkerClick:i}),s.current=!0)},[e,r,o,i])}function dn({mapFirst:e,map:r,mapboxgl:o,onMarkerClick:i}){let s=f.useRef(!1);f.useEffect(()=>{!e||!r||s.current||(e.attachMap(r,{platform:"mapbox",mapboxgl:o,onMarkerClick:i}),s.current=!0)},[e,r,o,i])}function mn(e){let r=f.useRef(null);return f.useEffect(()=>{if(!e)return;let o=new we(e);return r.current=o,()=>{o.destroy(),r.current=null}},[e]),r}function fn(e){let[r,o]=f.useState(!1),[i,s]=f.useState(null);return{search:f.useCallback(async u=>{if(!e){let p=new Error("MapFirst instance not available");throw s(p),p}o(!0),s(null);try{return await e.runPropertiesSearch({...u,onError:t=>{let n=t instanceof Error?t:new Error(String(t));s(n)}})}catch(p){let t=p instanceof Error?p:new Error(String(p));throw s(t),t}finally{o(!1)}},[e]),isLoading:r,error:i}}function gn(e){let[r,o]=f.useState(!1),[i,s]=f.useState(null);return{search:f.useCallback(async u=>{if(!e){let p=new Error("MapFirst instance not available");throw s(p),p}o(!0),s(null);try{return await e.runSmartFilterSearch({...u,onError:t=>{let n=t instanceof Error?t:new Error(String(t));s(n)}})}catch(p){let t=p instanceof Error?p:new Error(String(p));throw s(t),t}finally{o(!1)}},[e]),isLoading:r,error:i}}function yn(e){let[r,o]=f.useState(!1),[i,s]=f.useState(null);return{performBoundsSearch:f.useCallback(async()=>{if(!e)return null;o(!0),s(null);try{return await e.performBoundsSearch()}catch(u){let p=u instanceof Error?u:new Error(String(u));throw s(p),p}finally{o(!1)}},[e]),isSearching:r,error:i}}function hn({markers:e}){return Re("div",{style:{fontFamily:"sans-serif",fontSize:14},children:[Fe("strong",{children:"Markers"}),Fe("ul",{children:e.map(r=>{var o,i,s,d,u,p;return Re("li",{children:[r.name," \u2014 ",(s=(i=(o=r.location)==null?void 0:o.lat)==null?void 0:i.toFixed(3))!=null?s:"n/a",","," ",(p=(u=(d=r.location)==null?void 0:d.lon)==null?void 0:u.toFixed(3))!=null?p:"n/a"]},String(r.tripadvisor_id))})})]})}export{J as Chip,me as CloseIcon,q as EditIcon,pe as FilterChips,hn as MarkerDebugList,G as MinRatingFilterChip,Z as NextIcon,oe as PriceRangeFilterChip,ie as RestaurantPriceLevelChip,V as SearchIcon,mt as SmartFilter,fe as StarIcon,ae as TransformedQueryChip,Cn as convertToApiFilters,Rt as createMinRatingFilterLabel,wt as createPriceRangeFilterLabel,ee as formatRatingValue,xn as processApiFilters,De as renderStars,le as useFilterScroll,un as useGoogleMapsAttachment,ue as useIsPortrait,mn as useMapFirst,yn as useMapFirstBoundsSearch,on as useMapFirstCore,sn as useMapFirstProperties,an as useMapFirstSelectedProperty,pn as useMapLibreAttachment,dn as useMapboxAttachment,ln as usePrimaryType,fn as usePropertiesSearch,cn as useSelectedMarker,gn as useSmartFilterSearch,R as useTranslation};
10
+ `}),t.length===0&&_("form",{onSubmit:E,style:{...ot,...P},children:Re("div",{style:it,children:[_("input",{type:"text",value:v,onChange:b=>R(b.target.value),disabled:n,style:{...at,...h},autoComplete:"off","aria-label":"Smart search"}),i&&v.length===0&&!n&&_("span",{style:ct,children:V}),n&&_("div",{style:st,children:_("div",{style:lt})})]})}),t.length>0&&_(pe,{filters:t,currency:u,minRatingSuffix:B,clearAllLabel:k,previousFiltersLabel:O,nextFiltersLabel:a,formatCurrency:I,onFilterChange:M,onResetFilters:Z,onClearAll:F})]})};function Xr(e){let t=L.useRef(null),[p,n]=L.useState(null),l=L.useRef(e);L.useEffect(()=>{l.current=e}),L.useEffect(()=>{let F=l.current,b={adapter:null,...F,callbacks:{...F.callbacks,onPropertiesChange:c=>{var o,g;n(S=>S?{...S,properties:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onPropertiesChange)==null||g.call(o,c)},onSelectedPropertyChange:c=>{var o,g;n(S=>S?{...S,selectedPropertyId:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onSelectedPropertyChange)==null||g.call(o,c)},onPrimaryTypeChange:c=>{var o,g;n(S=>S?{...S,primary:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onPrimaryTypeChange)==null||g.call(o,c)},onFiltersChange:c=>{var o,g;n(S=>S?{...S,filters:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onFiltersChange)==null||g.call(o,c)},onBoundsChange:c=>{var o,g;n(S=>S?{...S,bounds:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onBoundsChange)==null||g.call(o,c)},onPendingBoundsChange:c=>{var o,g;n(S=>S?{...S,pendingBounds:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onPendingBoundsChange)==null||g.call(o,c)},onCenterChange:(c,o)=>{var g,S;n(de=>de?{...de,center:c,zoom:o}:null),(S=(g=l.current.callbacks)==null?void 0:g.onCenterChange)==null||S.call(g,c,o)},onZoomChange:c=>{var o,g;n(S=>S?{...S,zoom:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onZoomChange)==null||g.call(o,c)},onActiveLocationChange:c=>{var o,g;n(S=>S?{...S,activeLocation:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onActiveLocationChange)==null||g.call(o,c)},onLoadingStateChange:c=>{var o,g;n(S=>S?{...S,initialLoading:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onLoadingStateChange)==null||g.call(o,c)},onSearchingStateChange:c=>{var o,g;n(S=>S?{...S,isSearching:c}:null),(g=(o=l.current.callbacks)==null?void 0:o.onSearchingStateChange)==null||g.call(o,c)}}},y=new ut(b);return t.current=y,n(y.getState()),()=>{y.destroy(),t.current=null,n(null)}},[]);let m=L.useCallback(F=>{t.current&&t.current.setPrimaryType(F)},[]),f=L.useCallback(F=>{t.current&&t.current.setSelectedMarker(F)},[]),[s,i]=L.useState(!1),[d,u]=L.useState(null),P=L.useMemo(()=>({search:async F=>{if(!t.current){let b=new Error("MapFirst instance not available");throw u(b),b}i(!0),u(null);try{return await t.current.runPropertiesSearch({...F,onError:y=>{let c=y instanceof Error?y:new Error(String(y));u(c)}})}catch(b){let y=b instanceof Error?b:new Error(String(b));throw u(y),y}finally{i(!1)}},isLoading:s,error:d}),[s,d]),[h,w]=L.useState(!1),[C,x]=L.useState(null),v=L.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 c=y instanceof Error?y:new Error(String(y));x(c)}})}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,r]=L.useState(!1),[I,B]=L.useState(null),V=L.useMemo(()=>({perform:async()=>{if(!t.current)return null;r(!0),B(null);try{return await t.current.performBoundsSearch()}catch(F){let b=F instanceof Error?F:new Error(String(F));throw B(b),b}finally{r(!1)}},isSearching:R,error:I}),[R,I]),O=L.useRef(!1),a=L.useCallback((F,b,y)=>{t.current&&F&&!O.current&&(t.current.attachMap(F,{platform:"maplibre",maplibregl:b,onMarkerClick:y==null?void 0:y.onMarkerClick}),O.current=!0)},[]),k=L.useRef(!1),E=L.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)},[]),M=L.useRef(!1),Z=L.useCallback((F,b,y)=>{t.current&&F&&!M.current&&(t.current.attachMap(F,{platform:"mapbox",mapboxgl:b,onMarkerClick:y==null?void 0:y.onMarkerClick}),M.current=!0)},[]);return{instance:t.current,state:p,setPrimaryType:m,setSelectedMarker:f,propertiesSearch:P,smartFilterSearch:v,boundsSearch:V,attachMapLibre:a,attachGoogle:E,attachMapbox:Z}}export{ee as Chip,ge as CloseIcon,Q as EditIcon,pe as FilterChips,U as MinRatingFilterChip,j as NextIcon,ie as PriceRangeFilterChip,ae as RestaurantPriceLevelChip,me as SearchIcon,pt as SmartFilter,ye as StarIcon,le as TransformedQueryChip,rn as convertToApiFilters,Ft as createMinRatingFilterLabel,Pt as createPriceRangeFilterLabel,te as formatRatingValue,tn as processApiFilters,He as renderStars,ce as useFilterScroll,Xr as useMapFirst,N as useTranslation};
11
11
  //# sourceMappingURL=index.mjs.map