@qratilabs/qrati-connect 2.7.0-beta.21 → 2.7.0-beta.22

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/element/ApyjFWKp.js +1 -0
  3. package/element/B4hg-Jzn.js +1 -0
  4. package/element/{DGuOrd-J.js → Bu-UssyO.js} +3 -3
  5. package/element/C73GNwh3.js +8 -0
  6. package/element/CoFGfneL.js +1 -0
  7. package/element/D8g89do5.js +46 -0
  8. package/element/DJSvG_Nj.js +4 -0
  9. package/element/DKsx0Y8e.js +1 -0
  10. package/element/Dp3VaoZ-.js +3 -0
  11. package/element/Dp5jqmjn.js +4 -0
  12. package/element/M8Us9cU9.js +2 -0
  13. package/element/Nlxbxype.js +19 -0
  14. package/element/V5NTL9Q8.js +8 -0
  15. package/element/ts3zQh2I.js +3 -0
  16. package/element/web.es.js +426 -421
  17. package/element/zVkCODn-.js +1 -0
  18. package/package.json +1 -1
  19. package/react/{BiCzDvPj.js → AapCUC-0.js} +1 -1
  20. package/react/{BMKU_9Dv.js → BA-rmyyP.js} +1 -1
  21. package/react/{1Ikk7UFc.js → BFeys-t9.js} +1 -1
  22. package/react/{DE1Dpj--.js → BJuTpMwr.js} +1 -1
  23. package/react/{B6PQAfDy.js → BNq5z2O6.js} +1 -1
  24. package/react/{rdtnGUzO.js → BSqusAcm.js} +1 -1
  25. package/react/{De1I5osG.js → BWSvzAIN.js} +1 -1
  26. package/react/{lO7A5UtA.js → CH6vqA5t.js} +1 -1
  27. package/react/{DBByV_MA.js → CIMTZgx2.js} +1 -1
  28. package/react/{B4OqjpeZ.js → CMNwX5MM.js} +3 -3
  29. package/react/{DEml42Wf.js → CRqKn_Cg.js} +1 -1
  30. package/react/CS1Kg8-a.js +1 -0
  31. package/react/CWGMt62d.js +1 -0
  32. package/react/{DZCz7kl3.js → CdVkPkqy.js} +1 -1
  33. package/react/Cn5QS0_5.js +1 -0
  34. package/react/Cqdhu1W9.js +1 -0
  35. package/react/{Bv-1NjQE.js → CwlQ8z66.js} +1 -1
  36. package/react/{Dnp2RfXx.js → DEsmg9S6.js} +1 -1
  37. package/react/{DDcelZeN.js → DMmZTL_c.js} +1 -1
  38. package/react/DSiikjS9.js +1 -0
  39. package/react/{BjBT1ihN.js → DZ_wJszu.js} +1 -1
  40. package/react/{DJtDMWy2.js → DsQDSY49.js} +1 -1
  41. package/react/{Bg0TKkPl.js → DyShHlxS.js} +1 -1
  42. package/react/K73cs4am.js +1 -0
  43. package/react/RkYXaQ5u.js +1 -0
  44. package/react/{BNYjlts5.js → Y9MAVRwK.js} +1 -1
  45. package/react/{CM-f5bOF.js → bAxGEsnX.js} +1 -1
  46. package/react/{BSXFijrL.js → bia7_YIN.js} +1 -1
  47. package/react/index.cjs +1 -1
  48. package/react/index.mjs +114 -109
  49. package/umd/web.umd.js +1 -1
  50. package/element/Bl3RFWpg.js +0 -3
  51. package/element/Bmvot7Mx.js +0 -3
  52. package/element/C0wQndW7.js +0 -19
  53. package/element/CCEtowI9.js +0 -46
  54. package/element/CUGl86v2.js +0 -8
  55. package/element/CUfhicE8.js +0 -1
  56. package/element/DCFrvyiS.js +0 -2
  57. package/element/DCbRXtK8.js +0 -4
  58. package/element/DI_rRNLa.js +0 -4
  59. package/element/dcV4od5T.js +0 -8
  60. package/react/BarCxWTX.js +0 -1
  61. /package/element/{CMbOX_GS.js → BAMB7Uoo.js} +0 -0
  62. /package/element/{C6TX_i0I.js → BzIJspY1.js} +0 -0
  63. /package/element/{DgGPkDRT.js → CjmNvKgB.js} +0 -0
  64. /package/element/{BxbCvlCo.js → D1zX23l-.js} +0 -0
  65. /package/element/{CzSmu5XM.js → DUJAMyRv.js} +0 -0
  66. /package/element/{CIcND0Dg.js → PPVqva_9.js} +0 -0
  67. /package/element/{Cdux6g1i.js → tPk8Ov5I.js} +0 -0
  68. /package/react/{Cdux6g1i.js → BJ85RnFv.js} +0 -0
  69. /package/react/{BvVjd_UK.js → Bp3BRlhW.js} +0 -0
  70. /package/react/{BCc5Yj_f.js → BszowxAR.js} +0 -0
  71. /package/react/{BH8UJKb5.js → BtTYXVAR.js} +0 -0
  72. /package/react/{DJTeOMQR.js → BvT0jQ3V.js} +0 -0
  73. /package/react/{BAKN93OB.js → Byq3TC8k.js} +0 -0
  74. /package/react/{qy2OAEht.js → C5dmblnS.js} +0 -0
  75. /package/react/{fwmxAw7l.js → D2h6qyms.js} +0 -0
  76. /package/react/{DlCuoz_e.js → D7BzZEsL.js} +0 -0
  77. /package/react/{C8D6WaBQ.js → DSaIeQ30.js} +0 -0
  78. /package/react/{DiysJlOc.js → DYeIUbVU.js} +0 -0
  79. /package/react/{I7IwY3sd.js → Y-mDLYqW.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{n as e}from"./Bto__AIV.js";import{At as t,Ct as r,Et as n,V as o,et as s,g as i,jt as l,p as a,r as c,wt as u,y as d}from"./BMKU_9Dv.js";import{t as p}from"./rdtnGUzO.js";import{a as m,i as f,n as g,o as h,r as y,t as b}from"./DE1Dpj--.js";var v={top:60,bottom:60,left:276,right:60},x="#fb8500",w=new p,L=(e,t,r)=>{l(/* @__PURE__ */d(s,{client:w,children:/* @__PURE__ */d(c,{children:/* @__PURE__ */d(m,{event:e,onExplore:r})})}),t)},C=e=>{const t=document.createElement("div");t.style.cssText=`\n background:${y(e.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=e.folder.name;const n=document.createElement("span");return n.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",n.textContent=String(e.eventCount),t.appendChild(r),t.appendChild(n),t},z=({apiKey:s,is3D:l,onExplore:c,logoUrl:p})=>{const m=r(null),y=r(null),w=r(null),z=r(l),E=r([]),k=r([]),_=r(null),T=r(!1),j=r(!1),F=r(null),[S,B]=n(l),Z=u(()=>(()=>{try{const e=sessionStorage.getItem(o);if(!e)return null;const t=JSON.parse(e);if(Array.isArray(t?.center)&&"number"==typeof t.zoom)return t}catch{}return null})(),[]),[D,I]=n(!1),[M,O]=n(!0),{folderTree:U,activeFolderId:A,activeFolder:P,visibleEvents:R,setActiveFolderId:W,isLoadingEvents:q}=h(),{organization:J}=a(),N=()=>{E.current.forEach(e=>e.remove()),E.current=[]},$=()=>{k.current.forEach(e=>e.remove()),k.current=[]},K=(e,t)=>{const r=t?"visible":"none";for(const n of["heatmap","event-clusters","cluster-count","unclustered-point"])e.getLayer(n)&&e.setLayoutProperty(n,"visibility",r)};return t(()=>{if(!m.current||y.current)return;let t,r=!1;return(async()=>{try{const n=(await import("./DlCuoz_e.js").then(t=>/* @__PURE__ */e(t.default,1))).default;if(r)return;if(!m.current)return;n.accessToken=s;const i=Z?.center??[0,20],l=Z?.zoom??3,a=new n.Map({container:m.current,style:"mapbox://styles/mapbox/streets-v12",center:i,zoom:l,minZoom:0,pitch:0,bearing:0,renderWorldCopies:!1,antialias:!0,projection:z.current?"globe":"mercator"});y.current=a,w.current=n,a.on("load",()=>{if(r)return;const e=a.getStyle()?.layers??[];let t,o;for(const r of e){const e=r;"symbol"===e.type&&e.layout?.["text-field"]&&!t&&(t=r.id),"building"!==e["source-layer"]||o||(o=e.source)}o&&!a.getLayer("3d-buildings")&&a.addLayer({id:"3d-buildings",source:o,"source-layer":"building",filter:["has","render_height"],type:"fill-extrusion",minzoom:14,paint:{"fill-extrusion-color":["interpolate",["linear"],["get","render_height"],0,"lightgray",200,"royalblue",400,"lightblue"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,15,["get","render_height"]],"fill-extrusion-base":["case",["has","render_min_height"],["get","render_min_height"],0],"fill-extrusion-opacity":.6}},t),a.addSource("all-events",{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterRadius:50,clusterMaxZoom:14}),a.addSource("heat-events",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),a.addLayer({id:"heatmap",type:"heatmap",source:"heat-events",layout:{visibility:"none"},paint:{"heatmap-weight":["interpolate",["linear"],["get","views"],0,0,200,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"rgb(103,169,207)",.4,"rgb(209,229,240)",.6,"rgb(253,219,199)",.8,"rgb(239,138,98)",1,"rgb(178,24,43)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,4,9,30],"heatmap-opacity":["interpolate",["linear"],["zoom"],6,.85,11,0]}}),a.addLayer({id:"event-clusters",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],x,10,"#e63946",30,"#9b2226"],"circle-radius":["step",["get","point_count"],16,10,20,30,26],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),a.addLayer({id:"cluster-count",type:"symbol",source:"all-events",layout:{visibility:"none","text-field":"{point_count_abbreviated}","text-size":12},paint:{"text-color":"#fff"}}),a.addLayer({id:"unclustered-point",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["!",["has","point_count"]],paint:{"circle-radius":7,"circle-color":x,"circle-stroke-color":"#fff","circle-stroke-width":2}}),a.on("click","event-clusters",e=>{const t=a.queryRenderedFeatures(e.point,{layers:["event-clusters"]});if(!t.length)return;const r=t[0].properties?.cluster_id,n=a.getSource("all-events");r&&n?.getClusterExpansionZoom&&n.getClusterExpansionZoom(r,(e,r)=>{e||"number"!=typeof r||a.easeTo({center:t[0].geometry.coordinates,zoom:r,duration:600})})}),a.on("click","unclustered-point",e=>{const t=e.features?.[0];if(!t)return;const r=t.geometry.coordinates.slice(0,2),o=t.properties??{},s={_id:o._id,slug:o.slug,name:o.name,views:o.views,location:{x:r[0],y:r[1],label:o.label},contents:o.thumbnailUrl?[{thumbnailUrl:o.thumbnailUrl}]:[]};F.current&&(F.current.remove(),F.current=null);const i=document.createElement("div");L(s,i,c);const l=new n.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-10]}).setLngLat(r).setDOMContent(i).addTo(a);F.current=l,l.on("close",()=>{F.current===l&&(F.current=null)})}),a.on("click",e=>{!a.queryRenderedFeatures(e.point,{layers:["event-clusters","unclustered-point"]}).length&&F.current&&(F.current.remove(),F.current=null)}),a.on("mouseenter","event-clusters",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","event-clusters",()=>{a.getCanvas().style.cursor=""}),a.on("mouseenter","unclustered-point",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","unclustered-point",()=>{a.getCanvas().style.cursor=""}),I(!0),O(!1)});const u=()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{try{const e=a.getCenter();sessionStorage.setItem(o,JSON.stringify({center:[e.lng,e.lat],zoom:a.getZoom()}))}catch{}},250)};a.on("zoomend",u),a.on("moveend",u),t=()=>{N(),$(),F.current&&(F.current.remove(),F.current=null),_.current&&clearTimeout(_.current),a.off("zoomend",u),a.off("moveend",u),a.remove(),y.current=null,w.current=null}}finally{r||O(!1)}})(),()=>{r=!0,t?.()}},[s]),t(()=>{if(!D)return;const e=y.current,t=w.current;if(e&&t)if(N(),$(),null===A&&U.length>0){K(e,!1);const r=n=>{for(const o of n)if(o.centroid){const r=C(o);r.addEventListener("click",()=>W(o.folder._id));const n=new t.Marker({element:r,anchor:"center"}).setLngLat([o.centroid[0],o.centroid[1]]).addTo(e);E.current.push(n)}else o.children.length>0&&r(o.children)};r(U)}else if(0===U.length&&null===A){if(0===R.length)return;const r=R.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:[e.location.x,e.location.y]},properties:{_id:e._id,slug:e.slug,name:e.name,views:e.views??0,label:e.location?.label??"",thumbnailUrl:e.contents?.[0]?.thumbnailUrl??""}})),n={type:"FeatureCollection",features:r};if(e.getSource("all-events")?.setData(n),e.getSource("heat-events")?.setData({...n,features:r.map(e=>({...e,properties:{views:e.properties.views}}))}),K(e,!0),!j.current&&(j.current=!0,!Z)){const r=new t.LngLatBounds;R.forEach(e=>r.extend([e.location.x,e.location.y])),r.isEmpty()||e.fitBounds(r,{padding:v,maxZoom:8,duration:800})}}else{if(0===R.length)return;K(e,!1);const r=P?.color||x,n=new t.LngLatBounds;R.forEach(o=>{const s=o.location.x,i=o.location.y;n.extend([s,i]);const l=((e,t)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${e};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,t){const e=document.createElement("img");e.src=f(t)??"",e.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(e)}return r})(r,p);l.addEventListener("click",()=>{F.current&&(F.current.remove(),F.current=null);const r=document.createElement("div");L(o,r,c);const n=new t.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-40]}).setLngLat([s,i]).setDOMContent(r).addTo(e);F.current=n,n.on("close",()=>{F.current===n&&(F.current=null)})});const a=new t.Marker({element:l}).setLngLat([s,i]).addTo(e);k.current.push(a)})}},[A,U,R,D,c,p,W,P,Z]),t(()=>{if(!D)return;const e=y.current;if(!e)return;if(!T.current&&Z)return void(T.current=!0);T.current=!0;const t={padding:v,duration:3e3,essential:!0},r=w.current;if(r)if(A){const n=g(U,A);if(!n?.folder.boundary?.length)return;const o=new r.LngLatBounds;for(const e of n.folder.boundary)o.extend([e.x,e.y]);o.isEmpty()||e.fitBounds(o,{...t,maxZoom:14})}else if(U.length>0){const n=new r.LngLatBounds,o=e=>{for(const t of e)t.centroid?n.extend([t.centroid[0],t.centroid[1]]):o(t.children)};o(U),n.isEmpty()||e.fitBounds(n,{...t,maxZoom:8})}},[A,U,D,Z]),t(()=>{y.current&&(z.current=S,y.current.setProjection(S?"globe":"mercator"),y.current.easeTo({pitch:0,bearing:0,duration:600}))},[S]),/* @__PURE__ */d("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:i(J),children:[
1
+ import{n as e}from"./Bto__AIV.js";import{At as t,Ct as r,Et as n,V as o,et as s,g as i,jt as l,p as a,r as c,wt as u,y as d}from"./BA-rmyyP.js";import{t as p}from"./BSqusAcm.js";import{a as m,i as f,n as g,o as h,r as y,t as b}from"./BJuTpMwr.js";var v={top:60,bottom:60,left:276,right:60},x="#fb8500",w=new p,L=(e,t,r)=>{l(/* @__PURE__ */d(s,{client:w,children:/* @__PURE__ */d(c,{children:/* @__PURE__ */d(m,{event:e,onExplore:r})})}),t)},C=e=>{const t=document.createElement("div");t.style.cssText=`\n background:${y(e.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=e.folder.name;const n=document.createElement("span");return n.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",n.textContent=String(e.eventCount),t.appendChild(r),t.appendChild(n),t},z=({apiKey:s,is3D:l,onExplore:c,logoUrl:p})=>{const m=r(null),y=r(null),w=r(null),z=r(l),E=r([]),k=r([]),_=r(null),T=r(!1),j=r(!1),F=r(null),[S,B]=n(l),Z=u(()=>(()=>{try{const e=sessionStorage.getItem(o);if(!e)return null;const t=JSON.parse(e);if(Array.isArray(t?.center)&&"number"==typeof t.zoom)return t}catch{}return null})(),[]),[D,I]=n(!1),[M,O]=n(!0),{folderTree:U,activeFolderId:A,activeFolder:P,visibleEvents:R,setActiveFolderId:W,isLoadingEvents:q}=h(),{organization:J}=a(),N=()=>{E.current.forEach(e=>e.remove()),E.current=[]},$=()=>{k.current.forEach(e=>e.remove()),k.current=[]},K=(e,t)=>{const r=t?"visible":"none";for(const n of["heatmap","event-clusters","cluster-count","unclustered-point"])e.getLayer(n)&&e.setLayoutProperty(n,"visibility",r)};return t(()=>{if(!m.current||y.current)return;let t,r=!1;return(async()=>{try{const n=(await import("./D7BzZEsL.js").then(t=>/* @__PURE__ */e(t.default,1))).default;if(r)return;if(!m.current)return;n.accessToken=s;const i=Z?.center??[0,20],l=Z?.zoom??3,a=new n.Map({container:m.current,style:"mapbox://styles/mapbox/streets-v12",center:i,zoom:l,minZoom:0,pitch:0,bearing:0,renderWorldCopies:!1,antialias:!0,projection:z.current?"globe":"mercator"});y.current=a,w.current=n,a.on("load",()=>{if(r)return;const e=a.getStyle()?.layers??[];let t,o;for(const r of e){const e=r;"symbol"===e.type&&e.layout?.["text-field"]&&!t&&(t=r.id),"building"!==e["source-layer"]||o||(o=e.source)}o&&!a.getLayer("3d-buildings")&&a.addLayer({id:"3d-buildings",source:o,"source-layer":"building",filter:["has","render_height"],type:"fill-extrusion",minzoom:14,paint:{"fill-extrusion-color":["interpolate",["linear"],["get","render_height"],0,"lightgray",200,"royalblue",400,"lightblue"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,15,["get","render_height"]],"fill-extrusion-base":["case",["has","render_min_height"],["get","render_min_height"],0],"fill-extrusion-opacity":.6}},t),a.addSource("all-events",{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterRadius:50,clusterMaxZoom:14}),a.addSource("heat-events",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),a.addLayer({id:"heatmap",type:"heatmap",source:"heat-events",layout:{visibility:"none"},paint:{"heatmap-weight":["interpolate",["linear"],["get","views"],0,0,200,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"rgb(103,169,207)",.4,"rgb(209,229,240)",.6,"rgb(253,219,199)",.8,"rgb(239,138,98)",1,"rgb(178,24,43)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,4,9,30],"heatmap-opacity":["interpolate",["linear"],["zoom"],6,.85,11,0]}}),a.addLayer({id:"event-clusters",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],x,10,"#e63946",30,"#9b2226"],"circle-radius":["step",["get","point_count"],16,10,20,30,26],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),a.addLayer({id:"cluster-count",type:"symbol",source:"all-events",layout:{visibility:"none","text-field":"{point_count_abbreviated}","text-size":12},paint:{"text-color":"#fff"}}),a.addLayer({id:"unclustered-point",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["!",["has","point_count"]],paint:{"circle-radius":7,"circle-color":x,"circle-stroke-color":"#fff","circle-stroke-width":2}}),a.on("click","event-clusters",e=>{const t=a.queryRenderedFeatures(e.point,{layers:["event-clusters"]});if(!t.length)return;const r=t[0].properties?.cluster_id,n=a.getSource("all-events");r&&n?.getClusterExpansionZoom&&n.getClusterExpansionZoom(r,(e,r)=>{e||"number"!=typeof r||a.easeTo({center:t[0].geometry.coordinates,zoom:r,duration:600})})}),a.on("click","unclustered-point",e=>{const t=e.features?.[0];if(!t)return;const r=t.geometry.coordinates.slice(0,2),o=t.properties??{},s={_id:o._id,slug:o.slug,name:o.name,views:o.views,location:{x:r[0],y:r[1],label:o.label},contents:o.thumbnailUrl?[{thumbnailUrl:o.thumbnailUrl}]:[]};F.current&&(F.current.remove(),F.current=null);const i=document.createElement("div");L(s,i,c);const l=new n.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-10]}).setLngLat(r).setDOMContent(i).addTo(a);F.current=l,l.on("close",()=>{F.current===l&&(F.current=null)})}),a.on("click",e=>{!a.queryRenderedFeatures(e.point,{layers:["event-clusters","unclustered-point"]}).length&&F.current&&(F.current.remove(),F.current=null)}),a.on("mouseenter","event-clusters",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","event-clusters",()=>{a.getCanvas().style.cursor=""}),a.on("mouseenter","unclustered-point",()=>{a.getCanvas().style.cursor="pointer"}),a.on("mouseleave","unclustered-point",()=>{a.getCanvas().style.cursor=""}),I(!0),O(!1)});const u=()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{try{const e=a.getCenter();sessionStorage.setItem(o,JSON.stringify({center:[e.lng,e.lat],zoom:a.getZoom()}))}catch{}},250)};a.on("zoomend",u),a.on("moveend",u),t=()=>{N(),$(),F.current&&(F.current.remove(),F.current=null),_.current&&clearTimeout(_.current),a.off("zoomend",u),a.off("moveend",u),a.remove(),y.current=null,w.current=null}}finally{r||O(!1)}})(),()=>{r=!0,t?.()}},[s]),t(()=>{if(!D)return;const e=y.current,t=w.current;if(e&&t)if(N(),$(),null===A&&U.length>0){K(e,!1);const r=n=>{for(const o of n)if(o.centroid){const r=C(o);r.addEventListener("click",()=>W(o.folder._id));const n=new t.Marker({element:r,anchor:"center"}).setLngLat([o.centroid[0],o.centroid[1]]).addTo(e);E.current.push(n)}else o.children.length>0&&r(o.children)};r(U)}else if(0===U.length&&null===A){if(0===R.length)return;const r=R.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:[e.location.x,e.location.y]},properties:{_id:e._id,slug:e.slug,name:e.name,views:e.views??0,label:e.location?.label??"",thumbnailUrl:e.contents?.[0]?.thumbnailUrl??""}})),n={type:"FeatureCollection",features:r};if(e.getSource("all-events")?.setData(n),e.getSource("heat-events")?.setData({...n,features:r.map(e=>({...e,properties:{views:e.properties.views}}))}),K(e,!0),!j.current&&(j.current=!0,!Z)){const r=new t.LngLatBounds;R.forEach(e=>r.extend([e.location.x,e.location.y])),r.isEmpty()||e.fitBounds(r,{padding:v,maxZoom:8,duration:800})}}else{if(0===R.length)return;K(e,!1);const r=P?.color||x,n=new t.LngLatBounds;R.forEach(o=>{const s=o.location.x,i=o.location.y;n.extend([s,i]);const l=((e,t)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${e};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,t){const e=document.createElement("img");e.src=f(t)??"",e.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(e)}return r})(r,p);l.addEventListener("click",()=>{F.current&&(F.current.remove(),F.current=null);const r=document.createElement("div");L(o,r,c);const n=new t.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-40]}).setLngLat([s,i]).setDOMContent(r).addTo(e);F.current=n,n.on("close",()=>{F.current===n&&(F.current=null)})});const a=new t.Marker({element:l}).setLngLat([s,i]).addTo(e);k.current.push(a)})}},[A,U,R,D,c,p,W,P,Z]),t(()=>{if(!D)return;const e=y.current;if(!e)return;if(!T.current&&Z)return void(T.current=!0);T.current=!0;const t={padding:v,duration:3e3,essential:!0},r=w.current;if(r)if(A){const n=g(U,A);if(!n?.folder.boundary?.length)return;const o=new r.LngLatBounds;for(const e of n.folder.boundary)o.extend([e.x,e.y]);o.isEmpty()||e.fitBounds(o,{...t,maxZoom:14})}else if(U.length>0){const n=new r.LngLatBounds,o=e=>{for(const t of e)t.centroid?n.extend([t.centroid[0],t.centroid[1]]):o(t.children)};o(U),n.isEmpty()||e.fitBounds(n,{...t,maxZoom:8})}},[A,U,D,Z]),t(()=>{y.current&&(z.current=S,y.current.setProjection(S?"globe":"mercator"),y.current.easeTo({pitch:0,bearing:0,duration:600}))},[S]),/* @__PURE__ */d("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:i(J),children:[
2
2
  /* @__PURE__ */d(b,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:U,activeFolderId:A,setActiveFolderId:W}),
3
3
  /* @__PURE__ */d("button",{type:"button",onClick:()=>B(e=>!e),class:"bg-background hover:bg-foreground/10 absolute top-4 right-4 z-[1000] rounded-xl px-3 py-2 text-xs font-semibold shadow-lg backdrop-blur-sm",children:S?"2D":"3D"}),q&&/* @__PURE__ */d("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:/* @__PURE__ */d("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),M&&/* @__PURE__ */d("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:/* @__PURE__ */d("div",{class:"flex flex-col items-center gap-3",children:[/* @__PURE__ */d("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),/* @__PURE__ */d("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),
4
4
  /* @__PURE__ */d("div",{ref:m,class:"size-full"})]})};export{z as default};
@@ -1 +1 @@
1
- const t=require("./BarCxWTX.js"),e=require("./B6PQAfDy.js"),r=require("./DDcelZeN.js");var{getOwnPropertyNames:n,getOwnPropertySymbols:s}=Object,{hasOwnProperty:o}=Object.prototype;function i(t,e){return function(r,n,s){return t(r,n,s)&&e(r,n,s)}}function a(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);const{cache:s}=n,o=s.get(e),i=s.get(r);if(o&&i)return o===r&&i===e;s.set(e,r),s.set(r,e);const a=t(e,r,n);return s.delete(e),s.delete(r),a}}function c(t){return n(t).concat(s(t))}var u=Object.hasOwn||((t,e)=>o.call(t,e));function l(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var{getOwnPropertyDescriptor:h,keys:p}=Object;function d(t,e){return t.byteLength===e.byteLength&&_(new Uint8Array(t),new Uint8Array(e))}function f(t,e,r){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function m(t,e){return t.byteLength===e.byteLength&&_(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function g(t,e){return l(t.getTime(),e.getTime())}function y(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function b(t,e){return t===e}function w(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const s=new Array(n),o=t.entries();let i,a,c=0;for(;(i=o.next())&&!i.done;){const n=e.entries();let o=!1,u=0;for(;(a=n.next())&&!a.done;){if(s[u]){u++;continue}const n=i.value,l=a.value;if(r.equals(n[0],l[0],c,u,t,e,r)&&r.equals(n[1],l[1],n[0],l[0],t,e,r)){o=s[u]=!0;break}u++}if(!o)return!1;c++}return!0}var x=l;function E(t,e,r){const n=p(t);let s=n.length;if(p(e).length!==s)return!1;for(;s-- >0;)if(!j(t,e,r,n[s]))return!1;return!0}function k(t,e,r){const n=c(t);let s,o,i,a=n.length;if(c(e).length!==a)return!1;for(;a-- >0;){if(s=n[a],!j(t,e,r,s))return!1;if(o=h(t,s),i=h(e,s),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable))return!1}return!0}function v(t,e){return l(t.valueOf(),e.valueOf())}function A(t,e){return t.source===e.source&&t.flags===e.flags}function M(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const s=new Array(n),o=t.values();let i,a;for(;(i=o.next())&&!i.done;){const n=e.values();let o=!1,c=0;for(;(a=n.next())&&!a.done;){if(!s[c]&&r.equals(i.value,a.value,i.value,a.value,t,e,r)){o=s[c]=!0;break}c++}if(!o)return!1}return!0}function _(t,e){let r=t.byteLength;if(e.byteLength!==r||t.byteOffset!==e.byteOffset)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function C(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function j(t,e,r,n){return!("_owner"!==n&&"__o"!==n&&"__v"!==n||!t.$$typeof&&!e.$$typeof)||u(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var L={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},I=Object.prototype.toString;var O=T();function T(t={}){const{circular:e=!1,createInternalComparator:r,createState:n,strict:s=!1}=t,o=function({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:l,areSetsEqual:h,areTypedArraysEqual:p,areUrlsEqual:d,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&o(m,g,y);const w=m.constructor;if(w!==g.constructor)return!1;if(w===Object)return c(m,g,y);if(Array.isArray(m))return e(m,g,y);if(w===Date)return n(m,g,y);if(w===RegExp)return l(m,g,y);if(w===Map)return i(m,g,y);if(w===Set)return h(m,g,y);const x=I.call(m);if("[object Date]"===x)return n(m,g,y);if("[object RegExp]"===x)return l(m,g,y);if("[object Map]"===x)return i(m,g,y);if("[object Set]"===x)return h(m,g,y);if("[object Object]"===x)return"function"!=typeof m.then&&"function"!=typeof g.then&&c(m,g,y);if("[object URL]"===x)return d(m,g,y);if("[object Error]"===x)return s(m,g,y);if("[object Arguments]"===x)return c(m,g,y);if(L[x])return p(m,g,y);if("[object ArrayBuffer]"===x)return t(m,g,y);if("[object DataView]"===x)return r(m,g,y);if("[object Boolean]"===x||"[object Number]"===x||"[object String]"===x)return u(m,g,y);if(f){let t=f[x];if(!t){const e=null!=(E=m)?E[Symbol.toStringTag]:void 0;e&&(t=f[e])}if(t)return t(m,g,y)}var E;return!1}}(function({circular:t,createCustomConfig:e,strict:r}){let n={areArrayBuffersEqual:d,areArraysEqual:r?k:f,areDataViewsEqual:m,areDatesEqual:g,areErrorsEqual:y,areFunctionsEqual:b,areMapsEqual:r?i(w,k):w,areNumbersEqual:x,areObjectsEqual:r?k:E,arePrimitiveWrappersEqual:v,areRegExpsEqual:A,areSetsEqual:r?i(M,k):M,areTypedArraysEqual:r?i(_,k):_,areUrlsEqual:C,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const t=a(n.areArraysEqual),e=a(n.areMapsEqual),r=a(n.areObjectsEqual),s=a(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:t,areMapsEqual:e,areObjectsEqual:r,areSetsEqual:s})}return n}(t));return function({circular:t,comparator:e,createState:r,equals:n,strict:s}){if(r)return function(o,i){const{cache:a=(t?new WeakMap:void 0),meta:c}=r();return e(o,i,{cache:a,equals:n,meta:c,strict:s})};if(t)return function(t,r){return e(t,r,{cache:new WeakMap,equals:n,meta:void 0,strict:s})};const o={cache:void 0,equals:n,meta:void 0,strict:s};return function(t,r){return e(t,r,o)}}({circular:e,comparator:o,createState:n,equals:r?r(o):(c=o,function(t,e,r,n,s,o,i){return c(t,e,i)}),strict:s});var c}T({strict:!0}),T({circular:!0}),T({circular:!0,strict:!0}),T({createInternalComparator:()=>l}),T({strict:!0,createInternalComparator:()=>l}),T({circular:!0,createInternalComparator:()=>l}),T({circular:!0,createInternalComparator:()=>l,strict:!0});var q=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],S=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(e,0,2);if(219!==r)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(1!==s)throw new Error(`Got v${s} data when expected v1.`);const o=q[15&n];if(!o)throw new Error("Unrecognized array type.");const[i]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new t(a,i,o,e)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const s=q.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,i=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-i%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+i+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+i+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+i+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return P(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:o,nodeSize:i}=this,a=[0,s.length-1,0],c=[];for(;a.length;){const u=a.pop()||0,l=a.pop()||0,h=a.pop()||0;if(l-h<=i){for(let i=h;i<=l;i++){const a=o[2*i],u=o[2*i+1];a>=t&&a<=r&&u>=e&&u<=n&&c.push(s[i])}continue}const p=h+l>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=r&&f>=e&&f<=n&&c.push(s[p]),(0===u?t<=d:e<=f)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?r>=d:n>=f)&&(a.push(p+1),a.push(l),a.push(1-u))}return c}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:s,nodeSize:o}=this,i=[0,n.length-1,0],a=[],c=r*r;for(;i.length;){const u=i.pop()||0,l=i.pop()||0,h=i.pop()||0;if(l-h<=o){for(let r=h;r<=l;r++)N(s[2*r],s[2*r+1],t,e)<=c&&a.push(n[r]);continue}const p=h+l>>1,d=s[2*p],f=s[2*p+1];N(d,f,t,e)<=c&&a.push(n[p]),(0===u?t-r<=d:e-r<=f)&&(i.push(h),i.push(p-1),i.push(1-u)),(0===u?t+r>=d:e+r>=f)&&(i.push(p+1),i.push(l),i.push(1-u))}return a}};function P(t,e,r,n,s,o){if(s-n<=r)return;const i=n+s>>1;z(t,e,i,n,s,o),P(t,e,r,n,i-1,1-o),P(t,e,r,i+1,s,1-o)}function z(t,e,r,n,s,o){for(;s>n;){if(s-n>600){const i=s-n+1,a=r-n+1,c=Math.log(i),u=.5*Math.exp(2*c/3),l=.5*Math.sqrt(c*u*(i-u)/i)*(a-i/2<0?-1:1);z(t,e,r,Math.max(n,Math.floor(r-a*u/i+l)),Math.min(s,Math.floor(r+(i-a)*u/i+l)),o)}const i=e[2*r+o];let a=n,c=s;for(U(t,e,n,r),e[2*s+o]>i&&U(t,e,n,s);a<c;){for(U(t,e,a,c),a++,c--;e[2*a+o]<i;)a++;for(;e[2*c+o]>i;)c--}e[2*n+o]===i?U(t,e,n,c):(c++,U(t,e,c,s)),c<=r&&(n=c+1),r<=c&&(s=c-1)}}function U(t,e,r,n){Z(t,r,n),Z(e,2*r,2*n),Z(e,2*r+1,2*n+1)}function Z(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function N(t,e,r,n){const s=t-r,o=e-n;return s*s+o*o}var F,B={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},D=Math.fround||(F=new Float32Array(1),t=>(F[0]=+t,F[0])),R=class{constructor(t){this.options=Object.assign(Object.create(B),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:n}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;const o=[];for(let a=0;a<t.length;a++){const e=t[a];if(!e.geometry)continue;const[r,n]=e.geometry.coordinates,s=D(V(r)),i=D(K(n));o.push(s,i,1/0,a,-1,1),this.options.reduce&&o.push(0)}let i=this.trees[n+1]=this._createTree(o);e&&console.timeEnd(s);for(let a=n;a>=r;a--){const t=+Date.now();i=this.trees[a]=this._createTree(this._cluster(i,a)),e&&console.log("z%d: %d clusters in %dms",a,i.numItems,+Date.now()-t)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let s=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,s=180;else if(r>s){const t=this.getClusters([r,n,180,o],e),i=this.getClusters([-180,n,s,o],e);return t.concat(i)}const i=this.trees[this._limitZoom(e)],a=i.range(V(r),K(o),V(s),K(n)),c=i.data,u=[];for(const l of a){const t=this.stride*l;u.push(c[t+5]>1?$(c,t,this.clusterProps):this.points[c[t+3]])}return u}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",s=this.trees[r];if(!s)throw new Error(n);const o=s.data;if(e*this.stride>=o.length)throw new Error(n);const i=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=o[e*this.stride],c=o[e*this.stride+1],u=s.within(a,c,i),l=[];for(const h of u){const e=h*this.stride;o[e+4]===t&&l.push(o[e+5]>1?$(o,e,this.clusterProps):this.points[o[e+3]])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){e=e||10,r=r||0;const n=[];return this._appendLeaves(n,t,e,r,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],s=Math.pow(2,t),{extent:o,radius:i}=this.options,a=i/o,c=(r-a)/s,u=(r+1+a)/s,l={features:[]};return this._addTileFeatures(n.range((e-a)/s,c,(e+1+a)/s,u),n.data,e,r,s,l),0===e&&this._addTileFeatures(n.range(1-a/s,c,1,u),n.data,s,r,s,l),e===s-1&&this._addTileFeatures(n.range(0,c,a/s,u),n.data,-1,r,s,l),l.features.length?l:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,s){const o=this.getChildren(e);for(const i of o){const e=i.properties;if(e&&e.cluster?s+e.point_count<=n?s+=e.point_count:s=this._appendLeaves(t,e.cluster_id,r,n,s):s<n?s++:t.push(i),t.length===r)break}return s}_createTree(t){const e=new S(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,r,n,s,o){for(const i of t){const t=i*this.stride,a=e[t+5]>1;let c,u,l;if(a)c=G(e,t,this.clusterProps),u=e[t],l=e[t+1];else{const r=this.points[e[t+3]];c=r.properties;const[n,s]=r.geometry.coordinates;u=V(n),l=K(s)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*s-r)),Math.round(this.options.extent*(l*s-n))]],tags:c};let p;p=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:n,reduce:s,minPoints:o}=this.options,i=r/(n*Math.pow(2,e)),a=t.data,c=[],u=this.stride;for(let l=0;l<a.length;l+=u){if(a[l+2]<=e)continue;a[l+2]=e;const r=a[l],n=a[l+1],h=t.within(a[l],a[l+1],i),p=a[l+5];let d=p;for(const t of h){const r=t*u;a[r+2]>e&&(d+=a[r+5])}if(d>p&&d>=o){let t,o=r*p,i=n*p,f=-1;const m=(l/u<<5)+(e+1)+this.points.length;for(const r of h){const n=r*u;if(a[n+2]<=e)continue;a[n+2]=e;const c=a[n+5];o+=a[n]*c,i+=a[n+1]*c,a[n+4]=m,s&&(t||(t=this._map(a,l,!0),f=this.clusterProps.length,this.clusterProps.push(t)),s(t,this._map(a,n)))}a[l+4]=m,c.push(o/d,i/d,1/0,m,-1,d),s&&c.push(f)}else{for(let t=0;t<u;t++)c.push(a[l+t]);if(d>1)for(const t of h){const r=t*u;if(!(a[r+2]<=e)){a[r+2]=e;for(let t=0;t<u;t++)c.push(a[r+t])}}}}return c}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const n=this.clusterProps[t[e+6]];return r?Object.assign({},n):n}const n=this.points[t[e+3]].properties,s=this.options.map(n);return r&&s===n?Object.assign({},s):s}};function $(t,e,r){return{type:"Feature",id:t[e+3],properties:G(t,e,r),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),W(t[e+1])]}};var n}function G(t,e,r){const n=t[e+5],s=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=t[e+6],i=-1===o?{}:Object.assign({},r[o]);return Object.assign(i,{cluster:!0,cluster_id:t[e+3],point_count:n,point_count_abbreviated:s})}function V(t){return t/360+.5}function K(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function W(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var X=class{static isAdvancedMarkerAvailable(t){return google.maps.marker&&!0===t.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(t){return google.maps.marker&&t instanceof google.maps.marker.AdvancedMarkerElement}static setMap(t,e){this.isAdvancedMarker(t)?t.map=e:t.setMap(e)}static getPosition(t){if(this.isAdvancedMarker(t)){if(t.position){if(t.position instanceof google.maps.LatLng)return t.position;if(Number.isFinite(t.position.lat)&&Number.isFinite(t.position.lng))return new google.maps.LatLng(t.position.lat,t.position.lng)}return new google.maps.LatLng(null)}return t.getPosition()}static getVisible(t){return!!this.isAdvancedMarker(t)||t.getVisible()}},J=class{constructor({markers:t,position:e}){this.markers=[],t&&(this.markers=t),e&&(e instanceof google.maps.LatLng?this._position=e:this._position=new google.maps.LatLng(e))}get bounds(){if(0===this.markers.length&&!this._position)return;const t=new google.maps.LatLngBounds(this._position,this._position);for(const e of this.markers)t.extend(X.getPosition(e));return t}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(t=>X.getVisible(t)).length}push(t){this.markers.push(t)}delete(){this.marker&&(X.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}};function Q(t,e="assertion failed"){if(null==t)throw Error(e)}var Y,H=class{constructor({maxZoom:t=16}){this.maxZoom=t}noop({markers:t}){return tt(t)}},tt=t=>t.map(t=>new J({position:X.getPosition(t),markers:[t]})),et=class extends H{constructor(t){var{maxZoom:e,radius:r=60}=t,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(t,["maxZoom","radius"]);super({maxZoom:e}),this.markers=[],this.clusters=[],this.state={zoom:-1},this.superCluster=new R(Object.assign({maxZoom:this.maxZoom,radius:r},n))}calculate(t){let e=!1,r=t.map.getZoom();Q(r),r=Math.round(r);const n={zoom:r};if(!O(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const r=this.markers.map(t=>{const e=X.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng(),e.lat()]},properties:{marker:t}}});this.superCluster.load(r)}return e||(this.state.zoom<=this.maxZoom||n.zoom<=this.maxZoom)&&(e=!O(this.state,n)),this.state=n,0===t.markers.length?(this.clusters=[],{clusters:this.clusters,changed:e}):(e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e})}cluster({map:t}){const e=t.getZoom();return Q(e),this.superCluster.getClusters([-180,-90,180,90],Math.round(e)).map(t=>this.transformCluster(t))}transformCluster({geometry:{coordinates:[t,e]},properties:r}){if(r.cluster)return new J({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map(t=>t.properties.marker),position:{lat:e,lng:t}});const n=r.marker;return new J({markers:[n],position:X.getPosition(n)})}},rt=class{constructor(t,e){this.markers={sum:t.length};const r=e.map(t=>t.count),n=r.reduce((t,e)=>t+e,0);this.clusters={count:e.length,markers:{mean:n/e.length,sum:n,min:Math.min(...r),max:Math.max(...r)}}}},nt=class{render({count:t,position:e},r,n){const s=`<svg fill="${t>Math.max(10,r.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${t}</text>\n</svg>`,o=`Cluster of ${t} markers`,i=Number(google.maps.Marker.MAX_ZINDEX)+t;if(X.isAdvancedMarkerAvailable(n)){const t=(new DOMParser).parseFromString(s,"image/svg+xml").documentElement;t.setAttribute("transform","translate(0 25)");const r={map:n,position:e,zIndex:i,title:o,content:t};return new google.maps.marker.AdvancedMarkerElement(r)}const a={position:e,zIndex:i,title:o,icon:{url:`data:image/svg+xml;base64,${btoa(s)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(a)}},st=class t{constructor(){!function(t,e){for(let r in e.prototype)t.prototype[r]=e.prototype[r]}(t,google.maps.OverlayView)}};!function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click",t.GMP_CLICK="gmp-click"}(Y||(Y={}));var ot=(t,e,r)=>{e.bounds&&r.fitBounds(e.bounds)},it=class extends st{constructor({map:t,markers:e=[],algorithmOptions:r={},algorithm:n=new et(r),renderer:s=new nt,onClusterClick:o=ot}){super(),this.map=null,this.idleListener=null,this.markers=[...e],this.clusters=[],this.algorithm=n,this.renderer=s,this.onClusterClick=o,t&&this.setMap(t)}addMarker(t,e){this.markers.includes(t)||(this.markers.push(t),e||this.render())}addMarkers(t,e){t.forEach(t=>{this.addMarker(t,!0)}),e||this.render()}removeMarker(t,e){const r=this.markers.indexOf(t);return-1!==r&&(X.setMap(t,null),this.markers.splice(r,1),e||this.render(),!0)}removeMarkers(t,e){let r=!1;return t.forEach(t=>{r=this.removeMarker(t,!0)||r}),r&&!e&&this.render(),r}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const t=this.getMap();if(t instanceof google.maps.Map&&t.getProjection()){google.maps.event.trigger(this,Y.CLUSTERING_BEGIN,this);const{clusters:e,changed:r}=this.algorithm.calculate({markers:this.markers,map:t,mapCanvasProjection:this.getProjection()});if(r||null==r){const t=new Set;for(const n of e)1==n.markers.length&&t.add(n.markers[0]);const r=[];for(const e of this.clusters)null!=e.marker&&(1==e.markers.length?t.has(e.marker)||X.setMap(e.marker,null):r.push(e.marker));this.clusters=e,this.renderClusters(),requestAnimationFrame(()=>r.forEach(t=>X.setMap(t,null)))}google.maps.event.trigger(this,Y.CLUSTERING_END,this)}}onAdd(){const t=this.getMap();Q(t),this.idleListener=t.addListener("idle",this.render.bind(this)),this.render()}onRemove(){this.idleListener&&google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(t=>X.setMap(t,null)),this.clusters.forEach(t=>t.delete()),this.clusters=[]}renderClusters(){const t=new rt(this.markers,this.clusters),e=this.getMap();this.clusters.forEach(r=>{if(1===r.markers.length)r.marker=r.markers[0];else if(r.marker=this.renderer.render(r,t,e),r.markers.forEach(t=>X.setMap(t,null)),this.onClusterClick){const t=X.isAdvancedMarker(r.marker)?Y.GMP_CLICK:Y.CLUSTER_CLICK;r.marker.addListener(t,t=>{google.maps.event.trigger(this,Y.CLUSTER_CLICK,r),this.onClusterClick(t,r,e)})}X.setMap(r.marker,e)})}},at={top:60,bottom:60,left:276,right:60},ct="#fb8500",ut=new e.QueryClient,lt=(e,n,s)=>{t.R(t.u(t.QueryClientProvider,{client:ut,children:t.u(t.MemoryRouter,{children:t.u(r.EventPreviewCard,{event:e,onExplore:s})})}),n)},ht=t=>{const e=document.createElement("div");e.style.cssText=`\n background:${r.safeCssColor(t.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const n=document.createElement("span");n.textContent=t.folder.name;const s=document.createElement("span");return s.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",s.textContent=String(t.eventCount),e.appendChild(n),e.appendChild(s),e},pt=(t,e)=>{const n=document.createElement("div");if(n.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${t};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,e){const t=document.createElement("img");t.src=r.safeImageUrl(e)??"",t.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",n.appendChild(t)}return n};exports.default=({apiKey:e,onExplore:n,logoUrl:s})=>{const o=t.A(null),i=t.A(null),a=t.A(null),c=t.A(null),u=t.A([]),l=t.A([]),h=t.A(null),p=t.A(null),d=t.A(!1),f=t.A(!1),m=t.T(()=>(()=>{try{const e=sessionStorage.getItem(t.MAP_STATE_SESSION_STORAGE_PARAM);if(!e)return null;const r=JSON.parse(e);if(Array.isArray(r?.center)&&"number"==typeof r.zoom)return r}catch{}return null})(),[]),[g,y]=t.d(!1),[b,w]=t.d(!0),{folderTree:x,activeFolderId:E,activeFolder:k,visibleEvents:v,setActiveFolderId:A,isLoadingEvents:M}=r.useFolderMap(),{organization:_}=t.useSession(),C=()=>{u.current.forEach(t=>{t.map=null}),u.current=[]},j=()=>{h.current&&(h.current.clearMarkers(),h.current=null),l.current.forEach(t=>{t.map=null}),l.current=[]};return t.y(()=>{if(!o.current||i.current)return;let r=!1;return(async()=>{try{const{setOptions:n,importLibrary:s}=await Promise.resolve().then(()=>require("./BpfGLehL.js"));if(r)return;if(n({key:e,v:"weekly"}),await Promise.all([s("maps"),s("marker"),s("visualization")]),r||!o.current)return;const u=window.google.maps;a.current=u;const l=m?.center?{lng:m.center[0],lat:m.center[1]}:{lat:20,lng:0},h=m?.zoom??3,d=new u.Map(o.current,{mapId:"DEMO_MAP_ID",renderingType:"VECTOR",mapTypeId:"roadmap",center:l,zoom:h,mapTypeControl:!1,streetViewControl:!1});i.current=d,c.current=new u.InfoWindow({maxWidth:280}),p.current=new u.visualization.HeatmapLayer({data:[],map:null,radius:30,opacity:.8});const f=()=>{try{const e=d.getCenter();if(!e)return;sessionStorage.setItem(t.MAP_STATE_SESSION_STORAGE_PARAM,JSON.stringify({center:[e.lng(),e.lat()],zoom:d.getZoom()}))}catch{}};d.addListener("idle",f),w(!1),y(!0)}finally{r||w(!1)}})(),()=>{r=!0,C(),j(),p.current&&(p.current.setMap(null),p.current=null),c.current?.close(),i.current=null,a.current=null}},[e]),t.y(()=>{if(!g)return;const t=i.current,e=a.current;if(t&&e)if(C(),j(),c.current?.close(),null===E&&x.length>0){p.current?.setMap(null);const r=n=>{for(const s of n)if(s.centroid){const r=ht(s),n=new e.marker.AdvancedMarkerElement({map:t,position:{lng:s.centroid[0],lat:s.centroid[1]},content:r,gmpClickable:!0});n.addListener("click",()=>A(s.folder._id)),u.current.push(n)}else s.children.length>0&&r(s.children)};r(x)}else{const r=0===x.length&&null===E;if(0===v.length)return;if(r){const r=[],o=v.map(o=>{const i=o.location.y,a=o.location.x;r.push({location:new e.LatLng(i,a),weight:(o.views||0)+1});const u=pt(ct,s),l=new e.marker.AdvancedMarkerElement({map:t,position:{lat:i,lng:a},content:u,gmpClickable:!0});return l.addListener("click",()=>{const e=document.createElement("div");lt(o,e,n),c.current.close(),c.current.setContent(e),c.current.open({anchor:l,map:t})}),l});if(l.current=o,h.current=new it({markers:o,map:t,renderer:{render:({count:t,position:r})=>{const n=document.createElement("div"),s=t<10?28:t<30?34:40;return n.style.cssText=`\n width:${s}px;height:${s}px;border-radius:50%;cursor:pointer;\n background:${ct};color:#fff;\n display:flex;align-items:center;justify-content:center;\n font-size:13px;font-weight:700;\n box-shadow:0 2px 8px rgba(0,0,0,0.3);\n border:2px solid rgba(255,255,255,0.6);\n `,n.textContent=String(t),new e.marker.AdvancedMarkerElement({position:r,content:n,gmpClickable:!0,zIndex:Number(e.Marker?.MAX_ZINDEX??0)+t})}}}),p.current&&(p.current.setData(r),p.current.setMap(t)),!f.current&&(f.current=!0,!m)){const r=new e.LatLngBounds;v.forEach(t=>r.extend({lat:t.location.y,lng:t.location.x})),r.isEmpty()||t.fitBounds(r,at)}}else{p.current?.setMap(null);const r=k?.color||ct,o=new e.LatLngBounds;v.forEach(i=>{const a=i.location.y,u=i.location.x;o.extend({lat:a,lng:u});const h=pt(r,s),p=new e.marker.AdvancedMarkerElement({map:t,position:{lat:a,lng:u},content:h,gmpClickable:!0});p.addListener("click",()=>{const e=document.createElement("div");lt(i,e,n),c.current.close(),c.current.setContent(e),c.current.open({anchor:p,map:t})}),l.current.push(p)})}}},[E,x,v,g,n,s,A,k,m]),t.y(()=>{if(!g)return;const t=i.current,e=a.current;if(t&&e)if(d.current||!m){if(d.current=!0,E){const n=r.findNodeById(x,E);if(!n?.folder.boundary?.length)return;const s=new e.LatLngBounds;for(const t of n.folder.boundary)s.extend({lat:t.y,lng:t.x});s.isEmpty()||t.fitBounds(s,{...at,maxZoom:14})}else if(x.length>0){const r=new e.LatLngBounds,n=t=>{for(const e of t)e.centroid?r.extend({lng:e.centroid[0],lat:e.centroid[1]}):n(e.children)};n(x),r.isEmpty()||t.fitBounds(r,{...at,maxZoom:8})}}else d.current=!0},[E,x,g,m]),t.u("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:t.getStyleObject(_),children:[t.u(r.FolderTreeSidebar,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:x,activeFolderId:E,setActiveFolderId:A}),M&&t.u("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),b&&t.u("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:t.u("div",{class:"flex flex-col items-center gap-3",children:[t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),t.u("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),t.u("div",{ref:o,class:"size-full"})]})};
1
+ const t=require("./Cn5QS0_5.js"),e=require("./BNq5z2O6.js"),r=require("./DMmZTL_c.js");var{getOwnPropertyNames:n,getOwnPropertySymbols:s}=Object,{hasOwnProperty:o}=Object.prototype;function i(t,e){return function(r,n,s){return t(r,n,s)&&e(r,n,s)}}function a(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);const{cache:s}=n,o=s.get(e),i=s.get(r);if(o&&i)return o===r&&i===e;s.set(e,r),s.set(r,e);const a=t(e,r,n);return s.delete(e),s.delete(r),a}}function c(t){return n(t).concat(s(t))}var u=Object.hasOwn||((t,e)=>o.call(t,e));function l(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var{getOwnPropertyDescriptor:h,keys:p}=Object;function d(t,e){return t.byteLength===e.byteLength&&_(new Uint8Array(t),new Uint8Array(e))}function f(t,e,r){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function m(t,e){return t.byteLength===e.byteLength&&_(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function g(t,e){return l(t.getTime(),e.getTime())}function y(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function b(t,e){return t===e}function w(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const s=new Array(n),o=t.entries();let i,a,c=0;for(;(i=o.next())&&!i.done;){const n=e.entries();let o=!1,u=0;for(;(a=n.next())&&!a.done;){if(s[u]){u++;continue}const n=i.value,l=a.value;if(r.equals(n[0],l[0],c,u,t,e,r)&&r.equals(n[1],l[1],n[0],l[0],t,e,r)){o=s[u]=!0;break}u++}if(!o)return!1;c++}return!0}var x=l;function E(t,e,r){const n=p(t);let s=n.length;if(p(e).length!==s)return!1;for(;s-- >0;)if(!j(t,e,r,n[s]))return!1;return!0}function k(t,e,r){const n=c(t);let s,o,i,a=n.length;if(c(e).length!==a)return!1;for(;a-- >0;){if(s=n[a],!j(t,e,r,s))return!1;if(o=h(t,s),i=h(e,s),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable))return!1}return!0}function v(t,e){return l(t.valueOf(),e.valueOf())}function A(t,e){return t.source===e.source&&t.flags===e.flags}function M(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const s=new Array(n),o=t.values();let i,a;for(;(i=o.next())&&!i.done;){const n=e.values();let o=!1,c=0;for(;(a=n.next())&&!a.done;){if(!s[c]&&r.equals(i.value,a.value,i.value,a.value,t,e,r)){o=s[c]=!0;break}c++}if(!o)return!1}return!0}function _(t,e){let r=t.byteLength;if(e.byteLength!==r||t.byteOffset!==e.byteOffset)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function C(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function j(t,e,r,n){return!("_owner"!==n&&"__o"!==n&&"__v"!==n||!t.$$typeof&&!e.$$typeof)||u(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var L={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},I=Object.prototype.toString;var O=T();function T(t={}){const{circular:e=!1,createInternalComparator:r,createState:n,strict:s=!1}=t,o=function({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:l,areSetsEqual:h,areTypedArraysEqual:p,areUrlsEqual:d,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&o(m,g,y);const w=m.constructor;if(w!==g.constructor)return!1;if(w===Object)return c(m,g,y);if(Array.isArray(m))return e(m,g,y);if(w===Date)return n(m,g,y);if(w===RegExp)return l(m,g,y);if(w===Map)return i(m,g,y);if(w===Set)return h(m,g,y);const x=I.call(m);if("[object Date]"===x)return n(m,g,y);if("[object RegExp]"===x)return l(m,g,y);if("[object Map]"===x)return i(m,g,y);if("[object Set]"===x)return h(m,g,y);if("[object Object]"===x)return"function"!=typeof m.then&&"function"!=typeof g.then&&c(m,g,y);if("[object URL]"===x)return d(m,g,y);if("[object Error]"===x)return s(m,g,y);if("[object Arguments]"===x)return c(m,g,y);if(L[x])return p(m,g,y);if("[object ArrayBuffer]"===x)return t(m,g,y);if("[object DataView]"===x)return r(m,g,y);if("[object Boolean]"===x||"[object Number]"===x||"[object String]"===x)return u(m,g,y);if(f){let t=f[x];if(!t){const e=null!=(E=m)?E[Symbol.toStringTag]:void 0;e&&(t=f[e])}if(t)return t(m,g,y)}var E;return!1}}(function({circular:t,createCustomConfig:e,strict:r}){let n={areArrayBuffersEqual:d,areArraysEqual:r?k:f,areDataViewsEqual:m,areDatesEqual:g,areErrorsEqual:y,areFunctionsEqual:b,areMapsEqual:r?i(w,k):w,areNumbersEqual:x,areObjectsEqual:r?k:E,arePrimitiveWrappersEqual:v,areRegExpsEqual:A,areSetsEqual:r?i(M,k):M,areTypedArraysEqual:r?i(_,k):_,areUrlsEqual:C,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const t=a(n.areArraysEqual),e=a(n.areMapsEqual),r=a(n.areObjectsEqual),s=a(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:t,areMapsEqual:e,areObjectsEqual:r,areSetsEqual:s})}return n}(t));return function({circular:t,comparator:e,createState:r,equals:n,strict:s}){if(r)return function(o,i){const{cache:a=(t?new WeakMap:void 0),meta:c}=r();return e(o,i,{cache:a,equals:n,meta:c,strict:s})};if(t)return function(t,r){return e(t,r,{cache:new WeakMap,equals:n,meta:void 0,strict:s})};const o={cache:void 0,equals:n,meta:void 0,strict:s};return function(t,r){return e(t,r,o)}}({circular:e,comparator:o,createState:n,equals:r?r(o):(c=o,function(t,e,r,n,s,o,i){return c(t,e,i)}),strict:s});var c}T({strict:!0}),T({circular:!0}),T({circular:!0,strict:!0}),T({createInternalComparator:()=>l}),T({strict:!0,createInternalComparator:()=>l}),T({circular:!0,createInternalComparator:()=>l}),T({circular:!0,createInternalComparator:()=>l,strict:!0});var q=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],S=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,n]=new Uint8Array(e,0,2);if(219!==r)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(1!==s)throw new Error(`Got v${s} data when expected v1.`);const o=q[15&n];if(!o)throw new Error("Unrecognized array type.");const[i]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new t(a,i,o,e)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const s=q.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,i=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-i%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+i+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+i+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+i+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return P(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:o,nodeSize:i}=this,a=[0,s.length-1,0],c=[];for(;a.length;){const u=a.pop()||0,l=a.pop()||0,h=a.pop()||0;if(l-h<=i){for(let i=h;i<=l;i++){const a=o[2*i],u=o[2*i+1];a>=t&&a<=r&&u>=e&&u<=n&&c.push(s[i])}continue}const p=h+l>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=r&&f>=e&&f<=n&&c.push(s[p]),(0===u?t<=d:e<=f)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?r>=d:n>=f)&&(a.push(p+1),a.push(l),a.push(1-u))}return c}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:s,nodeSize:o}=this,i=[0,n.length-1,0],a=[],c=r*r;for(;i.length;){const u=i.pop()||0,l=i.pop()||0,h=i.pop()||0;if(l-h<=o){for(let r=h;r<=l;r++)N(s[2*r],s[2*r+1],t,e)<=c&&a.push(n[r]);continue}const p=h+l>>1,d=s[2*p],f=s[2*p+1];N(d,f,t,e)<=c&&a.push(n[p]),(0===u?t-r<=d:e-r<=f)&&(i.push(h),i.push(p-1),i.push(1-u)),(0===u?t+r>=d:e+r>=f)&&(i.push(p+1),i.push(l),i.push(1-u))}return a}};function P(t,e,r,n,s,o){if(s-n<=r)return;const i=n+s>>1;z(t,e,i,n,s,o),P(t,e,r,n,i-1,1-o),P(t,e,r,i+1,s,1-o)}function z(t,e,r,n,s,o){for(;s>n;){if(s-n>600){const i=s-n+1,a=r-n+1,c=Math.log(i),u=.5*Math.exp(2*c/3),l=.5*Math.sqrt(c*u*(i-u)/i)*(a-i/2<0?-1:1);z(t,e,r,Math.max(n,Math.floor(r-a*u/i+l)),Math.min(s,Math.floor(r+(i-a)*u/i+l)),o)}const i=e[2*r+o];let a=n,c=s;for(U(t,e,n,r),e[2*s+o]>i&&U(t,e,n,s);a<c;){for(U(t,e,a,c),a++,c--;e[2*a+o]<i;)a++;for(;e[2*c+o]>i;)c--}e[2*n+o]===i?U(t,e,n,c):(c++,U(t,e,c,s)),c<=r&&(n=c+1),r<=c&&(s=c-1)}}function U(t,e,r,n){Z(t,r,n),Z(e,2*r,2*n),Z(e,2*r+1,2*n+1)}function Z(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function N(t,e,r,n){const s=t-r,o=e-n;return s*s+o*o}var F,B={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},D=Math.fround||(F=new Float32Array(1),t=>(F[0]=+t,F[0])),R=class{constructor(t){this.options=Object.assign(Object.create(B),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:n}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;const o=[];for(let a=0;a<t.length;a++){const e=t[a];if(!e.geometry)continue;const[r,n]=e.geometry.coordinates,s=D(V(r)),i=D(K(n));o.push(s,i,1/0,a,-1,1),this.options.reduce&&o.push(0)}let i=this.trees[n+1]=this._createTree(o);e&&console.timeEnd(s);for(let a=n;a>=r;a--){const t=+Date.now();i=this.trees[a]=this._createTree(this._cluster(i,a)),e&&console.log("z%d: %d clusters in %dms",a,i.numItems,+Date.now()-t)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let s=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,s=180;else if(r>s){const t=this.getClusters([r,n,180,o],e),i=this.getClusters([-180,n,s,o],e);return t.concat(i)}const i=this.trees[this._limitZoom(e)],a=i.range(V(r),K(o),V(s),K(n)),c=i.data,u=[];for(const l of a){const t=this.stride*l;u.push(c[t+5]>1?$(c,t,this.clusterProps):this.points[c[t+3]])}return u}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",s=this.trees[r];if(!s)throw new Error(n);const o=s.data;if(e*this.stride>=o.length)throw new Error(n);const i=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=o[e*this.stride],c=o[e*this.stride+1],u=s.within(a,c,i),l=[];for(const h of u){const e=h*this.stride;o[e+4]===t&&l.push(o[e+5]>1?$(o,e,this.clusterProps):this.points[o[e+3]])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,r){e=e||10,r=r||0;const n=[];return this._appendLeaves(n,t,e,r,0),n}getTile(t,e,r){const n=this.trees[this._limitZoom(t)],s=Math.pow(2,t),{extent:o,radius:i}=this.options,a=i/o,c=(r-a)/s,u=(r+1+a)/s,l={features:[]};return this._addTileFeatures(n.range((e-a)/s,c,(e+1+a)/s,u),n.data,e,r,s,l),0===e&&this._addTileFeatures(n.range(1-a/s,c,1,u),n.data,s,r,s,l),e===s-1&&this._addTileFeatures(n.range(0,c,a/s,u),n.data,-1,r,s,l),l.features.length?l:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,n,s){const o=this.getChildren(e);for(const i of o){const e=i.properties;if(e&&e.cluster?s+e.point_count<=n?s+=e.point_count:s=this._appendLeaves(t,e.cluster_id,r,n,s):s<n?s++:t.push(i),t.length===r)break}return s}_createTree(t){const e=new S(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.data=t,e}_addTileFeatures(t,e,r,n,s,o){for(const i of t){const t=i*this.stride,a=e[t+5]>1;let c,u,l;if(a)c=G(e,t,this.clusterProps),u=e[t],l=e[t+1];else{const r=this.points[e[t+3]];c=r.properties;const[n,s]=r.geometry.coordinates;u=V(n),l=K(s)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*s-r)),Math.round(this.options.extent*(l*s-n))]],tags:c};let p;p=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:n,reduce:s,minPoints:o}=this.options,i=r/(n*Math.pow(2,e)),a=t.data,c=[],u=this.stride;for(let l=0;l<a.length;l+=u){if(a[l+2]<=e)continue;a[l+2]=e;const r=a[l],n=a[l+1],h=t.within(a[l],a[l+1],i),p=a[l+5];let d=p;for(const t of h){const r=t*u;a[r+2]>e&&(d+=a[r+5])}if(d>p&&d>=o){let t,o=r*p,i=n*p,f=-1;const m=(l/u<<5)+(e+1)+this.points.length;for(const r of h){const n=r*u;if(a[n+2]<=e)continue;a[n+2]=e;const c=a[n+5];o+=a[n]*c,i+=a[n+1]*c,a[n+4]=m,s&&(t||(t=this._map(a,l,!0),f=this.clusterProps.length,this.clusterProps.push(t)),s(t,this._map(a,n)))}a[l+4]=m,c.push(o/d,i/d,1/0,m,-1,d),s&&c.push(f)}else{for(let t=0;t<u;t++)c.push(a[l+t]);if(d>1)for(const t of h){const r=t*u;if(!(a[r+2]<=e)){a[r+2]=e;for(let t=0;t<u;t++)c.push(a[r+t])}}}}return c}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const n=this.clusterProps[t[e+6]];return r?Object.assign({},n):n}const n=this.points[t[e+3]].properties,s=this.options.map(n);return r&&s===n?Object.assign({},s):s}};function $(t,e,r){return{type:"Feature",id:t[e+3],properties:G(t,e,r),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),W(t[e+1])]}};var n}function G(t,e,r){const n=t[e+5],s=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=t[e+6],i=-1===o?{}:Object.assign({},r[o]);return Object.assign(i,{cluster:!0,cluster_id:t[e+3],point_count:n,point_count_abbreviated:s})}function V(t){return t/360+.5}function K(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function W(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var X=class{static isAdvancedMarkerAvailable(t){return google.maps.marker&&!0===t.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(t){return google.maps.marker&&t instanceof google.maps.marker.AdvancedMarkerElement}static setMap(t,e){this.isAdvancedMarker(t)?t.map=e:t.setMap(e)}static getPosition(t){if(this.isAdvancedMarker(t)){if(t.position){if(t.position instanceof google.maps.LatLng)return t.position;if(Number.isFinite(t.position.lat)&&Number.isFinite(t.position.lng))return new google.maps.LatLng(t.position.lat,t.position.lng)}return new google.maps.LatLng(null)}return t.getPosition()}static getVisible(t){return!!this.isAdvancedMarker(t)||t.getVisible()}},J=class{constructor({markers:t,position:e}){this.markers=[],t&&(this.markers=t),e&&(e instanceof google.maps.LatLng?this._position=e:this._position=new google.maps.LatLng(e))}get bounds(){if(0===this.markers.length&&!this._position)return;const t=new google.maps.LatLngBounds(this._position,this._position);for(const e of this.markers)t.extend(X.getPosition(e));return t}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(t=>X.getVisible(t)).length}push(t){this.markers.push(t)}delete(){this.marker&&(X.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}};function Q(t,e="assertion failed"){if(null==t)throw Error(e)}var Y,H=class{constructor({maxZoom:t=16}){this.maxZoom=t}noop({markers:t}){return tt(t)}},tt=t=>t.map(t=>new J({position:X.getPosition(t),markers:[t]})),et=class extends H{constructor(t){var{maxZoom:e,radius:r=60}=t,n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]])}return r}(t,["maxZoom","radius"]);super({maxZoom:e}),this.markers=[],this.clusters=[],this.state={zoom:-1},this.superCluster=new R(Object.assign({maxZoom:this.maxZoom,radius:r},n))}calculate(t){let e=!1,r=t.map.getZoom();Q(r),r=Math.round(r);const n={zoom:r};if(!O(t.markers,this.markers)){e=!0,this.markers=[...t.markers];const r=this.markers.map(t=>{const e=X.getPosition(t);return{type:"Feature",geometry:{type:"Point",coordinates:[e.lng(),e.lat()]},properties:{marker:t}}});this.superCluster.load(r)}return e||(this.state.zoom<=this.maxZoom||n.zoom<=this.maxZoom)&&(e=!O(this.state,n)),this.state=n,0===t.markers.length?(this.clusters=[],{clusters:this.clusters,changed:e}):(e&&(this.clusters=this.cluster(t)),{clusters:this.clusters,changed:e})}cluster({map:t}){const e=t.getZoom();return Q(e),this.superCluster.getClusters([-180,-90,180,90],Math.round(e)).map(t=>this.transformCluster(t))}transformCluster({geometry:{coordinates:[t,e]},properties:r}){if(r.cluster)return new J({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map(t=>t.properties.marker),position:{lat:e,lng:t}});const n=r.marker;return new J({markers:[n],position:X.getPosition(n)})}},rt=class{constructor(t,e){this.markers={sum:t.length};const r=e.map(t=>t.count),n=r.reduce((t,e)=>t+e,0);this.clusters={count:e.length,markers:{mean:n/e.length,sum:n,min:Math.min(...r),max:Math.max(...r)}}}},nt=class{render({count:t,position:e},r,n){const s=`<svg fill="${t>Math.max(10,r.clusters.markers.mean)?"#ff0000":"#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${t}</text>\n</svg>`,o=`Cluster of ${t} markers`,i=Number(google.maps.Marker.MAX_ZINDEX)+t;if(X.isAdvancedMarkerAvailable(n)){const t=(new DOMParser).parseFromString(s,"image/svg+xml").documentElement;t.setAttribute("transform","translate(0 25)");const r={map:n,position:e,zIndex:i,title:o,content:t};return new google.maps.marker.AdvancedMarkerElement(r)}const a={position:e,zIndex:i,title:o,icon:{url:`data:image/svg+xml;base64,${btoa(s)}`,anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(a)}},st=class t{constructor(){!function(t,e){for(let r in e.prototype)t.prototype[r]=e.prototype[r]}(t,google.maps.OverlayView)}};!function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click",t.GMP_CLICK="gmp-click"}(Y||(Y={}));var ot=(t,e,r)=>{e.bounds&&r.fitBounds(e.bounds)},it=class extends st{constructor({map:t,markers:e=[],algorithmOptions:r={},algorithm:n=new et(r),renderer:s=new nt,onClusterClick:o=ot}){super(),this.map=null,this.idleListener=null,this.markers=[...e],this.clusters=[],this.algorithm=n,this.renderer=s,this.onClusterClick=o,t&&this.setMap(t)}addMarker(t,e){this.markers.includes(t)||(this.markers.push(t),e||this.render())}addMarkers(t,e){t.forEach(t=>{this.addMarker(t,!0)}),e||this.render()}removeMarker(t,e){const r=this.markers.indexOf(t);return-1!==r&&(X.setMap(t,null),this.markers.splice(r,1),e||this.render(),!0)}removeMarkers(t,e){let r=!1;return t.forEach(t=>{r=this.removeMarker(t,!0)||r}),r&&!e&&this.render(),r}clearMarkers(t){this.markers.length=0,t||this.render()}render(){const t=this.getMap();if(t instanceof google.maps.Map&&t.getProjection()){google.maps.event.trigger(this,Y.CLUSTERING_BEGIN,this);const{clusters:e,changed:r}=this.algorithm.calculate({markers:this.markers,map:t,mapCanvasProjection:this.getProjection()});if(r||null==r){const t=new Set;for(const n of e)1==n.markers.length&&t.add(n.markers[0]);const r=[];for(const e of this.clusters)null!=e.marker&&(1==e.markers.length?t.has(e.marker)||X.setMap(e.marker,null):r.push(e.marker));this.clusters=e,this.renderClusters(),requestAnimationFrame(()=>r.forEach(t=>X.setMap(t,null)))}google.maps.event.trigger(this,Y.CLUSTERING_END,this)}}onAdd(){const t=this.getMap();Q(t),this.idleListener=t.addListener("idle",this.render.bind(this)),this.render()}onRemove(){this.idleListener&&google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(t=>X.setMap(t,null)),this.clusters.forEach(t=>t.delete()),this.clusters=[]}renderClusters(){const t=new rt(this.markers,this.clusters),e=this.getMap();this.clusters.forEach(r=>{if(1===r.markers.length)r.marker=r.markers[0];else if(r.marker=this.renderer.render(r,t,e),r.markers.forEach(t=>X.setMap(t,null)),this.onClusterClick){const t=X.isAdvancedMarker(r.marker)?Y.GMP_CLICK:Y.CLUSTER_CLICK;r.marker.addListener(t,t=>{google.maps.event.trigger(this,Y.CLUSTER_CLICK,r),this.onClusterClick(t,r,e)})}X.setMap(r.marker,e)})}},at={top:60,bottom:60,left:276,right:60},ct="#fb8500",ut=new e.QueryClient,lt=(e,n,s)=>{t.R(t.u(t.QueryClientProvider,{client:ut,children:t.u(t.MemoryRouter,{children:t.u(r.EventPreviewCard,{event:e,onExplore:s})})}),n)},ht=t=>{const e=document.createElement("div");e.style.cssText=`\n background:${r.safeCssColor(t.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const n=document.createElement("span");n.textContent=t.folder.name;const s=document.createElement("span");return s.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",s.textContent=String(t.eventCount),e.appendChild(n),e.appendChild(s),e},pt=(t,e)=>{const n=document.createElement("div");if(n.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${t};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,e){const t=document.createElement("img");t.src=r.safeImageUrl(e)??"",t.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",n.appendChild(t)}return n};exports.default=({apiKey:e,onExplore:n,logoUrl:s})=>{const o=t.A(null),i=t.A(null),a=t.A(null),c=t.A(null),u=t.A([]),l=t.A([]),h=t.A(null),p=t.A(null),d=t.A(!1),f=t.A(!1),m=t.T(()=>(()=>{try{const e=sessionStorage.getItem(t.MAP_STATE_SESSION_STORAGE_PARAM);if(!e)return null;const r=JSON.parse(e);if(Array.isArray(r?.center)&&"number"==typeof r.zoom)return r}catch{}return null})(),[]),[g,y]=t.d(!1),[b,w]=t.d(!0),{folderTree:x,activeFolderId:E,activeFolder:k,visibleEvents:v,setActiveFolderId:A,isLoadingEvents:M}=r.useFolderMap(),{organization:_}=t.useSession(),C=()=>{u.current.forEach(t=>{t.map=null}),u.current=[]},j=()=>{h.current&&(h.current.clearMarkers(),h.current=null),l.current.forEach(t=>{t.map=null}),l.current=[]};return t.y(()=>{if(!o.current||i.current)return;let r=!1;return(async()=>{try{const{setOptions:n,importLibrary:s}=await Promise.resolve().then(()=>require("./BpfGLehL.js"));if(r)return;if(n({key:e,v:"weekly"}),await Promise.all([s("maps"),s("marker"),s("visualization")]),r||!o.current)return;const u=window.google.maps;a.current=u;const l=m?.center?{lng:m.center[0],lat:m.center[1]}:{lat:20,lng:0},h=m?.zoom??3,d=new u.Map(o.current,{mapId:"DEMO_MAP_ID",renderingType:"VECTOR",mapTypeId:"roadmap",center:l,zoom:h,mapTypeControl:!1,streetViewControl:!1});i.current=d,c.current=new u.InfoWindow({maxWidth:280}),p.current=new u.visualization.HeatmapLayer({data:[],map:null,radius:30,opacity:.8});const f=()=>{try{const e=d.getCenter();if(!e)return;sessionStorage.setItem(t.MAP_STATE_SESSION_STORAGE_PARAM,JSON.stringify({center:[e.lng(),e.lat()],zoom:d.getZoom()}))}catch{}};d.addListener("idle",f),w(!1),y(!0)}finally{r||w(!1)}})(),()=>{r=!0,C(),j(),p.current&&(p.current.setMap(null),p.current=null),c.current?.close(),i.current=null,a.current=null}},[e]),t.y(()=>{if(!g)return;const t=i.current,e=a.current;if(t&&e)if(C(),j(),c.current?.close(),null===E&&x.length>0){p.current?.setMap(null);const r=n=>{for(const s of n)if(s.centroid){const r=ht(s),n=new e.marker.AdvancedMarkerElement({map:t,position:{lng:s.centroid[0],lat:s.centroid[1]},content:r,gmpClickable:!0});n.addListener("click",()=>A(s.folder._id)),u.current.push(n)}else s.children.length>0&&r(s.children)};r(x)}else{const r=0===x.length&&null===E;if(0===v.length)return;if(r){const r=[],o=v.map(o=>{const i=o.location.y,a=o.location.x;r.push({location:new e.LatLng(i,a),weight:(o.views||0)+1});const u=pt(ct,s),l=new e.marker.AdvancedMarkerElement({map:t,position:{lat:i,lng:a},content:u,gmpClickable:!0});return l.addListener("click",()=>{const e=document.createElement("div");lt(o,e,n),c.current.close(),c.current.setContent(e),c.current.open({anchor:l,map:t})}),l});if(l.current=o,h.current=new it({markers:o,map:t,renderer:{render:({count:t,position:r})=>{const n=document.createElement("div"),s=t<10?28:t<30?34:40;return n.style.cssText=`\n width:${s}px;height:${s}px;border-radius:50%;cursor:pointer;\n background:${ct};color:#fff;\n display:flex;align-items:center;justify-content:center;\n font-size:13px;font-weight:700;\n box-shadow:0 2px 8px rgba(0,0,0,0.3);\n border:2px solid rgba(255,255,255,0.6);\n `,n.textContent=String(t),new e.marker.AdvancedMarkerElement({position:r,content:n,gmpClickable:!0,zIndex:Number(e.Marker?.MAX_ZINDEX??0)+t})}}}),p.current&&(p.current.setData(r),p.current.setMap(t)),!f.current&&(f.current=!0,!m)){const r=new e.LatLngBounds;v.forEach(t=>r.extend({lat:t.location.y,lng:t.location.x})),r.isEmpty()||t.fitBounds(r,at)}}else{p.current?.setMap(null);const r=k?.color||ct,o=new e.LatLngBounds;v.forEach(i=>{const a=i.location.y,u=i.location.x;o.extend({lat:a,lng:u});const h=pt(r,s),p=new e.marker.AdvancedMarkerElement({map:t,position:{lat:a,lng:u},content:h,gmpClickable:!0});p.addListener("click",()=>{const e=document.createElement("div");lt(i,e,n),c.current.close(),c.current.setContent(e),c.current.open({anchor:p,map:t})}),l.current.push(p)})}}},[E,x,v,g,n,s,A,k,m]),t.y(()=>{if(!g)return;const t=i.current,e=a.current;if(t&&e)if(d.current||!m){if(d.current=!0,E){const n=r.findNodeById(x,E);if(!n?.folder.boundary?.length)return;const s=new e.LatLngBounds;for(const t of n.folder.boundary)s.extend({lat:t.y,lng:t.x});s.isEmpty()||t.fitBounds(s,{...at,maxZoom:14})}else if(x.length>0){const r=new e.LatLngBounds,n=t=>{for(const e of t)e.centroid?r.extend({lng:e.centroid[0],lat:e.centroid[1]}):n(e.children)};n(x),r.isEmpty()||t.fitBounds(r,{...at,maxZoom:8})}}else d.current=!0},[E,x,g,m]),t.u("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:t.getStyleObject(_),children:[t.u(r.FolderTreeSidebar,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:x,activeFolderId:E,setActiveFolderId:A}),M&&t.u("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),b&&t.u("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:t.u("div",{class:"flex flex-col items-center gap-3",children:[t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),t.u("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),t.u("div",{ref:o,class:"size-full"})]})};
@@ -0,0 +1 @@
1
+ import{n as e}from"./Bto__AIV.js";var n=[{id:"underwater-correction",name:"Underwater Color Correction",description:"Reference underwater correction filter using hue-shifted red histogram normalization",category:"color-correction",script:"-- Underwater Color Correction\nfunction getColorMatrix(stats, pixels, width, height)\n local numOfPixels = width * height\n local thresholdRatio = 2000\n local thresholdLevel = numOfPixels / thresholdRatio\n local minAvgRed = 60\n local maxHueShift = 120\n local blueMagicValue = 1.2\n\n local hist = { r = {}, g = {}, b = {} }\n local normalize = { r = {}, g = {}, b = {} }\n local adjust = { r = {}, g = {}, b = {} }\n local hueShift = 0\n\n for i = 0, 255 do\n hist.r[i] = 0\n hist.g[i] = 0\n hist.b[i] = 0\n end\n\n local avg = calculateAverageColor(pixels, width, height)\n\n local newAvgRed = avg.r\n while newAvgRed < minAvgRed do\n local shifted = hueShiftRed(avg.r, avg.g, avg.b, hueShift)\n newAvgRed = shifted.r + shifted.g + shifted.b\n hueShift = hueShift + 1\n if hueShift > maxHueShift then\n newAvgRed = 60\n end\n end\n\n for y = 0, height - 1 do\n for x = 0, width * 4 - 4, 4 do\n local pos = x + (width * 4) * y\n\n local red = math.floor((pixels[pos] or 0) + 0.5)\n local green = math.floor((pixels[pos + 1] or 0) + 0.5)\n local blue = math.floor((pixels[pos + 2] or 0) + 0.5)\n\n local shifted = hueShiftRed(red, green, blue, hueShift)\n red = shifted.r + shifted.g + shifted.b\n red = math.min(255, math.max(0, red))\n red = math.floor(red + 0.5)\n\n hist.r[red] = (hist.r[red] or 0) + 1\n hist.g[green] = (hist.g[green] or 0) + 1\n hist.b[blue] = (hist.b[blue] or 0) + 1\n end\n end\n\n normalize.r[#normalize.r + 1] = 0\n normalize.g[#normalize.g + 1] = 0\n normalize.b[#normalize.b + 1] = 0\n\n for i = 0, 255 do\n if (hist.r[i] or 0) - thresholdLevel < 2 then normalize.r[#normalize.r + 1] = i end\n if (hist.g[i] or 0) - thresholdLevel < 2 then normalize.g[#normalize.g + 1] = i end\n if (hist.b[i] or 0) - thresholdLevel < 2 then normalize.b[#normalize.b + 1] = i end\n end\n\n normalize.r[#normalize.r + 1] = 255\n normalize.g[#normalize.g + 1] = 255\n normalize.b[#normalize.b + 1] = 255\n\n adjust.r = normalizingInterval(normalize.r)\n adjust.g = normalizingInterval(normalize.g)\n adjust.b = normalizingInterval(normalize.b)\n\n local shifted = hueShiftRed(1, 1, 1, hueShift)\n\n local redGain = 256 / (adjust.r.high - adjust.r.low)\n local greenGain = 256 / (adjust.g.high - adjust.g.low)\n local blueGain = 256 / (adjust.b.high - adjust.b.low)\n\n local redOffset = (-adjust.r.low / 256) * redGain\n local greenOffset = (-adjust.g.low / 256) * greenGain\n local blueOffset = (-adjust.b.low / 256) * blueGain\n\n local adjstRed = shifted.r * redGain\n local adjstRedGreen = shifted.g * redGain\n local adjstRedBlue = shifted.b * redGain * blueMagicValue\n\n return {\n adjstRed, adjstRedGreen, adjstRedBlue, 0, redOffset,\n 0, greenGain, 0, 0, greenOffset,\n 0, 0, blueGain, 0, blueOffset,\n 0, 0, 0, 1, 0,\n }\nend\n\nfunction calculateAverageColor(pixels, width, height)\n local avg = { r = 0, g = 0, b = 0 }\n\n for y = 0, height - 1 do\n for x = 0, width * 4 - 4, 4 do\n local pos = x + (width * 4) * y\n avg.r = avg.r + (pixels[pos] or 0)\n avg.g = avg.g + (pixels[pos + 1] or 0)\n avg.b = avg.b + (pixels[pos + 2] or 0)\n end\n end\n\n avg.r = avg.r / (width * height)\n avg.g = avg.g / (width * height)\n avg.b = avg.b / (width * height)\n\n return avg\nend\n\nfunction hueShiftRed(r, g, b, h)\n local U = math.cos(h * math.pi / 180)\n local W = math.sin(h * math.pi / 180)\n\n r = (0.299 + 0.701 * U + 0.168 * W) * r\n g = (0.587 - 0.587 * U + 0.330 * W) * g\n b = (0.114 - 0.114 * U - 0.497 * W) * b\n\n return { r = r, g = g, b = b }\nend\n\nfunction normalizingInterval(normArray)\n local high = 255\n local low = 0\n local maxDist = 0\n\n for i = 2, #normArray do\n local dist = normArray[i] - normArray[i - 1]\n if dist > maxDist then\n maxDist = dist\n high = normArray[i]\n low = normArray[i - 1]\n end\n end\n\n return { low = low, high = high }\nend",defaultVariables:{},variableSchema:[]},{id:"vignette",name:"Vignette Effect",description:"Darken image corners for dramatic effect",category:"stylistic",script:"-- Vignette Effect\n-- Darkens corners of the image\n\nfunction processPixel(r, g, b, a, x, y, width, height)\n -- Calculate distance from center (normalized 0-1)\n local cx = width / 2\n local cy = height / 2\n local dx = (x - cx) / cx\n local dy = (y - cy) / cy\n local distance = math.sqrt(dx * dx + dy * dy)\n\n -- Vignette strength\n local strength = vignette_strength or 0.5\n local radius = vignette_radius or 0.8\n\n -- Calculate vignette factor\n local factor = 1.0\n if distance > radius then\n factor = 1.0 - ((distance - radius) / (1 - radius)) * strength\n factor = math.max(0.2, factor) -- Don't go completely black\n end\n\n -- Apply vignette\n r = r * factor\n g = g * factor\n b = b * factor\n\n return r, g, b, a\nend",defaultVariables:{vignette_strength:.5,vignette_radius:.7},variableSchema:[{key:"vignette_strength",type:"number",label:"Vignette strength",min:0,max:1,step:.05,default:.5},{key:"vignette_radius",type:"number",label:"Vignette radius",min:0,max:1,step:.05,default:.7}]},{id:"sepia",name:"Sepia Tone",description:"Apply warm sepia tone for vintage look",category:"stylistic",script:"-- Sepia Tone\n-- Applies vintage sepia coloring\n\nfunction processPixel(r, g, b, a, x, y, width, height)\n local intensity = sepia_intensity or 1.0\n\n -- Convert to grayscale first\n local gray = (r * 0.299 + g * 0.587 + b * 0.114)\n\n -- Apply sepia tone\n local newR = math.min(255, gray + (40 * intensity))\n local newG = math.min(255, gray + (20 * intensity))\n local newB = math.max(0, gray - (30 * intensity))\n\n -- Blend with original based on intensity\n r = r * (1 - intensity) + newR * intensity\n g = g * (1 - intensity) + newG * intensity\n b = b * (1 - intensity) + newB * intensity\n\n return r, g, b, a\nend",defaultVariables:{sepia_intensity:.8},variableSchema:[{key:"sepia_intensity",type:"number",label:"Sepia intensity",min:0,max:1,step:.05,default:.8}]},{id:"auto-white-balance",name:"Auto White Balance",description:"Simple grey-world white balance algorithm",category:"color-correction",script:"-- Auto White Balance (Grey World)\n-- Assumes average color of image should be grey\n-- Note: This is a simplified version\n\nfunction processPixel(r, g, b, a, x, y, width, height)\n -- These would ideally be calculated from image histogram\n -- For per-pixel processing, we use approximate multipliers\n local avgR = avg_red or 128\n local avgG = avg_green or 128\n local avgB = avg_blue or 128\n\n -- Calculate gain to make averages equal\n local avgGray = (avgR + avgG + avgB) / 3\n\n if avgR > 0 then\n r = math.min(255, r * (avgGray / avgR))\n end\n if avgG > 0 then\n g = math.min(255, g * (avgGray / avgG))\n end\n if avgB > 0 then\n b = math.min(255, b * (avgGray / avgB))\n end\n\n return r, g, b, a\nend",defaultVariables:{avg_red:128,avg_green:128,avg_blue:128},variableSchema:[{key:"avg_red",type:"number",label:"Average red",min:1,max:255,step:1,default:128},{key:"avg_green",type:"number",label:"Average green",min:1,max:255,step:1,default:128},{key:"avg_blue",type:"number",label:"Average blue",min:1,max:255,step:1,default:128}]},{id:"custom-script",name:"Custom Script",description:"Start with a blank template",category:"custom",script:"-- Custom Filter Script\n-- Available: math functions, pixel coordinates\n-- Input: r, g, b, a (0-255), x, y, width, height\n-- Output: r, g, b, a\n\nfunction processPixel(r, g, b, a, x, y, width, height)\n -- Your custom logic here\n -- Example: Invert colors\n -- r = 255 - r\n -- g = 255 - g\n -- b = 255 - b\n\n return r, g, b, a\nend",defaultVariables:{},variableSchema:[]}],a={"Underwater Color Correction":"underwater-correction"};function t(e,t){const r=function(e,n){return e.templateId?e.templateId:n?a[n]:void 0}(e,t);if(!r)return e;const i=(l=r,n.find(e=>e.id===l));var l;return i?{...e,templateId:r,script:i.script,variables:{...i.defaultVariables,...e.variables||{}}}:e}var r=800;async function i(n,a,t){const r=await import("./CS1Kg8-a.js").then(n=>/* @__PURE__ */e(n.default,1)),{lua:i,lauxlib:l,lualib:o}=r,s=r.to_luastring,u=l.luaL_newstate();if(o.luaL_openlibs(u),function(e,n,a,t){const r=a.to_luastring;for(const i of["io","os","package","debug","load","loadfile","dofile","require"])n.lua_pushnil(e),n.lua_setglobal(e,r(i));n.lua_pushjsfunction(e,()=>0),n.lua_setglobal(e,r("print"));for(const[i,l]of Object.entries(t)){if("number"==typeof l)n.lua_pushnumber(e,l);else if("string"==typeof l)n.lua_pushstring(e,r(l));else{if("boolean"!=typeof l)continue;n.lua_pushboolean(e,l?1:0)}n.lua_setglobal(e,r(i))}}(u,i,r,a),l.luaL_dostring(u,s(n))!==i.LUA_OK){const e=i.lua_tojsstring(u,-1);return i.lua_close(u),{data:t,error:`Load error: ${e}`}}i.lua_getglobal(u,s("getColorMatrix"));const h=i.lua_isfunction(u,-1);if(i.lua_pop(u,1),h){const e=function(e){const{data:n,width:a,height:t}=e,r=a*t,i=new Array(256).fill(0),l=new Array(256).fill(0),o=new Array(256).fill(0),s=new Array(256).fill(0);let u=0,h=0,g=0,c=0;for(let d=0;d<n.length;d+=4)i[n[d]]++,l[n[d+1]]++,o[n[d+2]]++,s[n[d+3]]++,u+=n[d],h+=n[d+1],g+=n[d+2],c+=n[d+3];return{averages:{r:u/r,g:h/r,b:g/r,a:c/r},histograms:{r:i,g:l,b:o,a:s}}}(t);if(i.lua_getglobal(u,s("getColorMatrix")),function(e,n,a,t){n.lua_createtable(e,0,2),n.lua_pushstring(e,a("averages")),n.lua_createtable(e,0,4);for(const[r,i]of Object.entries(t.averages))n.lua_pushstring(e,a(r)),n.lua_pushnumber(e,i),n.lua_settable(e,-3);n.lua_settable(e,-3),n.lua_pushstring(e,a("histograms")),n.lua_createtable(e,0,4);for(const[r,i]of Object.entries(t.histograms))n.lua_pushstring(e,a(r)),n.lua_createtable(e,i.length,0),i.forEach((a,t)=>{n.lua_pushnumber(e,t),n.lua_pushnumber(e,a),n.lua_settable(e,-3)}),n.lua_settable(e,-3);n.lua_settable(e,-3)}(u,i,s,e),function(e,n,a){n.lua_createtable(e,a.data.length,0),a.data.forEach((a,t)=>{n.lua_pushnumber(e,t),n.lua_pushnumber(e,a),n.lua_settable(e,-3)})}(u,i,t),i.lua_pushnumber(u,t.width),i.lua_pushnumber(u,t.height),i.lua_pcall(u,4,1,0)!==i.LUA_OK){const e=i.lua_tojsstring(u,-1);return i.lua_close(u),{data:t,error:`Runtime error: ${e}`}}const n=function(e,n){const a=[];n.lua_rawgeti(e,-1,1);const t=n.lua_type(e,-1)===n.LUA_TNUMBER;if(n.lua_pop(e,1),t){for(let t=0;t<4;t++){const r=[];for(let a=0;a<5;a++)n.lua_rawgeti(e,-1,5*t+a+1),r.push(n.lua_tonumber(e,-1)),n.lua_pop(e,1);a.push(r)}return a}for(let r=0;r<4;r++){n.lua_rawgeti(e,-1,r+1);const t=[];for(let a=0;a<5;a++)n.lua_rawgeti(e,-1,a+1),t.push(n.lua_tonumber(e,-1)),n.lua_pop(e,1);a.push(t),n.lua_pop(e,1)}return a}(u,i);i.lua_pop(u,1),i.lua_close(u);const{data:a,width:r,height:l}=t,o=new Uint8ClampedArray(a.length),[h,g,c,d,m]=n[0],[f,p,b,v,_]=n[1],[w,y,x,R,A]=n[2],[M,j,z,S,G]=n[3];for(let t=0;t<a.length;t+=4){const e=a[t],n=a[t+1],r=a[t+2],i=a[t+3];o[t]=Math.min(255,Math.max(0,Math.round(h*e+g*n+c*r+d*i+255*m))),o[t+1]=Math.min(255,Math.max(0,Math.round(f*e+p*n+b*r+v*i+255*_))),o[t+2]=Math.min(255,Math.max(0,Math.round(w*e+y*n+x*r+R*i+255*A))),o[t+3]=Math.min(255,Math.max(0,Math.round(M*e+j*n+z*r+S*i+255*G)))}return{data:new ImageData(o,r,l)}}i.lua_getglobal(u,s("processPixel"));const g=i.lua_isfunction(u,-1);if(i.lua_pop(u,1),!g)return i.lua_close(u),{data:t,error:"Script must define one of: processPixel(r,g,b,a,x,y,w,h), processImage(ctx, stats), or getColorMatrix(ctx, stats)"};const{data:c,width:d,height:m}=t,f=new Uint8ClampedArray(c.length),p=Date.now();for(let e=0;e<c.length;e+=4){if(e%(40*d)==0&&Date.now()-p>2e4)return i.lua_close(u),{data:t,error:"Execution timeout"};const n=e/4,a=n%d,r=Math.floor(n/d);if(i.lua_getglobal(u,s("processPixel")),i.lua_pushnumber(u,c[e]),i.lua_pushnumber(u,c[e+1]),i.lua_pushnumber(u,c[e+2]),i.lua_pushnumber(u,c[e+3]),i.lua_pushnumber(u,a),i.lua_pushnumber(u,r),i.lua_pushnumber(u,d),i.lua_pushnumber(u,m),i.lua_pcall(u,8,4,0)!==i.LUA_OK){const e=i.lua_tojsstring(u,-1);return i.lua_close(u),{data:t,error:`Runtime error at pixel ${n}: ${e}`}}const l=i.lua_tonumber(u,-1),o=i.lua_tonumber(u,-2),h=i.lua_tonumber(u,-3),g=i.lua_tonumber(u,-4);i.lua_pop(u,4),f[e]=Math.min(255,Math.max(0,Math.round(g))),f[e+1]=Math.min(255,Math.max(0,Math.round(h))),f[e+2]=Math.min(255,Math.max(0,Math.round(o))),f[e+3]=Math.min(255,Math.max(0,Math.round(l)))}return i.lua_close(u),{data:new ImageData(f,d,m)}}async function l(e,n){const a=Date.now(),l=[],o=[],{canvas:s,w:u,h:h}=function(e){let n=e.naturalWidth,a=e.naturalHeight;if(n>r||a>r){const e=Math.min(r/n,r/a);n=Math.round(n*e),a=Math.round(a*e)}const t=document.createElement("canvas");return t.width=n,t.height=a,t.getContext("2d").drawImage(e,0,0,n,a),{canvas:t,w:n,h:a}}(await function(e){return new Promise((n,a)=>{const t=new Image,r=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(r),n(t)},t.onerror=()=>{URL.revokeObjectURL(r),a(/* @__PURE__ */new Error("Failed to load image"))},t.src=r})}(e)),g=s.toDataURL("image/jpeg",.92),c=document.createElement("canvas");c.width=u,c.height=h;const d=c.getContext("2d");d.drawImage(s,0,0);const m=n.filter(e=>e.enabled);for(const r of m){const e=t(r.config,r.name);if(!e?.script){o.push({id:r.id,error:"No Lua script provided"});continue}const n=d.getImageData(0,0,u,h),{data:a,error:s}=await i(e.script,e.variables||{},n);s?o.push({id:r.id,error:s}):(d.putImageData(a,0,0),l.push(r.id))}return{original:g,processed:c.toDataURL("image/jpeg",.92),appliedFilters:l,failedFilters:o,totalExecutionTime:Date.now()-a}}export{l as runClientLuaPreview};
@@ -0,0 +1 @@
1
+ import{createContext as e,useCallback as t,useContext as r,useEffect as n,useLayoutEffect as i,useRef as o,useState as a}from"react";import{jsx as l,jsxs as s}from"react/jsx-runtime";var d,c="itemOne",p="--rcs-raw-position",u="--rcs-current-position",h="--rcs-bounds-padding",g="--rcs-handle-color",v={capture:!1,passive:!0},b={capture:!0,passive:!1},m=((d={}).ARROW_LEFT="ArrowLeft",d.ARROW_RIGHT="ArrowRight",d.ARROW_UP="ArrowUp",d.ARROW_DOWN="ArrowDown",d),x=(e,t,r,i)=>{let a=o(void 0);n(()=>{a.current=t},[t]),n(()=>{if(!r?.addEventListener)return;let t=e=>a.current?.(e);return r.addEventListener(e,t,i),()=>{r.removeEventListener(e,t,i)}},[e,r,i])},y=e(null),f=({children:e,...t})=>l(y.Provider,{value:t,children:e}),w=()=>{let e=r(y);if(!e)throw Error("useReactCompareSliderContext must be used within the Provider component");return e},R=({flip:e})=>l("div",{"aria-hidden":"true",className:"__rcs-handle-arrow",style:{width:"0.85rem",height:"0.85rem",clipPath:"polygon(100% 0%, 100% 100%, 30% 50%)",rotate:e?"180deg":"0deg",outline:`0.5rem solid var(${g})`,outlineOffset:"-0.5rem"}}),P=({className:e="__rcs-handle-root",buttonStyle:t,linesStyle:r,style:n,...i})=>{let{disabled:o,portrait:a}=w(),d={boxSizing:"border-box",position:"relative",display:"inline-flex",flexDirection:a?"row":"column",placeItems:"center",width:a?"100%":void 0,height:a?void 0:"100%",cursor:o?"not-allowed":a?"ns-resize":"ew-resize",pointerEvents:"none",[g]:"rgba(255, 255, 255, 1)",...n},c={flexGrow:1,height:a?2:"100%",width:a?"100%":2,outline:`1px solid var(${g})`,outlineOffset:-1,pointerEvents:"auto",boxShadow:"0 0 4px rgba(0,0,0,.5)",...r},p={direction:"ltr",display:"grid",gridAutoFlow:"column",gap:"0.5rem",placeContent:"center",flexShrink:0,width:"3.5rem",height:"3.5rem",borderRadius:"50%",border:`2px solid var(${g})`,color:"inherit",pointerEvents:"auto",backdropFilter:"blur(0.5rem)",WebkitBackdropFilter:"blur(0.5rem)",backgroundColor:"rgba(0, 0, 0, 0.125)",boxShadow:"0 0 4px rgba(0,0,0,.35)",transform:a?"rotate(90deg)":void 0,...t};return s("div",{"data-rcs":"handle",...i,className:e,style:d,children:[l("div",{className:"__rcs-handle-line",style:c}),s("div",{className:"__rcs-handle-button",style:p,children:[l(R,{}),l(R,{flip:!0})]}),l("div",{className:"__rcs-handle-line",style:c})]})},k=({style:e,...t})=>{let{disabled:r,portrait:n,position:i,handleRootRef:o,onHandleRootClick:a,onHandleRootKeyDown:s}=w(),d={WebkitAppearance:"none",MozAppearance:"none",WebkitTapHighlightColor:"transparent",boxSizing:"border-box",position:"absolute",display:"flex",flexDirection:n?"row":"column",placeItems:"center",contain:"layout",top:n?"-50%":void 0,left:n?void 0:"-50%",width:"100%",height:"100%",background:"none",border:0,padding:0,pointerEvents:"none",appearance:"none",outline:0,zIndex:1,translate:n?`0 var(${u}) 0`:`var(${u}) 0 0`,backfaceVisibility:"hidden",willChange:"translate",...e};return x("keydown",s,o.current,b),x("click",a,o.current,b),l("div",{ref:o,tabIndex:0,"aria-label":"Click and drag or focus and use arrow keys to change the position of the slider","aria-orientation":n?"vertical":"horizontal","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i.current,"aria-disabled":r,"data-rcs":"handle-root",role:"slider",style:d,...t})},C=({itemClip:e,portrait:t})=>e===c?t?`inset(0px 0px calc(100% - var(${u})) 0px)`:`inset(0px calc(100% - var(${u})) 0px 0px)`:"itemTwo"===e?t?`inset(var(${u}) 0px 0px 0px)`:`inset(0px 0px 0px var(${u}))`:"none",S=({item:e,style:t,...r})=>{let{clip:n,portrait:i}=w(),o={KhtmlUserSelect:"none",MozUserSelect:"none",WebkitUserSelect:"none",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden",gridArea:"1 / 1",maxWidth:"100%",overflow:"hidden",clipPath:C({itemClip:"all"===n||n===e?e:void 0,portrait:i}),boxSizing:"border-box",transform:"translateZ(0)",userSelect:"none",zIndex:e===c?1:void 0,willChange:"clip-path",...t};return l("div",{"data-rcs":"item","data-rcs-item":e,...r,style:o})},O=`clamp(var(${h}), var(${p}) - var(${h}) + var(${h}), calc(100% - var(${h})))`,E=({style:e,...t})=>{let{browsingContext:r,boundsPadding:i,changePositionOnHover:o,clip:a,isDragging:s,portrait:d,position:c,onTouchEnd:g,onPointerDown:m,onPointerMove:y,onPointerUp:f,interactiveTarget:R,rootRef:P,transition:k,canTransition:C}=w(),S={position:"relative",boxSizing:"border-box",display:"grid",maxWidth:"100%",maxHeight:"100%",overflow:"hidden",cursor:s?d?"ns-resize":"ew-resize":void 0,touchAction:"pan-y",userSelect:"none",KhtmlUserSelect:"none",msUserSelect:"none",MozUserSelect:"none",WebkitUserSelect:"none",transition:C&&k?`${p} ${k}`:"none",[p]:`${c.current}%`,[h]:i,[u]:O,...e};return x("touchend",g,R,b),x("pointerdown",m,R,b),n(()=>{let e=P.current,t=e=>{s||f(e)};return o&&(e.addEventListener("pointermove",y,v),e.addEventListener("pointerleave",t,v)),()=>{e.removeEventListener("pointermove",y),e.removeEventListener("pointerleave",t)}},[o,y,f,s,P]),n(()=>{if(s)return r.addEventListener("pointermove",y,v),r.addEventListener("pointerup",f,v),()=>{r?.removeEventListener("pointermove",y),r?.removeEventListener("pointerup",f)}},[y,f,s,r]),l("div",{ref:P,style:S,"data-rcs":"root","data-rcs-clip":a,...t})};(()=>{try{typeof CSS<"u"&&CSS.registerProperty({name:p,syntax:"<percentage>",inherits:!0,initialValue:"50%"})}catch(d){console.debug("[react-compare-slider] register CSS property:",d)}})();var $=()=>globalThis.matchMedia?.("(prefers-reduced-motion: no-preference)")?.matches?"0.15s ease-out":"none",A=()=>!!globalThis.matchMedia?.("(pointer: coarse)")?.matches,D=({boundsPadding:e="0px",browsingContext:r=globalThis,changePositionOnHover:l=!1,clip:s="all",defaultPosition:d=50,disabled:c=!1,keyboardIncrement:u="5%",onlyHandleDraggable:h=A(),onPositionChange:g,portrait:v=!1,transition:b=$()}={})=>{let x=o(null),y=o(null),f=o(d),[w,R]=a(!1),[P,k]=a(!0),[C,S]=a(null),O=t(e=>{let t=Math.min(Math.max(e,0),100);x.current?.style.setProperty(p,`${t}%`),y.current?.setAttribute("aria-valuenow",`${Math.round(t)}`),f.current=t,g?.(t)},[g]),E=t(function({x:e,y:t}){let{width:n,height:i,top:o,left:a}=x.current.getBoundingClientRect();0===n||0===i||O((v?t-o-r.scrollY:e-a-r.scrollX)/(v?i:n)*100)},[r,v,O]),D=t(e=>{e.preventDefault(),!c&&0===e.button&&(E({x:e.pageX,y:e.pageY}),R(!0),k(!0))},[c,E]),T=t(function(e){k(!1),E({x:e.pageX,y:e.pageY})},[E]),W=t(e=>{R(!1),k(!0)},[]),_=t(e=>{R(!1),k(!0)},[]),H=t(e=>{e.preventDefault(),e.currentTarget?.focus()},[]),z=t(e=>{if(!Object.values(m).includes(e.key))return;e.preventDefault(),k(!0);let t="string"==typeof u?Number.parseFloat(u):u/x.current?.getBoundingClientRect().width*100;O((v?e.key===m.ARROW_LEFT||e.key===m.ARROW_DOWN:e.key===m.ARROW_RIGHT||e.key===m.ARROW_UP)?f.current+t:f.current-t)},[u,v,O]);return i(()=>{S(h?y.current:x.current)},[h]),n(()=>{O(d)},[d,O]),{boundsPadding:e,browsingContext:r,changePositionOnHover:l,clip:s,defaultPosition:d,disabled:c,keyboardIncrement:u,onlyHandleDraggable:h,portrait:v,transition:b,onHandleRootKeyDown:z,onPointerDown:D,onPointerMove:T,onPointerUp:W,onTouchEnd:_,onHandleRootClick:H,canTransition:P,isDragging:w,position:f,setPosition:O,setPositionFromBounds:E,rootRef:x,handleRootRef:y,interactiveTarget:C}},T=({boundsPadding:e,browsingContext:t,changePositionOnHover:r,clip:n,defaultPosition:i,disabled:o,handle:a,itemOne:d,itemTwo:c,keyboardIncrement:p,onPositionChange:u,onlyHandleDraggable:h,portrait:g,transition:v,...b})=>l(f,{...D({boundsPadding:e,browsingContext:t,changePositionOnHover:r,clip:n,defaultPosition:i,disabled:o,keyboardIncrement:p,onPositionChange:u,onlyHandleDraggable:h,portrait:g,transition:v}),children:s(E,{...b,children:[l(S,{item:"itemOne",children:d}),l(S,{item:"itemTwo",children:c}),l(k,{children:a||l(P,{})})]})});export{T as ReactCompareSlider};
@@ -1 +1 @@
1
- const e=require("./CH5eh9L8.js"),t=require("./BarCxWTX.js"),r=require("./B6PQAfDy.js"),n=require("./DDcelZeN.js");var o={top:60,bottom:60,left:276,right:60},i="#fb8500",s=new r.QueryClient,l=(e,r,o)=>{t.R(t.u(t.QueryClientProvider,{client:s,children:t.u(t.MemoryRouter,{children:t.u(n.EventPreviewCard,{event:e,onExplore:o})})}),r)},c=e=>{const t=document.createElement("div");t.style.cssText=`\n background:${n.safeCssColor(e.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=e.folder.name;const o=document.createElement("span");return o.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",o.textContent=String(e.eventCount),t.appendChild(r),t.appendChild(o),t};exports.default=({apiKey:r,is3D:s,onExplore:a,logoUrl:u})=>{const d=t.A(null),p=t.A(null),m=t.A(null),f=t.A(s),g=t.A([]),y=t.A([]),h=t.A(null),b=t.A(!1),v=t.A(!1),x=t.A(null),[w,E]=t.d(s),C=t.T(()=>(()=>{try{const e=sessionStorage.getItem(t.MAP_STATE_SESSION_STORAGE_PARAM);if(!e)return null;const r=JSON.parse(e);if(Array.isArray(r?.center)&&"number"==typeof r.zoom)return r}catch{}return null})(),[]),[_,L]=t.d(!1),[A,S]=t.d(!0),{folderTree:z,activeFolderId:T,activeFolder:k,visibleEvents:j,setActiveFolderId:F,isLoadingEvents:M}=n.useFolderMap(),{organization:P}=t.useSession(),O=()=>{g.current.forEach(e=>e.remove()),g.current=[]},B=()=>{y.current.forEach(e=>e.remove()),y.current=[]},I=(e,t)=>{const r=t?"visible":"none";for(const n of["heatmap","event-clusters","cluster-count","unclustered-point"])e.getLayer(n)&&e.setLayoutProperty(n,"visibility",r)};return t.y(()=>{if(!d.current||p.current)return;let n,o=!1;return(async()=>{try{const s=(await Promise.resolve().then(()=>e.__toESM(require("./BvVjd_UK.js").default,1))).default;if(o)return;if(!d.current)return;const c=C?.center??[0,20],u=C?.zoom??3,g=new s.Map({container:d.current,style:`https://api.maptiler.com/maps/streets-v2/style.json?key=${r}`,center:c,zoom:u,minZoom:0,pitch:0,bearing:0,renderWorldCopies:!1,projection:f.current?{type:"globe"}:{type:"mercator"},canvasContextAttributes:{antialias:!0}});p.current=g,m.current=s,g.on("load",()=>{if(o)return;const e=g.getStyle()?.layers??[];let t,r;for(const n of e){const e=n;"symbol"===e.type&&e.layout?.["text-field"]&&!t&&(t=n.id),"building"!==e["source-layer"]||r||(r=e.source)}r&&!g.getLayer("3d-buildings")&&g.addLayer({id:"3d-buildings",source:r,"source-layer":"building",filter:["has","render_height"],type:"fill-extrusion",minzoom:2,paint:{"fill-extrusion-color":["interpolate",["linear"],["get","render_height"],0,"lightgray",200,"royalblue",400,"lightblue"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,15,["get","render_height"]],"fill-extrusion-base":["case",["has","render_min_height"],["get","render_min_height"],0],"fill-extrusion-opacity":.6}},t),g.addSource("all-events",{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterRadius:50,clusterMaxZoom:14}),g.addSource("heat-events",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),g.addLayer({id:"heatmap",type:"heatmap",source:"heat-events",layout:{visibility:"none"},paint:{"heatmap-weight":["interpolate",["linear"],["get","views"],0,0,200,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"rgb(103,169,207)",.4,"rgb(209,229,240)",.6,"rgb(253,219,199)",.8,"rgb(239,138,98)",1,"rgb(178,24,43)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,4,9,30],"heatmap-opacity":["interpolate",["linear"],["zoom"],6,.85,11,0]}}),g.addLayer({id:"event-clusters",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],i,10,"#e63946",30,"#9b2226"],"circle-radius":["step",["get","point_count"],16,10,20,30,26],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),g.addLayer({id:"cluster-count",type:"symbol",source:"all-events",layout:{visibility:"none","text-field":"{point_count_abbreviated}","text-size":12},paint:{"text-color":"#fff"}}),g.addLayer({id:"unclustered-point",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["!",["has","point_count"]],paint:{"circle-radius":7,"circle-color":i,"circle-stroke-color":"#fff","circle-stroke-width":2}}),g.on("click","event-clusters",e=>{const t=g.queryRenderedFeatures(e.point,{layers:["event-clusters"]});if(!t.length)return;const r=t[0].properties?.cluster_id,n=g.getSource("all-events");r&&n?.getClusterExpansionZoom&&n.getClusterExpansionZoom(r,(e,r)=>{e||"number"!=typeof r||g.easeTo({center:t[0].geometry.coordinates,zoom:r,duration:600})})}),g.on("click","unclustered-point",e=>{const t=e.features?.[0];if(!t)return;const r=t.geometry.coordinates.slice(0,2),n=t.properties??{},o={_id:n._id,slug:n.slug,name:n.name,views:n.views,location:{x:r[0],y:r[1],label:n.label},contents:n.thumbnailUrl?[{thumbnailUrl:n.thumbnailUrl}]:[]};x.current&&(x.current.remove(),x.current=null);const i=document.createElement("div");l(o,i,a);const c=new s.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-10]}).setLngLat(r).setDOMContent(i).addTo(g);x.current=c,c.on("close",()=>{x.current===c&&(x.current=null)})}),g.on("click",e=>{!g.queryRenderedFeatures(e.point,{layers:["event-clusters","unclustered-point"]}).length&&x.current&&(x.current.remove(),x.current=null)}),g.on("mouseenter","event-clusters",()=>{g.getCanvas().style.cursor="pointer"}),g.on("mouseleave","event-clusters",()=>{g.getCanvas().style.cursor=""}),g.on("mouseenter","unclustered-point",()=>{g.getCanvas().style.cursor="pointer"}),g.on("mouseleave","unclustered-point",()=>{g.getCanvas().style.cursor=""}),L(!0),S(!1)});const y=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{try{const e=g.getCenter();sessionStorage.setItem(t.MAP_STATE_SESSION_STORAGE_PARAM,JSON.stringify({center:[e.lng,e.lat],zoom:g.getZoom()}))}catch{}},250)};g.on("zoomend",y),g.on("moveend",y),n=()=>{O(),B(),h.current&&clearTimeout(h.current),g.off("zoomend",y),g.off("moveend",y),g.remove(),p.current=null,m.current=null}}finally{o||S(!1)}})(),()=>{o=!0,n?.()}},[r]),t.y(()=>{if(!_)return;const e=p.current,t=m.current;if(e&&t)if(O(),B(),null===T&&z.length>0){I(e,!1);const r=n=>{for(const o of n)if(o.centroid){const r=c(o);r.addEventListener("click",()=>F(o.folder._id));const n=new t.Marker({element:r,anchor:"center"}).setLngLat([o.centroid[0],o.centroid[1]]).addTo(e);g.current.push(n)}else o.children.length>0&&r(o.children)};r(z)}else if(0===z.length&&null===T){if(0===j.length)return;const r=j.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:[e.location.x,e.location.y]},properties:{_id:e._id,slug:e.slug,name:e.name,views:e.views??0,label:e.location?.label??"",thumbnailUrl:e.contents?.[0]?.thumbnailUrl??""}})),n={type:"FeatureCollection",features:r};if(e.getSource("all-events")?.setData(n),e.getSource("heat-events")?.setData({...n,features:r.map(e=>({...e,properties:{views:e.properties.views}}))}),I(e,!0),!v.current&&(v.current=!0,!C)){const r=new t.LngLatBounds;j.forEach(e=>r.extend([e.location.x,e.location.y])),r.isEmpty()||e.fitBounds(r,{padding:o,maxZoom:8,duration:800})}}else{if(0===j.length)return;I(e,!1);const r=k?.color||i,o=new t.LngLatBounds;j.forEach(i=>{const s=i.location.x,c=i.location.y;o.extend([s,c]);const d=((e,t)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${e};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,t){const e=document.createElement("img");e.src=n.safeImageUrl(t)??"",e.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(e)}return r})(r,u);d.addEventListener("click",()=>{x.current&&(x.current.remove(),x.current=null);const r=document.createElement("div");l(i,r,a);const n=new t.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-40]}).setLngLat([s,c]).setDOMContent(r).addTo(e);x.current=n,n.on("close",()=>{x.current===n&&(x.current=null)})});const p=new t.Marker({element:d}).setLngLat([s,c]).addTo(e);y.current.push(p)})}},[T,z,j,_,a,u,F,k,C]),t.y(()=>{if(!_)return;const e=p.current;if(!e)return;if(!b.current&&C)return void(b.current=!0);b.current=!0;const t={padding:o,duration:3e3,essential:!0};if(T){const r=n.findNodeById(z,T);if(!r?.folder.boundary?.length)return;const o=m.current;if(!o)return;const i=new o.LngLatBounds;for(const e of r.folder.boundary)i.extend([e.x,e.y]);i.isEmpty()||e.fitBounds(i,{...t,maxZoom:14})}else if(z.length>0){const r=m.current;if(!r)return;const n=new r.LngLatBounds,o=e=>{for(const t of e)t.centroid?n.extend([t.centroid[0],t.centroid[1]]):o(t.children)};o(z),n.isEmpty()||e.fitBounds(n,{...t,maxZoom:8})}},[T,z,_,C]),t.y(()=>{p.current&&(f.current=w,p.current.setProjection(w?{type:"globe"}:{type:"mercator"}),p.current.easeTo({pitch:0,bearing:0,duration:600}))},[w]),t.u("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:t.getStyleObject(P),children:[t.u(n.FolderTreeSidebar,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:z,activeFolderId:T,setActiveFolderId:F}),t.u("button",{type:"button",onClick:()=>E(e=>!e),class:"bg-background hover:bg-foreground/10 absolute top-4 right-4 z-[1000] rounded-xl px-3 py-2 text-xs font-semibold shadow-lg backdrop-blur-sm",children:w?"2D":"3D"}),M&&t.u("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),A&&t.u("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:t.u("div",{class:"flex flex-col items-center gap-3",children:[t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),t.u("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),t.u("div",{ref:d,class:"size-full"})]})};
1
+ const e=require("./CH5eh9L8.js"),t=require("./Cn5QS0_5.js"),r=require("./BNq5z2O6.js"),n=require("./DMmZTL_c.js");var o={top:60,bottom:60,left:276,right:60},i="#fb8500",s=new r.QueryClient,l=(e,r,o)=>{t.R(t.u(t.QueryClientProvider,{client:s,children:t.u(t.MemoryRouter,{children:t.u(n.EventPreviewCard,{event:e,onExplore:o})})}),r)},c=e=>{const t=document.createElement("div");t.style.cssText=`\n background:${n.safeCssColor(e.color,"#fb8500")};color:#fff;border-radius:20px;padding:5px 10px;\n font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;\n box-shadow:0 2px 8px rgba(0,0,0,0.25);border:2px solid rgba(255,255,255,0.4);\n display:inline-flex;align-items:center;gap:6px;\n `;const r=document.createElement("span");r.textContent=e.folder.name;const o=document.createElement("span");return o.style.cssText="background:rgba(0,0,0,0.18);border-radius:10px;padding:1px 5px;font-size:10px;",o.textContent=String(e.eventCount),t.appendChild(r),t.appendChild(o),t};exports.default=({apiKey:r,is3D:s,onExplore:a,logoUrl:u})=>{const d=t.A(null),p=t.A(null),m=t.A(null),f=t.A(s),g=t.A([]),y=t.A([]),h=t.A(null),b=t.A(!1),v=t.A(!1),x=t.A(null),[w,E]=t.d(s),C=t.T(()=>(()=>{try{const e=sessionStorage.getItem(t.MAP_STATE_SESSION_STORAGE_PARAM);if(!e)return null;const r=JSON.parse(e);if(Array.isArray(r?.center)&&"number"==typeof r.zoom)return r}catch{}return null})(),[]),[_,L]=t.d(!1),[A,S]=t.d(!0),{folderTree:z,activeFolderId:T,activeFolder:k,visibleEvents:j,setActiveFolderId:F,isLoadingEvents:M}=n.useFolderMap(),{organization:P}=t.useSession(),O=()=>{g.current.forEach(e=>e.remove()),g.current=[]},B=()=>{y.current.forEach(e=>e.remove()),y.current=[]},I=(e,t)=>{const r=t?"visible":"none";for(const n of["heatmap","event-clusters","cluster-count","unclustered-point"])e.getLayer(n)&&e.setLayoutProperty(n,"visibility",r)};return t.y(()=>{if(!d.current||p.current)return;let n,o=!1;return(async()=>{try{const s=(await Promise.resolve().then(()=>e.__toESM(require("./Bp3BRlhW.js").default,1))).default;if(o)return;if(!d.current)return;const c=C?.center??[0,20],u=C?.zoom??3,g=new s.Map({container:d.current,style:`https://api.maptiler.com/maps/streets-v2/style.json?key=${r}`,center:c,zoom:u,minZoom:0,pitch:0,bearing:0,renderWorldCopies:!1,projection:f.current?{type:"globe"}:{type:"mercator"},canvasContextAttributes:{antialias:!0}});p.current=g,m.current=s,g.on("load",()=>{if(o)return;const e=g.getStyle()?.layers??[];let t,r;for(const n of e){const e=n;"symbol"===e.type&&e.layout?.["text-field"]&&!t&&(t=n.id),"building"!==e["source-layer"]||r||(r=e.source)}r&&!g.getLayer("3d-buildings")&&g.addLayer({id:"3d-buildings",source:r,"source-layer":"building",filter:["has","render_height"],type:"fill-extrusion",minzoom:2,paint:{"fill-extrusion-color":["interpolate",["linear"],["get","render_height"],0,"lightgray",200,"royalblue",400,"lightblue"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,15,["get","render_height"]],"fill-extrusion-base":["case",["has","render_min_height"],["get","render_min_height"],0],"fill-extrusion-opacity":.6}},t),g.addSource("all-events",{type:"geojson",data:{type:"FeatureCollection",features:[]},cluster:!0,clusterRadius:50,clusterMaxZoom:14}),g.addSource("heat-events",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),g.addLayer({id:"heatmap",type:"heatmap",source:"heat-events",layout:{visibility:"none"},paint:{"heatmap-weight":["interpolate",["linear"],["get","views"],0,0,200,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(33,102,172,0)",.2,"rgb(103,169,207)",.4,"rgb(209,229,240)",.6,"rgb(253,219,199)",.8,"rgb(239,138,98)",1,"rgb(178,24,43)"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,4,9,30],"heatmap-opacity":["interpolate",["linear"],["zoom"],6,.85,11,0]}}),g.addLayer({id:"event-clusters",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],i,10,"#e63946",30,"#9b2226"],"circle-radius":["step",["get","point_count"],16,10,20,30,26],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),g.addLayer({id:"cluster-count",type:"symbol",source:"all-events",layout:{visibility:"none","text-field":"{point_count_abbreviated}","text-size":12},paint:{"text-color":"#fff"}}),g.addLayer({id:"unclustered-point",type:"circle",source:"all-events",layout:{visibility:"none"},filter:["!",["has","point_count"]],paint:{"circle-radius":7,"circle-color":i,"circle-stroke-color":"#fff","circle-stroke-width":2}}),g.on("click","event-clusters",e=>{const t=g.queryRenderedFeatures(e.point,{layers:["event-clusters"]});if(!t.length)return;const r=t[0].properties?.cluster_id,n=g.getSource("all-events");r&&n?.getClusterExpansionZoom&&n.getClusterExpansionZoom(r,(e,r)=>{e||"number"!=typeof r||g.easeTo({center:t[0].geometry.coordinates,zoom:r,duration:600})})}),g.on("click","unclustered-point",e=>{const t=e.features?.[0];if(!t)return;const r=t.geometry.coordinates.slice(0,2),n=t.properties??{},o={_id:n._id,slug:n.slug,name:n.name,views:n.views,location:{x:r[0],y:r[1],label:n.label},contents:n.thumbnailUrl?[{thumbnailUrl:n.thumbnailUrl}]:[]};x.current&&(x.current.remove(),x.current=null);const i=document.createElement("div");l(o,i,a);const c=new s.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-10]}).setLngLat(r).setDOMContent(i).addTo(g);x.current=c,c.on("close",()=>{x.current===c&&(x.current=null)})}),g.on("click",e=>{!g.queryRenderedFeatures(e.point,{layers:["event-clusters","unclustered-point"]}).length&&x.current&&(x.current.remove(),x.current=null)}),g.on("mouseenter","event-clusters",()=>{g.getCanvas().style.cursor="pointer"}),g.on("mouseleave","event-clusters",()=>{g.getCanvas().style.cursor=""}),g.on("mouseenter","unclustered-point",()=>{g.getCanvas().style.cursor="pointer"}),g.on("mouseleave","unclustered-point",()=>{g.getCanvas().style.cursor=""}),L(!0),S(!1)});const y=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{try{const e=g.getCenter();sessionStorage.setItem(t.MAP_STATE_SESSION_STORAGE_PARAM,JSON.stringify({center:[e.lng,e.lat],zoom:g.getZoom()}))}catch{}},250)};g.on("zoomend",y),g.on("moveend",y),n=()=>{O(),B(),h.current&&clearTimeout(h.current),g.off("zoomend",y),g.off("moveend",y),g.remove(),p.current=null,m.current=null}}finally{o||S(!1)}})(),()=>{o=!0,n?.()}},[r]),t.y(()=>{if(!_)return;const e=p.current,t=m.current;if(e&&t)if(O(),B(),null===T&&z.length>0){I(e,!1);const r=n=>{for(const o of n)if(o.centroid){const r=c(o);r.addEventListener("click",()=>F(o.folder._id));const n=new t.Marker({element:r,anchor:"center"}).setLngLat([o.centroid[0],o.centroid[1]]).addTo(e);g.current.push(n)}else o.children.length>0&&r(o.children)};r(z)}else if(0===z.length&&null===T){if(0===j.length)return;const r=j.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:[e.location.x,e.location.y]},properties:{_id:e._id,slug:e.slug,name:e.name,views:e.views??0,label:e.location?.label??"",thumbnailUrl:e.contents?.[0]?.thumbnailUrl??""}})),n={type:"FeatureCollection",features:r};if(e.getSource("all-events")?.setData(n),e.getSource("heat-events")?.setData({...n,features:r.map(e=>({...e,properties:{views:e.properties.views}}))}),I(e,!0),!v.current&&(v.current=!0,!C)){const r=new t.LngLatBounds;j.forEach(e=>r.extend([e.location.x,e.location.y])),r.isEmpty()||e.fitBounds(r,{padding:o,maxZoom:8,duration:800})}}else{if(0===j.length)return;I(e,!1);const r=k?.color||i,o=new t.LngLatBounds;j.forEach(i=>{const s=i.location.x,c=i.location.y;o.extend([s,c]);const d=((e,t)=>{const r=document.createElement("div");if(r.style.cssText=`\n width:36px;height:36px;cursor:pointer;\n background:${e};border-radius:50% 50% 50% 0;transform:rotate(-45deg);\n border:2px solid white;box-shadow:0 2px 8px rgba(0,0,0,0.3);\n display:flex;align-items:center;justify-content:center;overflow:hidden;\n `,t){const e=document.createElement("img");e.src=n.safeImageUrl(t)??"",e.style.cssText="width:24px;height:24px;border-radius:50%;object-fit:cover;transform:rotate(45deg);",r.appendChild(e)}return r})(r,u);d.addEventListener("click",()=>{x.current&&(x.current.remove(),x.current=null);const r=document.createElement("div");l(i,r,a);const n=new t.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"none",offset:[0,-40]}).setLngLat([s,c]).setDOMContent(r).addTo(e);x.current=n,n.on("close",()=>{x.current===n&&(x.current=null)})});const p=new t.Marker({element:d}).setLngLat([s,c]).addTo(e);y.current.push(p)})}},[T,z,j,_,a,u,F,k,C]),t.y(()=>{if(!_)return;const e=p.current;if(!e)return;if(!b.current&&C)return void(b.current=!0);b.current=!0;const t={padding:o,duration:3e3,essential:!0};if(T){const r=n.findNodeById(z,T);if(!r?.folder.boundary?.length)return;const o=m.current;if(!o)return;const i=new o.LngLatBounds;for(const e of r.folder.boundary)i.extend([e.x,e.y]);i.isEmpty()||e.fitBounds(i,{...t,maxZoom:14})}else if(z.length>0){const r=m.current;if(!r)return;const n=new r.LngLatBounds,o=e=>{for(const t of e)t.centroid?n.extend([t.centroid[0],t.centroid[1]]):o(t.children)};o(z),n.isEmpty()||e.fitBounds(n,{...t,maxZoom:8})}},[T,z,_,C]),t.y(()=>{p.current&&(f.current=w,p.current.setProjection(w?{type:"globe"}:{type:"mercator"}),p.current.easeTo({pitch:0,bearing:0,duration:600}))},[w]),t.u("div",{class:"relative h-screen w-full sm:h-[calc(100vh-4rem)]",style:t.getStyleObject(P),children:[t.u(n.FolderTreeSidebar,{positionClass:"absolute top-3 left-16 z-[1000]",folderTree:z,activeFolderId:T,setActiveFolderId:F}),t.u("button",{type:"button",onClick:()=>E(e=>!e),class:"bg-background hover:bg-foreground/10 absolute top-4 right-4 z-[1000] rounded-xl px-3 py-2 text-xs font-semibold shadow-lg backdrop-blur-sm",children:w?"2D":"3D"}),M&&t.u("div",{class:"absolute inset-0 z-10 flex items-center justify-center bg-white/60",children:t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"})}),A&&t.u("div",{class:"absolute inset-0 z-20 flex items-center justify-center bg-white/85",children:t.u("div",{class:"flex flex-col items-center gap-3",children:[t.u("div",{class:"border-primary size-10 animate-spin rounded-full border-4 border-t-transparent"}),t.u("p",{class:"text-sm font-medium text-slate-700",children:"Loading map…"})]})}),t.u("div",{ref:d,class:"size-full"})]})};