react-listing-engine 0.7.10 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-23WHD4QO.cjs +2 -0
- package/dist/chunk-JGTCJNXN.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/{listing-app-B8lXqvd5.d.cts → listing-app-B7_vzALF.d.cts} +1 -1
- package/dist/{listing-app-4RjoW6x-.d.ts → listing-app-DogqrxBV.d.ts} +1 -1
- package/dist/{map-provider.interface-B_8-GtsW.d.cts → map-provider.interface-8hvdqqjd.d.cts} +13 -2
- package/dist/{map-provider.interface-B_8-GtsW.d.ts → map-provider.interface-8hvdqqjd.d.ts} +13 -2
- package/dist/maps/google/index.cjs +1 -1
- package/dist/maps/google/index.d.cts +1 -1
- package/dist/maps/google/index.d.ts +1 -1
- package/dist/maps/google/index.js +1 -1
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.d.cts +3 -3
- package/dist/styled/index.d.ts +3 -3
- package/dist/styled/index.js +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-N2VOJIO3.cjs +0 -2
- package/dist/chunk-WIBKE6RD.js +0 -2
|
@@ -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 J= (_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 U= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>_optionalChain([i, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(e)])).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}}, _class2);var Y= (_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 ee= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}}, _class4);var Be={pagination:"paged",pageSize:20,debounceMs:250};var te=class{constructor(e){this.options=Object.freeze({...Be,...e})}};var ie= (_class5 =class{__init5() {this.emitter=new ee}__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 U)),this.map=e.map,this.config=new te(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 J({filters:_nullishCoalesce(e.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}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 r=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(n=>n.id===i)]);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function He(...t){let e={config:{},filters:new U,datasets:new Y};for(let i of t)i(e);return e}var Ae=t=>e=>{e.config={...e.config,...t}},ze= exports.j =t=>e=>{e.map=t},Ue= exports.k =t=>e=>{e.datasets.add(t)},Ke= exports.l =t=>e=>{t(e.filters)},Ni= exports.m =t=>e=>{e.urlSync=t},Ve= exports.n =t=>e=>{e.initialFilters=t},Ri= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function vt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var bt=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:vt(t)}),Lt=()=>_jsxruntime.jsx.call(void 0, "div",{}),me= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),Tt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Pt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Ft=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),St=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),Ct=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),kt=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),wt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),E={Card:bt,Marker:Lt,Popup:me,Sidebar:Tt,FilterPanel:Pt,Search:Ft,Empty:St,Loading:Ct,ResultHeader:kt,Toolbar:wt},qe=_react.createContext.call(void 0, E);function $e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:d,Loading:p,ResultHeader:l,Toolbar:a,children:g}=t,b={Card:_nullishCoalesce(e, () => (E.Card)),Marker:_nullishCoalesce(i, () => (E.Marker)),Popup:_nullishCoalesce(r, () => (E.Popup)),Sidebar:_nullishCoalesce(n, () => (E.Sidebar)),FilterPanel:_nullishCoalesce(s, () => (E.FilterPanel)),Search:_nullishCoalesce(o, () => (E.Search)),Empty:_nullishCoalesce(d, () => (E.Empty)),Loading:_nullishCoalesce(p, () => (E.Loading)),ResultHeader:_nullishCoalesce(l, () => (E.ResultHeader)),Toolbar:_nullishCoalesce(a, () => (E.Toolbar))};return _jsxruntime.jsx.call(void 0, qe.Provider,{value:b,children:g})}function P(){return _react.useContext.call(void 0, qe)}var re=_react.createContext.call(void 0, null);function y(){let t=_react.useContext.call(void 0, re);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function F(){let t=y(),e=_react.useCallback.call(void 0, r=>t.subscribe(r),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function ne(){let t=y(),e=F(),i=_react.useCallback.call(void 0, n=>t.applyFilters(n),[t]),r=_react.useCallback.call(void 0, (n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}function ge({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=y(),{FilterPanel:o}=P(),{filters:d}=ne(),p=r!==void 0&&n!==void 0,l=p?r:d;return _jsxruntime.jsx.call(void 0, o,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(t, () => ("space-y-5")),children:s.filters.list().map(a=>{if(typeof a.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":a.key,className:e},a.key);let g=a.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[a.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),_jsxruntime.jsx.call(void 0, g,{value:a.fromParams(l),onChange:b=>p?n(a.toParams(b)):void s.applyFilters(a.toParams(b))})]},a.key)})})})}function K(){return F().results}function Mt(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 Ge({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:d}=P();return r.loading&&i.length===0?_jsxruntime.jsx.call(void 0, d,{}):i.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:t,children:i.map((p,l)=>{let a=Mt(p,l);return _jsxruntime.jsx.call(void 0, s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}var _reactdom = require('react-dom');var Ot={west:-179.9,south:-85,east:179.9,north:85},Ze=.1,Xe=.02;function _t(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:d,lng:p}of t)p<e&&(e=p),p>i&&(i=p),d<r&&(r=d),d>n&&(n=d);let s=n>r?(n-r)*Ze:Xe,o=i>e?(i-e)*Ze:Xe;return{west:e-o,east:i+o,south:r-s,north:n+s}}function Ye(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=y(),o=F(),d=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, null),[a,g]=_react.useState.call(void 0, !1),b=_react.useRef.call(void 0, !1),x=_react.useRef.call(void 0, !1),C=_react.useRef.call(void 0, !1),c=s.map;_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let f=s.datasets.get(u),I=_nullishCoalesce(o.points[u], () => ([])),$={id:u,markers:I.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(u,R)};h.push(c.renderLayer(T,$))}return()=>{h.forEach(u=>u())}},[s,c,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{if(!d.current||!c)return;let T=d.current,h=!1,u=null;return(async()=>{let f=await c.mount(T,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(p.current, () => (void 0))});if(h){c.destroy(f);return}l.current=f,s.setMapHandle(f),u=c.onBoundsChange(f,I=>{C.current?C.current=!1:x.current=!0,s.loadPoints(I)}),g(!0),s.loadPoints(Ot)})(),()=>{h=!0,_optionalChain([u, 'optionalCall', _24 => _24()]),l.current&&(c.destroy(l.current),l.current=null,s.setMapHandle(null)),g(!1)}},[s,c]),_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T||e||b.current||x.current)return;let h=[];for(let f of Object.keys(o.points))if(o.layers[f]!==!1)for(let I of _nullishCoalesce(o.points[f], () => ([])))h.push(I.position);let u=_t(h);u&&(b.current=!0,C.current=!0,c.fitBounds(T,u))},[c,e,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([c, 'optionalAccess', _25 => _25.updateMarkerStates, 'call', _26 => _26(o.selection,o.hovered)])},[c,a,o.selection,o.hovered]);let{Popup:L}=P(),N=L!==me,k=_nullishCoalesce(o.points[s.primaryDatasetId], () => ([])),z=o.selection!=null?k.find(T=>T.id===o.selection):void 0,[w,D]=_react.useState.call(void 0, null),X=_react.useRef.call(void 0, z);return X.current=z,_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T||!N)return;let h=X.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),I=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",I);let $=c.onMapClick(f);return()=>{document.removeEventListener("keydown",I),$(),u.unmount(),D(null)}},[s,c,a,o.selection,N]),_jsxruntime.jsxs.call(void 0, "div",{ref:p,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&w?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, L,{entity:w.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),w.container):null]}),n!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-none absolute inset-0",children:_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-auto",children:n})})]})}var ye="gap";function Bt(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),r=Math.min(t-1,e+1),n=[1];i>2&&n.push(ye);for(let s=i;s<=r;s+=1)n.push(s);return r<t-1&&n.push(ye),n.push(t),n}function et(){let t=y(),{results:e,pagination:i}=F();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 r=t.options.pageSize,{pageIndex:n}=i,s=n+1,o=e.total!=null?Math.ceil(e.total/r):null,d=o!=null?s<o:e.nextCursor!=null||e.items.length>=r;if(o!=null?o<=1:n===0&&!d)return null;let p=l=>()=>{t.goToPage(l)};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||n===0,onClick:p(n-1),children:"\u2039"}),o!=null&&Bt(o,s).map((l,a)=>l===ye?_jsxruntime.jsx.call(void 0, "span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${a}`):_jsxruntime.jsx.call(void 0, "button",{type:"button",className:l===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${l}`,"aria-current":l===s?"page":void 0,disabled:i.loading,onClick:p(l-1),children:l},l)),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!d,onClick:p(n+1),children:"\u203A"})]})}function tt(){let{items:t,total:e}=K(),{ResultHeader:i}=P();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function it(t,e){let i=y(),r=_react.useRef.call(void 0, e);r.current=e,_react.useEffect.call(void 0, ()=>i.on(t,n=>r.current(n)),[i,t])}function nt(t){let{children:e,...i}=t,[r]=_react.useState.call(void 0, ()=>i),[n,s]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new ie({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(d=>d===o?null:d)}},[r]),n?_jsxruntime.jsx.call(void 0, re.Provider,{value:n,children:e}):null}function V(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 he({item:t,selected:e,onSelect:i}){let r=_nullishCoalesce(t, () => ({})),n=qt(e),s=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:r.title}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:V(r.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:n,children:s}):_jsxruntime.jsx.call(void 0, "article",{className:n,children:s})}function ve(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 be({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function Le(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 Te({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}function Fe({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:V(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 Ce({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function ke({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function we({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var at={Card:he,Marker:Te,Popup:Fe,Sidebar:ke,FilterPanel:be,Search:Ce,Empty:ve,Loading:Le,ResultHeader:Se,Toolbar:we};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, Yt,{}),"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, ei,{}),"Map"]})]})})}function Yt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",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 ei(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",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 pt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=_react.useRef.call(void 0, null),[o,d]=_react.useState.call(void 0, !1),[p,l]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){l(!1),d(!1);return}d(!0);let a=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(a)},[t]),_react.useEffect.call(void 0, ()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),_react.useEffect.call(void 0, ()=>{if(!o)return;_optionalChain([s, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]);function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:i}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, ri,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:r}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ri(){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 ct({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=P();return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[_jsxruntime.jsx.call(void 0, si,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),r&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:_nullishCoalesce(r.icon, () => (_jsxruntime.jsx.call(void 0, oi,{})))})]})}function si(){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 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","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 ai=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function li(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[r,n]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:b,scrollWidth:x}=s;i(b<=0),n(b+g>=x-1)},d=0,p=()=>{d||(d=requestAnimationFrame(()=>{d=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let l,a;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),_optionalChain([l, 'optionalAccess', _30 => _30.disconnect, 'call', _31 => _31()]),_optionalChain([a, 'optionalAccess', _32 => _32.disconnect, 'call', _33 => _33()]),d&&cancelAnimationFrame(d)}},[]),{atEnd:r,atStart:e,ref:t}}function di(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function ut({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:r,autoFetch:n=!0,hasMap:s,mapCenter:o,mapZoom:d,mapControls:p,mobileSheetFooter:l,className:a}){let g=y(),{Search:b}=P(),x=K(),{filters:C,set:c}=ne(),{pagination:L}=F(),N=_nullishCoalesce(s, () => (g.map!=null)),[k,z]=_react.useState.call(void 0, "list"),[w,D]=_react.useState.call(void 0, !1),{atEnd:X,atStart:T,ref:h}=li(),u=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{L.mode==="paged"&&u.current&&(u.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,I]=_react.useState.call(void 0, C),[$,R]=_react.useState.call(void 0, w);w!==$&&(R(w),w&&I(C));let Ne=ue=>I(ft=>({...ft,...ue})),[Re,Me]=_react.useState.call(void 0, !1),ce=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(Re){if(L.loading){ce.current=!0;return}ce.current&&(ce.current=!1,Me(!1),D(!1))}},[Re,L.loading]);let W=t?{value:String(_nullishCoalesce(C[t.filterKey], () => (""))),onChange:ue=>{c({[t.filterKey]:ue||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{n!==!1&&g.applyFilters({})},[g,n]);let De=()=>{Ne(g.filters.clearedParams())},Oe=()=>{if(di(f,C)){D(!1);return}Me(!0),g.applyFilters(f)},gt=g.filters.activeKeys(C).length,_e=_nullishCoalesce(x.total, () => (x.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:a?`rle-app ${a}`:"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:[W&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, b,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__slot",children:e}),_jsxruntime.jsx.call(void 0, ge,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!X&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, ct,{search:W,onFiltersClick:()=>D(!0),filterCount:gt,action:r}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":k,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",ref:u,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, tt,{}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:i})]}),_jsxruntime.jsx.call(void 0, Ge,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, et,{})]}),N&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, Ye,{center:o,zoom:d,fallback:ai,mapControls:p})})]}),N&&_jsxruntime.jsx.call(void 0, lt,{view:k,onViewChange:z}),_jsxruntime.jsx.call(void 0, pt,{title:"Filters",open:w,onOpenChange:D,footer:l?l({draft:f,apply:Oe,clear:De,resultCount:_e,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:De,children:"Clear all"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:Oe,children:L.loading?_jsxruntime.jsx.call(void 0, "span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${_e} results`})]}),children:_jsxruntime.jsx.call(void 0, ge,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Ne})})]})}function mt(t){return"provider"in t}function gi(t){let e=t!=null&&!mt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,d]=_react.useState.call(void 0, ()=>!t||mt(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _34 => _34.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:l})=>{p||d({ready:!0,provider:l({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function fi({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,it("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function _n(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:d,search:p,filterBarStart:l,toolbarEnd:a,mapControls:g,mobileSheetFooter:b,config:x,autoFetch:C,className:c}=t,{ready:L,provider:N}=gi(r);if(!L)return null;let k=[];for(let D of e)k.push(Ue(D));i&&k.push(Ke(i)),N&&k.push(ze(N)),s&&k.push(Ve(s)),x&&k.push(Ae(x));let z=He(...k),w={...at,...n};return _jsxruntime.jsxs.call(void 0, nt,{...z,children:[o&&_jsxruntime.jsx.call(void 0, fi,{onFiltersChange:o}),_jsxruntime.jsx.call(void 0, $e,{...w,children:_jsxruntime.jsx.call(void 0, ut,{className:c,search:p,filterBarStart:l,toolbarEnd:a,mobileAction:d,autoFetch:C,mapCenter:_optionalChain([r, 'optionalAccess', _35 => _35.center]),mapZoom:_optionalChain([r, 'optionalAccess', _36 => _36.zoom]),mapControls:g,mobileSheetFooter:b})})]})}exports.a = J; exports.b = U; exports.c = Y; exports.d = ee; exports.e = Be; exports.f = te; exports.g = ie; exports.h = He; exports.i = Ae; exports.j = ze; exports.k = Ue; exports.l = Ke; exports.m = Ni; exports.n = Ve; exports.o = Ri; exports.p = me; exports.q = $e; exports.r = P; exports.s = re; exports.t = y; exports.u = F; exports.v = ne; exports.w = ge; exports.x = K; exports.y = Ge; exports.z = Ye; exports.A = et; exports.B = tt; exports.C = it; exports.D = nt; exports.E = he; exports.F = ve; exports.G = be; exports.H = Le; exports.I = Te; exports.J = Fe; exports.K = Se; exports.L = Ce; exports.M = ke; exports.N = we; exports.O = at; exports.P = lt; exports.Q = pt; exports.R = ut; exports.S = _n;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var J=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 U=class{defs=new Map;add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>i.isActive?.(e)).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}};var Y=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 ee=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}};var Be={pagination:"paged",pageSize:20,debounceMs:250};var te=class{options;constructor(e){this.options=Object.freeze({...Be,...e})}};var ie=class{filters;map;datasets;primaryDatasetId;store;emitter=new ee;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;mapHandle=null;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new U,this.map=e.map,this.config=new te(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 J({filters:e.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}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 r=this.state.points[e]?.find(n=>n.id===i);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function He(...t){let e={config:{},filters:new U,datasets:new Y};for(let i of t)i(e);return e}var Ae=t=>e=>{e.config={...e.config,...t}},ze=t=>e=>{e.map=t},Ue=t=>e=>{e.datasets.add(t)},Ke=t=>e=>{t(e.filters)},Ni=t=>e=>{e.urlSync=t},Ve=t=>e=>{e.initialFilters=t},Ri=t=>e=>{e.primaryDatasetId=t};import{createContext as yt,useContext as ht}from"react";import{jsx as M,jsxs as It}from"react/jsx-runtime";function vt(t){return String(t?.title??"")}var bt=({item:t})=>M("div",{children:vt(t)}),Lt=()=>M("div",{}),me=()=>M("div",{}),Tt=({children:t})=>M("div",{children:t}),Pt=({children:t})=>M("div",{children:t}),Ft=({value:t,onChange:e,placeholder:i})=>M("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search"}),St=()=>M("div",{role:"status",children:"No results"}),Ct=()=>M("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),kt=({count:t})=>It("div",{children:[t," results"]}),wt=({children:t})=>M("div",{children:t}),E={Card:bt,Marker:Lt,Popup:me,Sidebar:Tt,FilterPanel:Pt,Search:Ft,Empty:St,Loading:Ct,ResultHeader:kt,Toolbar:wt},qe=yt(E);function $e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:d,Loading:p,ResultHeader:l,Toolbar:a,children:g}=t,b={Card:e??E.Card,Marker:i??E.Marker,Popup:r??E.Popup,Sidebar:n??E.Sidebar,FilterPanel:s??E.FilterPanel,Search:o??E.Search,Empty:d??E.Empty,Loading:p??E.Loading,ResultHeader:l??E.ResultHeader,Toolbar:a??E.Toolbar};return M(qe.Provider,{value:b,children:g})}function P(){return ht(qe)}import{createContext as Et}from"react";var re=Et(null);import{useContext as xt}from"react";function y(){let t=xt(re);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as We,useSyncExternalStore as Nt}from"react";function F(){let t=y(),e=We(r=>t.subscribe(r),[t]),i=We(()=>t.state,[t]);return Nt(e,i,i)}import{useCallback as je}from"react";function ne(){let t=y(),e=F(),i=je(n=>t.applyFilters(n),[t]),r=je((n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}import{jsx as j,jsxs as Rt}from"react/jsx-runtime";function ge({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=y(),{FilterPanel:o}=P(),{filters:d}=ne(),p=r!==void 0&&n!==void 0,l=p?r:d;return j(o,{children:j("div",{className:t??"space-y-5",children:s.filters.list().map(a=>{if(typeof a.render=="string")return j("div",{"data-filter":a.key,className:e},a.key);let g=a.render;return Rt("div",{className:e,children:[a.label&&!i&&j("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),j(g,{value:a.fromParams(l),onChange:b=>p?n(a.toParams(b)):void s.applyFilters(a.toParams(b))})]},a.key)})})})}function K(){return F().results}import{jsx as se}from"react/jsx-runtime";function Mt(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 Ge({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:d}=P();return r.loading&&i.length===0?se(d,{}):i.length===0?se(o,{}):se("div",{role:"list",className:t,children:i.map((p,l)=>{let a=Mt(p,l);return se(s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}import{useEffect as G,useRef as B,useState as Qe}from"react";import{createPortal as Dt}from"react-dom";import{jsx as fe,jsxs as Je}from"react/jsx-runtime";var Ot={west:-179.9,south:-85,east:179.9,north:85},Ze=.1,Xe=.02;function _t(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:d,lng:p}of t)p<e&&(e=p),p>i&&(i=p),d<r&&(r=d),d>n&&(n=d);let s=n>r?(n-r)*Ze:Xe,o=i>e?(i-e)*Ze:Xe;return{west:e-o,east:i+o,south:r-s,north:n+s}}function Ye(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=y(),o=F(),d=B(null),p=B(null),l=B(null),[a,g]=Qe(!1),b=B(!1),x=B(!1),C=B(!1),c=s.map;G(()=>{let T=l.current;if(!c||!T)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let f=s.datasets.get(u),I=o.points[u]??[],$={id:u,markers:I.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(u,R)};h.push(c.renderLayer(T,$))}return()=>{h.forEach(u=>u())}},[s,c,a,o.points,o.layers]),G(()=>{if(!d.current||!c)return;let T=d.current,h=!1,u=null;return(async()=>{let f=await c.mount(T,{center:e,zoom:i,fullscreenTarget:p.current??void 0});if(h){c.destroy(f);return}l.current=f,s.setMapHandle(f),u=c.onBoundsChange(f,I=>{C.current?C.current=!1:x.current=!0,s.loadPoints(I)}),g(!0),s.loadPoints(Ot)})(),()=>{h=!0,u?.(),l.current&&(c.destroy(l.current),l.current=null,s.setMapHandle(null)),g(!1)}},[s,c]),G(()=>{let T=l.current;if(!c||!T||e||b.current||x.current)return;let h=[];for(let f of Object.keys(o.points))if(o.layers[f]!==!1)for(let I of o.points[f]??[])h.push(I.position);let u=_t(h);u&&(b.current=!0,C.current=!0,c.fitBounds(T,u))},[c,e,a,o.points,o.layers]),G(()=>{c?.updateMarkerStates(o.selection,o.hovered)},[c,a,o.selection,o.hovered]);let{Popup:L}=P(),N=L!==me,k=o.points[s.primaryDatasetId]??[],z=o.selection!=null?k.find(T=>T.id===o.selection):void 0,[w,D]=Qe(null),X=B(z);return X.current=z,G(()=>{let T=l.current;if(!c||!T||!N)return;let h=X.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),I=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",I);let $=c.onMapClick(f);return()=>{document.removeEventListener("keydown",I),$(),u.unmount(),D(null)}},[s,c,a,o.selection,N]),Je("div",{ref:p,className:"relative h-full min-h-0 w-full",children:[Je("div",{ref:d,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&w?Dt(fe(L,{entity:w.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),w.container):null]}),n!=null&&fe("div",{className:"pointer-events-none absolute inset-0",children:fe("div",{className:"pointer-events-auto",children:n})})]})}import{jsx as Q,jsxs as Ht}from"react/jsx-runtime";var ye="gap";function Bt(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),r=Math.min(t-1,e+1),n=[1];i>2&&n.push(ye);for(let s=i;s<=r;s+=1)n.push(s);return r<t-1&&n.push(ye),n.push(t),n}function et(){let t=y(),{results:e,pagination:i}=F();if(i.mode==="infinite")return e.nextCursor==null?null:Q("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let r=t.options.pageSize,{pageIndex:n}=i,s=n+1,o=e.total!=null?Math.ceil(e.total/r):null,d=o!=null?s<o:e.nextCursor!=null||e.items.length>=r;if(o!=null?o<=1:n===0&&!d)return null;let p=l=>()=>{t.goToPage(l)};return Ht("nav",{className:"rle-pagination","aria-label":"Pagination",children:[Q("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||n===0,onClick:p(n-1),children:"\u2039"}),o!=null&&Bt(o,s).map((l,a)=>l===ye?Q("span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${a}`):Q("button",{type:"button",className:l===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${l}`,"aria-current":l===s?"page":void 0,disabled:i.loading,onClick:p(l-1),children:l},l)),Q("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!d,onClick:p(n+1),children:"\u203A"})]})}import{jsx as At}from"react/jsx-runtime";function tt(){let{items:t,total:e}=K(),{ResultHeader:i}=P();return At(i,{count:t.length,total:e})}import{useEffect as zt,useRef as Ut}from"react";function it(t,e){let i=y(),r=Ut(e);r.current=e,zt(()=>i.on(t,n=>r.current(n)),[i,t])}import{useEffect as Kt,useState as rt}from"react";import{jsx as Vt}from"react/jsx-runtime";function nt(t){let{children:e,...i}=t,[r]=rt(()=>i),[n,s]=rt(null);return Kt(()=>{let o=new ie({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(d=>d===o?null:d)}},[r]),n?Vt(re.Provider,{value:n,children:e}):null}function V(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as $t,jsx as O,jsxs as st}from"react/jsx-runtime";function qt(t){return t?"rle-card rle-card--selected":"rle-card"}function he({item:t,selected:e,onSelect:i}){let r=t??{},n=qt(e),s=st($t,{children:[r.imageUrl?O("img",{src:r.imageUrl,alt:r.title??"",className:"rle-card-media"}):O("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),st("div",{className:"rle-card-body",children:[r.title&&O("span",{className:"rle-card-title",children:r.title}),r.subtitle&&O("span",{className:"rle-card-address",children:r.subtitle}),r.badge&&O("div",{className:"rle-card-info",children:O("span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&O("span",{className:"rle-card-price",children:V(r.price)})]})]});return i?O("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:n,children:s}):O("article",{className:n,children:s})}import{jsx as oe,jsxs as ot}from"react/jsx-runtime";function ve(t){return ot("div",{role:"status",className:"rle-empty",children:[ot("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:[oe("circle",{cx:"11",cy:"11",r:"7"}),oe("path",{d:"m21 21-4.3-4.3"})]}),oe("p",{className:"rle-empty-title",children:"No results"}),oe("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Wt}from"react/jsx-runtime";function be({children:t}){return Wt("div",{className:"rle-filter-panel",children:t})}import{jsx as ae,jsxs as jt}from"react/jsx-runtime";function Le(t){return ae("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:[ae("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),ae("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),ae("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as Gt}from"react/jsx-runtime";function Te({point:t}){let e=t.entity??{};return Gt("span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}import{jsx as q,jsxs as Pe}from"react/jsx-runtime";function Fe({entity:t,onClose:e}){let i=t??{};return Pe("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[q("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children: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:[q("path",{d:"M18 6 6 18"}),q("path",{d:"m6 6 12 12"})]})}),Pe("div",{children:[i.title&&q("div",{className:"rle-card-title",children:i.title}),i.subtitle&&q("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&q("div",{className:"rle-card-price",children:V(i.price)})]})]})}import{jsx as Qt}from"react/jsx-runtime";function Se({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return Qt("div",{className:"rle-result-header",children:i})}import{jsx as Zt}from"react/jsx-runtime";function Ce({value:t,onChange:e,placeholder:i}){return Zt("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as Xt}from"react/jsx-runtime";function ke({children:t}){return Xt("aside",{className:"rle-sidebar",children:t})}import{jsx as Jt}from"react/jsx-runtime";function we({children:t}){return Jt("div",{className:"rle-toolbar",children:t})}var at={Card:he,Marker:Te,Popup:Fe,Sidebar:ke,FilterPanel:be,Search:Ce,Empty:ve,Loading:Le,ResultHeader:Se,Toolbar:we};import{jsx as S,jsxs as Z}from"react/jsx-runtime";function lt({view:t,onViewChange:e}){return S("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:Z("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[Z("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[S(Yt,{}),"List"]}),Z("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[S(ei,{}),"Map"]})]})})}function Yt(){return Z("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:[S("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),S("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),S("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),S("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),S("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),S("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function ei(){return Z("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:[S("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),S("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),S("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}import{useEffect as Ie,useRef as ti,useState as dt}from"react";import{createPortal as ii}from"react-dom";import{Fragment as ni,jsx as _,jsxs as le}from"react/jsx-runtime";function pt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=ti(null),[o,d]=dt(!1),[p,l]=dt(!1);return Ie(()=>{if(!t){l(!1),d(!1);return}d(!0);let a=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(a)},[t]),Ie(()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),Ie(()=>{if(!o)return;s.current?.focus();function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:ii(le(ni,{children:[_("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),le("div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_("div",{className:"rle-sheet__handle","aria-hidden":"true"}),le("div",{className:"rle-sheet__header",children:[i&&_("div",{className:"rle-sheet__title",children:i}),_("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_(ri,{})})]}),_("div",{className:"rle-sheet__body",children:r}),n&&_("div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ri(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_("path",{d:"M18 6 6 18"}),_("path",{d:"m6 6 12 12"})]})}import{useEffect as pe,useRef as Ee,useState as A}from"react";import{jsx as v,jsxs as de}from"react/jsx-runtime";function ct({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=P();return de("header",{className:"rle-mobile-header",children:[t&&v("div",{className:"rle-mobile-header__search",children:v(n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),de("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[v(si,{}),v("span",{children:"Filters"}),i>0&&v("span",{className:"rle-mobile-header__count",children:i})]}),r&&v("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:r.icon??v(oi,{})})]})}function si(){return de("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:[v("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),v("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),v("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),v("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function oi(){return de("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:[v("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{Fragment as pi,jsx as m,jsxs as H}from"react/jsx-runtime";var ai=m("div",{className:"rle-empty",children:"Map unavailable"});function li(){let t=Ee(null),[e,i]=A(!0),[r,n]=A(!0);return pe(()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:b,scrollWidth:x}=s;i(b<=0),n(b+g>=x-1)},d=0,p=()=>{d||(d=requestAnimationFrame(()=>{d=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let l,a;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),l?.disconnect(),a?.disconnect(),d&&cancelAnimationFrame(d)}},[]),{atEnd:r,atStart:e,ref:t}}function di(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function ut({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:r,autoFetch:n=!0,hasMap:s,mapCenter:o,mapZoom:d,mapControls:p,mobileSheetFooter:l,className:a}){let g=y(),{Search:b}=P(),x=K(),{filters:C,set:c}=ne(),{pagination:L}=F(),N=s??g.map!=null,[k,z]=A("list"),[w,D]=A(!1),{atEnd:X,atStart:T,ref:h}=li(),u=Ee(null);pe(()=>{L.mode==="paged"&&u.current&&(u.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,I]=A(C),[$,R]=A(w);w!==$&&(R(w),w&&I(C));let Ne=ue=>I(ft=>({...ft,...ue})),[Re,Me]=A(!1),ce=Ee(!1);pe(()=>{if(Re){if(L.loading){ce.current=!0;return}ce.current&&(ce.current=!1,Me(!1),D(!1))}},[Re,L.loading]);let W=t?{value:String(C[t.filterKey]??""),onChange:ue=>{c({[t.filterKey]:ue||void 0})},placeholder:t.placeholder}:void 0;pe(()=>{n!==!1&&g.applyFilters({})},[g,n]);let De=()=>{Ne(g.filters.clearedParams())},Oe=()=>{if(di(f,C)){D(!1);return}Me(!0),g.applyFilters(f)},gt=g.filters.activeKeys(C).length,_e=x.total??x.items.length;return H("div",{className:a?`rle-app ${a}`:"rle-app",children:[H("div",{className:"rle-filter-bar",children:[H("div",{className:"rle-filter-bar__scroll",ref:h,children:[W&&m("div",{className:"rle-filter-bar__search",children:m(b,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),e&&m("div",{className:"rle-filter-bar__slot",children:e}),m(ge,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!X&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),m(ct,{search:W,onFiltersClick:()=>D(!0),filterCount:gt,action:r}),H("div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":k,children:[H("div",{className:"rle-list",ref:u,children:[H("div",{className:"rle-list-header",children:[m(tt,{}),i&&m("div",{className:"rle-list-header__toolbar",children:i})]}),m(Ge,{className:"rle-list-grid"}),m(et,{})]}),N&&m("div",{className:"rle-map",children:m(Ye,{center:o,zoom:d,fallback:ai,mapControls:p})})]}),N&&m(lt,{view:k,onViewChange:z}),m(pt,{title:"Filters",open:w,onOpenChange:D,footer:l?l({draft:f,apply:Oe,clear:De,resultCount:_e,loading:L.loading}):H(pi,{children:[m("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:De,children:"Clear all"}),m("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:Oe,children:L.loading?m("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${_e} results`})]}),children:m(ge,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Ne})})]})}import{useEffect as ci,useRef as ui,useState as mi}from"react";import{jsx as xe,jsxs as yi}from"react/jsx-runtime";function mt(t){return"provider"in t}function gi(t){let e=t!=null&&!mt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,d]=mi(()=>!t||mt(t)?{ready:!0,provider:t?.provider}:{ready:!1});return ci(()=>{if(!i)return;let p=!1;return import("./maps/google/index.js").then(({googleProvider:l})=>{p||d({ready:!0,provider:l({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function fi({onFiltersChange:t}){let e=ui(t);return e.current=t,it("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function _n(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:d,search:p,filterBarStart:l,toolbarEnd:a,mapControls:g,mobileSheetFooter:b,config:x,autoFetch:C,className:c}=t,{ready:L,provider:N}=gi(r);if(!L)return null;let k=[];for(let D of e)k.push(Ue(D));i&&k.push(Ke(i)),N&&k.push(ze(N)),s&&k.push(Ve(s)),x&&k.push(Ae(x));let z=He(...k),w={...at,...n};return yi(nt,{...z,children:[o&&xe(fi,{onFiltersChange:o}),xe($e,{...w,children:xe(ut,{className:c,search:p,filterBarStart:l,toolbarEnd:a,mobileAction:d,autoFetch:C,mapCenter:r?.center,mapZoom:r?.zoom,mapControls:g,mobileSheetFooter:b})})]})}export{J as a,U as b,Y as c,ee as d,Be as e,te as f,ie as g,He as h,Ae as i,ze as j,Ue as k,Ke as l,Ni as m,Ve as n,Ri as o,me as p,$e as q,P as r,re as s,y as t,F as u,ne as v,ge as w,K as x,Ge as y,Ye as z,et as A,tt as B,it as C,nt as D,he as E,ve as F,be as G,Le as H,Te as I,Fe as J,Se as K,Ce as L,ke as M,we as N,at as O,lt as P,pt as Q,ut as R,_n 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
|
|
2
|
+
var _chunk23WHD4QOcjs = require('./chunk-23WHD4QO.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}=_chunk23WHD4QOcjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunk23WHD4QOcjs.t.call(void 0, ),t=_chunk23WHD4QOcjs.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=_chunk23WHD4QOcjs.t.call(void 0, ),r=_chunk23WHD4QOcjs.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 = _chunk23WHD4QOcjs.c; exports.FallbackPopup = _chunk23WHD4QOcjs.p; exports.FilterRegistry = _chunk23WHD4QOcjs.b; exports.ListingApp = _chunk23WHD4QOcjs.S; exports.ListingComponentsProvider = _chunk23WHD4QOcjs.q; exports.ListingConfig = _chunk23WHD4QOcjs.f; exports.ListingEngine = _chunk23WHD4QOcjs.g; exports.ListingEngineContext = _chunk23WHD4QOcjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunk23WHD4QOcjs.w; exports.ListingList = _chunk23WHD4QOcjs.y; exports.ListingMap = _chunk23WHD4QOcjs.z; exports.ListingPagination = _chunk23WHD4QOcjs.A; exports.ListingProvider = _chunk23WHD4QOcjs.D; exports.ListingResultHeader = _chunk23WHD4QOcjs.B; exports.ListingStore = _chunk23WHD4QOcjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunk23WHD4QOcjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunk23WHD4QOcjs.h; exports.listingDefaultConfig = _chunk23WHD4QOcjs.e; exports.useListing = _chunk23WHD4QOcjs.t; exports.useListingComponents = _chunk23WHD4QOcjs.r; exports.useListingEvent = _chunk23WHD4QOcjs.C; exports.useListingFilters = _chunk23WHD4QOcjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunk23WHD4QOcjs.x; exports.useListingState = _chunk23WHD4QOcjs.u; exports.withConfig = _chunk23WHD4QOcjs.i; exports.withDataset = _chunk23WHD4QOcjs.k; exports.withFilters = _chunk23WHD4QOcjs.l; exports.withInitialFilters = _chunk23WHD4QOcjs.n; exports.withMap = _chunk23WHD4QOcjs.j; exports.withPrimaryDataset = _chunk23WHD4QOcjs.o; exports.withUrlSync = _chunk23WHD4QOcjs.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, Q as QueryParams, L as LatLng } from './map-provider.interface-
|
|
2
|
-
export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-
|
|
3
|
-
import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-
|
|
4
|
-
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-
|
|
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-B7_vzALF.cjs';
|
|
4
|
+
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-B7_vzALF.cjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
@@ -232,7 +232,7 @@ declare class ListingEngine<TEntity, TFilters> {
|
|
|
232
232
|
* requested box to the container's aspect ratio, so echoing the requested
|
|
233
233
|
* `bounds` here would briefly publish a viewport the map never shows).
|
|
234
234
|
*/
|
|
235
|
-
fitBounds(bounds: Bounds): void;
|
|
235
|
+
fitBounds(bounds: Bounds, options?: FitBoundsOptions): void;
|
|
236
236
|
selectPoint(datasetId: string, id: EntityId | null): void;
|
|
237
237
|
setHovered(_datasetId: string, id: EntityId | null): void;
|
|
238
238
|
toggleLayer(id: string): void;
|
|
@@ -836,7 +836,7 @@ declare function useListingMap(): {
|
|
|
836
836
|
zoomIn: () => void | undefined;
|
|
837
837
|
zoomOut: () => void | undefined;
|
|
838
838
|
toggleFullscreen: () => void | undefined;
|
|
839
|
-
fitBounds: (bounds: Bounds) => void;
|
|
839
|
+
fitBounds: (bounds: Bounds, options?: FitBoundsOptions) => void;
|
|
840
840
|
};
|
|
841
841
|
|
|
842
842
|
/**
|
|
@@ -888,4 +888,4 @@ interface IListingProviderComponentProps<TFilters> extends IListingProviderProps
|
|
|
888
888
|
*/
|
|
889
889
|
declare function ListingProvider<TEntity, TFilters>(props: IListingProviderComponentProps<TFilters>): react.JSX.Element | null;
|
|
890
890
|
|
|
891
|
-
export { Bounds, BrowserHistoryPort, type BrowserHistoryPortOptions, DatasetDefinition, DatasetRegistry, EntityId, FilterRegistry, type HistoryPort, IListingConfigOptions, type IListingFiltersProps, type IListingMapProps, type IListingProviderProps, IListingToolbarProps, LatLng, ListingConfig, ListingEngine, ListingEngineContext, type ListingEngineOptions, type ListingEvent, ListingEventType, ListingFilters, ListingList, ListingMap, ListingPagination, ListingProvider, type ListingProviderMod, ListingResultHeader, type ListingState, ListingStore, type ListingStoreInit, ListingToolbar, MapHandle, MapPoint, MapProvider, MemoryHistoryPort, Page, PaginationMode, QueryParams, TypedEmitter, Unsubscribe, UrlSyncController, type UrlSyncEngine, type UrlSyncOptions, composeListingProviders, listingDefaultConfig, useListing, useListingEvent, useListingFilters, useListingLayer, useListingMap, useListingResults, useListingState, withConfig, withDataset, withFilters, withInitialFilters, withMap, withPrimaryDataset, withUrlSync };
|
|
891
|
+
export { Bounds, BrowserHistoryPort, type BrowserHistoryPortOptions, DatasetDefinition, DatasetRegistry, EntityId, FilterRegistry, FitBoundsOptions, type HistoryPort, IListingConfigOptions, type IListingFiltersProps, type IListingMapProps, type IListingProviderProps, IListingToolbarProps, LatLng, ListingConfig, ListingEngine, ListingEngineContext, type ListingEngineOptions, type ListingEvent, ListingEventType, ListingFilters, ListingList, ListingMap, ListingPagination, ListingProvider, type ListingProviderMod, ListingResultHeader, type ListingState, ListingStore, type ListingStoreInit, ListingToolbar, MapHandle, MapPoint, MapProvider, MemoryHistoryPort, Page, PaginationMode, QueryParams, TypedEmitter, Unsubscribe, UrlSyncController, type UrlSyncEngine, type UrlSyncOptions, composeListingProviders, listingDefaultConfig, useListing, useListingEvent, useListingFilters, useListingLayer, useListingMap, useListingResults, useListingState, withConfig, withDataset, withFilters, withInitialFilters, withMap, withPrimaryDataset, withUrlSync };
|
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, Q as QueryParams, L as LatLng } from './map-provider.interface-
|
|
2
|
-
export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-
|
|
3
|
-
import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-
|
|
4
|
-
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-
|
|
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-DogqrxBV.js';
|
|
4
|
+
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-DogqrxBV.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
@@ -232,7 +232,7 @@ declare class ListingEngine<TEntity, TFilters> {
|
|
|
232
232
|
* requested box to the container's aspect ratio, so echoing the requested
|
|
233
233
|
* `bounds` here would briefly publish a viewport the map never shows).
|
|
234
234
|
*/
|
|
235
|
-
fitBounds(bounds: Bounds): void;
|
|
235
|
+
fitBounds(bounds: Bounds, options?: FitBoundsOptions): void;
|
|
236
236
|
selectPoint(datasetId: string, id: EntityId | null): void;
|
|
237
237
|
setHovered(_datasetId: string, id: EntityId | null): void;
|
|
238
238
|
toggleLayer(id: string): void;
|
|
@@ -836,7 +836,7 @@ declare function useListingMap(): {
|
|
|
836
836
|
zoomIn: () => void | undefined;
|
|
837
837
|
zoomOut: () => void | undefined;
|
|
838
838
|
toggleFullscreen: () => void | undefined;
|
|
839
|
-
fitBounds: (bounds: Bounds) => void;
|
|
839
|
+
fitBounds: (bounds: Bounds, options?: FitBoundsOptions) => void;
|
|
840
840
|
};
|
|
841
841
|
|
|
842
842
|
/**
|
|
@@ -888,4 +888,4 @@ interface IListingProviderComponentProps<TFilters> extends IListingProviderProps
|
|
|
888
888
|
*/
|
|
889
889
|
declare function ListingProvider<TEntity, TFilters>(props: IListingProviderComponentProps<TFilters>): react.JSX.Element | null;
|
|
890
890
|
|
|
891
|
-
export { Bounds, BrowserHistoryPort, type BrowserHistoryPortOptions, DatasetDefinition, DatasetRegistry, EntityId, FilterRegistry, type HistoryPort, IListingConfigOptions, type IListingFiltersProps, type IListingMapProps, type IListingProviderProps, IListingToolbarProps, LatLng, ListingConfig, ListingEngine, ListingEngineContext, type ListingEngineOptions, type ListingEvent, ListingEventType, ListingFilters, ListingList, ListingMap, ListingPagination, ListingProvider, type ListingProviderMod, ListingResultHeader, type ListingState, ListingStore, type ListingStoreInit, ListingToolbar, MapHandle, MapPoint, MapProvider, MemoryHistoryPort, Page, PaginationMode, QueryParams, TypedEmitter, Unsubscribe, UrlSyncController, type UrlSyncEngine, type UrlSyncOptions, composeListingProviders, listingDefaultConfig, useListing, useListingEvent, useListingFilters, useListingLayer, useListingMap, useListingResults, useListingState, withConfig, withDataset, withFilters, withInitialFilters, withMap, withPrimaryDataset, withUrlSync };
|
|
891
|
+
export { Bounds, BrowserHistoryPort, type BrowserHistoryPortOptions, DatasetDefinition, DatasetRegistry, EntityId, FilterRegistry, FitBoundsOptions, type HistoryPort, IListingConfigOptions, type IListingFiltersProps, type IListingMapProps, type IListingProviderProps, IListingToolbarProps, LatLng, ListingConfig, ListingEngine, ListingEngineContext, type ListingEngineOptions, type ListingEvent, ListingEventType, ListingFilters, ListingList, ListingMap, ListingPagination, ListingProvider, type ListingProviderMod, ListingResultHeader, type ListingState, ListingStore, type ListingStoreInit, ListingToolbar, MapHandle, MapPoint, MapProvider, MemoryHistoryPort, Page, PaginationMode, QueryParams, TypedEmitter, Unsubscribe, UrlSyncController, type UrlSyncEngine, type UrlSyncOptions, composeListingProviders, listingDefaultConfig, useListing, useListingEvent, useListingFilters, useListingLayer, useListingMap, useListingResults, useListingState, withConfig, withDataset, withFilters, withInitialFilters, withMap, withPrimaryDataset, withUrlSync };
|
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
|
|
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-JGTCJNXN.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-
|
|
3
|
+
import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-8hvdqqjd.cjs';
|
|
4
4
|
|
|
5
5
|
interface FilterControlProps<TValue> {
|
|
6
6
|
value: TValue;
|
|
@@ -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-
|
|
3
|
+
import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-8hvdqqjd.js';
|
|
4
4
|
|
|
5
5
|
interface FilterControlProps<TValue> {
|
|
6
6
|
value: TValue;
|
package/dist/{map-provider.interface-B_8-GtsW.d.cts → map-provider.interface-8hvdqqjd.d.cts}
RENAMED
|
@@ -75,6 +75,17 @@ interface RenderedLayer {
|
|
|
75
75
|
onMarkerClick?(id: string | number): void;
|
|
76
76
|
}
|
|
77
77
|
type Unsubscribe = () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Options for `MapProvider.fitBounds`. `animate: true` requests a "fly-to":
|
|
80
|
+
* instead of snapping to the target, the provider stages the camera move so
|
|
81
|
+
* the map SDK animates each leg (the Google provider zooms out to an
|
|
82
|
+
* overview of the current view + target, then zooms into the target once the
|
|
83
|
+
* camera settles). Providers MAY treat it as a hint -- omitted/false keeps
|
|
84
|
+
* the direct, instant fit.
|
|
85
|
+
*/
|
|
86
|
+
interface FitBoundsOptions {
|
|
87
|
+
animate?: boolean;
|
|
88
|
+
}
|
|
78
89
|
/**
|
|
79
90
|
* Handle to an imperatively-mounted, lat/lng-anchored DOM overlay (see
|
|
80
91
|
* `MapProvider.mountOverlay`). `container` is a stable element the provider
|
|
@@ -101,7 +112,7 @@ interface MapProvider {
|
|
|
101
112
|
* `mountOverlay`, a provider instance operates on its own currently-mounted map.
|
|
102
113
|
*/
|
|
103
114
|
onMapClick(cb: () => void): Unsubscribe;
|
|
104
|
-
fitBounds(handle: MapHandle, b: Bounds): void;
|
|
115
|
+
fitBounds(handle: MapHandle, b: Bounds, options?: FitBoundsOptions): void;
|
|
105
116
|
destroy(handle: MapHandle): void;
|
|
106
117
|
/**
|
|
107
118
|
* Repaints the SELECTED/HOVERED marker's existing DOM without recreating any marker -- toggles
|
|
@@ -147,4 +158,4 @@ interface MapProvider {
|
|
|
147
158
|
toggleFullscreen(): void;
|
|
148
159
|
}
|
|
149
160
|
|
|
150
|
-
export type { Bounds as B, EntityId as E, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, RenderedLayer as R, Unsubscribe as U, MapProvider as a, MapHandle as b, EntityAdapter as c, MapInitOptions as d, MapOverlayHandle as e, PageRequest as f };
|
|
161
|
+
export type { Bounds as B, EntityId as E, FitBoundsOptions as F, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, RenderedLayer as R, Unsubscribe as U, MapProvider as a, MapHandle as b, EntityAdapter as c, MapInitOptions as d, MapOverlayHandle as e, PageRequest as f };
|
|
@@ -75,6 +75,17 @@ interface RenderedLayer {
|
|
|
75
75
|
onMarkerClick?(id: string | number): void;
|
|
76
76
|
}
|
|
77
77
|
type Unsubscribe = () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Options for `MapProvider.fitBounds`. `animate: true` requests a "fly-to":
|
|
80
|
+
* instead of snapping to the target, the provider stages the camera move so
|
|
81
|
+
* the map SDK animates each leg (the Google provider zooms out to an
|
|
82
|
+
* overview of the current view + target, then zooms into the target once the
|
|
83
|
+
* camera settles). Providers MAY treat it as a hint -- omitted/false keeps
|
|
84
|
+
* the direct, instant fit.
|
|
85
|
+
*/
|
|
86
|
+
interface FitBoundsOptions {
|
|
87
|
+
animate?: boolean;
|
|
88
|
+
}
|
|
78
89
|
/**
|
|
79
90
|
* Handle to an imperatively-mounted, lat/lng-anchored DOM overlay (see
|
|
80
91
|
* `MapProvider.mountOverlay`). `container` is a stable element the provider
|
|
@@ -101,7 +112,7 @@ interface MapProvider {
|
|
|
101
112
|
* `mountOverlay`, a provider instance operates on its own currently-mounted map.
|
|
102
113
|
*/
|
|
103
114
|
onMapClick(cb: () => void): Unsubscribe;
|
|
104
|
-
fitBounds(handle: MapHandle, b: Bounds): void;
|
|
115
|
+
fitBounds(handle: MapHandle, b: Bounds, options?: FitBoundsOptions): void;
|
|
105
116
|
destroy(handle: MapHandle): void;
|
|
106
117
|
/**
|
|
107
118
|
* Repaints the SELECTED/HOVERED marker's existing DOM without recreating any marker -- toggles
|
|
@@ -147,4 +158,4 @@ interface MapProvider {
|
|
|
147
158
|
toggleFullscreen(): void;
|
|
148
159
|
}
|
|
149
160
|
|
|
150
|
-
export type { Bounds as B, EntityId as E, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, RenderedLayer as R, Unsubscribe as U, MapProvider as a, MapHandle as b, EntityAdapter as c, MapInitOptions as d, MapOverlayHandle as e, PageRequest as f };
|
|
161
|
+
export type { Bounds as B, EntityId as E, FitBoundsOptions as F, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, RenderedLayer as R, Unsubscribe as U, MapProvider as a, MapHandle as b, EntityAdapter as c, MapInitOptions as d, MapOverlayHandle as e, PageRequest as f };
|
|
@@ -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 H="DEMO_MAP_ID";function f(r){return r.raw}function x(r,o){if(r.element)return r.element;if(r.iconUrl)return new o.PinElement({glyphSrc:r.iconUrl}).element}var E=12,I="#b3261e";function R(r){if(r.element)return r.element;if(r.iconUrl){let a=document.createElement("img");return a.src=r.iconUrl,a}let o=document.createElement("div");return o.style.width=`${E}px`,o.style.height=`${E}px`,o.style.borderRadius="50%",o.style.backgroundColor=I,o.style.border="2px solid #ffffff",o.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",o}var g;function A(){if(g)return g;class r extends google.maps.OverlayView{constructor(e,s,i,t){super();r.prototype.__init.call(this);;this.position=e;this.content=s;this.onClick=i;this.lifecycle=t}__init() {this.div=null}onAdd(){let e=document.createElement("div");e.style.position="absolute",e.style.transform="translate(-50%, -50%)",this.onClick&&(e.style.cursor="pointer",e.addEventListener("click",this.onClick)),e.appendChild(this.content),this.div=e,_optionalChain([this, 'access', _2 => _2.getPanes, 'call', _3 => _3(), 'optionalAccess', _4 => _4.overlayMouseTarget, 'access', _5 => _5.appendChild, 'call', _6 => _6(e)]),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(e),this.lifecycle.onContainerAdd(e)}draw(){if(!this.div)return;let e=this.getProjection();if(!e)return;let s=e.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));s&&(this.div.style.left=`${s.x}px`,this.div.style.top=`${s.y}px`)}onRemove(){let e=this.div;_optionalChain([this, 'access', _7 => _7.div, 'optionalAccess', _8 => _8.remove, 'call', _9 => _9()]),this.div=null,e&&this.lifecycle.onContainerRemove(e)}}return g=r,g}var v=14,T=8;function S(r){let{anchorX:o,anchorY:a,popupW:e,popupH:s,mapW:i,mapH:t,offsetY:n,pad:l}=r,d=o-e/2,c=o+e/2,p=0;e>i-l*2?p=l-d:c>i-l?p=i-l-c:d<l&&(p=l-d);let u=a-n-s,y=a+n+s,m=u<l&&y<=t-l;return{dx:p,flipBelow:m}}var M;function G(){if(M)return M;class r extends google.maps.OverlayView{constructor(e,s,i){super();r.prototype.__init2.call(this);r.prototype.__init3.call(this);;this.container=e;this.position=s;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 e=this.getProjection();if(!e)return;let s=new google.maps.LatLng(this.position.lat,this.position.lng),i=e.fromLatLngToDivPixel(s);if(!i)return;if(this.clampOffset===null){let l=this.container.offsetWidth,d=this.container.offsetHeight,c=l&&d?e.fromLatLngToContainerPixel(s):null;if(!c){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${i.x}px`,this.container.style.top=`${i.y-v}px`;return}this.clampOffset=S({anchorX:c.x,anchorY:c.y,popupW:l,popupH:d,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:T})}let{dx:t,flipBelow:n}=this.clampOffset;this.container.style.left=`${i.x+t}px`,n?(this.container.style.top=`${i.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-v}px`,this.container.style.transform="translate(-50%, -100%)")}onRemove(){this.attached=!1,this.container.remove()}updatePosition(e){(e.lat!==this.position.lat||e.lng!==this.position.lng)&&(this.clampOffset=null),this.position=e,this.attached&&this.draw()}}return M=r,M}function k(r){for(let o of r)typeof o.setMap=="function"?o.setMap(null):o.map=null}var _="#b3261e",F=40,B=64,U=14;function z(r,o){let a=o.count,e=Math.min(B,F+Math.round(Math.log10(a+1)*U)),s=document.createElement("div");return s.textContent=String(a),s.style.display="flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.width=`${e}px`,s.style.height=`${e}px`,s.style.borderRadius="50%",s.style.backgroundColor=_,s.style.border="2px solid #ffffff",s.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",s.style.color="#ffffff",s.style.fontFamily="inherit",s.style.fontWeight="700",s.style.fontSize=e>=52?"15px":"13px",new r.AdvancedMarkerElement({position:o.position,content:s})}var b=!1;async function V(r,o,a,e){let s;try{s=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(t){b||(b=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',t));return}if(r.layers.get(o)!==a)return;let i=new s.MarkerClusterer({map:r.map,markers:a,algorithmOptions:{maxZoom:e.maxZoom},renderer:{render:t=>z(r.markerLib,t)}});r.clusterers.set(o,i)}function L(r,o){let a=r.clusterers.get(o);a&&(a.setMap(null),r.clusterers.delete(o))}var C=!1;function W(){C||(C=!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 $(r,o){return o.markers.map(a=>{let e=new r.markerLib.AdvancedMarkerElement({map:r.map,position:a.position,content:x(a,r.markerLib),gmpClickable:!!o.onMarkerClick});if(o.onMarkerClick){let s=o.onMarkerClick;e.addListener("click",()=>s(a.id))}return e})}function w(r,o,a,e){r.classList.toggle("rle-marker--selected",o===a),r.classList.toggle("rle-marker--hovered",o===e&&o!==a)}function D(r,o){let a=A();return o.markers.map(e=>{let s=o.onMarkerClick,i=s?()=>s(e.id):void 0,t=new a(e.position,R(e),i,{onContainerAdd:n=>{r.markerElements.set(e.id,n),w(n,e.id,r.selectedMarkerId,r.hoveredMarkerId)},onContainerRemove:n=>{r.markerElements.get(e.id)===n&&r.markerElements.delete(e.id)}});return t.setMap(r.map),t})}function O(r,o){let a=r.layerMarkerIds.get(o);if(a){for(let e of a)r.markerElements.delete(e);r.layerMarkerIds.delete(o)}}function X(r){let o=r.getSouthWest(),a=r.getNorthEast();return{west:o.lng(),south:o.lat(),east:a.lng(),north:a.lat()}}function Z(r,o,a){if(typeof ResizeObserver>"u")return;let e=!1,s=()=>{let{width:t,height:n}=r.getBoundingClientRect();t===0||n===0||(google.maps.event.trigger(o,"resize"),e||(e=!0,o.setCenter(a)))},i=new ResizeObserver(s);return i.observe(r),typeof requestAnimationFrame<"u"?requestAnimationFrame(s):queueMicrotask(s),i}function q(r){if(!r.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let o=!1,a=()=>{o||(_jsapiloader.setOptions.call(void 0, {...r.loaderOptions,key:r.apiKey}),o=!0)},e,s=0;return{async mount(i,t){let n=++s;a();let l=await _jsapiloader.importLibrary.call(void 0, "maps"),d=await _jsapiloader.importLibrary.call(void 0, "marker"),c=_nullishCoalesce(t.center, () => ({lat:0,lng:0})),p=r.styles!=null,u=new l.Map(i,{...r.mapOptions,center:c,zoom:_nullishCoalesce(t.zoom, () => (10)),...p?{styles:r.styles}:{mapId:_nullishCoalesce(r.mapId, () => (H))}}),y=Z(i,u,c),m={map:u,containerEl:i,fullscreenEl:_nullishCoalesce(t.fullscreenTarget, () => (i)),markerLib:d,markerMode:p?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:y,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null};return n===s&&(e=m),{raw:m}},renderLayer(i,t){let n=f(i),l=n.layers.get(t.id);l&&(k(l),n.layers.delete(t.id),O(n,t.id)),L(n,t.id);let d=n.markerMode==="overlay"?D(n,t):$(n,t);n.layers.set(t.id,d),n.markerMode==="overlay"&&n.layerMarkerIds.set(t.id,t.markers.map(p=>p.id)),t.clustering&&(n.markerMode==="overlay"?W():V(n,t.id,d,t.clustering));let c=!1;return()=>{c||(c=!0,n.layers.get(t.id)===d&&(k(d),n.layers.delete(t.id),L(n,t.id),O(n,t.id)))}},onBoundsChange(i,t){let n=f(i),l=n.map.addListener("idle",()=>{let c=n.map.getBounds();c&&t(X(c))});n.boundsListeners.add(l);let d=!1;return()=>{d||(d=!0,l.remove(),n.boundsListeners.delete(l))}},onMapClick(i){let t=e;if(!t)return()=>{};let n=t.map.addListener("click",()=>i());t.clickListeners.add(n);let l=!1;return()=>{l||(l=!0,n.remove(),t.clickListeners.delete(n))}},fitBounds(i,t){f(i).map.fitBounds(t)},destroy(i){let t=f(i);_optionalChain([t, 'access', _15 => _15.resizeObserver, 'optionalAccess', _16 => _16.disconnect, 'call', _17 => _17()]);for(let n of t.boundsListeners)n.remove();t.boundsListeners.clear();for(let n of t.clickListeners)n.remove();t.clickListeners.clear();for(let n of[...t.clusterers.keys()])L(t,n);for(let n of t.layers.values())k(n);t.layers.clear(),t.markerElements.clear(),t.layerMarkerIds.clear(),e===t&&(e=void 0)},updateMarkerStates(i,t){if(e){e.selectedMarkerId=i,e.hoveredMarkerId=t;for(let[n,l]of e.markerElements)w(l,n,i,t)}},mountOverlay(i){let t=document.createElement("div");if(t.style.position="absolute",t.style.transform="translate(-50%, -100%)",t.style.pointerEvents="auto",!e)return{container:t,setPosition:()=>{},unmount:()=>t.remove()};let n=G(),l=new n(t,i,e.containerEl);return l.setMap(e.map),{container:t,setPosition:d=>l.updatePosition(d),unmount:()=>{l.setMap(null),t.remove()}}},zoomIn(){e&&e.map.setZoom((_nullishCoalesce(e.map.getZoom(), () => (0)))+1)},zoomOut(){e&&e.map.setZoom((_nullishCoalesce(e.map.getZoom(), () => (0)))-1)},toggleFullscreen(){if(!e)return;let i=e.fullscreenEl,t=document.fullscreenElement;t!=null&&i.contains(t)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _18 => _18.exitFullscreen, 'call', _19 => _19(), 'optionalAccess', _20 => _20.catch, 'call', _21 => _21(()=>{})]):typeof i.requestFullscreen=="function"&&_optionalChain([i, 'access', _22 => _22.requestFullscreen, 'call', _23 => _23(), 'optionalAccess', _24 => _24.catch, 'call', _25 => _25(()=>{})])}}}exports.googleProvider = q;
|
|
2
|
+
var _jsapiloader = require('@googlemaps/js-api-loader');var G="DEMO_MAP_ID";function M(n){return n.raw}function B(n,r){if(n.element)return n.element;if(n.iconUrl)return new r.PinElement({glyphSrc:n.iconUrl}).element}var H=12,W="#b3261e";function U(n){if(n.element)return n.element;if(n.iconUrl){let l=document.createElement("img");return l.src=n.iconUrl,l}let r=document.createElement("div");return r.style.width=`${H}px`,r.style.height=`${H}px`,r.style.borderRadius="50%",r.style.backgroundColor=W,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var y;function Z(){if(y)return y;class n extends google.maps.OverlayView{constructor(t,a,i,e){super();n.prototype.__init.call(this);;this.position=t;this.content=a;this.onClick=i;this.lifecycle=e}__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 y=n,y}var v=14,V=8;function D(n){let{anchorX:r,anchorY:l,popupW:t,popupH:a,mapW:i,mapH:e,offsetY:o,pad:s}=n,c=r-t/2,d=r+t/2,p=0;t>i-s*2?p=s-c:d>i-s?p=i-s-d:c<s&&(p=s-c);let u=l-o-a,m=l+o+a,f=u<s&&m<=e-s;return{dx:p,flipBelow:f}}var h;function X(){if(h)return h;class n extends google.maps.OverlayView{constructor(t,a,i){super();n.prototype.__init2.call(this);n.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-v}px`;return}this.clampOffset=D({anchorX:d.x,anchorY:d.y,popupW:s,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:V})}let{dx:e,flipBelow:o}=this.clampOffset;this.container.style.left=`${i.x+e}px`,o?(this.container.style.top=`${i.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-v}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 h=n,h}function E(n){for(let r of n)typeof r.setMap=="function"?r.setMap(null):r.map=null}var Y="#b3261e",q=40,$=64,j=14;function K(n,r){let l=r.count,t=Math.min($,q+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=Y,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 n.AdvancedMarkerElement({position:r.position,content:a})}var I=!1;async function N(n,r,l,t){let a;try{a=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(e){I||(I=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',e));return}if(n.layers.get(r)!==l)return;let i=new a.MarkerClusterer({map:n.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:e=>K(n.markerLib,e)}});n.clusterers.set(r,i)}function b(n,r){let l=n.clusterers.get(r);l&&(l.setMap(null),n.clusterers.delete(r))}var A=!1;function J(){A||(A=!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 Q(n,r){return r.markers.map(l=>{let t=new n.markerLib.AdvancedMarkerElement({map:n.map,position:l.position,content:B(l,n.markerLib),gmpClickable:!!r.onMarkerClick});if(r.onMarkerClick){let a=r.onMarkerClick;t.addListener("click",()=>a(l.id))}return t})}function F(n,r,l,t){n.classList.toggle("rle-marker--selected",r===l),n.classList.toggle("rle-marker--hovered",r===t&&r!==l)}function ee(n,r){let l=Z();return r.markers.map(t=>{let a=r.onMarkerClick,i=a?()=>a(t.id):void 0,e=new l(t.position,U(t),i,{onContainerAdd:o=>{n.markerElements.set(t.id,o),F(o,t.id,n.selectedMarkerId,n.hoveredMarkerId)},onContainerRemove:o=>{n.markerElements.get(t.id)===o&&n.markerElements.delete(t.id)}});return e.setMap(n.map),e})}function R(n,r){let l=n.layerMarkerIds.get(r);if(l){for(let t of l)n.markerElements.delete(t);n.layerMarkerIds.delete(r)}}function te(n){let r=n.getSouthWest(),l=n.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var k=256,ne=500,re=1300,oe=4;function L(n,r){let l=Math.min(Math.max(Math.sin(n*Math.PI/180),-.9999),.9999);return{x:k*(.5+r/360),y:k*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function T(n){let r=Math.PI-2*Math.PI*n.y/k;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(n.x/k-.5)*360}}function ae(n,r,l){let t=L(n.north,n.east),a=L(n.south,n.west),i=Math.abs(t.x-a.x),e=Math.abs(t.y-a.y);return i===0||e===0||r===0||l===0?null:{center:T({x:(t.x+a.x)/2,y:(t.y+a.y)/2}),zoom:Math.min(Math.log2(r/i),Math.log2(l/e))}}function ie(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}function se(n,r,l){if(typeof ResizeObserver>"u")return;let t=!1,a=()=>{let{width:e,height:o}=n.getBoundingClientRect();e===0||o===0||(google.maps.event.trigger(r,"resize"),t||(t=!0,r.setCenter(l)))},i=new ResizeObserver(a);return i.observe(n),typeof requestAnimationFrame<"u"?requestAnimationFrame(a):queueMicrotask(a),i}function le(n){if(!n.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let r=!1,l=()=>{r||(_jsapiloader.setOptions.call(void 0, {...n.loaderOptions,key:n.apiKey}),r=!0)},t,a=0;return{async mount(i,e){let o=++a;l();let s=await _jsapiloader.importLibrary.call(void 0, "maps"),c=await _jsapiloader.importLibrary.call(void 0, "marker"),d=_nullishCoalesce(e.center, () => ({lat:0,lng:0})),p=n.styles!=null,u=new s.Map(i,{...n.mapOptions,center:d,zoom:_nullishCoalesce(e.zoom, () => (10)),...p?{styles:n.styles}:{mapId:_nullishCoalesce(n.mapId, () => (G))}}),m=se(i,u,d),f={map:u,containerEl:i,fullscreenEl:_nullishCoalesce(e.fullscreenTarget, () => (i)),markerLib:c,markerMode:p?"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,flightFrame:null};return o===a&&(t=f),{raw:f}},renderLayer(i,e){let o=M(i),s=o.layers.get(e.id);s&&(E(s),o.layers.delete(e.id),R(o,e.id)),b(o,e.id);let c=o.markerMode==="overlay"?ee(o,e):Q(o,e);o.layers.set(e.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(e.id,e.markers.map(p=>p.id)),e.clustering&&(o.markerMode==="overlay"?J():N(o,e.id,c,e.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(e.id)===c&&(E(c),o.layers.delete(e.id),b(o,e.id),R(o,e.id)))}},onBoundsChange(i,e){let o=M(i),s=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&e(te(d))});o.boundsListeners.add(s);let c=!1;return()=>{c||(c=!0,s.remove(),o.boundsListeners.delete(s))}},onMapClick(i){let e=t;if(!e)return()=>{};let o=e.map.addListener("click",()=>i());e.clickListeners.add(o);let s=!1;return()=>{s||(s=!0,o.remove(),e.clickListeners.delete(o))}},fitBounds(i,e,o){let s=M(i);if(s.flightFrame!=null&&(cancelAnimationFrame(s.flightFrame),s.flightFrame=null),!_optionalChain([o, 'optionalAccess', _15 => _15.animate])){s.map.fitBounds(e);return}let c=s.map.getZoom(),d=s.map.getCenter(),p=ae(e,s.containerEl.clientWidth,s.containerEl.clientHeight);if(c==null||!d||!p){s.map.fitBounds(e);return}s.map.setOptions({isFractionalZoomEnabled:!0});let u={...L(d.lat(),d.lng()),zoom:c},m={...L(p.center.lat,p.center.lng),zoom:p.zoom},f=Math.hypot(m.x-u.x,m.y-u.y)*2**Math.min(u.zoom,m.zoom),C=Math.max(s.containerEl.clientWidth,s.containerEl.clientHeight),O=f>C?Math.min(oe,Math.log2(f/C)+1):0,_=Math.min(re,ne+O*200),S=performance.now(),P=()=>{let x=Math.min(1,(performance.now()-S)/_),g=ie(x);s.map.setZoom(u.zoom+(m.zoom-u.zoom)*g-O*Math.sin(Math.PI*g)),s.map.setCenter(T({x:u.x+(m.x-u.x)*g,y:u.y+(m.y-u.y)*g})),s.flightFrame=x<1?requestAnimationFrame(P):null};s.flightFrame=requestAnimationFrame(P)},destroy(i){let e=M(i);_optionalChain([e, 'access', _16 => _16.resizeObserver, 'optionalAccess', _17 => _17.disconnect, 'call', _18 => _18()]),e.flightFrame!=null&&(cancelAnimationFrame(e.flightFrame),e.flightFrame=null);for(let o of e.boundsListeners)o.remove();e.boundsListeners.clear();for(let o of e.clickListeners)o.remove();e.clickListeners.clear();for(let o of[...e.clusterers.keys()])b(e,o);for(let o of e.layers.values())E(o);e.layers.clear(),e.markerElements.clear(),e.layerMarkerIds.clear(),t===e&&(t=void 0)},updateMarkerStates(i,e){if(t){t.selectedMarkerId=i,t.hoveredMarkerId=e;for(let[o,s]of t.markerElements)F(s,o,i,e)}},mountOverlay(i){let e=document.createElement("div");if(e.style.position="absolute",e.style.transform="translate(-50%, -100%)",e.style.pointerEvents="auto",!t)return{container:e,setPosition:()=>{},unmount:()=>e.remove()};let o=X(),s=new o(e,i,t.containerEl);return s.setMap(t.map),{container:e,setPosition:c=>s.updatePosition(c),unmount:()=>{s.setMap(null),e.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,e=document.fullscreenElement;e!=null&&i.contains(e)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _19 => _19.exitFullscreen, 'call', _20 => _20(), 'optionalAccess', _21 => _21.catch, 'call', _22 => _22(()=>{})]):typeof i.requestFullscreen=="function"&&_optionalChain([i, 'access', _23 => _23.requestFullscreen, 'call', _24 => _24(), 'optionalAccess', _25 => _25.catch, 'call', _26 => _26(()=>{})])}}}exports.googleProvider = le;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIOptions } from '@googlemaps/js-api-loader';
|
|
2
|
-
import { a as MapProvider } from '../../map-provider.interface-
|
|
2
|
+
import { a as MapProvider } from '../../map-provider.interface-8hvdqqjd.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-
|
|
2
|
+
import { a as MapProvider } from '../../map-provider.interface-8hvdqqjd.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 h,setOptions as P}from"@googlemaps/js-api-loader";var H="DEMO_MAP_ID";function f(r){return r.raw}function x(r,o){if(r.element)return r.element;if(r.iconUrl)return new o.PinElement({glyphSrc:r.iconUrl}).element}var E=12,I="#b3261e";function R(r){if(r.element)return r.element;if(r.iconUrl){let a=document.createElement("img");return a.src=r.iconUrl,a}let o=document.createElement("div");return o.style.width=`${E}px`,o.style.height=`${E}px`,o.style.borderRadius="50%",o.style.backgroundColor=I,o.style.border="2px solid #ffffff",o.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",o}var g;function A(){if(g)return g;class r extends google.maps.OverlayView{constructor(e,s,i,t){super();this.position=e;this.content=s;this.onClick=i;this.lifecycle=t}position;content;onClick;lifecycle;div=null;onAdd(){let e=document.createElement("div");e.style.position="absolute",e.style.transform="translate(-50%, -50%)",this.onClick&&(e.style.cursor="pointer",e.addEventListener("click",this.onClick)),e.appendChild(this.content),this.div=e,this.getPanes()?.overlayMouseTarget.appendChild(e),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(e),this.lifecycle.onContainerAdd(e)}draw(){if(!this.div)return;let e=this.getProjection();if(!e)return;let s=e.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));s&&(this.div.style.left=`${s.x}px`,this.div.style.top=`${s.y}px`)}onRemove(){let e=this.div;this.div?.remove(),this.div=null,e&&this.lifecycle.onContainerRemove(e)}}return g=r,g}var v=14,T=8;function S(r){let{anchorX:o,anchorY:a,popupW:e,popupH:s,mapW:i,mapH:t,offsetY:n,pad:l}=r,d=o-e/2,c=o+e/2,p=0;e>i-l*2?p=l-d:c>i-l?p=i-l-c:d<l&&(p=l-d);let u=a-n-s,y=a+n+s,m=u<l&&y<=t-l;return{dx:p,flipBelow:m}}var M;function G(){if(M)return M;class r extends google.maps.OverlayView{constructor(e,s,i){super();this.container=e;this.position=s;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 e=this.getProjection();if(!e)return;let s=new google.maps.LatLng(this.position.lat,this.position.lng),i=e.fromLatLngToDivPixel(s);if(!i)return;if(this.clampOffset===null){let l=this.container.offsetWidth,d=this.container.offsetHeight,c=l&&d?e.fromLatLngToContainerPixel(s):null;if(!c){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${i.x}px`,this.container.style.top=`${i.y-v}px`;return}this.clampOffset=S({anchorX:c.x,anchorY:c.y,popupW:l,popupH:d,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:T})}let{dx:t,flipBelow:n}=this.clampOffset;this.container.style.left=`${i.x+t}px`,n?(this.container.style.top=`${i.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-v}px`,this.container.style.transform="translate(-50%, -100%)")}onRemove(){this.attached=!1,this.container.remove()}updatePosition(e){(e.lat!==this.position.lat||e.lng!==this.position.lng)&&(this.clampOffset=null),this.position=e,this.attached&&this.draw()}}return M=r,M}function k(r){for(let o of r)typeof o.setMap=="function"?o.setMap(null):o.map=null}var _="#b3261e",F=40,B=64,U=14;function z(r,o){let a=o.count,e=Math.min(B,F+Math.round(Math.log10(a+1)*U)),s=document.createElement("div");return s.textContent=String(a),s.style.display="flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.width=`${e}px`,s.style.height=`${e}px`,s.style.borderRadius="50%",s.style.backgroundColor=_,s.style.border="2px solid #ffffff",s.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",s.style.color="#ffffff",s.style.fontFamily="inherit",s.style.fontWeight="700",s.style.fontSize=e>=52?"15px":"13px",new r.AdvancedMarkerElement({position:o.position,content:s})}var b=!1;async function V(r,o,a,e){let s;try{s=await import("@googlemaps/markerclusterer")}catch(t){b||(b=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',t));return}if(r.layers.get(o)!==a)return;let i=new s.MarkerClusterer({map:r.map,markers:a,algorithmOptions:{maxZoom:e.maxZoom},renderer:{render:t=>z(r.markerLib,t)}});r.clusterers.set(o,i)}function L(r,o){let a=r.clusterers.get(o);a&&(a.setMap(null),r.clusterers.delete(o))}var C=!1;function W(){C||(C=!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 $(r,o){return o.markers.map(a=>{let e=new r.markerLib.AdvancedMarkerElement({map:r.map,position:a.position,content:x(a,r.markerLib),gmpClickable:!!o.onMarkerClick});if(o.onMarkerClick){let s=o.onMarkerClick;e.addListener("click",()=>s(a.id))}return e})}function w(r,o,a,e){r.classList.toggle("rle-marker--selected",o===a),r.classList.toggle("rle-marker--hovered",o===e&&o!==a)}function D(r,o){let a=A();return o.markers.map(e=>{let s=o.onMarkerClick,i=s?()=>s(e.id):void 0,t=new a(e.position,R(e),i,{onContainerAdd:n=>{r.markerElements.set(e.id,n),w(n,e.id,r.selectedMarkerId,r.hoveredMarkerId)},onContainerRemove:n=>{r.markerElements.get(e.id)===n&&r.markerElements.delete(e.id)}});return t.setMap(r.map),t})}function O(r,o){let a=r.layerMarkerIds.get(o);if(a){for(let e of a)r.markerElements.delete(e);r.layerMarkerIds.delete(o)}}function X(r){let o=r.getSouthWest(),a=r.getNorthEast();return{west:o.lng(),south:o.lat(),east:a.lng(),north:a.lat()}}function Z(r,o,a){if(typeof ResizeObserver>"u")return;let e=!1,s=()=>{let{width:t,height:n}=r.getBoundingClientRect();t===0||n===0||(google.maps.event.trigger(o,"resize"),e||(e=!0,o.setCenter(a)))},i=new ResizeObserver(s);return i.observe(r),typeof requestAnimationFrame<"u"?requestAnimationFrame(s):queueMicrotask(s),i}function q(r){if(!r.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let o=!1,a=()=>{o||(P({...r.loaderOptions,key:r.apiKey}),o=!0)},e,s=0;return{async mount(i,t){let n=++s;a();let l=await h("maps"),d=await h("marker"),c=t.center??{lat:0,lng:0},p=r.styles!=null,u=new l.Map(i,{...r.mapOptions,center:c,zoom:t.zoom??10,...p?{styles:r.styles}:{mapId:r.mapId??H}}),y=Z(i,u,c),m={map:u,containerEl:i,fullscreenEl:t.fullscreenTarget??i,markerLib:d,markerMode:p?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:y,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null};return n===s&&(e=m),{raw:m}},renderLayer(i,t){let n=f(i),l=n.layers.get(t.id);l&&(k(l),n.layers.delete(t.id),O(n,t.id)),L(n,t.id);let d=n.markerMode==="overlay"?D(n,t):$(n,t);n.layers.set(t.id,d),n.markerMode==="overlay"&&n.layerMarkerIds.set(t.id,t.markers.map(p=>p.id)),t.clustering&&(n.markerMode==="overlay"?W():V(n,t.id,d,t.clustering));let c=!1;return()=>{c||(c=!0,n.layers.get(t.id)===d&&(k(d),n.layers.delete(t.id),L(n,t.id),O(n,t.id)))}},onBoundsChange(i,t){let n=f(i),l=n.map.addListener("idle",()=>{let c=n.map.getBounds();c&&t(X(c))});n.boundsListeners.add(l);let d=!1;return()=>{d||(d=!0,l.remove(),n.boundsListeners.delete(l))}},onMapClick(i){let t=e;if(!t)return()=>{};let n=t.map.addListener("click",()=>i());t.clickListeners.add(n);let l=!1;return()=>{l||(l=!0,n.remove(),t.clickListeners.delete(n))}},fitBounds(i,t){f(i).map.fitBounds(t)},destroy(i){let t=f(i);t.resizeObserver?.disconnect();for(let n of t.boundsListeners)n.remove();t.boundsListeners.clear();for(let n of t.clickListeners)n.remove();t.clickListeners.clear();for(let n of[...t.clusterers.keys()])L(t,n);for(let n of t.layers.values())k(n);t.layers.clear(),t.markerElements.clear(),t.layerMarkerIds.clear(),e===t&&(e=void 0)},updateMarkerStates(i,t){if(e){e.selectedMarkerId=i,e.hoveredMarkerId=t;for(let[n,l]of e.markerElements)w(l,n,i,t)}},mountOverlay(i){let t=document.createElement("div");if(t.style.position="absolute",t.style.transform="translate(-50%, -100%)",t.style.pointerEvents="auto",!e)return{container:t,setPosition:()=>{},unmount:()=>t.remove()};let n=G(),l=new n(t,i,e.containerEl);return l.setMap(e.map),{container:t,setPosition:d=>l.updatePosition(d),unmount:()=>{l.setMap(null),t.remove()}}},zoomIn(){e&&e.map.setZoom((e.map.getZoom()??0)+1)},zoomOut(){e&&e.map.setZoom((e.map.getZoom()??0)-1)},toggleFullscreen(){if(!e)return;let i=e.fullscreenEl,t=document.fullscreenElement;t!=null&&i.contains(t)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof i.requestFullscreen=="function"&&i.requestFullscreen()?.catch(()=>{})}}}export{q as googleProvider};
|
|
2
|
+
import{importLibrary as w,setOptions as z}from"@googlemaps/js-api-loader";var G="DEMO_MAP_ID";function M(n){return n.raw}function B(n,r){if(n.element)return n.element;if(n.iconUrl)return new r.PinElement({glyphSrc:n.iconUrl}).element}var H=12,W="#b3261e";function U(n){if(n.element)return n.element;if(n.iconUrl){let l=document.createElement("img");return l.src=n.iconUrl,l}let r=document.createElement("div");return r.style.width=`${H}px`,r.style.height=`${H}px`,r.style.borderRadius="50%",r.style.backgroundColor=W,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var y;function Z(){if(y)return y;class n extends google.maps.OverlayView{constructor(t,a,i,e){super();this.position=t;this.content=a;this.onClick=i;this.lifecycle=e}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 y=n,y}var v=14,V=8;function D(n){let{anchorX:r,anchorY:l,popupW:t,popupH:a,mapW:i,mapH:e,offsetY:o,pad:s}=n,c=r-t/2,d=r+t/2,p=0;t>i-s*2?p=s-c:d>i-s?p=i-s-d:c<s&&(p=s-c);let u=l-o-a,m=l+o+a,f=u<s&&m<=e-s;return{dx:p,flipBelow:f}}var h;function X(){if(h)return h;class n 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-v}px`;return}this.clampOffset=D({anchorX:d.x,anchorY:d.y,popupW:s,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:V})}let{dx:e,flipBelow:o}=this.clampOffset;this.container.style.left=`${i.x+e}px`,o?(this.container.style.top=`${i.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${i.y-v}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 h=n,h}function E(n){for(let r of n)typeof r.setMap=="function"?r.setMap(null):r.map=null}var Y="#b3261e",q=40,$=64,j=14;function K(n,r){let l=r.count,t=Math.min($,q+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=Y,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 n.AdvancedMarkerElement({position:r.position,content:a})}var I=!1;async function N(n,r,l,t){let a;try{a=await import("@googlemaps/markerclusterer")}catch(e){I||(I=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',e));return}if(n.layers.get(r)!==l)return;let i=new a.MarkerClusterer({map:n.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:e=>K(n.markerLib,e)}});n.clusterers.set(r,i)}function b(n,r){let l=n.clusterers.get(r);l&&(l.setMap(null),n.clusterers.delete(r))}var A=!1;function J(){A||(A=!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 Q(n,r){return r.markers.map(l=>{let t=new n.markerLib.AdvancedMarkerElement({map:n.map,position:l.position,content:B(l,n.markerLib),gmpClickable:!!r.onMarkerClick});if(r.onMarkerClick){let a=r.onMarkerClick;t.addListener("click",()=>a(l.id))}return t})}function F(n,r,l,t){n.classList.toggle("rle-marker--selected",r===l),n.classList.toggle("rle-marker--hovered",r===t&&r!==l)}function ee(n,r){let l=Z();return r.markers.map(t=>{let a=r.onMarkerClick,i=a?()=>a(t.id):void 0,e=new l(t.position,U(t),i,{onContainerAdd:o=>{n.markerElements.set(t.id,o),F(o,t.id,n.selectedMarkerId,n.hoveredMarkerId)},onContainerRemove:o=>{n.markerElements.get(t.id)===o&&n.markerElements.delete(t.id)}});return e.setMap(n.map),e})}function R(n,r){let l=n.layerMarkerIds.get(r);if(l){for(let t of l)n.markerElements.delete(t);n.layerMarkerIds.delete(r)}}function te(n){let r=n.getSouthWest(),l=n.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var k=256,ne=500,re=1300,oe=4;function L(n,r){let l=Math.min(Math.max(Math.sin(n*Math.PI/180),-.9999),.9999);return{x:k*(.5+r/360),y:k*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function T(n){let r=Math.PI-2*Math.PI*n.y/k;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(n.x/k-.5)*360}}function ae(n,r,l){let t=L(n.north,n.east),a=L(n.south,n.west),i=Math.abs(t.x-a.x),e=Math.abs(t.y-a.y);return i===0||e===0||r===0||l===0?null:{center:T({x:(t.x+a.x)/2,y:(t.y+a.y)/2}),zoom:Math.min(Math.log2(r/i),Math.log2(l/e))}}function ie(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}function se(n,r,l){if(typeof ResizeObserver>"u")return;let t=!1,a=()=>{let{width:e,height:o}=n.getBoundingClientRect();e===0||o===0||(google.maps.event.trigger(r,"resize"),t||(t=!0,r.setCenter(l)))},i=new ResizeObserver(a);return i.observe(n),typeof requestAnimationFrame<"u"?requestAnimationFrame(a):queueMicrotask(a),i}function le(n){if(!n.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let r=!1,l=()=>{r||(z({...n.loaderOptions,key:n.apiKey}),r=!0)},t,a=0;return{async mount(i,e){let o=++a;l();let s=await w("maps"),c=await w("marker"),d=e.center??{lat:0,lng:0},p=n.styles!=null,u=new s.Map(i,{...n.mapOptions,center:d,zoom:e.zoom??10,...p?{styles:n.styles}:{mapId:n.mapId??G}}),m=se(i,u,d),f={map:u,containerEl:i,fullscreenEl:e.fullscreenTarget??i,markerLib:c,markerMode:p?"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,flightFrame:null};return o===a&&(t=f),{raw:f}},renderLayer(i,e){let o=M(i),s=o.layers.get(e.id);s&&(E(s),o.layers.delete(e.id),R(o,e.id)),b(o,e.id);let c=o.markerMode==="overlay"?ee(o,e):Q(o,e);o.layers.set(e.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(e.id,e.markers.map(p=>p.id)),e.clustering&&(o.markerMode==="overlay"?J():N(o,e.id,c,e.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(e.id)===c&&(E(c),o.layers.delete(e.id),b(o,e.id),R(o,e.id)))}},onBoundsChange(i,e){let o=M(i),s=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&e(te(d))});o.boundsListeners.add(s);let c=!1;return()=>{c||(c=!0,s.remove(),o.boundsListeners.delete(s))}},onMapClick(i){let e=t;if(!e)return()=>{};let o=e.map.addListener("click",()=>i());e.clickListeners.add(o);let s=!1;return()=>{s||(s=!0,o.remove(),e.clickListeners.delete(o))}},fitBounds(i,e,o){let s=M(i);if(s.flightFrame!=null&&(cancelAnimationFrame(s.flightFrame),s.flightFrame=null),!o?.animate){s.map.fitBounds(e);return}let c=s.map.getZoom(),d=s.map.getCenter(),p=ae(e,s.containerEl.clientWidth,s.containerEl.clientHeight);if(c==null||!d||!p){s.map.fitBounds(e);return}s.map.setOptions({isFractionalZoomEnabled:!0});let u={...L(d.lat(),d.lng()),zoom:c},m={...L(p.center.lat,p.center.lng),zoom:p.zoom},f=Math.hypot(m.x-u.x,m.y-u.y)*2**Math.min(u.zoom,m.zoom),C=Math.max(s.containerEl.clientWidth,s.containerEl.clientHeight),O=f>C?Math.min(oe,Math.log2(f/C)+1):0,_=Math.min(re,ne+O*200),S=performance.now(),P=()=>{let x=Math.min(1,(performance.now()-S)/_),g=ie(x);s.map.setZoom(u.zoom+(m.zoom-u.zoom)*g-O*Math.sin(Math.PI*g)),s.map.setCenter(T({x:u.x+(m.x-u.x)*g,y:u.y+(m.y-u.y)*g})),s.flightFrame=x<1?requestAnimationFrame(P):null};s.flightFrame=requestAnimationFrame(P)},destroy(i){let e=M(i);e.resizeObserver?.disconnect(),e.flightFrame!=null&&(cancelAnimationFrame(e.flightFrame),e.flightFrame=null);for(let o of e.boundsListeners)o.remove();e.boundsListeners.clear();for(let o of e.clickListeners)o.remove();e.clickListeners.clear();for(let o of[...e.clusterers.keys()])b(e,o);for(let o of e.layers.values())E(o);e.layers.clear(),e.markerElements.clear(),e.layerMarkerIds.clear(),t===e&&(t=void 0)},updateMarkerStates(i,e){if(t){t.selectedMarkerId=i,t.hoveredMarkerId=e;for(let[o,s]of t.markerElements)F(s,o,i,e)}},mountOverlay(i){let e=document.createElement("div");if(e.style.position="absolute",e.style.transform="translate(-50%, -100%)",e.style.pointerEvents="auto",!t)return{container:e,setPosition:()=>{},unmount:()=>e.remove()};let o=X(),s=new o(e,i,t.containerEl);return s.setMap(t.map),{container:e,setPosition:c=>s.updatePosition(c),unmount:()=>{s.setMap(null),e.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,e=document.fullscreenElement;e!=null&&i.contains(e)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof i.requestFullscreen=="function"&&i.requestFullscreen()?.catch(()=>{})}}}export{le as googleProvider};
|
package/dist/styled/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunk23WHD4QOcjs = require('../chunk-23WHD4QO.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunk23WHD4QOcjs.q,{..._chunk23WHD4QOcjs.O,children:o})}exports.BottomNav = _chunk23WHD4QOcjs.P; exports.BottomSheet = _chunk23WHD4QOcjs.Q; exports.ListingApp = _chunk23WHD4QOcjs.S; exports.StyledCard = _chunk23WHD4QOcjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunk23WHD4QOcjs.F; exports.StyledFilterPanel = _chunk23WHD4QOcjs.G; exports.StyledListingLayout = _chunk23WHD4QOcjs.R; exports.StyledLoading = _chunk23WHD4QOcjs.H; exports.StyledMarker = _chunk23WHD4QOcjs.I; exports.StyledPopup = _chunk23WHD4QOcjs.J; exports.StyledResultHeader = _chunk23WHD4QOcjs.K; exports.StyledSearch = _chunk23WHD4QOcjs.L; exports.StyledSidebar = _chunk23WHD4QOcjs.M; exports.StyledToolbar = _chunk23WHD4QOcjs.N; exports.styledDefaultComponents = _chunk23WHD4QOcjs.O;
|
package/dist/styled/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-
|
|
4
|
-
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-
|
|
5
|
-
import '../map-provider.interface-
|
|
3
|
+
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-B7_vzALF.cjs';
|
|
4
|
+
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-B7_vzALF.cjs';
|
|
5
|
+
import '../map-provider.interface-8hvdqqjd.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
|
package/dist/styled/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-
|
|
4
|
-
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-
|
|
5
|
-
import '../map-provider.interface-
|
|
3
|
+
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-DogqrxBV.js';
|
|
4
|
+
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-DogqrxBV.js';
|
|
5
|
+
import '../map-provider.interface-8hvdqqjd.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
|
package/dist/styled/index.js
CHANGED
|
@@ -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 t,P as S,Q as f,R as P,S as u,q as e}from"../chunk-
|
|
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 t,P as S,Q as f,R as P,S as u,q as e}from"../chunk-JGTCJNXN.js";import{jsx as g}from"react/jsx-runtime";function L({children:o}){return g(e,{...t,children:o})}export{S as BottomNav,f as BottomSheet,u as ListingApp,r as StyledCard,L as StyledComponentsProviderWithDefaults,p as StyledEmpty,i as StyledFilterPanel,P as StyledListingLayout,y as StyledLoading,d as StyledMarker,l as StyledPopup,n as StyledResultHeader,m as StyledSearch,s as StyledSidebar,a as StyledToolbar,t as styledDefaultComponents};
|
package/dist/testing/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;"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){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}};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;
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -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, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-
|
|
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';
|
|
2
2
|
|
|
3
3
|
type BoundsListener = (b: Bounds) => void;
|
|
4
4
|
/** One live overlay record kept by `FakeMapProvider.mountOverlay` for assertions. */
|
|
@@ -51,7 +51,7 @@ declare class FakeMapProvider implements MapProvider {
|
|
|
51
51
|
onMapClick(cb: () => void): Unsubscribe;
|
|
52
52
|
/** Test-only: simulates a click on the map background by invoking every registered map-click listener. */
|
|
53
53
|
emitMapClick(): void;
|
|
54
|
-
fitBounds(_handle: MapHandle, b: Bounds): void;
|
|
54
|
+
fitBounds(_handle: MapHandle, b: Bounds, _options?: FitBoundsOptions): void;
|
|
55
55
|
destroy(handle: MapHandle): void;
|
|
56
56
|
updateMarkerStates(selectedId: EntityId | null, hoveredId: EntityId | null): void;
|
|
57
57
|
mountOverlay(position: LatLng): MapOverlayHandle;
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -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, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-
|
|
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';
|
|
2
2
|
|
|
3
3
|
type BoundsListener = (b: Bounds) => void;
|
|
4
4
|
/** One live overlay record kept by `FakeMapProvider.mountOverlay` for assertions. */
|
|
@@ -51,7 +51,7 @@ declare class FakeMapProvider implements MapProvider {
|
|
|
51
51
|
onMapClick(cb: () => void): Unsubscribe;
|
|
52
52
|
/** Test-only: simulates a click on the map background by invoking every registered map-click listener. */
|
|
53
53
|
emitMapClick(): void;
|
|
54
|
-
fitBounds(_handle: MapHandle, b: Bounds): void;
|
|
54
|
+
fitBounds(_handle: MapHandle, b: Bounds, _options?: FitBoundsOptions): void;
|
|
55
55
|
destroy(handle: MapHandle): void;
|
|
56
56
|
updateMarkerStates(selectedId: EntityId | null, hoveredId: EntityId | null): void;
|
|
57
57
|
mountOverlay(position: LatLng): MapOverlayHandle;
|
package/dist/testing/index.js
CHANGED
|
@@ -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){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}};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.7.
|
|
3
|
+
"version": "0.7.12",
|
|
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": [
|
|
@@ -80,6 +80,14 @@
|
|
|
80
80
|
"optional": true
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"build": "tsup",
|
|
85
|
+
"test": "vitest run",
|
|
86
|
+
"test:watch": "vitest",
|
|
87
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
88
|
+
"lint": "eslint .",
|
|
89
|
+
"release": "changeset publish"
|
|
90
|
+
},
|
|
83
91
|
"devDependencies": {
|
|
84
92
|
"@changesets/cli": "^2.31.1",
|
|
85
93
|
"@googlemaps/js-api-loader": "^2.1.1",
|
|
@@ -103,13 +111,5 @@
|
|
|
103
111
|
},
|
|
104
112
|
"publishConfig": {
|
|
105
113
|
"access": "public"
|
|
106
|
-
},
|
|
107
|
-
"scripts": {
|
|
108
|
-
"build": "tsup",
|
|
109
|
-
"test": "vitest run",
|
|
110
|
-
"test:watch": "vitest",
|
|
111
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
112
|
-
"lint": "eslint .",
|
|
113
|
-
"release": "changeset publish"
|
|
114
114
|
}
|
|
115
|
-
}
|
|
115
|
+
}
|
package/dist/chunk-N2VOJIO3.cjs
DELETED
|
@@ -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 J= (_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 U= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>_optionalChain([i, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(e)])).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}}, _class2);var Y= (_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 ee= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}}, _class4);var Be={pagination:"paged",pageSize:20,debounceMs:250};var te=class{constructor(e){this.options=Object.freeze({...Be,...e})}};var ie= (_class5 =class{__init5() {this.emitter=new ee}__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 U)),this.map=e.map,this.config=new te(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 J({filters:_nullishCoalesce(e.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e)}selectPoint(e,i){this.store.setSelection(i);let r=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(n=>n.id===i)]);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function He(...t){let e={config:{},filters:new U,datasets:new Y};for(let i of t)i(e);return e}var Ae=t=>e=>{e.config={...e.config,...t}},ze= exports.j =t=>e=>{e.map=t},Ue= exports.k =t=>e=>{e.datasets.add(t)},Ke= exports.l =t=>e=>{t(e.filters)},Ni= exports.m =t=>e=>{e.urlSync=t},Ve= exports.n =t=>e=>{e.initialFilters=t},Ri= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function vt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var bt=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:vt(t)}),Lt=()=>_jsxruntime.jsx.call(void 0, "div",{}),me= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),Tt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Pt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Ft=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),St=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),Ct=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),kt=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),wt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),E={Card:bt,Marker:Lt,Popup:me,Sidebar:Tt,FilterPanel:Pt,Search:Ft,Empty:St,Loading:Ct,ResultHeader:kt,Toolbar:wt},qe=_react.createContext.call(void 0, E);function $e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:d,Loading:p,ResultHeader:l,Toolbar:a,children:g}=t,b={Card:_nullishCoalesce(e, () => (E.Card)),Marker:_nullishCoalesce(i, () => (E.Marker)),Popup:_nullishCoalesce(r, () => (E.Popup)),Sidebar:_nullishCoalesce(n, () => (E.Sidebar)),FilterPanel:_nullishCoalesce(s, () => (E.FilterPanel)),Search:_nullishCoalesce(o, () => (E.Search)),Empty:_nullishCoalesce(d, () => (E.Empty)),Loading:_nullishCoalesce(p, () => (E.Loading)),ResultHeader:_nullishCoalesce(l, () => (E.ResultHeader)),Toolbar:_nullishCoalesce(a, () => (E.Toolbar))};return _jsxruntime.jsx.call(void 0, qe.Provider,{value:b,children:g})}function P(){return _react.useContext.call(void 0, qe)}var re=_react.createContext.call(void 0, null);function y(){let t=_react.useContext.call(void 0, re);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function F(){let t=y(),e=_react.useCallback.call(void 0, r=>t.subscribe(r),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function ne(){let t=y(),e=F(),i=_react.useCallback.call(void 0, n=>t.applyFilters(n),[t]),r=_react.useCallback.call(void 0, (n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}function ge({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=y(),{FilterPanel:o}=P(),{filters:d}=ne(),p=r!==void 0&&n!==void 0,l=p?r:d;return _jsxruntime.jsx.call(void 0, o,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(t, () => ("space-y-5")),children:s.filters.list().map(a=>{if(typeof a.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":a.key,className:e},a.key);let g=a.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[a.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),_jsxruntime.jsx.call(void 0, g,{value:a.fromParams(l),onChange:b=>p?n(a.toParams(b)):void s.applyFilters(a.toParams(b))})]},a.key)})})})}function K(){return F().results}function Mt(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 Ge({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:d}=P();return r.loading&&i.length===0?_jsxruntime.jsx.call(void 0, d,{}):i.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:t,children:i.map((p,l)=>{let a=Mt(p,l);return _jsxruntime.jsx.call(void 0, s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}var _reactdom = require('react-dom');var _t={west:-179.9,south:-85,east:179.9,north:85},Ze=.1,Xe=.02;function Ot(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:d,lng:p}of t)p<e&&(e=p),p>i&&(i=p),d<r&&(r=d),d>n&&(n=d);let s=n>r?(n-r)*Ze:Xe,o=i>e?(i-e)*Ze:Xe;return{west:e-o,east:i+o,south:r-s,north:n+s}}function Ye(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=y(),o=F(),d=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, null),[a,g]=_react.useState.call(void 0, !1),b=_react.useRef.call(void 0, !1),x=_react.useRef.call(void 0, !1),C=_react.useRef.call(void 0, !1),c=s.map;_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let f=s.datasets.get(u),I=_nullishCoalesce(o.points[u], () => ([])),$={id:u,markers:I.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(u,R)};h.push(c.renderLayer(T,$))}return()=>{h.forEach(u=>u())}},[s,c,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{if(!d.current||!c)return;let T=d.current,h=!1,u=null;return(async()=>{let f=await c.mount(T,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(p.current, () => (void 0))});if(h){c.destroy(f);return}l.current=f,s.setMapHandle(f),u=c.onBoundsChange(f,I=>{C.current?C.current=!1:x.current=!0,s.loadPoints(I)}),g(!0),s.loadPoints(_t)})(),()=>{h=!0,_optionalChain([u, 'optionalCall', _24 => _24()]),l.current&&(c.destroy(l.current),l.current=null,s.setMapHandle(null)),g(!1)}},[s,c]),_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T||e||b.current||x.current)return;let h=[];for(let f of Object.keys(o.points))if(o.layers[f]!==!1)for(let I of _nullishCoalesce(o.points[f], () => ([])))h.push(I.position);let u=Ot(h);u&&(b.current=!0,C.current=!0,c.fitBounds(T,u))},[c,e,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([c, 'optionalAccess', _25 => _25.updateMarkerStates, 'call', _26 => _26(o.selection,o.hovered)])},[c,a,o.selection,o.hovered]);let{Popup:L}=P(),N=L!==me,k=_nullishCoalesce(o.points[s.primaryDatasetId], () => ([])),z=o.selection!=null?k.find(T=>T.id===o.selection):void 0,[w,D]=_react.useState.call(void 0, null),X=_react.useRef.call(void 0, z);return X.current=z,_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T||!N)return;let h=X.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),I=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",I);let $=c.onMapClick(f);return()=>{document.removeEventListener("keydown",I),$(),u.unmount(),D(null)}},[s,c,a,o.selection,N]),_jsxruntime.jsxs.call(void 0, "div",{ref:p,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&w?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, L,{entity:w.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),w.container):null]}),n!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-none absolute inset-0",children:_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-auto",children:n})})]})}var ye="gap";function Bt(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),r=Math.min(t-1,e+1),n=[1];i>2&&n.push(ye);for(let s=i;s<=r;s+=1)n.push(s);return r<t-1&&n.push(ye),n.push(t),n}function et(){let t=y(),{results:e,pagination:i}=F();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 r=t.options.pageSize,{pageIndex:n}=i,s=n+1,o=e.total!=null?Math.ceil(e.total/r):null,d=o!=null?s<o:e.nextCursor!=null||e.items.length>=r;if(o!=null?o<=1:n===0&&!d)return null;let p=l=>()=>{t.goToPage(l)};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||n===0,onClick:p(n-1),children:"\u2039"}),o!=null&&Bt(o,s).map((l,a)=>l===ye?_jsxruntime.jsx.call(void 0, "span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${a}`):_jsxruntime.jsx.call(void 0, "button",{type:"button",className:l===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${l}`,"aria-current":l===s?"page":void 0,disabled:i.loading,onClick:p(l-1),children:l},l)),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!d,onClick:p(n+1),children:"\u203A"})]})}function tt(){let{items:t,total:e}=K(),{ResultHeader:i}=P();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function it(t,e){let i=y(),r=_react.useRef.call(void 0, e);r.current=e,_react.useEffect.call(void 0, ()=>i.on(t,n=>r.current(n)),[i,t])}function nt(t){let{children:e,...i}=t,[r]=_react.useState.call(void 0, ()=>i),[n,s]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new ie({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(d=>d===o?null:d)}},[r]),n?_jsxruntime.jsx.call(void 0, re.Provider,{value:n,children:e}):null}function V(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 he({item:t,selected:e,onSelect:i}){let r=_nullishCoalesce(t, () => ({})),n=qt(e),s=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:r.title}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:V(r.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:n,children:s}):_jsxruntime.jsx.call(void 0, "article",{className:n,children:s})}function ve(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 be({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function Le(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 Te({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}function Fe({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:V(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 Ce({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function ke({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function we({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var at={Card:he,Marker:Te,Popup:Fe,Sidebar:ke,FilterPanel:be,Search:Ce,Empty:ve,Loading:Le,ResultHeader:Se,Toolbar:we};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, Yt,{}),"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, ei,{}),"Map"]})]})})}function Yt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",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 ei(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",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 pt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=_react.useRef.call(void 0, null),[o,d]=_react.useState.call(void 0, !1),[p,l]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){l(!1),d(!1);return}d(!0);let a=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(a)},[t]),_react.useEffect.call(void 0, ()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),_react.useEffect.call(void 0, ()=>{if(!o)return;_optionalChain([s, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]);function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:i}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, ri,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:r}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ri(){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 ct({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=P();return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[_jsxruntime.jsx.call(void 0, si,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),r&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:_nullishCoalesce(r.icon, () => (_jsxruntime.jsx.call(void 0, oi,{})))})]})}function si(){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 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","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 ai=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function li(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[r,n]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:b,scrollWidth:x}=s;i(b<=0),n(b+g>=x-1)},d=0,p=()=>{d||(d=requestAnimationFrame(()=>{d=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let l,a;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),_optionalChain([l, 'optionalAccess', _30 => _30.disconnect, 'call', _31 => _31()]),_optionalChain([a, 'optionalAccess', _32 => _32.disconnect, 'call', _33 => _33()]),d&&cancelAnimationFrame(d)}},[]),{atEnd:r,atStart:e,ref:t}}function di(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function ut({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:r,autoFetch:n=!0,hasMap:s,mapCenter:o,mapZoom:d,mapControls:p,mobileSheetFooter:l,className:a}){let g=y(),{Search:b}=P(),x=K(),{filters:C,set:c}=ne(),{pagination:L}=F(),N=_nullishCoalesce(s, () => (g.map!=null)),[k,z]=_react.useState.call(void 0, "list"),[w,D]=_react.useState.call(void 0, !1),{atEnd:X,atStart:T,ref:h}=li(),u=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{L.mode==="paged"&&u.current&&(u.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,I]=_react.useState.call(void 0, C),[$,R]=_react.useState.call(void 0, w);w!==$&&(R(w),w&&I(C));let Ne=ue=>I(ft=>({...ft,...ue})),[Re,Me]=_react.useState.call(void 0, !1),ce=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(Re){if(L.loading){ce.current=!0;return}ce.current&&(ce.current=!1,Me(!1),D(!1))}},[Re,L.loading]);let W=t?{value:String(_nullishCoalesce(C[t.filterKey], () => (""))),onChange:ue=>{c({[t.filterKey]:ue||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{n!==!1&&g.applyFilters({})},[g,n]);let De=()=>{Ne(g.filters.clearedParams())},_e=()=>{if(di(f,C)){D(!1);return}Me(!0),g.applyFilters(f)},gt=g.filters.activeKeys(C).length,Oe=_nullishCoalesce(x.total, () => (x.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:a?`rle-app ${a}`:"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:[W&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, b,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__slot",children:e}),_jsxruntime.jsx.call(void 0, ge,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!X&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, ct,{search:W,onFiltersClick:()=>D(!0),filterCount:gt,action:r}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":k,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",ref:u,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, tt,{}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:i})]}),_jsxruntime.jsx.call(void 0, Ge,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, et,{})]}),N&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, Ye,{center:o,zoom:d,fallback:ai,mapControls:p})})]}),N&&_jsxruntime.jsx.call(void 0, lt,{view:k,onViewChange:z}),_jsxruntime.jsx.call(void 0, pt,{title:"Filters",open:w,onOpenChange:D,footer:l?l({draft:f,apply:_e,clear:De,resultCount:Oe,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:De,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 ${Oe} results`})]}),children:_jsxruntime.jsx.call(void 0, ge,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Ne})})]})}function mt(t){return"provider"in t}function gi(t){let e=t!=null&&!mt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,d]=_react.useState.call(void 0, ()=>!t||mt(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _34 => _34.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:l})=>{p||d({ready:!0,provider:l({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function fi({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,it("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function On(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:d,search:p,filterBarStart:l,toolbarEnd:a,mapControls:g,mobileSheetFooter:b,config:x,autoFetch:C,className:c}=t,{ready:L,provider:N}=gi(r);if(!L)return null;let k=[];for(let D of e)k.push(Ue(D));i&&k.push(Ke(i)),N&&k.push(ze(N)),s&&k.push(Ve(s)),x&&k.push(Ae(x));let z=He(...k),w={...at,...n};return _jsxruntime.jsxs.call(void 0, nt,{...z,children:[o&&_jsxruntime.jsx.call(void 0, fi,{onFiltersChange:o}),_jsxruntime.jsx.call(void 0, $e,{...w,children:_jsxruntime.jsx.call(void 0, ut,{className:c,search:p,filterBarStart:l,toolbarEnd:a,mobileAction:d,autoFetch:C,mapCenter:_optionalChain([r, 'optionalAccess', _35 => _35.center]),mapZoom:_optionalChain([r, 'optionalAccess', _36 => _36.zoom]),mapControls:g,mobileSheetFooter:b})})]})}exports.a = J; exports.b = U; exports.c = Y; exports.d = ee; exports.e = Be; exports.f = te; exports.g = ie; exports.h = He; exports.i = Ae; exports.j = ze; exports.k = Ue; exports.l = Ke; exports.m = Ni; exports.n = Ve; exports.o = Ri; exports.p = me; exports.q = $e; exports.r = P; exports.s = re; exports.t = y; exports.u = F; exports.v = ne; exports.w = ge; exports.x = K; exports.y = Ge; exports.z = Ye; exports.A = et; exports.B = tt; exports.C = it; exports.D = nt; exports.E = he; exports.F = ve; exports.G = be; exports.H = Le; exports.I = Te; exports.J = Fe; exports.K = Se; exports.L = Ce; exports.M = ke; exports.N = we; exports.O = at; exports.P = lt; exports.Q = pt; exports.R = ut; exports.S = On;
|
package/dist/chunk-WIBKE6RD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var J=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 U=class{defs=new Map;add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>i.isActive?.(e)).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}};var Y=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 ee=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}};var Be={pagination:"paged",pageSize:20,debounceMs:250};var te=class{options;constructor(e){this.options=Object.freeze({...Be,...e})}};var ie=class{filters;map;datasets;primaryDatasetId;store;emitter=new ee;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;mapHandle=null;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new U,this.map=e.map,this.config=new te(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 J({filters:e.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e)}selectPoint(e,i){this.store.setSelection(i);let r=this.state.points[e]?.find(n=>n.id===i);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function He(...t){let e={config:{},filters:new U,datasets:new Y};for(let i of t)i(e);return e}var Ae=t=>e=>{e.config={...e.config,...t}},ze=t=>e=>{e.map=t},Ue=t=>e=>{e.datasets.add(t)},Ke=t=>e=>{t(e.filters)},Ni=t=>e=>{e.urlSync=t},Ve=t=>e=>{e.initialFilters=t},Ri=t=>e=>{e.primaryDatasetId=t};import{createContext as yt,useContext as ht}from"react";import{jsx as M,jsxs as It}from"react/jsx-runtime";function vt(t){return String(t?.title??"")}var bt=({item:t})=>M("div",{children:vt(t)}),Lt=()=>M("div",{}),me=()=>M("div",{}),Tt=({children:t})=>M("div",{children:t}),Pt=({children:t})=>M("div",{children:t}),Ft=({value:t,onChange:e,placeholder:i})=>M("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search"}),St=()=>M("div",{role:"status",children:"No results"}),Ct=()=>M("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),kt=({count:t})=>It("div",{children:[t," results"]}),wt=({children:t})=>M("div",{children:t}),E={Card:bt,Marker:Lt,Popup:me,Sidebar:Tt,FilterPanel:Pt,Search:Ft,Empty:St,Loading:Ct,ResultHeader:kt,Toolbar:wt},qe=yt(E);function $e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:d,Loading:p,ResultHeader:l,Toolbar:a,children:g}=t,b={Card:e??E.Card,Marker:i??E.Marker,Popup:r??E.Popup,Sidebar:n??E.Sidebar,FilterPanel:s??E.FilterPanel,Search:o??E.Search,Empty:d??E.Empty,Loading:p??E.Loading,ResultHeader:l??E.ResultHeader,Toolbar:a??E.Toolbar};return M(qe.Provider,{value:b,children:g})}function P(){return ht(qe)}import{createContext as Et}from"react";var re=Et(null);import{useContext as xt}from"react";function y(){let t=xt(re);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as We,useSyncExternalStore as Nt}from"react";function F(){let t=y(),e=We(r=>t.subscribe(r),[t]),i=We(()=>t.state,[t]);return Nt(e,i,i)}import{useCallback as je}from"react";function ne(){let t=y(),e=F(),i=je(n=>t.applyFilters(n),[t]),r=je((n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}import{jsx as j,jsxs as Rt}from"react/jsx-runtime";function ge({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=y(),{FilterPanel:o}=P(),{filters:d}=ne(),p=r!==void 0&&n!==void 0,l=p?r:d;return j(o,{children:j("div",{className:t??"space-y-5",children:s.filters.list().map(a=>{if(typeof a.render=="string")return j("div",{"data-filter":a.key,className:e},a.key);let g=a.render;return Rt("div",{className:e,children:[a.label&&!i&&j("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),j(g,{value:a.fromParams(l),onChange:b=>p?n(a.toParams(b)):void s.applyFilters(a.toParams(b))})]},a.key)})})})}function K(){return F().results}import{jsx as se}from"react/jsx-runtime";function Mt(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 Ge({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:d}=P();return r.loading&&i.length===0?se(d,{}):i.length===0?se(o,{}):se("div",{role:"list",className:t,children:i.map((p,l)=>{let a=Mt(p,l);return se(s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}import{useEffect as G,useRef as B,useState as Qe}from"react";import{createPortal as Dt}from"react-dom";import{jsx as fe,jsxs as Je}from"react/jsx-runtime";var _t={west:-179.9,south:-85,east:179.9,north:85},Ze=.1,Xe=.02;function Ot(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:d,lng:p}of t)p<e&&(e=p),p>i&&(i=p),d<r&&(r=d),d>n&&(n=d);let s=n>r?(n-r)*Ze:Xe,o=i>e?(i-e)*Ze:Xe;return{west:e-o,east:i+o,south:r-s,north:n+s}}function Ye(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=y(),o=F(),d=B(null),p=B(null),l=B(null),[a,g]=Qe(!1),b=B(!1),x=B(!1),C=B(!1),c=s.map;G(()=>{let T=l.current;if(!c||!T)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let f=s.datasets.get(u),I=o.points[u]??[],$={id:u,markers:I.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(u,R)};h.push(c.renderLayer(T,$))}return()=>{h.forEach(u=>u())}},[s,c,a,o.points,o.layers]),G(()=>{if(!d.current||!c)return;let T=d.current,h=!1,u=null;return(async()=>{let f=await c.mount(T,{center:e,zoom:i,fullscreenTarget:p.current??void 0});if(h){c.destroy(f);return}l.current=f,s.setMapHandle(f),u=c.onBoundsChange(f,I=>{C.current?C.current=!1:x.current=!0,s.loadPoints(I)}),g(!0),s.loadPoints(_t)})(),()=>{h=!0,u?.(),l.current&&(c.destroy(l.current),l.current=null,s.setMapHandle(null)),g(!1)}},[s,c]),G(()=>{let T=l.current;if(!c||!T||e||b.current||x.current)return;let h=[];for(let f of Object.keys(o.points))if(o.layers[f]!==!1)for(let I of o.points[f]??[])h.push(I.position);let u=Ot(h);u&&(b.current=!0,C.current=!0,c.fitBounds(T,u))},[c,e,a,o.points,o.layers]),G(()=>{c?.updateMarkerStates(o.selection,o.hovered)},[c,a,o.selection,o.hovered]);let{Popup:L}=P(),N=L!==me,k=o.points[s.primaryDatasetId]??[],z=o.selection!=null?k.find(T=>T.id===o.selection):void 0,[w,D]=Qe(null),X=B(z);return X.current=z,G(()=>{let T=l.current;if(!c||!T||!N)return;let h=X.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),I=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",I);let $=c.onMapClick(f);return()=>{document.removeEventListener("keydown",I),$(),u.unmount(),D(null)}},[s,c,a,o.selection,N]),Je("div",{ref:p,className:"relative h-full min-h-0 w-full",children:[Je("div",{ref:d,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&w?Dt(fe(L,{entity:w.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),w.container):null]}),n!=null&&fe("div",{className:"pointer-events-none absolute inset-0",children:fe("div",{className:"pointer-events-auto",children:n})})]})}import{jsx as Q,jsxs as Ht}from"react/jsx-runtime";var ye="gap";function Bt(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),r=Math.min(t-1,e+1),n=[1];i>2&&n.push(ye);for(let s=i;s<=r;s+=1)n.push(s);return r<t-1&&n.push(ye),n.push(t),n}function et(){let t=y(),{results:e,pagination:i}=F();if(i.mode==="infinite")return e.nextCursor==null?null:Q("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let r=t.options.pageSize,{pageIndex:n}=i,s=n+1,o=e.total!=null?Math.ceil(e.total/r):null,d=o!=null?s<o:e.nextCursor!=null||e.items.length>=r;if(o!=null?o<=1:n===0&&!d)return null;let p=l=>()=>{t.goToPage(l)};return Ht("nav",{className:"rle-pagination","aria-label":"Pagination",children:[Q("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||n===0,onClick:p(n-1),children:"\u2039"}),o!=null&&Bt(o,s).map((l,a)=>l===ye?Q("span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${a}`):Q("button",{type:"button",className:l===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${l}`,"aria-current":l===s?"page":void 0,disabled:i.loading,onClick:p(l-1),children:l},l)),Q("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!d,onClick:p(n+1),children:"\u203A"})]})}import{jsx as At}from"react/jsx-runtime";function tt(){let{items:t,total:e}=K(),{ResultHeader:i}=P();return At(i,{count:t.length,total:e})}import{useEffect as zt,useRef as Ut}from"react";function it(t,e){let i=y(),r=Ut(e);r.current=e,zt(()=>i.on(t,n=>r.current(n)),[i,t])}import{useEffect as Kt,useState as rt}from"react";import{jsx as Vt}from"react/jsx-runtime";function nt(t){let{children:e,...i}=t,[r]=rt(()=>i),[n,s]=rt(null);return Kt(()=>{let o=new ie({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(d=>d===o?null:d)}},[r]),n?Vt(re.Provider,{value:n,children:e}):null}function V(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as $t,jsx as _,jsxs as st}from"react/jsx-runtime";function qt(t){return t?"rle-card rle-card--selected":"rle-card"}function he({item:t,selected:e,onSelect:i}){let r=t??{},n=qt(e),s=st($t,{children:[r.imageUrl?_("img",{src:r.imageUrl,alt:r.title??"",className:"rle-card-media"}):_("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),st("div",{className:"rle-card-body",children:[r.title&&_("span",{className:"rle-card-title",children:r.title}),r.subtitle&&_("span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_("div",{className:"rle-card-info",children:_("span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_("span",{className:"rle-card-price",children:V(r.price)})]})]});return i?_("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:n,children:s}):_("article",{className:n,children:s})}import{jsx as oe,jsxs as ot}from"react/jsx-runtime";function ve(t){return ot("div",{role:"status",className:"rle-empty",children:[ot("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:[oe("circle",{cx:"11",cy:"11",r:"7"}),oe("path",{d:"m21 21-4.3-4.3"})]}),oe("p",{className:"rle-empty-title",children:"No results"}),oe("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Wt}from"react/jsx-runtime";function be({children:t}){return Wt("div",{className:"rle-filter-panel",children:t})}import{jsx as ae,jsxs as jt}from"react/jsx-runtime";function Le(t){return ae("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:[ae("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),ae("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),ae("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as Gt}from"react/jsx-runtime";function Te({point:t}){let e=t.entity??{};return Gt("span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}import{jsx as q,jsxs as Pe}from"react/jsx-runtime";function Fe({entity:t,onClose:e}){let i=t??{};return Pe("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[q("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children: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:[q("path",{d:"M18 6 6 18"}),q("path",{d:"m6 6 12 12"})]})}),Pe("div",{children:[i.title&&q("div",{className:"rle-card-title",children:i.title}),i.subtitle&&q("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&q("div",{className:"rle-card-price",children:V(i.price)})]})]})}import{jsx as Qt}from"react/jsx-runtime";function Se({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return Qt("div",{className:"rle-result-header",children:i})}import{jsx as Zt}from"react/jsx-runtime";function Ce({value:t,onChange:e,placeholder:i}){return Zt("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as Xt}from"react/jsx-runtime";function ke({children:t}){return Xt("aside",{className:"rle-sidebar",children:t})}import{jsx as Jt}from"react/jsx-runtime";function we({children:t}){return Jt("div",{className:"rle-toolbar",children:t})}var at={Card:he,Marker:Te,Popup:Fe,Sidebar:ke,FilterPanel:be,Search:Ce,Empty:ve,Loading:Le,ResultHeader:Se,Toolbar:we};import{jsx as S,jsxs as Z}from"react/jsx-runtime";function lt({view:t,onViewChange:e}){return S("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:Z("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[Z("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[S(Yt,{}),"List"]}),Z("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[S(ei,{}),"Map"]})]})})}function Yt(){return Z("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:[S("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),S("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),S("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),S("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),S("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),S("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function ei(){return Z("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:[S("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),S("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),S("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}import{useEffect as Ie,useRef as ti,useState as dt}from"react";import{createPortal as ii}from"react-dom";import{Fragment as ni,jsx as O,jsxs as le}from"react/jsx-runtime";function pt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=ti(null),[o,d]=dt(!1),[p,l]=dt(!1);return Ie(()=>{if(!t){l(!1),d(!1);return}d(!0);let a=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(a)},[t]),Ie(()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),Ie(()=>{if(!o)return;s.current?.focus();function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:ii(le(ni,{children:[O("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),le("div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[O("div",{className:"rle-sheet__handle","aria-hidden":"true"}),le("div",{className:"rle-sheet__header",children:[i&&O("div",{className:"rle-sheet__title",children:i}),O("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:O(ri,{})})]}),O("div",{className:"rle-sheet__body",children:r}),n&&O("div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ri(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[O("path",{d:"M18 6 6 18"}),O("path",{d:"m6 6 12 12"})]})}import{useEffect as pe,useRef as Ee,useState as A}from"react";import{jsx as v,jsxs as de}from"react/jsx-runtime";function ct({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=P();return de("header",{className:"rle-mobile-header",children:[t&&v("div",{className:"rle-mobile-header__search",children:v(n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),de("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[v(si,{}),v("span",{children:"Filters"}),i>0&&v("span",{className:"rle-mobile-header__count",children:i})]}),r&&v("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:r.icon??v(oi,{})})]})}function si(){return de("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:[v("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),v("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),v("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),v("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function oi(){return de("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:[v("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{Fragment as pi,jsx as m,jsxs as H}from"react/jsx-runtime";var ai=m("div",{className:"rle-empty",children:"Map unavailable"});function li(){let t=Ee(null),[e,i]=A(!0),[r,n]=A(!0);return pe(()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:b,scrollWidth:x}=s;i(b<=0),n(b+g>=x-1)},d=0,p=()=>{d||(d=requestAnimationFrame(()=>{d=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let l,a;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),l?.disconnect(),a?.disconnect(),d&&cancelAnimationFrame(d)}},[]),{atEnd:r,atStart:e,ref:t}}function di(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function ut({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:r,autoFetch:n=!0,hasMap:s,mapCenter:o,mapZoom:d,mapControls:p,mobileSheetFooter:l,className:a}){let g=y(),{Search:b}=P(),x=K(),{filters:C,set:c}=ne(),{pagination:L}=F(),N=s??g.map!=null,[k,z]=A("list"),[w,D]=A(!1),{atEnd:X,atStart:T,ref:h}=li(),u=Ee(null);pe(()=>{L.mode==="paged"&&u.current&&(u.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,I]=A(C),[$,R]=A(w);w!==$&&(R(w),w&&I(C));let Ne=ue=>I(ft=>({...ft,...ue})),[Re,Me]=A(!1),ce=Ee(!1);pe(()=>{if(Re){if(L.loading){ce.current=!0;return}ce.current&&(ce.current=!1,Me(!1),D(!1))}},[Re,L.loading]);let W=t?{value:String(C[t.filterKey]??""),onChange:ue=>{c({[t.filterKey]:ue||void 0})},placeholder:t.placeholder}:void 0;pe(()=>{n!==!1&&g.applyFilters({})},[g,n]);let De=()=>{Ne(g.filters.clearedParams())},_e=()=>{if(di(f,C)){D(!1);return}Me(!0),g.applyFilters(f)},gt=g.filters.activeKeys(C).length,Oe=x.total??x.items.length;return H("div",{className:a?`rle-app ${a}`:"rle-app",children:[H("div",{className:"rle-filter-bar",children:[H("div",{className:"rle-filter-bar__scroll",ref:h,children:[W&&m("div",{className:"rle-filter-bar__search",children:m(b,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),e&&m("div",{className:"rle-filter-bar__slot",children:e}),m(ge,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!X&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),m(ct,{search:W,onFiltersClick:()=>D(!0),filterCount:gt,action:r}),H("div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":k,children:[H("div",{className:"rle-list",ref:u,children:[H("div",{className:"rle-list-header",children:[m(tt,{}),i&&m("div",{className:"rle-list-header__toolbar",children:i})]}),m(Ge,{className:"rle-list-grid"}),m(et,{})]}),N&&m("div",{className:"rle-map",children:m(Ye,{center:o,zoom:d,fallback:ai,mapControls:p})})]}),N&&m(lt,{view:k,onViewChange:z}),m(pt,{title:"Filters",open:w,onOpenChange:D,footer:l?l({draft:f,apply:_e,clear:De,resultCount:Oe,loading:L.loading}):H(pi,{children:[m("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:De,children:"Clear all"}),m("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:_e,children:L.loading?m("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${Oe} results`})]}),children:m(ge,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Ne})})]})}import{useEffect as ci,useRef as ui,useState as mi}from"react";import{jsx as xe,jsxs as yi}from"react/jsx-runtime";function mt(t){return"provider"in t}function gi(t){let e=t!=null&&!mt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,d]=mi(()=>!t||mt(t)?{ready:!0,provider:t?.provider}:{ready:!1});return ci(()=>{if(!i)return;let p=!1;return import("./maps/google/index.js").then(({googleProvider:l})=>{p||d({ready:!0,provider:l({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function fi({onFiltersChange:t}){let e=ui(t);return e.current=t,it("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function On(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:d,search:p,filterBarStart:l,toolbarEnd:a,mapControls:g,mobileSheetFooter:b,config:x,autoFetch:C,className:c}=t,{ready:L,provider:N}=gi(r);if(!L)return null;let k=[];for(let D of e)k.push(Ue(D));i&&k.push(Ke(i)),N&&k.push(ze(N)),s&&k.push(Ve(s)),x&&k.push(Ae(x));let z=He(...k),w={...at,...n};return yi(nt,{...z,children:[o&&xe(fi,{onFiltersChange:o}),xe($e,{...w,children:xe(ut,{className:c,search:p,filterBarStart:l,toolbarEnd:a,mobileAction:d,autoFetch:C,mapCenter:r?.center,mapZoom:r?.zoom,mapControls:g,mobileSheetFooter:b})})]})}export{J as a,U as b,Y as c,ee as d,Be as e,te as f,ie as g,He as h,Ae as i,ze as j,Ue as k,Ke as l,Ni as m,Ve as n,Ri as o,me as p,$e as q,P as r,re as s,y as t,F as u,ne as v,ge as w,K as x,Ge as y,Ye as z,et as A,tt as B,it as C,nt as D,he as E,ve as F,be as G,Le as H,Te as I,Fe as J,Se as K,Ce as L,ke as M,we as N,at as O,lt as P,pt as Q,ut as R,On as S};
|