react-listing-engine 0.7.4 → 0.7.6

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.
@@ -1,2 +0,0 @@
1
- "use client";
2
- var X=class{state;listeners=new Set;constructor(e){this.state=this.freezeState({filters:{...e.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,hovered:null,pagination:{mode:e.mode??"paged",loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(e){this.setState({filters:{...this.state.filters,...e}})}setResults(e){this.setState({results:{items:[...e.items],nextCursor:e.nextCursor,total:e.total}})}appendResults(e){this.setState({results:{items:[...this.state.results.items,...e.items],nextCursor:e.nextCursor,total:e.total}})}setBounds(e){this.setState({bounds:e?{...e}:null})}setSelection(e){this.setState({selection:e})}setHovered(e){this.setState({hovered:e})}setLayerVisible(e,i){this.setState({layers:{...this.state.layers,[e]:i}})}setLoading(e){this.setState({pagination:{...this.state.pagination,loading:e}})}setPoints(e,i){this.setState({points:{...this.state.points,[e]:[...i]}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=this.freezeState({...this.state,...e}),this.notify()}notify(){for(let e of this.listeners)e()}freezeState(e){Object.freeze(e.filters),Object.freeze(e.results.items),Object.freeze(e.results),e.bounds&&Object.freeze(e.bounds),Object.freeze(e.pagination),Object.freeze(e.layers);for(let i of Object.values(e.points))Object.freeze(i);return Object.freeze(e.points),Object.freeze(e)}};var z=class{defs=new Map;add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>i.isActive?.(e)).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}};var J=class{defs=new Map;add(e){if(this.defs.has(e.id))throw new Error(`DatasetRegistry: dataset "${e.id}" is already registered`);return this.defs.set(e.id,{...e}),this}get(e){return this.defs.get(e)}has(e){return this.defs.has(e)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(e=>e.visible?.()!==!1).map(e=>e.id)}};var Y=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}};var Ie={pagination:"paged",pageSize:20,debounceMs:250};var ee=class{options;constructor(e){this.options=Object.freeze({...Ie,...e})}};var te=class{filters;map;datasets;primaryDatasetId;store;emitter=new Y;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new z,this.map=e.map,this.config=new ee(e.config);let i=e.primaryDatasetId??this.datasets.list()[0]?.id;if(i==null||!this.datasets.has(i))throw new Error(`ListingEngine: primary dataset "${i??""}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=i,this.store=new X({filters:e.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}selectPoint(e,i){this.store.setSelection(i);let r=this.state.points[e]?.find(n=>n.id===i);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function Ee(...t){let e={config:{},filters:new z,datasets:new J};for(let i of t)i(e);return e}var xe=t=>e=>{e.config={...e.config,...t}},Ne=t=>e=>{e.map=t},Re=t=>e=>{e.datasets.add(t)},Me=t=>e=>{t(e.filters)},wi=t=>e=>{e.urlSync=t},De=t=>e=>{e.initialFilters=t},ki=t=>e=>{e.primaryDatasetId=t};import{createContext as ct,useContext as ut}from"react";import{jsx as E,jsxs as Ft}from"react/jsx-runtime";function mt(t){return String(t?.title??"")}var ft=({item:t})=>E("div",{children:mt(t)}),gt=()=>E("div",{}),ce=()=>E("div",{}),yt=({children:t})=>E("div",{children:t}),vt=({children:t})=>E("div",{children:t}),ht=({value:t,onChange:e,placeholder:i})=>E("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search"}),Lt=()=>E("div",{role:"status",children:"No results"}),bt=()=>E("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),Pt=({count:t})=>Ft("div",{children:[t," results"]}),Tt=({children:t})=>E("div",{children:t}),S={Card:ft,Marker:gt,Popup:ce,Sidebar:yt,FilterPanel:vt,Search:ht,Empty:Lt,Loading:bt,ResultHeader:Pt,Toolbar:Tt},Oe=ct(S);function _e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:l,Loading:p,ResultHeader:d,Toolbar:a,children:g}=t,m={Card:e??S.Card,Marker:i??S.Marker,Popup:r??S.Popup,Sidebar:n??S.Sidebar,FilterPanel:s??S.FilterPanel,Search:o??S.Search,Empty:l??S.Empty,Loading:p??S.Loading,ResultHeader:d??S.ResultHeader,Toolbar:a??S.Toolbar};return E(Oe.Provider,{value:m,children:g})}function T(){return ut(Oe)}import{createContext as Ct}from"react";var ie=Ct(null);import{useContext as wt}from"react";function v(){let t=wt(ie);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as Be,useSyncExternalStore as kt}from"react";function F(){let t=v(),e=Be(r=>t.subscribe(r),[t]),i=Be(()=>t.state,[t]);return kt(e,i,i)}import{useCallback as Ae}from"react";function re(){let t=v(),e=F(),i=Ae(n=>t.applyFilters(n),[t]),r=Ae((n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}import{jsx as q,jsxs as St}from"react/jsx-runtime";function ue({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=v(),{FilterPanel:o}=T(),{filters:l}=re(),p=r!==void 0&&n!==void 0,d=p?r:l;return q(o,{children:q("div",{className:t??"space-y-5",children:s.filters.list().map(a=>{if(typeof a.render=="string")return q("div",{"data-filter":a.key,className:e},a.key);let g=a.render;return St("div",{className:e,children:[a.label&&!i&&q("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),q(g,{value:a.fromParams(d),onChange:m=>p?n(a.toParams(m)):void s.applyFilters(a.toParams(m))})]},a.key)})})})}function U(){return F().results}import{jsx as ne}from"react/jsx-runtime";function It(t,e){if(t&&typeof t=="object"&&"id"in t){let i=t.id;if(typeof i=="string"||typeof i=="number")return i}return e}function He({className:t}={}){let e=v(),{items:i}=U(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:l}=T();return r.loading&&i.length===0?ne(l,{}):i.length===0?ne(o,{}):ne("div",{role:"list",className:t,children:i.map((p,d)=>{let a=It(p,d);return ne(s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}import{useEffect as j,useRef as _,useState as ze}from"react";import{createPortal as Et}from"react-dom";import{jsx as me,jsxs as Ve}from"react/jsx-runtime";var xt={west:-179.9,south:-85,east:179.9,north:85},Ue=.1,Ke=.02;function Nt(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:l,lng:p}of t)p<e&&(e=p),p>i&&(i=p),l<r&&(r=l),l>n&&(n=l);let s=n>r?(n-r)*Ue:Ke,o=i>e?(i-e)*Ue:Ke;return{west:e-o,east:i+o,south:r-s,north:n+s}}function $e(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=v(),o=F(),l=_(null),p=_(null),d=_(null),[a,g]=ze(!1),m=_(!1),D=_(!1),I=_(!1),c=s.map;j(()=>{let h=d.current;if(!c||!h)return;let y=[];for(let f of Object.keys(o.points)){if(o.layers[f]===!1)continue;let L=s.datasets.get(f),w=o.points[f]??[],H={id:f,markers:w.map(k=>({id:k.id,position:k.position,iconUrl:L?.marker.iconUrl?.(k.entity),element:L?.marker.element?.(k.entity)})),clustering:L?.clustering,onMarkerClick:k=>s.selectPoint(f,k)};y.push(c.renderLayer(h,H))}return()=>{y.forEach(f=>f())}},[s,c,a,o.points,o.layers]),j(()=>{if(!l.current||!c)return;let h=l.current,y=!1,f=null;return(async()=>{let L=await c.mount(h,{center:e,zoom:i,fullscreenTarget:p.current??void 0});if(y){c.destroy(L);return}d.current=L,f=c.onBoundsChange(L,w=>{I.current?I.current=!1:D.current=!0,s.loadPoints(w)}),g(!0),s.loadPoints(xt)})(),()=>{y=!0,f?.(),d.current&&(c.destroy(d.current),d.current=null),g(!1)}},[s,c]),j(()=>{let h=d.current;if(!c||!h||e||m.current||D.current)return;let y=[];for(let L of Object.keys(o.points))if(o.layers[L]!==!1)for(let w of o.points[L]??[])y.push(w.position);let f=Nt(y);f&&(m.current=!0,I.current=!0,c.fitBounds(h,f))},[c,e,a,o.points,o.layers]),j(()=>{c?.updateMarkerStates(o.selection,o.hovered)},[c,a,o.selection,o.hovered]);let{Popup:P}=T(),O=P!==ce,x=o.points[s.primaryDatasetId]??[],N=o.selection!=null?x.find(h=>h.id===o.selection):void 0,[$,G]=ze(null),Z=_(N);return Z.current=N,j(()=>{let h=d.current;if(!c||!h||!O)return;let y=Z.current;if(!y)return;let f=c.mountOverlay(y.position);G({entity:y.entity,position:y.position,container:f.container});let L=()=>s.selectPoint(s.primaryDatasetId,null),w=k=>{k.key==="Escape"&&L()};document.addEventListener("keydown",w);let H=c.onMapClick(L);return()=>{document.removeEventListener("keydown",w),H(),f.unmount(),G(null)}},[s,c,a,o.selection,O]),Ve("div",{ref:p,className:"relative h-full min-h-0 w-full",children:[Ve("div",{ref:l,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,O&&$?Et(me(P,{entity:$.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),$.container):null]}),n!=null&&me("div",{className:"pointer-events-none absolute inset-0",children:me("div",{className:"pointer-events-auto",children:n})})]})}import{jsx as Rt}from"react/jsx-runtime";function We(){let t=v(),{results:e,pagination:i}=F();return e.nextCursor==null?null:Rt("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"})}import{jsx as Mt}from"react/jsx-runtime";function qe(){let{items:t,total:e}=U(),{ResultHeader:i}=T();return Mt(i,{count:t.length,total:e})}import{useEffect as Dt,useRef as Ot}from"react";function je(t,e){let i=v(),r=Ot(e);r.current=e,Dt(()=>i.on(t,n=>r.current(n)),[i,t])}import{useEffect as _t,useState as Qe}from"react";import{jsx as Bt}from"react/jsx-runtime";function Ge(t){let{children:e,...i}=t,[r]=Qe(()=>i),[n,s]=Qe(null);return _t(()=>{let o=new te({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(l=>l===o?null:l)}},[r]),n?Bt(ie.Provider,{value:n,children:e}):null}function K(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as Ht,jsx as R,jsxs as Ze}from"react/jsx-runtime";function At(t){return t?"rle-card rle-card--selected":"rle-card"}function fe({item:t,selected:e,onSelect:i}){let r=t??{},n=At(e),s=Ze(Ht,{children:[r.imageUrl?R("img",{src:r.imageUrl,alt:r.title??"",className:"rle-card-media"}):R("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),Ze("div",{className:"rle-card-body",children:[r.title&&R("span",{className:"rle-card-title",children:r.title}),r.subtitle&&R("span",{className:"rle-card-address",children:r.subtitle}),r.badge&&R("div",{className:"rle-card-info",children:R("span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&R("span",{className:"rle-card-price",children:K(r.price)})]})]});return i?R("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:n,children:s}):R("article",{className:n,children:s})}import{jsx as se,jsxs as Xe}from"react/jsx-runtime";function ge(t){return Xe("div",{role:"status",className:"rle-empty",children:[Xe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[se("circle",{cx:"11",cy:"11",r:"7"}),se("path",{d:"m21 21-4.3-4.3"})]}),se("p",{className:"rle-empty-title",children:"No results"}),se("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as zt}from"react/jsx-runtime";function ye({children:t}){return zt("div",{className:"rle-filter-panel",children:t})}import{jsx as oe,jsxs as Ut}from"react/jsx-runtime";function ve(t){return oe("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>Ut("div",{className:"rle-loading-item",children:[oe("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),oe("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),oe("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as Kt}from"react/jsx-runtime";function he({point:t}){let e=t.entity??{};return Kt("span",{className:"rle-pin",children:e.price!=null?K(e.price):""})}import{jsx as V,jsxs as Le}from"react/jsx-runtime";function be({entity:t,onClose:e}){let i=t??{};return Le("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[V("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:Le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[V("path",{d:"M18 6 6 18"}),V("path",{d:"m6 6 12 12"})]})}),Le("div",{children:[i.title&&V("div",{className:"rle-card-title",children:i.title}),i.subtitle&&V("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&V("div",{className:"rle-card-price",children:K(i.price)})]})]})}import{jsx as Vt}from"react/jsx-runtime";function Pe({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return Vt("div",{className:"rle-result-header",children:i})}import{jsx as $t}from"react/jsx-runtime";function Te({value:t,onChange:e,placeholder:i}){return $t("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as Wt}from"react/jsx-runtime";function Fe({children:t}){return Wt("aside",{className:"rle-sidebar",children:t})}import{jsx as qt}from"react/jsx-runtime";function Ce({children:t}){return qt("div",{className:"rle-toolbar",children:t})}var Je={Card:fe,Marker:he,Popup:be,Sidebar:Fe,FilterPanel:ye,Search:Te,Empty:ge,Loading:ve,ResultHeader:Pe,Toolbar:Ce};import{jsx as C,jsxs as Q}from"react/jsx-runtime";function Ye({view:t,onViewChange:e}){return C("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:Q("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[Q("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[C(jt,{}),"List"]}),Q("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[C(Qt,{}),"Map"]})]})})}function jt(){return Q("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[C("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),C("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),C("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),C("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),C("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),C("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Qt(){return Q("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[C("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),C("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),C("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}import{useEffect as we,useRef as Gt,useState as et}from"react";import{createPortal as Zt}from"react-dom";import{Fragment as Jt,jsx as M,jsxs as ae}from"react/jsx-runtime";function tt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=Gt(null),[o,l]=et(!1),[p,d]=et(!1);return we(()=>{if(!t){d(!1),l(!1);return}l(!0);let a=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(a)},[t]),we(()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),we(()=>{if(!o)return;s.current?.focus();function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:Zt(ae(Jt,{children:[M("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),ae("div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[M("div",{className:"rle-sheet__handle","aria-hidden":"true"}),ae("div",{className:"rle-sheet__header",children:[i&&M("div",{className:"rle-sheet__title",children:i}),M("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:M(Xt,{})})]}),M("div",{className:"rle-sheet__body",children:r}),n&&M("div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function Xt(){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[M("path",{d:"M18 6 6 18"}),M("path",{d:"m6 6 12 12"})]})}import{useEffect as ke,useRef as rt,useState as A}from"react";import{jsx as b,jsxs as le}from"react/jsx-runtime";function it({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=T();return le("header",{className:"rle-mobile-header",children:[t&&b("div",{className:"rle-mobile-header__search",children:b(n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),le("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[b(Yt,{}),b("span",{children:"Filters"}),i>0&&b("span",{className:"rle-mobile-header__count",children:i})]}),r&&b("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:r.icon??b(ei,{})})]})}function Yt(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),b("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),b("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),b("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),b("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),b("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function ei(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{Fragment as ni,jsx as u,jsxs as B}from"react/jsx-runtime";var ti=u("div",{className:"rle-empty",children:"Map unavailable"});function ii(){let t=rt(null),[e,i]=A(!0),[r,n]=A(!0);return ke(()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:m,scrollWidth:D}=s;i(m<=0),n(m+g>=D-1)},l=0,p=()=>{l||(l=requestAnimationFrame(()=>{l=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let d,a;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(o),d.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),d?.disconnect(),a?.disconnect(),l&&cancelAnimationFrame(l)}},[]),{atEnd:r,atStart:e,ref:t}}function ri(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function nt({search:t,toolbarEnd:e,mobileAction:i,autoFetch:r=!0,hasMap:n,mapCenter:s,mapZoom:o,mapControls:l,className:p}){let d=v(),{Search:a}=T(),g=U(),{filters:m,set:D}=re(),{pagination:I}=F(),c=n??d.map!=null,[P,O]=A("list"),[x,N]=A(!1),{atEnd:$,atStart:G,ref:Z}=ii(),[h,y]=A(m),[f,L]=A(x);x!==f&&(L(x),x&&y(m));let w=pe=>y(pt=>({...pt,...pe})),[H,k]=A(!1),de=rt(!1);ke(()=>{if(H){if(I.loading){de.current=!0;return}de.current&&(de.current=!1,k(!1),N(!1))}},[H,I.loading]);let W=t?{value:String(m[t.filterKey]??""),onChange:pe=>{D({[t.filterKey]:pe||void 0})},placeholder:t.placeholder}:void 0;ke(()=>{r!==!1&&d.applyFilters({})},[d,r]);let ot=()=>{w(d.filters.clearedParams())},at=()=>{if(ri(h,m)){N(!1);return}k(!0),d.applyFilters(h)},lt=d.filters.activeKeys(m).length,dt=g.total??g.items.length;return B("div",{className:p?`rle-app ${p}`:"rle-app",children:[B("div",{className:"rle-filter-bar",children:[B("div",{className:"rle-filter-bar__scroll",ref:Z,children:[W&&u("div",{className:"rle-filter-bar__search",children:u(a,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),u(ue,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!G&&u("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!$&&u("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),u(it,{search:W,onFiltersClick:()=>N(!0),filterCount:lt,action:i}),B("div",{className:`rle-body ${c?"rle-split":"rle-body--list-only"}`,"data-mobile-view":P,children:[B("div",{className:"rle-list",children:[B("div",{className:"rle-list-header",children:[u(qe,{}),e&&u("div",{className:"rle-list-header__toolbar",children:e})]}),u(He,{className:"rle-list-grid"}),u(We,{})]}),c&&u("div",{className:"rle-map",children:u($e,{center:s,zoom:o,fallback:ti,mapControls:l})})]}),c&&u(Ye,{view:P,onViewChange:O}),u(tt,{title:"Filters",open:x,onOpenChange:N,footer:B(ni,{children:[u("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:ot,children:"Clear all"}),u("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:I.loading,onClick:at,children:I.loading?u("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${dt} results`})]}),children:u(ue,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:h,onDraftChange:w})})]})}import{useEffect as si,useRef as oi,useState as ai}from"react";import{jsx as Se,jsxs as pi}from"react/jsx-runtime";function st(t){return"provider"in t}function li(t){let e=t!=null&&!st(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,l]=ai(()=>!t||st(t)?{ready:!0,provider:t?.provider}:{ready:!1});return si(()=>{if(!i)return;let p=!1;return import("./maps/google/index.js").then(({googleProvider:d})=>{p||l({ready:!0,provider:d({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function di({onFiltersChange:t}){let e=oi(t);return e.current=t,je("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function xn(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:l,search:p,toolbarEnd:d,mapControls:a,config:g,autoFetch:m,className:D}=t,{ready:I,provider:c}=li(r);if(!I)return null;let P=[];for(let N of e)P.push(Re(N));i&&P.push(Me(i)),c&&P.push(Ne(c)),s&&P.push(De(s)),g&&P.push(xe(g));let O=Ee(...P),x={...Je,...n};return pi(Ge,{...O,children:[o&&Se(di,{onFiltersChange:o}),Se(_e,{...x,children:Se(nt,{className:D,search:p,toolbarEnd:d,mobileAction:l,autoFetch:m,mapCenter:r?.center,mapZoom:r?.zoom,mapControls:a})})]})}export{X as a,z as b,J as c,Y as d,Ie as e,ee as f,te as g,Ee as h,xe as i,Ne as j,Re as k,Me as l,wi as m,De as n,ki as o,ce as p,_e as q,T as r,ie as s,v as t,F as u,re as v,ue as w,U as x,He as y,$e as z,We as A,qe as B,je as C,Ge as D,fe as E,ge as F,ye as G,ve as H,he as I,be as J,Pe as K,Te as L,Fe as M,Ce as N,Je as O,Ye as P,tt as Q,nt as R,xn as S};
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5;"use client";
2
- var X= (_class =class{__init() {this.listeners=new Set}constructor(e){;_class.prototype.__init.call(this);this.state=this.freezeState({filters:{...e.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,hovered:null,pagination:{mode:_nullishCoalesce(e.mode, () => ("paged")),loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(e){this.setState({filters:{...this.state.filters,...e}})}setResults(e){this.setState({results:{items:[...e.items],nextCursor:e.nextCursor,total:e.total}})}appendResults(e){this.setState({results:{items:[...this.state.results.items,...e.items],nextCursor:e.nextCursor,total:e.total}})}setBounds(e){this.setState({bounds:e?{...e}:null})}setSelection(e){this.setState({selection:e})}setHovered(e){this.setState({hovered:e})}setLayerVisible(e,i){this.setState({layers:{...this.state.layers,[e]:i}})}setLoading(e){this.setState({pagination:{...this.state.pagination,loading:e}})}setPoints(e,i){this.setState({points:{...this.state.points,[e]:[...i]}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=this.freezeState({...this.state,...e}),this.notify()}notify(){for(let e of this.listeners)e()}freezeState(e){Object.freeze(e.filters),Object.freeze(e.results.items),Object.freeze(e.results),e.bounds&&Object.freeze(e.bounds),Object.freeze(e.pagination),Object.freeze(e.layers);for(let i of Object.values(e.points))Object.freeze(i);return Object.freeze(e.points),Object.freeze(e)}}, _class);var z= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>_optionalChain([i, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(e)])).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}}, _class2);var J= (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this.defs=new Map}add(e){if(this.defs.has(e.id))throw new Error(`DatasetRegistry: dataset "${e.id}" is already registered`);return this.defs.set(e.id,{...e}),this}get(e){return this.defs.get(e)}has(e){return this.defs.has(e)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(e=>_optionalChain([e, 'access', _4 => _4.visible, 'optionalCall', _5 => _5()])!==!1).map(e=>e.id)}}, _class3);var Y= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}}, _class4);var Ie={pagination:"paged",pageSize:20,debounceMs:250};var ee=class{constructor(e){this.options=Object.freeze({...Ie,...e})}};var te= (_class5 =class{__init5() {this.emitter=new Y}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}constructor(e){;_class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);_class5.prototype.__init9.call(this);this.datasets=e.datasets,this.filters=_nullishCoalesce(e.filters, () => (new z)),this.map=e.map,this.config=new ee(e.config);let i=_nullishCoalesce(e.primaryDatasetId, () => (_optionalChain([this, 'access', _6 => _6.datasets, 'access', _7 => _7.list, 'call', _8 => _8(), 'access', _9 => _9[0], 'optionalAccess', _10 => _10.id])));if(i==null||!this.datasets.has(i))throw new Error(`ListingEngine: primary dataset "${_nullishCoalesce(i, () => (""))}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=i,this.store=new X({filters:_nullishCoalesce(e.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}selectPoint(e,i){this.store.setSelection(i);let r=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(n=>n.id===i)]);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function Ee(...t){let e={config:{},filters:new z,datasets:new J};for(let i of t)i(e);return e}var xe=t=>e=>{e.config={...e.config,...t}},Ne= exports.j =t=>e=>{e.map=t},Re= exports.k =t=>e=>{e.datasets.add(t)},Me= exports.l =t=>e=>{t(e.filters)},wi= exports.m =t=>e=>{e.urlSync=t},De= exports.n =t=>e=>{e.initialFilters=t},ki= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function mt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var ft=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:mt(t)}),gt=()=>_jsxruntime.jsx.call(void 0, "div",{}),ce= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),yt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),vt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),ht=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),Lt=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),bt=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),Pt=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),Tt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),S={Card:ft,Marker:gt,Popup:ce,Sidebar:yt,FilterPanel:vt,Search:ht,Empty:Lt,Loading:bt,ResultHeader:Pt,Toolbar:Tt},Oe=_react.createContext.call(void 0, S);function _e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:l,Loading:p,ResultHeader:d,Toolbar:a,children:g}=t,m={Card:_nullishCoalesce(e, () => (S.Card)),Marker:_nullishCoalesce(i, () => (S.Marker)),Popup:_nullishCoalesce(r, () => (S.Popup)),Sidebar:_nullishCoalesce(n, () => (S.Sidebar)),FilterPanel:_nullishCoalesce(s, () => (S.FilterPanel)),Search:_nullishCoalesce(o, () => (S.Search)),Empty:_nullishCoalesce(l, () => (S.Empty)),Loading:_nullishCoalesce(p, () => (S.Loading)),ResultHeader:_nullishCoalesce(d, () => (S.ResultHeader)),Toolbar:_nullishCoalesce(a, () => (S.Toolbar))};return _jsxruntime.jsx.call(void 0, Oe.Provider,{value:m,children:g})}function T(){return _react.useContext.call(void 0, Oe)}var ie=_react.createContext.call(void 0, null);function v(){let t=_react.useContext.call(void 0, ie);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function F(){let t=v(),e=_react.useCallback.call(void 0, r=>t.subscribe(r),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function re(){let t=v(),e=F(),i=_react.useCallback.call(void 0, n=>t.applyFilters(n),[t]),r=_react.useCallback.call(void 0, (n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}function ue({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=v(),{FilterPanel:o}=T(),{filters:l}=re(),p=r!==void 0&&n!==void 0,d=p?r:l;return _jsxruntime.jsx.call(void 0, o,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(t, () => ("space-y-5")),children:s.filters.list().map(a=>{if(typeof a.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":a.key,className:e},a.key);let g=a.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[a.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),_jsxruntime.jsx.call(void 0, g,{value:a.fromParams(d),onChange:m=>p?n(a.toParams(m)):void s.applyFilters(a.toParams(m))})]},a.key)})})})}function U(){return F().results}function It(t,e){if(t&&typeof t=="object"&&"id"in t){let i=t.id;if(typeof i=="string"||typeof i=="number")return i}return e}function He({className:t}={}){let e=v(),{items:i}=U(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:l}=T();return r.loading&&i.length===0?_jsxruntime.jsx.call(void 0, l,{}):i.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:t,children:i.map((p,d)=>{let a=It(p,d);return _jsxruntime.jsx.call(void 0, s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}var _reactdom = require('react-dom');var xt={west:-179.9,south:-85,east:179.9,north:85},Ue=.1,Ke=.02;function Nt(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:l,lng:p}of t)p<e&&(e=p),p>i&&(i=p),l<r&&(r=l),l>n&&(n=l);let s=n>r?(n-r)*Ue:Ke,o=i>e?(i-e)*Ue:Ke;return{west:e-o,east:i+o,south:r-s,north:n+s}}function $e(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=v(),o=F(),l=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),d=_react.useRef.call(void 0, null),[a,g]=_react.useState.call(void 0, !1),m=_react.useRef.call(void 0, !1),D=_react.useRef.call(void 0, !1),I=_react.useRef.call(void 0, !1),c=s.map;_react.useEffect.call(void 0, ()=>{let h=d.current;if(!c||!h)return;let y=[];for(let f of Object.keys(o.points)){if(o.layers[f]===!1)continue;let L=s.datasets.get(f),w=_nullishCoalesce(o.points[f], () => ([])),H={id:f,markers:w.map(k=>({id:k.id,position:k.position,iconUrl:_optionalChain([L, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(k.entity)]),element:_optionalChain([L, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(k.entity)])})),clustering:_optionalChain([L, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:k=>s.selectPoint(f,k)};y.push(c.renderLayer(h,H))}return()=>{y.forEach(f=>f())}},[s,c,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{if(!l.current||!c)return;let h=l.current,y=!1,f=null;return(async()=>{let L=await c.mount(h,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(p.current, () => (void 0))});if(y){c.destroy(L);return}d.current=L,f=c.onBoundsChange(L,w=>{I.current?I.current=!1:D.current=!0,s.loadPoints(w)}),g(!0),s.loadPoints(xt)})(),()=>{y=!0,_optionalChain([f, 'optionalCall', _24 => _24()]),d.current&&(c.destroy(d.current),d.current=null),g(!1)}},[s,c]),_react.useEffect.call(void 0, ()=>{let h=d.current;if(!c||!h||e||m.current||D.current)return;let y=[];for(let L of Object.keys(o.points))if(o.layers[L]!==!1)for(let w of _nullishCoalesce(o.points[L], () => ([])))y.push(w.position);let f=Nt(y);f&&(m.current=!0,I.current=!0,c.fitBounds(h,f))},[c,e,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([c, 'optionalAccess', _25 => _25.updateMarkerStates, 'call', _26 => _26(o.selection,o.hovered)])},[c,a,o.selection,o.hovered]);let{Popup:P}=T(),O=P!==ce,x=_nullishCoalesce(o.points[s.primaryDatasetId], () => ([])),N=o.selection!=null?x.find(h=>h.id===o.selection):void 0,[$,G]=_react.useState.call(void 0, null),Z=_react.useRef.call(void 0, N);return Z.current=N,_react.useEffect.call(void 0, ()=>{let h=d.current;if(!c||!h||!O)return;let y=Z.current;if(!y)return;let f=c.mountOverlay(y.position);G({entity:y.entity,position:y.position,container:f.container});let L=()=>s.selectPoint(s.primaryDatasetId,null),w=k=>{k.key==="Escape"&&L()};document.addEventListener("keydown",w);let H=c.onMapClick(L);return()=>{document.removeEventListener("keydown",w),H(),f.unmount(),G(null)}},[s,c,a,o.selection,O]),_jsxruntime.jsxs.call(void 0, "div",{ref:p,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,O&&$?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, P,{entity:$.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),$.container):null]}),n!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-none absolute inset-0",children:_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-auto",children:n})})]})}function We(){let t=v(),{results:e,pagination:i}=F();return e.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"})}function qe(){let{items:t,total:e}=U(),{ResultHeader:i}=T();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function je(t,e){let i=v(),r=_react.useRef.call(void 0, e);r.current=e,_react.useEffect.call(void 0, ()=>i.on(t,n=>r.current(n)),[i,t])}function Ge(t){let{children:e,...i}=t,[r]=_react.useState.call(void 0, ()=>i),[n,s]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new te({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(l=>l===o?null:l)}},[r]),n?_jsxruntime.jsx.call(void 0, ie.Provider,{value:n,children:e}):null}function K(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}function At(t){return t?"rle-card rle-card--selected":"rle-card"}function fe({item:t,selected:e,onSelect:i}){let r=_nullishCoalesce(t, () => ({})),n=At(e),s=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:r.title}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:K(r.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:n,children:s}):_jsxruntime.jsx.call(void 0, "article",{className:n,children:s})}function ge(t){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"rle-empty",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-title",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}function ye({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function ve(t){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rle-loading-item",children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}function he({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?K(e.price):""})}function be({entity:t,onClose:e}){let i=_nullishCoalesce(t, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{children:[i.title&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-title",children:i.title}),i.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-price",children:K(i.price)})]})]})}function Pe({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"rle-result-header",children:i})}function Te({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function Fe({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function Ce({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var Je={Card:fe,Marker:he,Popup:be,Sidebar:Fe,FilterPanel:ye,Search:Te,Empty:ge,Loading:ve,ResultHeader:Pe,Toolbar:Ce};function Ye({view:t,onViewChange:e}){return _jsxruntime.jsx.call(void 0, "nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[_jsxruntime.jsx.call(void 0, jt,{}),"List"]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[_jsxruntime.jsx.call(void 0, Qt,{}),"Map"]})]})})}function jt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Qt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"3",x2:"8",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function tt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=_react.useRef.call(void 0, null),[o,l]=_react.useState.call(void 0, !1),[p,d]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){d(!1),l(!1);return}l(!0);let a=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(a)},[t]),_react.useEffect.call(void 0, ()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),_react.useEffect.call(void 0, ()=>{if(!o)return;_optionalChain([s, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]);function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:i}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, Xt,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:r}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function Xt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}function it({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=T();return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[_jsxruntime.jsx.call(void 0, Yt,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),r&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:_nullishCoalesce(r.icon, () => (_jsxruntime.jsx.call(void 0, ei,{})))})]})}function Yt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function ei(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_jsxruntime.jsx.call(void 0, "line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}var ti=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function ii(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[r,n]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:m,scrollWidth:D}=s;i(m<=0),n(m+g>=D-1)},l=0,p=()=>{l||(l=requestAnimationFrame(()=>{l=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let d,a;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(o),d.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),_optionalChain([d, 'optionalAccess', _30 => _30.disconnect, 'call', _31 => _31()]),_optionalChain([a, 'optionalAccess', _32 => _32.disconnect, 'call', _33 => _33()]),l&&cancelAnimationFrame(l)}},[]),{atEnd:r,atStart:e,ref:t}}function ri(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function nt({search:t,toolbarEnd:e,mobileAction:i,autoFetch:r=!0,hasMap:n,mapCenter:s,mapZoom:o,mapControls:l,className:p}){let d=v(),{Search:a}=T(),g=U(),{filters:m,set:D}=re(),{pagination:I}=F(),c=_nullishCoalesce(n, () => (d.map!=null)),[P,O]=_react.useState.call(void 0, "list"),[x,N]=_react.useState.call(void 0, !1),{atEnd:$,atStart:G,ref:Z}=ii(),[h,y]=_react.useState.call(void 0, m),[f,L]=_react.useState.call(void 0, x);x!==f&&(L(x),x&&y(m));let w=pe=>y(pt=>({...pt,...pe})),[H,k]=_react.useState.call(void 0, !1),de=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(H){if(I.loading){de.current=!0;return}de.current&&(de.current=!1,k(!1),N(!1))}},[H,I.loading]);let W=t?{value:String(_nullishCoalesce(m[t.filterKey], () => (""))),onChange:pe=>{D({[t.filterKey]:pe||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{r!==!1&&d.applyFilters({})},[d,r]);let ot=()=>{w(d.filters.clearedParams())},at=()=>{if(ri(h,m)){N(!1);return}k(!0),d.applyFilters(h)},lt=d.filters.activeKeys(m).length,dt=_nullishCoalesce(g.total, () => (g.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:p?`rle-app ${p}`:"rle-app",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar__scroll",ref:Z,children:[W&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, a,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),_jsxruntime.jsx.call(void 0, ue,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!G&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!$&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, it,{search:W,onFiltersClick:()=>N(!0),filterCount:lt,action:i}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${c?"rle-split":"rle-body--list-only"}`,"data-mobile-view":P,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, qe,{}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:e})]}),_jsxruntime.jsx.call(void 0, He,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, We,{})]}),c&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, $e,{center:s,zoom:o,fallback:ti,mapControls:l})})]}),c&&_jsxruntime.jsx.call(void 0, Ye,{view:P,onViewChange:O}),_jsxruntime.jsx.call(void 0, tt,{title:"Filters",open:x,onOpenChange:N,footer:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:ot,children:"Clear all"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:I.loading,onClick:at,children:I.loading?_jsxruntime.jsx.call(void 0, "span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${dt} results`})]}),children:_jsxruntime.jsx.call(void 0, ue,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:h,onDraftChange:w})})]})}function st(t){return"provider"in t}function li(t){let e=t!=null&&!st(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,l]=_react.useState.call(void 0, ()=>!t||st(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _34 => _34.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:d})=>{p||l({ready:!0,provider:d({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function di({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,je("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function xn(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:l,search:p,toolbarEnd:d,mapControls:a,config:g,autoFetch:m,className:D}=t,{ready:I,provider:c}=li(r);if(!I)return null;let P=[];for(let N of e)P.push(Re(N));i&&P.push(Me(i)),c&&P.push(Ne(c)),s&&P.push(De(s)),g&&P.push(xe(g));let O=Ee(...P),x={...Je,...n};return _jsxruntime.jsxs.call(void 0, Ge,{...O,children:[o&&_jsxruntime.jsx.call(void 0, di,{onFiltersChange:o}),_jsxruntime.jsx.call(void 0, _e,{...x,children:_jsxruntime.jsx.call(void 0, nt,{className:D,search:p,toolbarEnd:d,mobileAction:l,autoFetch:m,mapCenter:_optionalChain([r, 'optionalAccess', _35 => _35.center]),mapZoom:_optionalChain([r, 'optionalAccess', _36 => _36.zoom]),mapControls:a})})]})}exports.a = X; exports.b = z; exports.c = J; exports.d = Y; exports.e = Ie; exports.f = ee; exports.g = te; exports.h = Ee; exports.i = xe; exports.j = Ne; exports.k = Re; exports.l = Me; exports.m = wi; exports.n = De; exports.o = ki; exports.p = ce; exports.q = _e; exports.r = T; exports.s = ie; exports.t = v; exports.u = F; exports.v = re; exports.w = ue; exports.x = U; exports.y = He; exports.z = $e; exports.A = We; exports.B = qe; exports.C = je; exports.D = Ge; exports.E = fe; exports.F = ge; exports.G = ye; exports.H = ve; exports.I = he; exports.J = be; exports.K = Pe; exports.L = Te; exports.M = Fe; exports.N = Ce; exports.O = Je; exports.P = Ye; exports.Q = tt; exports.R = nt; exports.S = xn;