react-listing-engine 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # react-listing-engine
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `/styled`: make the results list the primary surface and improve the responsive grid.
8
+
9
+ - When no map is configured, the layout now fills the full width as a multi-column card grid (and drops the mobile List|Map toggle) instead of reserving half the viewport for an empty map region. `ListingApp` detects this from its `map` prop; `StyledListingLayout` takes a new `hasMap` prop (defaults `true`).
10
+ - When a map IS present, the split gives the list the majority share (~58%, floored at 400px) rather than the minority, and cards reach multiple columns sooner.
11
+ - `ListingPagination` renders nothing when there is no next page, instead of a dangling disabled "Load more" button on empty/last pages.
12
+
3
13
  ## 0.2.1
4
14
 
5
15
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{A as se,B as le,h as G,i as J,j as Q,k as X,l as Y,n as j,p as ee,q as C,s as x,u as te,v as T,w as re,x as ie,y as oe,z as ne}from"./chunk-MAAKKFJ6.js";import{useEffect as we,useRef as Pe}from"react";function ae(e,r){let t=x(),i=Pe(r);i.current=r,we(()=>t.on(e,n=>i.current(n)),[t,e])}function b(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}import{Fragment as xe,jsx as u,jsxs as de}from"react/jsx-runtime";function Ce(e){return e?"rle-card rle-card--selected":"rle-card"}function B({item:e,selected:r,onSelect:t}){let i=e??{},n=Ce(r),a=de(xe,{children:[i.imageUrl?u("img",{src:i.imageUrl,alt:i.title??"",className:"rle-card-media"}):u("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),de("div",{className:"rle-card-body",children:[i.title&&u("span",{className:"rle-card-title",children:i.title}),i.subtitle&&u("span",{className:"rle-card-address",children:i.subtitle}),i.badge&&u("div",{className:"rle-card-info",children:u("span",{className:"rle-card-info-item",children:i.badge})}),i.price!=null&&u("span",{className:"rle-card-price",children:b(i.price)})]})]});return t?u("button",{type:"button",onClick:t,"aria-pressed":r??!1,className:n,children:a}):u("article",{className:n,children:a})}import{jsx as k,jsxs as pe}from"react/jsx-runtime";function A(e){return pe("div",{role:"status",className:"rle-empty",children:[pe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[k("circle",{cx:"11",cy:"11",r:"7"}),k("path",{d:"m21 21-4.3-4.3"})]}),k("p",{className:"rle-empty-title",children:"No results"}),k("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as ke}from"react/jsx-runtime";function V({children:e}){return ke("div",{className:"rle-filter-panel",children:e})}import{jsx as I,jsxs as Ie}from"react/jsx-runtime";function K(e){return I("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((r,t)=>Ie("div",{className:"rle-loading-item",children:[I("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),I("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),I("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},t))})}import{jsx as Fe}from"react/jsx-runtime";function H({point:e}){let r=e.entity??{};return Fe("span",{className:"rle-pin",children:r.price!=null?b(r.price):""})}import{jsx as L,jsxs as D}from"react/jsx-runtime";function O({entity:e,onClose:r}){let t=e??{};return D("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[L("button",{type:"button",onClick:r,"aria-label":"Close",className:"rle-popup-close",children:D("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[L("path",{d:"M18 6 6 18"}),L("path",{d:"m6 6 12 12"})]})}),D("div",{children:[t.title&&L("div",{className:"rle-card-title",children:t.title}),t.subtitle&&L("div",{className:"rle-card-address",children:t.subtitle}),t.price!=null&&L("div",{className:"rle-card-price",children:b(t.price)})]})]})}import{jsx as Me}from"react/jsx-runtime";function W({count:e,total:r}){let t=r!=null&&r!==e?`${e} of ${r} results`:`${e} results`;return Me("div",{className:"rle-result-header",children:t})}import{jsx as Ee}from"react/jsx-runtime";function $({value:e,onChange:r,placeholder:t}){return Ee("input",{type:"search",value:e,placeholder:t,onChange:i=>r(i.target.value),"aria-label":t??"Search",className:"rle-input"})}import{jsx as _e}from"react/jsx-runtime";function z({children:e}){return _e("aside",{className:"rle-sidebar",children:e})}import{jsx as Re}from"react/jsx-runtime";function U({children:e}){return Re("div",{className:"rle-toolbar",children:e})}var ce={Card:B,Marker:H,Popup:O,Sidebar:z,FilterPanel:V,Search:$,Empty:A,Loading:K,ResultHeader:W,Toolbar:U};import{jsx as o,jsxs as y}from"react/jsx-runtime";function me({view:e,onViewChange:r}){return o("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:y("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[y("button",{type:"button",className:`rle-viewtoggle__btn${e==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="list",onClick:()=>r("list"),children:[o(Te,{}),"List"]}),y("button",{type:"button",className:`rle-viewtoggle__btn${e==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="map",onClick:()=>r("map"),children:[o(Be,{}),"Map"]})]})})}function ue(){return y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),o("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),o("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),o("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),o("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),o("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function Te(){return y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[o("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),o("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),o("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),o("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),o("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),o("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Be(){return y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[o("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),o("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),o("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function ge(){return y("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{useEffect as Z,useRef as Ae,useState as fe}from"react";import{createPortal as Ve}from"react-dom";import{Fragment as He,jsx as g,jsxs as F}from"react/jsx-runtime";function ye({open:e,onOpenChange:r,title:t,children:i,footer:n}){let a=Ae(null),[s,m]=fe(!1),[p,h]=fe(!1);return Z(()=>{if(!e){h(!1),m(!1);return}m(!0);let d=requestAnimationFrame(()=>h(!0));return()=>cancelAnimationFrame(d)},[e]),Z(()=>{if(!s)return;let d=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=d}},[s]),Z(()=>{if(!s)return;a.current?.focus();function d(S){S.key==="Escape"&&r(!1)}return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[s,r]),!s||typeof document>"u"?null:Ve(F(He,{children:[g("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>r(!1),"aria-hidden":"true"}),F("div",{ref:a,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":t,tabIndex:-1,children:[g("div",{className:"rle-sheet__handle","aria-hidden":"true"}),F("div",{className:"rle-sheet__header",children:[t&&g("div",{className:"rle-sheet__title",children:t}),g("button",{type:"button",className:"rle-sheet__close",onClick:()=>r(!1),"aria-label":"Close",children:g(Ke,{})})]}),g("div",{className:"rle-sheet__body",children:i}),n&&g("div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function Ke(){return F("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[g("path",{d:"M18 6 6 18"}),g("path",{d:"m6 6 12 12"})]})}import{useEffect as De,useState as be}from"react";import{jsx as N,jsxs as ve}from"react/jsx-runtime";function he({search:e,onFiltersClick:r,action:t}){let{Search:i}=C();return ve("header",{className:"rle-mobile-header",children:[e&&N("div",{className:"rle-mobile-header__search",children:N(i,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),ve("button",{type:"button",className:"rle-mobile-header__btn",onClick:r,children:[N(ue,{}),N("span",{children:"Filters"})]}),t&&N("button",{type:"button",className:"rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:t.onClick,"aria-label":t.label,children:t.icon??N(ge,{})})]})}import{Fragment as We,jsx as l,jsxs as v}from"react/jsx-runtime";var Oe=l("div",{className:"rle-empty",children:"Map unavailable"});function Le({search:e,toolbarEnd:r,mobileAction:t,autoFetch:i=!0,hasMap:n=!0,mapCenter:a,mapZoom:s,className:m}){let p=x(),{Search:h}=C(),d=re(),{filters:S}=te(),[w,M]=be("list"),[P,c]=be(!1),f=e?{value:String(S[e.filterKey]??""),onChange:R=>{p.applyFilters({[e.filterKey]:R||void 0})},placeholder:e.placeholder}:void 0;De(()=>{i!==!1&&p.applyFilters({})},[p,i]);let E=()=>{let R=Object.fromEntries(p.filters.list().map(Se=>[Se.key,void 0]));p.applyFilters(R)},_=d.total??d.items.length;return v("div",{className:m?`rle-app ${m}`:"rle-app",children:[v("div",{className:"rle-filter-bar",children:[f&&l(h,{value:f.value,onChange:f.onChange,placeholder:f.placeholder}),l(T,{className:"rle-filters-row",groupClassName:"rle-filter-group"}),v("div",{className:"rle-filter-bar__end",children:[l(se,{}),r]})]}),l(he,{search:f,onFiltersClick:()=>c(!0),action:t}),v("div",{className:`rle-body ${n?"rle-split":"rle-body--list-only"}`,"data-mobile-view":w,children:[v("div",{className:"rle-list",children:[l(ie,{className:"rle-list-grid"}),l(ne,{})]}),n&&l("div",{className:"rle-map",children:l(oe,{center:a,zoom:s,fallback:Oe})})]}),n&&l(me,{view:w,onViewChange:M}),l(ye,{title:"Filters",open:P,onOpenChange:c,footer:v(We,{children:[l("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:E,children:"Clear all"}),v("button",{type:"button",className:"rle-btn rle-btn--primary",onClick:()=>c(!1),children:["Show ",_," results"]})]}),children:l(T,{className:"rle-filter-stack",groupClassName:"rle-filter-group"})})]})}import{useEffect as $e,useRef as ze,useState as Ue}from"react";import{jsx as q,jsxs as Ge}from"react/jsx-runtime";function Ne(e){return"provider"in e}function Ze(e){let r=e!=null&&!Ne(e),t=r?e.apiKey:void 0,i=r?e.mapId:void 0,[n,a]=Ue(()=>!e||Ne(e)?{ready:!0,provider:e?.provider}:{ready:!1});return $e(()=>{if(!t)return;let s=!1;return import("./maps/google/index.js").then(({googleProvider:m})=>{s||a({ready:!0,provider:m({apiKey:t,mapId:i})})}),()=>{s=!0}},[t,i]),n}function qe({onFiltersChange:e}){let r=ze(e);return r.current=e,ae("FiltersChanged",t=>{t.type==="FiltersChanged"&&r.current(t.filters)}),null}function ir(e){let{datasets:r,filters:t,map:i,components:n,initialFilters:a,onFiltersChange:s,mobileAction:m,search:p,toolbarEnd:h,config:d,autoFetch:S,className:w}=e,{ready:M,provider:P}=Ze(i);if(!M)return null;let c=[];for(let _ of r)c.push(X(_));t&&c.push(Y(t)),P&&c.push(Q(P)),a&&c.push(j(a)),d&&c.push(J(d));let f=G(...c),E={...ce,...n};return Ge(le,{...f,children:[s&&q(qe,{onFiltersChange:s}),q(ee,{...E,children:q(Le,{className:w,search:p,toolbarEnd:h,mobileAction:m,autoFetch:S,hasMap:i!=null,mapCenter:i?.center,mapZoom:i?.zoom})})]})}export{ae as a,B as b,A as c,V as d,K as e,H as f,O as g,W as h,$ as i,z as j,U as k,ce as l,me as m,ye as n,Le as o,ir as p};
@@ -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; var _class3; var _class4; var _class5;"use client";
2
- var S= (_class =class{__init() {this.listeners=new Set}constructor(t){;_class.prototype.__init.call(this);this.state=this.freezeState({filters:{...t.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,pagination:{mode:_nullishCoalesce(t.mode, () => ("paged")),loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(t){this.setState({filters:{...this.state.filters,...t}})}setResults(t){this.setState({results:{items:[...t.items],nextCursor:t.nextCursor,total:t.total}})}appendResults(t){this.setState({results:{items:[...this.state.results.items,...t.items],nextCursor:t.nextCursor,total:t.total}})}setBounds(t){this.setState({bounds:t?{...t}:null})}setSelection(t){this.setState({selection:t})}setLayerVisible(t,e){this.setState({layers:{...this.state.layers,[t]:e}})}setLoading(t){this.setState({pagination:{...this.state.pagination,loading:t}})}setPoints(t,e){this.setState({points:{...this.state.points,[t]:[...e]}})}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}setState(t){this.state=this.freezeState({...this.state,...t}),this.notify()}notify(){for(let t of this.listeners)t()}freezeState(t){Object.freeze(t.filters),Object.freeze(t.results.items),Object.freeze(t.results),t.bounds&&Object.freeze(t.bounds),Object.freeze(t.pagination),Object.freeze(t.layers);for(let e of Object.values(t.points))Object.freeze(e);return Object.freeze(t.points),Object.freeze(t)}}, _class);var P= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(t){if(this.defs.has(t.key))throw new Error(`FilterRegistry: filter "${t.key}" is already registered`);return this.defs.set(t.key,{...t}),this}remove(t){return this.defs.delete(t),this}replace(t,e){if(!this.defs.has(t))throw new Error(`FilterRegistry: cannot replace unregistered filter "${t}"`);return this.defs.set(t,{...e,key:t}),this}reorder(t){let e=this.list(),n=t.filter(r=>this.defs.has(r));n.forEach((r,o)=>{this.defs.get(r).order=o});let s=new Set(n);return e.filter(r=>!s.has(r.key)).forEach((r,o)=>{r.order=n.length+o}),this}list(){return[...this.defs.values()].sort((t,e)=>t.order-e.order)}has(t){return this.defs.has(t)}toFilters(t){return this.list().filter(n=>Object.hasOwn(t,n.key)).map(n=>n.toParams(t[n.key])).reduce((n,s)=>({...n,...s}),{})}activeKeys(t){return this.list().filter(e=>_optionalChain([e, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(t)])).map(e=>e.key)}}, _class2);var w= (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this.defs=new Map}add(t){if(this.defs.has(t.id))throw new Error(`DatasetRegistry: dataset "${t.id}" is already registered`);return this.defs.set(t.id,{...t}),this}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(t=>_optionalChain([t, 'access', _4 => _4.visible, 'optionalCall', _5 => _5()])!==!1).map(t=>t.id)}}, _class3);var R= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(t){let e=this.map.get(t.type);if(e)for(let s of[...e])s(t);let n=this.map.get("*");if(n)for(let s of[...n])s(t)}on(t,e){let n=this.map.get(t);return n||(n=new Set,this.map.set(t,n)),n.add(e),()=>{n.delete(e)}}}, _class4);var B={pagination:"paged",pageSize:20,debounceMs:250};var x=class{constructor(t){this.options=Object.freeze({...B,...t})}};var D= (_class5 =class{__init5() {this.emitter=new R}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}constructor(t){;_class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);_class5.prototype.__init9.call(this);this.datasets=t.datasets,this.filters=_nullishCoalesce(t.filters, () => (new P)),this.map=t.map,this.config=new x(t.config);let e=_nullishCoalesce(t.primaryDatasetId, () => (_optionalChain([this, 'access', _6 => _6.datasets, 'access', _7 => _7.list, 'call', _8 => _8(), 'access', _9 => _9[0], 'optionalAccess', _10 => _10.id])));if(e==null||!this.datasets.has(e))throw new Error(`ListingEngine: primary dataset "${_nullishCoalesce(e, () => (""))}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=e,this.store=new S({filters:_nullishCoalesce(t.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(t){this.store.setFilters(t),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let e=++this.queryToken,n=this.config.options.debounceMs;return n<=0?this.runQuery(e):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(e))},n)})}async loadPage(){let t=this.state.results.nextCursor;if(t===null)return;let e=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let s=await n.adapter.list(this.currentFilters(),{cursor:t,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(s):this.store.setResults(s),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:s.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(t){this.store.setBounds(t),this.emitter.emit({type:"BoundsChanged",bounds:t});let e=this.currentFilters(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let r=this.datasets.get(s);if(!r)return;let o=await r.adapter.getPoints(e,t);n===this.pointsToken&&this.store.setPoints(s,o)}))}selectPoint(t,e){this.store.setSelection(e);let n=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[t], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(s=>s.id===e)]);n&&this.emitter.emit({type:"PointClicked",datasetId:t,id:e,entity:n.entity})}toggleLayer(t){let n=!(_nullishCoalesce(this.state.layers[t], () => (!0)));this.store.setLayerVisible(t,n),this.emitter.emit({type:"LayerToggled",datasetId:t,visible:n})}subscribe(t){return this.store.subscribe(t)}on(t,e){return this.emitter.on(t,e)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(t){if(t!==this.queryToken)return;let e=this.primaryDataset();this.store.setLoading(!0);try{let n=await e.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(t!==this.queryToken)return;this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{t===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function Mt(...i){let t={config:{},filters:new P,datasets:new w};for(let e of i)e(t);return t}var Ot=i=>t=>{t.config={...t.config,...i}},Nt= exports.j =i=>t=>{t.map=i},zt= exports.k =i=>t=>{t.datasets.add(i)},Bt= exports.l =i=>t=>{i(t.filters)},Ut= exports.m =i=>t=>{t.urlSync=i},Ht= exports.n =i=>t=>{t.initialFilters=i},jt= exports.o =i=>t=>{t.primaryDatasetId=i};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function G(i){return String(_nullishCoalesce(_optionalChain([i, 'optionalAccess', _16 => _16.title]), () => ("")))}var W=({item:i})=>_jsxruntime.jsx.call(void 0, "div",{children:G(i)}),X=()=>_jsxruntime.jsx.call(void 0, "div",{}),J=()=>_jsxruntime.jsx.call(void 0, "div",{}),Y=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),Z=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),tt=({value:i,onChange:t,placeholder:e})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:i,placeholder:e,onChange:n=>t(n.target.value),"aria-label":_nullishCoalesce(e, () => ("Search"))}),et=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),it=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),nt=({count:i})=>_jsxruntime.jsxs.call(void 0, "div",{children:[i," results"]}),st=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),c={Card:W,Marker:X,Popup:J,Sidebar:Y,FilterPanel:Z,Search:tt,Empty:et,Loading:it,ResultHeader:nt,Toolbar:st},U=_react.createContext.call(void 0, c);function Vt(i){let{Card:t,Marker:e,Popup:n,Sidebar:s,FilterPanel:r,Search:o,Empty:a,Loading:u,ResultHeader:L,Toolbar:y,children:k}=i,b={Card:_nullishCoalesce(t, () => (c.Card)),Marker:_nullishCoalesce(e, () => (c.Marker)),Popup:_nullishCoalesce(n, () => (c.Popup)),Sidebar:_nullishCoalesce(s, () => (c.Sidebar)),FilterPanel:_nullishCoalesce(r, () => (c.FilterPanel)),Search:_nullishCoalesce(o, () => (c.Search)),Empty:_nullishCoalesce(a, () => (c.Empty)),Loading:_nullishCoalesce(u, () => (c.Loading)),ResultHeader:_nullishCoalesce(L, () => (c.ResultHeader)),Toolbar:_nullishCoalesce(y, () => (c.Toolbar))};return _jsxruntime.jsx.call(void 0, U.Provider,{value:b,children:k})}function v(){return _react.useContext.call(void 0, U)}var M=_react.createContext.call(void 0, null);function d(){let i=_react.useContext.call(void 0, M);if(i===null)throw new Error("useListing must be used within a <ListingProvider>");return i}function m(){let i=d(),t=_react.useCallback.call(void 0, n=>i.subscribe(n),[i]),e=_react.useCallback.call(void 0, ()=>i.state,[i]);return _react.useSyncExternalStore.call(void 0, t,e,e)}function q(){let i=d(),t=m(),e=_react.useCallback.call(void 0, s=>i.applyFilters(s),[i]),n=_react.useCallback.call(void 0, (s,r)=>i.applyFilters({[s]:r}),[i]);return{filters:t.filters,set:e,setField:n}}function ae({className:i,groupClassName:t}={}){let e=d(),{FilterPanel:n}=v(),{filters:s}=q();return _jsxruntime.jsx.call(void 0, n,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(i, () => ("space-y-5")),children:e.filters.list().map(r=>{if(typeof r.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":r.key,className:t},r.key);let o=r.render;return _jsxruntime.jsxs.call(void 0, "div",{className:t,children:[r.label&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:r.label}),_jsxruntime.jsx.call(void 0, o,{value:r.fromParams(s),onChange:a=>{e.applyFilters(r.toParams(a))}})]},r.key)})})})}function O(){return m().results}function ut(i,t){if(i&&typeof i=="object"&&"id"in i){let e=i.id;if(typeof e=="string"||typeof e=="number")return e}return t}function ye({className:i}={}){let t=d(),{items:e}=O(),{pagination:n,selection:s}=m(),{Card:r,Empty:o,Loading:a}=v();return n.loading&&e.length===0?_jsxruntime.jsx.call(void 0, a,{}):e.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:i,children:e.map((u,L)=>{let y=ut(u,L);return _jsxruntime.jsx.call(void 0, r,{item:u,selected:s===y,onSelect:()=>t.selectPoint(t.primaryDatasetId,y)},y)})})}var ct={west:-179.9,south:-85,east:179.9,north:85},A=.1,V=.02;function gt(i){if(i.length===0)return null;let t=i[0].lng,e=i[0].lng,n=i[0].lat,s=i[0].lat;for(let{lat:a,lng:u}of i)u<t&&(t=u),u>e&&(e=u),a<n&&(n=a),a>s&&(s=a);let r=s>n?(s-n)*A:V,o=e>t?(e-t)*A:V;return{west:t-o,east:e+o,south:n-r,north:s+r}}function ve(i){let{center:t,zoom:e,fallback:n}=i,s=d(),r=m(),o=_react.useRef.call(void 0, null),a=_react.useRef.call(void 0, null),[u,L]=_react.useState.call(void 0, !1),y=_react.useRef.call(void 0, !1),k=_react.useRef.call(void 0, !1),b=_react.useRef.call(void 0, !1),l=s.map;return _react.useEffect.call(void 0, ()=>{let T=a.current;if(!l||!T)return;let h=[];for(let p of Object.keys(r.points)){if(r.layers[p]===!1)continue;let g=s.datasets.get(p),E=_nullishCoalesce(r.points[p], () => ([])),_={id:p,markers:E.map(F=>({id:F.id,position:F.position,iconUrl:_optionalChain([g, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(F.entity)]),element:_optionalChain([g, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(F.entity)])})),clustering:_optionalChain([g, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:F=>s.selectPoint(p,F)};h.push(l.renderLayer(T,_))}return()=>{h.forEach(p=>p())}},[s,l,u,r.points,r.layers]),_react.useEffect.call(void 0, ()=>{if(!o.current||!l)return;let T=o.current,h=!1,p=null;return(async()=>{let g=await l.mount(T,{center:t,zoom:e});if(h){l.destroy(g);return}a.current=g,p=l.onBoundsChange(g,E=>{b.current?b.current=!1:k.current=!0,s.loadPoints(E)}),L(!0),s.loadPoints(ct)})(),()=>{h=!0,_optionalChain([p, 'optionalCall', _24 => _24()]),a.current&&(l.destroy(a.current),a.current=null),L(!1)}},[s,l]),_react.useEffect.call(void 0, ()=>{let T=a.current;if(!l||!T||t||y.current||k.current)return;let h=[];for(let g of Object.keys(r.points))if(r.layers[g]!==!1)for(let E of _nullishCoalesce(r.points[g], () => ([])))h.push(E.position);let p=gt(h);p&&(y.current=!0,b.current=!0,l.fitBounds(T,p))},[l,t,u,r.points,r.layers]),_jsxruntime.jsx.call(void 0, "div",{ref:o,className:!l&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:!l&&n})}function ke(){let i=d(),{results:t,pagination:e}=m(),n=t.nextCursor==null||e.loading;return _jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:n,onClick:()=>{i.loadPage()},children:"Load more"})}function De(){let{items:i,total:t}=O(),{ResultHeader:e}=v();return _jsxruntime.jsx.call(void 0, e,{count:i.length,total:t})}function Ue(i){let{children:t,...e}=i,[n]=_react.useState.call(void 0, ()=>e),[s,r]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new D({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),r(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),r(a=>a===o?null:a)}},[n]),s?_jsxruntime.jsx.call(void 0, M.Provider,{value:s,children:t}):null}exports.a = S; exports.b = P; exports.c = w; exports.d = R; exports.e = B; exports.f = x; exports.g = D; exports.h = Mt; exports.i = Ot; exports.j = Nt; exports.k = zt; exports.l = Bt; exports.m = Ut; exports.n = Ht; exports.o = jt; exports.p = Vt; exports.q = v; exports.r = M; exports.s = d; exports.t = m; exports.u = q; exports.v = ae; exports.w = O; exports.x = ye; exports.y = ve; exports.z = ke; exports.A = De; exports.B = Ue;
2
+ var S= (_class =class{__init() {this.listeners=new Set}constructor(t){;_class.prototype.__init.call(this);this.state=this.freezeState({filters:{...t.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,pagination:{mode:_nullishCoalesce(t.mode, () => ("paged")),loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(t){this.setState({filters:{...this.state.filters,...t}})}setResults(t){this.setState({results:{items:[...t.items],nextCursor:t.nextCursor,total:t.total}})}appendResults(t){this.setState({results:{items:[...this.state.results.items,...t.items],nextCursor:t.nextCursor,total:t.total}})}setBounds(t){this.setState({bounds:t?{...t}:null})}setSelection(t){this.setState({selection:t})}setLayerVisible(t,e){this.setState({layers:{...this.state.layers,[t]:e}})}setLoading(t){this.setState({pagination:{...this.state.pagination,loading:t}})}setPoints(t,e){this.setState({points:{...this.state.points,[t]:[...e]}})}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}setState(t){this.state=this.freezeState({...this.state,...t}),this.notify()}notify(){for(let t of this.listeners)t()}freezeState(t){Object.freeze(t.filters),Object.freeze(t.results.items),Object.freeze(t.results),t.bounds&&Object.freeze(t.bounds),Object.freeze(t.pagination),Object.freeze(t.layers);for(let e of Object.values(t.points))Object.freeze(e);return Object.freeze(t.points),Object.freeze(t)}}, _class);var P= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(t){if(this.defs.has(t.key))throw new Error(`FilterRegistry: filter "${t.key}" is already registered`);return this.defs.set(t.key,{...t}),this}remove(t){return this.defs.delete(t),this}replace(t,e){if(!this.defs.has(t))throw new Error(`FilterRegistry: cannot replace unregistered filter "${t}"`);return this.defs.set(t,{...e,key:t}),this}reorder(t){let e=this.list(),n=t.filter(r=>this.defs.has(r));n.forEach((r,o)=>{this.defs.get(r).order=o});let s=new Set(n);return e.filter(r=>!s.has(r.key)).forEach((r,o)=>{r.order=n.length+o}),this}list(){return[...this.defs.values()].sort((t,e)=>t.order-e.order)}has(t){return this.defs.has(t)}toFilters(t){return this.list().filter(n=>Object.hasOwn(t,n.key)).map(n=>n.toParams(t[n.key])).reduce((n,s)=>({...n,...s}),{})}activeKeys(t){return this.list().filter(e=>_optionalChain([e, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(t)])).map(e=>e.key)}}, _class2);var w= (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this.defs=new Map}add(t){if(this.defs.has(t.id))throw new Error(`DatasetRegistry: dataset "${t.id}" is already registered`);return this.defs.set(t.id,{...t}),this}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(t=>_optionalChain([t, 'access', _4 => _4.visible, 'optionalCall', _5 => _5()])!==!1).map(t=>t.id)}}, _class3);var R= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(t){let e=this.map.get(t.type);if(e)for(let s of[...e])s(t);let n=this.map.get("*");if(n)for(let s of[...n])s(t)}on(t,e){let n=this.map.get(t);return n||(n=new Set,this.map.set(t,n)),n.add(e),()=>{n.delete(e)}}}, _class4);var B={pagination:"paged",pageSize:20,debounceMs:250};var x=class{constructor(t){this.options=Object.freeze({...B,...t})}};var D= (_class5 =class{__init5() {this.emitter=new R}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}constructor(t){;_class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);_class5.prototype.__init9.call(this);this.datasets=t.datasets,this.filters=_nullishCoalesce(t.filters, () => (new P)),this.map=t.map,this.config=new x(t.config);let e=_nullishCoalesce(t.primaryDatasetId, () => (_optionalChain([this, 'access', _6 => _6.datasets, 'access', _7 => _7.list, 'call', _8 => _8(), 'access', _9 => _9[0], 'optionalAccess', _10 => _10.id])));if(e==null||!this.datasets.has(e))throw new Error(`ListingEngine: primary dataset "${_nullishCoalesce(e, () => (""))}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=e,this.store=new S({filters:_nullishCoalesce(t.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(t){this.store.setFilters(t),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let e=++this.queryToken,n=this.config.options.debounceMs;return n<=0?this.runQuery(e):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(e))},n)})}async loadPage(){let t=this.state.results.nextCursor;if(t===null)return;let e=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let s=await n.adapter.list(this.currentFilters(),{cursor:t,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(s):this.store.setResults(s),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:s.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(t){this.store.setBounds(t),this.emitter.emit({type:"BoundsChanged",bounds:t});let e=this.currentFilters(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let r=this.datasets.get(s);if(!r)return;let o=await r.adapter.getPoints(e,t);n===this.pointsToken&&this.store.setPoints(s,o)}))}selectPoint(t,e){this.store.setSelection(e);let n=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[t], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(s=>s.id===e)]);n&&this.emitter.emit({type:"PointClicked",datasetId:t,id:e,entity:n.entity})}toggleLayer(t){let n=!(_nullishCoalesce(this.state.layers[t], () => (!0)));this.store.setLayerVisible(t,n),this.emitter.emit({type:"LayerToggled",datasetId:t,visible:n})}subscribe(t){return this.store.subscribe(t)}on(t,e){return this.emitter.on(t,e)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(t){if(t!==this.queryToken)return;let e=this.primaryDataset();this.store.setLoading(!0);try{let n=await e.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(t!==this.queryToken)return;this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{t===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function Mt(...i){let t={config:{},filters:new P,datasets:new w};for(let e of i)e(t);return t}var Ot=i=>t=>{t.config={...t.config,...i}},Nt= exports.j =i=>t=>{t.map=i},zt= exports.k =i=>t=>{t.datasets.add(i)},Bt= exports.l =i=>t=>{i(t.filters)},Ut= exports.m =i=>t=>{t.urlSync=i},Ht= exports.n =i=>t=>{t.initialFilters=i},jt= exports.o =i=>t=>{t.primaryDatasetId=i};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function G(i){return String(_nullishCoalesce(_optionalChain([i, 'optionalAccess', _16 => _16.title]), () => ("")))}var W=({item:i})=>_jsxruntime.jsx.call(void 0, "div",{children:G(i)}),X=()=>_jsxruntime.jsx.call(void 0, "div",{}),J=()=>_jsxruntime.jsx.call(void 0, "div",{}),Y=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),Z=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),tt=({value:i,onChange:t,placeholder:e})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:i,placeholder:e,onChange:n=>t(n.target.value),"aria-label":_nullishCoalesce(e, () => ("Search"))}),et=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),it=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),nt=({count:i})=>_jsxruntime.jsxs.call(void 0, "div",{children:[i," results"]}),st=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),c={Card:W,Marker:X,Popup:J,Sidebar:Y,FilterPanel:Z,Search:tt,Empty:et,Loading:it,ResultHeader:nt,Toolbar:st},U=_react.createContext.call(void 0, c);function Vt(i){let{Card:t,Marker:e,Popup:n,Sidebar:s,FilterPanel:r,Search:o,Empty:a,Loading:u,ResultHeader:L,Toolbar:y,children:k}=i,b={Card:_nullishCoalesce(t, () => (c.Card)),Marker:_nullishCoalesce(e, () => (c.Marker)),Popup:_nullishCoalesce(n, () => (c.Popup)),Sidebar:_nullishCoalesce(s, () => (c.Sidebar)),FilterPanel:_nullishCoalesce(r, () => (c.FilterPanel)),Search:_nullishCoalesce(o, () => (c.Search)),Empty:_nullishCoalesce(a, () => (c.Empty)),Loading:_nullishCoalesce(u, () => (c.Loading)),ResultHeader:_nullishCoalesce(L, () => (c.ResultHeader)),Toolbar:_nullishCoalesce(y, () => (c.Toolbar))};return _jsxruntime.jsx.call(void 0, U.Provider,{value:b,children:k})}function v(){return _react.useContext.call(void 0, U)}var M=_react.createContext.call(void 0, null);function d(){let i=_react.useContext.call(void 0, M);if(i===null)throw new Error("useListing must be used within a <ListingProvider>");return i}function m(){let i=d(),t=_react.useCallback.call(void 0, n=>i.subscribe(n),[i]),e=_react.useCallback.call(void 0, ()=>i.state,[i]);return _react.useSyncExternalStore.call(void 0, t,e,e)}function q(){let i=d(),t=m(),e=_react.useCallback.call(void 0, s=>i.applyFilters(s),[i]),n=_react.useCallback.call(void 0, (s,r)=>i.applyFilters({[s]:r}),[i]);return{filters:t.filters,set:e,setField:n}}function ae({className:i,groupClassName:t}={}){let e=d(),{FilterPanel:n}=v(),{filters:s}=q();return _jsxruntime.jsx.call(void 0, n,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(i, () => ("space-y-5")),children:e.filters.list().map(r=>{if(typeof r.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":r.key,className:t},r.key);let o=r.render;return _jsxruntime.jsxs.call(void 0, "div",{className:t,children:[r.label&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:r.label}),_jsxruntime.jsx.call(void 0, o,{value:r.fromParams(s),onChange:a=>{e.applyFilters(r.toParams(a))}})]},r.key)})})})}function O(){return m().results}function ut(i,t){if(i&&typeof i=="object"&&"id"in i){let e=i.id;if(typeof e=="string"||typeof e=="number")return e}return t}function ye({className:i}={}){let t=d(),{items:e}=O(),{pagination:n,selection:s}=m(),{Card:r,Empty:o,Loading:a}=v();return n.loading&&e.length===0?_jsxruntime.jsx.call(void 0, a,{}):e.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:i,children:e.map((u,L)=>{let y=ut(u,L);return _jsxruntime.jsx.call(void 0, r,{item:u,selected:s===y,onSelect:()=>t.selectPoint(t.primaryDatasetId,y)},y)})})}var ct={west:-179.9,south:-85,east:179.9,north:85},A=.1,V=.02;function gt(i){if(i.length===0)return null;let t=i[0].lng,e=i[0].lng,n=i[0].lat,s=i[0].lat;for(let{lat:a,lng:u}of i)u<t&&(t=u),u>e&&(e=u),a<n&&(n=a),a>s&&(s=a);let r=s>n?(s-n)*A:V,o=e>t?(e-t)*A:V;return{west:t-o,east:e+o,south:n-r,north:s+r}}function ve(i){let{center:t,zoom:e,fallback:n}=i,s=d(),r=m(),o=_react.useRef.call(void 0, null),a=_react.useRef.call(void 0, null),[u,L]=_react.useState.call(void 0, !1),y=_react.useRef.call(void 0, !1),k=_react.useRef.call(void 0, !1),b=_react.useRef.call(void 0, !1),l=s.map;return _react.useEffect.call(void 0, ()=>{let T=a.current;if(!l||!T)return;let h=[];for(let p of Object.keys(r.points)){if(r.layers[p]===!1)continue;let g=s.datasets.get(p),E=_nullishCoalesce(r.points[p], () => ([])),_={id:p,markers:E.map(F=>({id:F.id,position:F.position,iconUrl:_optionalChain([g, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(F.entity)]),element:_optionalChain([g, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(F.entity)])})),clustering:_optionalChain([g, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:F=>s.selectPoint(p,F)};h.push(l.renderLayer(T,_))}return()=>{h.forEach(p=>p())}},[s,l,u,r.points,r.layers]),_react.useEffect.call(void 0, ()=>{if(!o.current||!l)return;let T=o.current,h=!1,p=null;return(async()=>{let g=await l.mount(T,{center:t,zoom:e});if(h){l.destroy(g);return}a.current=g,p=l.onBoundsChange(g,E=>{b.current?b.current=!1:k.current=!0,s.loadPoints(E)}),L(!0),s.loadPoints(ct)})(),()=>{h=!0,_optionalChain([p, 'optionalCall', _24 => _24()]),a.current&&(l.destroy(a.current),a.current=null),L(!1)}},[s,l]),_react.useEffect.call(void 0, ()=>{let T=a.current;if(!l||!T||t||y.current||k.current)return;let h=[];for(let g of Object.keys(r.points))if(r.layers[g]!==!1)for(let E of _nullishCoalesce(r.points[g], () => ([])))h.push(E.position);let p=gt(h);p&&(y.current=!0,b.current=!0,l.fitBounds(T,p))},[l,t,u,r.points,r.layers]),_jsxruntime.jsx.call(void 0, "div",{ref:o,className:!l&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:!l&&n})}function ke(){let i=d(),{results:t,pagination:e}=m();return t.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:e.loading,onClick:()=>{i.loadPage()},children:"Load more"})}function De(){let{items:i,total:t}=O(),{ResultHeader:e}=v();return _jsxruntime.jsx.call(void 0, e,{count:i.length,total:t})}function Ue(i){let{children:t,...e}=i,[n]=_react.useState.call(void 0, ()=>e),[s,r]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new D({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),r(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),r(a=>a===o?null:a)}},[n]),s?_jsxruntime.jsx.call(void 0, M.Provider,{value:s,children:t}):null}exports.a = S; exports.b = P; exports.c = w; exports.d = R; exports.e = B; exports.f = x; exports.g = D; exports.h = Mt; exports.i = Ot; exports.j = Nt; exports.k = zt; exports.l = Bt; exports.m = Ut; exports.n = Ht; exports.o = jt; exports.p = Vt; exports.q = v; exports.r = M; exports.s = d; exports.t = m; exports.u = q; exports.v = ae; exports.w = O; exports.x = ye; exports.y = ve; exports.z = ke; exports.A = De; exports.B = Ue;
@@ -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 _chunk5O36WI7Hcjs = require('./chunk-5O36WI7H.cjs');var _react = require('react');function le(e,r){let t=_chunk5O36WI7Hcjs.s.call(void 0, ),i=_react.useRef.call(void 0, r);i.current=r,_react.useEffect.call(void 0, ()=>t.on(e,s=>i.current(s)),[t,e])}function L(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}var _jsxruntime = require('react/jsx-runtime');function Pe(e){return e?"rle-card rle-card--selected":"rle-card"}function T({item:e,selected:r,onSelect:t}){let i=_nullishCoalesce(e, () => ({})),s=Pe(r),a=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[i.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:i.imageUrl,alt:_nullishCoalesce(i.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[i.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:i.title}),i.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:i.subtitle}),i.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:i.badge})}),i.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:L(i.price)})]})]});return t?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:t,"aria-pressed":_nullishCoalesce(r, () => (!1)),className:s,children:a}):_jsxruntime.jsx.call(void 0, "article",{className:s,children:a})}function B(e){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"rle-empty",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-title",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}function A({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:e})}function V(e){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((r,t)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rle-loading-item",children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},t))})}function K({point:e}){let r=_nullishCoalesce(e.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:r.price!=null?L(r.price):""})}function D({entity:e,onClose:r}){let t=_nullishCoalesce(e, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:r,"aria-label":"Close",className:"rle-popup-close",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{children:[t.title&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-title",children:t.title}),t.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-address",children:t.subtitle}),t.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-price",children:L(t.price)})]})]})}function O({count:e,total:r}){let t=r!=null&&r!==e?`${e} of ${r} results`:`${e} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"rle-result-header",children:t})}function W({value:e,onChange:r,placeholder:t}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:e,placeholder:t,onChange:i=>r(i.target.value),"aria-label":_nullishCoalesce(t, () => ("Search")),className:"rle-input"})}function $({children:e}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:e})}function z({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:e})}var pe={Card:T,Marker:K,Popup:D,Sidebar:$,FilterPanel:A,Search:W,Empty:B,Loading:V,ResultHeader:O,Toolbar:z};function ce({view:e,onViewChange:r}){return _jsxruntime.jsx.call(void 0, "nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${e==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="list",onClick:()=>r("list"),children:[_jsxruntime.jsx.call(void 0, Re,{}),"List"]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${e==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="map",onClick:()=>r("map"),children:[_jsxruntime.jsx.call(void 0, Te,{}),"Map"]})]})})}function me(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function Re(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Te(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"3",x2:"8",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function ue(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_jsxruntime.jsx.call(void 0, "line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}var _reactdom = require('react-dom');function fe({open:e,onOpenChange:r,title:t,children:i,footer:s}){let a=_react.useRef.call(void 0, null),[n,d]=_react.useState.call(void 0, !1),[v,g]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!e){g(!1),d(!1);return}d(!0);let c=requestAnimationFrame(()=>g(!0));return()=>cancelAnimationFrame(c)},[e]),_react.useEffect.call(void 0, ()=>{if(!n)return;let c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[n]),_react.useEffect.call(void 0, ()=>{if(!n)return;_optionalChain([a, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.focus, 'call', _4 => _4()]);function c(h){h.key==="Escape"&&r(!1)}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n,r]),!n||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${v?" rle-sheet-backdrop--open":""}`,onClick:()=>r(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:a,className:`rle-sheet${v?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":t,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:t}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>r(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, Ve,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:i}),s&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:s})]})]}),document.body)}function Ve(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}function ve({search:e,onFiltersClick:r,action:t}){let{Search:i}=_chunk5O36WI7Hcjs.q.call(void 0, );return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, i,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-mobile-header__btn",onClick:r,children:[_jsxruntime.jsx.call(void 0, me,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"})]}),t&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:t.onClick,"aria-label":t.label,children:_nullishCoalesce(t.icon, () => (_jsxruntime.jsx.call(void 0, ue,{})))})]})}var De=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function be({search:e,toolbarEnd:r,mobileAction:t,autoFetch:i=!0,mapCenter:s,mapZoom:a,className:n}){let d=_chunk5O36WI7Hcjs.s.call(void 0, ),{Search:v}=_chunk5O36WI7Hcjs.q.call(void 0, ),g=_chunk5O36WI7Hcjs.w.call(void 0, ),{filters:c}=_chunk5O36WI7Hcjs.u.call(void 0, ),[h,F]=_react.useState.call(void 0, "list"),[M,b]=_react.useState.call(void 0, !1),p=e?{value:String(_nullishCoalesce(c[e.filterKey], () => (""))),onChange:w=>{d.applyFilters({[e.filterKey]:w||void 0})},placeholder:e.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{i!==!1&&d.applyFilters({})},[d,i]);let E=()=>{let w=Object.fromEntries(d.filters.list().map(Ne=>[Ne.key,void 0]));d.applyFilters(w)},_=_nullishCoalesce(g.total, () => (g.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:n?`rle-app ${n}`:"rle-app",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar",children:[p&&_jsxruntime.jsx.call(void 0, v,{value:p.value,onChange:p.onChange,placeholder:p.placeholder}),_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.v,{className:"rle-filters-row",groupClassName:"rle-filter-group"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar__end",children:[_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.A,{}),r]})]}),_jsxruntime.jsx.call(void 0, ve,{search:p,onFiltersClick:()=>b(!0),action:t}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-body rle-split","data-mobile-view":h,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",children:[_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.x,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.z,{})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.y,{center:s,zoom:a,fallback:De})})]}),_jsxruntime.jsx.call(void 0, ce,{view:h,onViewChange:F}),_jsxruntime.jsx.call(void 0, fe,{title:"Filters",open:M,onOpenChange:b,footer:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:E,children:"Clear all"}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary",onClick:()=>b(!1),children:["Show ",_," results"]})]}),children:_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.v,{className:"rle-filter-stack",groupClassName:"rle-filter-group"})})]})}function Le(e){return"provider"in e}function Ue(e){let r=e!=null&&!Le(e),t=r?e.apiKey:void 0,i=r?e.mapId:void 0,[s,a]=_react.useState.call(void 0, ()=>!e||Le(e)?{ready:!0,provider:_optionalChain([e, 'optionalAccess', _5 => _5.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!t)return;let n=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:d})=>{n||a({ready:!0,provider:d({apiKey:t,mapId:i})})}),()=>{n=!0}},[t,i]),s}function Ze({onFiltersChange:e}){let r=_react.useRef.call(void 0, e);return r.current=e,le("FiltersChanged",t=>{t.type==="FiltersChanged"&&r.current(t.filters)}),null}function rr(e){let{datasets:r,filters:t,map:i,components:s,initialFilters:a,onFiltersChange:n,mobileAction:d,search:v,toolbarEnd:g,config:c,autoFetch:h,className:F}=e,{ready:M,provider:b}=Ue(i);if(!M)return null;let p=[];for(let w of r)p.push(_chunk5O36WI7Hcjs.k.call(void 0, w));t&&p.push(_chunk5O36WI7Hcjs.l.call(void 0, t)),b&&p.push(_chunk5O36WI7Hcjs.j.call(void 0, b)),a&&p.push(_chunk5O36WI7Hcjs.n.call(void 0, a)),c&&p.push(_chunk5O36WI7Hcjs.i.call(void 0, c));let E=_chunk5O36WI7Hcjs.h.call(void 0, ...p),_={...pe,...s};return _jsxruntime.jsxs.call(void 0, _chunk5O36WI7Hcjs.B,{...E,children:[n&&_jsxruntime.jsx.call(void 0, Ze,{onFiltersChange:n}),_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.p,{..._,children:_jsxruntime.jsx.call(void 0, be,{className:F,search:v,toolbarEnd:g,mobileAction:d,autoFetch:h,mapCenter:_optionalChain([i, 'optionalAccess', _6 => _6.center]),mapZoom:_optionalChain([i, 'optionalAccess', _7 => _7.zoom])})})]})}exports.a = le; exports.b = T; exports.c = B; exports.d = A; exports.e = V; exports.f = K; exports.g = D; exports.h = O; exports.i = W; exports.j = $; exports.k = z; exports.l = pe; exports.m = ce; exports.n = fe; exports.o = be; exports.p = rr;
2
+ var _chunkF4G42IGQcjs = require('./chunk-F4G42IGQ.cjs');var _react = require('react');function ae(e,r){let t=_chunkF4G42IGQcjs.s.call(void 0, ),i=_react.useRef.call(void 0, r);i.current=r,_react.useEffect.call(void 0, ()=>t.on(e,n=>i.current(n)),[t,e])}function b(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}var _jsxruntime = require('react/jsx-runtime');function Ce(e){return e?"rle-card rle-card--selected":"rle-card"}function B({item:e,selected:r,onSelect:t}){let i=_nullishCoalesce(e, () => ({})),n=Ce(r),a=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[i.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:i.imageUrl,alt:_nullishCoalesce(i.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[i.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:i.title}),i.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:i.subtitle}),i.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:i.badge})}),i.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:b(i.price)})]})]});return t?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:t,"aria-pressed":_nullishCoalesce(r, () => (!1)),className:n,children:a}):_jsxruntime.jsx.call(void 0, "article",{className:n,children:a})}function A(e){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"rle-empty",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-title",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}function V({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:e})}function K(e){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((r,t)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rle-loading-item",children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},t))})}function H({point:e}){let r=_nullishCoalesce(e.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:r.price!=null?b(r.price):""})}function O({entity:e,onClose:r}){let t=_nullishCoalesce(e, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:r,"aria-label":"Close",className:"rle-popup-close",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{children:[t.title&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-title",children:t.title}),t.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-address",children:t.subtitle}),t.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-price",children:b(t.price)})]})]})}function W({count:e,total:r}){let t=r!=null&&r!==e?`${e} of ${r} results`:`${e} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"rle-result-header",children:t})}function $({value:e,onChange:r,placeholder:t}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:e,placeholder:t,onChange:i=>r(i.target.value),"aria-label":_nullishCoalesce(t, () => ("Search")),className:"rle-input"})}function z({children:e}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:e})}function U({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:e})}var ce={Card:B,Marker:H,Popup:O,Sidebar:z,FilterPanel:V,Search:$,Empty:A,Loading:K,ResultHeader:W,Toolbar:U};function me({view:e,onViewChange:r}){return _jsxruntime.jsx.call(void 0, "nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${e==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="list",onClick:()=>r("list"),children:[_jsxruntime.jsx.call(void 0, Te,{}),"List"]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${e==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="map",onClick:()=>r("map"),children:[_jsxruntime.jsx.call(void 0, Be,{}),"Map"]})]})})}function ue(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function Te(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Be(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"3",x2:"8",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function ge(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_jsxruntime.jsx.call(void 0, "line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}var _reactdom = require('react-dom');function ye({open:e,onOpenChange:r,title:t,children:i,footer:n}){let a=_react.useRef.call(void 0, null),[s,m]=_react.useState.call(void 0, !1),[p,h]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!e){h(!1),m(!1);return}m(!0);let d=requestAnimationFrame(()=>h(!0));return()=>cancelAnimationFrame(d)},[e]),_react.useEffect.call(void 0, ()=>{if(!s)return;let d=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=d}},[s]),_react.useEffect.call(void 0, ()=>{if(!s)return;_optionalChain([a, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.focus, 'call', _4 => _4()]);function d(S){S.key==="Escape"&&r(!1)}return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[s,r]),!s||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>r(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:a,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":t,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:t}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>r(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, Ke,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:i}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function Ke(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}function he({search:e,onFiltersClick:r,action:t}){let{Search:i}=_chunkF4G42IGQcjs.q.call(void 0, );return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, i,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-mobile-header__btn",onClick:r,children:[_jsxruntime.jsx.call(void 0, ue,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"})]}),t&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:t.onClick,"aria-label":t.label,children:_nullishCoalesce(t.icon, () => (_jsxruntime.jsx.call(void 0, ge,{})))})]})}var Oe=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function Le({search:e,toolbarEnd:r,mobileAction:t,autoFetch:i=!0,hasMap:n=!0,mapCenter:a,mapZoom:s,className:m}){let p=_chunkF4G42IGQcjs.s.call(void 0, ),{Search:h}=_chunkF4G42IGQcjs.q.call(void 0, ),d=_chunkF4G42IGQcjs.w.call(void 0, ),{filters:S}=_chunkF4G42IGQcjs.u.call(void 0, ),[w,M]=_react.useState.call(void 0, "list"),[P,c]=_react.useState.call(void 0, !1),f=e?{value:String(_nullishCoalesce(S[e.filterKey], () => (""))),onChange:R=>{p.applyFilters({[e.filterKey]:R||void 0})},placeholder:e.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{i!==!1&&p.applyFilters({})},[p,i]);let E=()=>{let R=Object.fromEntries(p.filters.list().map(Se=>[Se.key,void 0]));p.applyFilters(R)},_=_nullishCoalesce(d.total, () => (d.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:m?`rle-app ${m}`:"rle-app",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar",children:[f&&_jsxruntime.jsx.call(void 0, h,{value:f.value,onChange:f.onChange,placeholder:f.placeholder}),_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.v,{className:"rle-filters-row",groupClassName:"rle-filter-group"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar__end",children:[_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.A,{}),r]})]}),_jsxruntime.jsx.call(void 0, he,{search:f,onFiltersClick:()=>c(!0),action:t}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${n?"rle-split":"rle-body--list-only"}`,"data-mobile-view":w,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",children:[_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.x,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.z,{})]}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.y,{center:a,zoom:s,fallback:Oe})})]}),n&&_jsxruntime.jsx.call(void 0, me,{view:w,onViewChange:M}),_jsxruntime.jsx.call(void 0, ye,{title:"Filters",open:P,onOpenChange:c,footer:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:E,children:"Clear all"}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary",onClick:()=>c(!1),children:["Show ",_," results"]})]}),children:_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.v,{className:"rle-filter-stack",groupClassName:"rle-filter-group"})})]})}function Ne(e){return"provider"in e}function Ze(e){let r=e!=null&&!Ne(e),t=r?e.apiKey:void 0,i=r?e.mapId:void 0,[n,a]=_react.useState.call(void 0, ()=>!e||Ne(e)?{ready:!0,provider:_optionalChain([e, 'optionalAccess', _5 => _5.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!t)return;let s=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:m})=>{s||a({ready:!0,provider:m({apiKey:t,mapId:i})})}),()=>{s=!0}},[t,i]),n}function qe({onFiltersChange:e}){let r=_react.useRef.call(void 0, e);return r.current=e,ae("FiltersChanged",t=>{t.type==="FiltersChanged"&&r.current(t.filters)}),null}function ir(e){let{datasets:r,filters:t,map:i,components:n,initialFilters:a,onFiltersChange:s,mobileAction:m,search:p,toolbarEnd:h,config:d,autoFetch:S,className:w}=e,{ready:M,provider:P}=Ze(i);if(!M)return null;let c=[];for(let _ of r)c.push(_chunkF4G42IGQcjs.k.call(void 0, _));t&&c.push(_chunkF4G42IGQcjs.l.call(void 0, t)),P&&c.push(_chunkF4G42IGQcjs.j.call(void 0, P)),a&&c.push(_chunkF4G42IGQcjs.n.call(void 0, a)),d&&c.push(_chunkF4G42IGQcjs.i.call(void 0, d));let f=_chunkF4G42IGQcjs.h.call(void 0, ...c),E={...ce,...n};return _jsxruntime.jsxs.call(void 0, _chunkF4G42IGQcjs.B,{...f,children:[s&&_jsxruntime.jsx.call(void 0, qe,{onFiltersChange:s}),_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.p,{...E,children:_jsxruntime.jsx.call(void 0, Le,{className:w,search:p,toolbarEnd:h,mobileAction:m,autoFetch:S,hasMap:i!=null,mapCenter:_optionalChain([i, 'optionalAccess', _6 => _6.center]),mapZoom:_optionalChain([i, 'optionalAccess', _7 => _7.zoom])})})]})}exports.a = ae; exports.b = B; exports.c = A; exports.d = V; exports.e = K; exports.f = H; exports.g = O; exports.h = W; exports.i = $; exports.j = z; exports.k = U; exports.l = ce; exports.m = me; exports.n = ye; exports.o = Le; exports.p = ir;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var S=class{state;listeners=new Set;constructor(t){this.state=this.freezeState({filters:{...t.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,pagination:{mode:t.mode??"paged",loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(t){this.setState({filters:{...this.state.filters,...t}})}setResults(t){this.setState({results:{items:[...t.items],nextCursor:t.nextCursor,total:t.total}})}appendResults(t){this.setState({results:{items:[...this.state.results.items,...t.items],nextCursor:t.nextCursor,total:t.total}})}setBounds(t){this.setState({bounds:t?{...t}:null})}setSelection(t){this.setState({selection:t})}setLayerVisible(t,e){this.setState({layers:{...this.state.layers,[t]:e}})}setLoading(t){this.setState({pagination:{...this.state.pagination,loading:t}})}setPoints(t,e){this.setState({points:{...this.state.points,[t]:[...e]}})}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}setState(t){this.state=this.freezeState({...this.state,...t}),this.notify()}notify(){for(let t of this.listeners)t()}freezeState(t){Object.freeze(t.filters),Object.freeze(t.results.items),Object.freeze(t.results),t.bounds&&Object.freeze(t.bounds),Object.freeze(t.pagination),Object.freeze(t.layers);for(let e of Object.values(t.points))Object.freeze(e);return Object.freeze(t.points),Object.freeze(t)}};var P=class{defs=new Map;add(t){if(this.defs.has(t.key))throw new Error(`FilterRegistry: filter "${t.key}" is already registered`);return this.defs.set(t.key,{...t}),this}remove(t){return this.defs.delete(t),this}replace(t,e){if(!this.defs.has(t))throw new Error(`FilterRegistry: cannot replace unregistered filter "${t}"`);return this.defs.set(t,{...e,key:t}),this}reorder(t){let e=this.list(),n=t.filter(r=>this.defs.has(r));n.forEach((r,o)=>{this.defs.get(r).order=o});let s=new Set(n);return e.filter(r=>!s.has(r.key)).forEach((r,o)=>{r.order=n.length+o}),this}list(){return[...this.defs.values()].sort((t,e)=>t.order-e.order)}has(t){return this.defs.has(t)}toFilters(t){return this.list().filter(n=>Object.hasOwn(t,n.key)).map(n=>n.toParams(t[n.key])).reduce((n,s)=>({...n,...s}),{})}activeKeys(t){return this.list().filter(e=>e.isActive?.(t)).map(e=>e.key)}};var w=class{defs=new Map;add(t){if(this.defs.has(t.id))throw new Error(`DatasetRegistry: dataset "${t.id}" is already registered`);return this.defs.set(t.id,{...t}),this}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(t=>t.visible?.()!==!1).map(t=>t.id)}};var R=class{map=new Map;dispose(){this.map.clear()}emit(t){let e=this.map.get(t.type);if(e)for(let s of[...e])s(t);let n=this.map.get("*");if(n)for(let s of[...n])s(t)}on(t,e){let n=this.map.get(t);return n||(n=new Set,this.map.set(t,n)),n.add(e),()=>{n.delete(e)}}};var B={pagination:"paged",pageSize:20,debounceMs:250};var x=class{options;constructor(t){this.options=Object.freeze({...B,...t})}};var D=class{filters;map;datasets;primaryDatasetId;store;emitter=new R;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;constructor(t){this.datasets=t.datasets,this.filters=t.filters??new P,this.map=t.map,this.config=new x(t.config);let e=t.primaryDatasetId??this.datasets.list()[0]?.id;if(e==null||!this.datasets.has(e))throw new Error(`ListingEngine: primary dataset "${e??""}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=e,this.store=new S({filters:t.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(t){this.store.setFilters(t),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let e=++this.queryToken,n=this.config.options.debounceMs;return n<=0?this.runQuery(e):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(e))},n)})}async loadPage(){let t=this.state.results.nextCursor;if(t===null)return;let e=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let s=await n.adapter.list(this.currentFilters(),{cursor:t,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(s):this.store.setResults(s),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:s.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(t){this.store.setBounds(t),this.emitter.emit({type:"BoundsChanged",bounds:t});let e=this.currentFilters(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let r=this.datasets.get(s);if(!r)return;let o=await r.adapter.getPoints(e,t);n===this.pointsToken&&this.store.setPoints(s,o)}))}selectPoint(t,e){this.store.setSelection(e);let n=this.state.points[t]?.find(s=>s.id===e);n&&this.emitter.emit({type:"PointClicked",datasetId:t,id:e,entity:n.entity})}toggleLayer(t){let n=!(this.state.layers[t]??!0);this.store.setLayerVisible(t,n),this.emitter.emit({type:"LayerToggled",datasetId:t,visible:n})}subscribe(t){return this.store.subscribe(t)}on(t,e){return this.emitter.on(t,e)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(t){if(t!==this.queryToken)return;let e=this.primaryDataset();this.store.setLoading(!0);try{let n=await e.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(t!==this.queryToken)return;this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{t===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function Mt(...i){let t={config:{},filters:new P,datasets:new w};for(let e of i)e(t);return t}var Ot=i=>t=>{t.config={...t.config,...i}},Nt=i=>t=>{t.map=i},zt=i=>t=>{t.datasets.add(i)},Bt=i=>t=>{i(t.filters)},Ut=i=>t=>{t.urlSync=i},Ht=i=>t=>{t.initialFilters=i},jt=i=>t=>{t.primaryDatasetId=i};import{createContext as $,useContext as Q}from"react";import{jsx as f,jsxs as rt}from"react/jsx-runtime";function G(i){return String(i?.title??"")}var W=({item:i})=>f("div",{children:G(i)}),X=()=>f("div",{}),J=()=>f("div",{}),Y=({children:i})=>f("div",{children:i}),Z=({children:i})=>f("div",{children:i}),tt=({value:i,onChange:t,placeholder:e})=>f("input",{type:"search",value:i,placeholder:e,onChange:n=>t(n.target.value),"aria-label":e??"Search"}),et=()=>f("div",{role:"status",children:"No results"}),it=()=>f("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),nt=({count:i})=>rt("div",{children:[i," results"]}),st=({children:i})=>f("div",{children:i}),c={Card:W,Marker:X,Popup:J,Sidebar:Y,FilterPanel:Z,Search:tt,Empty:et,Loading:it,ResultHeader:nt,Toolbar:st},U=$(c);function Vt(i){let{Card:t,Marker:e,Popup:n,Sidebar:s,FilterPanel:r,Search:o,Empty:a,Loading:u,ResultHeader:L,Toolbar:y,children:k}=i,b={Card:t??c.Card,Marker:e??c.Marker,Popup:n??c.Popup,Sidebar:s??c.Sidebar,FilterPanel:r??c.FilterPanel,Search:o??c.Search,Empty:a??c.Empty,Loading:u??c.Loading,ResultHeader:L??c.ResultHeader,Toolbar:y??c.Toolbar};return f(U.Provider,{value:b,children:k})}function v(){return Q(U)}import{createContext as ot}from"react";var M=ot(null);import{useContext as at}from"react";function d(){let i=at(M);if(i===null)throw new Error("useListing must be used within a <ListingProvider>");return i}import{useCallback as H,useSyncExternalStore as lt}from"react";function m(){let i=d(),t=H(n=>i.subscribe(n),[i]),e=H(()=>i.state,[i]);return lt(t,e,e)}import{useCallback as j}from"react";function q(){let i=d(),t=m(),e=j(s=>i.applyFilters(s),[i]),n=j((s,r)=>i.applyFilters({[s]:r}),[i]);return{filters:t.filters,set:e,setField:n}}import{jsx as I,jsxs as pt}from"react/jsx-runtime";function ae({className:i,groupClassName:t}={}){let e=d(),{FilterPanel:n}=v(),{filters:s}=q();return I(n,{children:I("div",{className:i??"space-y-5",children:e.filters.list().map(r=>{if(typeof r.render=="string")return I("div",{"data-filter":r.key,className:t},r.key);let o=r.render;return pt("div",{className:t,children:[r.label&&I("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:r.label}),I(o,{value:r.fromParams(s),onChange:a=>{e.applyFilters(r.toParams(a))}})]},r.key)})})})}function O(){return m().results}import{jsx as N}from"react/jsx-runtime";function ut(i,t){if(i&&typeof i=="object"&&"id"in i){let e=i.id;if(typeof e=="string"||typeof e=="number")return e}return t}function ye({className:i}={}){let t=d(),{items:e}=O(),{pagination:n,selection:s}=m(),{Card:r,Empty:o,Loading:a}=v();return n.loading&&e.length===0?N(a,{}):e.length===0?N(o,{}):N("div",{role:"list",className:i,children:e.map((u,L)=>{let y=ut(u,L);return N(r,{item:u,selected:s===y,onSelect:()=>t.selectPoint(t.primaryDatasetId,y)},y)})})}import{useEffect as z,useRef as C,useState as dt}from"react";import{jsx as ft}from"react/jsx-runtime";var ct={west:-179.9,south:-85,east:179.9,north:85},A=.1,V=.02;function gt(i){if(i.length===0)return null;let t=i[0].lng,e=i[0].lng,n=i[0].lat,s=i[0].lat;for(let{lat:a,lng:u}of i)u<t&&(t=u),u>e&&(e=u),a<n&&(n=a),a>s&&(s=a);let r=s>n?(s-n)*A:V,o=e>t?(e-t)*A:V;return{west:t-o,east:e+o,south:n-r,north:s+r}}function ve(i){let{center:t,zoom:e,fallback:n}=i,s=d(),r=m(),o=C(null),a=C(null),[u,L]=dt(!1),y=C(!1),k=C(!1),b=C(!1),l=s.map;return z(()=>{let T=a.current;if(!l||!T)return;let h=[];for(let p of Object.keys(r.points)){if(r.layers[p]===!1)continue;let g=s.datasets.get(p),E=r.points[p]??[],_={id:p,markers:E.map(F=>({id:F.id,position:F.position,iconUrl:g?.marker.iconUrl?.(F.entity),element:g?.marker.element?.(F.entity)})),clustering:g?.clustering,onMarkerClick:F=>s.selectPoint(p,F)};h.push(l.renderLayer(T,_))}return()=>{h.forEach(p=>p())}},[s,l,u,r.points,r.layers]),z(()=>{if(!o.current||!l)return;let T=o.current,h=!1,p=null;return(async()=>{let g=await l.mount(T,{center:t,zoom:e});if(h){l.destroy(g);return}a.current=g,p=l.onBoundsChange(g,E=>{b.current?b.current=!1:k.current=!0,s.loadPoints(E)}),L(!0),s.loadPoints(ct)})(),()=>{h=!0,p?.(),a.current&&(l.destroy(a.current),a.current=null),L(!1)}},[s,l]),z(()=>{let T=a.current;if(!l||!T||t||y.current||k.current)return;let h=[];for(let g of Object.keys(r.points))if(r.layers[g]!==!1)for(let E of r.points[g]??[])h.push(E.position);let p=gt(h);p&&(y.current=!0,b.current=!0,l.fitBounds(T,p))},[l,t,u,r.points,r.layers]),ft("div",{ref:o,className:!l&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:!l&&n})}import{jsx as mt}from"react/jsx-runtime";function ke(){let i=d(),{results:t,pagination:e}=m(),n=t.nextCursor==null||e.loading;return mt("button",{type:"button",disabled:n,onClick:()=>{i.loadPage()},children:"Load more"})}import{jsx as yt}from"react/jsx-runtime";function De(){let{items:i,total:t}=O(),{ResultHeader:e}=v();return yt(e,{count:i.length,total:t})}import{useEffect as ht,useState as K}from"react";import{jsx as Tt}from"react/jsx-runtime";function Ue(i){let{children:t,...e}=i,[n]=K(()=>e),[s,r]=K(null);return ht(()=>{let o=new D({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),r(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),r(a=>a===o?null:a)}},[n]),s?Tt(M.Provider,{value:s,children:t}):null}export{S as a,P as b,w as c,R as d,B as e,x as f,D as g,Mt as h,Ot as i,Nt as j,zt as k,Bt as l,Ut as m,Ht as n,jt as o,Vt as p,v as q,M as r,d as s,m as t,q as u,ae as v,O as w,ye as x,ve as y,ke as z,De as A,Ue as B};
2
+ var S=class{state;listeners=new Set;constructor(t){this.state=this.freezeState({filters:{...t.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,pagination:{mode:t.mode??"paged",loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(t){this.setState({filters:{...this.state.filters,...t}})}setResults(t){this.setState({results:{items:[...t.items],nextCursor:t.nextCursor,total:t.total}})}appendResults(t){this.setState({results:{items:[...this.state.results.items,...t.items],nextCursor:t.nextCursor,total:t.total}})}setBounds(t){this.setState({bounds:t?{...t}:null})}setSelection(t){this.setState({selection:t})}setLayerVisible(t,e){this.setState({layers:{...this.state.layers,[t]:e}})}setLoading(t){this.setState({pagination:{...this.state.pagination,loading:t}})}setPoints(t,e){this.setState({points:{...this.state.points,[t]:[...e]}})}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}setState(t){this.state=this.freezeState({...this.state,...t}),this.notify()}notify(){for(let t of this.listeners)t()}freezeState(t){Object.freeze(t.filters),Object.freeze(t.results.items),Object.freeze(t.results),t.bounds&&Object.freeze(t.bounds),Object.freeze(t.pagination),Object.freeze(t.layers);for(let e of Object.values(t.points))Object.freeze(e);return Object.freeze(t.points),Object.freeze(t)}};var P=class{defs=new Map;add(t){if(this.defs.has(t.key))throw new Error(`FilterRegistry: filter "${t.key}" is already registered`);return this.defs.set(t.key,{...t}),this}remove(t){return this.defs.delete(t),this}replace(t,e){if(!this.defs.has(t))throw new Error(`FilterRegistry: cannot replace unregistered filter "${t}"`);return this.defs.set(t,{...e,key:t}),this}reorder(t){let e=this.list(),n=t.filter(r=>this.defs.has(r));n.forEach((r,o)=>{this.defs.get(r).order=o});let s=new Set(n);return e.filter(r=>!s.has(r.key)).forEach((r,o)=>{r.order=n.length+o}),this}list(){return[...this.defs.values()].sort((t,e)=>t.order-e.order)}has(t){return this.defs.has(t)}toFilters(t){return this.list().filter(n=>Object.hasOwn(t,n.key)).map(n=>n.toParams(t[n.key])).reduce((n,s)=>({...n,...s}),{})}activeKeys(t){return this.list().filter(e=>e.isActive?.(t)).map(e=>e.key)}};var w=class{defs=new Map;add(t){if(this.defs.has(t.id))throw new Error(`DatasetRegistry: dataset "${t.id}" is already registered`);return this.defs.set(t.id,{...t}),this}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(t=>t.visible?.()!==!1).map(t=>t.id)}};var R=class{map=new Map;dispose(){this.map.clear()}emit(t){let e=this.map.get(t.type);if(e)for(let s of[...e])s(t);let n=this.map.get("*");if(n)for(let s of[...n])s(t)}on(t,e){let n=this.map.get(t);return n||(n=new Set,this.map.set(t,n)),n.add(e),()=>{n.delete(e)}}};var B={pagination:"paged",pageSize:20,debounceMs:250};var x=class{options;constructor(t){this.options=Object.freeze({...B,...t})}};var D=class{filters;map;datasets;primaryDatasetId;store;emitter=new R;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;constructor(t){this.datasets=t.datasets,this.filters=t.filters??new P,this.map=t.map,this.config=new x(t.config);let e=t.primaryDatasetId??this.datasets.list()[0]?.id;if(e==null||!this.datasets.has(e))throw new Error(`ListingEngine: primary dataset "${e??""}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=e,this.store=new S({filters:t.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(t){this.store.setFilters(t),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let e=++this.queryToken,n=this.config.options.debounceMs;return n<=0?this.runQuery(e):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(e))},n)})}async loadPage(){let t=this.state.results.nextCursor;if(t===null)return;let e=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let s=await n.adapter.list(this.currentFilters(),{cursor:t,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(s):this.store.setResults(s),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:s.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(t){this.store.setBounds(t),this.emitter.emit({type:"BoundsChanged",bounds:t});let e=this.currentFilters(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let r=this.datasets.get(s);if(!r)return;let o=await r.adapter.getPoints(e,t);n===this.pointsToken&&this.store.setPoints(s,o)}))}selectPoint(t,e){this.store.setSelection(e);let n=this.state.points[t]?.find(s=>s.id===e);n&&this.emitter.emit({type:"PointClicked",datasetId:t,id:e,entity:n.entity})}toggleLayer(t){let n=!(this.state.layers[t]??!0);this.store.setLayerVisible(t,n),this.emitter.emit({type:"LayerToggled",datasetId:t,visible:n})}subscribe(t){return this.store.subscribe(t)}on(t,e){return this.emitter.on(t,e)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(t){if(t!==this.queryToken)return;let e=this.primaryDataset();this.store.setLoading(!0);try{let n=await e.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(t!==this.queryToken)return;this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{t===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function Mt(...i){let t={config:{},filters:new P,datasets:new w};for(let e of i)e(t);return t}var Ot=i=>t=>{t.config={...t.config,...i}},Nt=i=>t=>{t.map=i},zt=i=>t=>{t.datasets.add(i)},Bt=i=>t=>{i(t.filters)},Ut=i=>t=>{t.urlSync=i},Ht=i=>t=>{t.initialFilters=i},jt=i=>t=>{t.primaryDatasetId=i};import{createContext as $,useContext as Q}from"react";import{jsx as f,jsxs as rt}from"react/jsx-runtime";function G(i){return String(i?.title??"")}var W=({item:i})=>f("div",{children:G(i)}),X=()=>f("div",{}),J=()=>f("div",{}),Y=({children:i})=>f("div",{children:i}),Z=({children:i})=>f("div",{children:i}),tt=({value:i,onChange:t,placeholder:e})=>f("input",{type:"search",value:i,placeholder:e,onChange:n=>t(n.target.value),"aria-label":e??"Search"}),et=()=>f("div",{role:"status",children:"No results"}),it=()=>f("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),nt=({count:i})=>rt("div",{children:[i," results"]}),st=({children:i})=>f("div",{children:i}),c={Card:W,Marker:X,Popup:J,Sidebar:Y,FilterPanel:Z,Search:tt,Empty:et,Loading:it,ResultHeader:nt,Toolbar:st},U=$(c);function Vt(i){let{Card:t,Marker:e,Popup:n,Sidebar:s,FilterPanel:r,Search:o,Empty:a,Loading:u,ResultHeader:L,Toolbar:y,children:k}=i,b={Card:t??c.Card,Marker:e??c.Marker,Popup:n??c.Popup,Sidebar:s??c.Sidebar,FilterPanel:r??c.FilterPanel,Search:o??c.Search,Empty:a??c.Empty,Loading:u??c.Loading,ResultHeader:L??c.ResultHeader,Toolbar:y??c.Toolbar};return f(U.Provider,{value:b,children:k})}function v(){return Q(U)}import{createContext as ot}from"react";var M=ot(null);import{useContext as at}from"react";function d(){let i=at(M);if(i===null)throw new Error("useListing must be used within a <ListingProvider>");return i}import{useCallback as H,useSyncExternalStore as lt}from"react";function m(){let i=d(),t=H(n=>i.subscribe(n),[i]),e=H(()=>i.state,[i]);return lt(t,e,e)}import{useCallback as j}from"react";function q(){let i=d(),t=m(),e=j(s=>i.applyFilters(s),[i]),n=j((s,r)=>i.applyFilters({[s]:r}),[i]);return{filters:t.filters,set:e,setField:n}}import{jsx as I,jsxs as pt}from"react/jsx-runtime";function ae({className:i,groupClassName:t}={}){let e=d(),{FilterPanel:n}=v(),{filters:s}=q();return I(n,{children:I("div",{className:i??"space-y-5",children:e.filters.list().map(r=>{if(typeof r.render=="string")return I("div",{"data-filter":r.key,className:t},r.key);let o=r.render;return pt("div",{className:t,children:[r.label&&I("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:r.label}),I(o,{value:r.fromParams(s),onChange:a=>{e.applyFilters(r.toParams(a))}})]},r.key)})})})}function O(){return m().results}import{jsx as N}from"react/jsx-runtime";function ut(i,t){if(i&&typeof i=="object"&&"id"in i){let e=i.id;if(typeof e=="string"||typeof e=="number")return e}return t}function ye({className:i}={}){let t=d(),{items:e}=O(),{pagination:n,selection:s}=m(),{Card:r,Empty:o,Loading:a}=v();return n.loading&&e.length===0?N(a,{}):e.length===0?N(o,{}):N("div",{role:"list",className:i,children:e.map((u,L)=>{let y=ut(u,L);return N(r,{item:u,selected:s===y,onSelect:()=>t.selectPoint(t.primaryDatasetId,y)},y)})})}import{useEffect as z,useRef as C,useState as dt}from"react";import{jsx as ft}from"react/jsx-runtime";var ct={west:-179.9,south:-85,east:179.9,north:85},A=.1,V=.02;function gt(i){if(i.length===0)return null;let t=i[0].lng,e=i[0].lng,n=i[0].lat,s=i[0].lat;for(let{lat:a,lng:u}of i)u<t&&(t=u),u>e&&(e=u),a<n&&(n=a),a>s&&(s=a);let r=s>n?(s-n)*A:V,o=e>t?(e-t)*A:V;return{west:t-o,east:e+o,south:n-r,north:s+r}}function ve(i){let{center:t,zoom:e,fallback:n}=i,s=d(),r=m(),o=C(null),a=C(null),[u,L]=dt(!1),y=C(!1),k=C(!1),b=C(!1),l=s.map;return z(()=>{let T=a.current;if(!l||!T)return;let h=[];for(let p of Object.keys(r.points)){if(r.layers[p]===!1)continue;let g=s.datasets.get(p),E=r.points[p]??[],_={id:p,markers:E.map(F=>({id:F.id,position:F.position,iconUrl:g?.marker.iconUrl?.(F.entity),element:g?.marker.element?.(F.entity)})),clustering:g?.clustering,onMarkerClick:F=>s.selectPoint(p,F)};h.push(l.renderLayer(T,_))}return()=>{h.forEach(p=>p())}},[s,l,u,r.points,r.layers]),z(()=>{if(!o.current||!l)return;let T=o.current,h=!1,p=null;return(async()=>{let g=await l.mount(T,{center:t,zoom:e});if(h){l.destroy(g);return}a.current=g,p=l.onBoundsChange(g,E=>{b.current?b.current=!1:k.current=!0,s.loadPoints(E)}),L(!0),s.loadPoints(ct)})(),()=>{h=!0,p?.(),a.current&&(l.destroy(a.current),a.current=null),L(!1)}},[s,l]),z(()=>{let T=a.current;if(!l||!T||t||y.current||k.current)return;let h=[];for(let g of Object.keys(r.points))if(r.layers[g]!==!1)for(let E of r.points[g]??[])h.push(E.position);let p=gt(h);p&&(y.current=!0,b.current=!0,l.fitBounds(T,p))},[l,t,u,r.points,r.layers]),ft("div",{ref:o,className:!l&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:!l&&n})}import{jsx as mt}from"react/jsx-runtime";function ke(){let i=d(),{results:t,pagination:e}=m();return t.nextCursor==null?null:mt("button",{type:"button",disabled:e.loading,onClick:()=>{i.loadPage()},children:"Load more"})}import{jsx as yt}from"react/jsx-runtime";function De(){let{items:i,total:t}=O(),{ResultHeader:e}=v();return yt(e,{count:i.length,total:t})}import{useEffect as ht,useState as K}from"react";import{jsx as Tt}from"react/jsx-runtime";function Ue(i){let{children:t,...e}=i,[n]=K(()=>e),[s,r]=K(null);return ht(()=>{let o=new D({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),r(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),r(a=>a===o?null:a)}},[n]),s?Tt(M.Provider,{value:s,children:t}):null}export{S as a,P as b,w as c,R as d,B as e,x as f,D as g,Mt as h,Ot as i,Nt as j,zt as k,Bt as l,Ut as m,Ht as n,jt as o,Vt as p,v as q,M as r,d as s,m as t,q as u,ae as v,O as w,ye as x,ve as y,ke as z,De as A,Ue as B};
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(); } } var _class;"use client";
2
- var _chunkWSAS5XXVcjs = require('./chunk-WSAS5XXV.cjs');var _chunk5O36WI7Hcjs = require('./chunk-5O36WI7H.cjs');var _chunkCHNUE46Kcjs = require('./chunk-CHNUE46K.cjs');var _chunk2VUHLHHXcjs = require('./chunk-2VUHLHHX.cjs');var d=(o=>(o.Paged="paged",o.Infinite="infinite",o))(d||{});var f=(r=>(r.FiltersChanged="FiltersChanged",r.ResultsLoaded="ResultsLoaded",r.PointClicked="PointClicked",r.BoundsChanged="BoundsChanged",r.LayerToggled="LayerToggled",r))(f||{});var u= (_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);var _jsxruntime = require('react/jsx-runtime');function Z({children:e}){let{Toolbar:t}=_chunk5O36WI7Hcjs.q.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function tt(){let e=_chunk5O36WI7Hcjs.s.call(void 0, ),t=_chunk5O36WI7Hcjs.t.call(void 0, ),o=_react.useCallback.call(void 0, a=>e.loadPoints(a),[e]),n=_react.useCallback.call(void 0, (a,r)=>e.selectPoint(a,r),[e]);return{bounds:t.bounds,points:t.points,loadPoints:o,selectPoint:n}}function it(e){let t=_chunk5O36WI7Hcjs.s.call(void 0, ),o=_chunk5O36WI7Hcjs.t.call(void 0, ),n=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(o.layers[e], () => (!0)),points:_nullishCoalesce(o.points[e], () => ([])),toggle:n}}exports.BrowserHistoryPort = _chunkCHNUE46Kcjs.a; exports.DatasetRegistry = _chunk5O36WI7Hcjs.c; exports.FilterRegistry = _chunk5O36WI7Hcjs.b; exports.ListingApp = _chunkWSAS5XXVcjs.p; exports.ListingComponentsProvider = _chunk5O36WI7Hcjs.p; exports.ListingConfig = _chunk5O36WI7Hcjs.f; exports.ListingEngine = _chunk5O36WI7Hcjs.g; exports.ListingEngineContext = _chunk5O36WI7Hcjs.r; exports.ListingEventType = f; exports.ListingFilters = _chunk5O36WI7Hcjs.v; exports.ListingList = _chunk5O36WI7Hcjs.x; exports.ListingMap = _chunk5O36WI7Hcjs.y; exports.ListingPagination = _chunk5O36WI7Hcjs.z; exports.ListingProvider = _chunk5O36WI7Hcjs.B; exports.ListingResultHeader = _chunk5O36WI7Hcjs.A; exports.ListingStore = _chunk5O36WI7Hcjs.a; exports.ListingToolbar = Z; exports.MemoryHistoryPort = u; exports.PaginationMode = d; exports.TypedEmitter = _chunk5O36WI7Hcjs.d; exports.UrlSyncController = _chunk2VUHLHHXcjs.a; exports.composeListingProviders = _chunk5O36WI7Hcjs.h; exports.listingDefaultConfig = _chunk5O36WI7Hcjs.e; exports.useListing = _chunk5O36WI7Hcjs.s; exports.useListingComponents = _chunk5O36WI7Hcjs.q; exports.useListingEvent = _chunkWSAS5XXVcjs.a; exports.useListingFilters = _chunk5O36WI7Hcjs.u; exports.useListingLayer = it; exports.useListingMap = tt; exports.useListingResults = _chunk5O36WI7Hcjs.w; exports.useListingState = _chunk5O36WI7Hcjs.t; exports.withConfig = _chunk5O36WI7Hcjs.i; exports.withDataset = _chunk5O36WI7Hcjs.k; exports.withFilters = _chunk5O36WI7Hcjs.l; exports.withInitialFilters = _chunk5O36WI7Hcjs.n; exports.withMap = _chunk5O36WI7Hcjs.j; exports.withPrimaryDataset = _chunk5O36WI7Hcjs.o; exports.withUrlSync = _chunk5O36WI7Hcjs.m;
2
+ var _chunkKE33GMRXcjs = require('./chunk-KE33GMRX.cjs');var _chunkF4G42IGQcjs = require('./chunk-F4G42IGQ.cjs');var _chunkCHNUE46Kcjs = require('./chunk-CHNUE46K.cjs');var _chunk2VUHLHHXcjs = require('./chunk-2VUHLHHX.cjs');var d=(o=>(o.Paged="paged",o.Infinite="infinite",o))(d||{});var f=(r=>(r.FiltersChanged="FiltersChanged",r.ResultsLoaded="ResultsLoaded",r.PointClicked="PointClicked",r.BoundsChanged="BoundsChanged",r.LayerToggled="LayerToggled",r))(f||{});var u= (_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);var _jsxruntime = require('react/jsx-runtime');function Z({children:e}){let{Toolbar:t}=_chunkF4G42IGQcjs.q.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function tt(){let e=_chunkF4G42IGQcjs.s.call(void 0, ),t=_chunkF4G42IGQcjs.t.call(void 0, ),o=_react.useCallback.call(void 0, a=>e.loadPoints(a),[e]),n=_react.useCallback.call(void 0, (a,r)=>e.selectPoint(a,r),[e]);return{bounds:t.bounds,points:t.points,loadPoints:o,selectPoint:n}}function it(e){let t=_chunkF4G42IGQcjs.s.call(void 0, ),o=_chunkF4G42IGQcjs.t.call(void 0, ),n=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(o.layers[e], () => (!0)),points:_nullishCoalesce(o.points[e], () => ([])),toggle:n}}exports.BrowserHistoryPort = _chunkCHNUE46Kcjs.a; exports.DatasetRegistry = _chunkF4G42IGQcjs.c; exports.FilterRegistry = _chunkF4G42IGQcjs.b; exports.ListingApp = _chunkKE33GMRXcjs.p; exports.ListingComponentsProvider = _chunkF4G42IGQcjs.p; exports.ListingConfig = _chunkF4G42IGQcjs.f; exports.ListingEngine = _chunkF4G42IGQcjs.g; exports.ListingEngineContext = _chunkF4G42IGQcjs.r; exports.ListingEventType = f; exports.ListingFilters = _chunkF4G42IGQcjs.v; exports.ListingList = _chunkF4G42IGQcjs.x; exports.ListingMap = _chunkF4G42IGQcjs.y; exports.ListingPagination = _chunkF4G42IGQcjs.z; exports.ListingProvider = _chunkF4G42IGQcjs.B; exports.ListingResultHeader = _chunkF4G42IGQcjs.A; exports.ListingStore = _chunkF4G42IGQcjs.a; exports.ListingToolbar = Z; exports.MemoryHistoryPort = u; exports.PaginationMode = d; exports.TypedEmitter = _chunkF4G42IGQcjs.d; exports.UrlSyncController = _chunk2VUHLHHXcjs.a; exports.composeListingProviders = _chunkF4G42IGQcjs.h; exports.listingDefaultConfig = _chunkF4G42IGQcjs.e; exports.useListing = _chunkF4G42IGQcjs.s; exports.useListingComponents = _chunkF4G42IGQcjs.q; exports.useListingEvent = _chunkKE33GMRXcjs.a; exports.useListingFilters = _chunkF4G42IGQcjs.u; exports.useListingLayer = it; exports.useListingMap = tt; exports.useListingResults = _chunkF4G42IGQcjs.w; exports.useListingState = _chunkF4G42IGQcjs.t; exports.withConfig = _chunkF4G42IGQcjs.i; exports.withDataset = _chunkF4G42IGQcjs.k; exports.withFilters = _chunkF4G42IGQcjs.l; exports.withInitialFilters = _chunkF4G42IGQcjs.n; exports.withMap = _chunkF4G42IGQcjs.j; exports.withPrimaryDataset = _chunkF4G42IGQcjs.o; exports.withUrlSync = _chunkF4G42IGQcjs.m;
package/dist/index.d.cts CHANGED
@@ -9,7 +9,7 @@ import { H as HistoryPort, U as UrlSyncController } from './url-sync.controller-
9
9
  export { a as UrlSyncEngine, b as UrlSyncOptions } from './url-sync.controller-CsU_QxoS.cjs';
10
10
  import * as react from 'react';
11
11
  import { ReactNode } from 'react';
12
- export { L as ListingApp, a as ListingAppProps } from './listing-app-CVGVzkaD.cjs';
12
+ export { L as ListingApp, a as ListingAppProps } from './listing-app-D2UB9ru3.cjs';
13
13
 
14
14
  declare enum ListingEventType {
15
15
  FiltersChanged = "FiltersChanged",
@@ -477,9 +477,11 @@ interface IListingMapProps {
477
477
  declare function ListingMap(props: IListingMapProps): react.JSX.Element;
478
478
 
479
479
  /**
480
- * Structure-only "Load more" control. Disabled when there is no next page
481
- * (`results.nextCursor == null`) or a query is already in flight
482
- * (`pagination.loading`); otherwise calls `engine.loadPage()`.
480
+ * Structure-only "Load more" control. Renders NOTHING when there is no next
481
+ * page (`results.nextCursor == null`) -- an empty result set or the last page
482
+ * should not leave a dangling (disabled) button behind. When a next page
483
+ * exists, the button is disabled only while a query is in flight
484
+ * (`pagination.loading`); otherwise it calls `engine.loadPage()`.
483
485
  *
484
486
  * Renders a plain `<button>` rather than an injected component: `useListingComponents()`
485
487
  * (`IListingComponents`) has no `Button` slot yet, so there is nothing to
@@ -487,7 +489,7 @@ declare function ListingMap(props: IListingMapProps): react.JSX.Element;
487
489
  * adapter's styled Button) is a documented future enhancement once that slot
488
490
  * exists.
489
491
  */
490
- declare function ListingPagination(): react.JSX.Element;
492
+ declare function ListingPagination(): react.JSX.Element | null;
491
493
 
492
494
  /** Structure-only result count header: `{ items, total }` from `useListingResults()` piped into the injected `ResultHeader`. */
493
495
  declare function ListingResultHeader(): react.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { H as HistoryPort, U as UrlSyncController } from './url-sync.controller-
9
9
  export { a as UrlSyncEngine, b as UrlSyncOptions } from './url-sync.controller-DX67JivW.js';
10
10
  import * as react from 'react';
11
11
  import { ReactNode } from 'react';
12
- export { L as ListingApp, a as ListingAppProps } from './listing-app-Cxw8Kym4.js';
12
+ export { L as ListingApp, a as ListingAppProps } from './listing-app-DDKZ6Inn.js';
13
13
 
14
14
  declare enum ListingEventType {
15
15
  FiltersChanged = "FiltersChanged",
@@ -477,9 +477,11 @@ interface IListingMapProps {
477
477
  declare function ListingMap(props: IListingMapProps): react.JSX.Element;
478
478
 
479
479
  /**
480
- * Structure-only "Load more" control. Disabled when there is no next page
481
- * (`results.nextCursor == null`) or a query is already in flight
482
- * (`pagination.loading`); otherwise calls `engine.loadPage()`.
480
+ * Structure-only "Load more" control. Renders NOTHING when there is no next
481
+ * page (`results.nextCursor == null`) -- an empty result set or the last page
482
+ * should not leave a dangling (disabled) button behind. When a next page
483
+ * exists, the button is disabled only while a query is in flight
484
+ * (`pagination.loading`); otherwise it calls `engine.loadPage()`.
483
485
  *
484
486
  * Renders a plain `<button>` rather than an injected component: `useListingComponents()`
485
487
  * (`IListingComponents`) has no `Button` slot yet, so there is nothing to
@@ -487,7 +489,7 @@ declare function ListingMap(props: IListingMapProps): react.JSX.Element;
487
489
  * adapter's styled Button) is a documented future enhancement once that slot
488
490
  * exists.
489
491
  */
490
- declare function ListingPagination(): react.JSX.Element;
492
+ declare function ListingPagination(): react.JSX.Element | null;
491
493
 
492
494
  /** Structure-only result count header: `{ items, total }` from `useListingResults()` piped into the injected `ResultHeader`. */
493
495
  declare function ListingResultHeader(): react.JSX.Element;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as O,p as m}from"./chunk-SDF5ANTO.js";import{A as N,B as U,a as y,b as P,c as L,d as h,e as b,f as x,g as C,h as I,i as k,j as q,k as v,l as B,m as S,n as A,o as F,p as T,q as p,r as w,s,t as i,u as H,v as z,w as D,x as G,y as J,z as K}from"./chunk-PFPHWJAA.js";import{a as R}from"./chunk-5FBI2WIM.js";import{a as Q}from"./chunk-35KYEBAC.js";var d=(o=>(o.Paged="paged",o.Infinite="infinite",o))(d||{});var f=(r=>(r.FiltersChanged="FiltersChanged",r.ResultsLoaded="ResultsLoaded",r.PointClicked="PointClicked",r.BoundsChanged="BoundsChanged",r.LayerToggled="LayerToggled",r))(f||{});var u=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()}};import{jsx as c}from"react/jsx-runtime";function Z({children:e}){let{Toolbar:t}=p();return c(t,{children:e})}import{useCallback as l}from"react";function tt(){let e=s(),t=i(),o=l(a=>e.loadPoints(a),[e]),n=l((a,r)=>e.selectPoint(a,r),[e]);return{bounds:t.bounds,points:t.points,loadPoints:o,selectPoint:n}}import{useCallback as g}from"react";function it(e){let t=s(),o=i(),n=g(()=>t.toggleLayer(e),[t,e]);return{visible:o.layers[e]??!0,points:o.points[e]??[],toggle:n}}export{R as BrowserHistoryPort,L as DatasetRegistry,P as FilterRegistry,m as ListingApp,T as ListingComponentsProvider,x as ListingConfig,C as ListingEngine,w as ListingEngineContext,f as ListingEventType,z as ListingFilters,G as ListingList,J as ListingMap,K as ListingPagination,U as ListingProvider,N as ListingResultHeader,y as ListingStore,Z as ListingToolbar,u as MemoryHistoryPort,d as PaginationMode,h as TypedEmitter,Q as UrlSyncController,I as composeListingProviders,b as listingDefaultConfig,s as useListing,p as useListingComponents,O as useListingEvent,H as useListingFilters,it as useListingLayer,tt as useListingMap,D as useListingResults,i as useListingState,k as withConfig,v as withDataset,B as withFilters,A as withInitialFilters,q as withMap,F as withPrimaryDataset,S as withUrlSync};
2
+ import{a as O,p as m}from"./chunk-CHMSXWBT.js";import{A as N,B as U,a as y,b as P,c as L,d as h,e as b,f as x,g as C,h as I,i as k,j as q,k as v,l as B,m as S,n as A,o as F,p as T,q as p,r as w,s,t as i,u as H,v as z,w as D,x as G,y as J,z as K}from"./chunk-MAAKKFJ6.js";import{a as R}from"./chunk-5FBI2WIM.js";import{a as Q}from"./chunk-35KYEBAC.js";var d=(o=>(o.Paged="paged",o.Infinite="infinite",o))(d||{});var f=(r=>(r.FiltersChanged="FiltersChanged",r.ResultsLoaded="ResultsLoaded",r.PointClicked="PointClicked",r.BoundsChanged="BoundsChanged",r.LayerToggled="LayerToggled",r))(f||{});var u=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()}};import{jsx as c}from"react/jsx-runtime";function Z({children:e}){let{Toolbar:t}=p();return c(t,{children:e})}import{useCallback as l}from"react";function tt(){let e=s(),t=i(),o=l(a=>e.loadPoints(a),[e]),n=l((a,r)=>e.selectPoint(a,r),[e]);return{bounds:t.bounds,points:t.points,loadPoints:o,selectPoint:n}}import{useCallback as g}from"react";function it(e){let t=s(),o=i(),n=g(()=>t.toggleLayer(e),[t,e]);return{visible:o.layers[e]??!0,points:o.points[e]??[],toggle:n}}export{R as BrowserHistoryPort,L as DatasetRegistry,P as FilterRegistry,m as ListingApp,T as ListingComponentsProvider,x as ListingConfig,C as ListingEngine,w as ListingEngineContext,f as ListingEventType,z as ListingFilters,G as ListingList,J as ListingMap,K as ListingPagination,U as ListingProvider,N as ListingResultHeader,y as ListingStore,Z as ListingToolbar,u as MemoryHistoryPort,d as PaginationMode,h as TypedEmitter,Q as UrlSyncController,I as composeListingProviders,b as listingDefaultConfig,s as useListing,p as useListingComponents,O as useListingEvent,H as useListingFilters,it as useListingLayer,tt as useListingMap,D as useListingResults,i as useListingState,k as withConfig,v as withDataset,B as withFilters,A as withInitialFilters,q as withMap,F as withPrimaryDataset,S as withUrlSync};
@@ -45,6 +45,13 @@ interface IStyledListingLayoutProps {
45
45
  toolbarEnd?: ReactNode;
46
46
  /** Optional bottom-nav action button (e.g. "Add"), forwarded verbatim to `<BottomNav action={...} />`. Omit to render just Filters + the List|Map toggle. */
47
47
  mobileAction?: IBottomNavAction;
48
+ /**
49
+ * Whether a map is configured. When `false`, the map region is dropped and
50
+ * the results list fills the full width as a multi-column grid, and the
51
+ * mobile List|Map toggle is omitted (nothing to toggle to). Defaults to
52
+ * `true` (the split list/map view). `ListingApp` passes `map != null`.
53
+ */
54
+ hasMap?: boolean;
48
55
  /** Whether the layout fetches the first page itself on mount (`engine.applyFilters({})`). Defaults to `true`. */
49
56
  autoFetch?: boolean;
50
57
  /** Forwarded verbatim to `<ListingMap center={mapCenter} />` -- see that component's "Auto-fit" doc comment. */
@@ -91,7 +98,7 @@ interface IStyledListingLayoutProps {
91
98
  * default, exactly like `/shadcn`'s `ListingLayout` -- pass `autoFetch={false}`
92
99
  * to opt out and drive the first fetch yourself.
93
100
  */
94
- declare function StyledListingLayout({ search, toolbarEnd, mobileAction, autoFetch, mapCenter, mapZoom, className, }: IStyledListingLayoutProps): react.JSX.Element;
101
+ declare function StyledListingLayout({ search, toolbarEnd, mobileAction, autoFetch, hasMap, mapCenter, mapZoom, className, }: IStyledListingLayoutProps): react.JSX.Element;
95
102
 
96
103
  /**
97
104
  * Same two-shape `map` prop as `/shadcn`'s `ListingApp` (see that file's
@@ -45,6 +45,13 @@ interface IStyledListingLayoutProps {
45
45
  toolbarEnd?: ReactNode;
46
46
  /** Optional bottom-nav action button (e.g. "Add"), forwarded verbatim to `<BottomNav action={...} />`. Omit to render just Filters + the List|Map toggle. */
47
47
  mobileAction?: IBottomNavAction;
48
+ /**
49
+ * Whether a map is configured. When `false`, the map region is dropped and
50
+ * the results list fills the full width as a multi-column grid, and the
51
+ * mobile List|Map toggle is omitted (nothing to toggle to). Defaults to
52
+ * `true` (the split list/map view). `ListingApp` passes `map != null`.
53
+ */
54
+ hasMap?: boolean;
48
55
  /** Whether the layout fetches the first page itself on mount (`engine.applyFilters({})`). Defaults to `true`. */
49
56
  autoFetch?: boolean;
50
57
  /** Forwarded verbatim to `<ListingMap center={mapCenter} />` -- see that component's "Auto-fit" doc comment. */
@@ -91,7 +98,7 @@ interface IStyledListingLayoutProps {
91
98
  * default, exactly like `/shadcn`'s `ListingLayout` -- pass `autoFetch={false}`
92
99
  * to opt out and drive the first fetch yourself.
93
100
  */
94
- declare function StyledListingLayout({ search, toolbarEnd, mobileAction, autoFetch, mapCenter, mapZoom, className, }: IStyledListingLayoutProps): react.JSX.Element;
101
+ declare function StyledListingLayout({ search, toolbarEnd, mobileAction, autoFetch, hasMap, mapCenter, mapZoom, className, }: IStyledListingLayoutProps): react.JSX.Element;
95
102
 
96
103
  /**
97
104
  * Same two-shape `map` prop as `/shadcn`'s `ListingApp` (see that file's
@@ -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 _chunk5O36WI7Hcjs = require('../chunk-5O36WI7H.cjs');var _chunkLCQZIWBOcjs = require('../chunk-LCQZIWBO.cjs');var _chunk2VUHLHHXcjs = require('../chunk-2VUHLHHX.cjs');var _jsxruntime = require('react/jsx-runtime');function oe(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function w({item:e,selected:i,onSelect:t}){let r=_nullishCoalesce(e, () => ({})),l=_chunkLCQZIWBOcjs.a.call(void 0, "flex w-full flex-col overflow-hidden rounded-lg border bg-card text-left text-card-foreground shadow-sm","motion-safe:transition-shadow",t&&"hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",i&&"ring-2 ring-ring"),a=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl&&_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"aspect-video w-full rounded-t-lg object-cover"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-1 flex-col gap-1 p-3",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start justify-between gap-2",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:r.title}),r.badge&&_jsxruntime.jsx.call(void 0, "span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:r.badge})]}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"text-sm text-muted-foreground",children:r.subtitle}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 font-semibold tabular-nums",children:oe(r.price)})]})]});return t?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:t,"aria-pressed":_nullishCoalesce(i, () => (!1)),className:l,children:a}):_jsxruntime.jsx.call(void 0, "article",{className:l,children:a})}function C(e){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"h-8 w-8","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium text-foreground",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-muted-foreground",children:"Try adjusting your filters or search terms."})]})}function I({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-3",children:e})}function D(e){return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-3 p-3",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((i,t)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 motion-safe:animate-pulse",children:[_jsxruntime.jsx.call(void 0, "div",{className:"aspect-video w-full rounded-md bg-muted"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-2/3 rounded-md bg-muted"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-1/3 rounded-md bg-muted"})]},t))})}function M({point:e}){let i=_nullishCoalesce(e.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rounded-full border bg-background px-2 py-0.5 text-xs font-medium tabular-nums shadow-sm",children:_nullishCoalesce(i.price, () => (""))})}function F({entity:e,onClose:i}){let t=_nullishCoalesce(e, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"relative w-64 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-label":"Close",className:"absolute right-2 top-2 rounded-md p-1 text-muted-foreground motion-safe:transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"pr-6",children:[t.title&&_jsxruntime.jsx.call(void 0, "div",{className:"font-medium",children:t.title}),t.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"text-sm text-muted-foreground",children:t.subtitle}),t.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 font-semibold tabular-nums",children:t.price})]})]})}function S({count:e,total:i}){let t=i!=null&&i!==e?`${e} of ${i} results`:`${e} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"text-sm tabular-nums text-muted-foreground",children:t})}function T({value:e,onChange:i,placeholder:t}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:e,placeholder:t,onChange:r=>i(r.target.value),"aria-label":_nullishCoalesce(t, () => ("Search")),className:_chunkLCQZIWBOcjs.a.call(void 0, "h-9 w-full rounded-md border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})}function R({children:e}){return _jsxruntime.jsx.call(void 0, "aside",{className:"flex w-full flex-col gap-4 p-4 md:border-r md:border-border",children:e})}function A({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-2 border-b p-2",children:e})}var g={Card:w,Marker:M,Popup:F,Sidebar:R,FilterPanel:I,Search:T,Empty:C,Loading:D,ResultHeader:S,Toolbar:A};function fe({children:e}){return _jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.p,{...g,children:e})}var _react = require('react');var ve=_jsxruntime.jsx.call(void 0, "p",{className:"px-4 text-center text-sm text-muted-foreground",children:"Map unavailable - provide a Google Maps API key"});function E({search:e,className:i,toolbarEnd:t,autoFetch:r=!0,mapCenter:l,mapZoom:a}){let p=_chunk5O36WI7Hcjs.s.call(void 0, ),{Search:u}=_chunk5O36WI7Hcjs.q.call(void 0, ),[f,y]=_react.useState.call(void 0, "list");_react.useEffect.call(void 0, ()=>{r!==!1&&p.applyFilters({})},[p,r]);let h=f==="map"?"hidden md:block":"block",P=f==="list"?"hidden md:block":"block";return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkLCQZIWBOcjs.a.call(void 0, "flex h-full min-h-0 w-full flex-col bg-background text-foreground",i),"data-slot":"listing-layout",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"sticky top-0 z-10 flex flex-wrap items-end gap-3 border-b border-border bg-background p-3","data-slot":"listing-layout-filter-bar",children:[e&&_jsxruntime.jsx.call(void 0, "div",{className:"w-full min-w-0 sm:w-auto sm:max-w-xs sm:flex-1",children:_jsxruntime.jsx.call(void 0, u,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.v,{className:"flex flex-wrap items-end gap-3",groupClassName:"min-w-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"ml-auto flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.A,{}),t]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center gap-1 border-b border-border bg-background p-2 md:hidden","data-slot":"listing-layout-mobile-toggle",children:_jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":"View",className:"inline-flex rounded-md border border-border p-0.5",children:[{view:"list",label:"List"},{view:"map",label:"Map"}].map(({view:d,label:n})=>_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":f===d,onClick:()=>y(d),className:_chunkLCQZIWBOcjs.a.call(void 0, "rounded-[5px] px-3 py-1 text-sm font-medium motion-safe:transition-colors",f===d?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground"),children:n},d))})}),_jsxruntime.jsxs.call(void 0, "div",{className:"grid min-h-0 flex-1 md:grid-cols-[minmax(340px,42%)_1fr]","data-slot":"listing-layout-split",children:[_jsxruntime.jsxs.call(void 0, "div",{className:_chunkLCQZIWBOcjs.a.call(void 0, "min-h-0 overflow-y-auto p-3",h),"data-slot":"listing-layout-list",children:[_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.x,{className:"grid content-start gap-3 [grid-template-columns:repeat(auto-fill,minmax(200px,1fr))]"}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-4 flex justify-center",children:_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.z,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:_chunkLCQZIWBOcjs.a.call(void 0, "min-h-0 md:sticky md:top-0",P),"data-slot":"listing-layout-map",children:_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.y,{center:l,zoom:a,fallback:ve})})]})]})}function ee(e){return"provider"in e}function ye(e){let i=e!=null&&!ee(e),t=i?e.apiKey:void 0,r=i?e.mapId:void 0,[l,a]=_react.useState.call(void 0, ()=>!e||ee(e)?{ready:!0,provider:_optionalChain([e, 'optionalAccess', _2 => _2.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!t)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("../maps/google/index.cjs"))).then(({googleProvider:u})=>{p||a({ready:!0,provider:u({apiKey:t,mapId:r})})}),()=>{p=!0}},[t,r]),l}function he(e){let{datasets:i,filters:t,map:r,components:l,urlSync:a,initialFilters:p,config:u,className:f,search:y,autoFetch:h}=e,{ready:P,provider:d}=ye(r);if(!P)return null;let n=[];for(let ie of i)n.push(_chunk5O36WI7Hcjs.k.call(void 0, ie));t&&n.push(_chunk5O36WI7Hcjs.l.call(void 0, t)),d&&n.push(_chunk5O36WI7Hcjs.j.call(void 0, d)),a instanceof _chunk2VUHLHHXcjs.a&&n.push(_chunk5O36WI7Hcjs.m.call(void 0, a)),p&&n.push(_chunk5O36WI7Hcjs.n.call(void 0, p)),u&&n.push(_chunk5O36WI7Hcjs.i.call(void 0, u));let te=_chunk5O36WI7Hcjs.h.call(void 0, ...n),re={...g,...l};return _jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.B,{...te,children:_jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.p,{...re,children:_jsxruntime.jsx.call(void 0, E,{className:f,search:y,autoFetch:h,mapCenter:_optionalChain([r, 'optionalAccess', _3 => _3.center]),mapZoom:_optionalChain([r, 'optionalAccess', _4 => _4.zoom])})})})}exports.DefaultCard = w; exports.DefaultEmpty = C; exports.DefaultFilterPanel = I; exports.DefaultLoading = D; exports.DefaultMarker = M; exports.DefaultPopup = F; exports.DefaultResultHeader = S; exports.DefaultSearch = T; exports.DefaultSidebar = R; exports.DefaultToolbar = A; exports.ListingApp = he; exports.ListingComponentsProviderWithDefaults = fe; exports.ListingLayout = E; exports.cn = _chunkLCQZIWBOcjs.a; exports.shadcnDefaultComponents = g;
2
+ var _chunkF4G42IGQcjs = require('../chunk-F4G42IGQ.cjs');var _chunkLCQZIWBOcjs = require('../chunk-LCQZIWBO.cjs');var _chunk2VUHLHHXcjs = require('../chunk-2VUHLHHX.cjs');var _jsxruntime = require('react/jsx-runtime');function oe(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function w({item:e,selected:i,onSelect:t}){let r=_nullishCoalesce(e, () => ({})),l=_chunkLCQZIWBOcjs.a.call(void 0, "flex w-full flex-col overflow-hidden rounded-lg border bg-card text-left text-card-foreground shadow-sm","motion-safe:transition-shadow",t&&"hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",i&&"ring-2 ring-ring"),a=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl&&_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"aspect-video w-full rounded-t-lg object-cover"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-1 flex-col gap-1 p-3",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start justify-between gap-2",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:r.title}),r.badge&&_jsxruntime.jsx.call(void 0, "span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:r.badge})]}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"text-sm text-muted-foreground",children:r.subtitle}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 font-semibold tabular-nums",children:oe(r.price)})]})]});return t?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:t,"aria-pressed":_nullishCoalesce(i, () => (!1)),className:l,children:a}):_jsxruntime.jsx.call(void 0, "article",{className:l,children:a})}function C(e){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"h-8 w-8","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"text-sm font-medium text-foreground",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-muted-foreground",children:"Try adjusting your filters or search terms."})]})}function I({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-3",children:e})}function D(e){return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-3 p-3",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((i,t)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 motion-safe:animate-pulse",children:[_jsxruntime.jsx.call(void 0, "div",{className:"aspect-video w-full rounded-md bg-muted"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-2/3 rounded-md bg-muted"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-1/3 rounded-md bg-muted"})]},t))})}function M({point:e}){let i=_nullishCoalesce(e.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rounded-full border bg-background px-2 py-0.5 text-xs font-medium tabular-nums shadow-sm",children:_nullishCoalesce(i.price, () => (""))})}function F({entity:e,onClose:i}){let t=_nullishCoalesce(e, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"relative w-64 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-label":"Close",className:"absolute right-2 top-2 rounded-md p-1 text-muted-foreground motion-safe:transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{className:"pr-6",children:[t.title&&_jsxruntime.jsx.call(void 0, "div",{className:"font-medium",children:t.title}),t.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"text-sm text-muted-foreground",children:t.subtitle}),t.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 font-semibold tabular-nums",children:t.price})]})]})}function S({count:e,total:i}){let t=i!=null&&i!==e?`${e} of ${i} results`:`${e} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"text-sm tabular-nums text-muted-foreground",children:t})}function T({value:e,onChange:i,placeholder:t}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:e,placeholder:t,onChange:r=>i(r.target.value),"aria-label":_nullishCoalesce(t, () => ("Search")),className:_chunkLCQZIWBOcjs.a.call(void 0, "h-9 w-full rounded-md border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})}function R({children:e}){return _jsxruntime.jsx.call(void 0, "aside",{className:"flex w-full flex-col gap-4 p-4 md:border-r md:border-border",children:e})}function A({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-2 border-b p-2",children:e})}var g={Card:w,Marker:M,Popup:F,Sidebar:R,FilterPanel:I,Search:T,Empty:C,Loading:D,ResultHeader:S,Toolbar:A};function fe({children:e}){return _jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.p,{...g,children:e})}var _react = require('react');var ve=_jsxruntime.jsx.call(void 0, "p",{className:"px-4 text-center text-sm text-muted-foreground",children:"Map unavailable - provide a Google Maps API key"});function E({search:e,className:i,toolbarEnd:t,autoFetch:r=!0,mapCenter:l,mapZoom:a}){let p=_chunkF4G42IGQcjs.s.call(void 0, ),{Search:u}=_chunkF4G42IGQcjs.q.call(void 0, ),[f,y]=_react.useState.call(void 0, "list");_react.useEffect.call(void 0, ()=>{r!==!1&&p.applyFilters({})},[p,r]);let h=f==="map"?"hidden md:block":"block",P=f==="list"?"hidden md:block":"block";return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkLCQZIWBOcjs.a.call(void 0, "flex h-full min-h-0 w-full flex-col bg-background text-foreground",i),"data-slot":"listing-layout",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"sticky top-0 z-10 flex flex-wrap items-end gap-3 border-b border-border bg-background p-3","data-slot":"listing-layout-filter-bar",children:[e&&_jsxruntime.jsx.call(void 0, "div",{className:"w-full min-w-0 sm:w-auto sm:max-w-xs sm:flex-1",children:_jsxruntime.jsx.call(void 0, u,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.v,{className:"flex flex-wrap items-end gap-3",groupClassName:"min-w-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"ml-auto flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.A,{}),t]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center gap-1 border-b border-border bg-background p-2 md:hidden","data-slot":"listing-layout-mobile-toggle",children:_jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":"View",className:"inline-flex rounded-md border border-border p-0.5",children:[{view:"list",label:"List"},{view:"map",label:"Map"}].map(({view:d,label:n})=>_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":f===d,onClick:()=>y(d),className:_chunkLCQZIWBOcjs.a.call(void 0, "rounded-[5px] px-3 py-1 text-sm font-medium motion-safe:transition-colors",f===d?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground"),children:n},d))})}),_jsxruntime.jsxs.call(void 0, "div",{className:"grid min-h-0 flex-1 md:grid-cols-[minmax(340px,42%)_1fr]","data-slot":"listing-layout-split",children:[_jsxruntime.jsxs.call(void 0, "div",{className:_chunkLCQZIWBOcjs.a.call(void 0, "min-h-0 overflow-y-auto p-3",h),"data-slot":"listing-layout-list",children:[_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.x,{className:"grid content-start gap-3 [grid-template-columns:repeat(auto-fill,minmax(200px,1fr))]"}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-4 flex justify-center",children:_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.z,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:_chunkLCQZIWBOcjs.a.call(void 0, "min-h-0 md:sticky md:top-0",P),"data-slot":"listing-layout-map",children:_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.y,{center:l,zoom:a,fallback:ve})})]})]})}function ee(e){return"provider"in e}function ye(e){let i=e!=null&&!ee(e),t=i?e.apiKey:void 0,r=i?e.mapId:void 0,[l,a]=_react.useState.call(void 0, ()=>!e||ee(e)?{ready:!0,provider:_optionalChain([e, 'optionalAccess', _2 => _2.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!t)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("../maps/google/index.cjs"))).then(({googleProvider:u})=>{p||a({ready:!0,provider:u({apiKey:t,mapId:r})})}),()=>{p=!0}},[t,r]),l}function he(e){let{datasets:i,filters:t,map:r,components:l,urlSync:a,initialFilters:p,config:u,className:f,search:y,autoFetch:h}=e,{ready:P,provider:d}=ye(r);if(!P)return null;let n=[];for(let ie of i)n.push(_chunkF4G42IGQcjs.k.call(void 0, ie));t&&n.push(_chunkF4G42IGQcjs.l.call(void 0, t)),d&&n.push(_chunkF4G42IGQcjs.j.call(void 0, d)),a instanceof _chunk2VUHLHHXcjs.a&&n.push(_chunkF4G42IGQcjs.m.call(void 0, a)),p&&n.push(_chunkF4G42IGQcjs.n.call(void 0, p)),u&&n.push(_chunkF4G42IGQcjs.i.call(void 0, u));let te=_chunkF4G42IGQcjs.h.call(void 0, ...n),re={...g,...l};return _jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.B,{...te,children:_jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.p,{...re,children:_jsxruntime.jsx.call(void 0, E,{className:f,search:y,autoFetch:h,mapCenter:_optionalChain([r, 'optionalAccess', _3 => _3.center]),mapZoom:_optionalChain([r, 'optionalAccess', _4 => _4.zoom])})})})}exports.DefaultCard = w; exports.DefaultEmpty = C; exports.DefaultFilterPanel = I; exports.DefaultLoading = D; exports.DefaultMarker = M; exports.DefaultPopup = F; exports.DefaultResultHeader = S; exports.DefaultSearch = T; exports.DefaultSidebar = R; exports.DefaultToolbar = A; exports.ListingApp = he; exports.ListingComponentsProviderWithDefaults = fe; exports.ListingLayout = E; exports.cn = _chunkLCQZIWBOcjs.a; exports.shadcnDefaultComponents = g;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{A as X,B as Y,h as U,i as H,j as _,k as O,l as W,m as z,n as B,p as v,q as $,s as Z,v as G,x as q,y as J,z as Q}from"../chunk-PFPHWJAA.js";import{a as s}from"../chunk-6PZHSHU3.js";import{a as K}from"../chunk-35KYEBAC.js";import{Fragment as se,jsx as m,jsxs as N}from"react/jsx-runtime";function oe(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function w({item:e,selected:i,onSelect:t}){let r=e??{},l=s("flex w-full flex-col overflow-hidden rounded-lg border bg-card text-left text-card-foreground shadow-sm","motion-safe:transition-shadow",t&&"hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",i&&"ring-2 ring-ring"),a=N(se,{children:[r.imageUrl&&m("img",{src:r.imageUrl,alt:r.title??"",className:"aspect-video w-full rounded-t-lg object-cover"}),N("div",{className:"flex flex-1 flex-col gap-1 p-3",children:[N("div",{className:"flex items-start justify-between gap-2",children:[r.title&&m("span",{className:"font-medium",children:r.title}),r.badge&&m("span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:r.badge})]}),r.subtitle&&m("span",{className:"text-sm text-muted-foreground",children:r.subtitle}),r.price!=null&&m("span",{className:"mt-1 font-semibold tabular-nums",children:oe(r.price)})]})]});return t?m("button",{type:"button",onClick:t,"aria-pressed":i??!1,className:l,children:a}):m("article",{className:l,children:a})}import{jsx as L,jsxs as j}from"react/jsx-runtime";function C(e){return j("div",{role:"status",className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[j("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"h-8 w-8","aria-hidden":"true",children:[L("circle",{cx:"11",cy:"11",r:"7"}),L("path",{d:"m21 21-4.3-4.3"})]}),L("p",{className:"text-sm font-medium text-foreground",children:"No results"}),L("p",{className:"text-xs text-muted-foreground",children:"Try adjusting your filters or search terms."})]})}import{jsx as ae}from"react/jsx-runtime";function I({children:e}){return ae("div",{className:"flex flex-col gap-3",children:e})}import{jsx as x,jsxs as ne}from"react/jsx-runtime";function D(e){return x("div",{className:"flex flex-col gap-3 p-3",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((i,t)=>ne("div",{className:"flex flex-col gap-2 motion-safe:animate-pulse",children:[x("div",{className:"aspect-video w-full rounded-md bg-muted"}),x("div",{className:"h-4 w-2/3 rounded-md bg-muted"}),x("div",{className:"h-3 w-1/3 rounded-md bg-muted"})]},t))})}import{jsx as le}from"react/jsx-runtime";function M({point:e}){let i=e.entity??{};return le("span",{className:"rounded-full border bg-background px-2 py-0.5 text-xs font-medium tabular-nums shadow-sm",children:i.price??""})}import{jsx as c,jsxs as k}from"react/jsx-runtime";function F({entity:e,onClose:i}){let t=e??{};return k("div",{className:"relative w-64 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md",role:"group","aria-label":"Location details",children:[c("button",{type:"button",onClick:i,"aria-label":"Close",className:"absolute right-2 top-2 rounded-md p-1 text-muted-foreground motion-safe:transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4","aria-hidden":"true",children:[c("path",{d:"M18 6 6 18"}),c("path",{d:"m6 6 12 12"})]})}),k("div",{className:"pr-6",children:[t.title&&c("div",{className:"font-medium",children:t.title}),t.subtitle&&c("div",{className:"text-sm text-muted-foreground",children:t.subtitle}),t.price!=null&&c("div",{className:"mt-1 font-semibold tabular-nums",children:t.price})]})]})}import{jsx as pe}from"react/jsx-runtime";function S({count:e,total:i}){let t=i!=null&&i!==e?`${e} of ${i} results`:`${e} results`;return pe("div",{className:"text-sm tabular-nums text-muted-foreground",children:t})}import{jsx as de}from"react/jsx-runtime";function T({value:e,onChange:i,placeholder:t}){return de("input",{type:"search",value:e,placeholder:t,onChange:r=>i(r.target.value),"aria-label":t??"Search",className:s("h-9 w-full rounded-md border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})}import{jsx as me}from"react/jsx-runtime";function R({children:e}){return me("aside",{className:"flex w-full flex-col gap-4 p-4 md:border-r md:border-border",children:e})}import{jsx as ue}from"react/jsx-runtime";function A({children:e}){return ue("div",{className:"flex items-center gap-2 border-b p-2",children:e})}var g={Card:w,Marker:M,Popup:F,Sidebar:R,FilterPanel:I,Search:T,Empty:C,Loading:D,ResultHeader:S,Toolbar:A};import{jsx as ce}from"react/jsx-runtime";function fe({children:e}){return ce(v,{...g,children:e})}import{useEffect as Le,useState as xe}from"react";import{useEffect as ge,useState as be}from"react";import{jsx as o,jsxs as b}from"react/jsx-runtime";var ve=o("p",{className:"px-4 text-center text-sm text-muted-foreground",children:"Map unavailable - provide a Google Maps API key"});function E({search:e,className:i,toolbarEnd:t,autoFetch:r=!0,mapCenter:l,mapZoom:a}){let p=Z(),{Search:u}=$(),[f,y]=be("list");ge(()=>{r!==!1&&p.applyFilters({})},[p,r]);let h=f==="map"?"hidden md:block":"block",P=f==="list"?"hidden md:block":"block";return b("div",{className:s("flex h-full min-h-0 w-full flex-col bg-background text-foreground",i),"data-slot":"listing-layout",children:[b("div",{className:"sticky top-0 z-10 flex flex-wrap items-end gap-3 border-b border-border bg-background p-3","data-slot":"listing-layout-filter-bar",children:[e&&o("div",{className:"w-full min-w-0 sm:w-auto sm:max-w-xs sm:flex-1",children:o(u,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),o(G,{className:"flex flex-wrap items-end gap-3",groupClassName:"min-w-0"}),b("div",{className:"ml-auto flex items-center gap-3",children:[o(X,{}),t]})]}),o("div",{className:"flex items-center justify-center gap-1 border-b border-border bg-background p-2 md:hidden","data-slot":"listing-layout-mobile-toggle",children:o("div",{role:"group","aria-label":"View",className:"inline-flex rounded-md border border-border p-0.5",children:[{view:"list",label:"List"},{view:"map",label:"Map"}].map(({view:d,label:n})=>o("button",{type:"button","aria-pressed":f===d,onClick:()=>y(d),className:s("rounded-[5px] px-3 py-1 text-sm font-medium motion-safe:transition-colors",f===d?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground"),children:n},d))})}),b("div",{className:"grid min-h-0 flex-1 md:grid-cols-[minmax(340px,42%)_1fr]","data-slot":"listing-layout-split",children:[b("div",{className:s("min-h-0 overflow-y-auto p-3",h),"data-slot":"listing-layout-list",children:[o(q,{className:"grid content-start gap-3 [grid-template-columns:repeat(auto-fill,minmax(200px,1fr))]"}),o("div",{className:"mt-4 flex justify-center",children:o(Q,{})})]}),o("div",{className:s("min-h-0 md:sticky md:top-0",P),"data-slot":"listing-layout-map",children:o(J,{center:l,zoom:a,fallback:ve})})]})]})}import{jsx as V}from"react/jsx-runtime";function ee(e){return"provider"in e}function ye(e){let i=e!=null&&!ee(e),t=i?e.apiKey:void 0,r=i?e.mapId:void 0,[l,a]=xe(()=>!e||ee(e)?{ready:!0,provider:e?.provider}:{ready:!1});return Le(()=>{if(!t)return;let p=!1;return import("../maps/google/index.js").then(({googleProvider:u})=>{p||a({ready:!0,provider:u({apiKey:t,mapId:r})})}),()=>{p=!0}},[t,r]),l}function he(e){let{datasets:i,filters:t,map:r,components:l,urlSync:a,initialFilters:p,config:u,className:f,search:y,autoFetch:h}=e,{ready:P,provider:d}=ye(r);if(!P)return null;let n=[];for(let ie of i)n.push(O(ie));t&&n.push(W(t)),d&&n.push(_(d)),a instanceof K&&n.push(z(a)),p&&n.push(B(p)),u&&n.push(H(u));let te=U(...n),re={...g,...l};return V(Y,{...te,children:V(v,{...re,children:V(E,{className:f,search:y,autoFetch:h,mapCenter:r?.center,mapZoom:r?.zoom})})})}export{w as DefaultCard,C as DefaultEmpty,I as DefaultFilterPanel,D as DefaultLoading,M as DefaultMarker,F as DefaultPopup,S as DefaultResultHeader,T as DefaultSearch,R as DefaultSidebar,A as DefaultToolbar,he as ListingApp,fe as ListingComponentsProviderWithDefaults,E as ListingLayout,s as cn,g as shadcnDefaultComponents};
2
+ import{A as X,B as Y,h as U,i as H,j as _,k as O,l as W,m as z,n as B,p as v,q as $,s as Z,v as G,x as q,y as J,z as Q}from"../chunk-MAAKKFJ6.js";import{a as s}from"../chunk-6PZHSHU3.js";import{a as K}from"../chunk-35KYEBAC.js";import{Fragment as se,jsx as m,jsxs as N}from"react/jsx-runtime";function oe(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function w({item:e,selected:i,onSelect:t}){let r=e??{},l=s("flex w-full flex-col overflow-hidden rounded-lg border bg-card text-left text-card-foreground shadow-sm","motion-safe:transition-shadow",t&&"hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",i&&"ring-2 ring-ring"),a=N(se,{children:[r.imageUrl&&m("img",{src:r.imageUrl,alt:r.title??"",className:"aspect-video w-full rounded-t-lg object-cover"}),N("div",{className:"flex flex-1 flex-col gap-1 p-3",children:[N("div",{className:"flex items-start justify-between gap-2",children:[r.title&&m("span",{className:"font-medium",children:r.title}),r.badge&&m("span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:r.badge})]}),r.subtitle&&m("span",{className:"text-sm text-muted-foreground",children:r.subtitle}),r.price!=null&&m("span",{className:"mt-1 font-semibold tabular-nums",children:oe(r.price)})]})]});return t?m("button",{type:"button",onClick:t,"aria-pressed":i??!1,className:l,children:a}):m("article",{className:l,children:a})}import{jsx as L,jsxs as j}from"react/jsx-runtime";function C(e){return j("div",{role:"status",className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[j("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"h-8 w-8","aria-hidden":"true",children:[L("circle",{cx:"11",cy:"11",r:"7"}),L("path",{d:"m21 21-4.3-4.3"})]}),L("p",{className:"text-sm font-medium text-foreground",children:"No results"}),L("p",{className:"text-xs text-muted-foreground",children:"Try adjusting your filters or search terms."})]})}import{jsx as ae}from"react/jsx-runtime";function I({children:e}){return ae("div",{className:"flex flex-col gap-3",children:e})}import{jsx as x,jsxs as ne}from"react/jsx-runtime";function D(e){return x("div",{className:"flex flex-col gap-3 p-3",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((i,t)=>ne("div",{className:"flex flex-col gap-2 motion-safe:animate-pulse",children:[x("div",{className:"aspect-video w-full rounded-md bg-muted"}),x("div",{className:"h-4 w-2/3 rounded-md bg-muted"}),x("div",{className:"h-3 w-1/3 rounded-md bg-muted"})]},t))})}import{jsx as le}from"react/jsx-runtime";function M({point:e}){let i=e.entity??{};return le("span",{className:"rounded-full border bg-background px-2 py-0.5 text-xs font-medium tabular-nums shadow-sm",children:i.price??""})}import{jsx as c,jsxs as k}from"react/jsx-runtime";function F({entity:e,onClose:i}){let t=e??{};return k("div",{className:"relative w-64 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md",role:"group","aria-label":"Location details",children:[c("button",{type:"button",onClick:i,"aria-label":"Close",className:"absolute right-2 top-2 rounded-md p-1 text-muted-foreground motion-safe:transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4","aria-hidden":"true",children:[c("path",{d:"M18 6 6 18"}),c("path",{d:"m6 6 12 12"})]})}),k("div",{className:"pr-6",children:[t.title&&c("div",{className:"font-medium",children:t.title}),t.subtitle&&c("div",{className:"text-sm text-muted-foreground",children:t.subtitle}),t.price!=null&&c("div",{className:"mt-1 font-semibold tabular-nums",children:t.price})]})]})}import{jsx as pe}from"react/jsx-runtime";function S({count:e,total:i}){let t=i!=null&&i!==e?`${e} of ${i} results`:`${e} results`;return pe("div",{className:"text-sm tabular-nums text-muted-foreground",children:t})}import{jsx as de}from"react/jsx-runtime";function T({value:e,onChange:i,placeholder:t}){return de("input",{type:"search",value:e,placeholder:t,onChange:r=>i(r.target.value),"aria-label":t??"Search",className:s("h-9 w-full rounded-md border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})}import{jsx as me}from"react/jsx-runtime";function R({children:e}){return me("aside",{className:"flex w-full flex-col gap-4 p-4 md:border-r md:border-border",children:e})}import{jsx as ue}from"react/jsx-runtime";function A({children:e}){return ue("div",{className:"flex items-center gap-2 border-b p-2",children:e})}var g={Card:w,Marker:M,Popup:F,Sidebar:R,FilterPanel:I,Search:T,Empty:C,Loading:D,ResultHeader:S,Toolbar:A};import{jsx as ce}from"react/jsx-runtime";function fe({children:e}){return ce(v,{...g,children:e})}import{useEffect as Le,useState as xe}from"react";import{useEffect as ge,useState as be}from"react";import{jsx as o,jsxs as b}from"react/jsx-runtime";var ve=o("p",{className:"px-4 text-center text-sm text-muted-foreground",children:"Map unavailable - provide a Google Maps API key"});function E({search:e,className:i,toolbarEnd:t,autoFetch:r=!0,mapCenter:l,mapZoom:a}){let p=Z(),{Search:u}=$(),[f,y]=be("list");ge(()=>{r!==!1&&p.applyFilters({})},[p,r]);let h=f==="map"?"hidden md:block":"block",P=f==="list"?"hidden md:block":"block";return b("div",{className:s("flex h-full min-h-0 w-full flex-col bg-background text-foreground",i),"data-slot":"listing-layout",children:[b("div",{className:"sticky top-0 z-10 flex flex-wrap items-end gap-3 border-b border-border bg-background p-3","data-slot":"listing-layout-filter-bar",children:[e&&o("div",{className:"w-full min-w-0 sm:w-auto sm:max-w-xs sm:flex-1",children:o(u,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),o(G,{className:"flex flex-wrap items-end gap-3",groupClassName:"min-w-0"}),b("div",{className:"ml-auto flex items-center gap-3",children:[o(X,{}),t]})]}),o("div",{className:"flex items-center justify-center gap-1 border-b border-border bg-background p-2 md:hidden","data-slot":"listing-layout-mobile-toggle",children:o("div",{role:"group","aria-label":"View",className:"inline-flex rounded-md border border-border p-0.5",children:[{view:"list",label:"List"},{view:"map",label:"Map"}].map(({view:d,label:n})=>o("button",{type:"button","aria-pressed":f===d,onClick:()=>y(d),className:s("rounded-[5px] px-3 py-1 text-sm font-medium motion-safe:transition-colors",f===d?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground"),children:n},d))})}),b("div",{className:"grid min-h-0 flex-1 md:grid-cols-[minmax(340px,42%)_1fr]","data-slot":"listing-layout-split",children:[b("div",{className:s("min-h-0 overflow-y-auto p-3",h),"data-slot":"listing-layout-list",children:[o(q,{className:"grid content-start gap-3 [grid-template-columns:repeat(auto-fill,minmax(200px,1fr))]"}),o("div",{className:"mt-4 flex justify-center",children:o(Q,{})})]}),o("div",{className:s("min-h-0 md:sticky md:top-0",P),"data-slot":"listing-layout-map",children:o(J,{center:l,zoom:a,fallback:ve})})]})]})}import{jsx as V}from"react/jsx-runtime";function ee(e){return"provider"in e}function ye(e){let i=e!=null&&!ee(e),t=i?e.apiKey:void 0,r=i?e.mapId:void 0,[l,a]=xe(()=>!e||ee(e)?{ready:!0,provider:e?.provider}:{ready:!1});return Le(()=>{if(!t)return;let p=!1;return import("../maps/google/index.js").then(({googleProvider:u})=>{p||a({ready:!0,provider:u({apiKey:t,mapId:r})})}),()=>{p=!0}},[t,r]),l}function he(e){let{datasets:i,filters:t,map:r,components:l,urlSync:a,initialFilters:p,config:u,className:f,search:y,autoFetch:h}=e,{ready:P,provider:d}=ye(r);if(!P)return null;let n=[];for(let ie of i)n.push(O(ie));t&&n.push(W(t)),d&&n.push(_(d)),a instanceof K&&n.push(z(a)),p&&n.push(B(p)),u&&n.push(H(u));let te=U(...n),re={...g,...l};return V(Y,{...te,children:V(v,{...re,children:V(E,{className:f,search:y,autoFetch:h,mapCenter:r?.center,mapZoom:r?.zoom})})})}export{w as DefaultCard,C as DefaultEmpty,I as DefaultFilterPanel,D as DefaultLoading,M as DefaultMarker,F as DefaultPopup,S as DefaultResultHeader,T as DefaultSearch,R as DefaultSidebar,A as DefaultToolbar,he as ListingApp,fe as ListingComponentsProviderWithDefaults,E as ListingLayout,s as cn,g as shadcnDefaultComponents};
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var _chunkWSAS5XXVcjs = require('../chunk-WSAS5XXV.cjs');var _chunk5O36WI7Hcjs = require('../chunk-5O36WI7H.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunk5O36WI7Hcjs.p,{..._chunkWSAS5XXVcjs.l,children:o})}exports.BottomNav = _chunkWSAS5XXVcjs.m; exports.BottomSheet = _chunkWSAS5XXVcjs.n; exports.ListingApp = _chunkWSAS5XXVcjs.p; exports.StyledCard = _chunkWSAS5XXVcjs.b; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkWSAS5XXVcjs.c; exports.StyledFilterPanel = _chunkWSAS5XXVcjs.d; exports.StyledListingLayout = _chunkWSAS5XXVcjs.o; exports.StyledLoading = _chunkWSAS5XXVcjs.e; exports.StyledMarker = _chunkWSAS5XXVcjs.f; exports.StyledPopup = _chunkWSAS5XXVcjs.g; exports.StyledResultHeader = _chunkWSAS5XXVcjs.h; exports.StyledSearch = _chunkWSAS5XXVcjs.i; exports.StyledSidebar = _chunkWSAS5XXVcjs.j; exports.StyledToolbar = _chunkWSAS5XXVcjs.k; exports.styledDefaultComponents = _chunkWSAS5XXVcjs.l;
2
+ var _chunkKE33GMRXcjs = require('../chunk-KE33GMRX.cjs');var _chunkF4G42IGQcjs = require('../chunk-F4G42IGQ.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkF4G42IGQcjs.p,{..._chunkKE33GMRXcjs.l,children:o})}exports.BottomNav = _chunkKE33GMRXcjs.m; exports.BottomSheet = _chunkKE33GMRXcjs.n; exports.ListingApp = _chunkKE33GMRXcjs.p; exports.StyledCard = _chunkKE33GMRXcjs.b; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkKE33GMRXcjs.c; exports.StyledFilterPanel = _chunkKE33GMRXcjs.d; exports.StyledListingLayout = _chunkKE33GMRXcjs.o; exports.StyledLoading = _chunkKE33GMRXcjs.e; exports.StyledMarker = _chunkKE33GMRXcjs.f; exports.StyledPopup = _chunkKE33GMRXcjs.g; exports.StyledResultHeader = _chunkKE33GMRXcjs.h; exports.StyledSearch = _chunkKE33GMRXcjs.i; exports.StyledSidebar = _chunkKE33GMRXcjs.j; exports.StyledToolbar = _chunkKE33GMRXcjs.k; exports.styledDefaultComponents = _chunkKE33GMRXcjs.l;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { c as IListingCardProps, e as IListingEmptyProps, f as IListingFilterPanelProps, g as IListingLoadingProps, h as IListingMarkerProps, i as IListingPopupProps, j as IListingResultHeaderProps, k as IListingSearchProps, l as IListingSidebarProps, I as IListingToolbarProps, d as IListingComponents } from '../components-provider-CF0Mo0B8.cjs';
4
- export { B as BottomNav, b as BottomNavView, I as IBottomNavAction, c as IBottomNavProps, d as IStyledListingLayoutProps, L as ListingApp, e as ListingAppMapProp, a as ListingAppProps, S as StyledListingLayout } from '../listing-app-CVGVzkaD.cjs';
4
+ export { B as BottomNav, b as BottomNavView, I as IBottomNavAction, c as IBottomNavProps, d as IStyledListingLayoutProps, L as ListingApp, e as ListingAppMapProp, a as ListingAppProps, S as StyledListingLayout } from '../listing-app-D2UB9ru3.cjs';
5
5
  import '../entity-adapter.interface-BDgbSxhq.cjs';
6
6
  import '../map-provider.interface-BMnwW3ob.cjs';
7
7
  import '../listing-config-options.interface-ZJYY_ZvR.cjs';
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { c as IListingCardProps, e as IListingEmptyProps, f as IListingFilterPanelProps, g as IListingLoadingProps, h as IListingMarkerProps, i as IListingPopupProps, j as IListingResultHeaderProps, k as IListingSearchProps, l as IListingSidebarProps, I as IListingToolbarProps, d as IListingComponents } from '../components-provider-CjMxkxrP.js';
4
- export { B as BottomNav, b as BottomNavView, I as IBottomNavAction, c as IBottomNavProps, d as IStyledListingLayoutProps, L as ListingApp, e as ListingAppMapProp, a as ListingAppProps, S as StyledListingLayout } from '../listing-app-Cxw8Kym4.js';
4
+ export { B as BottomNav, b as BottomNavView, I as IBottomNavAction, c as IBottomNavProps, d as IStyledListingLayoutProps, L as ListingApp, e as ListingAppMapProp, a as ListingAppProps, S as StyledListingLayout } from '../listing-app-DDKZ6Inn.js';
5
5
  import '../entity-adapter.interface-BDgbSxhq.js';
6
6
  import '../map-provider.interface-BxexMT3X.js';
7
7
  import '../listing-config-options.interface-ZJYY_ZvR.js';
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{b as r,c as p,d as i,e as d,f as y,g as l,h as n,i as m,j as s,k as a,l as t,m as S,n as f,o as P,p as u}from"../chunk-SDF5ANTO.js";import{p as e}from"../chunk-PFPHWJAA.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,d as StyledLoading,y as StyledMarker,l as StyledPopup,n as StyledResultHeader,m as StyledSearch,s as StyledSidebar,a as StyledToolbar,t as styledDefaultComponents};
2
+ import{b as r,c as p,d as i,e as d,f as y,g as l,h as n,i as m,j as s,k as a,l as t,m as S,n as f,o as P,p as u}from"../chunk-CHMSXWBT.js";import{p as e}from"../chunk-MAAKKFJ6.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,d as StyledLoading,y as StyledMarker,l as StyledPopup,n as StyledResultHeader,m as StyledSearch,s as StyledSidebar,a as StyledToolbar,t as styledDefaultComponents};
package/dist/styles.css CHANGED
@@ -783,10 +783,19 @@
783
783
 
784
784
  @media (min-width: 768px) {
785
785
  .rle-split {
786
- grid-template-columns: minmax(340px, 42%) 1fr;
786
+ /* List-majority: scanning the cards is the primary task and the map is
787
+ orientation, so the list takes ~58% (floored at 400px) rather than
788
+ the minority share. */
789
+ grid-template-columns: minmax(400px, 1.4fr) 1fr;
787
790
  }
788
791
  }
789
792
 
793
+ /* No map configured: the results list fills the full width as a multi-column
794
+ grid instead of reserving half the viewport for an empty map region. */
795
+ .rle-body--list-only {
796
+ display: block;
797
+ }
798
+
790
799
  .rle-list {
791
800
  min-height: 0;
792
801
  height: 100%;
@@ -796,7 +805,7 @@
796
805
 
797
806
  .rle-list-grid {
798
807
  display: grid;
799
- grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
808
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
800
809
  gap: var(--rle-space);
801
810
  }
802
811
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-listing-engine",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "description": "Headless, composable listing engine for React: filterable list + Google-Maps multi-layer map, with pluggable data adapters, a filter/dataset registry, injectable components, and a shadcn-compatible styled adapter.",
6
6
  "funding": [
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{A as ne,B as se,h as q,i as G,j as J,k as Q,l as X,n as Y,p as j,q as P,s as C,u as ee,v as R,w as te,x as re,y as ie,z as oe}from"./chunk-PFPHWJAA.js";import{useEffect as Se,useRef as we}from"react";function le(e,r){let t=C(),i=we(r);i.current=r,Se(()=>t.on(e,s=>i.current(s)),[t,e])}function L(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}import{Fragment as Ce,jsx as m,jsxs as ae}from"react/jsx-runtime";function Pe(e){return e?"rle-card rle-card--selected":"rle-card"}function T({item:e,selected:r,onSelect:t}){let i=e??{},s=Pe(r),a=ae(Ce,{children:[i.imageUrl?m("img",{src:i.imageUrl,alt:i.title??"",className:"rle-card-media"}):m("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),ae("div",{className:"rle-card-body",children:[i.title&&m("span",{className:"rle-card-title",children:i.title}),i.subtitle&&m("span",{className:"rle-card-address",children:i.subtitle}),i.badge&&m("div",{className:"rle-card-info",children:m("span",{className:"rle-card-info-item",children:i.badge})}),i.price!=null&&m("span",{className:"rle-card-price",children:L(i.price)})]})]});return t?m("button",{type:"button",onClick:t,"aria-pressed":r??!1,className:s,children:a}):m("article",{className:s,children:a})}import{jsx as x,jsxs as de}from"react/jsx-runtime";function B(e){return de("div",{role:"status",className:"rle-empty",children:[de("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[x("circle",{cx:"11",cy:"11",r:"7"}),x("path",{d:"m21 21-4.3-4.3"})]}),x("p",{className:"rle-empty-title",children:"No results"}),x("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as xe}from"react/jsx-runtime";function A({children:e}){return xe("div",{className:"rle-filter-panel",children:e})}import{jsx as k,jsxs as ke}from"react/jsx-runtime";function V(e){return k("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((r,t)=>ke("div",{className:"rle-loading-item",children:[k("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),k("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),k("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},t))})}import{jsx as Ie}from"react/jsx-runtime";function K({point:e}){let r=e.entity??{};return Ie("span",{className:"rle-pin",children:r.price!=null?L(r.price):""})}import{jsx as N,jsxs as H}from"react/jsx-runtime";function D({entity:e,onClose:r}){let t=e??{};return H("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[N("button",{type:"button",onClick:r,"aria-label":"Close",className:"rle-popup-close",children:H("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[N("path",{d:"M18 6 6 18"}),N("path",{d:"m6 6 12 12"})]})}),H("div",{children:[t.title&&N("div",{className:"rle-card-title",children:t.title}),t.subtitle&&N("div",{className:"rle-card-address",children:t.subtitle}),t.price!=null&&N("div",{className:"rle-card-price",children:L(t.price)})]})]})}import{jsx as Fe}from"react/jsx-runtime";function O({count:e,total:r}){let t=r!=null&&r!==e?`${e} of ${r} results`:`${e} results`;return Fe("div",{className:"rle-result-header",children:t})}import{jsx as Me}from"react/jsx-runtime";function W({value:e,onChange:r,placeholder:t}){return Me("input",{type:"search",value:e,placeholder:t,onChange:i=>r(i.target.value),"aria-label":t??"Search",className:"rle-input"})}import{jsx as Ee}from"react/jsx-runtime";function $({children:e}){return Ee("aside",{className:"rle-sidebar",children:e})}import{jsx as _e}from"react/jsx-runtime";function z({children:e}){return _e("div",{className:"rle-toolbar",children:e})}var pe={Card:T,Marker:K,Popup:D,Sidebar:$,FilterPanel:A,Search:W,Empty:B,Loading:V,ResultHeader:O,Toolbar:z};import{jsx as o,jsxs as f}from"react/jsx-runtime";function ce({view:e,onViewChange:r}){return o("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:f("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[f("button",{type:"button",className:`rle-viewtoggle__btn${e==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="list",onClick:()=>r("list"),children:[o(Re,{}),"List"]}),f("button",{type:"button",className:`rle-viewtoggle__btn${e==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="map",onClick:()=>r("map"),children:[o(Te,{}),"Map"]})]})})}function me(){return f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),o("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),o("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),o("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),o("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),o("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function Re(){return f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[o("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),o("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),o("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),o("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),o("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),o("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Te(){return f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[o("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),o("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),o("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function ue(){return f("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{useEffect as U,useRef as Be,useState as ge}from"react";import{createPortal as Ae}from"react-dom";import{Fragment as Ke,jsx as u,jsxs as I}from"react/jsx-runtime";function fe({open:e,onOpenChange:r,title:t,children:i,footer:s}){let a=Be(null),[n,d]=ge(!1),[v,g]=ge(!1);return U(()=>{if(!e){g(!1),d(!1);return}d(!0);let c=requestAnimationFrame(()=>g(!0));return()=>cancelAnimationFrame(c)},[e]),U(()=>{if(!n)return;let c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=c}},[n]),U(()=>{if(!n)return;a.current?.focus();function c(h){h.key==="Escape"&&r(!1)}return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n,r]),!n||typeof document>"u"?null:Ae(I(Ke,{children:[u("div",{className:`rle-sheet-backdrop${v?" rle-sheet-backdrop--open":""}`,onClick:()=>r(!1),"aria-hidden":"true"}),I("div",{ref:a,className:`rle-sheet${v?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":t,tabIndex:-1,children:[u("div",{className:"rle-sheet__handle","aria-hidden":"true"}),I("div",{className:"rle-sheet__header",children:[t&&u("div",{className:"rle-sheet__title",children:t}),u("button",{type:"button",className:"rle-sheet__close",onClick:()=>r(!1),"aria-label":"Close",children:u(Ve,{})})]}),u("div",{className:"rle-sheet__body",children:i}),s&&u("div",{className:"rle-sheet__footer",children:s})]})]}),document.body)}function Ve(){return I("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[u("path",{d:"M18 6 6 18"}),u("path",{d:"m6 6 12 12"})]})}import{useEffect as He,useState as he}from"react";import{jsx as S,jsxs as ye}from"react/jsx-runtime";function ve({search:e,onFiltersClick:r,action:t}){let{Search:i}=P();return ye("header",{className:"rle-mobile-header",children:[e&&S("div",{className:"rle-mobile-header__search",children:S(i,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),ye("button",{type:"button",className:"rle-mobile-header__btn",onClick:r,children:[S(me,{}),S("span",{children:"Filters"})]}),t&&S("button",{type:"button",className:"rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:t.onClick,"aria-label":t.label,children:t.icon??S(ue,{})})]})}import{Fragment as Oe,jsx as l,jsxs as y}from"react/jsx-runtime";var De=l("div",{className:"rle-empty",children:"Map unavailable"});function be({search:e,toolbarEnd:r,mobileAction:t,autoFetch:i=!0,mapCenter:s,mapZoom:a,className:n}){let d=C(),{Search:v}=P(),g=te(),{filters:c}=ee(),[h,F]=he("list"),[M,b]=he(!1),p=e?{value:String(c[e.filterKey]??""),onChange:w=>{d.applyFilters({[e.filterKey]:w||void 0})},placeholder:e.placeholder}:void 0;He(()=>{i!==!1&&d.applyFilters({})},[d,i]);let E=()=>{let w=Object.fromEntries(d.filters.list().map(Ne=>[Ne.key,void 0]));d.applyFilters(w)},_=g.total??g.items.length;return y("div",{className:n?`rle-app ${n}`:"rle-app",children:[y("div",{className:"rle-filter-bar",children:[p&&l(v,{value:p.value,onChange:p.onChange,placeholder:p.placeholder}),l(R,{className:"rle-filters-row",groupClassName:"rle-filter-group"}),y("div",{className:"rle-filter-bar__end",children:[l(ne,{}),r]})]}),l(ve,{search:p,onFiltersClick:()=>b(!0),action:t}),y("div",{className:"rle-body rle-split","data-mobile-view":h,children:[y("div",{className:"rle-list",children:[l(re,{className:"rle-list-grid"}),l(oe,{})]}),l("div",{className:"rle-map",children:l(ie,{center:s,zoom:a,fallback:De})})]}),l(ce,{view:h,onViewChange:F}),l(fe,{title:"Filters",open:M,onOpenChange:b,footer:y(Oe,{children:[l("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:E,children:"Clear all"}),y("button",{type:"button",className:"rle-btn rle-btn--primary",onClick:()=>b(!1),children:["Show ",_," results"]})]}),children:l(R,{className:"rle-filter-stack",groupClassName:"rle-filter-group"})})]})}import{useEffect as We,useRef as $e,useState as ze}from"react";import{jsx as Z,jsxs as qe}from"react/jsx-runtime";function Le(e){return"provider"in e}function Ue(e){let r=e!=null&&!Le(e),t=r?e.apiKey:void 0,i=r?e.mapId:void 0,[s,a]=ze(()=>!e||Le(e)?{ready:!0,provider:e?.provider}:{ready:!1});return We(()=>{if(!t)return;let n=!1;return import("./maps/google/index.js").then(({googleProvider:d})=>{n||a({ready:!0,provider:d({apiKey:t,mapId:i})})}),()=>{n=!0}},[t,i]),s}function Ze({onFiltersChange:e}){let r=$e(e);return r.current=e,le("FiltersChanged",t=>{t.type==="FiltersChanged"&&r.current(t.filters)}),null}function rr(e){let{datasets:r,filters:t,map:i,components:s,initialFilters:a,onFiltersChange:n,mobileAction:d,search:v,toolbarEnd:g,config:c,autoFetch:h,className:F}=e,{ready:M,provider:b}=Ue(i);if(!M)return null;let p=[];for(let w of r)p.push(Q(w));t&&p.push(X(t)),b&&p.push(J(b)),a&&p.push(Y(a)),c&&p.push(G(c));let E=q(...p),_={...pe,...s};return qe(se,{...E,children:[n&&Z(Ze,{onFiltersChange:n}),Z(j,{..._,children:Z(be,{className:F,search:v,toolbarEnd:g,mobileAction:d,autoFetch:h,mapCenter:i?.center,mapZoom:i?.zoom})})]})}export{le as a,T as b,B as c,A as d,V as e,K as f,D as g,O as h,W as i,$ as j,z as k,pe as l,ce as m,fe as n,be as o,rr as p};