react-listing-engine 0.8.0 → 0.10.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-listing-engine
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `onMapReady` now delivers the provider's NATIVE map object (the `google.maps.Map` for the Google provider) rather than the provider's internal raw handle. Previously it passed `MapHandle.raw`, which for the Google provider is internal state that merely _contains_ the map (`{ map, ... }`) -- so consumers had to reach into `.map`. `MapHandle` gains an optional `nativeMap` field that providers populate with the bare map; `onMapReady` prefers it and falls back to `raw`.
8
+
9
+ ## 0.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add an `initialPage` prop to `ListingApp` (0-based): when set, the mount autoFetch loads that page directly via `engine.goToPage(initialPage)` (an offset request) instead of page 1, so a deep-linked/refreshed `?page=N` restores in a single fetch rather than page-1-then-jump. Only honored with `autoFetch` on; unset/`0` loads page 1 as before. Needs an offset-capable adapter.
14
+
3
15
  ## 0.8.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,2 @@
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 ee= (_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,pageIndex:0},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}})}setPageIndex(e){this.setState({pagination:{...this.state.pagination,pageIndex: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 $= (_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(),n=e.filter(s=>this.defs.has(s));n.forEach((s,o)=>{this.defs.get(s).order=o});let r=new Set(n);return i.filter(s=>!r.has(s.key)).forEach((s,o)=>{s.order=n.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(n=>Object.hasOwn(e,n.key)).map(n=>n.toParams(e[n.key])).reduce((n,r)=>({...n,...r}),{})}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 te= (_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 ie= (_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 r of[...i])r(e);let n=this.map.get("*");if(n)for(let r of[...n])r(e)}on(e,i){let n=this.map.get(e);return n||(n=new Set,this.map.set(e,n)),n.add(i),()=>{n.delete(i)}}}, _class4);var Ae={pagination:"paged",pageSize:20,debounceMs:250};var ne=class{constructor(e){this.options=Object.freeze({...Ae,...e})}};var re= (_class5 =class{__init5() {this.emitter=new ie}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}__init10() {this.mapHandle=null}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);_class5.prototype.__init10.call(this);this.datasets=e.datasets,this.filters=_nullishCoalesce(e.filters, () => (new $)),this.map=e.map,this.config=new ne(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 ee({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,n=this.config.options.debounceMs;return n<=0?this.runQuery(i):new Promise(r=>{this.debounceResolve=r,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,r(this.runQuery(i))},n)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(r):this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.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(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async r=>{let s=this.datasets.get(r);if(!s)return;let o=await s.adapter.getPoints(i,e);n===this.pointsToken&&this.store.setPoints(r,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e,i){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e,i)}selectPoint(e,i){this.store.setSelection(i);let n=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(r=>r.id===i)]);n&&this.emitter.emit({type:"PointClicked",datasetId:e,id:n.id,entity:n.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let n=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,n),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:n})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let n=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.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 ze(...t){let e={config:{},filters:new $,datasets:new te};for(let i of t)i(e);return e}var Ue=t=>e=>{e.config={...e.config,...t}},Ke= exports.j =t=>e=>{e.map=t},Ve= exports.k =t=>e=>{e.datasets.add(t)},qe= exports.l =t=>e=>{t(e.filters)},Bi= exports.m =t=>e=>{e.urlSync=t},$e= exports.n =t=>e=>{e.initialFilters=t},Oi= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function Tt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var Ft=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:Tt(t)}),kt=()=>_jsxruntime.jsx.call(void 0, "div",{}),fe= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),Ct=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),St=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),wt=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),It=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),Et=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),xt=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),Nt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Mt=({view:t,onViewChange:e})=>_jsxruntime.jsxs.call(void 0, "nav",{"aria-label":"Listing navigation",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":t==="list",onClick:()=>e("list"),children:"List"}),_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":t==="map",onClick:()=>e("map"),children:"Map"})]}),C={BottomNav:Mt,Card:Ft,Marker:kt,Popup:fe,Sidebar:Ct,FilterPanel:St,Search:wt,Empty:It,Loading:Et,ResultHeader:xt,Toolbar:Nt},We=_react.createContext.call(void 0, C);function je(t){let{BottomNav:e,Card:i,Marker:n,Popup:r,Sidebar:s,FilterPanel:o,Search:a,Empty:p,Loading:d,ResultHeader:l,Toolbar:c,children:y}=t,v={BottomNav:_nullishCoalesce(e, () => (C.BottomNav)),Card:_nullishCoalesce(i, () => (C.Card)),Marker:_nullishCoalesce(n, () => (C.Marker)),Popup:_nullishCoalesce(r, () => (C.Popup)),Sidebar:_nullishCoalesce(s, () => (C.Sidebar)),FilterPanel:_nullishCoalesce(o, () => (C.FilterPanel)),Search:_nullishCoalesce(a, () => (C.Search)),Empty:_nullishCoalesce(p, () => (C.Empty)),Loading:_nullishCoalesce(d, () => (C.Loading)),ResultHeader:_nullishCoalesce(l, () => (C.ResultHeader)),Toolbar:_nullishCoalesce(c, () => (C.Toolbar))};return _jsxruntime.jsx.call(void 0, We.Provider,{value:v,children:y})}function w(){return _react.useContext.call(void 0, We)}var se=_react.createContext.call(void 0, null);function h(){let t=_react.useContext.call(void 0, se);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function I(){let t=h(),e=_react.useCallback.call(void 0, n=>t.subscribe(n),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function oe(){let t=h(),e=I(),i=_react.useCallback.call(void 0, r=>t.applyFilters(r),[t]),n=_react.useCallback.call(void 0, (r,s)=>t.applyFilters({[r]:s}),[t]);return{filters:e.filters,set:i,setField:n}}function ye({className:t,groupClassName:e,hideLabels:i,draft:n,onDraftChange:r}={}){let s=h(),{FilterPanel:o}=w(),{filters:a}=oe(),p=n!==void 0&&r!==void 0,d=p?n:a;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(l=>{if(typeof l.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":l.key,className:e},l.key);let c=l.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[l.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:l.label}),_jsxruntime.jsx.call(void 0, c,{value:l.fromParams(d),onChange:y=>p?r(l.toParams(y)):void s.applyFilters(l.toParams(y))})]},l.key)})})})}function W(){return I().results}function _t(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 Xe({className:t}={}){let e=h(),{items:i}=W(),{pagination:n,selection:r}=I(),{Card:s,Empty:o,Loading:a}=w();return n.loading&&i.length===0?_jsxruntime.jsx.call(void 0, a,{}):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 l=_t(p,d);return _jsxruntime.jsx.call(void 0, s,{item:p,selected:r===l,onSelect:()=>e.selectPoint(e.primaryDatasetId,l)},l)})})}var _reactdom = require('react-dom');var At={west:-179.9,south:-85,east:179.9,north:85},Ye=.1,et=.02;function zt(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,n=t[0].lat,r=t[0].lat;for(let{lat:a,lng:p}of t)p<e&&(e=p),p>i&&(i=p),a<n&&(n=a),a>r&&(r=a);let s=r>n?(r-n)*Ye:et,o=i>e?(i-e)*Ye:et;return{west:e-o,east:i+o,south:n-s,north:r+s}}function it(t){let{center:e,zoom:i,fallback:n,mapControls:r,onMapReady:s}=t,o=h(),a=I(),p=_react.useRef.call(void 0, s);p.current=s;let d=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, null),c=_react.useRef.call(void 0, null),[y,v]=_react.useState.call(void 0, !1),O=_react.useRef.call(void 0, !1),K=_react.useRef.call(void 0, !1),D=_react.useRef.call(void 0, !1),u=o.map;_react.useEffect.call(void 0, ()=>{let T=c.current;if(!u||!T)return;let L=[];for(let f of Object.keys(a.points)){if(a.layers[f]===!1)continue;let m=o.datasets.get(f),F=_nullishCoalesce(a.points[f], () => ([])),q={id:f,markers:F.map(N=>({id:N.id,position:N.position,iconUrl:_optionalChain([m, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(N.entity)]),element:_optionalChain([m, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(N.entity)])})),clustering:_optionalChain([m, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:N=>o.selectPoint(f,N)};L.push(u.renderLayer(T,q))}return()=>{L.forEach(f=>f())}},[o,u,y,a.points,a.layers]),_react.useEffect.call(void 0, ()=>{if(!d.current||!u)return;let T=d.current,L=!1,f=null;return(async()=>{let m=await u.mount(T,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(l.current, () => (void 0))});if(L){u.destroy(m);return}c.current=m,o.setMapHandle(m),f=u.onBoundsChange(m,F=>{D.current?D.current=!1:K.current=!0,o.loadPoints(F)}),v(!0),_optionalChain([p, 'access', _24 => _24.current, 'optionalCall', _25 => _25(_nullishCoalesce(m.nativeMap, () => (m.raw)))]),o.loadPoints(At)})(),()=>{L=!0,_optionalChain([f, 'optionalCall', _26 => _26()]),c.current&&(u.destroy(c.current),c.current=null,o.setMapHandle(null),_optionalChain([p, 'access', _27 => _27.current, 'optionalCall', _28 => _28(null)])),v(!1)}},[o,u]),_react.useEffect.call(void 0, ()=>{let T=c.current;if(!u||!T||e||O.current||K.current)return;let L=[];for(let m of Object.keys(a.points))if(a.layers[m]!==!1)for(let F of _nullishCoalesce(a.points[m], () => ([])))L.push(F.position);let f=zt(L);f&&(O.current=!0,D.current=!0,u.fitBounds(T,f))},[u,e,y,a.points,a.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([u, 'optionalAccess', _29 => _29.updateMarkerStates, 'call', _30 => _30(a.selection,a.hovered)])},[u,y,a.selection,a.hovered]);let{Popup:V}=w(),b=V!==fe,k=_nullishCoalesce(a.points[o.primaryDatasetId], () => ([])),_=a.selection!=null?k.find(T=>T.id===a.selection):void 0,[H,x]=_react.useState.call(void 0, null),A=_react.useRef.call(void 0, _);return A.current=_,_react.useEffect.call(void 0, ()=>{let T=c.current;if(!u||!T||!b)return;let L=A.current;if(!L)return;let f=u.mountOverlay(L.position);x({entity:L.entity,position:L.position,container:f.container});let m=()=>o.selectPoint(o.primaryDatasetId,null),F=N=>{N.key==="Escape"&&m()};document.addEventListener("keydown",F);let q=u.onMapClick(m);return()=>{document.removeEventListener("keydown",F),q(),f.unmount(),x(null)}},[o,u,y,a.selection,b]),_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:!u&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!u&&n,b&&H?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, V,{entity:H.entity,onClose:()=>o.selectPoint(o.primaryDatasetId,null)}),H.container):null]}),r!=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:r})})]})}var he="gap";function Ut(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),n=Math.min(t-1,e+1),r=[1];i>2&&r.push(he);for(let s=i;s<=n;s+=1)r.push(s);return n<t-1&&r.push(he),r.push(t),r}function nt(){let t=h(),{results:e,pagination:i}=I();if(i.mode==="infinite")return e.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let n=t.options.pageSize,{pageIndex:r}=i,s=r+1,o=e.total!=null?Math.ceil(e.total/n):null,a=o!=null?s<o:e.nextCursor!=null||e.items.length>=n;if(o!=null?o<=1:r===0&&!a)return null;let p=d=>()=>{t.goToPage(d)};return _jsxruntime.jsxs.call(void 0, "nav",{className:"rle-pagination","aria-label":"Pagination",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||r===0,onClick:p(r-1),children:"\u2039"}),o!=null&&Ut(o,s).map((d,l)=>d===he?_jsxruntime.jsx.call(void 0, "span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${l}`):_jsxruntime.jsx.call(void 0, "button",{type:"button",className:d===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${d}`,"aria-current":d===s?"page":void 0,disabled:i.loading,onClick:p(d-1),children:d},d)),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!a,onClick:p(r+1),children:"\u203A"})]})}function rt(){let{items:t,total:e}=W(),{ResultHeader:i}=w();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function st(t,e){let i=h(),n=_react.useRef.call(void 0, e);n.current=e,_react.useEffect.call(void 0, ()=>i.on(t,r=>n.current(r)),[i,t])}function at(t){let{children:e,...i}=t,[n]=_react.useState.call(void 0, ()=>i),[r,s]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new re({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),s(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),s(a=>a===o?null:a)}},[n]),r?_jsxruntime.jsx.call(void 0, se.Provider,{value:r,children:e}):null}function lt({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, Gt,{}),"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 Gt(){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 j(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}function Zt(t){return t?"rle-card rle-card--selected":"rle-card"}function be({item:t,selected:e,onSelect:i}){let n=_nullishCoalesce(t, () => ({})),r=Zt(e),s=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[n.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:n.imageUrl,alt:_nullishCoalesce(n.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:[n.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:n.title}),n.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:n.subtitle}),n.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:n.badge})}),n.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:j(n.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:r,children:s}):_jsxruntime.jsx.call(void 0, "article",{className:r,children:s})}function Le(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 Pe({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function Te(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 Fe({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?j(e.price):""})}function Ce({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:j(i.price)})]})]})}function Se({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 we({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function Ie({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function Ee({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var ut={BottomNav:lt,Card:be,Marker:Fe,Popup:Ce,Sidebar:Ie,FilterPanel:Pe,Search:we,Empty:Le,Loading:Te,ResultHeader:Se,Toolbar:Ee};function mt({open:t,onOpenChange:e,title:i,children:n,footer:r}){let s=_react.useRef.call(void 0, null),[o,a]=_react.useState.call(void 0, !1),[p,d]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){d(!1),a(!1);return}a(!0);let l=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(l)},[t]),_react.useEffect.call(void 0, ()=>{if(!o)return;let l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}},[o]),_react.useEffect.call(void 0, ()=>{if(!o)return;_optionalChain([s, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.focus, 'call', _33 => _33()]);function l(c){c.key==="Escape"&&e(!1)}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[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, ai,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:n}),r&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:r})]})]}),document.body)}function ai(){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 gt({search:t,onFiltersClick:e,filterCount:i=0,action:n}){let{Search:r}=w();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, r,{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, di,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),n&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:n.onClick,"aria-label":n.label,children:_nullishCoalesce(n.icon, () => (_jsxruntime.jsx.call(void 0, pi,{})))})]})}function di(){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 pi(){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 ui=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function ci(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[n,r]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:c,scrollLeft:y,scrollWidth:v}=s;i(y<=0),r(y+c>=v-1)},a=0,p=()=>{a||(a=requestAnimationFrame(()=>{a=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let d,l;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(o),d.observe(s)),typeof MutationObserver<"u"&&(l=new MutationObserver(p),l.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),_optionalChain([d, 'optionalAccess', _34 => _34.disconnect, 'call', _35 => _35()]),_optionalChain([l, 'optionalAccess', _36 => _36.disconnect, 'call', _37 => _37()]),a&&cancelAnimationFrame(a)}},[]),{atEnd:n,atStart:e,ref:t}}function mi(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,n=e,r=new Set([...Object.keys(i),...Object.keys(n)]);for(let s of r)if(i[s]!==n[s])return!1;return!0}function ft({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:n,autoFetch:r=!0,initialPage:s,hasMap:o,mapCenter:a,mapZoom:p,mapControls:d,onMapReady:l,mobileSheetFooter:c,className:y}){let v=h(),{BottomNav:O,Search:K}=w(),D=W(),{filters:u,set:V}=oe(),{pagination:b}=I(),k=_nullishCoalesce(o, () => (v.map!=null)),[_,H]=_react.useState.call(void 0, "list"),[x,A]=_react.useState.call(void 0, !1),{atEnd:T,atStart:L,ref:f}=ci(),m=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{b.mode==="paged"&&m.current&&(m.current.scrollTop=0)},[b.mode,b.pageIndex]);let[F,q]=_react.useState.call(void 0, u),[N,vt]=_react.useState.call(void 0, x);x!==N&&(vt(x),x&&q(u));let Re=ge=>q(bt=>({...bt,...ge})),[De,Be]=_react.useState.call(void 0, !1),me=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(De){if(b.loading){me.current=!0;return}me.current&&(me.current=!1,Be(!1),A(!1))}},[De,b.loading]);let Q=t?{value:String(_nullishCoalesce(u[t.filterKey], () => (""))),onChange:ge=>{V({[t.filterKey]:ge||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{r!==!1&&(s&&s>0?v.goToPage(s):v.applyFilters({}))},[v,r]);let Oe=()=>{Re(v.filters.clearedParams())},_e=()=>{if(mi(F,u)){A(!1);return}Be(!0),v.applyFilters(F)},ht=v.filters.activeKeys(u).length,He=_nullishCoalesce(D.total, () => (D.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:y?`rle-app ${y}`:"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:f,children:[Q&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, K,{value:Q.value,onChange:Q.onChange,placeholder:Q.placeholder})}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__slot",children:e}),_jsxruntime.jsx.call(void 0, ye,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!L&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!T&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, gt,{search:Q,onFiltersClick:()=>A(!0),filterCount:ht,action:n}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${k?"rle-split":"rle-body--list-only"}`,"data-mobile-view":_,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",ref:m,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, rt,{}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:i})]}),_jsxruntime.jsx.call(void 0, Xe,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, nt,{})]}),k&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, it,{center:a,zoom:p,fallback:ui,mapControls:d,onMapReady:l})})]}),k&&_jsxruntime.jsx.call(void 0, O,{view:_,onViewChange:H}),_jsxruntime.jsx.call(void 0, mt,{title:"Filters",open:x,onOpenChange:A,footer:c?c({draft:F,apply:_e,clear:Oe,resultCount:He,loading:b.loading}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:Oe,children:"Clear all"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:b.loading,onClick:_e,children:b.loading?_jsxruntime.jsx.call(void 0, "span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${He} results`})]}),children:_jsxruntime.jsx.call(void 0, ye,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:F,onDraftChange:Re})})]})}function yt(t){return"provider"in t}function hi(t){let e=t!=null&&!yt(t),i=e?t.apiKey:void 0,n=e?t.mapId:void 0,r=e?t.mapOptions:void 0,s=e?t.styles:void 0,o=e?t.overlayMarkers:void 0,[a,p]=_react.useState.call(void 0, ()=>!t||yt(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _38 => _38.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let d=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:l})=>{d||p({ready:!0,provider:l({apiKey:i,mapId:n,mapOptions:r,styles:s,overlayMarkers:o})})}),()=>{d=!0}},[i,n]),a}function bi({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,st("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function zr(t){let{datasets:e,filters:i,map:n,components:r,initialFilters:s,onFiltersChange:o,mobileAction:a,search:p,filterBarStart:d,toolbarEnd:l,mapControls:c,onMapReady:y,mobileSheetFooter:v,config:O,autoFetch:K,initialPage:D,className:u}=t,{ready:V,provider:b}=hi(n);if(!V)return null;let k=[];for(let x of e)k.push(Ve(x));i&&k.push(qe(i)),b&&k.push(Ke(b)),s&&k.push($e(s)),O&&k.push(Ue(O));let _=ze(...k),H={...ut,...r};return _jsxruntime.jsxs.call(void 0, at,{..._,children:[o&&_jsxruntime.jsx.call(void 0, bi,{onFiltersChange:o}),_jsxruntime.jsx.call(void 0, je,{...H,children:_jsxruntime.jsx.call(void 0, ft,{className:u,search:p,filterBarStart:d,toolbarEnd:l,mobileAction:a,autoFetch:K,mapCenter:_optionalChain([n, 'optionalAccess', _39 => _39.center]),mapZoom:_optionalChain([n, 'optionalAccess', _40 => _40.zoom]),mapControls:c,onMapReady:y,initialPage:D,mobileSheetFooter:v})})]})}exports.a = ee; exports.b = $; exports.c = te; exports.d = ie; exports.e = Ae; exports.f = ne; exports.g = re; exports.h = ze; exports.i = Ue; exports.j = Ke; exports.k = Ve; exports.l = qe; exports.m = Bi; exports.n = $e; exports.o = Oi; exports.p = fe; exports.q = je; exports.r = w; exports.s = se; exports.t = h; exports.u = I; exports.v = oe; exports.w = ye; exports.x = W; exports.y = Xe; exports.z = it; exports.A = nt; exports.B = rt; exports.C = st; exports.D = at; exports.E = lt; exports.F = be; exports.G = Le; exports.H = Pe; exports.I = Te; exports.J = Fe; exports.K = Ce; exports.L = Se; exports.M = we; exports.N = Ie; exports.O = Ee; exports.P = ut; exports.Q = mt; exports.R = ft; exports.S = zr;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ var ee=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,pageIndex:0},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}})}setPageIndex(e){this.setState({pagination:{...this.state.pagination,pageIndex: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 $=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(),n=e.filter(s=>this.defs.has(s));n.forEach((s,o)=>{this.defs.get(s).order=o});let r=new Set(n);return i.filter(s=>!r.has(s.key)).forEach((s,o)=>{s.order=n.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(n=>Object.hasOwn(e,n.key)).map(n=>n.toParams(e[n.key])).reduce((n,r)=>({...n,...r}),{})}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 te=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 ie=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let r of[...i])r(e);let n=this.map.get("*");if(n)for(let r of[...n])r(e)}on(e,i){let n=this.map.get(e);return n||(n=new Set,this.map.set(e,n)),n.add(i),()=>{n.delete(i)}}};var Ae={pagination:"paged",pageSize:20,debounceMs:250};var ne=class{options;constructor(e){this.options=Object.freeze({...Ae,...e})}};var re=class{filters;map;datasets;primaryDatasetId;store;emitter=new ie;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;mapHandle=null;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new $,this.map=e.map,this.config=new ne(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 ee({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,n=this.config.options.debounceMs;return n<=0?this.runQuery(i):new Promise(r=>{this.debounceResolve=r,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,r(this.runQuery(i))},n)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(r):this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.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(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async r=>{let s=this.datasets.get(r);if(!s)return;let o=await s.adapter.getPoints(i,e);n===this.pointsToken&&this.store.setPoints(r,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e,i){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e,i)}selectPoint(e,i){this.store.setSelection(i);let n=this.state.points[e]?.find(r=>r.id===i);n&&this.emitter.emit({type:"PointClicked",datasetId:e,id:n.id,entity:n.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let n=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,n),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:n})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let n=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.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 ze(...t){let e={config:{},filters:new $,datasets:new te};for(let i of t)i(e);return e}var Ue=t=>e=>{e.config={...e.config,...t}},Ke=t=>e=>{e.map=t},Ve=t=>e=>{e.datasets.add(t)},qe=t=>e=>{t(e.filters)},Bi=t=>e=>{e.urlSync=t},$e=t=>e=>{e.initialFilters=t},Oi=t=>e=>{e.primaryDatasetId=t};import{createContext as Lt,useContext as Pt}from"react";import{jsx as S,jsxs as Ge}from"react/jsx-runtime";function Tt(t){return String(t?.title??"")}var Ft=({item:t})=>S("div",{children:Tt(t)}),kt=()=>S("div",{}),fe=()=>S("div",{}),Ct=({children:t})=>S("div",{children:t}),St=({children:t})=>S("div",{children:t}),wt=({value:t,onChange:e,placeholder:i})=>S("input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":i??"Search"}),It=()=>S("div",{role:"status",children:"No results"}),Et=()=>S("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),xt=({count:t})=>Ge("div",{children:[t," results"]}),Nt=({children:t})=>S("div",{children:t}),Mt=({view:t,onViewChange:e})=>Ge("nav",{"aria-label":"Listing navigation",children:[S("button",{type:"button","aria-pressed":t==="list",onClick:()=>e("list"),children:"List"}),S("button",{type:"button","aria-pressed":t==="map",onClick:()=>e("map"),children:"Map"})]}),C={BottomNav:Mt,Card:Ft,Marker:kt,Popup:fe,Sidebar:Ct,FilterPanel:St,Search:wt,Empty:It,Loading:Et,ResultHeader:xt,Toolbar:Nt},We=Lt(C);function je(t){let{BottomNav:e,Card:i,Marker:n,Popup:r,Sidebar:s,FilterPanel:o,Search:a,Empty:p,Loading:d,ResultHeader:l,Toolbar:c,children:y}=t,v={BottomNav:e??C.BottomNav,Card:i??C.Card,Marker:n??C.Marker,Popup:r??C.Popup,Sidebar:s??C.Sidebar,FilterPanel:o??C.FilterPanel,Search:a??C.Search,Empty:p??C.Empty,Loading:d??C.Loading,ResultHeader:l??C.ResultHeader,Toolbar:c??C.Toolbar};return S(We.Provider,{value:v,children:y})}function w(){return Pt(We)}import{createContext as Rt}from"react";var se=Rt(null);import{useContext as Dt}from"react";function h(){let t=Dt(se);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as Qe,useSyncExternalStore as Bt}from"react";function I(){let t=h(),e=Qe(n=>t.subscribe(n),[t]),i=Qe(()=>t.state,[t]);return Bt(e,i,i)}import{useCallback as Ze}from"react";function oe(){let t=h(),e=I(),i=Ze(r=>t.applyFilters(r),[t]),n=Ze((r,s)=>t.applyFilters({[r]:s}),[t]);return{filters:e.filters,set:i,setField:n}}import{jsx as Z,jsxs as Ot}from"react/jsx-runtime";function ye({className:t,groupClassName:e,hideLabels:i,draft:n,onDraftChange:r}={}){let s=h(),{FilterPanel:o}=w(),{filters:a}=oe(),p=n!==void 0&&r!==void 0,d=p?n:a;return Z(o,{children:Z("div",{className:t??"space-y-5",children:s.filters.list().map(l=>{if(typeof l.render=="string")return Z("div",{"data-filter":l.key,className:e},l.key);let c=l.render;return Ot("div",{className:e,children:[l.label&&!i&&Z("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:l.label}),Z(c,{value:l.fromParams(d),onChange:y=>p?r(l.toParams(y)):void s.applyFilters(l.toParams(y))})]},l.key)})})})}function W(){return I().results}import{jsx as ae}from"react/jsx-runtime";function _t(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 Xe({className:t}={}){let e=h(),{items:i}=W(),{pagination:n,selection:r}=I(),{Card:s,Empty:o,Loading:a}=w();return n.loading&&i.length===0?ae(a,{}):i.length===0?ae(o,{}):ae("div",{role:"list",className:t,children:i.map((p,d)=>{let l=_t(p,d);return ae(s,{item:p,selected:r===l,onSelect:()=>e.selectPoint(e.primaryDatasetId,l)},l)})})}import{useEffect as X,useRef as B,useState as Je}from"react";import{createPortal as Ht}from"react-dom";import{jsx as ve,jsxs as tt}from"react/jsx-runtime";var At={west:-179.9,south:-85,east:179.9,north:85},Ye=.1,et=.02;function zt(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,n=t[0].lat,r=t[0].lat;for(let{lat:a,lng:p}of t)p<e&&(e=p),p>i&&(i=p),a<n&&(n=a),a>r&&(r=a);let s=r>n?(r-n)*Ye:et,o=i>e?(i-e)*Ye:et;return{west:e-o,east:i+o,south:n-s,north:r+s}}function it(t){let{center:e,zoom:i,fallback:n,mapControls:r,onMapReady:s}=t,o=h(),a=I(),p=B(s);p.current=s;let d=B(null),l=B(null),c=B(null),[y,v]=Je(!1),O=B(!1),K=B(!1),D=B(!1),u=o.map;X(()=>{let T=c.current;if(!u||!T)return;let L=[];for(let f of Object.keys(a.points)){if(a.layers[f]===!1)continue;let m=o.datasets.get(f),F=a.points[f]??[],q={id:f,markers:F.map(N=>({id:N.id,position:N.position,iconUrl:m?.marker.iconUrl?.(N.entity),element:m?.marker.element?.(N.entity)})),clustering:m?.clustering,onMarkerClick:N=>o.selectPoint(f,N)};L.push(u.renderLayer(T,q))}return()=>{L.forEach(f=>f())}},[o,u,y,a.points,a.layers]),X(()=>{if(!d.current||!u)return;let T=d.current,L=!1,f=null;return(async()=>{let m=await u.mount(T,{center:e,zoom:i,fullscreenTarget:l.current??void 0});if(L){u.destroy(m);return}c.current=m,o.setMapHandle(m),f=u.onBoundsChange(m,F=>{D.current?D.current=!1:K.current=!0,o.loadPoints(F)}),v(!0),p.current?.(m.nativeMap??m.raw),o.loadPoints(At)})(),()=>{L=!0,f?.(),c.current&&(u.destroy(c.current),c.current=null,o.setMapHandle(null),p.current?.(null)),v(!1)}},[o,u]),X(()=>{let T=c.current;if(!u||!T||e||O.current||K.current)return;let L=[];for(let m of Object.keys(a.points))if(a.layers[m]!==!1)for(let F of a.points[m]??[])L.push(F.position);let f=zt(L);f&&(O.current=!0,D.current=!0,u.fitBounds(T,f))},[u,e,y,a.points,a.layers]),X(()=>{u?.updateMarkerStates(a.selection,a.hovered)},[u,y,a.selection,a.hovered]);let{Popup:V}=w(),b=V!==fe,k=a.points[o.primaryDatasetId]??[],_=a.selection!=null?k.find(T=>T.id===a.selection):void 0,[H,x]=Je(null),A=B(_);return A.current=_,X(()=>{let T=c.current;if(!u||!T||!b)return;let L=A.current;if(!L)return;let f=u.mountOverlay(L.position);x({entity:L.entity,position:L.position,container:f.container});let m=()=>o.selectPoint(o.primaryDatasetId,null),F=N=>{N.key==="Escape"&&m()};document.addEventListener("keydown",F);let q=u.onMapClick(m);return()=>{document.removeEventListener("keydown",F),q(),f.unmount(),x(null)}},[o,u,y,a.selection,b]),tt("div",{ref:l,className:"relative h-full min-h-0 w-full",children:[tt("div",{ref:d,className:!u&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!u&&n,b&&H?Ht(ve(V,{entity:H.entity,onClose:()=>o.selectPoint(o.primaryDatasetId,null)}),H.container):null]}),r!=null&&ve("div",{className:"pointer-events-none absolute inset-0",children:ve("div",{className:"pointer-events-auto",children:r})})]})}import{jsx as J,jsxs as Kt}from"react/jsx-runtime";var he="gap";function Ut(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),n=Math.min(t-1,e+1),r=[1];i>2&&r.push(he);for(let s=i;s<=n;s+=1)r.push(s);return n<t-1&&r.push(he),r.push(t),r}function nt(){let t=h(),{results:e,pagination:i}=I();if(i.mode==="infinite")return e.nextCursor==null?null:J("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let n=t.options.pageSize,{pageIndex:r}=i,s=r+1,o=e.total!=null?Math.ceil(e.total/n):null,a=o!=null?s<o:e.nextCursor!=null||e.items.length>=n;if(o!=null?o<=1:r===0&&!a)return null;let p=d=>()=>{t.goToPage(d)};return Kt("nav",{className:"rle-pagination","aria-label":"Pagination",children:[J("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||r===0,onClick:p(r-1),children:"\u2039"}),o!=null&&Ut(o,s).map((d,l)=>d===he?J("span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${l}`):J("button",{type:"button",className:d===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${d}`,"aria-current":d===s?"page":void 0,disabled:i.loading,onClick:p(d-1),children:d},d)),J("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!a,onClick:p(r+1),children:"\u203A"})]})}import{jsx as Vt}from"react/jsx-runtime";function rt(){let{items:t,total:e}=W(),{ResultHeader:i}=w();return Vt(i,{count:t.length,total:e})}import{useEffect as qt,useRef as $t}from"react";function st(t,e){let i=h(),n=$t(e);n.current=e,qt(()=>i.on(t,r=>n.current(r)),[i,t])}import{useEffect as Wt,useState as ot}from"react";import{jsx as jt}from"react/jsx-runtime";function at(t){let{children:e,...i}=t,[n]=ot(()=>i),[r,s]=ot(null);return Wt(()=>{let o=new re({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),s(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),s(a=>a===o?null:a)}},[n]),r?jt(se.Provider,{value:r,children:e}):null}import{jsx as E,jsxs as Y}from"react/jsx-runtime";function lt({view:t,onViewChange:e}){return E("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:Y("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[Y("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[E(Gt,{}),"List"]}),Y("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[E(Qt,{}),"Map"]})]})})}function Gt(){return Y("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:[E("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),E("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),E("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),E("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),E("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),E("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Qt(){return Y("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:[E("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),E("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),E("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function j(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as Xt,jsx as M,jsxs as dt}from"react/jsx-runtime";function Zt(t){return t?"rle-card rle-card--selected":"rle-card"}function be({item:t,selected:e,onSelect:i}){let n=t??{},r=Zt(e),s=dt(Xt,{children:[n.imageUrl?M("img",{src:n.imageUrl,alt:n.title??"",className:"rle-card-media"}):M("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),dt("div",{className:"rle-card-body",children:[n.title&&M("span",{className:"rle-card-title",children:n.title}),n.subtitle&&M("span",{className:"rle-card-address",children:n.subtitle}),n.badge&&M("div",{className:"rle-card-info",children:M("span",{className:"rle-card-info-item",children:n.badge})}),n.price!=null&&M("span",{className:"rle-card-price",children:j(n.price)})]})]});return i?M("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:r,children:s}):M("article",{className:r,children:s})}import{jsx as le,jsxs as pt}from"react/jsx-runtime";function Le(t){return pt("div",{role:"status",className:"rle-empty",children:[pt("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:[le("circle",{cx:"11",cy:"11",r:"7"}),le("path",{d:"m21 21-4.3-4.3"})]}),le("p",{className:"rle-empty-title",children:"No results"}),le("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Jt}from"react/jsx-runtime";function Pe({children:t}){return Jt("div",{className:"rle-filter-panel",children:t})}import{jsx as de,jsxs as Yt}from"react/jsx-runtime";function Te(t){return de("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>Yt("div",{className:"rle-loading-item",children:[de("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),de("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),de("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as ei}from"react/jsx-runtime";function Fe({point:t}){let e=t.entity??{};return ei("span",{className:"rle-pin",children:e.price!=null?j(e.price):""})}import{jsx as G,jsxs as ke}from"react/jsx-runtime";function Ce({entity:t,onClose:e}){let i=t??{};return ke("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[G("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:ke("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:[G("path",{d:"M18 6 6 18"}),G("path",{d:"m6 6 12 12"})]})}),ke("div",{children:[i.title&&G("div",{className:"rle-card-title",children:i.title}),i.subtitle&&G("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&G("div",{className:"rle-card-price",children:j(i.price)})]})]})}import{jsx as ti}from"react/jsx-runtime";function Se({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return ti("div",{className:"rle-result-header",children:i})}import{jsx as ii}from"react/jsx-runtime";function we({value:t,onChange:e,placeholder:i}){return ii("input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as ni}from"react/jsx-runtime";function Ie({children:t}){return ni("aside",{className:"rle-sidebar",children:t})}import{jsx as ri}from"react/jsx-runtime";function Ee({children:t}){return ri("div",{className:"rle-toolbar",children:t})}var ut={BottomNav:lt,Card:be,Marker:Fe,Popup:Ce,Sidebar:Ie,FilterPanel:Pe,Search:we,Empty:Le,Loading:Te,ResultHeader:Se,Toolbar:Ee};import{useEffect as xe,useRef as si,useState as ct}from"react";import{createPortal as oi}from"react-dom";import{Fragment as li,jsx as R,jsxs as pe}from"react/jsx-runtime";function mt({open:t,onOpenChange:e,title:i,children:n,footer:r}){let s=si(null),[o,a]=ct(!1),[p,d]=ct(!1);return xe(()=>{if(!t){d(!1),a(!1);return}a(!0);let l=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(l)},[t]),xe(()=>{if(!o)return;let l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}},[o]),xe(()=>{if(!o)return;s.current?.focus();function l(c){c.key==="Escape"&&e(!1)}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o,e]),!o||typeof document>"u"?null:oi(pe(li,{children:[R("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),pe("div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[R("div",{className:"rle-sheet__handle","aria-hidden":"true"}),pe("div",{className:"rle-sheet__header",children:[i&&R("div",{className:"rle-sheet__title",children:i}),R("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:R(ai,{})})]}),R("div",{className:"rle-sheet__body",children:n}),r&&R("div",{className:"rle-sheet__footer",children:r})]})]}),document.body)}function ai(){return pe("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:[R("path",{d:"M18 6 6 18"}),R("path",{d:"m6 6 12 12"})]})}import{useEffect as ce,useRef as Ne,useState as U}from"react";import{jsx as P,jsxs as ue}from"react/jsx-runtime";function gt({search:t,onFiltersClick:e,filterCount:i=0,action:n}){let{Search:r}=w();return ue("header",{className:"rle-mobile-header",children:[t&&P("div",{className:"rle-mobile-header__search",children:P(r,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),ue("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[P(di,{}),P("span",{children:"Filters"}),i>0&&P("span",{className:"rle-mobile-header__count",children:i})]}),n&&P("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:n.onClick,"aria-label":n.label,children:n.icon??P(pi,{})})]})}function di(){return ue("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:[P("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),P("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),P("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),P("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),P("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),P("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function pi(){return ue("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:[P("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),P("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{Fragment as gi,jsx as g,jsxs as z}from"react/jsx-runtime";var ui=g("div",{className:"rle-empty",children:"Map unavailable"});function ci(){let t=Ne(null),[e,i]=U(!0),[n,r]=U(!0);return ce(()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:c,scrollLeft:y,scrollWidth:v}=s;i(y<=0),r(y+c>=v-1)},a=0,p=()=>{a||(a=requestAnimationFrame(()=>{a=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let d,l;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(o),d.observe(s)),typeof MutationObserver<"u"&&(l=new MutationObserver(p),l.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),d?.disconnect(),l?.disconnect(),a&&cancelAnimationFrame(a)}},[]),{atEnd:n,atStart:e,ref:t}}function mi(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,n=e,r=new Set([...Object.keys(i),...Object.keys(n)]);for(let s of r)if(i[s]!==n[s])return!1;return!0}function ft({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:n,autoFetch:r=!0,initialPage:s,hasMap:o,mapCenter:a,mapZoom:p,mapControls:d,onMapReady:l,mobileSheetFooter:c,className:y}){let v=h(),{BottomNav:O,Search:K}=w(),D=W(),{filters:u,set:V}=oe(),{pagination:b}=I(),k=o??v.map!=null,[_,H]=U("list"),[x,A]=U(!1),{atEnd:T,atStart:L,ref:f}=ci(),m=Ne(null);ce(()=>{b.mode==="paged"&&m.current&&(m.current.scrollTop=0)},[b.mode,b.pageIndex]);let[F,q]=U(u),[N,vt]=U(x);x!==N&&(vt(x),x&&q(u));let Re=ge=>q(bt=>({...bt,...ge})),[De,Be]=U(!1),me=Ne(!1);ce(()=>{if(De){if(b.loading){me.current=!0;return}me.current&&(me.current=!1,Be(!1),A(!1))}},[De,b.loading]);let Q=t?{value:String(u[t.filterKey]??""),onChange:ge=>{V({[t.filterKey]:ge||void 0})},placeholder:t.placeholder}:void 0;ce(()=>{r!==!1&&(s&&s>0?v.goToPage(s):v.applyFilters({}))},[v,r]);let Oe=()=>{Re(v.filters.clearedParams())},_e=()=>{if(mi(F,u)){A(!1);return}Be(!0),v.applyFilters(F)},ht=v.filters.activeKeys(u).length,He=D.total??D.items.length;return z("div",{className:y?`rle-app ${y}`:"rle-app",children:[z("div",{className:"rle-filter-bar",children:[z("div",{className:"rle-filter-bar__scroll",ref:f,children:[Q&&g("div",{className:"rle-filter-bar__search",children:g(K,{value:Q.value,onChange:Q.onChange,placeholder:Q.placeholder})}),e&&g("div",{className:"rle-filter-bar__slot",children:e}),g(ye,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!L&&g("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!T&&g("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),g(gt,{search:Q,onFiltersClick:()=>A(!0),filterCount:ht,action:n}),z("div",{className:`rle-body ${k?"rle-split":"rle-body--list-only"}`,"data-mobile-view":_,children:[z("div",{className:"rle-list",ref:m,children:[z("div",{className:"rle-list-header",children:[g(rt,{}),i&&g("div",{className:"rle-list-header__toolbar",children:i})]}),g(Xe,{className:"rle-list-grid"}),g(nt,{})]}),k&&g("div",{className:"rle-map",children:g(it,{center:a,zoom:p,fallback:ui,mapControls:d,onMapReady:l})})]}),k&&g(O,{view:_,onViewChange:H}),g(mt,{title:"Filters",open:x,onOpenChange:A,footer:c?c({draft:F,apply:_e,clear:Oe,resultCount:He,loading:b.loading}):z(gi,{children:[g("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:Oe,children:"Clear all"}),g("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:b.loading,onClick:_e,children:b.loading?g("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${He} results`})]}),children:g(ye,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:F,onDraftChange:Re})})]})}import{useEffect as fi,useRef as yi,useState as vi}from"react";import{jsx as Me,jsxs as Li}from"react/jsx-runtime";function yt(t){return"provider"in t}function hi(t){let e=t!=null&&!yt(t),i=e?t.apiKey:void 0,n=e?t.mapId:void 0,r=e?t.mapOptions:void 0,s=e?t.styles:void 0,o=e?t.overlayMarkers:void 0,[a,p]=vi(()=>!t||yt(t)?{ready:!0,provider:t?.provider}:{ready:!1});return fi(()=>{if(!i)return;let d=!1;return import("./maps/google/index.js").then(({googleProvider:l})=>{d||p({ready:!0,provider:l({apiKey:i,mapId:n,mapOptions:r,styles:s,overlayMarkers:o})})}),()=>{d=!0}},[i,n]),a}function bi({onFiltersChange:t}){let e=yi(t);return e.current=t,st("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function zr(t){let{datasets:e,filters:i,map:n,components:r,initialFilters:s,onFiltersChange:o,mobileAction:a,search:p,filterBarStart:d,toolbarEnd:l,mapControls:c,onMapReady:y,mobileSheetFooter:v,config:O,autoFetch:K,initialPage:D,className:u}=t,{ready:V,provider:b}=hi(n);if(!V)return null;let k=[];for(let x of e)k.push(Ve(x));i&&k.push(qe(i)),b&&k.push(Ke(b)),s&&k.push($e(s)),O&&k.push(Ue(O));let _=ze(...k),H={...ut,...r};return Li(at,{..._,children:[o&&Me(bi,{onFiltersChange:o}),Me(je,{...H,children:Me(ft,{className:u,search:p,filterBarStart:d,toolbarEnd:l,mobileAction:a,autoFetch:K,mapCenter:n?.center,mapZoom:n?.zoom,mapControls:c,onMapReady:y,initialPage:D,mobileSheetFooter:v})})]})}export{ee as a,$ as b,te as c,ie as d,Ae as e,ne as f,re as g,ze as h,Ue as i,Ke as j,Ve as k,qe as l,Bi as m,$e as n,Oi as o,fe as p,je as q,w as r,se as s,h as t,I as u,oe as v,ye as w,W as x,Xe as y,it as z,nt as A,rt as B,st as C,at as D,lt as E,be as F,Le as G,Pe as H,Te as I,Fe as J,Ce as K,Se as L,we as M,Ie as N,Ee as O,ut as P,mt as Q,ft as R,zr as S};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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;"use client";
2
- var _chunkOXSKWVIDcjs = require('./chunk-OXSKWVID.cjs');var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var h= (_class =class{__init() {this.listeners=new Set}constructor(t={}){;_class.prototype.__init.call(this);this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}}, _class);function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var f= (_class2 =class{__init2() {this.isSyncing=!1}__init3() {this.unsubscribeEngine=null}__init4() {this.unsubscribeHistory=null}constructor(t){;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=_nullishCoalesce(t.hydrateOnStart, () => (!0))}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){_optionalChain([this, 'access', _ => _.unsubscribeEngine, 'optionalCall', _2 => _2()]),this.unsubscribeEngine=null,_optionalChain([this, 'access', _3 => _3.unsubscribeHistory, 'optionalCall', _4 => _4()]),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}}, _class2);var m=class{constructor(t={}){this.mode=_nullishCoalesce(t.mode, () => ("replace"))}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};var _jsxruntime = require('react/jsx-runtime');function st({children:e}){let{Toolbar:t}=_chunkOXSKWVIDcjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunkOXSKWVIDcjs.t.call(void 0, ),t=_chunkOXSKWVIDcjs.u.call(void 0, ),r=_react.useCallback.call(void 0, n=>e.loadPoints(n),[e]),s=_react.useCallback.call(void 0, (n,p)=>e.selectPoint(n,p),[e]),o=_react.useCallback.call(void 0, n=>e.setHovered(e.primaryDatasetId,n),[e]),i=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _5 => _5.map, 'optionalAccess', _6 => _6.zoomIn, 'call', _7 => _7()]),[e]),c=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _8 => _8.map, 'optionalAccess', _9 => _9.zoomOut, 'call', _10 => _10()]),[e]),l=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _11 => _11.map, 'optionalAccess', _12 => _12.toggleFullscreen, 'call', _13 => _13()]),[e]),g=_react.useCallback.call(void 0, (n,p)=>e.fitBounds(n,p),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:g}}function ht(e){let t=_chunkOXSKWVIDcjs.t.call(void 0, ),r=_chunkOXSKWVIDcjs.u.call(void 0, ),s=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(r.layers[e], () => (!0)),points:_nullishCoalesce(r.points[e], () => ([])),toggle:s}}exports.BrowserHistoryPort = m; exports.DatasetRegistry = _chunkOXSKWVIDcjs.c; exports.FallbackPopup = _chunkOXSKWVIDcjs.p; exports.FilterRegistry = _chunkOXSKWVIDcjs.b; exports.ListingApp = _chunkOXSKWVIDcjs.S; exports.ListingComponentsProvider = _chunkOXSKWVIDcjs.q; exports.ListingConfig = _chunkOXSKWVIDcjs.f; exports.ListingEngine = _chunkOXSKWVIDcjs.g; exports.ListingEngineContext = _chunkOXSKWVIDcjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunkOXSKWVIDcjs.w; exports.ListingList = _chunkOXSKWVIDcjs.y; exports.ListingMap = _chunkOXSKWVIDcjs.z; exports.ListingPagination = _chunkOXSKWVIDcjs.A; exports.ListingProvider = _chunkOXSKWVIDcjs.D; exports.ListingResultHeader = _chunkOXSKWVIDcjs.B; exports.ListingStore = _chunkOXSKWVIDcjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunkOXSKWVIDcjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunkOXSKWVIDcjs.h; exports.listingDefaultConfig = _chunkOXSKWVIDcjs.e; exports.useListing = _chunkOXSKWVIDcjs.t; exports.useListingComponents = _chunkOXSKWVIDcjs.r; exports.useListingEvent = _chunkOXSKWVIDcjs.C; exports.useListingFilters = _chunkOXSKWVIDcjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunkOXSKWVIDcjs.x; exports.useListingState = _chunkOXSKWVIDcjs.u; exports.withConfig = _chunkOXSKWVIDcjs.i; exports.withDataset = _chunkOXSKWVIDcjs.k; exports.withFilters = _chunkOXSKWVIDcjs.l; exports.withInitialFilters = _chunkOXSKWVIDcjs.n; exports.withMap = _chunkOXSKWVIDcjs.j; exports.withPrimaryDataset = _chunkOXSKWVIDcjs.o; exports.withUrlSync = _chunkOXSKWVIDcjs.m;
2
+ var _chunkPLAFA6TTcjs = require('./chunk-PLAFA6TT.cjs');var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var h= (_class =class{__init() {this.listeners=new Set}constructor(t={}){;_class.prototype.__init.call(this);this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}}, _class);function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var f= (_class2 =class{__init2() {this.isSyncing=!1}__init3() {this.unsubscribeEngine=null}__init4() {this.unsubscribeHistory=null}constructor(t){;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=_nullishCoalesce(t.hydrateOnStart, () => (!0))}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){_optionalChain([this, 'access', _ => _.unsubscribeEngine, 'optionalCall', _2 => _2()]),this.unsubscribeEngine=null,_optionalChain([this, 'access', _3 => _3.unsubscribeHistory, 'optionalCall', _4 => _4()]),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}}, _class2);var m=class{constructor(t={}){this.mode=_nullishCoalesce(t.mode, () => ("replace"))}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};var _jsxruntime = require('react/jsx-runtime');function st({children:e}){let{Toolbar:t}=_chunkPLAFA6TTcjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunkPLAFA6TTcjs.t.call(void 0, ),t=_chunkPLAFA6TTcjs.u.call(void 0, ),r=_react.useCallback.call(void 0, n=>e.loadPoints(n),[e]),s=_react.useCallback.call(void 0, (n,p)=>e.selectPoint(n,p),[e]),o=_react.useCallback.call(void 0, n=>e.setHovered(e.primaryDatasetId,n),[e]),i=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _5 => _5.map, 'optionalAccess', _6 => _6.zoomIn, 'call', _7 => _7()]),[e]),c=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _8 => _8.map, 'optionalAccess', _9 => _9.zoomOut, 'call', _10 => _10()]),[e]),l=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _11 => _11.map, 'optionalAccess', _12 => _12.toggleFullscreen, 'call', _13 => _13()]),[e]),g=_react.useCallback.call(void 0, (n,p)=>e.fitBounds(n,p),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:g}}function ht(e){let t=_chunkPLAFA6TTcjs.t.call(void 0, ),r=_chunkPLAFA6TTcjs.u.call(void 0, ),s=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(r.layers[e], () => (!0)),points:_nullishCoalesce(r.points[e], () => ([])),toggle:s}}exports.BrowserHistoryPort = m; exports.DatasetRegistry = _chunkPLAFA6TTcjs.c; exports.FallbackPopup = _chunkPLAFA6TTcjs.p; exports.FilterRegistry = _chunkPLAFA6TTcjs.b; exports.ListingApp = _chunkPLAFA6TTcjs.S; exports.ListingComponentsProvider = _chunkPLAFA6TTcjs.q; exports.ListingConfig = _chunkPLAFA6TTcjs.f; exports.ListingEngine = _chunkPLAFA6TTcjs.g; exports.ListingEngineContext = _chunkPLAFA6TTcjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunkPLAFA6TTcjs.w; exports.ListingList = _chunkPLAFA6TTcjs.y; exports.ListingMap = _chunkPLAFA6TTcjs.z; exports.ListingPagination = _chunkPLAFA6TTcjs.A; exports.ListingProvider = _chunkPLAFA6TTcjs.D; exports.ListingResultHeader = _chunkPLAFA6TTcjs.B; exports.ListingStore = _chunkPLAFA6TTcjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunkPLAFA6TTcjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunkPLAFA6TTcjs.h; exports.listingDefaultConfig = _chunkPLAFA6TTcjs.e; exports.useListing = _chunkPLAFA6TTcjs.t; exports.useListingComponents = _chunkPLAFA6TTcjs.r; exports.useListingEvent = _chunkPLAFA6TTcjs.C; exports.useListingFilters = _chunkPLAFA6TTcjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunkPLAFA6TTcjs.x; exports.useListingState = _chunkPLAFA6TTcjs.u; exports.withConfig = _chunkPLAFA6TTcjs.i; exports.withDataset = _chunkPLAFA6TTcjs.k; exports.withFilters = _chunkPLAFA6TTcjs.l; exports.withInitialFilters = _chunkPLAFA6TTcjs.n; exports.withMap = _chunkPLAFA6TTcjs.j; exports.withPrimaryDataset = _chunkPLAFA6TTcjs.o; exports.withUrlSync = _chunkPLAFA6TTcjs.m;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, F as FitBoundsOptions, Q as QueryParams, L as LatLng } from './map-provider.interface-8hvdqqjd.cjs';
2
- export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-8hvdqqjd.cjs';
3
- import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-B53qbvxo.cjs';
4
- export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingBottomNavProps, f as IListingCardProps, g as IListingComponents, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, L as ListingApp, p as ListingAppProps, q as ListingComponentsProvider, M as MarkerRenderer, r as MobileSheetFooterContext, u as useListingComponents } from './listing-app-B53qbvxo.cjs';
1
+ import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, F as FitBoundsOptions, Q as QueryParams, L as LatLng } from './map-provider.interface-D3pwkbog.cjs';
2
+ export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-D3pwkbog.cjs';
3
+ import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-By6TrXB9.cjs';
4
+ export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingBottomNavProps, f as IListingCardProps, g as IListingComponents, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, L as ListingApp, p as ListingAppProps, q as ListingComponentsProvider, M as MarkerRenderer, r as MobileSheetFooterContext, u as useListingComponents } from './listing-app-By6TrXB9.cjs';
5
5
  import * as react from 'react';
6
6
  import { ReactNode } from 'react';
7
7
 
@@ -531,8 +531,8 @@ interface IListingMapProps {
531
531
  */
532
532
  mapControls?: ReactNode;
533
533
  /**
534
- * Fires with the underlying map SDK's native map object (`MapHandle.raw` --
535
- * the `google.maps.Map` for `googleProvider`) the moment the map finishes
534
+ * Fires with the underlying map SDK's native map object (the
535
+ * `google.maps.Map` for `googleProvider`) the moment the map finishes
536
536
  * mounting, and again with `null` when it is torn down (unmount / Strict-Mode
537
537
  * double-invoke). Typed `unknown` because this layer is provider-agnostic:
538
538
  * the consumer casts to their SDK's map type. This is the escape hatch for
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, F as FitBoundsOptions, Q as QueryParams, L as LatLng } from './map-provider.interface-8hvdqqjd.js';
2
- export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-8hvdqqjd.js';
3
- import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-DxRpWQgn.js';
4
- export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingBottomNavProps, f as IListingCardProps, g as IListingComponents, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, L as ListingApp, p as ListingAppProps, q as ListingComponentsProvider, M as MarkerRenderer, r as MobileSheetFooterContext, u as useListingComponents } from './listing-app-DxRpWQgn.js';
1
+ import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, F as FitBoundsOptions, Q as QueryParams, L as LatLng } from './map-provider.interface-D3pwkbog.js';
2
+ export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-D3pwkbog.js';
3
+ import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-CHC-XAhJ.js';
4
+ export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingBottomNavProps, f as IListingCardProps, g as IListingComponents, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, L as ListingApp, p as ListingAppProps, q as ListingComponentsProvider, M as MarkerRenderer, r as MobileSheetFooterContext, u as useListingComponents } from './listing-app-CHC-XAhJ.js';
5
5
  import * as react from 'react';
6
6
  import { ReactNode } from 'react';
7
7
 
@@ -531,8 +531,8 @@ interface IListingMapProps {
531
531
  */
532
532
  mapControls?: ReactNode;
533
533
  /**
534
- * Fires with the underlying map SDK's native map object (`MapHandle.raw` --
535
- * the `google.maps.Map` for `googleProvider`) the moment the map finishes
534
+ * Fires with the underlying map SDK's native map object (the
535
+ * `google.maps.Map` for `googleProvider`) the moment the map finishes
536
536
  * mounting, and again with `null` when it is torn down (unmount / Strict-Mode
537
537
  * double-invoke). Typed `unknown` because this layer is provider-agnostic:
538
538
  * the consumer casts to their SDK's map type. This is the escape hatch for
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{A as V,B as W,C as X,D as Y,S as P,a as Q,b as x,c as T,d as L,e as O,f as H,g as E,h as k,i as q,j as B,k as C,l as I,m as U,n as z,o as G,p as R,q as $,r as d,s as j,t as u,u as y,v as A,w as D,x as J,y as K,z as N}from"./chunk-AU6BK7UM.js";var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var h=class{query;listeners=new Set;constructor(t={}){this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}};function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var f=class{history;toQueryFn;toFiltersFn;hydrateOnStart;isSyncing=!1;unsubscribeEngine=null;unsubscribeHistory=null;constructor(t){this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=t.hydrateOnStart??!0}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){this.unsubscribeEngine?.(),this.unsubscribeEngine=null,this.unsubscribeHistory?.(),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}};var m=class{mode;constructor(t={}){this.mode=t.mode??"replace"}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};import{jsx as w}from"react/jsx-runtime";function st({children:e}){let{Toolbar:t}=d();return w(t,{children:e})}import{useCallback as a}from"react";function ut(){let e=u(),t=y(),r=a(n=>e.loadPoints(n),[e]),s=a((n,p)=>e.selectPoint(n,p),[e]),o=a(n=>e.setHovered(e.primaryDatasetId,n),[e]),i=a(()=>e.map?.zoomIn(),[e]),c=a(()=>e.map?.zoomOut(),[e]),l=a(()=>e.map?.toggleFullscreen(),[e]),g=a((n,p)=>e.fitBounds(n,p),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:g}}import{useCallback as S}from"react";function ht(e){let t=u(),r=y(),s=S(()=>t.toggleLayer(e),[t,e]);return{visible:r.layers[e]??!0,points:r.points[e]??[],toggle:s}}export{m as BrowserHistoryPort,T as DatasetRegistry,R as FallbackPopup,x as FilterRegistry,P as ListingApp,$ as ListingComponentsProvider,H as ListingConfig,E as ListingEngine,j as ListingEngineContext,v as ListingEventType,D as ListingFilters,K as ListingList,N as ListingMap,V as ListingPagination,Y as ListingProvider,W as ListingResultHeader,Q as ListingStore,st as ListingToolbar,h as MemoryHistoryPort,b as PaginationMode,L as TypedEmitter,f as UrlSyncController,k as composeListingProviders,O as listingDefaultConfig,u as useListing,d as useListingComponents,X as useListingEvent,A as useListingFilters,ht as useListingLayer,ut as useListingMap,J as useListingResults,y as useListingState,q as withConfig,C as withDataset,I as withFilters,z as withInitialFilters,B as withMap,G as withPrimaryDataset,U as withUrlSync};
2
+ import{A as V,B as W,C as X,D as Y,S as P,a as Q,b as x,c as T,d as L,e as O,f as H,g as E,h as k,i as q,j as B,k as C,l as I,m as U,n as z,o as G,p as R,q as $,r as d,s as j,t as u,u as y,v as A,w as D,x as J,y as K,z as N}from"./chunk-XJBDGG2S.js";var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var h=class{query;listeners=new Set;constructor(t={}){this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}};function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var f=class{history;toQueryFn;toFiltersFn;hydrateOnStart;isSyncing=!1;unsubscribeEngine=null;unsubscribeHistory=null;constructor(t){this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=t.hydrateOnStart??!0}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){this.unsubscribeEngine?.(),this.unsubscribeEngine=null,this.unsubscribeHistory?.(),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}};var m=class{mode;constructor(t={}){this.mode=t.mode??"replace"}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};import{jsx as w}from"react/jsx-runtime";function st({children:e}){let{Toolbar:t}=d();return w(t,{children:e})}import{useCallback as a}from"react";function ut(){let e=u(),t=y(),r=a(n=>e.loadPoints(n),[e]),s=a((n,p)=>e.selectPoint(n,p),[e]),o=a(n=>e.setHovered(e.primaryDatasetId,n),[e]),i=a(()=>e.map?.zoomIn(),[e]),c=a(()=>e.map?.zoomOut(),[e]),l=a(()=>e.map?.toggleFullscreen(),[e]),g=a((n,p)=>e.fitBounds(n,p),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:g}}import{useCallback as S}from"react";function ht(e){let t=u(),r=y(),s=S(()=>t.toggleLayer(e),[t,e]);return{visible:r.layers[e]??!0,points:r.points[e]??[],toggle:s}}export{m as BrowserHistoryPort,T as DatasetRegistry,R as FallbackPopup,x as FilterRegistry,P as ListingApp,$ as ListingComponentsProvider,H as ListingConfig,E as ListingEngine,j as ListingEngineContext,v as ListingEventType,D as ListingFilters,K as ListingList,N as ListingMap,V as ListingPagination,Y as ListingProvider,W as ListingResultHeader,Q as ListingStore,st as ListingToolbar,h as MemoryHistoryPort,b as PaginationMode,L as TypedEmitter,f as UrlSyncController,k as composeListingProviders,O as listingDefaultConfig,u as useListing,d as useListingComponents,X as useListingEvent,A as useListingFilters,ht as useListingLayer,ut as useListingMap,J as useListingResults,y as useListingState,q as withConfig,C as withDataset,I as withFilters,z as withInitialFilters,B as withMap,G as withPrimaryDataset,U as withUrlSync};
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
- import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-8hvdqqjd.js';
3
+ import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-D3pwkbog.cjs';
4
4
 
5
5
  interface FilterControlProps<TValue> {
6
6
  value: TValue;
@@ -210,6 +210,13 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
210
210
  hasMap?: boolean;
211
211
  /** Whether the layout fetches the first page itself on mount (`engine.applyFilters({})`). Defaults to `true`. */
212
212
  autoFetch?: boolean;
213
+ /**
214
+ * 0-based page to load on mount instead of page 1 -- for restoring a
215
+ * deep-linked page (`?page=N`) in one fetch (`engine.goToPage(initialPage)`)
216
+ * rather than page-1-then-jump. Only honored when `autoFetch` is on; `0`/unset
217
+ * loads page 1 as before. Needs an offset-capable adapter (`PageRequest.offset`).
218
+ */
219
+ initialPage?: number;
213
220
  /** Forwarded verbatim to `<ListingMap center={mapCenter} />` -- see that component's "Auto-fit" doc comment. */
214
221
  mapCenter?: LatLng;
215
222
  /** Forwarded verbatim to `<ListingMap zoom={mapZoom} />`. */
@@ -298,7 +305,7 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
298
305
  * default -- pass `autoFetch={false}`
299
306
  * to opt out and drive the first fetch yourself.
300
307
  */
301
- declare function StyledListingLayout<TFilters = unknown>({ search, filterBarStart, toolbarEnd, mobileAction, autoFetch, hasMap: hasMapProp, mapCenter, mapZoom, mapControls, onMapReady, mobileSheetFooter, className, }: IStyledListingLayoutProps<TFilters>): react.JSX.Element;
308
+ declare function StyledListingLayout<TFilters = unknown>({ search, filterBarStart, toolbarEnd, mobileAction, autoFetch, initialPage, hasMap: hasMapProp, mapCenter, mapZoom, mapControls, onMapReady, mobileSheetFooter, className, }: IStyledListingLayoutProps<TFilters>): react.JSX.Element;
302
309
 
303
310
  /**
304
311
  * Two-shape `map` prop: pass a ready `MapProvider`, or the `{ apiKey, mapId? }`
@@ -398,6 +405,13 @@ interface ListingAppProps<TFilters> {
398
405
  mobileSheetFooter?: (ctx: MobileSheetFooterContext<TFilters>) => ReactNode;
399
406
  config?: Partial<IListingConfigOptions>;
400
407
  autoFetch?: boolean;
408
+ /**
409
+ * 0-based page to load on mount instead of page 1 -- forwarded to
410
+ * `StyledListingLayout` to restore a deep-linked `?page=N` in a single fetch
411
+ * (`engine.goToPage`) rather than page-1-then-jump. Only honored with
412
+ * `autoFetch` on; needs an offset-capable adapter.
413
+ */
414
+ initialPage?: number;
401
415
  className?: string;
402
416
  }
403
417
  /**
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
- import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-8hvdqqjd.cjs';
3
+ import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-D3pwkbog.js';
4
4
 
5
5
  interface FilterControlProps<TValue> {
6
6
  value: TValue;
@@ -210,6 +210,13 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
210
210
  hasMap?: boolean;
211
211
  /** Whether the layout fetches the first page itself on mount (`engine.applyFilters({})`). Defaults to `true`. */
212
212
  autoFetch?: boolean;
213
+ /**
214
+ * 0-based page to load on mount instead of page 1 -- for restoring a
215
+ * deep-linked page (`?page=N`) in one fetch (`engine.goToPage(initialPage)`)
216
+ * rather than page-1-then-jump. Only honored when `autoFetch` is on; `0`/unset
217
+ * loads page 1 as before. Needs an offset-capable adapter (`PageRequest.offset`).
218
+ */
219
+ initialPage?: number;
213
220
  /** Forwarded verbatim to `<ListingMap center={mapCenter} />` -- see that component's "Auto-fit" doc comment. */
214
221
  mapCenter?: LatLng;
215
222
  /** Forwarded verbatim to `<ListingMap zoom={mapZoom} />`. */
@@ -298,7 +305,7 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
298
305
  * default -- pass `autoFetch={false}`
299
306
  * to opt out and drive the first fetch yourself.
300
307
  */
301
- declare function StyledListingLayout<TFilters = unknown>({ search, filterBarStart, toolbarEnd, mobileAction, autoFetch, hasMap: hasMapProp, mapCenter, mapZoom, mapControls, onMapReady, mobileSheetFooter, className, }: IStyledListingLayoutProps<TFilters>): react.JSX.Element;
308
+ declare function StyledListingLayout<TFilters = unknown>({ search, filterBarStart, toolbarEnd, mobileAction, autoFetch, initialPage, hasMap: hasMapProp, mapCenter, mapZoom, mapControls, onMapReady, mobileSheetFooter, className, }: IStyledListingLayoutProps<TFilters>): react.JSX.Element;
302
309
 
303
310
  /**
304
311
  * Two-shape `map` prop: pass a ready `MapProvider`, or the `{ apiKey, mapId? }`
@@ -398,6 +405,13 @@ interface ListingAppProps<TFilters> {
398
405
  mobileSheetFooter?: (ctx: MobileSheetFooterContext<TFilters>) => ReactNode;
399
406
  config?: Partial<IListingConfigOptions>;
400
407
  autoFetch?: boolean;
408
+ /**
409
+ * 0-based page to load on mount instead of page 1 -- forwarded to
410
+ * `StyledListingLayout` to restore a deep-linked `?page=N` in a single fetch
411
+ * (`engine.goToPage`) rather than page-1-then-jump. Only honored with
412
+ * `autoFetch` on; needs an offset-capable adapter.
413
+ */
414
+ initialPage?: number;
401
415
  className?: string;
402
416
  }
403
417
  /**
@@ -60,6 +60,13 @@ interface MapInitOptions {
60
60
  }
61
61
  interface MapHandle {
62
62
  readonly raw: unknown;
63
+ /**
64
+ * The provider's NATIVE map object (`google.maps.Map` for the Google
65
+ * provider) when it differs from `raw` -- which may be internal state that
66
+ * merely CONTAINS the map. This is what `onMapReady` hands to consumers.
67
+ * Optional: a provider whose `raw` already IS the native map can omit it.
68
+ */
69
+ readonly nativeMap?: unknown;
63
70
  }
64
71
  interface RenderedLayer {
65
72
  id: string;
@@ -60,6 +60,13 @@ interface MapInitOptions {
60
60
  }
61
61
  interface MapHandle {
62
62
  readonly raw: unknown;
63
+ /**
64
+ * The provider's NATIVE map object (`google.maps.Map` for the Google
65
+ * provider) when it differs from `raw` -- which may be internal state that
66
+ * merely CONTAINS the map. This is what `onMapReady` hands to consumers.
67
+ * Optional: a provider whose `raw` already IS the native map can omit it.
68
+ */
69
+ readonly nativeMap?: unknown;
63
70
  }
64
71
  interface RenderedLayer {
65
72
  id: string;
@@ -1,2 +1,2 @@
1
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; }"use client";
2
- var _jsapiloader = require('@googlemaps/js-api-loader');var G="DEMO_MAP_ID";function k(e){return e.raw}function W(e,o){if(e.element)return e.element;if(e.iconUrl)return new o.PinElement({glyphSrc:e.iconUrl}).element}var H=12,B="#b3261e";function U(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let o=document.createElement("div");return o.style.width=`${H}px`,o.style.height=`${H}px`,o.style.borderRadius="50%",o.style.backgroundColor=B,o.style.border="2px solid #ffffff",o.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",o}var L;function V(){if(L)return L;class e extends google.maps.OverlayView{constructor(t,a,i,n){super();e.prototype.__init.call(this);;this.position=t;this.content=a;this.onClick=i;this.lifecycle=n}__init() {this.div=null}onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,_optionalChain([this, 'access', _2 => _2.getPanes, 'call', _3 => _3(), 'optionalAccess', _4 => _4.overlayMouseTarget, 'access', _5 => _5.appendChild, 'call', _6 => _6(t)]),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let a=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));a&&(this.div.style.left=`${a.x}px`,this.div.style.top=`${a.y}px`)}onRemove(){let t=this.div;_optionalChain([this, 'access', _7 => _7.div, 'optionalAccess', _8 => _8.remove, 'call', _9 => _9()]),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return L=e,L}var E=14,Z=8;function q(e){let{anchorX:o,anchorY:l,popupW:t,popupH:a,mapW:i,mapH:n,offsetY:r,pad:s}=e,c=o-t/2,d=o+t/2,u=0;t>i-s*2?u=s-c:d>i-s?u=i-s-d:c<s&&(u=s-c);let p=l-r-a,m=l+r+a,f=p<s&&m<=n-s;return{dx:u,flipBelow:f}}var b;function Y(){if(b)return b;class e extends google.maps.OverlayView{constructor(t,a,i){super();e.prototype.__init2.call(this);e.prototype.__init3.call(this);;this.container=t;this.position=a;this.mapContainerEl=i}__init2() {this.attached=!1}__init3() {this.clampOffset=null}onAdd(){this.attached=!0,_optionalChain([this, 'access', _10 => _10.getPanes, 'call', _11 => _11(), 'optionalAccess', _12 => _12.floatPane, 'access', _13 => _13.appendChild, 'call', _14 => _14(this.container)]),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.container),typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>this.draw())}draw(){let t=this.getProjection();if(!t)return;let a=new google.maps.LatLng(this.position.lat,this.position.lng),i=t.fromLatLngToDivPixel(a);if(!i)return;if(this.clampOffset===null){let s=this.container.offsetWidth,c=this.container.offsetHeight,d=s&&c?t.fromLatLngToContainerPixel(a):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${i.x}px`,this.container.style.top=`${i.y-E}px`;return}this.clampOffset=q({anchorX:d.x,anchorY:d.y,popupW:s,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:E,pad:Z})}let{dx:n,flipBelow:r}=this.clampOffset;this.container.style.left=`${i.x+n}px`,r?(this.container.style.top=`${i.y+E}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-E}px`,this.container.style.transform="translate(-50%, -100%)")}onRemove(){this.attached=!1,this.container.remove()}updatePosition(t){(t.lat!==this.position.lat||t.lng!==this.position.lng)&&(this.clampOffset=null),this.position=t,this.attached&&this.draw()}}return b=e,b}function P(e){for(let o of e)typeof o.setMap=="function"?o.setMap(null):o.map=null}var D="#b3261e",X=40,$=64,j=14;function K(e,o){let l=o.count,t=Math.min($,X+Math.round(Math.log10(l+1)*j)),a=document.createElement("div");return a.textContent=String(l),a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.width=`${t}px`,a.style.height=`${t}px`,a.style.borderRadius="50%",a.style.backgroundColor=D,a.style.border="2px solid #ffffff",a.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",a.style.color="#ffffff",a.style.fontFamily="inherit",a.style.fontWeight="700",a.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:o.position,content:a})}var I=!1;async function N(e,o,l,t){let a;try{a=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(n){I||(I=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(o)!==l)return;let i=new a.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>K(e.markerLib,n)}});e.clusterers.set(o,i)}function x(e,o){let l=e.clusterers.get(o);l&&(l.setMap(null),e.clusterers.delete(o))}var R=!1;function Q(){R||(R=!0,console.warn('[react-listing-engine] Marker clustering is not supported in `styles` (OverlayView) mode -- "@googlemaps/markerclusterer" only manages Marker/AdvancedMarkerElement instances. Rendering plain, unclustered overlay markers instead. Use a `mapId` (advanced-marker mode) to enable clustering.'))}function J(e,o){return o.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:W(l,e.markerLib),gmpClickable:!!o.onMarkerClick});if(o.onMarkerClick){let a=o.onMarkerClick;t.addListener("click",()=>a(l.id))}return t})}function T(e,o,l,t){e.classList.toggle("rle-marker--selected",o===l),e.classList.toggle("rle-marker--hovered",o===t&&o!==l)}function ee(e,o){let l=V();return o.markers.map(t=>{let a=o.onMarkerClick,i=a?()=>a(t.id):void 0,n=new l(t.position,U(t),i,{onContainerAdd:r=>{e.markerElements.set(t.id,r),T(r,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:r=>{e.markerElements.get(t.id)===r&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function A(e,o){let l=e.layerMarkerIds.get(o);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(o)}}function te(e){let o=e.getSouthWest(),l=e.getNorthEast();return{west:o.lng(),south:o.lat(),east:l.lng(),north:l.lat()}}var C=256,ne=1.2,re=320,oe=450,ae=2600,F="rle-map-flying";function O(e,o){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:C*(.5+o/360),y:C*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function S(e){let o=Math.PI-2*Math.PI*e.y/C;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o))),lng:(e.x/C-.5)*360}}function se(e,o,l){let t=O(e.north,e.east),a=O(e.south,e.west),i=Math.abs(t.x-a.x),n=Math.abs(t.y-a.y);return i===0||n===0||o===0||l===0?null:{center:S({x:(t.x+a.x)/2,y:(t.y+a.y)/2}),zoom:Math.min(Math.log2(o/i),Math.log2(l/n))}}function ie(e,o,l){let t=l/2**e.zoom,a=l/2**o.zoom,i=o.x-e.x,n=o.y-e.y,r=i*i+n*n,s=ne,c=s*s;if(r<1e-12){let M=Math.abs(Math.log(a/t))/s,g=a<t?-1:1;return{S:M,at:h=>({x:e.x,y:e.y,zoom:Math.log2(l/(t*Math.exp(g*s*(h*M))))})}}let d=Math.sqrt(r),u=(a*a-t*t+c*c*r)/(2*t*c*d),p=(a*a-t*t-c*c*r)/(2*a*c*d),m=Math.log(Math.sqrt(u*u+1)-u),v=(Math.log(Math.sqrt(p*p+1)-p)-m)/s,y=Math.cosh(m);return{S:v,at:M=>{let g=s*(M*v)+m,h=t/(c*d)*(y*Math.tanh(g)-Math.sinh(m)),_=t*y/Math.cosh(g);return{x:e.x+h*i,y:e.y+h*n,zoom:Math.log2(l/_)}}}}function le(e){return e*(2-e)}function ce(e,o,l){let t=performance.now(),a,i=c=>{let d=S(c);typeof e.map.moveCamera=="function"?e.map.moveCamera({center:d,zoom:c.zoom}):(e.map.setZoom(c.zoom),e.map.setCenter(d))},n=()=>{e.containerEl.classList.remove(F),e.containerEl.removeEventListener("pointerdown",r,!0),e.containerEl.removeEventListener("wheel",r,!0)},r=()=>{cancelAnimationFrame(a),n(),e.cancelFlight===r&&(e.cancelFlight=null)},s=()=>{let c=Math.min(1,(performance.now()-t)/l);i(o.at(le(c))),c<1?a=requestAnimationFrame(s):(n(),e.cancelFlight=null)};return e.containerEl.classList.add(F),e.containerEl.addEventListener("pointerdown",r,!0),e.containerEl.addEventListener("wheel",r,!0),a=requestAnimationFrame(s),r}function de(e,o,l){if(typeof ResizeObserver>"u")return;let t=!1,a=()=>{let{width:n,height:r}=e.getBoundingClientRect();n===0||r===0||(google.maps.event.trigger(o,"resize"),t||(t=!0,o.setCenter(l)))},i=new ResizeObserver(a);return i.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(a):queueMicrotask(a),i}function ue(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let o=!1,l=()=>{o||(_jsapiloader.setOptions.call(void 0, {...e.loaderOptions,key:e.apiKey}),o=!0)},t,a=0;return{async mount(i,n){let r=++a;l();let s=await _jsapiloader.importLibrary.call(void 0, "maps"),c=await _jsapiloader.importLibrary.call(void 0, "marker"),d=_nullishCoalesce(n.center, () => ({lat:0,lng:0})),u=e.styles!=null||e.overlayMarkers===!0,p=new s.Map(i,{...e.mapOptions,center:d,zoom:_nullishCoalesce(n.zoom, () => (10)),...u?e.styles!=null?{styles:e.styles}:e.mapId!=null?{mapId:e.mapId}:{}:{mapId:_nullishCoalesce(e.mapId, () => (G))}}),m=de(i,p,d),f={map:p,containerEl:i,fullscreenEl:_nullishCoalesce(n.fullscreenTarget, () => (i)),markerLib:c,markerMode:u?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:m,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return r===a&&(t=f),{raw:f}},renderLayer(i,n){let r=k(i),s=r.layers.get(n.id);s&&(P(s),r.layers.delete(n.id),A(r,n.id)),x(r,n.id);let c=r.markerMode==="overlay"?ee(r,n):J(r,n);r.layers.set(n.id,c),r.markerMode==="overlay"&&r.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(r.markerMode==="overlay"?Q():N(r,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,r.layers.get(n.id)===c&&(P(c),r.layers.delete(n.id),x(r,n.id),A(r,n.id)))}},onBoundsChange(i,n){let r=k(i),s=r.map.addListener("idle",()=>{let d=r.map.getBounds();d&&n(te(d))});r.boundsListeners.add(s);let c=!1;return()=>{c||(c=!0,s.remove(),r.boundsListeners.delete(s))}},onMapClick(i){let n=t;if(!n)return()=>{};let r=n.map.addListener("click",()=>i());n.clickListeners.add(r);let s=!1;return()=>{s||(s=!0,r.remove(),n.clickListeners.delete(r))}},fitBounds(i,n,r){let s=k(i);if(_optionalChain([s, 'access', _15 => _15.cancelFlight, 'optionalCall', _16 => _16()]),s.cancelFlight=null,!_optionalChain([r, 'optionalAccess', _17 => _17.animate])){s.map.fitBounds(n);return}let c=s.map.getZoom(),d=s.map.getCenter(),u=se(n,s.containerEl.clientWidth,s.containerEl.clientHeight);if(c==null||!d||!u){s.map.fitBounds(n);return}let p=typeof s.map.getRenderingType=="function"?s.map.getRenderingType():void 0,m=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(p!=="VECTOR"||m){s.map.fitBounds(n);return}s.map.setOptions({isFractionalZoomEnabled:!0});let f={...O(d.lat(),d.lng()),zoom:c},v={...O(u.center.lat,u.center.lng),zoom:u.zoom},y=Math.max(s.containerEl.clientWidth,s.containerEl.clientHeight),M=ie(f,v,y),g=Math.min(ae,Math.max(oe,M.S*re));s.cancelFlight=ce(s,M,g)},destroy(i){let n=k(i);_optionalChain([n, 'access', _18 => _18.resizeObserver, 'optionalAccess', _19 => _19.disconnect, 'call', _20 => _20()]),_optionalChain([n, 'access', _21 => _21.cancelFlight, 'optionalCall', _22 => _22()]),n.cancelFlight=null;for(let r of n.boundsListeners)r.remove();n.boundsListeners.clear();for(let r of n.clickListeners)r.remove();n.clickListeners.clear();for(let r of[...n.clusterers.keys()])x(n,r);for(let r of n.layers.values())P(r);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(i,n){if(t){t.selectedMarkerId=i,t.hoveredMarkerId=n;for(let[r,s]of t.markerElements)T(s,r,i,n)}},mountOverlay(i){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let r=Y(),s=new r(n,i,t.containerEl);return s.setMap(t.map),{container:n,setPosition:c=>s.updatePosition(c),unmount:()=>{s.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))+1)},zoomOut(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))-1)},toggleFullscreen(){if(!t)return;let i=t.fullscreenEl,n=document.fullscreenElement;n!=null&&i.contains(n)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _23 => _23.exitFullscreen, 'call', _24 => _24(), 'optionalAccess', _25 => _25.catch, 'call', _26 => _26(()=>{})]):typeof i.requestFullscreen=="function"&&_optionalChain([i, 'access', _27 => _27.requestFullscreen, 'call', _28 => _28(), 'optionalAccess', _29 => _29.catch, 'call', _30 => _30(()=>{})])}}}exports.googleProvider = ue;
2
+ var _jsapiloader = require('@googlemaps/js-api-loader');var G="DEMO_MAP_ID";function k(e){return e.raw}function W(e,o){if(e.element)return e.element;if(e.iconUrl)return new o.PinElement({glyphSrc:e.iconUrl}).element}var H=12,B="#b3261e";function U(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let o=document.createElement("div");return o.style.width=`${H}px`,o.style.height=`${H}px`,o.style.borderRadius="50%",o.style.backgroundColor=B,o.style.border="2px solid #ffffff",o.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",o}var L;function V(){if(L)return L;class e extends google.maps.OverlayView{constructor(t,a,i,n){super();e.prototype.__init.call(this);;this.position=t;this.content=a;this.onClick=i;this.lifecycle=n}__init() {this.div=null}onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,_optionalChain([this, 'access', _2 => _2.getPanes, 'call', _3 => _3(), 'optionalAccess', _4 => _4.overlayMouseTarget, 'access', _5 => _5.appendChild, 'call', _6 => _6(t)]),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let a=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));a&&(this.div.style.left=`${a.x}px`,this.div.style.top=`${a.y}px`)}onRemove(){let t=this.div;_optionalChain([this, 'access', _7 => _7.div, 'optionalAccess', _8 => _8.remove, 'call', _9 => _9()]),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return L=e,L}var E=14,Z=8;function q(e){let{anchorX:o,anchorY:l,popupW:t,popupH:a,mapW:i,mapH:n,offsetY:r,pad:s}=e,c=o-t/2,d=o+t/2,u=0;t>i-s*2?u=s-c:d>i-s?u=i-s-d:c<s&&(u=s-c);let p=l-r-a,m=l+r+a,f=p<s&&m<=n-s;return{dx:u,flipBelow:f}}var b;function Y(){if(b)return b;class e extends google.maps.OverlayView{constructor(t,a,i){super();e.prototype.__init2.call(this);e.prototype.__init3.call(this);;this.container=t;this.position=a;this.mapContainerEl=i}__init2() {this.attached=!1}__init3() {this.clampOffset=null}onAdd(){this.attached=!0,_optionalChain([this, 'access', _10 => _10.getPanes, 'call', _11 => _11(), 'optionalAccess', _12 => _12.floatPane, 'access', _13 => _13.appendChild, 'call', _14 => _14(this.container)]),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.container),typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>this.draw())}draw(){let t=this.getProjection();if(!t)return;let a=new google.maps.LatLng(this.position.lat,this.position.lng),i=t.fromLatLngToDivPixel(a);if(!i)return;if(this.clampOffset===null){let s=this.container.offsetWidth,c=this.container.offsetHeight,d=s&&c?t.fromLatLngToContainerPixel(a):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${i.x}px`,this.container.style.top=`${i.y-E}px`;return}this.clampOffset=q({anchorX:d.x,anchorY:d.y,popupW:s,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:E,pad:Z})}let{dx:n,flipBelow:r}=this.clampOffset;this.container.style.left=`${i.x+n}px`,r?(this.container.style.top=`${i.y+E}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-E}px`,this.container.style.transform="translate(-50%, -100%)")}onRemove(){this.attached=!1,this.container.remove()}updatePosition(t){(t.lat!==this.position.lat||t.lng!==this.position.lng)&&(this.clampOffset=null),this.position=t,this.attached&&this.draw()}}return b=e,b}function P(e){for(let o of e)typeof o.setMap=="function"?o.setMap(null):o.map=null}var D="#b3261e",X=40,$=64,j=14;function K(e,o){let l=o.count,t=Math.min($,X+Math.round(Math.log10(l+1)*j)),a=document.createElement("div");return a.textContent=String(l),a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.width=`${t}px`,a.style.height=`${t}px`,a.style.borderRadius="50%",a.style.backgroundColor=D,a.style.border="2px solid #ffffff",a.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",a.style.color="#ffffff",a.style.fontFamily="inherit",a.style.fontWeight="700",a.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:o.position,content:a})}var I=!1;async function N(e,o,l,t){let a;try{a=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(n){I||(I=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(o)!==l)return;let i=new a.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>K(e.markerLib,n)}});e.clusterers.set(o,i)}function x(e,o){let l=e.clusterers.get(o);l&&(l.setMap(null),e.clusterers.delete(o))}var R=!1;function Q(){R||(R=!0,console.warn('[react-listing-engine] Marker clustering is not supported in `styles` (OverlayView) mode -- "@googlemaps/markerclusterer" only manages Marker/AdvancedMarkerElement instances. Rendering plain, unclustered overlay markers instead. Use a `mapId` (advanced-marker mode) to enable clustering.'))}function J(e,o){return o.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:W(l,e.markerLib),gmpClickable:!!o.onMarkerClick});if(o.onMarkerClick){let a=o.onMarkerClick;t.addListener("click",()=>a(l.id))}return t})}function T(e,o,l,t){e.classList.toggle("rle-marker--selected",o===l),e.classList.toggle("rle-marker--hovered",o===t&&o!==l)}function ee(e,o){let l=V();return o.markers.map(t=>{let a=o.onMarkerClick,i=a?()=>a(t.id):void 0,n=new l(t.position,U(t),i,{onContainerAdd:r=>{e.markerElements.set(t.id,r),T(r,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:r=>{e.markerElements.get(t.id)===r&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function A(e,o){let l=e.layerMarkerIds.get(o);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(o)}}function te(e){let o=e.getSouthWest(),l=e.getNorthEast();return{west:o.lng(),south:o.lat(),east:l.lng(),north:l.lat()}}var C=256,ne=1.2,re=320,oe=450,ae=2600,F="rle-map-flying";function O(e,o){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:C*(.5+o/360),y:C*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function S(e){let o=Math.PI-2*Math.PI*e.y/C;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o))),lng:(e.x/C-.5)*360}}function se(e,o,l){let t=O(e.north,e.east),a=O(e.south,e.west),i=Math.abs(t.x-a.x),n=Math.abs(t.y-a.y);return i===0||n===0||o===0||l===0?null:{center:S({x:(t.x+a.x)/2,y:(t.y+a.y)/2}),zoom:Math.min(Math.log2(o/i),Math.log2(l/n))}}function ie(e,o,l){let t=l/2**e.zoom,a=l/2**o.zoom,i=o.x-e.x,n=o.y-e.y,r=i*i+n*n,s=ne,c=s*s;if(r<1e-12){let M=Math.abs(Math.log(a/t))/s,g=a<t?-1:1;return{S:M,at:h=>({x:e.x,y:e.y,zoom:Math.log2(l/(t*Math.exp(g*s*(h*M))))})}}let d=Math.sqrt(r),u=(a*a-t*t+c*c*r)/(2*t*c*d),p=(a*a-t*t-c*c*r)/(2*a*c*d),m=Math.log(Math.sqrt(u*u+1)-u),v=(Math.log(Math.sqrt(p*p+1)-p)-m)/s,y=Math.cosh(m);return{S:v,at:M=>{let g=s*(M*v)+m,h=t/(c*d)*(y*Math.tanh(g)-Math.sinh(m)),_=t*y/Math.cosh(g);return{x:e.x+h*i,y:e.y+h*n,zoom:Math.log2(l/_)}}}}function le(e){return e*(2-e)}function ce(e,o,l){let t=performance.now(),a,i=c=>{let d=S(c);typeof e.map.moveCamera=="function"?e.map.moveCamera({center:d,zoom:c.zoom}):(e.map.setZoom(c.zoom),e.map.setCenter(d))},n=()=>{e.containerEl.classList.remove(F),e.containerEl.removeEventListener("pointerdown",r,!0),e.containerEl.removeEventListener("wheel",r,!0)},r=()=>{cancelAnimationFrame(a),n(),e.cancelFlight===r&&(e.cancelFlight=null)},s=()=>{let c=Math.min(1,(performance.now()-t)/l);i(o.at(le(c))),c<1?a=requestAnimationFrame(s):(n(),e.cancelFlight=null)};return e.containerEl.classList.add(F),e.containerEl.addEventListener("pointerdown",r,!0),e.containerEl.addEventListener("wheel",r,!0),a=requestAnimationFrame(s),r}function de(e,o,l){if(typeof ResizeObserver>"u")return;let t=!1,a=()=>{let{width:n,height:r}=e.getBoundingClientRect();n===0||r===0||(google.maps.event.trigger(o,"resize"),t||(t=!0,o.setCenter(l)))},i=new ResizeObserver(a);return i.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(a):queueMicrotask(a),i}function ue(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let o=!1,l=()=>{o||(_jsapiloader.setOptions.call(void 0, {...e.loaderOptions,key:e.apiKey}),o=!0)},t,a=0;return{async mount(i,n){let r=++a;l();let s=await _jsapiloader.importLibrary.call(void 0, "maps"),c=await _jsapiloader.importLibrary.call(void 0, "marker"),d=_nullishCoalesce(n.center, () => ({lat:0,lng:0})),u=e.styles!=null||e.overlayMarkers===!0,p=new s.Map(i,{...e.mapOptions,center:d,zoom:_nullishCoalesce(n.zoom, () => (10)),...u?e.styles!=null?{styles:e.styles}:e.mapId!=null?{mapId:e.mapId}:{}:{mapId:_nullishCoalesce(e.mapId, () => (G))}}),m=de(i,p,d),f={map:p,containerEl:i,fullscreenEl:_nullishCoalesce(n.fullscreenTarget, () => (i)),markerLib:c,markerMode:u?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:m,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return r===a&&(t=f),{raw:f,nativeMap:f.map}},renderLayer(i,n){let r=k(i),s=r.layers.get(n.id);s&&(P(s),r.layers.delete(n.id),A(r,n.id)),x(r,n.id);let c=r.markerMode==="overlay"?ee(r,n):J(r,n);r.layers.set(n.id,c),r.markerMode==="overlay"&&r.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(r.markerMode==="overlay"?Q():N(r,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,r.layers.get(n.id)===c&&(P(c),r.layers.delete(n.id),x(r,n.id),A(r,n.id)))}},onBoundsChange(i,n){let r=k(i),s=r.map.addListener("idle",()=>{let d=r.map.getBounds();d&&n(te(d))});r.boundsListeners.add(s);let c=!1;return()=>{c||(c=!0,s.remove(),r.boundsListeners.delete(s))}},onMapClick(i){let n=t;if(!n)return()=>{};let r=n.map.addListener("click",()=>i());n.clickListeners.add(r);let s=!1;return()=>{s||(s=!0,r.remove(),n.clickListeners.delete(r))}},fitBounds(i,n,r){let s=k(i);if(_optionalChain([s, 'access', _15 => _15.cancelFlight, 'optionalCall', _16 => _16()]),s.cancelFlight=null,!_optionalChain([r, 'optionalAccess', _17 => _17.animate])){s.map.fitBounds(n);return}let c=s.map.getZoom(),d=s.map.getCenter(),u=se(n,s.containerEl.clientWidth,s.containerEl.clientHeight);if(c==null||!d||!u){s.map.fitBounds(n);return}let p=typeof s.map.getRenderingType=="function"?s.map.getRenderingType():void 0,m=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(p!=="VECTOR"||m){s.map.fitBounds(n);return}s.map.setOptions({isFractionalZoomEnabled:!0});let f={...O(d.lat(),d.lng()),zoom:c},v={...O(u.center.lat,u.center.lng),zoom:u.zoom},y=Math.max(s.containerEl.clientWidth,s.containerEl.clientHeight),M=ie(f,v,y),g=Math.min(ae,Math.max(oe,M.S*re));s.cancelFlight=ce(s,M,g)},destroy(i){let n=k(i);_optionalChain([n, 'access', _18 => _18.resizeObserver, 'optionalAccess', _19 => _19.disconnect, 'call', _20 => _20()]),_optionalChain([n, 'access', _21 => _21.cancelFlight, 'optionalCall', _22 => _22()]),n.cancelFlight=null;for(let r of n.boundsListeners)r.remove();n.boundsListeners.clear();for(let r of n.clickListeners)r.remove();n.clickListeners.clear();for(let r of[...n.clusterers.keys()])x(n,r);for(let r of n.layers.values())P(r);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(i,n){if(t){t.selectedMarkerId=i,t.hoveredMarkerId=n;for(let[r,s]of t.markerElements)T(s,r,i,n)}},mountOverlay(i){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let r=Y(),s=new r(n,i,t.containerEl);return s.setMap(t.map),{container:n,setPosition:c=>s.updatePosition(c),unmount:()=>{s.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))+1)},zoomOut(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))-1)},toggleFullscreen(){if(!t)return;let i=t.fullscreenEl,n=document.fullscreenElement;n!=null&&i.contains(n)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _23 => _23.exitFullscreen, 'call', _24 => _24(), 'optionalAccess', _25 => _25.catch, 'call', _26 => _26(()=>{})]):typeof i.requestFullscreen=="function"&&_optionalChain([i, 'access', _27 => _27.requestFullscreen, 'call', _28 => _28(), 'optionalAccess', _29 => _29.catch, 'call', _30 => _30(()=>{})])}}}exports.googleProvider = ue;
@@ -1,5 +1,5 @@
1
1
  import { APIOptions } from '@googlemaps/js-api-loader';
2
- import { a as MapProvider } from '../../map-provider.interface-8hvdqqjd.cjs';
2
+ import { a as MapProvider } from '../../map-provider.interface-D3pwkbog.cjs';
3
3
 
4
4
  interface GoogleMapsProviderConfig {
5
5
  /** Google Maps JavaScript API key. Required -- there is no hardcoded fallback. */
@@ -1,5 +1,5 @@
1
1
  import { APIOptions } from '@googlemaps/js-api-loader';
2
- import { a as MapProvider } from '../../map-provider.interface-8hvdqqjd.js';
2
+ import { a as MapProvider } from '../../map-provider.interface-D3pwkbog.js';
3
3
 
4
4
  interface GoogleMapsProviderConfig {
5
5
  /** Google Maps JavaScript API key. Required -- there is no hardcoded fallback. */
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{importLibrary as w,setOptions as z}from"@googlemaps/js-api-loader";var G="DEMO_MAP_ID";function k(e){return e.raw}function W(e,o){if(e.element)return e.element;if(e.iconUrl)return new o.PinElement({glyphSrc:e.iconUrl}).element}var H=12,B="#b3261e";function U(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let o=document.createElement("div");return o.style.width=`${H}px`,o.style.height=`${H}px`,o.style.borderRadius="50%",o.style.backgroundColor=B,o.style.border="2px solid #ffffff",o.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",o}var L;function V(){if(L)return L;class e extends google.maps.OverlayView{constructor(t,a,i,n){super();this.position=t;this.content=a;this.onClick=i;this.lifecycle=n}position;content;onClick;lifecycle;div=null;onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,this.getPanes()?.overlayMouseTarget.appendChild(t),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let a=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));a&&(this.div.style.left=`${a.x}px`,this.div.style.top=`${a.y}px`)}onRemove(){let t=this.div;this.div?.remove(),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return L=e,L}var E=14,Z=8;function q(e){let{anchorX:o,anchorY:l,popupW:t,popupH:a,mapW:i,mapH:n,offsetY:r,pad:s}=e,c=o-t/2,d=o+t/2,u=0;t>i-s*2?u=s-c:d>i-s?u=i-s-d:c<s&&(u=s-c);let p=l-r-a,m=l+r+a,f=p<s&&m<=n-s;return{dx:u,flipBelow:f}}var b;function Y(){if(b)return b;class e extends google.maps.OverlayView{constructor(t,a,i){super();this.container=t;this.position=a;this.mapContainerEl=i}container;position;mapContainerEl;attached=!1;clampOffset=null;onAdd(){this.attached=!0,this.getPanes()?.floatPane.appendChild(this.container),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.container),typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>this.draw())}draw(){let t=this.getProjection();if(!t)return;let a=new google.maps.LatLng(this.position.lat,this.position.lng),i=t.fromLatLngToDivPixel(a);if(!i)return;if(this.clampOffset===null){let s=this.container.offsetWidth,c=this.container.offsetHeight,d=s&&c?t.fromLatLngToContainerPixel(a):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${i.x}px`,this.container.style.top=`${i.y-E}px`;return}this.clampOffset=q({anchorX:d.x,anchorY:d.y,popupW:s,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:E,pad:Z})}let{dx:n,flipBelow:r}=this.clampOffset;this.container.style.left=`${i.x+n}px`,r?(this.container.style.top=`${i.y+E}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-E}px`,this.container.style.transform="translate(-50%, -100%)")}onRemove(){this.attached=!1,this.container.remove()}updatePosition(t){(t.lat!==this.position.lat||t.lng!==this.position.lng)&&(this.clampOffset=null),this.position=t,this.attached&&this.draw()}}return b=e,b}function P(e){for(let o of e)typeof o.setMap=="function"?o.setMap(null):o.map=null}var D="#b3261e",X=40,$=64,j=14;function K(e,o){let l=o.count,t=Math.min($,X+Math.round(Math.log10(l+1)*j)),a=document.createElement("div");return a.textContent=String(l),a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.width=`${t}px`,a.style.height=`${t}px`,a.style.borderRadius="50%",a.style.backgroundColor=D,a.style.border="2px solid #ffffff",a.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",a.style.color="#ffffff",a.style.fontFamily="inherit",a.style.fontWeight="700",a.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:o.position,content:a})}var I=!1;async function N(e,o,l,t){let a;try{a=await import("@googlemaps/markerclusterer")}catch(n){I||(I=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(o)!==l)return;let i=new a.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>K(e.markerLib,n)}});e.clusterers.set(o,i)}function x(e,o){let l=e.clusterers.get(o);l&&(l.setMap(null),e.clusterers.delete(o))}var R=!1;function Q(){R||(R=!0,console.warn('[react-listing-engine] Marker clustering is not supported in `styles` (OverlayView) mode -- "@googlemaps/markerclusterer" only manages Marker/AdvancedMarkerElement instances. Rendering plain, unclustered overlay markers instead. Use a `mapId` (advanced-marker mode) to enable clustering.'))}function J(e,o){return o.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:W(l,e.markerLib),gmpClickable:!!o.onMarkerClick});if(o.onMarkerClick){let a=o.onMarkerClick;t.addListener("click",()=>a(l.id))}return t})}function T(e,o,l,t){e.classList.toggle("rle-marker--selected",o===l),e.classList.toggle("rle-marker--hovered",o===t&&o!==l)}function ee(e,o){let l=V();return o.markers.map(t=>{let a=o.onMarkerClick,i=a?()=>a(t.id):void 0,n=new l(t.position,U(t),i,{onContainerAdd:r=>{e.markerElements.set(t.id,r),T(r,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:r=>{e.markerElements.get(t.id)===r&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function A(e,o){let l=e.layerMarkerIds.get(o);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(o)}}function te(e){let o=e.getSouthWest(),l=e.getNorthEast();return{west:o.lng(),south:o.lat(),east:l.lng(),north:l.lat()}}var C=256,ne=1.2,re=320,oe=450,ae=2600,F="rle-map-flying";function O(e,o){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:C*(.5+o/360),y:C*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function S(e){let o=Math.PI-2*Math.PI*e.y/C;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o))),lng:(e.x/C-.5)*360}}function se(e,o,l){let t=O(e.north,e.east),a=O(e.south,e.west),i=Math.abs(t.x-a.x),n=Math.abs(t.y-a.y);return i===0||n===0||o===0||l===0?null:{center:S({x:(t.x+a.x)/2,y:(t.y+a.y)/2}),zoom:Math.min(Math.log2(o/i),Math.log2(l/n))}}function ie(e,o,l){let t=l/2**e.zoom,a=l/2**o.zoom,i=o.x-e.x,n=o.y-e.y,r=i*i+n*n,s=ne,c=s*s;if(r<1e-12){let M=Math.abs(Math.log(a/t))/s,g=a<t?-1:1;return{S:M,at:h=>({x:e.x,y:e.y,zoom:Math.log2(l/(t*Math.exp(g*s*(h*M))))})}}let d=Math.sqrt(r),u=(a*a-t*t+c*c*r)/(2*t*c*d),p=(a*a-t*t-c*c*r)/(2*a*c*d),m=Math.log(Math.sqrt(u*u+1)-u),v=(Math.log(Math.sqrt(p*p+1)-p)-m)/s,y=Math.cosh(m);return{S:v,at:M=>{let g=s*(M*v)+m,h=t/(c*d)*(y*Math.tanh(g)-Math.sinh(m)),_=t*y/Math.cosh(g);return{x:e.x+h*i,y:e.y+h*n,zoom:Math.log2(l/_)}}}}function le(e){return e*(2-e)}function ce(e,o,l){let t=performance.now(),a,i=c=>{let d=S(c);typeof e.map.moveCamera=="function"?e.map.moveCamera({center:d,zoom:c.zoom}):(e.map.setZoom(c.zoom),e.map.setCenter(d))},n=()=>{e.containerEl.classList.remove(F),e.containerEl.removeEventListener("pointerdown",r,!0),e.containerEl.removeEventListener("wheel",r,!0)},r=()=>{cancelAnimationFrame(a),n(),e.cancelFlight===r&&(e.cancelFlight=null)},s=()=>{let c=Math.min(1,(performance.now()-t)/l);i(o.at(le(c))),c<1?a=requestAnimationFrame(s):(n(),e.cancelFlight=null)};return e.containerEl.classList.add(F),e.containerEl.addEventListener("pointerdown",r,!0),e.containerEl.addEventListener("wheel",r,!0),a=requestAnimationFrame(s),r}function de(e,o,l){if(typeof ResizeObserver>"u")return;let t=!1,a=()=>{let{width:n,height:r}=e.getBoundingClientRect();n===0||r===0||(google.maps.event.trigger(o,"resize"),t||(t=!0,o.setCenter(l)))},i=new ResizeObserver(a);return i.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(a):queueMicrotask(a),i}function ue(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let o=!1,l=()=>{o||(z({...e.loaderOptions,key:e.apiKey}),o=!0)},t,a=0;return{async mount(i,n){let r=++a;l();let s=await w("maps"),c=await w("marker"),d=n.center??{lat:0,lng:0},u=e.styles!=null||e.overlayMarkers===!0,p=new s.Map(i,{...e.mapOptions,center:d,zoom:n.zoom??10,...u?e.styles!=null?{styles:e.styles}:e.mapId!=null?{mapId:e.mapId}:{}:{mapId:e.mapId??G}}),m=de(i,p,d),f={map:p,containerEl:i,fullscreenEl:n.fullscreenTarget??i,markerLib:c,markerMode:u?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:m,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return r===a&&(t=f),{raw:f}},renderLayer(i,n){let r=k(i),s=r.layers.get(n.id);s&&(P(s),r.layers.delete(n.id),A(r,n.id)),x(r,n.id);let c=r.markerMode==="overlay"?ee(r,n):J(r,n);r.layers.set(n.id,c),r.markerMode==="overlay"&&r.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(r.markerMode==="overlay"?Q():N(r,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,r.layers.get(n.id)===c&&(P(c),r.layers.delete(n.id),x(r,n.id),A(r,n.id)))}},onBoundsChange(i,n){let r=k(i),s=r.map.addListener("idle",()=>{let d=r.map.getBounds();d&&n(te(d))});r.boundsListeners.add(s);let c=!1;return()=>{c||(c=!0,s.remove(),r.boundsListeners.delete(s))}},onMapClick(i){let n=t;if(!n)return()=>{};let r=n.map.addListener("click",()=>i());n.clickListeners.add(r);let s=!1;return()=>{s||(s=!0,r.remove(),n.clickListeners.delete(r))}},fitBounds(i,n,r){let s=k(i);if(s.cancelFlight?.(),s.cancelFlight=null,!r?.animate){s.map.fitBounds(n);return}let c=s.map.getZoom(),d=s.map.getCenter(),u=se(n,s.containerEl.clientWidth,s.containerEl.clientHeight);if(c==null||!d||!u){s.map.fitBounds(n);return}let p=typeof s.map.getRenderingType=="function"?s.map.getRenderingType():void 0,m=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(p!=="VECTOR"||m){s.map.fitBounds(n);return}s.map.setOptions({isFractionalZoomEnabled:!0});let f={...O(d.lat(),d.lng()),zoom:c},v={...O(u.center.lat,u.center.lng),zoom:u.zoom},y=Math.max(s.containerEl.clientWidth,s.containerEl.clientHeight),M=ie(f,v,y),g=Math.min(ae,Math.max(oe,M.S*re));s.cancelFlight=ce(s,M,g)},destroy(i){let n=k(i);n.resizeObserver?.disconnect(),n.cancelFlight?.(),n.cancelFlight=null;for(let r of n.boundsListeners)r.remove();n.boundsListeners.clear();for(let r of n.clickListeners)r.remove();n.clickListeners.clear();for(let r of[...n.clusterers.keys()])x(n,r);for(let r of n.layers.values())P(r);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(i,n){if(t){t.selectedMarkerId=i,t.hoveredMarkerId=n;for(let[r,s]of t.markerElements)T(s,r,i,n)}},mountOverlay(i){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let r=Y(),s=new r(n,i,t.containerEl);return s.setMap(t.map),{container:n,setPosition:c=>s.updatePosition(c),unmount:()=>{s.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((t.map.getZoom()??0)+1)},zoomOut(){t&&t.map.setZoom((t.map.getZoom()??0)-1)},toggleFullscreen(){if(!t)return;let i=t.fullscreenEl,n=document.fullscreenElement;n!=null&&i.contains(n)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof i.requestFullscreen=="function"&&i.requestFullscreen()?.catch(()=>{})}}}export{ue as googleProvider};
2
+ import{importLibrary as w,setOptions as z}from"@googlemaps/js-api-loader";var G="DEMO_MAP_ID";function k(e){return e.raw}function W(e,o){if(e.element)return e.element;if(e.iconUrl)return new o.PinElement({glyphSrc:e.iconUrl}).element}var H=12,B="#b3261e";function U(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let o=document.createElement("div");return o.style.width=`${H}px`,o.style.height=`${H}px`,o.style.borderRadius="50%",o.style.backgroundColor=B,o.style.border="2px solid #ffffff",o.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",o}var L;function V(){if(L)return L;class e extends google.maps.OverlayView{constructor(t,a,i,n){super();this.position=t;this.content=a;this.onClick=i;this.lifecycle=n}position;content;onClick;lifecycle;div=null;onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,this.getPanes()?.overlayMouseTarget.appendChild(t),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let a=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));a&&(this.div.style.left=`${a.x}px`,this.div.style.top=`${a.y}px`)}onRemove(){let t=this.div;this.div?.remove(),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return L=e,L}var E=14,Z=8;function q(e){let{anchorX:o,anchorY:l,popupW:t,popupH:a,mapW:i,mapH:n,offsetY:r,pad:s}=e,c=o-t/2,d=o+t/2,u=0;t>i-s*2?u=s-c:d>i-s?u=i-s-d:c<s&&(u=s-c);let p=l-r-a,m=l+r+a,f=p<s&&m<=n-s;return{dx:u,flipBelow:f}}var b;function Y(){if(b)return b;class e extends google.maps.OverlayView{constructor(t,a,i){super();this.container=t;this.position=a;this.mapContainerEl=i}container;position;mapContainerEl;attached=!1;clampOffset=null;onAdd(){this.attached=!0,this.getPanes()?.floatPane.appendChild(this.container),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.container),typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>this.draw())}draw(){let t=this.getProjection();if(!t)return;let a=new google.maps.LatLng(this.position.lat,this.position.lng),i=t.fromLatLngToDivPixel(a);if(!i)return;if(this.clampOffset===null){let s=this.container.offsetWidth,c=this.container.offsetHeight,d=s&&c?t.fromLatLngToContainerPixel(a):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${i.x}px`,this.container.style.top=`${i.y-E}px`;return}this.clampOffset=q({anchorX:d.x,anchorY:d.y,popupW:s,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:E,pad:Z})}let{dx:n,flipBelow:r}=this.clampOffset;this.container.style.left=`${i.x+n}px`,r?(this.container.style.top=`${i.y+E}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-E}px`,this.container.style.transform="translate(-50%, -100%)")}onRemove(){this.attached=!1,this.container.remove()}updatePosition(t){(t.lat!==this.position.lat||t.lng!==this.position.lng)&&(this.clampOffset=null),this.position=t,this.attached&&this.draw()}}return b=e,b}function P(e){for(let o of e)typeof o.setMap=="function"?o.setMap(null):o.map=null}var D="#b3261e",X=40,$=64,j=14;function K(e,o){let l=o.count,t=Math.min($,X+Math.round(Math.log10(l+1)*j)),a=document.createElement("div");return a.textContent=String(l),a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.width=`${t}px`,a.style.height=`${t}px`,a.style.borderRadius="50%",a.style.backgroundColor=D,a.style.border="2px solid #ffffff",a.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",a.style.color="#ffffff",a.style.fontFamily="inherit",a.style.fontWeight="700",a.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:o.position,content:a})}var I=!1;async function N(e,o,l,t){let a;try{a=await import("@googlemaps/markerclusterer")}catch(n){I||(I=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(o)!==l)return;let i=new a.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>K(e.markerLib,n)}});e.clusterers.set(o,i)}function x(e,o){let l=e.clusterers.get(o);l&&(l.setMap(null),e.clusterers.delete(o))}var R=!1;function Q(){R||(R=!0,console.warn('[react-listing-engine] Marker clustering is not supported in `styles` (OverlayView) mode -- "@googlemaps/markerclusterer" only manages Marker/AdvancedMarkerElement instances. Rendering plain, unclustered overlay markers instead. Use a `mapId` (advanced-marker mode) to enable clustering.'))}function J(e,o){return o.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:W(l,e.markerLib),gmpClickable:!!o.onMarkerClick});if(o.onMarkerClick){let a=o.onMarkerClick;t.addListener("click",()=>a(l.id))}return t})}function T(e,o,l,t){e.classList.toggle("rle-marker--selected",o===l),e.classList.toggle("rle-marker--hovered",o===t&&o!==l)}function ee(e,o){let l=V();return o.markers.map(t=>{let a=o.onMarkerClick,i=a?()=>a(t.id):void 0,n=new l(t.position,U(t),i,{onContainerAdd:r=>{e.markerElements.set(t.id,r),T(r,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:r=>{e.markerElements.get(t.id)===r&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function A(e,o){let l=e.layerMarkerIds.get(o);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(o)}}function te(e){let o=e.getSouthWest(),l=e.getNorthEast();return{west:o.lng(),south:o.lat(),east:l.lng(),north:l.lat()}}var C=256,ne=1.2,re=320,oe=450,ae=2600,F="rle-map-flying";function O(e,o){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:C*(.5+o/360),y:C*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function S(e){let o=Math.PI-2*Math.PI*e.y/C;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o))),lng:(e.x/C-.5)*360}}function se(e,o,l){let t=O(e.north,e.east),a=O(e.south,e.west),i=Math.abs(t.x-a.x),n=Math.abs(t.y-a.y);return i===0||n===0||o===0||l===0?null:{center:S({x:(t.x+a.x)/2,y:(t.y+a.y)/2}),zoom:Math.min(Math.log2(o/i),Math.log2(l/n))}}function ie(e,o,l){let t=l/2**e.zoom,a=l/2**o.zoom,i=o.x-e.x,n=o.y-e.y,r=i*i+n*n,s=ne,c=s*s;if(r<1e-12){let M=Math.abs(Math.log(a/t))/s,g=a<t?-1:1;return{S:M,at:h=>({x:e.x,y:e.y,zoom:Math.log2(l/(t*Math.exp(g*s*(h*M))))})}}let d=Math.sqrt(r),u=(a*a-t*t+c*c*r)/(2*t*c*d),p=(a*a-t*t-c*c*r)/(2*a*c*d),m=Math.log(Math.sqrt(u*u+1)-u),v=(Math.log(Math.sqrt(p*p+1)-p)-m)/s,y=Math.cosh(m);return{S:v,at:M=>{let g=s*(M*v)+m,h=t/(c*d)*(y*Math.tanh(g)-Math.sinh(m)),_=t*y/Math.cosh(g);return{x:e.x+h*i,y:e.y+h*n,zoom:Math.log2(l/_)}}}}function le(e){return e*(2-e)}function ce(e,o,l){let t=performance.now(),a,i=c=>{let d=S(c);typeof e.map.moveCamera=="function"?e.map.moveCamera({center:d,zoom:c.zoom}):(e.map.setZoom(c.zoom),e.map.setCenter(d))},n=()=>{e.containerEl.classList.remove(F),e.containerEl.removeEventListener("pointerdown",r,!0),e.containerEl.removeEventListener("wheel",r,!0)},r=()=>{cancelAnimationFrame(a),n(),e.cancelFlight===r&&(e.cancelFlight=null)},s=()=>{let c=Math.min(1,(performance.now()-t)/l);i(o.at(le(c))),c<1?a=requestAnimationFrame(s):(n(),e.cancelFlight=null)};return e.containerEl.classList.add(F),e.containerEl.addEventListener("pointerdown",r,!0),e.containerEl.addEventListener("wheel",r,!0),a=requestAnimationFrame(s),r}function de(e,o,l){if(typeof ResizeObserver>"u")return;let t=!1,a=()=>{let{width:n,height:r}=e.getBoundingClientRect();n===0||r===0||(google.maps.event.trigger(o,"resize"),t||(t=!0,o.setCenter(l)))},i=new ResizeObserver(a);return i.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(a):queueMicrotask(a),i}function ue(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let o=!1,l=()=>{o||(z({...e.loaderOptions,key:e.apiKey}),o=!0)},t,a=0;return{async mount(i,n){let r=++a;l();let s=await w("maps"),c=await w("marker"),d=n.center??{lat:0,lng:0},u=e.styles!=null||e.overlayMarkers===!0,p=new s.Map(i,{...e.mapOptions,center:d,zoom:n.zoom??10,...u?e.styles!=null?{styles:e.styles}:e.mapId!=null?{mapId:e.mapId}:{}:{mapId:e.mapId??G}}),m=de(i,p,d),f={map:p,containerEl:i,fullscreenEl:n.fullscreenTarget??i,markerLib:c,markerMode:u?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:m,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return r===a&&(t=f),{raw:f,nativeMap:f.map}},renderLayer(i,n){let r=k(i),s=r.layers.get(n.id);s&&(P(s),r.layers.delete(n.id),A(r,n.id)),x(r,n.id);let c=r.markerMode==="overlay"?ee(r,n):J(r,n);r.layers.set(n.id,c),r.markerMode==="overlay"&&r.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(r.markerMode==="overlay"?Q():N(r,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,r.layers.get(n.id)===c&&(P(c),r.layers.delete(n.id),x(r,n.id),A(r,n.id)))}},onBoundsChange(i,n){let r=k(i),s=r.map.addListener("idle",()=>{let d=r.map.getBounds();d&&n(te(d))});r.boundsListeners.add(s);let c=!1;return()=>{c||(c=!0,s.remove(),r.boundsListeners.delete(s))}},onMapClick(i){let n=t;if(!n)return()=>{};let r=n.map.addListener("click",()=>i());n.clickListeners.add(r);let s=!1;return()=>{s||(s=!0,r.remove(),n.clickListeners.delete(r))}},fitBounds(i,n,r){let s=k(i);if(s.cancelFlight?.(),s.cancelFlight=null,!r?.animate){s.map.fitBounds(n);return}let c=s.map.getZoom(),d=s.map.getCenter(),u=se(n,s.containerEl.clientWidth,s.containerEl.clientHeight);if(c==null||!d||!u){s.map.fitBounds(n);return}let p=typeof s.map.getRenderingType=="function"?s.map.getRenderingType():void 0,m=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(p!=="VECTOR"||m){s.map.fitBounds(n);return}s.map.setOptions({isFractionalZoomEnabled:!0});let f={...O(d.lat(),d.lng()),zoom:c},v={...O(u.center.lat,u.center.lng),zoom:u.zoom},y=Math.max(s.containerEl.clientWidth,s.containerEl.clientHeight),M=ie(f,v,y),g=Math.min(ae,Math.max(oe,M.S*re));s.cancelFlight=ce(s,M,g)},destroy(i){let n=k(i);n.resizeObserver?.disconnect(),n.cancelFlight?.(),n.cancelFlight=null;for(let r of n.boundsListeners)r.remove();n.boundsListeners.clear();for(let r of n.clickListeners)r.remove();n.clickListeners.clear();for(let r of[...n.clusterers.keys()])x(n,r);for(let r of n.layers.values())P(r);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(i,n){if(t){t.selectedMarkerId=i,t.hoveredMarkerId=n;for(let[r,s]of t.markerElements)T(s,r,i,n)}},mountOverlay(i){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let r=Y(),s=new r(n,i,t.containerEl);return s.setMap(t.map),{container:n,setPosition:c=>s.updatePosition(c),unmount:()=>{s.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((t.map.getZoom()??0)+1)},zoomOut(){t&&t.map.setZoom((t.map.getZoom()??0)-1)},toggleFullscreen(){if(!t)return;let i=t.fullscreenEl,n=document.fullscreenElement;n!=null&&i.contains(n)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof i.requestFullscreen=="function"&&i.requestFullscreen()?.catch(()=>{})}}}export{ue as googleProvider};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var _chunkOXSKWVIDcjs = require('../chunk-OXSKWVID.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkOXSKWVIDcjs.q,{..._chunkOXSKWVIDcjs.P,children:o})}exports.BottomNav = _chunkOXSKWVIDcjs.E; exports.BottomSheet = _chunkOXSKWVIDcjs.Q; exports.ListingApp = _chunkOXSKWVIDcjs.S; exports.StyledCard = _chunkOXSKWVIDcjs.F; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkOXSKWVIDcjs.G; exports.StyledFilterPanel = _chunkOXSKWVIDcjs.H; exports.StyledListingLayout = _chunkOXSKWVIDcjs.R; exports.StyledLoading = _chunkOXSKWVIDcjs.I; exports.StyledMarker = _chunkOXSKWVIDcjs.J; exports.StyledPopup = _chunkOXSKWVIDcjs.K; exports.StyledResultHeader = _chunkOXSKWVIDcjs.L; exports.StyledSearch = _chunkOXSKWVIDcjs.M; exports.StyledSidebar = _chunkOXSKWVIDcjs.N; exports.StyledToolbar = _chunkOXSKWVIDcjs.O; exports.styledDefaultComponents = _chunkOXSKWVIDcjs.P;
2
+ var _chunkPLAFA6TTcjs = require('../chunk-PLAFA6TT.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkPLAFA6TTcjs.q,{..._chunkPLAFA6TTcjs.P,children:o})}exports.BottomNav = _chunkPLAFA6TTcjs.E; exports.BottomSheet = _chunkPLAFA6TTcjs.Q; exports.ListingApp = _chunkPLAFA6TTcjs.S; exports.StyledCard = _chunkPLAFA6TTcjs.F; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkPLAFA6TTcjs.G; exports.StyledFilterPanel = _chunkPLAFA6TTcjs.H; exports.StyledListingLayout = _chunkPLAFA6TTcjs.R; exports.StyledLoading = _chunkPLAFA6TTcjs.I; exports.StyledMarker = _chunkPLAFA6TTcjs.J; exports.StyledPopup = _chunkPLAFA6TTcjs.K; exports.StyledResultHeader = _chunkPLAFA6TTcjs.L; exports.StyledSearch = _chunkPLAFA6TTcjs.M; exports.StyledSidebar = _chunkPLAFA6TTcjs.N; exports.StyledToolbar = _chunkPLAFA6TTcjs.O; exports.styledDefaultComponents = _chunkPLAFA6TTcjs.P;
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { f as IListingCardProps, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, a as IListingToolbarProps, g as IListingComponents } from '../listing-app-B53qbvxo.cjs';
4
- export { B as BottomNav, s as BottomNavView, t as IBottomNavAction, v as IBottomNavProps, w as IStyledListingLayoutProps, L as ListingApp, x as ListingAppMapProp, p as ListingAppProps, r as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-B53qbvxo.cjs';
5
- import '../map-provider.interface-8hvdqqjd.cjs';
3
+ import { f as IListingCardProps, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, a as IListingToolbarProps, g as IListingComponents } from '../listing-app-By6TrXB9.cjs';
4
+ export { B as BottomNav, s as BottomNavView, t as IBottomNavAction, v as IBottomNavProps, w as IStyledListingLayoutProps, L as ListingApp, x as ListingAppMapProp, p as ListingAppProps, r as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-By6TrXB9.cjs';
5
+ import '../map-provider.interface-D3pwkbog.cjs';
6
6
 
7
7
  /**
8
8
  * Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { f as IListingCardProps, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, a as IListingToolbarProps, g as IListingComponents } from '../listing-app-DxRpWQgn.js';
4
- export { B as BottomNav, s as BottomNavView, t as IBottomNavAction, v as IBottomNavProps, w as IStyledListingLayoutProps, L as ListingApp, x as ListingAppMapProp, p as ListingAppProps, r as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-DxRpWQgn.js';
5
- import '../map-provider.interface-8hvdqqjd.js';
3
+ import { f as IListingCardProps, h as IListingEmptyProps, i as IListingFilterPanelProps, j as IListingLoadingProps, k as IListingMarkerProps, l as IListingPopupProps, m as IListingResultHeaderProps, n as IListingSearchProps, o as IListingSidebarProps, a as IListingToolbarProps, g as IListingComponents } from '../listing-app-CHC-XAhJ.js';
4
+ export { B as BottomNav, s as BottomNavView, t as IBottomNavAction, v as IBottomNavProps, w as IStyledListingLayoutProps, L as ListingApp, x as ListingAppMapProp, p as ListingAppProps, r as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-CHC-XAhJ.js';
5
+ import '../map-provider.interface-D3pwkbog.js';
6
6
 
7
7
  /**
8
8
  * Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{E as r,F as p,G as i,H as y,I as d,J as l,K as n,L as m,M as s,N as a,O as S,P as t,Q as f,R as P,S as u,q as e}from"../chunk-AU6BK7UM.js";import{jsx as g}from"react/jsx-runtime";function L({children:o}){return g(e,{...t,children:o})}export{r as BottomNav,f as BottomSheet,u as ListingApp,p as StyledCard,L as StyledComponentsProviderWithDefaults,i as StyledEmpty,y as StyledFilterPanel,P as StyledListingLayout,d as StyledLoading,l as StyledMarker,n as StyledPopup,m as StyledResultHeader,s as StyledSearch,a as StyledSidebar,S as StyledToolbar,t as styledDefaultComponents};
2
+ import{E as r,F as p,G as i,H as y,I as d,J as l,K as n,L as m,M as s,N as a,O as S,P as t,Q as f,R as P,S as u,q as e}from"../chunk-XJBDGG2S.js";import{jsx as g}from"react/jsx-runtime";function L({children:o}){return g(e,{...t,children:o})}export{r as BottomNav,f as BottomSheet,u as ListingApp,p as StyledCard,L as StyledComponentsProviderWithDefaults,i as StyledEmpty,y as StyledFilterPanel,P as StyledListingLayout,d as StyledLoading,l as StyledMarker,n as StyledPopup,m as StyledResultHeader,s as StyledSearch,a as StyledSidebar,S as StyledToolbar,t as styledDefaultComponents};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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;"use client";
2
- var o= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this); }__init() {this.mounts=[]}__init2() {this.renderedLayers=[]}__init3() {this.removedLayers=[]}__init4() {this.fitBoundsCalls=[]}__init5() {this.destroyed=[]}__init6() {this.destroyCount=0}__init7() {this.markerStates=null}__init8() {this.overlays=[]}__init9() {this.zoomCalls=[]}__init10() {this.fullscreenToggles=0}__init11() {this.boundsListeners=new Set}__init12() {this.mapClickListeners=new Set}mount(t,e){let n={raw:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=_nullishCoalesce(e.fullscreenTarget, () => (t)),n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e,n){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&_optionalChain([this, 'access', _ => _.fullscreenTarget, 'access', _2 => _2.requestFullscreen, 'call', _3 => _3(), 'optionalAccess', _4 => _4.catch, 'call', _5 => _5(()=>{})])}}, _class);var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor!=null?Number(e.cursor)+1:_nullishCoalesce(e.offset, () => (0)),r=n.slice(s,s+e.limit),i=s+r.length-1,l=i+1<n.length;return{items:r,nextCursor:l?String(i):null,total:n.length}}async getPoints(t,e){let s=this.rows.filter(r=>this.predicate(r,t)).map(r=>({id:this.idOf(r),position:this.toLatLng(r),entity:r}));return e?s.filter(r=>this.isInBounds(r.position,e)):s}async getById(t){let e=this.rows.find(n=>this.idOf(n)===t);if(!e)throw new Error(`InMemoryEntityAdapter: no row with id "${String(t)}"`);return e}isInBounds(t,e){return t.lat<=e.north&&t.lat>=e.south&&t.lng>=e.west&&t.lng<=e.east}};exports.FakeMapProvider = o; exports.InMemoryEntityAdapter = a;
2
+ var o= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this); }__init() {this.mounts=[]}__init2() {this.renderedLayers=[]}__init3() {this.removedLayers=[]}__init4() {this.fitBoundsCalls=[]}__init5() {this.destroyed=[]}__init6() {this.destroyCount=0}__init7() {this.markerStates=null}__init8() {this.overlays=[]}__init9() {this.zoomCalls=[]}__init10() {this.fullscreenToggles=0}__init11() {this.boundsListeners=new Set}__init12() {this.mapClickListeners=new Set}mount(t,e){let n={raw:{el:t,opts:e},nativeMap:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=_nullishCoalesce(e.fullscreenTarget, () => (t)),n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e,n){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&_optionalChain([this, 'access', _ => _.fullscreenTarget, 'access', _2 => _2.requestFullscreen, 'call', _3 => _3(), 'optionalAccess', _4 => _4.catch, 'call', _5 => _5(()=>{})])}}, _class);var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor!=null?Number(e.cursor)+1:_nullishCoalesce(e.offset, () => (0)),r=n.slice(s,s+e.limit),i=s+r.length-1,l=i+1<n.length;return{items:r,nextCursor:l?String(i):null,total:n.length}}async getPoints(t,e){let s=this.rows.filter(r=>this.predicate(r,t)).map(r=>({id:this.idOf(r),position:this.toLatLng(r),entity:r}));return e?s.filter(r=>this.isInBounds(r.position,e)):s}async getById(t){let e=this.rows.find(n=>this.idOf(n)===t);if(!e)throw new Error(`InMemoryEntityAdapter: no row with id "${String(t)}"`);return e}isInBounds(t,e){return t.lat<=e.north&&t.lat>=e.south&&t.lng>=e.west&&t.lng<=e.east}};exports.FakeMapProvider = o; exports.InMemoryEntityAdapter = a;
@@ -1,4 +1,4 @@
1
- import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, F as FitBoundsOptions, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-8hvdqqjd.cjs';
1
+ import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, F as FitBoundsOptions, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-D3pwkbog.cjs';
2
2
 
3
3
  type BoundsListener = (b: Bounds) => void;
4
4
  /** One live overlay record kept by `FakeMapProvider.mountOverlay` for assertions. */
@@ -1,4 +1,4 @@
1
- import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, F as FitBoundsOptions, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-8hvdqqjd.js';
1
+ import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, F as FitBoundsOptions, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-D3pwkbog.js';
2
2
 
3
3
  type BoundsListener = (b: Bounds) => void;
4
4
  /** One live overlay record kept by `FakeMapProvider.mountOverlay` for assertions. */
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var o=class{mounts=[];renderedLayers=[];removedLayers=[];fitBoundsCalls=[];destroyed=[];destroyCount=0;markerStates=null;overlays=[];zoomCalls=[];fullscreenToggles=0;fullscreenTarget;boundsListeners=new Set;mapClickListeners=new Set;mount(t,e){let n={raw:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=e.fullscreenTarget??t,n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e,n){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&this.fullscreenTarget.requestFullscreen()?.catch(()=>{})}};var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}rows;predicate;toLatLng;idOf;async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor!=null?Number(e.cursor)+1:e.offset??0,r=n.slice(s,s+e.limit),i=s+r.length-1,l=i+1<n.length;return{items:r,nextCursor:l?String(i):null,total:n.length}}async getPoints(t,e){let s=this.rows.filter(r=>this.predicate(r,t)).map(r=>({id:this.idOf(r),position:this.toLatLng(r),entity:r}));return e?s.filter(r=>this.isInBounds(r.position,e)):s}async getById(t){let e=this.rows.find(n=>this.idOf(n)===t);if(!e)throw new Error(`InMemoryEntityAdapter: no row with id "${String(t)}"`);return e}isInBounds(t,e){return t.lat<=e.north&&t.lat>=e.south&&t.lng>=e.west&&t.lng<=e.east}};export{o as FakeMapProvider,a as InMemoryEntityAdapter};
2
+ var o=class{mounts=[];renderedLayers=[];removedLayers=[];fitBoundsCalls=[];destroyed=[];destroyCount=0;markerStates=null;overlays=[];zoomCalls=[];fullscreenToggles=0;fullscreenTarget;boundsListeners=new Set;mapClickListeners=new Set;mount(t,e){let n={raw:{el:t,opts:e},nativeMap:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=e.fullscreenTarget??t,n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e,n){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&this.fullscreenTarget.requestFullscreen()?.catch(()=>{})}};var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}rows;predicate;toLatLng;idOf;async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor!=null?Number(e.cursor)+1:e.offset??0,r=n.slice(s,s+e.limit),i=s+r.length-1,l=i+1<n.length;return{items:r,nextCursor:l?String(i):null,total:n.length}}async getPoints(t,e){let s=this.rows.filter(r=>this.predicate(r,t)).map(r=>({id:this.idOf(r),position:this.toLatLng(r),entity:r}));return e?s.filter(r=>this.isInBounds(r.position,e)):s}async getById(t){let e=this.rows.find(n=>this.idOf(n)===t);if(!e)throw new Error(`InMemoryEntityAdapter: no row with id "${String(t)}"`);return e}isInBounds(t,e){return t.lat<=e.north&&t.lat>=e.south&&t.lng>=e.west&&t.lng<=e.east}};export{o as FakeMapProvider,a as InMemoryEntityAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-listing-engine",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "license": "MIT",
5
5
  "description": "Headless, composable listing engine for React: filterable list + Google-Maps multi-layer map, with pluggable data adapters, a filter/dataset registry, injectable components, and a Tailwind-free styled adapter.",
6
6
  "funding": [
@@ -1,2 +0,0 @@
1
- "use client";
2
- var ee=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,pageIndex:0},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}})}setPageIndex(e){this.setState({pagination:{...this.state.pagination,pageIndex: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 V=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(),n=e.filter(o=>this.defs.has(o));n.forEach((o,s)=>{this.defs.get(o).order=s});let r=new Set(n);return i.filter(o=>!r.has(o.key)).forEach((o,s)=>{o.order=n.length+s}),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(n=>Object.hasOwn(e,n.key)).map(n=>n.toParams(e[n.key])).reduce((n,r)=>({...n,...r}),{})}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 te=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 ie=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let r of[...i])r(e);let n=this.map.get("*");if(n)for(let r of[...n])r(e)}on(e,i){let n=this.map.get(e);return n||(n=new Set,this.map.set(e,n)),n.add(i),()=>{n.delete(i)}}};var Ae={pagination:"paged",pageSize:20,debounceMs:250};var ne=class{options;constructor(e){this.options=Object.freeze({...Ae,...e})}};var re=class{filters;map;datasets;primaryDatasetId;store;emitter=new ie;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;mapHandle=null;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new V,this.map=e.map,this.config=new ne(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 ee({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,n=this.config.options.debounceMs;return n<=0?this.runQuery(i):new Promise(r=>{this.debounceResolve=r,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,r(this.runQuery(i))},n)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(r):this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.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(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async r=>{let o=this.datasets.get(r);if(!o)return;let s=await o.adapter.getPoints(i,e);n===this.pointsToken&&this.store.setPoints(r,s)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e,i){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e,i)}selectPoint(e,i){this.store.setSelection(i);let n=this.state.points[e]?.find(r=>r.id===i);n&&this.emitter.emit({type:"PointClicked",datasetId:e,id:n.id,entity:n.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let n=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,n),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:n})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let n=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.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 ze(...t){let e={config:{},filters:new V,datasets:new te};for(let i of t)i(e);return e}var Ue=t=>e=>{e.config={...e.config,...t}},Ke=t=>e=>{e.map=t},Ve=t=>e=>{e.datasets.add(t)},qe=t=>e=>{t(e.filters)},Di=t=>e=>{e.urlSync=t},$e=t=>e=>{e.initialFilters=t},Bi=t=>e=>{e.primaryDatasetId=t};import{createContext as bt,useContext as Lt}from"react";import{jsx as k,jsxs as Ge}from"react/jsx-runtime";function Tt(t){return String(t?.title??"")}var Pt=({item:t})=>k("div",{children:Tt(t)}),Ft=()=>k("div",{}),fe=()=>k("div",{}),kt=({children:t})=>k("div",{children:t}),Ct=({children:t})=>k("div",{children:t}),St=({value:t,onChange:e,placeholder:i})=>k("input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":i??"Search"}),wt=()=>k("div",{role:"status",children:"No results"}),It=()=>k("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),Et=({count:t})=>Ge("div",{children:[t," results"]}),xt=({children:t})=>k("div",{children:t}),Nt=({view:t,onViewChange:e})=>Ge("nav",{"aria-label":"Listing navigation",children:[k("button",{type:"button","aria-pressed":t==="list",onClick:()=>e("list"),children:"List"}),k("button",{type:"button","aria-pressed":t==="map",onClick:()=>e("map"),children:"Map"})]}),F={BottomNav:Nt,Card:Pt,Marker:Ft,Popup:fe,Sidebar:kt,FilterPanel:Ct,Search:St,Empty:wt,Loading:It,ResultHeader:Et,Toolbar:xt},We=bt(F);function je(t){let{BottomNav:e,Card:i,Marker:n,Popup:r,Sidebar:o,FilterPanel:s,Search:a,Empty:p,Loading:d,ResultHeader:l,Toolbar:m,children:c}=t,N={BottomNav:e??F.BottomNav,Card:i??F.Card,Marker:n??F.Marker,Popup:r??F.Popup,Sidebar:o??F.Sidebar,FilterPanel:s??F.FilterPanel,Search:a??F.Search,Empty:p??F.Empty,Loading:d??F.Loading,ResultHeader:l??F.ResultHeader,Toolbar:m??F.Toolbar};return k(We.Provider,{value:N,children:c})}function C(){return Lt(We)}import{createContext as Rt}from"react";var se=Rt(null);import{useContext as Mt}from"react";function v(){let t=Mt(se);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as Qe,useSyncExternalStore as Dt}from"react";function S(){let t=v(),e=Qe(n=>t.subscribe(n),[t]),i=Qe(()=>t.state,[t]);return Dt(e,i,i)}import{useCallback as Ze}from"react";function oe(){let t=v(),e=S(),i=Ze(r=>t.applyFilters(r),[t]),n=Ze((r,o)=>t.applyFilters({[r]:o}),[t]);return{filters:e.filters,set:i,setField:n}}import{jsx as Q,jsxs as Bt}from"react/jsx-runtime";function ye({className:t,groupClassName:e,hideLabels:i,draft:n,onDraftChange:r}={}){let o=v(),{FilterPanel:s}=C(),{filters:a}=oe(),p=n!==void 0&&r!==void 0,d=p?n:a;return Q(s,{children:Q("div",{className:t??"space-y-5",children:o.filters.list().map(l=>{if(typeof l.render=="string")return Q("div",{"data-filter":l.key,className:e},l.key);let m=l.render;return Bt("div",{className:e,children:[l.label&&!i&&Q("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:l.label}),Q(m,{value:l.fromParams(d),onChange:c=>p?r(l.toParams(c)):void o.applyFilters(l.toParams(c))})]},l.key)})})})}function q(){return S().results}import{jsx as ae}from"react/jsx-runtime";function Ot(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 Xe({className:t}={}){let e=v(),{items:i}=q(),{pagination:n,selection:r}=S(),{Card:o,Empty:s,Loading:a}=C();return n.loading&&i.length===0?ae(a,{}):i.length===0?ae(s,{}):ae("div",{role:"list",className:t,children:i.map((p,d)=>{let l=Ot(p,d);return ae(o,{item:p,selected:r===l,onSelect:()=>e.selectPoint(e.primaryDatasetId,l)},l)})})}import{useEffect as Z,useRef as B,useState as Je}from"react";import{createPortal as _t}from"react-dom";import{jsx as ve,jsxs as tt}from"react/jsx-runtime";var Ht={west:-179.9,south:-85,east:179.9,north:85},Ye=.1,et=.02;function At(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,n=t[0].lat,r=t[0].lat;for(let{lat:a,lng:p}of t)p<e&&(e=p),p>i&&(i=p),a<n&&(n=a),a>r&&(r=a);let o=r>n?(r-n)*Ye:et,s=i>e?(i-e)*Ye:et;return{west:e-s,east:i+s,south:n-o,north:r+o}}function it(t){let{center:e,zoom:i,fallback:n,mapControls:r,onMapReady:o}=t,s=v(),a=S(),p=B(o);p.current=o;let d=B(null),l=B(null),m=B(null),[c,N]=Je(!1),O=B(!1),_=B(!1),I=B(!1),u=s.map;Z(()=>{let P=m.current;if(!u||!P)return;let h=[];for(let g of Object.keys(a.points)){if(a.layers[g]===!1)continue;let f=s.datasets.get(g),x=a.points[g]??[],j={id:g,markers:x.map(R=>({id:R.id,position:R.position,iconUrl:f?.marker.iconUrl?.(R.entity),element:f?.marker.element?.(R.entity)})),clustering:f?.clustering,onMarkerClick:R=>s.selectPoint(g,R)};h.push(u.renderLayer(P,j))}return()=>{h.forEach(g=>g())}},[s,u,c,a.points,a.layers]),Z(()=>{if(!d.current||!u)return;let P=d.current,h=!1,g=null;return(async()=>{let f=await u.mount(P,{center:e,zoom:i,fullscreenTarget:l.current??void 0});if(h){u.destroy(f);return}m.current=f,s.setMapHandle(f),g=u.onBoundsChange(f,x=>{I.current?I.current=!1:_.current=!0,s.loadPoints(x)}),N(!0),p.current?.(f.raw),s.loadPoints(Ht)})(),()=>{h=!0,g?.(),m.current&&(u.destroy(m.current),m.current=null,s.setMapHandle(null),p.current?.(null)),N(!1)}},[s,u]),Z(()=>{let P=m.current;if(!u||!P||e||O.current||_.current)return;let h=[];for(let f of Object.keys(a.points))if(a.layers[f]!==!1)for(let x of a.points[f]??[])h.push(x.position);let g=At(h);g&&(O.current=!0,I.current=!0,u.fitBounds(P,g))},[u,e,c,a.points,a.layers]),Z(()=>{u?.updateMarkerStates(a.selection,a.hovered)},[u,c,a.selection,a.hovered]);let{Popup:L}=C(),T=L!==fe,U=a.points[s.primaryDatasetId]??[],K=a.selection!=null?U.find(P=>P.id===a.selection):void 0,[E,H]=Je(null),Y=B(K);return Y.current=K,Z(()=>{let P=m.current;if(!u||!P||!T)return;let h=Y.current;if(!h)return;let g=u.mountOverlay(h.position);H({entity:h.entity,position:h.position,container:g.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),x=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",x);let j=u.onMapClick(f);return()=>{document.removeEventListener("keydown",x),j(),g.unmount(),H(null)}},[s,u,c,a.selection,T]),tt("div",{ref:l,className:"relative h-full min-h-0 w-full",children:[tt("div",{ref:d,className:!u&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!u&&n,T&&E?_t(ve(L,{entity:E.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),E.container):null]}),r!=null&&ve("div",{className:"pointer-events-none absolute inset-0",children:ve("div",{className:"pointer-events-auto",children:r})})]})}import{jsx as X,jsxs as Ut}from"react/jsx-runtime";var he="gap";function zt(t,e){if(t<=7)return Array.from({length:t},(o,s)=>s+1);let i=Math.max(2,e-1),n=Math.min(t-1,e+1),r=[1];i>2&&r.push(he);for(let o=i;o<=n;o+=1)r.push(o);return n<t-1&&r.push(he),r.push(t),r}function nt(){let t=v(),{results:e,pagination:i}=S();if(i.mode==="infinite")return e.nextCursor==null?null:X("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let n=t.options.pageSize,{pageIndex:r}=i,o=r+1,s=e.total!=null?Math.ceil(e.total/n):null,a=s!=null?o<s:e.nextCursor!=null||e.items.length>=n;if(s!=null?s<=1:r===0&&!a)return null;let p=d=>()=>{t.goToPage(d)};return Ut("nav",{className:"rle-pagination","aria-label":"Pagination",children:[X("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||r===0,onClick:p(r-1),children:"\u2039"}),s!=null&&zt(s,o).map((d,l)=>d===he?X("span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${l}`):X("button",{type:"button",className:d===o?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${d}`,"aria-current":d===o?"page":void 0,disabled:i.loading,onClick:p(d-1),children:d},d)),X("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!a,onClick:p(r+1),children:"\u203A"})]})}import{jsx as Kt}from"react/jsx-runtime";function rt(){let{items:t,total:e}=q(),{ResultHeader:i}=C();return Kt(i,{count:t.length,total:e})}import{useEffect as Vt,useRef as qt}from"react";function st(t,e){let i=v(),n=qt(e);n.current=e,Vt(()=>i.on(t,r=>n.current(r)),[i,t])}import{useEffect as $t,useState as ot}from"react";import{jsx as Wt}from"react/jsx-runtime";function at(t){let{children:e,...i}=t,[n]=ot(()=>i),[r,o]=ot(null);return $t(()=>{let s=new re({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(s),o(s),()=>{n.urlSync&&n.urlSync.stop(),s.dispose(),o(a=>a===s?null:a)}},[n]),r?Wt(se.Provider,{value:r,children:e}):null}import{jsx as w,jsxs as J}from"react/jsx-runtime";function lt({view:t,onViewChange:e}){return w("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:J("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[J("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[w(jt,{}),"List"]}),J("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[w(Gt,{}),"Map"]})]})})}function jt(){return J("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:[w("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),w("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),w("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),w("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),w("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),w("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Gt(){return J("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:[w("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),w("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),w("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function $(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as Zt,jsx as M,jsxs as dt}from"react/jsx-runtime";function Qt(t){return t?"rle-card rle-card--selected":"rle-card"}function be({item:t,selected:e,onSelect:i}){let n=t??{},r=Qt(e),o=dt(Zt,{children:[n.imageUrl?M("img",{src:n.imageUrl,alt:n.title??"",className:"rle-card-media"}):M("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),dt("div",{className:"rle-card-body",children:[n.title&&M("span",{className:"rle-card-title",children:n.title}),n.subtitle&&M("span",{className:"rle-card-address",children:n.subtitle}),n.badge&&M("div",{className:"rle-card-info",children:M("span",{className:"rle-card-info-item",children:n.badge})}),n.price!=null&&M("span",{className:"rle-card-price",children:$(n.price)})]})]});return i?M("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:r,children:o}):M("article",{className:r,children:o})}import{jsx as le,jsxs as pt}from"react/jsx-runtime";function Le(t){return pt("div",{role:"status",className:"rle-empty",children:[pt("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:[le("circle",{cx:"11",cy:"11",r:"7"}),le("path",{d:"m21 21-4.3-4.3"})]}),le("p",{className:"rle-empty-title",children:"No results"}),le("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Xt}from"react/jsx-runtime";function Te({children:t}){return Xt("div",{className:"rle-filter-panel",children:t})}import{jsx as de,jsxs as Jt}from"react/jsx-runtime";function Pe(t){return de("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>Jt("div",{className:"rle-loading-item",children:[de("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),de("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),de("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as Yt}from"react/jsx-runtime";function Fe({point:t}){let e=t.entity??{};return Yt("span",{className:"rle-pin",children:e.price!=null?$(e.price):""})}import{jsx as W,jsxs as ke}from"react/jsx-runtime";function Ce({entity:t,onClose:e}){let i=t??{};return ke("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[W("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:ke("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:[W("path",{d:"M18 6 6 18"}),W("path",{d:"m6 6 12 12"})]})}),ke("div",{children:[i.title&&W("div",{className:"rle-card-title",children:i.title}),i.subtitle&&W("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&W("div",{className:"rle-card-price",children:$(i.price)})]})]})}import{jsx as ei}from"react/jsx-runtime";function Se({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return ei("div",{className:"rle-result-header",children:i})}import{jsx as ti}from"react/jsx-runtime";function we({value:t,onChange:e,placeholder:i}){return ti("input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as ii}from"react/jsx-runtime";function Ie({children:t}){return ii("aside",{className:"rle-sidebar",children:t})}import{jsx as ni}from"react/jsx-runtime";function Ee({children:t}){return ni("div",{className:"rle-toolbar",children:t})}var ut={BottomNav:lt,Card:be,Marker:Fe,Popup:Ce,Sidebar:Ie,FilterPanel:Te,Search:we,Empty:Le,Loading:Pe,ResultHeader:Se,Toolbar:Ee};import{useEffect as xe,useRef as ri,useState as ct}from"react";import{createPortal as si}from"react-dom";import{Fragment as ai,jsx as D,jsxs as pe}from"react/jsx-runtime";function mt({open:t,onOpenChange:e,title:i,children:n,footer:r}){let o=ri(null),[s,a]=ct(!1),[p,d]=ct(!1);return xe(()=>{if(!t){d(!1),a(!1);return}a(!0);let l=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(l)},[t]),xe(()=>{if(!s)return;let l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}},[s]),xe(()=>{if(!s)return;o.current?.focus();function l(m){m.key==="Escape"&&e(!1)}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),!s||typeof document>"u"?null:si(pe(ai,{children:[D("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),pe("div",{ref:o,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[D("div",{className:"rle-sheet__handle","aria-hidden":"true"}),pe("div",{className:"rle-sheet__header",children:[i&&D("div",{className:"rle-sheet__title",children:i}),D("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:D(oi,{})})]}),D("div",{className:"rle-sheet__body",children:n}),r&&D("div",{className:"rle-sheet__footer",children:r})]})]}),document.body)}function oi(){return pe("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:[D("path",{d:"M18 6 6 18"}),D("path",{d:"m6 6 12 12"})]})}import{useEffect as ce,useRef as Ne,useState as z}from"react";import{jsx as b,jsxs as ue}from"react/jsx-runtime";function gt({search:t,onFiltersClick:e,filterCount:i=0,action:n}){let{Search:r}=C();return ue("header",{className:"rle-mobile-header",children:[t&&b("div",{className:"rle-mobile-header__search",children:b(r,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),ue("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[b(li,{}),b("span",{children:"Filters"}),i>0&&b("span",{className:"rle-mobile-header__count",children:i})]}),n&&b("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:n.onClick,"aria-label":n.label,children:n.icon??b(di,{})})]})}function li(){return ue("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 di(){return ue("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 mi,jsx as y,jsxs as A}from"react/jsx-runtime";var pi=y("div",{className:"rle-empty",children:"Map unavailable"});function ui(){let t=Ne(null),[e,i]=z(!0),[n,r]=z(!0);return ce(()=>{let o=t.current;if(!o)return;let s=()=>{let{clientWidth:m,scrollLeft:c,scrollWidth:N}=o;i(c<=0),r(c+m>=N-1)},a=0,p=()=>{a||(a=requestAnimationFrame(()=>{a=0,s()}))};s(),o.addEventListener("scroll",s,{passive:!0});let d,l;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(s),d.observe(o)),typeof MutationObserver<"u"&&(l=new MutationObserver(p),l.observe(o,{characterData:!0,childList:!0,subtree:!0})),()=>{o.removeEventListener("scroll",s),d?.disconnect(),l?.disconnect(),a&&cancelAnimationFrame(a)}},[]),{atEnd:n,atStart:e,ref:t}}function ci(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,n=e,r=new Set([...Object.keys(i),...Object.keys(n)]);for(let o of r)if(i[o]!==n[o])return!1;return!0}function ft({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:n,autoFetch:r=!0,hasMap:o,mapCenter:s,mapZoom:a,mapControls:p,onMapReady:d,mobileSheetFooter:l,className:m}){let c=v(),{BottomNav:N,Search:O}=C(),_=q(),{filters:I,set:u}=oe(),{pagination:L}=S(),T=o??c.map!=null,[U,K]=z("list"),[E,H]=z(!1),{atEnd:Y,atStart:P,ref:h}=ui(),g=Ne(null);ce(()=>{L.mode==="paged"&&g.current&&(g.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,x]=z(I),[j,R]=z(E);E!==j&&(R(E),E&&x(I));let Me=ge=>x(ht=>({...ht,...ge})),[De,Be]=z(!1),me=Ne(!1);ce(()=>{if(De){if(L.loading){me.current=!0;return}me.current&&(me.current=!1,Be(!1),H(!1))}},[De,L.loading]);let G=t?{value:String(I[t.filterKey]??""),onChange:ge=>{u({[t.filterKey]:ge||void 0})},placeholder:t.placeholder}:void 0;ce(()=>{r!==!1&&c.applyFilters({})},[c,r]);let Oe=()=>{Me(c.filters.clearedParams())},_e=()=>{if(ci(f,I)){H(!1);return}Be(!0),c.applyFilters(f)},vt=c.filters.activeKeys(I).length,He=_.total??_.items.length;return A("div",{className:m?`rle-app ${m}`:"rle-app",children:[A("div",{className:"rle-filter-bar",children:[A("div",{className:"rle-filter-bar__scroll",ref:h,children:[G&&y("div",{className:"rle-filter-bar__search",children:y(O,{value:G.value,onChange:G.onChange,placeholder:G.placeholder})}),e&&y("div",{className:"rle-filter-bar__slot",children:e}),y(ye,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!P&&y("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!Y&&y("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),y(gt,{search:G,onFiltersClick:()=>H(!0),filterCount:vt,action:n}),A("div",{className:`rle-body ${T?"rle-split":"rle-body--list-only"}`,"data-mobile-view":U,children:[A("div",{className:"rle-list",ref:g,children:[A("div",{className:"rle-list-header",children:[y(rt,{}),i&&y("div",{className:"rle-list-header__toolbar",children:i})]}),y(Xe,{className:"rle-list-grid"}),y(nt,{})]}),T&&y("div",{className:"rle-map",children:y(it,{center:s,zoom:a,fallback:pi,mapControls:p,onMapReady:d})})]}),T&&y(N,{view:U,onViewChange:K}),y(mt,{title:"Filters",open:E,onOpenChange:H,footer:l?l({draft:f,apply:_e,clear:Oe,resultCount:He,loading:L.loading}):A(mi,{children:[y("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:Oe,children:"Clear all"}),y("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:_e,children:L.loading?y("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${He} results`})]}),children:y(ye,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Me})})]})}import{useEffect as gi,useRef as fi,useState as yi}from"react";import{jsx as Re,jsxs as bi}from"react/jsx-runtime";function yt(t){return"provider"in t}function vi(t){let e=t!=null&&!yt(t),i=e?t.apiKey:void 0,n=e?t.mapId:void 0,r=e?t.mapOptions:void 0,o=e?t.styles:void 0,s=e?t.overlayMarkers:void 0,[a,p]=yi(()=>!t||yt(t)?{ready:!0,provider:t?.provider}:{ready:!1});return gi(()=>{if(!i)return;let d=!1;return import("./maps/google/index.js").then(({googleProvider:l})=>{d||p({ready:!0,provider:l({apiKey:i,mapId:n,mapOptions:r,styles:o,overlayMarkers:s})})}),()=>{d=!0}},[i,n]),a}function hi({onFiltersChange:t}){let e=fi(t);return e.current=t,st("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function Ar(t){let{datasets:e,filters:i,map:n,components:r,initialFilters:o,onFiltersChange:s,mobileAction:a,search:p,filterBarStart:d,toolbarEnd:l,mapControls:m,onMapReady:c,mobileSheetFooter:N,config:O,autoFetch:_,className:I}=t,{ready:u,provider:L}=vi(n);if(!u)return null;let T=[];for(let E of e)T.push(Ve(E));i&&T.push(qe(i)),L&&T.push(Ke(L)),o&&T.push($e(o)),O&&T.push(Ue(O));let U=ze(...T),K={...ut,...r};return bi(at,{...U,children:[s&&Re(hi,{onFiltersChange:s}),Re(je,{...K,children:Re(ft,{className:I,search:p,filterBarStart:d,toolbarEnd:l,mobileAction:a,autoFetch:_,mapCenter:n?.center,mapZoom:n?.zoom,mapControls:m,onMapReady:c,mobileSheetFooter:N})})]})}export{ee as a,V as b,te as c,ie as d,Ae as e,ne as f,re as g,ze as h,Ue as i,Ke as j,Ve as k,qe as l,Di as m,$e as n,Bi as o,fe as p,je as q,C as r,se as s,v as t,S as u,oe as v,ye as w,q as x,Xe as y,it as z,nt as A,rt as B,st as C,at as D,lt as E,be as F,Le as G,Te as H,Pe as I,Fe as J,Ce as K,Se as L,we as M,Ie as N,Ee as O,ut as P,mt as Q,ft as R,Ar 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 ee= (_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,pageIndex:0},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}})}setPageIndex(e){this.setState({pagination:{...this.state.pagination,pageIndex: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 V= (_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(),n=e.filter(o=>this.defs.has(o));n.forEach((o,s)=>{this.defs.get(o).order=s});let r=new Set(n);return i.filter(o=>!r.has(o.key)).forEach((o,s)=>{o.order=n.length+s}),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(n=>Object.hasOwn(e,n.key)).map(n=>n.toParams(e[n.key])).reduce((n,r)=>({...n,...r}),{})}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 te= (_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 ie= (_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 r of[...i])r(e);let n=this.map.get("*");if(n)for(let r of[...n])r(e)}on(e,i){let n=this.map.get(e);return n||(n=new Set,this.map.set(e,n)),n.add(i),()=>{n.delete(i)}}}, _class4);var Ae={pagination:"paged",pageSize:20,debounceMs:250};var ne=class{constructor(e){this.options=Object.freeze({...Ae,...e})}};var re= (_class5 =class{__init5() {this.emitter=new ie}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}__init10() {this.mapHandle=null}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);_class5.prototype.__init10.call(this);this.datasets=e.datasets,this.filters=_nullishCoalesce(e.filters, () => (new V)),this.map=e.map,this.config=new ne(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 ee({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,n=this.config.options.debounceMs;return n<=0?this.runQuery(i):new Promise(r=>{this.debounceResolve=r,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,r(this.runQuery(i))},n)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(r):this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let r=await n.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.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(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async r=>{let o=this.datasets.get(r);if(!o)return;let s=await o.adapter.getPoints(i,e);n===this.pointsToken&&this.store.setPoints(r,s)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e,i){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e,i)}selectPoint(e,i){this.store.setSelection(i);let n=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(r=>r.id===i)]);n&&this.emitter.emit({type:"PointClicked",datasetId:e,id:n.id,entity:n.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let n=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,n),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:n})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let n=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.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 ze(...t){let e={config:{},filters:new V,datasets:new te};for(let i of t)i(e);return e}var Ue=t=>e=>{e.config={...e.config,...t}},Ke= exports.j =t=>e=>{e.map=t},Ve= exports.k =t=>e=>{e.datasets.add(t)},qe= exports.l =t=>e=>{t(e.filters)},Di= exports.m =t=>e=>{e.urlSync=t},$e= exports.n =t=>e=>{e.initialFilters=t},Bi= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function Tt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var Pt=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:Tt(t)}),Ft=()=>_jsxruntime.jsx.call(void 0, "div",{}),fe= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),kt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Ct=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),St=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),wt=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),It=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),Et=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),xt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Nt=({view:t,onViewChange:e})=>_jsxruntime.jsxs.call(void 0, "nav",{"aria-label":"Listing navigation",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":t==="list",onClick:()=>e("list"),children:"List"}),_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":t==="map",onClick:()=>e("map"),children:"Map"})]}),F={BottomNav:Nt,Card:Pt,Marker:Ft,Popup:fe,Sidebar:kt,FilterPanel:Ct,Search:St,Empty:wt,Loading:It,ResultHeader:Et,Toolbar:xt},We=_react.createContext.call(void 0, F);function je(t){let{BottomNav:e,Card:i,Marker:n,Popup:r,Sidebar:o,FilterPanel:s,Search:a,Empty:p,Loading:d,ResultHeader:l,Toolbar:m,children:c}=t,N={BottomNav:_nullishCoalesce(e, () => (F.BottomNav)),Card:_nullishCoalesce(i, () => (F.Card)),Marker:_nullishCoalesce(n, () => (F.Marker)),Popup:_nullishCoalesce(r, () => (F.Popup)),Sidebar:_nullishCoalesce(o, () => (F.Sidebar)),FilterPanel:_nullishCoalesce(s, () => (F.FilterPanel)),Search:_nullishCoalesce(a, () => (F.Search)),Empty:_nullishCoalesce(p, () => (F.Empty)),Loading:_nullishCoalesce(d, () => (F.Loading)),ResultHeader:_nullishCoalesce(l, () => (F.ResultHeader)),Toolbar:_nullishCoalesce(m, () => (F.Toolbar))};return _jsxruntime.jsx.call(void 0, We.Provider,{value:N,children:c})}function C(){return _react.useContext.call(void 0, We)}var se=_react.createContext.call(void 0, null);function v(){let t=_react.useContext.call(void 0, se);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function S(){let t=v(),e=_react.useCallback.call(void 0, n=>t.subscribe(n),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function oe(){let t=v(),e=S(),i=_react.useCallback.call(void 0, r=>t.applyFilters(r),[t]),n=_react.useCallback.call(void 0, (r,o)=>t.applyFilters({[r]:o}),[t]);return{filters:e.filters,set:i,setField:n}}function ye({className:t,groupClassName:e,hideLabels:i,draft:n,onDraftChange:r}={}){let o=v(),{FilterPanel:s}=C(),{filters:a}=oe(),p=n!==void 0&&r!==void 0,d=p?n:a;return _jsxruntime.jsx.call(void 0, s,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(t, () => ("space-y-5")),children:o.filters.list().map(l=>{if(typeof l.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":l.key,className:e},l.key);let m=l.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[l.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:l.label}),_jsxruntime.jsx.call(void 0, m,{value:l.fromParams(d),onChange:c=>p?r(l.toParams(c)):void o.applyFilters(l.toParams(c))})]},l.key)})})})}function q(){return S().results}function Ot(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 Xe({className:t}={}){let e=v(),{items:i}=q(),{pagination:n,selection:r}=S(),{Card:o,Empty:s,Loading:a}=C();return n.loading&&i.length===0?_jsxruntime.jsx.call(void 0, a,{}):i.length===0?_jsxruntime.jsx.call(void 0, s,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:t,children:i.map((p,d)=>{let l=Ot(p,d);return _jsxruntime.jsx.call(void 0, o,{item:p,selected:r===l,onSelect:()=>e.selectPoint(e.primaryDatasetId,l)},l)})})}var _reactdom = require('react-dom');var Ht={west:-179.9,south:-85,east:179.9,north:85},Ye=.1,et=.02;function At(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,n=t[0].lat,r=t[0].lat;for(let{lat:a,lng:p}of t)p<e&&(e=p),p>i&&(i=p),a<n&&(n=a),a>r&&(r=a);let o=r>n?(r-n)*Ye:et,s=i>e?(i-e)*Ye:et;return{west:e-s,east:i+s,south:n-o,north:r+o}}function it(t){let{center:e,zoom:i,fallback:n,mapControls:r,onMapReady:o}=t,s=v(),a=S(),p=_react.useRef.call(void 0, o);p.current=o;let d=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, null),m=_react.useRef.call(void 0, null),[c,N]=_react.useState.call(void 0, !1),O=_react.useRef.call(void 0, !1),_=_react.useRef.call(void 0, !1),I=_react.useRef.call(void 0, !1),u=s.map;_react.useEffect.call(void 0, ()=>{let P=m.current;if(!u||!P)return;let h=[];for(let g of Object.keys(a.points)){if(a.layers[g]===!1)continue;let f=s.datasets.get(g),x=_nullishCoalesce(a.points[g], () => ([])),j={id:g,markers:x.map(R=>({id:R.id,position:R.position,iconUrl:_optionalChain([f, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(R.entity)]),element:_optionalChain([f, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(R.entity)])})),clustering:_optionalChain([f, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:R=>s.selectPoint(g,R)};h.push(u.renderLayer(P,j))}return()=>{h.forEach(g=>g())}},[s,u,c,a.points,a.layers]),_react.useEffect.call(void 0, ()=>{if(!d.current||!u)return;let P=d.current,h=!1,g=null;return(async()=>{let f=await u.mount(P,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(l.current, () => (void 0))});if(h){u.destroy(f);return}m.current=f,s.setMapHandle(f),g=u.onBoundsChange(f,x=>{I.current?I.current=!1:_.current=!0,s.loadPoints(x)}),N(!0),_optionalChain([p, 'access', _24 => _24.current, 'optionalCall', _25 => _25(f.raw)]),s.loadPoints(Ht)})(),()=>{h=!0,_optionalChain([g, 'optionalCall', _26 => _26()]),m.current&&(u.destroy(m.current),m.current=null,s.setMapHandle(null),_optionalChain([p, 'access', _27 => _27.current, 'optionalCall', _28 => _28(null)])),N(!1)}},[s,u]),_react.useEffect.call(void 0, ()=>{let P=m.current;if(!u||!P||e||O.current||_.current)return;let h=[];for(let f of Object.keys(a.points))if(a.layers[f]!==!1)for(let x of _nullishCoalesce(a.points[f], () => ([])))h.push(x.position);let g=At(h);g&&(O.current=!0,I.current=!0,u.fitBounds(P,g))},[u,e,c,a.points,a.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([u, 'optionalAccess', _29 => _29.updateMarkerStates, 'call', _30 => _30(a.selection,a.hovered)])},[u,c,a.selection,a.hovered]);let{Popup:L}=C(),T=L!==fe,U=_nullishCoalesce(a.points[s.primaryDatasetId], () => ([])),K=a.selection!=null?U.find(P=>P.id===a.selection):void 0,[E,H]=_react.useState.call(void 0, null),Y=_react.useRef.call(void 0, K);return Y.current=K,_react.useEffect.call(void 0, ()=>{let P=m.current;if(!u||!P||!T)return;let h=Y.current;if(!h)return;let g=u.mountOverlay(h.position);H({entity:h.entity,position:h.position,container:g.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),x=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",x);let j=u.onMapClick(f);return()=>{document.removeEventListener("keydown",x),j(),g.unmount(),H(null)}},[s,u,c,a.selection,T]),_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:!u&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!u&&n,T&&E?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, L,{entity:E.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),E.container):null]}),r!=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:r})})]})}var he="gap";function zt(t,e){if(t<=7)return Array.from({length:t},(o,s)=>s+1);let i=Math.max(2,e-1),n=Math.min(t-1,e+1),r=[1];i>2&&r.push(he);for(let o=i;o<=n;o+=1)r.push(o);return n<t-1&&r.push(he),r.push(t),r}function nt(){let t=v(),{results:e,pagination:i}=S();if(i.mode==="infinite")return e.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let n=t.options.pageSize,{pageIndex:r}=i,o=r+1,s=e.total!=null?Math.ceil(e.total/n):null,a=s!=null?o<s:e.nextCursor!=null||e.items.length>=n;if(s!=null?s<=1:r===0&&!a)return null;let p=d=>()=>{t.goToPage(d)};return _jsxruntime.jsxs.call(void 0, "nav",{className:"rle-pagination","aria-label":"Pagination",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||r===0,onClick:p(r-1),children:"\u2039"}),s!=null&&zt(s,o).map((d,l)=>d===he?_jsxruntime.jsx.call(void 0, "span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${l}`):_jsxruntime.jsx.call(void 0, "button",{type:"button",className:d===o?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${d}`,"aria-current":d===o?"page":void 0,disabled:i.loading,onClick:p(d-1),children:d},d)),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!a,onClick:p(r+1),children:"\u203A"})]})}function rt(){let{items:t,total:e}=q(),{ResultHeader:i}=C();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function st(t,e){let i=v(),n=_react.useRef.call(void 0, e);n.current=e,_react.useEffect.call(void 0, ()=>i.on(t,r=>n.current(r)),[i,t])}function at(t){let{children:e,...i}=t,[n]=_react.useState.call(void 0, ()=>i),[r,o]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let s=new re({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(s),o(s),()=>{n.urlSync&&n.urlSync.stop(),s.dispose(),o(a=>a===s?null:a)}},[n]),r?_jsxruntime.jsx.call(void 0, se.Provider,{value:r,children:e}):null}function lt({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, Gt,{}),"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 Gt(){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 $(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}function Qt(t){return t?"rle-card rle-card--selected":"rle-card"}function be({item:t,selected:e,onSelect:i}){let n=_nullishCoalesce(t, () => ({})),r=Qt(e),o=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[n.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:n.imageUrl,alt:_nullishCoalesce(n.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:[n.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:n.title}),n.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:n.subtitle}),n.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:n.badge})}),n.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:$(n.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:r,children:o}):_jsxruntime.jsx.call(void 0, "article",{className:r,children:o})}function Le(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 Te({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function Pe(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 Fe({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?$(e.price):""})}function Ce({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:$(i.price)})]})]})}function Se({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 we({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:n=>e(n.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function Ie({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function Ee({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var ut={BottomNav:lt,Card:be,Marker:Fe,Popup:Ce,Sidebar:Ie,FilterPanel:Te,Search:we,Empty:Le,Loading:Pe,ResultHeader:Se,Toolbar:Ee};function mt({open:t,onOpenChange:e,title:i,children:n,footer:r}){let o=_react.useRef.call(void 0, null),[s,a]=_react.useState.call(void 0, !1),[p,d]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){d(!1),a(!1);return}a(!0);let l=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(l)},[t]),_react.useEffect.call(void 0, ()=>{if(!s)return;let l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}},[s]),_react.useEffect.call(void 0, ()=>{if(!s)return;_optionalChain([o, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.focus, 'call', _33 => _33()]);function l(m){m.key==="Escape"&&e(!1)}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),!s||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:o,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, oi,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:n}),r&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:r})]})]}),document.body)}function oi(){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 gt({search:t,onFiltersClick:e,filterCount:i=0,action:n}){let{Search:r}=C();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, r,{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, li,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),n&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:n.onClick,"aria-label":n.label,children:_nullishCoalesce(n.icon, () => (_jsxruntime.jsx.call(void 0, di,{})))})]})}function li(){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 di(){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 pi=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function ui(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[n,r]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let o=t.current;if(!o)return;let s=()=>{let{clientWidth:m,scrollLeft:c,scrollWidth:N}=o;i(c<=0),r(c+m>=N-1)},a=0,p=()=>{a||(a=requestAnimationFrame(()=>{a=0,s()}))};s(),o.addEventListener("scroll",s,{passive:!0});let d,l;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(s),d.observe(o)),typeof MutationObserver<"u"&&(l=new MutationObserver(p),l.observe(o,{characterData:!0,childList:!0,subtree:!0})),()=>{o.removeEventListener("scroll",s),_optionalChain([d, 'optionalAccess', _34 => _34.disconnect, 'call', _35 => _35()]),_optionalChain([l, 'optionalAccess', _36 => _36.disconnect, 'call', _37 => _37()]),a&&cancelAnimationFrame(a)}},[]),{atEnd:n,atStart:e,ref:t}}function ci(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,n=e,r=new Set([...Object.keys(i),...Object.keys(n)]);for(let o of r)if(i[o]!==n[o])return!1;return!0}function ft({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:n,autoFetch:r=!0,hasMap:o,mapCenter:s,mapZoom:a,mapControls:p,onMapReady:d,mobileSheetFooter:l,className:m}){let c=v(),{BottomNav:N,Search:O}=C(),_=q(),{filters:I,set:u}=oe(),{pagination:L}=S(),T=_nullishCoalesce(o, () => (c.map!=null)),[U,K]=_react.useState.call(void 0, "list"),[E,H]=_react.useState.call(void 0, !1),{atEnd:Y,atStart:P,ref:h}=ui(),g=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{L.mode==="paged"&&g.current&&(g.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,x]=_react.useState.call(void 0, I),[j,R]=_react.useState.call(void 0, E);E!==j&&(R(E),E&&x(I));let Me=ge=>x(ht=>({...ht,...ge})),[De,Be]=_react.useState.call(void 0, !1),me=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(De){if(L.loading){me.current=!0;return}me.current&&(me.current=!1,Be(!1),H(!1))}},[De,L.loading]);let G=t?{value:String(_nullishCoalesce(I[t.filterKey], () => (""))),onChange:ge=>{u({[t.filterKey]:ge||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{r!==!1&&c.applyFilters({})},[c,r]);let Oe=()=>{Me(c.filters.clearedParams())},_e=()=>{if(ci(f,I)){H(!1);return}Be(!0),c.applyFilters(f)},vt=c.filters.activeKeys(I).length,He=_nullishCoalesce(_.total, () => (_.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:m?`rle-app ${m}`:"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:h,children:[G&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, O,{value:G.value,onChange:G.onChange,placeholder:G.placeholder})}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__slot",children:e}),_jsxruntime.jsx.call(void 0, ye,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!P&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!Y&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, gt,{search:G,onFiltersClick:()=>H(!0),filterCount:vt,action:n}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${T?"rle-split":"rle-body--list-only"}`,"data-mobile-view":U,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",ref:g,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, rt,{}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:i})]}),_jsxruntime.jsx.call(void 0, Xe,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, nt,{})]}),T&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, it,{center:s,zoom:a,fallback:pi,mapControls:p,onMapReady:d})})]}),T&&_jsxruntime.jsx.call(void 0, N,{view:U,onViewChange:K}),_jsxruntime.jsx.call(void 0, mt,{title:"Filters",open:E,onOpenChange:H,footer:l?l({draft:f,apply:_e,clear:Oe,resultCount:He,loading:L.loading}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:Oe,children:"Clear all"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:_e,children:L.loading?_jsxruntime.jsx.call(void 0, "span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${He} results`})]}),children:_jsxruntime.jsx.call(void 0, ye,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Me})})]})}function yt(t){return"provider"in t}function vi(t){let e=t!=null&&!yt(t),i=e?t.apiKey:void 0,n=e?t.mapId:void 0,r=e?t.mapOptions:void 0,o=e?t.styles:void 0,s=e?t.overlayMarkers:void 0,[a,p]=_react.useState.call(void 0, ()=>!t||yt(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _38 => _38.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let d=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:l})=>{d||p({ready:!0,provider:l({apiKey:i,mapId:n,mapOptions:r,styles:o,overlayMarkers:s})})}),()=>{d=!0}},[i,n]),a}function hi({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,st("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function Ar(t){let{datasets:e,filters:i,map:n,components:r,initialFilters:o,onFiltersChange:s,mobileAction:a,search:p,filterBarStart:d,toolbarEnd:l,mapControls:m,onMapReady:c,mobileSheetFooter:N,config:O,autoFetch:_,className:I}=t,{ready:u,provider:L}=vi(n);if(!u)return null;let T=[];for(let E of e)T.push(Ve(E));i&&T.push(qe(i)),L&&T.push(Ke(L)),o&&T.push($e(o)),O&&T.push(Ue(O));let U=ze(...T),K={...ut,...r};return _jsxruntime.jsxs.call(void 0, at,{...U,children:[s&&_jsxruntime.jsx.call(void 0, hi,{onFiltersChange:s}),_jsxruntime.jsx.call(void 0, je,{...K,children:_jsxruntime.jsx.call(void 0, ft,{className:I,search:p,filterBarStart:d,toolbarEnd:l,mobileAction:a,autoFetch:_,mapCenter:_optionalChain([n, 'optionalAccess', _39 => _39.center]),mapZoom:_optionalChain([n, 'optionalAccess', _40 => _40.zoom]),mapControls:m,onMapReady:c,mobileSheetFooter:N})})]})}exports.a = ee; exports.b = V; exports.c = te; exports.d = ie; exports.e = Ae; exports.f = ne; exports.g = re; exports.h = ze; exports.i = Ue; exports.j = Ke; exports.k = Ve; exports.l = qe; exports.m = Di; exports.n = $e; exports.o = Bi; exports.p = fe; exports.q = je; exports.r = C; exports.s = se; exports.t = v; exports.u = S; exports.v = oe; exports.w = ye; exports.x = q; exports.y = Xe; exports.z = it; exports.A = nt; exports.B = rt; exports.C = st; exports.D = at; exports.E = lt; exports.F = be; exports.G = Le; exports.H = Te; exports.I = Pe; exports.J = Fe; exports.K = Ce; exports.L = Se; exports.M = we; exports.N = Ie; exports.O = Ee; exports.P = ut; exports.Q = mt; exports.R = ft; exports.S = Ar;