@geowiki/map 0.16.9-dev.9 → 0.16.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  useEvolandStore,
39
39
  useMapLayerStore,
40
40
  useMapStore
41
- } from "./chunk-3LCQXIYM.mjs";
41
+ } from "./chunk-ALCD7VXT.mjs";
42
42
 
43
43
  // src/Components/CanvasImage.tsx
44
44
  var CanvasImage = () => {
@@ -224,10 +224,8 @@ var BingLayer = class extends L3.TileLayer {
224
224
  for (let i = z4; i > 0; i--) {
225
225
  let digit = 0;
226
226
  const mask = 1 << i - 1;
227
- if ((x & mask) !== 0)
228
- digit += 1;
229
- if ((y & mask) !== 0)
230
- digit += 2;
227
+ if ((x & mask) !== 0) digit += 1;
228
+ if ((y & mask) !== 0) digit += 2;
231
229
  quad = quad + digit;
232
230
  }
233
231
  return quad;
@@ -241,8 +239,7 @@ var BingLayer = class extends L3.TileLayer {
241
239
  }
242
240
  loadMetadata() {
243
241
  var _a;
244
- if (this.metaRequested)
245
- return;
242
+ if (this.metaRequested) return;
246
243
  this.metaRequested = true;
247
244
  const _this = this;
248
245
  const cbid = "_bing_metadata_" + L3.Util.stamp(this);
@@ -250,8 +247,7 @@ var BingLayer = class extends L3.TileLayer {
250
247
  var _a2;
251
248
  window[cbid] = void 0;
252
249
  const e = document.getElementById(cbid);
253
- if (e)
254
- (_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
250
+ if (e) (_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
255
251
  if (meta.errorDetails) {
256
252
  console.log(meta.errorDetails);
257
253
  return;
@@ -295,8 +291,7 @@ var BingLayer = class extends L3.TileLayer {
295
291
  this._update();
296
292
  }
297
293
  _update() {
298
- if (this._url === null || !this._map)
299
- return;
294
+ if (this._url === null || !this._map) return;
300
295
  this._update_attribution();
301
296
  super._update();
302
297
  }
@@ -458,8 +453,7 @@ var useMapControlStore = create2((set) => ({
458
453
  })),
459
454
  toggleControlOpen: (id) => set((state) => {
460
455
  const targetControl = state.controls.find((c) => c.id === id);
461
- if (!targetControl)
462
- return state;
456
+ if (!targetControl) return state;
463
457
  const targetPosition = targetControl.position;
464
458
  const shouldOpenTarget = !targetControl.isOpen;
465
459
  const updatedControls = state.controls.map((control) => {
@@ -645,7 +639,7 @@ import { jsx as jsx10 } from "react/jsx-runtime";
645
639
  var constructLegendUrl = (baseUrl, layer, format, style) => {
646
640
  return `${baseUrl}?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=${format}&LAYER=${layer}&STYLE=${style}&legend_options=dpi:150`;
647
641
  };
648
- var fetchLegendData = (baseUrl, layerName, format, style) => __async(void 0, null, function* () {
642
+ var fetchLegendData = (baseUrl, layerName, format, style) => __async(null, null, function* () {
649
643
  const legendGraphicUrl = constructLegendUrl(
650
644
  baseUrl,
651
645
  layerName,
@@ -1462,10 +1456,8 @@ var LayerSwitcher = memo2(() => {
1462
1456
  },
1463
1457
  [openHoverCardId]
1464
1458
  );
1465
- if (error)
1466
- return /* @__PURE__ */ jsx14("div", { children: "Error loading map layers" });
1467
- if (isLoading)
1468
- return /* @__PURE__ */ jsx14("div", { children: "Loading layers..." });
1459
+ if (error) return /* @__PURE__ */ jsx14("div", { children: "Error loading map layers" });
1460
+ if (isLoading) return /* @__PURE__ */ jsx14("div", { children: "Loading layers..." });
1469
1461
  const mapMenus = parseMapMenuItems(mapMenuItems);
1470
1462
  const hasRegularLayers = (mapMenus == null ? void 0 : mapMenus.length) > 0;
1471
1463
  const hasCustomLayers = customLayers.length > 0;
@@ -1479,6 +1471,7 @@ var LayerSwitcher = memo2(() => {
1479
1471
  /* @__PURE__ */ jsx14(
1480
1472
  Disclosure,
1481
1473
  {
1474
+ as: "div",
1482
1475
  "data-component": menu.title,
1483
1476
  defaultOpen: mapMenus.length === 1,
1484
1477
  children: ({ open }) => {
@@ -1947,8 +1940,7 @@ var MapControlContainer = memo3(() => {
1947
1940
  }, [controls]);
1948
1941
  return /* @__PURE__ */ jsx18(TooltipProvider, { children: /* @__PURE__ */ jsx18(Fragment6, { children: Object.entries(POSITION_CLASSES).map(([position, className]) => {
1949
1942
  const positionControls = controlsByPosition[position] || [];
1950
- if (positionControls.length === 0)
1951
- return null;
1943
+ if (positionControls.length === 0) return null;
1952
1944
  return /* @__PURE__ */ jsx18(
1953
1945
  PositionGroup,
1954
1946
  {
@@ -1975,8 +1967,7 @@ var BasicMap = () => {
1975
1967
  ((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
1976
1968
  ];
1977
1969
  useRenderInfo("BasicMap");
1978
- if (isSettingsLoading)
1979
- return /* @__PURE__ */ jsx19(LoaderFull, {});
1970
+ if (isSettingsLoading) return /* @__PURE__ */ jsx19(LoaderFull, {});
1980
1971
  return /* @__PURE__ */ jsx19(Fragment7, { children: /* @__PURE__ */ jsxs12(
1981
1972
  MapContainer2,
1982
1973
  {
@@ -2048,8 +2039,7 @@ var useSelectedPixelStore = create3((set) => ({
2048
2039
  set((state) => {
2049
2040
  var _a;
2050
2041
  const feat = (_a = geoJson.features[0]) == null ? void 0 : _a.id;
2051
- if (!feat)
2052
- return state;
2042
+ if (!feat) return state;
2053
2043
  const existing = state.data.some(
2054
2044
  (item) => item.features[0].id === geoJson.features[0].id
2055
2045
  );
@@ -2722,7 +2712,7 @@ var BasfSelect = () => {
2722
2712
  [selectedItems]
2723
2713
  );
2724
2714
  const onSubmit = useCallback4(
2725
- (data) => __async(void 0, null, function* () {
2715
+ (data) => __async(null, null, function* () {
2726
2716
  setIsSubmitting(true);
2727
2717
  try {
2728
2718
  if (checkIfItemExists(data)) {
@@ -2832,8 +2822,7 @@ function PolylineMeasureControl() {
2832
2822
  const controlRef = useRef4(null);
2833
2823
  const [active, setActive] = useState6(false);
2834
2824
  useEffect8(() => {
2835
- if (!map)
2836
- return;
2825
+ if (!map) return;
2837
2826
  controlRef.current = L5.control.polylineMeasure({
2838
2827
  position: "topright",
2839
2828
  unit: "metres",
@@ -2854,8 +2843,7 @@ function PolylineMeasureControl() {
2854
2843
  };
2855
2844
  }, [map]);
2856
2845
  const togglePolylineMeasure = () => {
2857
- if (!controlRef.current)
2858
- return;
2846
+ if (!controlRef.current) return;
2859
2847
  if (!controlRef.current._measureControl) {
2860
2848
  console.warn("Measurement control not properly initialized");
2861
2849
  return;
@@ -2871,8 +2859,7 @@ function PolylineMeasureControl() {
2871
2859
  }
2872
2860
  };
2873
2861
  const clearMeasurements = () => {
2874
- if (!controlRef.current)
2875
- return;
2862
+ if (!controlRef.current) return;
2876
2863
  controlRef.current._clearAllMeasurements();
2877
2864
  trackMapEvent2.measurementTool("clear");
2878
2865
  };
@@ -2981,8 +2968,7 @@ var BasfMapComponent = (_a) => {
2981
2968
  Number((_i = (_h = (_g = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _g.Longitude) == null ? void 0 : _h.Text) != null ? _i : 16.3738)
2982
2969
  ];
2983
2970
  const steps = (_k = (_j = mapSettings == null ? void 0 : mapSettings.MapSettings) == null ? void 0 : _j.TourSteps) == null ? void 0 : _k.Text;
2984
- if (isSettingsLoading)
2985
- return /* @__PURE__ */ jsx30(LoaderFull2, {});
2971
+ if (isSettingsLoading) return /* @__PURE__ */ jsx30(LoaderFull2, {});
2986
2972
  return /* @__PURE__ */ jsx30(Fragment10, { children: /* @__PURE__ */ jsxs19(
2987
2973
  MapContainer3,
2988
2974
  __spreadProps(__spreadValues({
@@ -3052,7 +3038,7 @@ var GeoTreesDownloadContent = () => {
3052
3038
  }
3053
3039
  }, [session, setValue]);
3054
3040
  useEffect10(() => {
3055
- const fetchCountries = () => __async(void 0, null, function* () {
3041
+ const fetchCountries = () => __async(null, null, function* () {
3056
3042
  try {
3057
3043
  const response = yield fetch(
3058
3044
  `${baseUrl}/api/plots/get-available-countries`,
@@ -3068,7 +3054,7 @@ var GeoTreesDownloadContent = () => {
3068
3054
  console.error("Error fetching countries:", error);
3069
3055
  }
3070
3056
  });
3071
- const fetchVersions = () => __async(void 0, null, function* () {
3057
+ const fetchVersions = () => __async(null, null, function* () {
3072
3058
  try {
3073
3059
  const response = yield fetch(
3074
3060
  `${baseUrl}/api/plots/available-versions`,
@@ -3322,8 +3308,7 @@ var ScaleControl3 = ({
3322
3308
  const [scale, setScale] = useState8("");
3323
3309
  useEffect11(() => {
3324
3310
  const updateScale = () => {
3325
- if (!map)
3326
- return;
3311
+ if (!map) return;
3327
3312
  const center = map.getCenter();
3328
3313
  const zoom = map.getZoom();
3329
3314
  const metersPerPixel = 156543.03392 * Math.cos(center.lat * Math.PI / 180) / Math.pow(2, zoom);
@@ -3339,8 +3324,7 @@ var ScaleControl3 = ({
3339
3324
  map.off("moveend", updateScale);
3340
3325
  };
3341
3326
  }, [map]);
3342
- if (!scale)
3343
- return null;
3327
+ if (!scale) return null;
3344
3328
  return /* @__PURE__ */ jsx32(
3345
3329
  "div",
3346
3330
  {
@@ -3943,7 +3927,7 @@ var GeoTreesExternalLayer = forwardRef3(
3943
3927
  const externalUrl = `${API_URL}/api/external/google-sheet-geojson`;
3944
3928
  const { isLoading, error, data } = useQuery2({
3945
3929
  queryKey: ["geoTreesExternal", externalUrl],
3946
- queryFn: () => __async(void 0, null, function* () {
3930
+ queryFn: () => __async(null, null, function* () {
3947
3931
  if (!API_URL) {
3948
3932
  throw new Error("NEXT_PUBLIC_GEO_TREE_API_URL is not configured");
3949
3933
  }
@@ -3975,8 +3959,7 @@ var GeoTreesExternalLayer = forwardRef3(
3975
3959
  );
3976
3960
  const addGeoTreesLayer = useCallback5(() => {
3977
3961
  var _a2;
3978
- if (!data)
3979
- return;
3962
+ if (!data) return;
3980
3963
  const layerId = "geotrees-external-layer";
3981
3964
  if (hasLayerBeenAdded(layerId) || existingLayer || hasAddedLayer.current) {
3982
3965
  console.warn("GEO-TREES BRM layer already exists, skipping addition", {
@@ -3989,8 +3972,7 @@ var GeoTreesExternalLayer = forwardRef3(
3989
3972
  const filteredFeatures = ((_a2 = data.features) == null ? void 0 : _a2.filter((feature) => {
3990
3973
  var _a3;
3991
3974
  const status = (_a3 = feature.properties) == null ? void 0 : _a3.Status;
3992
- if (!status)
3993
- return true;
3975
+ if (!status) return true;
3994
3976
  const statusKey = getStatusFromRaw(status);
3995
3977
  return statusKey ? statusFilter[statusKey] : true;
3996
3978
  })) || [];
@@ -4058,12 +4040,9 @@ var GeoTreesExternalLayer = forwardRef3(
4058
4040
  addGeoTreesLayer();
4059
4041
  }
4060
4042
  }, [data, autoAdd, existingLayer, addGeoTreesLayer, hasLayerBeenAdded]);
4061
- if (error)
4062
- return /* @__PURE__ */ jsx36(ErrorDisplay, { error });
4063
- if (isLoading)
4064
- return /* @__PURE__ */ jsx36(LoadingDisplay, {});
4065
- if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length))
4066
- return /* @__PURE__ */ jsx36(EmptyStateDisplay, {});
4043
+ if (error) return /* @__PURE__ */ jsx36(ErrorDisplay, { error });
4044
+ if (isLoading) return /* @__PURE__ */ jsx36(LoadingDisplay, {});
4045
+ if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length)) return /* @__PURE__ */ jsx36(EmptyStateDisplay, {});
4067
4046
  return null;
4068
4047
  }
4069
4048
  );
@@ -4114,8 +4093,7 @@ var GeoTreesMap = () => {
4114
4093
  "Error loading map settings: ",
4115
4094
  error.message
4116
4095
  ] }) });
4117
- if (isSettingsLoading)
4118
- return /* @__PURE__ */ jsx37(LoaderFull3, { showInCenter: false });
4096
+ if (isSettingsLoading) return /* @__PURE__ */ jsx37(LoaderFull3, { showInCenter: false });
4119
4097
  const zoom = (_c = (_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) != null ? _c : 12;
4120
4098
  const center = [
4121
4099
  (_f = (_e = (_d = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _d.Latitude) == null ? void 0 : _e.Text) != null ? _f : 48.2082,
@@ -4182,8 +4160,7 @@ var useAreaSelect = ({
4182
4160
  const rectangleRef = useRef7(null);
4183
4161
  useEffect15(() => {
4184
4162
  var _a;
4185
- if (!map.selectArea)
4186
- return;
4163
+ if (!map.selectArea) return;
4187
4164
  (_a = map.selectArea) == null ? void 0 : _a.setControlKey(false);
4188
4165
  if (!rectangleRef.current) {
4189
4166
  rectangleRef.current = new Rectangle(
@@ -4196,8 +4173,7 @@ var useAreaSelect = ({
4196
4173
  }
4197
4174
  const handleAreaSelected = (e) => {
4198
4175
  var _a2, _b, _c;
4199
- if (!e.bounds)
4200
- return;
4176
+ if (!e.bounds) return;
4201
4177
  const boundsString = e.bounds.toBBoxString();
4202
4178
  if (onAreaSelected) {
4203
4179
  onAreaSelected(boundsString);
@@ -4270,9 +4246,8 @@ import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
4270
4246
  var CanopyAtlasDownload = () => {
4271
4247
  const [format, setFormat] = useState10("shape-zip");
4272
4248
  const { bbox } = useAreaSelectStore();
4273
- const handleDownload = () => __async(void 0, null, function* () {
4274
- if (!bbox)
4275
- return;
4249
+ const handleDownload = () => __async(null, null, function* () {
4250
+ if (!bbox) return;
4276
4251
  const params = {
4277
4252
  request: "GetFeature",
4278
4253
  service: "WFS",
@@ -4287,8 +4262,7 @@ var CanopyAtlasDownload = () => {
4287
4262
  const wfsUrl = baseUrl + L7.Util.getParamString(params, baseUrl, true);
4288
4263
  try {
4289
4264
  const response = yield fetch(wfsUrl);
4290
- if (!response.ok)
4291
- throw new Error("Download failed");
4265
+ if (!response.ok) throw new Error("Download failed");
4292
4266
  const blob = yield response.blob();
4293
4267
  const url = window.URL.createObjectURL(blob);
4294
4268
  const a = document.createElement("a");
@@ -4470,20 +4444,15 @@ var CanopyFilter = memo11(({ onFilterChange }) => {
4470
4444
  localStorage.setItem(STORAGE_KEY, JSON.stringify(updatedFilters));
4471
4445
  onFilterChange(updatedFilters);
4472
4446
  };
4473
- const handleDownload = () => __async(void 0, null, function* () {
4447
+ const handleDownload = () => __async(null, null, function* () {
4474
4448
  const cqlFilters = [];
4475
- if (filters.biome)
4476
- cqlFilters.push(`biome='${filters.biome}'`);
4477
- if (filters.realm)
4478
- cqlFilters.push(`realm='${filters.realm}'`);
4479
- if (filters.access)
4480
- cqlFilters.push(`access='${filters.access}'`);
4449
+ if (filters.biome) cqlFilters.push(`biome='${filters.biome}'`);
4450
+ if (filters.realm) cqlFilters.push(`realm='${filters.realm}'`);
4451
+ if (filters.access) cqlFilters.push(`access='${filters.access}'`);
4481
4452
  if (filters.idunique)
4482
4453
  cqlFilters.push(`IDunique LIKE '%${filters.idunique}%'`);
4483
- if (filters.minyear)
4484
- cqlFilters.push(`minyear>=${filters.minyear}`);
4485
- if (filters.maxyear)
4486
- cqlFilters.push(`minyear<=${filters.maxyear}`);
4454
+ if (filters.minyear) cqlFilters.push(`minyear>=${filters.minyear}`);
4455
+ if (filters.maxyear) cqlFilters.push(`minyear<=${filters.maxyear}`);
4487
4456
  const params = __spreadValues({
4488
4457
  request: "GetFeature",
4489
4458
  service: "WFS",
@@ -4497,8 +4466,7 @@ var CanopyFilter = memo11(({ onFilterChange }) => {
4497
4466
  const wfsUrl = baseUrl + L8.Util.getParamString(params, baseUrl, true);
4498
4467
  try {
4499
4468
  const response = yield fetch(wfsUrl);
4500
- if (!response.ok)
4501
- throw new Error("Download failed");
4469
+ if (!response.ok) throw new Error("Download failed");
4502
4470
  const blob = yield response.blob();
4503
4471
  const url = window.URL.createObjectURL(blob);
4504
4472
  const a = document.createElement("a");
@@ -4732,10 +4700,8 @@ var constructCqlFilter = (filterParams) => {
4732
4700
  return "";
4733
4701
  }
4734
4702
  let _a = filterParams || {}, { minyear, maxyear } = _a, rest = __objRest(_a, ["minyear", "maxyear"]);
4735
- if (Array.isArray(minyear))
4736
- minyear = minyear[0];
4737
- if (Array.isArray(maxyear))
4738
- maxyear = maxyear[0];
4703
+ if (Array.isArray(minyear)) minyear = minyear[0];
4704
+ if (Array.isArray(maxyear)) maxyear = maxyear[0];
4739
4705
  const cqlExpressions = [];
4740
4706
  if (minyear && maxyear) {
4741
4707
  cqlExpressions.push(
@@ -4842,16 +4808,14 @@ var formatPropertyValue = (value, propertyName) => {
4842
4808
  return value.toString();
4843
4809
  };
4844
4810
  var createDefaultPopupContent = (feature, propertyNames) => {
4845
- if (!feature.properties)
4846
- return "";
4811
+ if (!feature.properties) return "";
4847
4812
  const propertiesToShow = (propertyNames == null ? void 0 : propertyNames.length) ? propertyNames : DEFAULT_POPUP_PROPERTIES;
4848
4813
  const properties = Object.entries(feature.properties).filter(([key]) => propertiesToShow.includes(key)).sort((a, b) => {
4849
4814
  const indexA = propertiesToShow.indexOf(a[0]);
4850
4815
  const indexB = propertiesToShow.indexOf(b[0]);
4851
4816
  return indexA - indexB;
4852
4817
  });
4853
- if (properties.length === 0)
4854
- return "";
4818
+ if (properties.length === 0) return "";
4855
4819
  return `
4856
4820
  <div class="leaflet-popup-content-wrapper" style="background-color: #fff; padding: 0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);">
4857
4821
  <div style="width: 100%; overflow-y: auto;">
@@ -4922,7 +4886,7 @@ var openDatabase = () => {
4922
4886
  };
4923
4887
  });
4924
4888
  };
4925
- var storeInIndexedDB = (key, data) => __async(void 0, null, function* () {
4889
+ var storeInIndexedDB = (key, data) => __async(null, null, function* () {
4926
4890
  try {
4927
4891
  const db = yield openDatabase();
4928
4892
  const transaction = db.transaction(STORE_NAME, "readwrite");
@@ -4941,7 +4905,7 @@ var storeInIndexedDB = (key, data) => __async(void 0, null, function* () {
4941
4905
  console.warn("Failed to store data in IndexedDB:", e);
4942
4906
  }
4943
4907
  });
4944
- var getFromIndexedDB = (key) => __async(void 0, null, function* () {
4908
+ var getFromIndexedDB = (key) => __async(null, null, function* () {
4945
4909
  try {
4946
4910
  const db = yield openDatabase();
4947
4911
  const transaction = db.transaction(STORE_NAME, "readonly");
@@ -4963,7 +4927,7 @@ var getFromIndexedDB = (key) => __async(void 0, null, function* () {
4963
4927
  return null;
4964
4928
  }
4965
4929
  });
4966
- var cleanupIndexedDB = () => __async(void 0, null, function* () {
4930
+ var cleanupIndexedDB = () => __async(null, null, function* () {
4967
4931
  try {
4968
4932
  const db = yield openDatabase();
4969
4933
  const transaction = db.transaction(STORE_NAME, "readwrite");
@@ -5013,8 +4977,7 @@ var WfsLayer = ({
5013
4977
  }
5014
4978
  });
5015
4979
  const stableFilterParams = useMemo4(() => {
5016
- if (!filterParams)
5017
- return null;
4980
+ if (!filterParams) return null;
5018
4981
  return JSON.stringify(filterParams);
5019
4982
  }, [filterParams]);
5020
4983
  const queryKey = useMemo4(() => {
@@ -5036,7 +4999,7 @@ var WfsLayer = ({
5036
4999
  }, [url, layerName, filterParams, useServerFiltering]);
5037
5000
  const { data: geoJsonData, error } = useQuery3({
5038
5001
  queryKey,
5039
- queryFn: () => __async(void 0, null, function* () {
5002
+ queryFn: () => __async(null, null, function* () {
5040
5003
  mapStore.setIsLoading(true);
5041
5004
  const wfsUrl = constructWfsUrl();
5042
5005
  const storageKey = `wfs-data-${queryKey.join("-")}`;
@@ -5101,8 +5064,7 @@ var WfsLayer = ({
5101
5064
  const getFeatureStyle = useCallback6(
5102
5065
  (feature) => {
5103
5066
  var _a2;
5104
- if (!feature)
5105
- return defaultStyle;
5067
+ if (!feature) return defaultStyle;
5106
5068
  const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
5107
5069
  return featureId === selectedFeatureId ? highlightStyle : defaultStyle;
5108
5070
  },
@@ -5113,8 +5075,7 @@ var WfsLayer = ({
5113
5075
  var _a2;
5114
5076
  const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
5115
5077
  layerRef.current[featureId] = layer;
5116
- if (!popupOptions || !feature.properties)
5117
- return;
5078
+ if (!popupOptions || !feature.properties) return;
5118
5079
  let popupContent;
5119
5080
  if (popupOptions.renderContent) {
5120
5081
  popupContent = popupOptions.renderContent(feature);
@@ -5159,8 +5120,7 @@ var WfsLayer = ({
5159
5120
  []
5160
5121
  );
5161
5122
  const filteredGeoJson = useMemo4(() => {
5162
- if (!geoJsonData)
5163
- return null;
5123
+ if (!geoJsonData) return null;
5164
5124
  if (useServerFiltering || !filterParams || Object.keys(filterParams).length === 0) {
5165
5125
  return geoJsonData;
5166
5126
  }
@@ -5397,15 +5357,14 @@ import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs29 } from "react/jsx-
5397
5357
  var CanopyMap = () => {
5398
5358
  var _a, _b, _c, _d, _e, _f;
5399
5359
  const { data: mapSettings, isLoading: isSettingsLoading } = useMapSettings4();
5400
- const mapRef = useRef10();
5360
+ const mapRef = useRef10(void 0);
5401
5361
  const zoom = ((_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) || 5;
5402
5362
  const center = [
5403
5363
  ((_d = (_c = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _c.Latitude) == null ? void 0 : _d.Text) || 48.2082,
5404
5364
  ((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
5405
5365
  ];
5406
5366
  useRenderInfo2("BasicMap");
5407
- if (isSettingsLoading)
5408
- return /* @__PURE__ */ jsx42(LoaderFull4, { showInCenter: false });
5367
+ if (isSettingsLoading) return /* @__PURE__ */ jsx42(LoaderFull4, { showInCenter: false });
5409
5368
  return /* @__PURE__ */ jsx42(Fragment16, { children: /* @__PURE__ */ jsxs29(
5410
5369
  MapContainer5,
5411
5370
  {
@@ -5529,7 +5488,7 @@ var BasfLeftPanel = () => {
5529
5488
  [selectedItems]
5530
5489
  );
5531
5490
  const onSubmit = useCallback8(
5532
- (data) => __async(void 0, null, function* () {
5491
+ (data) => __async(null, null, function* () {
5533
5492
  setIsSubmitting(true);
5534
5493
  try {
5535
5494
  if (checkIfItemExists(data)) {
@@ -5632,8 +5591,7 @@ var WaybackTimelineMap = (props) => {
5632
5591
  return null;
5633
5592
  }
5634
5593
  useEffect19(() => {
5635
- if (props.mapping)
5636
- setWAYBACK_SNAPSHOTS(props.mapping);
5594
+ if (props.mapping) setWAYBACK_SNAPSHOTS(props.mapping);
5637
5595
  }, [props.mapping]);
5638
5596
  const west = parseFloat(searchParams.get("xmin"));
5639
5597
  const south = parseFloat(searchParams.get("ymin"));
@@ -6039,7 +5997,7 @@ var LayerItem2 = memo13(
6039
5997
  }
6040
5998
  );
6041
5999
  LayerItem2.displayName = "LayerItem";
6042
- var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
6000
+ var LayerSwitcher2 = memo13((({ mapMenuItems, customLayers }) => {
6043
6001
  const store = useMapLayerStore2();
6044
6002
  const [openHoverCardId, setOpenHoverCardId] = useState16(null);
6045
6003
  useEffect20(() => {
@@ -6070,6 +6028,7 @@ var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
6070
6028
  /* @__PURE__ */ jsx46(
6071
6029
  Disclosure2,
6072
6030
  {
6031
+ as: "div",
6073
6032
  "data-component": menu.title,
6074
6033
  defaultOpen: mapMenuItems.length === 1,
6075
6034
  children: ({ open }) => {
@@ -6095,8 +6054,7 @@ var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
6095
6054
  ) !== -1,
6096
6055
  onToggle: () => {
6097
6056
  handleToggle(layer);
6098
- if (layer.ontoggle)
6099
- layer.ontoggle();
6057
+ if (layer.ontoggle) layer.ontoggle();
6100
6058
  },
6101
6059
  openHoverCardId,
6102
6060
  onInfoClick: handleInfoClick
@@ -6152,7 +6110,7 @@ var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
6152
6110
  ] })
6153
6111
  ] }, menu.id);
6154
6112
  }) });
6155
- });
6113
+ }));
6156
6114
  LayerSwitcher2.displayName = "LayerSwitcher";
6157
6115
 
6158
6116
  // src/Components/Generic/Map/MapControlToolbar.tsx
@@ -6164,23 +6122,18 @@ import {
6164
6122
  TooltipTrigger as TooltipTrigger2
6165
6123
  } from "@geowiki/ui";
6166
6124
 
6167
- // ../../node_modules/clsx/dist/clsx.m.js
6125
+ // ../../node_modules/clsx/dist/clsx.mjs
6168
6126
  function r(e) {
6169
6127
  var t, f, n = "";
6170
- if ("string" == typeof e || "number" == typeof e)
6171
- n += e;
6172
- else if ("object" == typeof e)
6173
- if (Array.isArray(e))
6174
- for (t = 0; t < e.length; t++)
6175
- e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
6176
- else
6177
- for (t in e)
6178
- e[t] && (n && (n += " "), n += t);
6128
+ if ("string" == typeof e || "number" == typeof e) n += e;
6129
+ else if ("object" == typeof e) if (Array.isArray(e)) {
6130
+ var o = e.length;
6131
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
6132
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
6179
6133
  return n;
6180
6134
  }
6181
6135
  function clsx() {
6182
- for (var e, t, f = 0, n = ""; f < arguments.length; )
6183
- (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
6136
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
6184
6137
  return n;
6185
6138
  }
6186
6139
 
@@ -6561,7 +6514,7 @@ var arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
6561
6514
  var fractionRegex = /^\d+\/\d+$/;
6562
6515
  var stringLengths = /* @__PURE__ */ new Set(["px", "full", "screen"]);
6563
6516
  var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
6564
- var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))/;
6517
+ var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
6565
6518
  var shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
6566
6519
  function isLength(value) {
6567
6520
  return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value) || isArbitraryLength(value);
@@ -6661,8 +6614,11 @@ function getDefaultConfig() {
6661
6614
  var getOverflow = function getOverflow2() {
6662
6615
  return ["auto", "hidden", "clip", "visible", "scroll"];
6663
6616
  };
6664
- var getSpacingWithAuto = function getSpacingWithAuto2() {
6665
- return ["auto", spacing];
6617
+ var getSpacingWithAutoAndArbitrary = function getSpacingWithAutoAndArbitrary2() {
6618
+ return ["auto", isArbitraryValue, spacing];
6619
+ };
6620
+ var getSpacingWithArbitrary = function getSpacingWithArbitrary2() {
6621
+ return [isArbitraryValue, spacing];
6666
6622
  };
6667
6623
  var getLengthWithEmpty = function getLengthWithEmpty2() {
6668
6624
  return ["", isLength];
@@ -6699,29 +6655,29 @@ function getDefaultConfig() {
6699
6655
  theme: {
6700
6656
  colors: [isAny],
6701
6657
  spacing: [isLength],
6702
- blur: ["none", "", isTshirtSize, isArbitraryLength],
6658
+ blur: ["none", "", isTshirtSize, isArbitraryValue],
6703
6659
  brightness: getNumber(),
6704
6660
  borderColor: [colors],
6705
- borderRadius: ["none", "", "full", isTshirtSize, isArbitraryLength],
6706
- borderSpacing: [spacing],
6661
+ borderRadius: ["none", "", "full", isTshirtSize, isArbitraryValue],
6662
+ borderSpacing: getSpacingWithArbitrary(),
6707
6663
  borderWidth: getLengthWithEmpty(),
6708
6664
  contrast: getNumber(),
6709
6665
  grayscale: getZeroAndEmpty(),
6710
6666
  hueRotate: getNumberAndArbitrary(),
6711
6667
  invert: getZeroAndEmpty(),
6712
- gap: [spacing],
6668
+ gap: getSpacingWithArbitrary(),
6713
6669
  gradientColorStops: [colors],
6714
6670
  gradientColorStopPositions: [isPercent, isArbitraryLength],
6715
- inset: getSpacingWithAuto(),
6716
- margin: getSpacingWithAuto(),
6671
+ inset: getSpacingWithAutoAndArbitrary(),
6672
+ margin: getSpacingWithAutoAndArbitrary(),
6717
6673
  opacity: getNumber(),
6718
- padding: [spacing],
6674
+ padding: getSpacingWithArbitrary(),
6719
6675
  saturate: getNumber(),
6720
6676
  scale: getNumber(),
6721
6677
  sepia: getZeroAndEmpty(),
6722
6678
  skew: getNumberAndArbitrary(),
6723
- space: [spacing],
6724
- translate: [spacing]
6679
+ space: getSpacingWithArbitrary(),
6680
+ translate: getSpacingWithArbitrary()
6725
6681
  },
6726
6682
  classGroups: {
6727
6683
  // Layout
@@ -6945,7 +6901,7 @@ function getDefaultConfig() {
6945
6901
  * @see https://tailwindcss.com/docs/flex-basis
6946
6902
  */
6947
6903
  basis: [{
6948
- basis: [spacing]
6904
+ basis: getSpacingWithAutoAndArbitrary()
6949
6905
  }],
6950
6906
  /**
6951
6907
  * Flex Direction
@@ -7002,7 +6958,7 @@ function getDefaultConfig() {
7002
6958
  */
7003
6959
  "col-start-end": [{
7004
6960
  col: ["auto", {
7005
- span: [isInteger]
6961
+ span: ["full", isInteger]
7006
6962
  }, isArbitraryValue]
7007
6963
  }],
7008
6964
  /**
@@ -7311,14 +7267,14 @@ function getDefaultConfig() {
7311
7267
  * @see https://tailwindcss.com/docs/width
7312
7268
  */
7313
7269
  w: [{
7314
- w: ["auto", "min", "max", "fit", spacing]
7270
+ w: ["auto", "min", "max", "fit", isArbitraryValue, spacing]
7315
7271
  }],
7316
7272
  /**
7317
7273
  * Min-Width
7318
7274
  * @see https://tailwindcss.com/docs/min-width
7319
7275
  */
7320
7276
  "min-w": [{
7321
- "min-w": ["min", "max", "fit", isLength]
7277
+ "min-w": ["min", "max", "fit", isArbitraryValue, isLength]
7322
7278
  }],
7323
7279
  /**
7324
7280
  * Max-Width
@@ -7327,28 +7283,28 @@ function getDefaultConfig() {
7327
7283
  "max-w": [{
7328
7284
  "max-w": ["0", "none", "full", "min", "max", "fit", "prose", {
7329
7285
  screen: [isTshirtSize]
7330
- }, isTshirtSize, isArbitraryLength]
7286
+ }, isTshirtSize, isArbitraryValue]
7331
7287
  }],
7332
7288
  /**
7333
7289
  * Height
7334
7290
  * @see https://tailwindcss.com/docs/height
7335
7291
  */
7336
7292
  h: [{
7337
- h: [spacing, "auto", "min", "max", "fit"]
7293
+ h: [isArbitraryValue, spacing, "auto", "min", "max", "fit"]
7338
7294
  }],
7339
7295
  /**
7340
7296
  * Min-Height
7341
7297
  * @see https://tailwindcss.com/docs/min-height
7342
7298
  */
7343
7299
  "min-h": [{
7344
- "min-h": ["min", "max", "fit", isLength]
7300
+ "min-h": ["min", "max", "fit", isArbitraryValue, isLength]
7345
7301
  }],
7346
7302
  /**
7347
7303
  * Max-Height
7348
7304
  * @see https://tailwindcss.com/docs/max-height
7349
7305
  */
7350
7306
  "max-h": [{
7351
- "max-h": [spacing, "min", "max", "fit"]
7307
+ "max-h": [isArbitraryValue, spacing, "min", "max", "fit"]
7352
7308
  }],
7353
7309
  // Typography
7354
7310
  /**
@@ -7417,7 +7373,7 @@ function getDefaultConfig() {
7417
7373
  * @see https://tailwindcss.com/docs/letter-spacing
7418
7374
  */
7419
7375
  tracking: [{
7420
- tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", isArbitraryLength]
7376
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", isArbitraryValue]
7421
7377
  }],
7422
7378
  /**
7423
7379
  * Line Clamp
@@ -7431,7 +7387,7 @@ function getDefaultConfig() {
7431
7387
  * @see https://tailwindcss.com/docs/line-height
7432
7388
  */
7433
7389
  leading: [{
7434
- leading: ["none", "tight", "snug", "normal", "relaxed", "loose", isLength]
7390
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose", isArbitraryValue, isLength]
7435
7391
  }],
7436
7392
  /**
7437
7393
  * List Style Image
@@ -7514,7 +7470,7 @@ function getDefaultConfig() {
7514
7470
  * @see https://tailwindcss.com/docs/text-underline-offset
7515
7471
  */
7516
7472
  "underline-offset": [{
7517
- "underline-offset": ["auto", isLength]
7473
+ "underline-offset": ["auto", isArbitraryValue, isLength]
7518
7474
  }],
7519
7475
  /**
7520
7476
  * Text Decoration Color
@@ -7538,14 +7494,14 @@ function getDefaultConfig() {
7538
7494
  * @see https://tailwindcss.com/docs/text-indent
7539
7495
  */
7540
7496
  indent: [{
7541
- indent: [spacing]
7497
+ indent: getSpacingWithArbitrary()
7542
7498
  }],
7543
7499
  /**
7544
7500
  * Vertical Alignment
7545
7501
  * @see https://tailwindcss.com/docs/vertical-align
7546
7502
  */
7547
7503
  "vertical-align": [{
7548
- align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryLength]
7504
+ align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryValue]
7549
7505
  }],
7550
7506
  /**
7551
7507
  * Whitespace
@@ -7975,7 +7931,7 @@ function getDefaultConfig() {
7975
7931
  * @see https://tailwindcss.com/docs/outline-offset
7976
7932
  */
7977
7933
  "outline-offset": [{
7978
- "outline-offset": [isLength]
7934
+ "outline-offset": [isArbitraryValue, isLength]
7979
7935
  }],
7980
7936
  /**
7981
7937
  * Outline Width
@@ -8054,7 +8010,7 @@ function getDefaultConfig() {
8054
8010
  opacity: [opacity]
8055
8011
  }],
8056
8012
  /**
8057
- * Mix Beldn Mode
8013
+ * Mix Blend Mode
8058
8014
  * @see https://tailwindcss.com/docs/mix-blend-mode
8059
8015
  */
8060
8016
  "mix-blend": [{
@@ -8413,126 +8369,126 @@ function getDefaultConfig() {
8413
8369
  * @see https://tailwindcss.com/docs/scroll-margin
8414
8370
  */
8415
8371
  "scroll-m": [{
8416
- "scroll-m": [spacing]
8372
+ "scroll-m": getSpacingWithArbitrary()
8417
8373
  }],
8418
8374
  /**
8419
8375
  * Scroll Margin X
8420
8376
  * @see https://tailwindcss.com/docs/scroll-margin
8421
8377
  */
8422
8378
  "scroll-mx": [{
8423
- "scroll-mx": [spacing]
8379
+ "scroll-mx": getSpacingWithArbitrary()
8424
8380
  }],
8425
8381
  /**
8426
8382
  * Scroll Margin Y
8427
8383
  * @see https://tailwindcss.com/docs/scroll-margin
8428
8384
  */
8429
8385
  "scroll-my": [{
8430
- "scroll-my": [spacing]
8386
+ "scroll-my": getSpacingWithArbitrary()
8431
8387
  }],
8432
8388
  /**
8433
8389
  * Scroll Margin Start
8434
8390
  * @see https://tailwindcss.com/docs/scroll-margin
8435
8391
  */
8436
8392
  "scroll-ms": [{
8437
- "scroll-ms": [spacing]
8393
+ "scroll-ms": getSpacingWithArbitrary()
8438
8394
  }],
8439
8395
  /**
8440
8396
  * Scroll Margin End
8441
8397
  * @see https://tailwindcss.com/docs/scroll-margin
8442
8398
  */
8443
8399
  "scroll-me": [{
8444
- "scroll-me": [spacing]
8400
+ "scroll-me": getSpacingWithArbitrary()
8445
8401
  }],
8446
8402
  /**
8447
8403
  * Scroll Margin Top
8448
8404
  * @see https://tailwindcss.com/docs/scroll-margin
8449
8405
  */
8450
8406
  "scroll-mt": [{
8451
- "scroll-mt": [spacing]
8407
+ "scroll-mt": getSpacingWithArbitrary()
8452
8408
  }],
8453
8409
  /**
8454
8410
  * Scroll Margin Right
8455
8411
  * @see https://tailwindcss.com/docs/scroll-margin
8456
8412
  */
8457
8413
  "scroll-mr": [{
8458
- "scroll-mr": [spacing]
8414
+ "scroll-mr": getSpacingWithArbitrary()
8459
8415
  }],
8460
8416
  /**
8461
8417
  * Scroll Margin Bottom
8462
8418
  * @see https://tailwindcss.com/docs/scroll-margin
8463
8419
  */
8464
8420
  "scroll-mb": [{
8465
- "scroll-mb": [spacing]
8421
+ "scroll-mb": getSpacingWithArbitrary()
8466
8422
  }],
8467
8423
  /**
8468
8424
  * Scroll Margin Left
8469
8425
  * @see https://tailwindcss.com/docs/scroll-margin
8470
8426
  */
8471
8427
  "scroll-ml": [{
8472
- "scroll-ml": [spacing]
8428
+ "scroll-ml": getSpacingWithArbitrary()
8473
8429
  }],
8474
8430
  /**
8475
8431
  * Scroll Padding
8476
8432
  * @see https://tailwindcss.com/docs/scroll-padding
8477
8433
  */
8478
8434
  "scroll-p": [{
8479
- "scroll-p": [spacing]
8435
+ "scroll-p": getSpacingWithArbitrary()
8480
8436
  }],
8481
8437
  /**
8482
8438
  * Scroll Padding X
8483
8439
  * @see https://tailwindcss.com/docs/scroll-padding
8484
8440
  */
8485
8441
  "scroll-px": [{
8486
- "scroll-px": [spacing]
8442
+ "scroll-px": getSpacingWithArbitrary()
8487
8443
  }],
8488
8444
  /**
8489
8445
  * Scroll Padding Y
8490
8446
  * @see https://tailwindcss.com/docs/scroll-padding
8491
8447
  */
8492
8448
  "scroll-py": [{
8493
- "scroll-py": [spacing]
8449
+ "scroll-py": getSpacingWithArbitrary()
8494
8450
  }],
8495
8451
  /**
8496
8452
  * Scroll Padding Start
8497
8453
  * @see https://tailwindcss.com/docs/scroll-padding
8498
8454
  */
8499
8455
  "scroll-ps": [{
8500
- "scroll-ps": [spacing]
8456
+ "scroll-ps": getSpacingWithArbitrary()
8501
8457
  }],
8502
8458
  /**
8503
8459
  * Scroll Padding End
8504
8460
  * @see https://tailwindcss.com/docs/scroll-padding
8505
8461
  */
8506
8462
  "scroll-pe": [{
8507
- "scroll-pe": [spacing]
8463
+ "scroll-pe": getSpacingWithArbitrary()
8508
8464
  }],
8509
8465
  /**
8510
8466
  * Scroll Padding Top
8511
8467
  * @see https://tailwindcss.com/docs/scroll-padding
8512
8468
  */
8513
8469
  "scroll-pt": [{
8514
- "scroll-pt": [spacing]
8470
+ "scroll-pt": getSpacingWithArbitrary()
8515
8471
  }],
8516
8472
  /**
8517
8473
  * Scroll Padding Right
8518
8474
  * @see https://tailwindcss.com/docs/scroll-padding
8519
8475
  */
8520
8476
  "scroll-pr": [{
8521
- "scroll-pr": [spacing]
8477
+ "scroll-pr": getSpacingWithArbitrary()
8522
8478
  }],
8523
8479
  /**
8524
8480
  * Scroll Padding Bottom
8525
8481
  * @see https://tailwindcss.com/docs/scroll-padding
8526
8482
  */
8527
8483
  "scroll-pb": [{
8528
- "scroll-pb": [spacing]
8484
+ "scroll-pb": getSpacingWithArbitrary()
8529
8485
  }],
8530
8486
  /**
8531
8487
  * Scroll Padding Left
8532
8488
  * @see https://tailwindcss.com/docs/scroll-padding
8533
8489
  */
8534
8490
  "scroll-pl": [{
8535
- "scroll-pl": [spacing]
8491
+ "scroll-pl": getSpacingWithArbitrary()
8536
8492
  }],
8537
8493
  /**
8538
8494
  * Scroll Snap Align
@@ -8792,47 +8748,43 @@ import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
8792
8748
  var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData, show_popup, popup }, ref) => {
8793
8749
  const mapContainer = ref;
8794
8750
  const mapRef = useRef12(null);
8795
- const map = mapRef.current;
8751
+ const [isMapReady, setIsMapReady] = useState17(false);
8752
+ const hasSatelliteLayer = baseLayers == null ? void 0 : baseLayers.find((layer) => layer.layer_type == "satellite");
8796
8753
  const changeMapProjection = () => {
8797
8754
  var _a;
8798
- if (!mapRef.current)
8799
- return;
8800
- const map2 = mapRef.current;
8801
- const currentProjection = (_a = map2.getProjection()) == null ? void 0 : _a.type;
8755
+ if (!mapRef.current) return;
8756
+ const map = mapRef.current;
8757
+ const currentProjection = (_a = map.getProjection()) == null ? void 0 : _a.type;
8802
8758
  const newProjection = currentProjection === "mercator" ? "globe" : "mercator";
8803
- map2.setProjection({
8759
+ map.setProjection({
8804
8760
  type: newProjection
8805
8761
  });
8806
8762
  };
8807
8763
  const zoomIn = () => {
8808
- if (!mapRef.current)
8809
- return;
8810
- const map2 = mapRef.current;
8811
- map2.zoomIn();
8812
- return map2.getBounds();
8764
+ if (!mapRef.current) return;
8765
+ const map = mapRef.current;
8766
+ map.zoomIn();
8767
+ return map.getBounds();
8813
8768
  };
8814
8769
  const zoomOut = () => {
8815
- if (!mapRef.current)
8816
- return;
8817
- const map2 = mapRef.current;
8818
- map2.zoomOut();
8819
- return map2.getBounds();
8770
+ if (!mapRef.current) return;
8771
+ const map = mapRef.current;
8772
+ map.zoomOut();
8773
+ return map.getBounds();
8820
8774
  };
8821
8775
  function getLayersByPattern(pattern) {
8822
- if (!mapRef.current)
8823
- return;
8824
- const map2 = mapRef.current;
8825
- return map2 == null ? void 0 : map2.getStyle().layers.filter((layer) => pattern.test(layer.id)).map((layer) => layer.id);
8776
+ if (!mapRef.current) return;
8777
+ const map = mapRef.current;
8778
+ return map == null ? void 0 : map.getStyle().layers.filter((layer) => pattern.test(layer.id)).map((layer) => layer.id);
8826
8779
  }
8827
8780
  const handleToggle = (layerId) => {
8828
- if (!mapRef.current)
8829
- return;
8830
- const map2 = mapRef.current;
8781
+ if (!mapRef.current) return;
8782
+ const map = mapRef.current;
8831
8783
  const layers = getLayersByPattern(new RegExp(layerId));
8832
8784
  layers == null ? void 0 : layers.forEach((id) => {
8833
- const visibility = map2 == null ? void 0 : map2.getLayoutProperty(id, "visibility");
8785
+ const visibility = map == null ? void 0 : map.getLayoutProperty(id, "visibility");
8834
8786
  const newVisibility = visibility === "none" ? "visible" : "none";
8835
- map2 == null ? void 0 : map2.setLayoutProperty(id, "visibility", newVisibility);
8787
+ map == null ? void 0 : map.setLayoutProperty(id, "visibility", newVisibility);
8836
8788
  });
8837
8789
  };
8838
8790
  const buildControls = (controls) => {
@@ -8954,7 +8906,7 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
8954
8906
  return control;
8955
8907
  }));
8956
8908
  };
8957
- const loadSvgImage = (color) => __async(void 0, null, function* () {
8909
+ const loadSvgImage = (color) => __async(null, null, function* () {
8958
8910
  let svgText = renderToStaticMarkup(
8959
8911
  /* @__PURE__ */ jsx48(MapPinIcon3, { className: "w-6 h-6" })
8960
8912
  );
@@ -8966,67 +8918,71 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
8966
8918
  yield img.decode();
8967
8919
  return img;
8968
8920
  });
8969
- const updatePinImage = (source) => __async(void 0, null, function* () {
8921
+ const updatePinImage = (source) => __async(null, null, function* () {
8922
+ const map = mapRef.current;
8923
+ if (!map) return;
8970
8924
  const img = yield loadSvgImage(source.style.pin_color);
8971
8925
  const imgName = `${source.name}-pin`;
8972
- if (map == null ? void 0 : map.hasImage(imgName))
8973
- map == null ? void 0 : map.removeImage(imgName);
8974
- map == null ? void 0 : map.addImage(imgName, img);
8926
+ if (map.hasImage(imgName)) map.removeImage(imgName);
8927
+ map.addImage(imgName, img);
8975
8928
  });
8976
8929
  const updateClusterColors = (source) => {
8930
+ const map = mapRef.current;
8931
+ if (!map) return;
8977
8932
  const layerId = `${source.name}-cluster-circles`;
8978
- if (!(map == null ? void 0 : map.getLayer(layerId)))
8979
- return;
8980
- const current = map == null ? void 0 : map.getPaintProperty(layerId, "circle-color");
8933
+ if (!map.getLayer(layerId)) return;
8934
+ const current = map.getPaintProperty(layerId, "circle-color");
8981
8935
  if (current !== source.style.cluster_color) {
8982
- map == null ? void 0 : map.setPaintProperty(layerId, "circle-color", source.style.cluster_color);
8983
- map == null ? void 0 : map.setPaintProperty(layerId, "circle-stroke-color", source.style.cluster_stroke_color);
8936
+ map.setPaintProperty(layerId, "circle-color", source.style.cluster_color);
8937
+ map.setPaintProperty(layerId, "circle-stroke-color", source.style.cluster_stroke_color);
8984
8938
  }
8985
8939
  };
8986
8940
  const loadBaseLayers = () => {
8987
- if (baseLayers && (baseLayers == null ? void 0 : baseLayers.length) > 0) {
8988
- const base_layers = buildBaseLayers(baseLayers);
8989
- base_layers == null ? void 0 : base_layers.forEach((layer) => {
8990
- if (!(map == null ? void 0 : map.getLayer(layer.name))) {
8991
- if (!(map == null ? void 0 : map.getSource(layer == null ? void 0 : layer.name))) {
8992
- if ((layer == null ? void 0 : layer.layer_type) == "satellite")
8993
- map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
8994
- type: layer == null ? void 0 : layer.type,
8995
- tiles: [layer == null ? void 0 : layer.url],
8996
- tileSize: layer == null ? void 0 : layer.tileSize
8997
- });
8998
- else
8999
- map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
9000
- type: layer == null ? void 0 : layer.type,
9001
- url: layer == null ? void 0 : layer.url,
9002
- tileSize: layer == null ? void 0 : layer.tileSize
9003
- });
9004
- if ((layer == null ? void 0 : layer.layer_type) == "terrainSource")
9005
- map == null ? void 0 : map.setTerrain({
9006
- source: "terrainSource",
9007
- exaggeration: 1
9008
- });
9009
- if ((layer == null ? void 0 : layer.layer_type) == "hillshade")
9010
- map == null ? void 0 : map.addLayer({
9011
- id: layer == null ? void 0 : layer.name,
9012
- type: layer == null ? void 0 : layer.layer_type,
9013
- source: layer == null ? void 0 : layer.name,
9014
- paint: { "hillshade-shadow-color": "#473B24" },
9015
- layout: { visibility: "visible" }
9016
- });
9017
- if ((layer == null ? void 0 : layer.layer_type) == "satellite")
9018
- map == null ? void 0 : map.addLayer({ id: layer == null ? void 0 : layer.name, type: layer == null ? void 0 : layer.type, source: layer == null ? void 0 : layer.name });
9019
- }
8941
+ const map = mapRef.current;
8942
+ if (!map || !baseLayers || baseLayers.length === 0) return;
8943
+ const base_layers = buildBaseLayers(baseLayers);
8944
+ base_layers == null ? void 0 : base_layers.forEach((layer) => {
8945
+ if (!map.getLayer(layer.name)) {
8946
+ if (!map.getSource(layer == null ? void 0 : layer.name)) {
8947
+ if ((layer == null ? void 0 : layer.layer_type) == "satellite") {
8948
+ map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
8949
+ type: layer == null ? void 0 : layer.type,
8950
+ tiles: [layer == null ? void 0 : layer.url],
8951
+ tileSize: layer == null ? void 0 : layer.tileSize
8952
+ });
8953
+ map == null ? void 0 : map.addLayer({ id: layer == null ? void 0 : layer.name, type: layer == null ? void 0 : layer.type, source: layer == null ? void 0 : layer.name });
8954
+ } else
8955
+ map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
8956
+ type: layer == null ? void 0 : layer.type,
8957
+ url: layer == null ? void 0 : layer.url,
8958
+ tileSize: layer == null ? void 0 : layer.tileSize
8959
+ });
8960
+ if ((layer == null ? void 0 : layer.layer_type) == "terrainSource")
8961
+ map == null ? void 0 : map.setTerrain({
8962
+ source: "terrainSource",
8963
+ exaggeration: 1
8964
+ });
8965
+ if ((layer == null ? void 0 : layer.layer_type) == "hillshade")
8966
+ map == null ? void 0 : map.addLayer({
8967
+ id: layer == null ? void 0 : layer.name,
8968
+ type: layer == null ? void 0 : layer.layer_type,
8969
+ source: layer == null ? void 0 : layer.name,
8970
+ paint: { "hillshade-shadow-color": "#473B24" },
8971
+ layout: { visibility: "visible" }
8972
+ });
9020
8973
  }
9021
- });
9022
- }
8974
+ }
8975
+ });
9023
8976
  };
9024
- const loadSourceData = () => {
9025
- sourceData == null ? void 0 : sourceData.forEach((source) => __async(void 0, null, function* () {
9026
- const existing_data = map == null ? void 0 : map.getSource(source.name);
8977
+ const loadSourceData = () => __async(null, null, function* () {
8978
+ var _a, _b, _c, _d;
8979
+ const map = mapRef.current;
8980
+ if (!map || (sourceData == null ? void 0 : sourceData.length) == 0) return;
8981
+ for (const source of sourceData) {
8982
+ const existing_data = map.getSource(source.name);
9027
8983
  if (!existing_data) {
9028
8984
  if (source.is_cluster) {
9029
- map == null ? void 0 : map.addSource(source.name, {
8985
+ map.addSource(source.name, {
9030
8986
  type: source.type,
9031
8987
  data: source.data,
9032
8988
  cluster: true,
@@ -9034,12 +8990,9 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9034
8990
  clusterRadius: 50
9035
8991
  });
9036
8992
  } else
9037
- map == null ? void 0 : map.addSource(source.name, {
8993
+ map.addSource(source.name, {
9038
8994
  type: source.type,
9039
8995
  data: source.data
9040
- // cluster: true,
9041
- // clusterMaxZoom: 10,
9042
- // clusterRadius: 50,
9043
8996
  });
9044
8997
  if (source.show_cluster_count) {
9045
8998
  map == null ? void 0 : map.addLayer({
@@ -9048,11 +9001,11 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9048
9001
  source: source.name,
9049
9002
  filter: ["has", "point_count"],
9050
9003
  paint: {
9051
- "circle-color": source.style.cluster_color,
9004
+ "circle-color": (_a = source.style) == null ? void 0 : _a.cluster_color,
9052
9005
  "circle-opacity": 1,
9053
9006
  "circle-radius": 20,
9054
9007
  "circle-stroke-width": 4,
9055
- "circle-stroke-color": source.style.cluster_stroke_color
9008
+ "circle-stroke-color": (_b = source.style) == null ? void 0 : _b.cluster_stroke_color
9056
9009
  }
9057
9010
  });
9058
9011
  map == null ? void 0 : map.addLayer({
@@ -9090,25 +9043,20 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9090
9043
  id: `${source.name}-cluster-circles`,
9091
9044
  type: "circle",
9092
9045
  source: source.name,
9093
- filter: [">", ["get", "count"], 1],
9046
+ filter: ["!=", ["get", "count"], null],
9094
9047
  paint: {
9095
- "circle-color": source.style.cluster_color,
9048
+ "circle-color": (_c = source.style) == null ? void 0 : _c.cluster_color,
9096
9049
  "circle-opacity": 1,
9097
9050
  "circle-radius": 20,
9098
9051
  "circle-stroke-width": 4,
9099
- "circle-stroke-color": source.style.cluster_stroke_color
9100
- // "circle-radius": [
9101
- // "step",
9102
- // ["get", "count"],
9103
- // 20, 100, 30, 750, 40
9104
- // ]
9052
+ "circle-stroke-color": (_d = source.style) == null ? void 0 : _d.cluster_stroke_color
9105
9053
  }
9106
9054
  });
9107
9055
  map == null ? void 0 : map.addLayer({
9108
9056
  id: `${source.name}-cluster-count`,
9109
9057
  type: "symbol",
9110
9058
  source: source.name,
9111
- filter: [">", ["get", "count"], 1],
9059
+ filter: ["!=", ["get", "count"], null],
9112
9060
  layout: {
9113
9061
  "text-field": "{count}",
9114
9062
  "text-font": ["Open Sans Bold"],
@@ -9126,7 +9074,6 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9126
9074
  id: source.name + "-pins",
9127
9075
  type: "symbol",
9128
9076
  source: source.name,
9129
- //filter: ["!", ["has", "point_count"]],
9130
9077
  filter: ["==", ["get", "count"], null],
9131
9078
  layout: {
9132
9079
  "icon-image": `${source.name}-pin`,
@@ -9141,16 +9088,12 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9141
9088
  updateClusterColors(source);
9142
9089
  updatePinImage(source);
9143
9090
  }
9144
- }));
9145
- };
9091
+ }
9092
+ });
9146
9093
  useEffect21(() => {
9147
- if (typeof mapContainer === "function")
9148
- return;
9149
- if (!(mapContainer == null ? void 0 : mapContainer.current))
9150
- return;
9151
- if (!sourceData)
9152
- return;
9153
- const map2 = new maplibregl.Map({
9094
+ if (typeof mapContainer === "function") return;
9095
+ if (!(mapContainer == null ? void 0 : mapContainer.current)) return;
9096
+ const map = new maplibregl.Map({
9154
9097
  container: mapContainer == null ? void 0 : mapContainer.current,
9155
9098
  style: {
9156
9099
  version: 8,
@@ -9178,21 +9121,22 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9178
9121
  renderWorldCopies: false,
9179
9122
  canvasContextAttributes: { antialias: true }
9180
9123
  });
9181
- mapRef.current = map2;
9182
- map2.scrollZoom.disable();
9183
- mapRef.current.getContainer().addEventListener("mouseenter", () => map2.scrollZoom.enable());
9184
- mapRef.current.getContainer().addEventListener("mouseleave", () => map2.scrollZoom.disable());
9185
- map2.on("load", () => __async(void 0, null, function* () {
9124
+ mapRef.current = map;
9125
+ map.scrollZoom.disable();
9126
+ mapRef.current.getContainer().addEventListener("mouseenter", () => map.scrollZoom.enable());
9127
+ mapRef.current.getContainer().addEventListener("mouseleave", () => map.scrollZoom.disable());
9128
+ map.on("load", () => __async(null, null, function* () {
9186
9129
  changeMapProjection();
9130
+ setIsMapReady(true);
9187
9131
  }));
9188
9132
  return () => {
9189
- map2.remove();
9133
+ map.remove();
9190
9134
  mapRef.current = null;
9191
9135
  };
9192
9136
  }, []);
9193
9137
  useEffect21(() => {
9194
- if (!map)
9195
- return;
9138
+ const map = mapRef.current;
9139
+ if (!map || !isMapReady) return;
9196
9140
  const init = () => {
9197
9141
  loadBaseLayers();
9198
9142
  };
@@ -9207,34 +9151,52 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9207
9151
  if (map.isStyleLoaded()) {
9208
9152
  init();
9209
9153
  map.on("zoomend", zoom);
9210
- } else
9211
- map.once("load", () => {
9212
- init();
9213
- map.on("zoomend", zoom);
9214
- });
9215
- }, [map]);
9154
+ map.on("moveend", zoom);
9155
+ } else map.once("load", () => {
9156
+ init();
9157
+ map.on("zoomend", zoom);
9158
+ map.on("moveend", zoom);
9159
+ });
9160
+ return () => {
9161
+ map.off("zoomend", zoom);
9162
+ map.off("moveend", zoom);
9163
+ };
9164
+ }, [mapControls, baseLayers, isMapReady]);
9216
9165
  useEffect21(() => {
9217
- var _a, _b, _c;
9218
- if (!map || !sourceData)
9219
- return;
9220
- if (map.isStyleLoaded()) {
9166
+ var _a;
9167
+ const map = mapRef.current;
9168
+ if (!map || !(sourceData == null ? void 0 : sourceData.length)) return;
9169
+ const satelliteLayerLoaded = hasSatelliteLayer !== void 0 ? map.getLayer("satellite") !== void 0 ? true : false : true;
9170
+ map.on("sourcedata", function onData(e) {
9171
+ if (e.sourceId === "satellite" && e.isSourceLoaded) {
9172
+ map.off("sourcedata", onData);
9173
+ loadSourceData();
9174
+ }
9175
+ });
9176
+ if (map.isStyleLoaded() && satelliteLayerLoaded) {
9221
9177
  loadSourceData();
9222
- return;
9178
+ } else {
9179
+ const handler = () => {
9180
+ if (satelliteLayerLoaded) loadSourceData();
9181
+ };
9182
+ map.once("load", handler);
9183
+ return () => {
9184
+ map.off("load", handler);
9185
+ };
9223
9186
  }
9224
- const handler = () => loadSourceData();
9225
- map.once("load", handler);
9226
9187
  if (show_popup && customLayers) {
9227
- map.on("mouseenter", ((_a = customLayers[0]) == null ? void 0 : _a.layerName) + "-pins", () => {
9188
+ const layerId = ((_a = customLayers[0]) == null ? void 0 : _a.layerName) + "-pins";
9189
+ const onMouseEnter = () => {
9228
9190
  map.getCanvas().style.cursor = "pointer";
9229
- });
9230
- map.on("mouseleave", ((_b = customLayers[0]) == null ? void 0 : _b.layerName) + "-pins", () => {
9191
+ };
9192
+ const onMouseLeave = () => {
9231
9193
  map.getCanvas().style.cursor = "";
9232
- });
9233
- map.on("click", ((_c = customLayers[0]) == null ? void 0 : _c.layerName) + "-pins", (e) => {
9234
- var _a2, _b2, _c2, _d;
9194
+ };
9195
+ const onLayerClick = (e) => {
9196
+ var _a2, _b, _c, _d;
9235
9197
  if (e.features) {
9236
9198
  const properties = (_a2 = e.features[0]) == null ? void 0 : _a2.properties;
9237
- const coordinates = (_c2 = (_b2 = e.features[0]) == null ? void 0 : _b2.geometry) == null ? void 0 : _c2.coordinates.slice();
9199
+ const coordinates = (_c = (_b = e.features[0]) == null ? void 0 : _b.geometry) == null ? void 0 : _c.coordinates.slice();
9238
9200
  const description = `
9239
9201
  <a class="popup-link text-primary text-xs hover:cursor-pointer">${(_d = e.features[0]) == null ? void 0 : _d.properties.description}</a>
9240
9202
  `;
@@ -9249,34 +9211,37 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData,
9249
9211
  }
9250
9212
  }, 0);
9251
9213
  }
9252
- });
9214
+ };
9215
+ map.on("mouseenter", layerId, onMouseEnter);
9216
+ map.on("mouseleave", layerId, onMouseLeave);
9217
+ map.on("click", layerId, onLayerClick);
9218
+ return () => {
9219
+ map.off("mouseenter", layerId, onMouseEnter);
9220
+ map.off("mouseleave", layerId, onMouseLeave);
9221
+ map.off("click", layerId, onLayerClick);
9222
+ };
9253
9223
  }
9254
- return () => {
9255
- map.off("load", handler);
9256
- };
9257
- }, [sourceData]);
9224
+ }, [sourceData, customLayers, show_popup, popup, isMapReady]);
9258
9225
  useEffect21(() => {
9259
- if (!map || !sourceData)
9260
- return;
9226
+ const map = mapRef.current;
9227
+ if (!map || !(sourceData == null ? void 0 : sourceData.length)) return;
9261
9228
  sourceData.forEach((source) => {
9262
9229
  const source_layer = map.getSource(source.name);
9263
- if (source_layer)
9264
- source_layer.setData(source.data);
9230
+ if (source_layer) source_layer.setData(source.data);
9265
9231
  });
9266
9232
  }, [sourceData]);
9267
- if (!sourceData)
9268
- return;
9269
9233
  return /* @__PURE__ */ jsxs35("div", { className: "relative", style: { width: "100%", height: "100%" }, children: [
9270
9234
  /* @__PURE__ */ jsx48("div", { ref: mapContainer, className: "w-full h-full" }),
9271
9235
  /* @__PURE__ */ jsx48(MapControlToolbar, { controls: mapControl, onToggleControl: (id) => toggleControl(id) })
9272
9236
  ] });
9273
9237
  });
9238
+ MapLibre.displayName = "MapLibre";
9274
9239
 
9275
9240
  // src/features/components/GeoWikiMapContainer.tsx
9276
9241
  import { Suspense, lazy, useEffect as useEffect22, useState as useState18 } from "react";
9277
9242
  import { jsx as jsx49 } from "react/jsx-runtime";
9278
9243
  var MapComponent = lazy(
9279
- () => import("./GeoWikiMap-G2JPQNTZ.mjs").then((m) => ({ default: m.GeoWikiMap }))
9244
+ () => import("./GeoWikiMap-OMS4RQ6H.mjs").then((m) => ({ default: m.GeoWikiMap }))
9280
9245
  );
9281
9246
  var ClientOnlyMap = ({ children }) => {
9282
9247
  const [isClient, setIsClient] = useState18(false);