react-listing-engine 0.7.17 → 0.7.18

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 _chunkINIFOR44cjs = require('./chunk-INIFOR44.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}=_chunkINIFOR44cjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunkINIFOR44cjs.t.call(void 0, ),t=_chunkINIFOR44cjs.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=_chunkINIFOR44cjs.t.call(void 0, ),r=_chunkINIFOR44cjs.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 = _chunkINIFOR44cjs.c; exports.FallbackPopup = _chunkINIFOR44cjs.p; exports.FilterRegistry = _chunkINIFOR44cjs.b; exports.ListingApp = _chunkINIFOR44cjs.S; exports.ListingComponentsProvider = _chunkINIFOR44cjs.q; exports.ListingConfig = _chunkINIFOR44cjs.f; exports.ListingEngine = _chunkINIFOR44cjs.g; exports.ListingEngineContext = _chunkINIFOR44cjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunkINIFOR44cjs.w; exports.ListingList = _chunkINIFOR44cjs.y; exports.ListingMap = _chunkINIFOR44cjs.z; exports.ListingPagination = _chunkINIFOR44cjs.A; exports.ListingProvider = _chunkINIFOR44cjs.D; exports.ListingResultHeader = _chunkINIFOR44cjs.B; exports.ListingStore = _chunkINIFOR44cjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunkINIFOR44cjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunkINIFOR44cjs.h; exports.listingDefaultConfig = _chunkINIFOR44cjs.e; exports.useListing = _chunkINIFOR44cjs.t; exports.useListingComponents = _chunkINIFOR44cjs.r; exports.useListingEvent = _chunkINIFOR44cjs.C; exports.useListingFilters = _chunkINIFOR44cjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunkINIFOR44cjs.x; exports.useListingState = _chunkINIFOR44cjs.u; exports.withConfig = _chunkINIFOR44cjs.i; exports.withDataset = _chunkINIFOR44cjs.k; exports.withFilters = _chunkINIFOR44cjs.l; exports.withInitialFilters = _chunkINIFOR44cjs.n; exports.withMap = _chunkINIFOR44cjs.j; exports.withPrimaryDataset = _chunkINIFOR44cjs.o; exports.withUrlSync = _chunkINIFOR44cjs.m;
2
+ var _chunkLTS65AW6cjs = require('./chunk-LTS65AW6.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}=_chunkLTS65AW6cjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunkLTS65AW6cjs.t.call(void 0, ),t=_chunkLTS65AW6cjs.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=_chunkLTS65AW6cjs.t.call(void 0, ),r=_chunkLTS65AW6cjs.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 = _chunkLTS65AW6cjs.c; exports.FallbackPopup = _chunkLTS65AW6cjs.p; exports.FilterRegistry = _chunkLTS65AW6cjs.b; exports.ListingApp = _chunkLTS65AW6cjs.S; exports.ListingComponentsProvider = _chunkLTS65AW6cjs.q; exports.ListingConfig = _chunkLTS65AW6cjs.f; exports.ListingEngine = _chunkLTS65AW6cjs.g; exports.ListingEngineContext = _chunkLTS65AW6cjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunkLTS65AW6cjs.w; exports.ListingList = _chunkLTS65AW6cjs.y; exports.ListingMap = _chunkLTS65AW6cjs.z; exports.ListingPagination = _chunkLTS65AW6cjs.A; exports.ListingProvider = _chunkLTS65AW6cjs.D; exports.ListingResultHeader = _chunkLTS65AW6cjs.B; exports.ListingStore = _chunkLTS65AW6cjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = h; exports.PaginationMode = b; exports.TypedEmitter = _chunkLTS65AW6cjs.d; exports.UrlSyncController = f; exports.composeListingProviders = _chunkLTS65AW6cjs.h; exports.listingDefaultConfig = _chunkLTS65AW6cjs.e; exports.useListing = _chunkLTS65AW6cjs.t; exports.useListingComponents = _chunkLTS65AW6cjs.r; exports.useListingEvent = _chunkLTS65AW6cjs.C; exports.useListingFilters = _chunkLTS65AW6cjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunkLTS65AW6cjs.x; exports.useListingState = _chunkLTS65AW6cjs.u; exports.withConfig = _chunkLTS65AW6cjs.i; exports.withDataset = _chunkLTS65AW6cjs.k; exports.withFilters = _chunkLTS65AW6cjs.l; exports.withInitialFilters = _chunkLTS65AW6cjs.n; exports.withMap = _chunkLTS65AW6cjs.j; exports.withPrimaryDataset = _chunkLTS65AW6cjs.o; exports.withUrlSync = _chunkLTS65AW6cjs.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-ZHLF5RDO.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-2W7WQDH7.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 U="DEMO_MAP_ID";function M(e){return e.raw}function V(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var F=12,X="#b3261e";function D(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=`${F}px`,r.style.height=`${F}px`,r.style.borderRadius="50%",r.style.backgroundColor=X,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var g;function q(){if(g)return g;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 g=e,g}var v=14,$=8;function j(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,u=0;t>s-a*2?u=a-c:d>s-a?u=s-a-d:c<a&&(u=a-c);let p=l-o-i,f=l+o+i,m=p<a&&f<=n-a;return{dx:u,flipBelow:m}}var y;function N(){if(y)return y;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-v}px`;return}this.clampOffset=j({anchorX:d.x,anchorY:d.y,popupW:a,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:$})}let{dx:n,flipBelow:o}=this.clampOffset;this.container.style.left=`${s.x+n}px`,o?(this.container.style.top=`${s.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.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 y=e,y}function P(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var K="#b3261e",J=40,Q=64,ee=14;function te(e,r){let l=r.count,t=Math.min(Q,J+Math.round(Math.log10(l+1)*ee)),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=K,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 R=!1;async function ne(e,r,l,t){let i;try{i=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(n){R||(R=!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=>te(e.markerLib,n)}});e.clusterers.set(r,s)}function x(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var T=!1;function re(){T||(T=!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 oe(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:V(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 ae(e,r){let l=q();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,D(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 S(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function ie(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var h=256,se=450,le=1500,ce=260,de=4,ue=5,pe=3,me=800,fe=1300,Me=600,ge=4;function k(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:h*(.5+r/360),y:h*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function W(e){let r=Math.PI-2*Math.PI*e.y/h;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/h-.5)*360}}function ve(e,r,l){let t=k(e.north,e.east),i=k(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:W({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function ye(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function w(e,r,l,t,i,s){let n=performance.now(),o,a=()=>{let c=Math.min(1,(performance.now()-n)/t),d=ye(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter(W({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 he(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 ke(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})),u=e.styles!=null||e.overlayMarkers===!0,p=new a.Map(s,{...e.mapOptions,center:d,zoom:_nullishCoalesce(n.zoom, () => (10)),...u?e.styles!=null?{styles:e.styles}:{}:{mapId:_nullishCoalesce(e.mapId, () => (U))}}),f=he(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 o===i&&(t=m),{raw:m}},renderLayer(s,n){let o=M(s),a=o.layers.get(n.id);a&&(P(a),o.layers.delete(n.id),S(o,n.id)),x(o,n.id);let c=o.markerMode==="overlay"?ae(o,n):oe(o,n);o.layers.set(n.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(o.markerMode==="overlay"?re():ne(o,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(n.id)===c&&(P(c),o.layers.delete(n.id),x(o,n.id),S(o,n.id)))}},onBoundsChange(s,n){let o=M(s),a=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&n(ie(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=M(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(),u=ve(n,a.containerEl.clientWidth,a.containerEl.clientHeight);if(c==null||!d||!u){a.map.fitBounds(n);return}a.map.setOptions({isFractionalZoomEnabled:!0});let p={...k(d.lat(),d.lng()),zoom:c},f=k(u.center.lat,u.center.lng),m={...f,zoom:u.zoom},L=Math.hypot(m.x-p.x,m.y-p.y)*2**Math.min(p.zoom,m.zoom),E=Math.max(a.containerEl.clientWidth,a.containerEl.clientHeight);if(L>E*de){let b=Math.min(Math.max(u.zoom-ue,pe),u.zoom),B={x:p.x,y:p.y},H=()=>{O();let C=_nullishCoalesce(a.map.getZoom(), () => (b));a.cancelFlight=w(a,{...f,zoom:C},m,fe,0)},_=()=>{a.map.setCenter(u.center);let C=a.map.addListener("tilesloaded",H),Z=setTimeout(H,Me);O=()=>{C.remove(),clearTimeout(Z)},a.cancelFlight=O},O=()=>{};p.zoom>b+.3?a.cancelFlight=w(a,p,{...B,zoom:b},me,0,_):_();return}let I=L>E?Math.min(ge,Math.log2(L/E)+1):0,G=Math.min(le,se+I*ce);a.cancelFlight=w(a,p,m,G,I)},destroy(s){let n=M(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()])x(n,o);for(let o of n.layers.values())P(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=N(),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 = ke;
2
+ var _jsapiloader = require('@googlemaps/js-api-loader');var U="DEMO_MAP_ID";function M(e){return e.raw}function V(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var F=12,X="#b3261e";function D(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=`${F}px`,r.style.height=`${F}px`,r.style.borderRadius="50%",r.style.backgroundColor=X,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var g;function q(){if(g)return g;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 g=e,g}var v=14,$=8;function j(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,u=0;t>s-a*2?u=a-c:d>s-a?u=s-a-d:c<a&&(u=a-c);let p=l-o-i,f=l+o+i,m=p<a&&f<=n-a;return{dx:u,flipBelow:m}}var y;function N(){if(y)return y;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-v}px`;return}this.clampOffset=j({anchorX:d.x,anchorY:d.y,popupW:a,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:$})}let{dx:n,flipBelow:o}=this.clampOffset;this.container.style.left=`${s.x+n}px`,o?(this.container.style.top=`${s.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.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 y=e,y}function P(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var K="#b3261e",J=40,Q=64,ee=14;function te(e,r){let l=r.count,t=Math.min(Q,J+Math.round(Math.log10(l+1)*ee)),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=K,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 R=!1;async function ne(e,r,l,t){let i;try{i=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(n){R||(R=!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=>te(e.markerLib,n)}});e.clusterers.set(r,s)}function x(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var T=!1;function re(){T||(T=!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 oe(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:V(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 ae(e,r){let l=q();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,D(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 S(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function ie(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var h=256,se=450,le=1500,ce=260,de=4,ue=5,pe=3,me=650,fe=1400,Me=600,ge=4;function k(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:h*(.5+r/360),y:h*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function W(e){let r=Math.PI-2*Math.PI*e.y/h;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/h-.5)*360}}function ve(e,r,l){let t=k(e.north,e.east),i=k(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:W({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function ye(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function w(e,r,l,t,i,s){let n=performance.now(),o,a=()=>{let c=Math.min(1,(performance.now()-n)/t),d=ye(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter(W({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 he(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 ke(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})),u=e.styles!=null||e.overlayMarkers===!0,p=new a.Map(s,{...e.mapOptions,center:d,zoom:_nullishCoalesce(n.zoom, () => (10)),...u?e.styles!=null?{styles:e.styles}:{}:{mapId:_nullishCoalesce(e.mapId, () => (U))}}),f=he(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 o===i&&(t=m),{raw:m}},renderLayer(s,n){let o=M(s),a=o.layers.get(n.id);a&&(P(a),o.layers.delete(n.id),S(o,n.id)),x(o,n.id);let c=o.markerMode==="overlay"?ae(o,n):oe(o,n);o.layers.set(n.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(o.markerMode==="overlay"?re():ne(o,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(n.id)===c&&(P(c),o.layers.delete(n.id),x(o,n.id),S(o,n.id)))}},onBoundsChange(s,n){let o=M(s),a=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&n(ie(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=M(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(),u=ve(n,a.containerEl.clientWidth,a.containerEl.clientHeight);if(c==null||!d||!u){a.map.fitBounds(n);return}a.map.setOptions({isFractionalZoomEnabled:!0});let p={...k(d.lat(),d.lng()),zoom:c},f=k(u.center.lat,u.center.lng),m={...f,zoom:u.zoom},L=Math.hypot(m.x-p.x,m.y-p.y)*2**Math.min(p.zoom,m.zoom),E=Math.max(a.containerEl.clientWidth,a.containerEl.clientHeight);if(L>E*de){let b=Math.min(Math.max(u.zoom-ue,pe),u.zoom),B={x:p.x,y:p.y},H=()=>{O();let C=_nullishCoalesce(a.map.getZoom(), () => (b));a.cancelFlight=w(a,{...f,zoom:C},m,fe,0)},_=()=>{a.map.setCenter(u.center);let C=a.map.addListener("tilesloaded",H),Z=setTimeout(H,Me);O=()=>{C.remove(),clearTimeout(Z)},a.cancelFlight=O},O=()=>{};p.zoom>b+.3?a.cancelFlight=w(a,p,{...B,zoom:b},me,0,_):_();return}let I=L>E?Math.min(ge,Math.log2(L/E)+1):0,G=Math.min(le,se+I*ce);a.cancelFlight=w(a,p,m,G,I)},destroy(s){let n=M(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()])x(n,o);for(let o of n.layers.values())P(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=N(),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 = ke;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{importLibrary as A,setOptions as Y}from"@googlemaps/js-api-loader";var U="DEMO_MAP_ID";function M(e){return e.raw}function V(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var F=12,X="#b3261e";function D(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=`${F}px`,r.style.height=`${F}px`,r.style.borderRadius="50%",r.style.backgroundColor=X,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var g;function q(){if(g)return g;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 g=e,g}var v=14,$=8;function j(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,u=0;t>s-a*2?u=a-c:d>s-a?u=s-a-d:c<a&&(u=a-c);let p=l-o-i,f=l+o+i,m=p<a&&f<=n-a;return{dx:u,flipBelow:m}}var y;function N(){if(y)return y;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-v}px`;return}this.clampOffset=j({anchorX:d.x,anchorY:d.y,popupW:a,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:$})}let{dx:n,flipBelow:o}=this.clampOffset;this.container.style.left=`${s.x+n}px`,o?(this.container.style.top=`${s.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.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 y=e,y}function P(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var K="#b3261e",J=40,Q=64,ee=14;function te(e,r){let l=r.count,t=Math.min(Q,J+Math.round(Math.log10(l+1)*ee)),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=K,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 R=!1;async function ne(e,r,l,t){let i;try{i=await import("@googlemaps/markerclusterer")}catch(n){R||(R=!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=>te(e.markerLib,n)}});e.clusterers.set(r,s)}function x(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var T=!1;function re(){T||(T=!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 oe(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:V(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 ae(e,r){let l=q();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,D(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 S(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function ie(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var h=256,se=450,le=1500,ce=260,de=4,ue=5,pe=3,me=800,fe=1300,Me=600,ge=4;function k(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:h*(.5+r/360),y:h*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function W(e){let r=Math.PI-2*Math.PI*e.y/h;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/h-.5)*360}}function ve(e,r,l){let t=k(e.north,e.east),i=k(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:W({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function ye(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function w(e,r,l,t,i,s){let n=performance.now(),o,a=()=>{let c=Math.min(1,(performance.now()-n)/t),d=ye(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter(W({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 he(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 ke(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let r=!1,l=()=>{r||(Y({...e.loaderOptions,key:e.apiKey}),r=!0)},t,i=0;return{async mount(s,n){let o=++i;l();let a=await A("maps"),c=await A("marker"),d=n.center??{lat:0,lng:0},u=e.styles!=null||e.overlayMarkers===!0,p=new a.Map(s,{...e.mapOptions,center:d,zoom:n.zoom??10,...u?e.styles!=null?{styles:e.styles}:{}:{mapId:e.mapId??U}}),f=he(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 o===i&&(t=m),{raw:m}},renderLayer(s,n){let o=M(s),a=o.layers.get(n.id);a&&(P(a),o.layers.delete(n.id),S(o,n.id)),x(o,n.id);let c=o.markerMode==="overlay"?ae(o,n):oe(o,n);o.layers.set(n.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(o.markerMode==="overlay"?re():ne(o,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(n.id)===c&&(P(c),o.layers.delete(n.id),x(o,n.id),S(o,n.id)))}},onBoundsChange(s,n){let o=M(s),a=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&n(ie(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=M(s);if(a.cancelFlight?.(),a.cancelFlight=null,!o?.animate){a.map.fitBounds(n);return}let c=a.map.getZoom(),d=a.map.getCenter(),u=ve(n,a.containerEl.clientWidth,a.containerEl.clientHeight);if(c==null||!d||!u){a.map.fitBounds(n);return}a.map.setOptions({isFractionalZoomEnabled:!0});let p={...k(d.lat(),d.lng()),zoom:c},f=k(u.center.lat,u.center.lng),m={...f,zoom:u.zoom},L=Math.hypot(m.x-p.x,m.y-p.y)*2**Math.min(p.zoom,m.zoom),E=Math.max(a.containerEl.clientWidth,a.containerEl.clientHeight);if(L>E*de){let b=Math.min(Math.max(u.zoom-ue,pe),u.zoom),B={x:p.x,y:p.y},H=()=>{O();let C=a.map.getZoom()??b;a.cancelFlight=w(a,{...f,zoom:C},m,fe,0)},_=()=>{a.map.setCenter(u.center);let C=a.map.addListener("tilesloaded",H),Z=setTimeout(H,Me);O=()=>{C.remove(),clearTimeout(Z)},a.cancelFlight=O},O=()=>{};p.zoom>b+.3?a.cancelFlight=w(a,p,{...B,zoom:b},me,0,_):_();return}let I=L>E?Math.min(ge,Math.log2(L/E)+1):0,G=Math.min(le,se+I*ce);a.cancelFlight=w(a,p,m,G,I)},destroy(s){let n=M(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()])x(n,o);for(let o of n.layers.values())P(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=N(),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{ke as googleProvider};
2
+ import{importLibrary as A,setOptions as Y}from"@googlemaps/js-api-loader";var U="DEMO_MAP_ID";function M(e){return e.raw}function V(e,r){if(e.element)return e.element;if(e.iconUrl)return new r.PinElement({glyphSrc:e.iconUrl}).element}var F=12,X="#b3261e";function D(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=`${F}px`,r.style.height=`${F}px`,r.style.borderRadius="50%",r.style.backgroundColor=X,r.style.border="2px solid #ffffff",r.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",r}var g;function q(){if(g)return g;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 g=e,g}var v=14,$=8;function j(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,u=0;t>s-a*2?u=a-c:d>s-a?u=s-a-d:c<a&&(u=a-c);let p=l-o-i,f=l+o+i,m=p<a&&f<=n-a;return{dx:u,flipBelow:m}}var y;function N(){if(y)return y;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-v}px`;return}this.clampOffset=j({anchorX:d.x,anchorY:d.y,popupW:a,popupH:c,mapW:this.mapContainerEl.clientWidth,mapH:this.mapContainerEl.clientHeight,offsetY:v,pad:$})}let{dx:n,flipBelow:o}=this.clampOffset;this.container.style.left=`${s.x+n}px`,o?(this.container.style.top=`${s.y+v}px`,this.container.style.transform="translate(-50%, 0)"):(this.container.style.top=`${s.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 y=e,y}function P(e){for(let r of e)typeof r.setMap=="function"?r.setMap(null):r.map=null}var K="#b3261e",J=40,Q=64,ee=14;function te(e,r){let l=r.count,t=Math.min(Q,J+Math.round(Math.log10(l+1)*ee)),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=K,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 R=!1;async function ne(e,r,l,t){let i;try{i=await import("@googlemaps/markerclusterer")}catch(n){R||(R=!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=>te(e.markerLib,n)}});e.clusterers.set(r,s)}function x(e,r){let l=e.clusterers.get(r);l&&(l.setMap(null),e.clusterers.delete(r))}var T=!1;function re(){T||(T=!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 oe(e,r){return r.markers.map(l=>{let t=new e.markerLib.AdvancedMarkerElement({map:e.map,position:l.position,content:V(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 ae(e,r){let l=q();return r.markers.map(t=>{let i=r.onMarkerClick,s=i?()=>i(t.id):void 0,n=new l(t.position,D(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 S(e,r){let l=e.layerMarkerIds.get(r);if(l){for(let t of l)e.markerElements.delete(t);e.layerMarkerIds.delete(r)}}function ie(e){let r=e.getSouthWest(),l=e.getNorthEast();return{west:r.lng(),south:r.lat(),east:l.lng(),north:l.lat()}}var h=256,se=450,le=1500,ce=260,de=4,ue=5,pe=3,me=650,fe=1400,Me=600,ge=4;function k(e,r){let l=Math.min(Math.max(Math.sin(e*Math.PI/180),-.9999),.9999);return{x:h*(.5+r/360),y:h*(.5-Math.log((1+l)/(1-l))/(4*Math.PI))}}function W(e){let r=Math.PI-2*Math.PI*e.y/h;return{lat:180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r))),lng:(e.x/h-.5)*360}}function ve(e,r,l){let t=k(e.north,e.east),i=k(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:W({x:(t.x+i.x)/2,y:(t.y+i.y)/2}),zoom:Math.min(Math.log2(r/s),Math.log2(l/n))}}function ye(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function w(e,r,l,t,i,s){let n=performance.now(),o,a=()=>{let c=Math.min(1,(performance.now()-n)/t),d=ye(c);e.map.setZoom(r.zoom+(l.zoom-r.zoom)*d-i*Math.sin(Math.PI*d)),e.map.setCenter(W({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 he(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 ke(e){if(!e.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let r=!1,l=()=>{r||(Y({...e.loaderOptions,key:e.apiKey}),r=!0)},t,i=0;return{async mount(s,n){let o=++i;l();let a=await A("maps"),c=await A("marker"),d=n.center??{lat:0,lng:0},u=e.styles!=null||e.overlayMarkers===!0,p=new a.Map(s,{...e.mapOptions,center:d,zoom:n.zoom??10,...u?e.styles!=null?{styles:e.styles}:{}:{mapId:e.mapId??U}}),f=he(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 o===i&&(t=m),{raw:m}},renderLayer(s,n){let o=M(s),a=o.layers.get(n.id);a&&(P(a),o.layers.delete(n.id),S(o,n.id)),x(o,n.id);let c=o.markerMode==="overlay"?ae(o,n):oe(o,n);o.layers.set(n.id,c),o.markerMode==="overlay"&&o.layerMarkerIds.set(n.id,n.markers.map(u=>u.id)),n.clustering&&(o.markerMode==="overlay"?re():ne(o,n.id,c,n.clustering));let d=!1;return()=>{d||(d=!0,o.layers.get(n.id)===c&&(P(c),o.layers.delete(n.id),x(o,n.id),S(o,n.id)))}},onBoundsChange(s,n){let o=M(s),a=o.map.addListener("idle",()=>{let d=o.map.getBounds();d&&n(ie(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=M(s);if(a.cancelFlight?.(),a.cancelFlight=null,!o?.animate){a.map.fitBounds(n);return}let c=a.map.getZoom(),d=a.map.getCenter(),u=ve(n,a.containerEl.clientWidth,a.containerEl.clientHeight);if(c==null||!d||!u){a.map.fitBounds(n);return}a.map.setOptions({isFractionalZoomEnabled:!0});let p={...k(d.lat(),d.lng()),zoom:c},f=k(u.center.lat,u.center.lng),m={...f,zoom:u.zoom},L=Math.hypot(m.x-p.x,m.y-p.y)*2**Math.min(p.zoom,m.zoom),E=Math.max(a.containerEl.clientWidth,a.containerEl.clientHeight);if(L>E*de){let b=Math.min(Math.max(u.zoom-ue,pe),u.zoom),B={x:p.x,y:p.y},H=()=>{O();let C=a.map.getZoom()??b;a.cancelFlight=w(a,{...f,zoom:C},m,fe,0)},_=()=>{a.map.setCenter(u.center);let C=a.map.addListener("tilesloaded",H),Z=setTimeout(H,Me);O=()=>{C.remove(),clearTimeout(Z)},a.cancelFlight=O},O=()=>{};p.zoom>b+.3?a.cancelFlight=w(a,p,{...B,zoom:b},me,0,_):_();return}let I=L>E?Math.min(ge,Math.log2(L/E)+1):0,G=Math.min(le,se+I*ce);a.cancelFlight=w(a,p,m,G,I)},destroy(s){let n=M(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()])x(n,o);for(let o of n.layers.values())P(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=N(),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{ke as googleProvider};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var _chunkINIFOR44cjs = require('../chunk-INIFOR44.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkINIFOR44cjs.q,{..._chunkINIFOR44cjs.O,children:o})}exports.BottomNav = _chunkINIFOR44cjs.P; exports.BottomSheet = _chunkINIFOR44cjs.Q; exports.ListingApp = _chunkINIFOR44cjs.S; exports.StyledCard = _chunkINIFOR44cjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkINIFOR44cjs.F; exports.StyledFilterPanel = _chunkINIFOR44cjs.G; exports.StyledListingLayout = _chunkINIFOR44cjs.R; exports.StyledLoading = _chunkINIFOR44cjs.H; exports.StyledMarker = _chunkINIFOR44cjs.I; exports.StyledPopup = _chunkINIFOR44cjs.J; exports.StyledResultHeader = _chunkINIFOR44cjs.K; exports.StyledSearch = _chunkINIFOR44cjs.L; exports.StyledSidebar = _chunkINIFOR44cjs.M; exports.StyledToolbar = _chunkINIFOR44cjs.N; exports.styledDefaultComponents = _chunkINIFOR44cjs.O;
2
+ var _chunkLTS65AW6cjs = require('../chunk-LTS65AW6.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkLTS65AW6cjs.q,{..._chunkLTS65AW6cjs.O,children:o})}exports.BottomNav = _chunkLTS65AW6cjs.P; exports.BottomSheet = _chunkLTS65AW6cjs.Q; exports.ListingApp = _chunkLTS65AW6cjs.S; exports.StyledCard = _chunkLTS65AW6cjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkLTS65AW6cjs.F; exports.StyledFilterPanel = _chunkLTS65AW6cjs.G; exports.StyledListingLayout = _chunkLTS65AW6cjs.R; exports.StyledLoading = _chunkLTS65AW6cjs.H; exports.StyledMarker = _chunkLTS65AW6cjs.I; exports.StyledPopup = _chunkLTS65AW6cjs.J; exports.StyledResultHeader = _chunkLTS65AW6cjs.K; exports.StyledSearch = _chunkLTS65AW6cjs.L; exports.StyledSidebar = _chunkLTS65AW6cjs.M; exports.StyledToolbar = _chunkLTS65AW6cjs.N; exports.styledDefaultComponents = _chunkLTS65AW6cjs.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-ZHLF5RDO.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-2W7WQDH7.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.17",
3
+ "version": "0.7.18",
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