react-listing-engine 0.7.19 → 0.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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 _chunkLYKLUZIJcjs = require('./chunk-LYKLUZIJ.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}=_chunkLYKLUZIJcjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunkLYKLUZIJcjs.t.call(void 0, ),t=_chunkLYKLUZIJcjs.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=_chunkLYKLUZIJcjs.t.call(void 0, ),r=_chunkLYKLUZIJcjs.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 = _chunkLYKLUZIJcjs.c; exports.FallbackPopup = _chunkLYKLUZIJcjs.p; exports.FilterRegistry = _chunkLYKLUZIJcjs.b; exports.ListingApp = _chunkLYKLUZIJcjs.S; exports.ListingComponentsProvider = _chunkLYKLUZIJcjs.q; exports.ListingConfig = _chunkLYKLUZIJcjs.f; exports.ListingEngine = _chunkLYKLUZIJcjs.g; exports.ListingEngineContext = _chunkLYKLUZIJcjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunkLYKLUZIJcjs.w; exports.ListingList = _chunkLYKLUZIJcjs.y; exports.ListingMap = _chunkLYKLUZIJcjs.z; exports.ListingPagination = _chunkLYKLUZIJcjs.A; exports.ListingProvider = _chunkLYKLUZIJcjs.D; exports.ListingResultHeader = _chunkLYKLUZIJcjs.B; exports.ListingStore = _chunkLYKLUZIJcjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunkLYKLUZIJcjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunkLYKLUZIJcjs.h; exports.listingDefaultConfig = _chunkLYKLUZIJcjs.e; exports.useListing = _chunkLYKLUZIJcjs.t; exports.useListingComponents = _chunkLYKLUZIJcjs.r; exports.useListingEvent = _chunkLYKLUZIJcjs.C; exports.useListingFilters = _chunkLYKLUZIJcjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunkLYKLUZIJcjs.x; exports.useListingState = _chunkLYKLUZIJcjs.u; exports.withConfig = _chunkLYKLUZIJcjs.i; exports.withDataset = _chunkLYKLUZIJcjs.k; exports.withFilters = _chunkLYKLUZIJcjs.l; exports.withInitialFilters = _chunkLYKLUZIJcjs.n; exports.withMap = _chunkLYKLUZIJcjs.j; exports.withPrimaryDataset = _chunkLYKLUZIJcjs.o; exports.withUrlSync = _chunkLYKLUZIJcjs.m;
2
+ var _chunkXK2MJTU2cjs = require('./chunk-XK2MJTU2.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}=_chunkXK2MJTU2cjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunkXK2MJTU2cjs.t.call(void 0, ),t=_chunkXK2MJTU2cjs.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=_chunkXK2MJTU2cjs.t.call(void 0, ),r=_chunkXK2MJTU2cjs.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 = _chunkXK2MJTU2cjs.c; exports.FallbackPopup = _chunkXK2MJTU2cjs.p; exports.FilterRegistry = _chunkXK2MJTU2cjs.b; exports.ListingApp = _chunkXK2MJTU2cjs.S; exports.ListingComponentsProvider = _chunkXK2MJTU2cjs.q; exports.ListingConfig = _chunkXK2MJTU2cjs.f; exports.ListingEngine = _chunkXK2MJTU2cjs.g; exports.ListingEngineContext = _chunkXK2MJTU2cjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunkXK2MJTU2cjs.w; exports.ListingList = _chunkXK2MJTU2cjs.y; exports.ListingMap = _chunkXK2MJTU2cjs.z; exports.ListingPagination = _chunkXK2MJTU2cjs.A; exports.ListingProvider = _chunkXK2MJTU2cjs.D; exports.ListingResultHeader = _chunkXK2MJTU2cjs.B; exports.ListingStore = _chunkXK2MJTU2cjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunkXK2MJTU2cjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunkXK2MJTU2cjs.h; exports.listingDefaultConfig = _chunkXK2MJTU2cjs.e; exports.useListing = _chunkXK2MJTU2cjs.t; exports.useListingComponents = _chunkXK2MJTU2cjs.r; exports.useListingEvent = _chunkXK2MJTU2cjs.C; exports.useListingFilters = _chunkXK2MJTU2cjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunkXK2MJTU2cjs.x; exports.useListingState = _chunkXK2MJTU2cjs.u; exports.withConfig = _chunkXK2MJTU2cjs.i; exports.withDataset = _chunkXK2MJTU2cjs.k; exports.withFilters = _chunkXK2MJTU2cjs.l; exports.withInitialFilters = _chunkXK2MJTU2cjs.n; exports.withMap = _chunkXK2MJTU2cjs.j; exports.withPrimaryDataset = _chunkXK2MJTU2cjs.o; exports.withUrlSync = _chunkXK2MJTU2cjs.m;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{A as V,B as W,C as X,D as Y,S as P,a as Q,b as x,c as T,d as L,e as O,f as H,g as E,h as k,i as q,j as B,k as C,l as I,m as U,n as z,o as G,p as R,q as $,r as d,s as j,t as u,u as y,v as A,w as D,x as J,y as K,z as N}from"./chunk-L7SBPTPY.js";var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var h=class{query;listeners=new Set;constructor(t={}){this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}};function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var f=class{history;toQueryFn;toFiltersFn;hydrateOnStart;isSyncing=!1;unsubscribeEngine=null;unsubscribeHistory=null;constructor(t){this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=t.hydrateOnStart??!0}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){this.unsubscribeEngine?.(),this.unsubscribeEngine=null,this.unsubscribeHistory?.(),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}};var m=class{mode;constructor(t={}){this.mode=t.mode??"replace"}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};import{jsx as w}from"react/jsx-runtime";function st({children:e}){let{Toolbar:t}=d();return w(t,{children:e})}import{useCallback as a}from"react";function ut(){let e=u(),t=y(),r=a(n=>e.loadPoints(n),[e]),s=a((n,p)=>e.selectPoint(n,p),[e]),o=a(n=>e.setHovered(e.primaryDatasetId,n),[e]),i=a(()=>e.map?.zoomIn(),[e]),c=a(()=>e.map?.zoomOut(),[e]),l=a(()=>e.map?.toggleFullscreen(),[e]),g=a((n,p)=>e.fitBounds(n,p),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:g}}import{useCallback as S}from"react";function ht(e){let t=u(),r=y(),s=S(()=>t.toggleLayer(e),[t,e]);return{visible:r.layers[e]??!0,points:r.points[e]??[],toggle:s}}export{m as BrowserHistoryPort,T as DatasetRegistry,R as FallbackPopup,x as FilterRegistry,P as ListingApp,$ as ListingComponentsProvider,H as ListingConfig,E as ListingEngine,j as ListingEngineContext,v as ListingEventType,D as ListingFilters,K as ListingList,N as ListingMap,V as ListingPagination,Y as ListingProvider,W as ListingResultHeader,Q as ListingStore,st as ListingToolbar,h as MemoryHistoryPort,b as PaginationMode,L as TypedEmitter,f as UrlSyncController,k as composeListingProviders,O as listingDefaultConfig,u as useListing,d as useListingComponents,X as useListingEvent,A as useListingFilters,ht as useListingLayer,ut as useListingMap,J as useListingResults,y as useListingState,q as withConfig,C as withDataset,I as withFilters,z as withInitialFilters,B as withMap,G as withPrimaryDataset,U as withUrlSync};
2
+ import{A as V,B as W,C as X,D as Y,S as P,a as Q,b as x,c as T,d as L,e as O,f as H,g as E,h as k,i as q,j as B,k as C,l as I,m as U,n as z,o as G,p as R,q as $,r as d,s as j,t as u,u as y,v as A,w as D,x as J,y as K,z as N}from"./chunk-VJIEENMM.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,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 $="DEMO_MAP_ID";function v(e){return e.raw}function j(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var T=12,N="#b3261e";function K(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let r=document.createElement("div");return r.style.width=`${T}px`,r.style.height=`${T}px`,r.style.borderRadius="50%",r.style.backgroundColor=N,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var h;function J(){if(h)return h;class e extends google.maps.OverlayView{constructor(t,i,s,n){super();e.prototype.__init.call(this);;this.position=t;this.content=i;this.onClick=s;this.lifecycle=n}__init() {this.div=null}onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,_optionalChain([this, 'access', _2 => _2.getPanes, 'call', _3 => _3(), 'optionalAccess', _4 => _4.overlayMouseTarget, 'access', _5 => _5.appendChild, 'call', _6 => _6(t)]),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let i=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));i&&(this.div.style.left=`${i.x}px`,this.div.style.top=`${i.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 h=e,h}var L=14,Q=8;function ee(e){let{anchorX:r,anchorY:l,popupW:t,popupH:i,mapW:s,mapH:n,offsetY:o,pad:a}=e,c=r-t/2,d=r+t/2,p=0;t>s-a*2?p=a-c:d>s-a?p=s-a-d:c<a&&(p=a-c);let u=l-o-i,f=l+o+i,m=u<a&&f<=n-a;return{dx:p,flipBelow:m}}var k;function te(){if(k)return k;class e extends google.maps.OverlayView{constructor(t,i,s){super();e.prototype.__init2.call(this);e.prototype.__init3.call(this);;this.container=t;this.position=i;this.mapContainerEl=s}__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 i=new google.maps.LatLng(this.position.lat,this.position.lng),s=t.fromLatLngToDivPixel(i);if(!s)return;if(this.clampOffset===null){let a=this.container.offsetWidth,c=this.container.offsetHeight,d=a&&c?t.fromLatLngToContainerPixel(i):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${s.x}px`,this.container.style.top=`${s.y-L}px`;return}this.clampOffset=ee({anchorX:d.x,anchorY:d.y,popupW:a,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:L,pad:Q})}let{dx:n,flipBelow:o}=this.clampOffset;this.container.style.left=`${s.x+n}px`,o?(this.container.style.top=`${s.y+L}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.y-L}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 k=e,k}function w(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var ne="#b3261e",re=40,oe=64,ae=14;function ie(e,r){let l=r.count,t=Math.min(oe,re+Math.round(Math.log10(l+1)*ae)),i=document.createElement("div");return i.textContent=String(l),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.width=`${t}px`,i.style.height=`${t}px`,i.style.borderRadius="50%",i.style.backgroundColor=ne,i.style.border="2px solid #ffffff",i.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",i.style.color="#ffffff",i.style.fontFamily="inherit",i.style.fontWeight="700",i.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:r.position,content:i})}var S=!1;async function se(e,r,l,t){let i;try{i=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(n){S||(S=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(r)!==l)return;let s=new i.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>ie(e.markerLib,n)}});e.clusterers.set(r,s)}function I(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var z=!1;function le(){z||(z=!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 ce(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:j(l,e.markerLib),gmpClickable:!!r.onMarkerClick});if(r.onMarkerClick){let i=r.onMarkerClick;t.addListener("click",()=>i(l.id))}return t})}function Z(e,r,l,t){e.classList.toggle("rle-marker--selected",r===l),e.classList.toggle("rle-marker--hovered",r===t&&r!==l)}function de(e,r){let l=J();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,K(t),s,{onContainerAdd:o=>{e.markerElements.set(t.id,o),Z(o,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:o=>{e.markerElements.get(t.id)===o&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function W(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function pe(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var b=256,G=450,ue=1500,B=260,me=4,fe=5,Y=3,Me=650,ge=1400,ye=600,ve=2400,he=.75,Le=4;function O(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:b*(.5+r/360),y:b*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function V(e){let r=Math.PI-2*Math.PI*e.y/b;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/b-.5)*360}}function ke(e,r,l){let t=O(e.north,e.east),i=O(e.south,e.west),s=Math.abs(t.x-i.x),n=Math.abs(t.y-i.y);return s===0||n===0||r===0||l===0?null:{center:V({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function Ee(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function E(e,r,l,t,i,s){let n=performance.now(),o,a=()=>{let c=Math.min(1,(performance.now()-n)/t),d=Ee(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter(V({x:r.x+(l.x-r.x)*d,y:r.y+(l.y-r.y)*d})),c<1?o=requestAnimationFrame(a):(e.cancelFlight=null,_optionalChain([s, 'optionalCall', _15 => _15()]))};return o=requestAnimationFrame(a),()=>cancelAnimationFrame(o)}function be(e,r,l){if(typeof ResizeObserver>"u")return;let t=!1,i=()=>{let{width:n,height:o}=e.getBoundingClientRect();n===0||o===0||(google.maps.event.trigger(r,"resize"),t||(t=!0,r.setCenter(l)))},s=new ResizeObserver(i);return s.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(i):queueMicrotask(i),s}function Oe(e){if(!e.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, {...e.loaderOptions,key:e.apiKey}),r=!0)},t,i=0;return{async mount(s,n){let o=++i;l();let a=await _jsapiloader.importLibrary.call(void 0, "maps"),c=await _jsapiloader.importLibrary.call(void 0, "marker"),d=_nullishCoalesce(n.center, () => ({lat:0,lng:0})),p=e.styles!=null||e.overlayMarkers===!0,u=new a.Map(s,{...e.mapOptions,center:d,zoom:_nullishCoalesce(n.zoom, () => (10)),...p?e.styles!=null?{styles:e.styles}:{}:{mapId:_nullishCoalesce(e.mapId, () => ($))}}),f=be(s,u,d),m={map:u,containerEl:s,fullscreenEl:_nullishCoalesce(n.fullscreenTarget, () => (s)),markerLib:c,markerMode:p?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:f,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return o===i&&(t=m),{raw:m}},renderLayer(s,n){let o=v(s),a=o.layers.get(n.id);a&&(w(a),o.layers.delete(n.id),W(o,n.id)),I(o,n.id);let c=o.markerMode==="overlay"?de(o,n):ce(o,n);o.layers.set(n.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(n.id,n.markers.map(p=>p.id)),n.clustering&&(o.markerMode==="overlay"?le():se(o,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(n.id)===c&&(w(c),o.layers.delete(n.id),I(o,n.id),W(o,n.id)))}},onBoundsChange(s,n){let o=v(s),a=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&n(pe(d))});o.boundsListeners.add(a);let c=!1;return()=>{c||(c=!0,a.remove(),o.boundsListeners.delete(a))}},onMapClick(s){let n=t;if(!n)return()=>{};let o=n.map.addListener("click",()=>s());n.clickListeners.add(o);let a=!1;return()=>{a||(a=!0,o.remove(),n.clickListeners.delete(o))}},fitBounds(s,n,o){let a=v(s);if(_optionalChain([a, 'access', _16 => _16.cancelFlight, 'optionalCall', _17 => _17()]),a.cancelFlight=null,!_optionalChain([o, 'optionalAccess', _18 => _18.animate])){a.map.fitBounds(n);return}let c=a.map.getZoom(),d=a.map.getCenter(),p=ke(n,a.containerEl.clientWidth,a.containerEl.clientHeight);if(c==null||!d||!p){a.map.fitBounds(n);return}a.map.setOptions({isFractionalZoomEnabled:!0});let u={...O(d.lat(),d.lng()),zoom:c},f=O(p.center.lat,p.center.lng),m={...f,zoom:p.zoom},C=Math.hypot(m.x-u.x,m.y-u.y)*2**Math.min(u.zoom,m.zoom),g=Math.max(a.containerEl.clientWidth,a.containerEl.clientHeight);if(C>g*me){let H=Math.hypot(m.x-u.x,m.y-u.y);if((typeof a.map.getRenderingType=="function"?a.map.getRenderingType():void 0)==="VECTOR"&&H>0){let M=Math.max(Math.log2(g*he/H),Y),y=Math.max(0,(u.zoom+m.zoom)/2-M),X=Math.min(ve,G+y*B);a.cancelFlight=E(a,u,m,X,y);return}let x=Math.min(Math.max(p.zoom-fe,Y),p.zoom),D={x:u.x,y:u.y},A=()=>{P();let M=_nullishCoalesce(a.map.getZoom(), () => (x));a.cancelFlight=E(a,{...f,zoom:M},m,ge,0)},F=()=>{a.map.setCenter(p.center);let M=a.map.addListener("tilesloaded",A),y=setTimeout(A,ye);P=()=>{M.remove(),clearTimeout(y)},a.cancelFlight=P},P=()=>{};u.zoom>x+.3?a.cancelFlight=E(a,u,{...D,zoom:x},Me,0,F):F();return}let _=C>g?Math.min(Le,Math.log2(C/g)+1):0,U=Math.min(ue,G+_*B);a.cancelFlight=E(a,u,m,U,_)},destroy(s){let n=v(s);_optionalChain([n, 'access', _19 => _19.resizeObserver, 'optionalAccess', _20 => _20.disconnect, 'call', _21 => _21()]),_optionalChain([n, 'access', _22 => _22.cancelFlight, 'optionalCall', _23 => _23()]),n.cancelFlight=null;for(let o of n.boundsListeners)o.remove();n.boundsListeners.clear();for(let o of n.clickListeners)o.remove();n.clickListeners.clear();for(let o of[...n.clusterers.keys()])I(n,o);for(let o of n.layers.values())w(o);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(s,n){if(t){t.selectedMarkerId=s,t.hoveredMarkerId=n;for(let[o,a]of t.markerElements)Z(a,o,s,n)}},mountOverlay(s){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let o=te(),a=new o(n,s,t.containerEl);return a.setMap(t.map),{container:n,setPosition:c=>a.updatePosition(c),unmount:()=>{a.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))+1)},zoomOut(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))-1)},toggleFullscreen(){if(!t)return;let s=t.fullscreenEl,n=document.fullscreenElement;n!=null&&s.contains(n)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _24 => _24.exitFullscreen, 'call', _25 => _25(), 'optionalAccess', _26 => _26.catch, 'call', _27 => _27(()=>{})]):typeof s.requestFullscreen=="function"&&_optionalChain([s, 'access', _28 => _28.requestFullscreen, 'call', _29 => _29(), 'optionalAccess', _30 => _30.catch, 'call', _31 => _31(()=>{})])}}}exports.googleProvider = Oe;
2
+ var _jsapiloader = require('@googlemaps/js-api-loader');var ee="DEMO_MAP_ID";function h(e){return e.raw}function te(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var G=12,ne="#b3261e";function re(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let r=document.createElement("div");return r.style.width=`${G}px`,r.style.height=`${G}px`,r.style.borderRadius="50%",r.style.backgroundColor=ne,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var L;function oe(){if(L)return L;class e extends google.maps.OverlayView{constructor(t,i,s,n){super();e.prototype.__init.call(this);;this.position=t;this.content=i;this.onClick=s;this.lifecycle=n}__init() {this.div=null}onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,_optionalChain([this, 'access', _2 => _2.getPanes, 'call', _3 => _3(), 'optionalAccess', _4 => _4.overlayMouseTarget, 'access', _5 => _5.appendChild, 'call', _6 => _6(t)]),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let i=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));i&&(this.div.style.left=`${i.x}px`,this.div.style.top=`${i.y}px`)}onRemove(){let t=this.div;_optionalChain([this, 'access', _7 => _7.div, 'optionalAccess', _8 => _8.remove, 'call', _9 => _9()]),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return L=e,L}var k=14,ae=8;function ie(e){let{anchorX:r,anchorY:l,popupW:t,popupH:i,mapW:s,mapH:n,offsetY:a,pad:o}=e,c=r-t/2,d=r+t/2,u=0;t>s-o*2?u=o-c:d>s-o?u=s-o-d:c<o&&(u=o-c);let p=l-a-i,f=l+a+i,m=p<o&&f<=n-o;return{dx:u,flipBelow:m}}var E;function se(){if(E)return E;class e extends google.maps.OverlayView{constructor(t,i,s){super();e.prototype.__init2.call(this);e.prototype.__init3.call(this);;this.container=t;this.position=i;this.mapContainerEl=s}__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 i=new google.maps.LatLng(this.position.lat,this.position.lng),s=t.fromLatLngToDivPixel(i);if(!s)return;if(this.clampOffset===null){let o=this.container.offsetWidth,c=this.container.offsetHeight,d=o&&c?t.fromLatLngToContainerPixel(i):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${s.x}px`,this.container.style.top=`${s.y-k}px`;return}this.clampOffset=ie({anchorX:d.x,anchorY:d.y,popupW:o,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:k,pad:ae})}let{dx:n,flipBelow:a}=this.clampOffset;this.container.style.left=`${s.x+n}px`,a?(this.container.style.top=`${s.y+k}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.y-k}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 E=e,E}function _(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var le="#b3261e",ce=40,de=64,pe=14;function ue(e,r){let l=r.count,t=Math.min(de,ce+Math.round(Math.log10(l+1)*pe)),i=document.createElement("div");return i.textContent=String(l),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.width=`${t}px`,i.style.height=`${t}px`,i.style.borderRadius="50%",i.style.backgroundColor=le,i.style.border="2px solid #ffffff",i.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",i.style.color="#ffffff",i.style.fontFamily="inherit",i.style.fontWeight="700",i.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:r.position,content:i})}var B=!1;async function me(e,r,l,t){let i;try{i=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(n){B||(B=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(r)!==l)return;let s=new i.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>ue(e.markerLib,n)}});e.clusterers.set(r,s)}function F(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var Y=!1;function fe(){Y||(Y=!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 Me(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:te(l,e.markerLib),gmpClickable:!!r.onMarkerClick});if(r.onMarkerClick){let i=r.onMarkerClick;t.addListener("click",()=>i(l.id))}return t})}function q(e,r,l,t){e.classList.toggle("rle-marker--selected",r===l),e.classList.toggle("rle-marker--hovered",r===t&&r!==l)}function ge(e,r){let l=oe();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,re(t),s,{onContainerAdd:a=>{e.markerElements.set(t.id,a),q(a,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:a=>{e.markerElements.get(t.id)===a&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function Z(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function ye(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var b=256,ve=450,he=1500,Le=260,ke=4,Ee=5,V=5,U=700,be=450,D=1500,Oe=600,Ce=5.5,X=.15,Pe=4;function O(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:b*(.5+r/360),y:b*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function $(e){let r=Math.PI-2*Math.PI*e.y/b;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/b-.5)*360}}function xe(e,r,l){let t=O(e.north,e.east),i=O(e.south,e.west),s=Math.abs(t.x-i.x),n=Math.abs(t.y-i.y);return s===0||n===0||r===0||l===0?null:{center:$({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function we(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function g(e,r,l,t,i,s){let n=performance.now(),a,o=()=>{let c=Math.min(1,(performance.now()-n)/t),d=we(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter($({x:r.x+(l.x-r.x)*d,y:r.y+(l.y-r.y)*d})),c<1?a=requestAnimationFrame(o):(e.cancelFlight=null,_optionalChain([s, 'optionalCall', _15 => _15()]))};return a=requestAnimationFrame(o),()=>cancelAnimationFrame(a)}function Ie(e,r,l){if(typeof ResizeObserver>"u")return;let t=!1,i=()=>{let{width:n,height:a}=e.getBoundingClientRect();n===0||a===0||(google.maps.event.trigger(r,"resize"),t||(t=!0,r.setCenter(l)))},s=new ResizeObserver(i);return s.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(i):queueMicrotask(i),s}function _e(e){if(!e.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, {...e.loaderOptions,key:e.apiKey}),r=!0)},t,i=0;return{async mount(s,n){let a=++i;l();let o=await _jsapiloader.importLibrary.call(void 0, "maps"),c=await _jsapiloader.importLibrary.call(void 0, "marker"),d=_nullishCoalesce(n.center, () => ({lat:0,lng:0})),u=e.styles!=null||e.overlayMarkers===!0,p=new o.Map(s,{...e.mapOptions,center:d,zoom:_nullishCoalesce(n.zoom, () => (10)),...u?e.styles!=null?{styles:e.styles}:{}:{mapId:_nullishCoalesce(e.mapId, () => (ee))}}),f=Ie(s,p,d),m={map:p,containerEl:s,fullscreenEl:_nullishCoalesce(n.fullscreenTarget, () => (s)),markerLib:c,markerMode:u?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:f,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return a===i&&(t=m),{raw:m}},renderLayer(s,n){let a=h(s),o=a.layers.get(n.id);o&&(_(o),a.layers.delete(n.id),Z(a,n.id)),F(a,n.id);let c=a.markerMode==="overlay"?ge(a,n):Me(a,n);a.layers.set(n.id,c),a.markerMode==="overlay"&&a.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(a.markerMode==="overlay"?fe():me(a,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,a.layers.get(n.id)===c&&(_(c),a.layers.delete(n.id),F(a,n.id),Z(a,n.id)))}},onBoundsChange(s,n){let a=h(s),o=a.map.addListener("idle",()=>{let d=a.map.getBounds();d&&n(ye(d))});a.boundsListeners.add(o);let c=!1;return()=>{c||(c=!0,o.remove(),a.boundsListeners.delete(o))}},onMapClick(s){let n=t;if(!n)return()=>{};let a=n.map.addListener("click",()=>s());n.clickListeners.add(a);let o=!1;return()=>{o||(o=!0,a.remove(),n.clickListeners.delete(a))}},fitBounds(s,n,a){let o=h(s);if(_optionalChain([o, 'access', _16 => _16.cancelFlight, 'optionalCall', _17 => _17()]),o.cancelFlight=null,!_optionalChain([a, 'optionalAccess', _18 => _18.animate])){o.map.fitBounds(n);return}let c=o.map.getZoom(),d=o.map.getCenter(),u=xe(n,o.containerEl.clientWidth,o.containerEl.clientHeight);if(c==null||!d||!u){o.map.fitBounds(n);return}o.map.setOptions({isFractionalZoomEnabled:!0});let p={...O(d.lat(),d.lng()),zoom:c},f=O(u.center.lat,u.center.lng),m={...f,zoom:u.zoom},C=Math.hypot(m.x-p.x,m.y-p.y)*2**Math.min(p.zoom,m.zoom),P=Math.max(o.containerEl.clientWidth,o.containerEl.clientHeight);if(C>P*ke){let j=Math.hypot(m.x-p.x,m.y-p.y);if((typeof o.map.getRenderingType=="function"?o.map.getRenderingType():void 0)==="VECTOR"&&j>0){let M=Math.min(p.zoom,m.zoom),y=Math.min(Math.max(M-Ce,V),M),I=v=>({x:p.x+(m.x-p.x)*v,y:p.y+(m.y-p.y)*v}),T={...I(X),zoom:y},z={...I(1-X),zoom:y},J=()=>{o.cancelFlight=g(o,z,m,D,0)},S=v=>{o.cancelFlight=g(o,v,z,be,0,J)};p.zoom-y<.3?S({...I(0),zoom:p.zoom}):o.cancelFlight=g(o,p,T,U,0,()=>S(T));return}let x=Math.min(Math.max(u.zoom-Ee,V),u.zoom),K={x:p.x,y:p.y},A=()=>{w();let M=_nullishCoalesce(o.map.getZoom(), () => (x));o.cancelFlight=g(o,{...f,zoom:M},m,D,0)},R=()=>{o.map.setCenter(u.center);let M=o.map.addListener("tilesloaded",A),y=setTimeout(A,Oe);w=()=>{M.remove(),clearTimeout(y)},o.cancelFlight=w},w=()=>{};p.zoom>x+.3?o.cancelFlight=g(o,p,{...K,zoom:x},U,0,R):R();return}let H=C>P?Math.min(Pe,Math.log2(C/P)+1):0,N=Math.min(he,ve+H*Le);o.cancelFlight=g(o,p,m,N,H)},destroy(s){let n=h(s);_optionalChain([n, 'access', _19 => _19.resizeObserver, 'optionalAccess', _20 => _20.disconnect, 'call', _21 => _21()]),_optionalChain([n, 'access', _22 => _22.cancelFlight, 'optionalCall', _23 => _23()]),n.cancelFlight=null;for(let a of n.boundsListeners)a.remove();n.boundsListeners.clear();for(let a of n.clickListeners)a.remove();n.clickListeners.clear();for(let a of[...n.clusterers.keys()])F(n,a);for(let a of n.layers.values())_(a);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(s,n){if(t){t.selectedMarkerId=s,t.hoveredMarkerId=n;for(let[a,o]of t.markerElements)q(o,a,s,n)}},mountOverlay(s){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let a=se(),o=new a(n,s,t.containerEl);return o.setMap(t.map),{container:n,setPosition:c=>o.updatePosition(c),unmount:()=>{o.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))+1)},zoomOut(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))-1)},toggleFullscreen(){if(!t)return;let s=t.fullscreenEl,n=document.fullscreenElement;n!=null&&s.contains(n)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _24 => _24.exitFullscreen, 'call', _25 => _25(), 'optionalAccess', _26 => _26.catch, 'call', _27 => _27(()=>{})]):typeof s.requestFullscreen=="function"&&_optionalChain([s, 'access', _28 => _28.requestFullscreen, 'call', _29 => _29(), 'optionalAccess', _30 => _30.catch, 'call', _31 => _31(()=>{})])}}}exports.googleProvider = _e;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{importLibrary as R,setOptions as q}from"@googlemaps/js-api-loader";var $="DEMO_MAP_ID";function v(e){return e.raw}function j(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var T=12,N="#b3261e";function K(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let r=document.createElement("div");return r.style.width=`${T}px`,r.style.height=`${T}px`,r.style.borderRadius="50%",r.style.backgroundColor=N,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var h;function J(){if(h)return h;class e extends google.maps.OverlayView{constructor(t,i,s,n){super();this.position=t;this.content=i;this.onClick=s;this.lifecycle=n}position;content;onClick;lifecycle;div=null;onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,this.getPanes()?.overlayMouseTarget.appendChild(t),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let i=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));i&&(this.div.style.left=`${i.x}px`,this.div.style.top=`${i.y}px`)}onRemove(){let t=this.div;this.div?.remove(),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return h=e,h}var L=14,Q=8;function ee(e){let{anchorX:r,anchorY:l,popupW:t,popupH:i,mapW:s,mapH:n,offsetY:o,pad:a}=e,c=r-t/2,d=r+t/2,p=0;t>s-a*2?p=a-c:d>s-a?p=s-a-d:c<a&&(p=a-c);let u=l-o-i,f=l+o+i,m=u<a&&f<=n-a;return{dx:p,flipBelow:m}}var k;function te(){if(k)return k;class e extends google.maps.OverlayView{constructor(t,i,s){super();this.container=t;this.position=i;this.mapContainerEl=s}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 i=new google.maps.LatLng(this.position.lat,this.position.lng),s=t.fromLatLngToDivPixel(i);if(!s)return;if(this.clampOffset===null){let a=this.container.offsetWidth,c=this.container.offsetHeight,d=a&&c?t.fromLatLngToContainerPixel(i):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${s.x}px`,this.container.style.top=`${s.y-L}px`;return}this.clampOffset=ee({anchorX:d.x,anchorY:d.y,popupW:a,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:L,pad:Q})}let{dx:n,flipBelow:o}=this.clampOffset;this.container.style.left=`${s.x+n}px`,o?(this.container.style.top=`${s.y+L}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.y-L}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 k=e,k}function w(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var ne="#b3261e",re=40,oe=64,ae=14;function ie(e,r){let l=r.count,t=Math.min(oe,re+Math.round(Math.log10(l+1)*ae)),i=document.createElement("div");return i.textContent=String(l),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.width=`${t}px`,i.style.height=`${t}px`,i.style.borderRadius="50%",i.style.backgroundColor=ne,i.style.border="2px solid #ffffff",i.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",i.style.color="#ffffff",i.style.fontFamily="inherit",i.style.fontWeight="700",i.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:r.position,content:i})}var S=!1;async function se(e,r,l,t){let i;try{i=await import("@googlemaps/markerclusterer")}catch(n){S||(S=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(r)!==l)return;let s=new i.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>ie(e.markerLib,n)}});e.clusterers.set(r,s)}function I(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var z=!1;function le(){z||(z=!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 ce(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:j(l,e.markerLib),gmpClickable:!!r.onMarkerClick});if(r.onMarkerClick){let i=r.onMarkerClick;t.addListener("click",()=>i(l.id))}return t})}function Z(e,r,l,t){e.classList.toggle("rle-marker--selected",r===l),e.classList.toggle("rle-marker--hovered",r===t&&r!==l)}function de(e,r){let l=J();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,K(t),s,{onContainerAdd:o=>{e.markerElements.set(t.id,o),Z(o,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:o=>{e.markerElements.get(t.id)===o&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function W(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function pe(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var b=256,G=450,ue=1500,B=260,me=4,fe=5,Y=3,Me=650,ge=1400,ye=600,ve=2400,he=.75,Le=4;function O(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:b*(.5+r/360),y:b*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function V(e){let r=Math.PI-2*Math.PI*e.y/b;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/b-.5)*360}}function ke(e,r,l){let t=O(e.north,e.east),i=O(e.south,e.west),s=Math.abs(t.x-i.x),n=Math.abs(t.y-i.y);return s===0||n===0||r===0||l===0?null:{center:V({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function Ee(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function E(e,r,l,t,i,s){let n=performance.now(),o,a=()=>{let c=Math.min(1,(performance.now()-n)/t),d=Ee(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter(V({x:r.x+(l.x-r.x)*d,y:r.y+(l.y-r.y)*d})),c<1?o=requestAnimationFrame(a):(e.cancelFlight=null,s?.())};return o=requestAnimationFrame(a),()=>cancelAnimationFrame(o)}function be(e,r,l){if(typeof ResizeObserver>"u")return;let t=!1,i=()=>{let{width:n,height:o}=e.getBoundingClientRect();n===0||o===0||(google.maps.event.trigger(r,"resize"),t||(t=!0,r.setCenter(l)))},s=new ResizeObserver(i);return s.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(i):queueMicrotask(i),s}function Oe(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let r=!1,l=()=>{r||(q({...e.loaderOptions,key:e.apiKey}),r=!0)},t,i=0;return{async mount(s,n){let o=++i;l();let a=await R("maps"),c=await R("marker"),d=n.center??{lat:0,lng:0},p=e.styles!=null||e.overlayMarkers===!0,u=new a.Map(s,{...e.mapOptions,center:d,zoom:n.zoom??10,...p?e.styles!=null?{styles:e.styles}:{}:{mapId:e.mapId??$}}),f=be(s,u,d),m={map:u,containerEl:s,fullscreenEl:n.fullscreenTarget??s,markerLib:c,markerMode:p?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:f,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return o===i&&(t=m),{raw:m}},renderLayer(s,n){let o=v(s),a=o.layers.get(n.id);a&&(w(a),o.layers.delete(n.id),W(o,n.id)),I(o,n.id);let c=o.markerMode==="overlay"?de(o,n):ce(o,n);o.layers.set(n.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(n.id,n.markers.map(p=>p.id)),n.clustering&&(o.markerMode==="overlay"?le():se(o,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(n.id)===c&&(w(c),o.layers.delete(n.id),I(o,n.id),W(o,n.id)))}},onBoundsChange(s,n){let o=v(s),a=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&n(pe(d))});o.boundsListeners.add(a);let c=!1;return()=>{c||(c=!0,a.remove(),o.boundsListeners.delete(a))}},onMapClick(s){let n=t;if(!n)return()=>{};let o=n.map.addListener("click",()=>s());n.clickListeners.add(o);let a=!1;return()=>{a||(a=!0,o.remove(),n.clickListeners.delete(o))}},fitBounds(s,n,o){let a=v(s);if(a.cancelFlight?.(),a.cancelFlight=null,!o?.animate){a.map.fitBounds(n);return}let c=a.map.getZoom(),d=a.map.getCenter(),p=ke(n,a.containerEl.clientWidth,a.containerEl.clientHeight);if(c==null||!d||!p){a.map.fitBounds(n);return}a.map.setOptions({isFractionalZoomEnabled:!0});let u={...O(d.lat(),d.lng()),zoom:c},f=O(p.center.lat,p.center.lng),m={...f,zoom:p.zoom},C=Math.hypot(m.x-u.x,m.y-u.y)*2**Math.min(u.zoom,m.zoom),g=Math.max(a.containerEl.clientWidth,a.containerEl.clientHeight);if(C>g*me){let H=Math.hypot(m.x-u.x,m.y-u.y);if((typeof a.map.getRenderingType=="function"?a.map.getRenderingType():void 0)==="VECTOR"&&H>0){let M=Math.max(Math.log2(g*he/H),Y),y=Math.max(0,(u.zoom+m.zoom)/2-M),X=Math.min(ve,G+y*B);a.cancelFlight=E(a,u,m,X,y);return}let x=Math.min(Math.max(p.zoom-fe,Y),p.zoom),D={x:u.x,y:u.y},A=()=>{P();let M=a.map.getZoom()??x;a.cancelFlight=E(a,{...f,zoom:M},m,ge,0)},F=()=>{a.map.setCenter(p.center);let M=a.map.addListener("tilesloaded",A),y=setTimeout(A,ye);P=()=>{M.remove(),clearTimeout(y)},a.cancelFlight=P},P=()=>{};u.zoom>x+.3?a.cancelFlight=E(a,u,{...D,zoom:x},Me,0,F):F();return}let _=C>g?Math.min(Le,Math.log2(C/g)+1):0,U=Math.min(ue,G+_*B);a.cancelFlight=E(a,u,m,U,_)},destroy(s){let n=v(s);n.resizeObserver?.disconnect(),n.cancelFlight?.(),n.cancelFlight=null;for(let o of n.boundsListeners)o.remove();n.boundsListeners.clear();for(let o of n.clickListeners)o.remove();n.clickListeners.clear();for(let o of[...n.clusterers.keys()])I(n,o);for(let o of n.layers.values())w(o);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(s,n){if(t){t.selectedMarkerId=s,t.hoveredMarkerId=n;for(let[o,a]of t.markerElements)Z(a,o,s,n)}},mountOverlay(s){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let o=te(),a=new o(n,s,t.containerEl);return a.setMap(t.map),{container:n,setPosition:c=>a.updatePosition(c),unmount:()=>{a.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((t.map.getZoom()??0)+1)},zoomOut(){t&&t.map.setZoom((t.map.getZoom()??0)-1)},toggleFullscreen(){if(!t)return;let s=t.fullscreenEl,n=document.fullscreenElement;n!=null&&s.contains(n)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof s.requestFullscreen=="function"&&s.requestFullscreen()?.catch(()=>{})}}}export{Oe as googleProvider};
2
+ import{importLibrary as W,setOptions as Q}from"@googlemaps/js-api-loader";var ee="DEMO_MAP_ID";function h(e){return e.raw}function te(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var G=12,ne="#b3261e";function re(e){if(e.element)return e.element;if(e.iconUrl){let l=document.createElement("img");return l.src=e.iconUrl,l}let r=document.createElement("div");return r.style.width=`${G}px`,r.style.height=`${G}px`,r.style.borderRadius="50%",r.style.backgroundColor=ne,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var L;function oe(){if(L)return L;class e extends google.maps.OverlayView{constructor(t,i,s,n){super();this.position=t;this.content=i;this.onClick=s;this.lifecycle=n}position;content;onClick;lifecycle;div=null;onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,this.getPanes()?.overlayMouseTarget.appendChild(t),typeof google.maps.OverlayView.preventMapHitsFrom=="function"&&google.maps.OverlayView.preventMapHitsFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let i=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));i&&(this.div.style.left=`${i.x}px`,this.div.style.top=`${i.y}px`)}onRemove(){let t=this.div;this.div?.remove(),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return L=e,L}var k=14,ae=8;function ie(e){let{anchorX:r,anchorY:l,popupW:t,popupH:i,mapW:s,mapH:n,offsetY:a,pad:o}=e,c=r-t/2,d=r+t/2,u=0;t>s-o*2?u=o-c:d>s-o?u=s-o-d:c<o&&(u=o-c);let p=l-a-i,f=l+a+i,m=p<o&&f<=n-o;return{dx:u,flipBelow:m}}var E;function se(){if(E)return E;class e extends google.maps.OverlayView{constructor(t,i,s){super();this.container=t;this.position=i;this.mapContainerEl=s}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 i=new google.maps.LatLng(this.position.lat,this.position.lng),s=t.fromLatLngToDivPixel(i);if(!s)return;if(this.clampOffset===null){let o=this.container.offsetWidth,c=this.container.offsetHeight,d=o&&c?t.fromLatLngToContainerPixel(i):null;if(!d){this.container.style.transform="translate(-50%, -100%)",this.container.style.left=`${s.x}px`,this.container.style.top=`${s.y-k}px`;return}this.clampOffset=ie({anchorX:d.x,anchorY:d.y,popupW:o,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:k,pad:ae})}let{dx:n,flipBelow:a}=this.clampOffset;this.container.style.left=`${s.x+n}px`,a?(this.container.style.top=`${s.y+k}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.y-k}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 E=e,E}function _(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var le="#b3261e",ce=40,de=64,pe=14;function ue(e,r){let l=r.count,t=Math.min(de,ce+Math.round(Math.log10(l+1)*pe)),i=document.createElement("div");return i.textContent=String(l),i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.width=`${t}px`,i.style.height=`${t}px`,i.style.borderRadius="50%",i.style.backgroundColor=le,i.style.border="2px solid #ffffff",i.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",i.style.color="#ffffff",i.style.fontFamily="inherit",i.style.fontWeight="700",i.style.fontSize=t>=52?"15px":"13px",new e.AdvancedMarkerElement({position:r.position,content:i})}var B=!1;async function me(e,r,l,t){let i;try{i=await import("@googlemaps/markerclusterer")}catch(n){B||(B=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',n));return}if(e.layers.get(r)!==l)return;let s=new i.MarkerClusterer({map:e.map,markers:l,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:n=>ue(e.markerLib,n)}});e.clusterers.set(r,s)}function F(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var Y=!1;function fe(){Y||(Y=!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 Me(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:te(l,e.markerLib),gmpClickable:!!r.onMarkerClick});if(r.onMarkerClick){let i=r.onMarkerClick;t.addListener("click",()=>i(l.id))}return t})}function q(e,r,l,t){e.classList.toggle("rle-marker--selected",r===l),e.classList.toggle("rle-marker--hovered",r===t&&r!==l)}function ge(e,r){let l=oe();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,re(t),s,{onContainerAdd:a=>{e.markerElements.set(t.id,a),q(a,t.id,e.selectedMarkerId,e.hoveredMarkerId)},onContainerRemove:a=>{e.markerElements.get(t.id)===a&&e.markerElements.delete(t.id)}});return n.setMap(e.map),n})}function Z(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function ye(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var b=256,ve=450,he=1500,Le=260,ke=4,Ee=5,V=5,U=700,be=450,D=1500,Oe=600,Ce=5.5,X=.15,Pe=4;function O(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:b*(.5+r/360),y:b*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function $(e){let r=Math.PI-2*Math.PI*e.y/b;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/b-.5)*360}}function xe(e,r,l){let t=O(e.north,e.east),i=O(e.south,e.west),s=Math.abs(t.x-i.x),n=Math.abs(t.y-i.y);return s===0||n===0||r===0||l===0?null:{center:$({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function we(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function g(e,r,l,t,i,s){let n=performance.now(),a,o=()=>{let c=Math.min(1,(performance.now()-n)/t),d=we(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter($({x:r.x+(l.x-r.x)*d,y:r.y+(l.y-r.y)*d})),c<1?a=requestAnimationFrame(o):(e.cancelFlight=null,s?.())};return a=requestAnimationFrame(o),()=>cancelAnimationFrame(a)}function Ie(e,r,l){if(typeof ResizeObserver>"u")return;let t=!1,i=()=>{let{width:n,height:a}=e.getBoundingClientRect();n===0||a===0||(google.maps.event.trigger(r,"resize"),t||(t=!0,r.setCenter(l)))},s=new ResizeObserver(i);return s.observe(e),typeof requestAnimationFrame<"u"?requestAnimationFrame(i):queueMicrotask(i),s}function _e(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let r=!1,l=()=>{r||(Q({...e.loaderOptions,key:e.apiKey}),r=!0)},t,i=0;return{async mount(s,n){let a=++i;l();let o=await W("maps"),c=await W("marker"),d=n.center??{lat:0,lng:0},u=e.styles!=null||e.overlayMarkers===!0,p=new o.Map(s,{...e.mapOptions,center:d,zoom:n.zoom??10,...u?e.styles!=null?{styles:e.styles}:{}:{mapId:e.mapId??ee}}),f=Ie(s,p,d),m={map:p,containerEl:s,fullscreenEl:n.fullscreenTarget??s,markerLib:c,markerMode:u?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:f,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null,cancelFlight:null};return a===i&&(t=m),{raw:m}},renderLayer(s,n){let a=h(s),o=a.layers.get(n.id);o&&(_(o),a.layers.delete(n.id),Z(a,n.id)),F(a,n.id);let c=a.markerMode==="overlay"?ge(a,n):Me(a,n);a.layers.set(n.id,c),a.markerMode==="overlay"&&a.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(a.markerMode==="overlay"?fe():me(a,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,a.layers.get(n.id)===c&&(_(c),a.layers.delete(n.id),F(a,n.id),Z(a,n.id)))}},onBoundsChange(s,n){let a=h(s),o=a.map.addListener("idle",()=>{let d=a.map.getBounds();d&&n(ye(d))});a.boundsListeners.add(o);let c=!1;return()=>{c||(c=!0,o.remove(),a.boundsListeners.delete(o))}},onMapClick(s){let n=t;if(!n)return()=>{};let a=n.map.addListener("click",()=>s());n.clickListeners.add(a);let o=!1;return()=>{o||(o=!0,a.remove(),n.clickListeners.delete(a))}},fitBounds(s,n,a){let o=h(s);if(o.cancelFlight?.(),o.cancelFlight=null,!a?.animate){o.map.fitBounds(n);return}let c=o.map.getZoom(),d=o.map.getCenter(),u=xe(n,o.containerEl.clientWidth,o.containerEl.clientHeight);if(c==null||!d||!u){o.map.fitBounds(n);return}o.map.setOptions({isFractionalZoomEnabled:!0});let p={...O(d.lat(),d.lng()),zoom:c},f=O(u.center.lat,u.center.lng),m={...f,zoom:u.zoom},C=Math.hypot(m.x-p.x,m.y-p.y)*2**Math.min(p.zoom,m.zoom),P=Math.max(o.containerEl.clientWidth,o.containerEl.clientHeight);if(C>P*ke){let j=Math.hypot(m.x-p.x,m.y-p.y);if((typeof o.map.getRenderingType=="function"?o.map.getRenderingType():void 0)==="VECTOR"&&j>0){let M=Math.min(p.zoom,m.zoom),y=Math.min(Math.max(M-Ce,V),M),I=v=>({x:p.x+(m.x-p.x)*v,y:p.y+(m.y-p.y)*v}),T={...I(X),zoom:y},z={...I(1-X),zoom:y},J=()=>{o.cancelFlight=g(o,z,m,D,0)},S=v=>{o.cancelFlight=g(o,v,z,be,0,J)};p.zoom-y<.3?S({...I(0),zoom:p.zoom}):o.cancelFlight=g(o,p,T,U,0,()=>S(T));return}let x=Math.min(Math.max(u.zoom-Ee,V),u.zoom),K={x:p.x,y:p.y},A=()=>{w();let M=o.map.getZoom()??x;o.cancelFlight=g(o,{...f,zoom:M},m,D,0)},R=()=>{o.map.setCenter(u.center);let M=o.map.addListener("tilesloaded",A),y=setTimeout(A,Oe);w=()=>{M.remove(),clearTimeout(y)},o.cancelFlight=w},w=()=>{};p.zoom>x+.3?o.cancelFlight=g(o,p,{...K,zoom:x},U,0,R):R();return}let H=C>P?Math.min(Pe,Math.log2(C/P)+1):0,N=Math.min(he,ve+H*Le);o.cancelFlight=g(o,p,m,N,H)},destroy(s){let n=h(s);n.resizeObserver?.disconnect(),n.cancelFlight?.(),n.cancelFlight=null;for(let a of n.boundsListeners)a.remove();n.boundsListeners.clear();for(let a of n.clickListeners)a.remove();n.clickListeners.clear();for(let a of[...n.clusterers.keys()])F(n,a);for(let a of n.layers.values())_(a);n.layers.clear(),n.markerElements.clear(),n.layerMarkerIds.clear(),t===n&&(t=void 0)},updateMarkerStates(s,n){if(t){t.selectedMarkerId=s,t.hoveredMarkerId=n;for(let[a,o]of t.markerElements)q(o,a,s,n)}},mountOverlay(s){let n=document.createElement("div");if(n.style.position="absolute",n.style.transform="translate(-50%, -100%)",n.style.pointerEvents="auto",!t)return{container:n,setPosition:()=>{},unmount:()=>n.remove()};let a=se(),o=new a(n,s,t.containerEl);return o.setMap(t.map),{container:n,setPosition:c=>o.updatePosition(c),unmount:()=>{o.setMap(null),n.remove()}}},zoomIn(){t&&t.map.setZoom((t.map.getZoom()??0)+1)},zoomOut(){t&&t.map.setZoom((t.map.getZoom()??0)-1)},toggleFullscreen(){if(!t)return;let s=t.fullscreenEl,n=document.fullscreenElement;n!=null&&s.contains(n)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof s.requestFullscreen=="function"&&s.requestFullscreen()?.catch(()=>{})}}}export{_e as googleProvider};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var _chunkLYKLUZIJcjs = require('../chunk-LYKLUZIJ.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkLYKLUZIJcjs.q,{..._chunkLYKLUZIJcjs.O,children:o})}exports.BottomNav = _chunkLYKLUZIJcjs.P; exports.BottomSheet = _chunkLYKLUZIJcjs.Q; exports.ListingApp = _chunkLYKLUZIJcjs.S; exports.StyledCard = _chunkLYKLUZIJcjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkLYKLUZIJcjs.F; exports.StyledFilterPanel = _chunkLYKLUZIJcjs.G; exports.StyledListingLayout = _chunkLYKLUZIJcjs.R; exports.StyledLoading = _chunkLYKLUZIJcjs.H; exports.StyledMarker = _chunkLYKLUZIJcjs.I; exports.StyledPopup = _chunkLYKLUZIJcjs.J; exports.StyledResultHeader = _chunkLYKLUZIJcjs.K; exports.StyledSearch = _chunkLYKLUZIJcjs.L; exports.StyledSidebar = _chunkLYKLUZIJcjs.M; exports.StyledToolbar = _chunkLYKLUZIJcjs.N; exports.styledDefaultComponents = _chunkLYKLUZIJcjs.O;
2
+ var _chunkXK2MJTU2cjs = require('../chunk-XK2MJTU2.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkXK2MJTU2cjs.q,{..._chunkXK2MJTU2cjs.O,children:o})}exports.BottomNav = _chunkXK2MJTU2cjs.P; exports.BottomSheet = _chunkXK2MJTU2cjs.Q; exports.ListingApp = _chunkXK2MJTU2cjs.S; exports.StyledCard = _chunkXK2MJTU2cjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkXK2MJTU2cjs.F; exports.StyledFilterPanel = _chunkXK2MJTU2cjs.G; exports.StyledListingLayout = _chunkXK2MJTU2cjs.R; exports.StyledLoading = _chunkXK2MJTU2cjs.H; exports.StyledMarker = _chunkXK2MJTU2cjs.I; exports.StyledPopup = _chunkXK2MJTU2cjs.J; exports.StyledResultHeader = _chunkXK2MJTU2cjs.K; exports.StyledSearch = _chunkXK2MJTU2cjs.L; exports.StyledSidebar = _chunkXK2MJTU2cjs.M; exports.StyledToolbar = _chunkXK2MJTU2cjs.N; exports.styledDefaultComponents = _chunkXK2MJTU2cjs.O;
@@ -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-L7SBPTPY.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};
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-VJIEENMM.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-listing-engine",
3
- "version": "0.7.19",
3
+ "version": "0.7.20",
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": [
File without changes
File without changes