@biodiv-platform/naksha-maplibre-layers 5.0.9 → 5.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -2301
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -2285
- package/locales/en.json +1 -0
- package/locales/fr.json +1 -0
- package/locales/hi.json +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2301 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.tsx
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
NakshaMaplibreLayers: () => NakshaMaplibreLayers
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
var import_naksha_commons14 = require("@biodiv-platform/naksha-commons");
|
|
37
|
-
var import_react14 = __toESM(require("react"), 1);
|
|
38
|
-
var import_maplibre10 = require("react-map-gl/maplibre");
|
|
39
|
-
var import_twind21 = require("twind");
|
|
40
|
-
|
|
41
|
-
// locales/en.json
|
|
42
|
-
var en_default = {
|
|
43
|
-
are_you_sure: "Are you sure?",
|
|
44
|
-
base_style: "Base Style",
|
|
45
|
-
clear: "Clear Selection",
|
|
46
|
-
created_by: "Attribution",
|
|
47
|
-
created_on: "Created On",
|
|
48
|
-
delete: "Delete",
|
|
49
|
-
download: "Download",
|
|
50
|
-
find_layer_by_name: "Find layer by name",
|
|
51
|
-
infobar: "Attributes at Clicked Location",
|
|
52
|
-
information: "Information",
|
|
53
|
-
layer_selection: "Layer Selection",
|
|
54
|
-
layer_selection_all: "All Layers",
|
|
55
|
-
layer_selection_top: "Top Layer Only",
|
|
56
|
-
layers: "Layers",
|
|
57
|
-
legend: "Legend",
|
|
58
|
-
less: "Less",
|
|
59
|
-
license: "License",
|
|
60
|
-
list_layers: "List Layers",
|
|
61
|
-
pending: "Pending",
|
|
62
|
-
publish: "Publish",
|
|
63
|
-
raster_style_not_found: "Style not available for the given layer",
|
|
64
|
-
remove: "Remove",
|
|
65
|
-
selected: "Selected",
|
|
66
|
-
settings: "Settings",
|
|
67
|
-
square: "Square",
|
|
68
|
-
tags: "Tags",
|
|
69
|
-
toggle: "Toggle Publishing",
|
|
70
|
-
uploaded: "Uploaded",
|
|
71
|
-
uploader: "Uploader",
|
|
72
|
-
url: "URL",
|
|
73
|
-
visiblity: "Visiblity"
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// locales/fr.json
|
|
77
|
-
var fr_default = {
|
|
78
|
-
are_you_sure: "\xCAtes-vous s\xFBr?",
|
|
79
|
-
base_style: "Style de base",
|
|
80
|
-
clear: "Effacer la s\xE9lection",
|
|
81
|
-
created_by: "Attribution",
|
|
82
|
-
created_on: "Cr\xE9\xE9 sur",
|
|
83
|
-
delete: "Effacer",
|
|
84
|
-
download: "T\xE9l\xE9charger",
|
|
85
|
-
find_layer_by_name: "Trouver la couche par nom",
|
|
86
|
-
infobar: "Attributs \xE0 l'emplacement cliqu\xE9",
|
|
87
|
-
information: "Informations",
|
|
88
|
-
layer_selection_all: "Toutes les couches",
|
|
89
|
-
layer_selection_top: "Couche sup\xE9rieure uniquement",
|
|
90
|
-
layer_selection: "S\xE9lection de calque",
|
|
91
|
-
layers: "Couches",
|
|
92
|
-
legend: "L\xE9gende",
|
|
93
|
-
less: "Moins",
|
|
94
|
-
license: "Licence",
|
|
95
|
-
list_layers: "Liste des couches",
|
|
96
|
-
pending: "En attente",
|
|
97
|
-
publish: "Publier",
|
|
98
|
-
remove: "Supprimer",
|
|
99
|
-
selected: "Choisie",
|
|
100
|
-
settings: "Param\xE8tres",
|
|
101
|
-
square: "Carr\xE9",
|
|
102
|
-
toggle: "Basculer la publication",
|
|
103
|
-
uploaded: "T\xE9l\xE9charg\xE9",
|
|
104
|
-
url: "url"
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// locales/hi.json
|
|
108
|
-
var hi_default = {
|
|
109
|
-
are_you_sure: "\u0915\u094D\u092F\u093E \u0906\u092A\u0915\u094B \u092F\u0915\u0940\u0928 \u0939\u0948?",
|
|
110
|
-
base_style: "\u0906\u0927\u093E\u0930 \u0936\u0948\u0932\u0940",
|
|
111
|
-
clear: "\u091A\u092F\u0928 \u0938\u093E\u092B\u093C \u0915\u0930\u0947\u0902",
|
|
112
|
-
created_by: "\u0906\u0930\u094B\u092A\u0923",
|
|
113
|
-
created_on: "\u092A\u0930 \u092C\u0928\u093E\u092F\u093E",
|
|
114
|
-
delete: "\u0939\u091F\u093E\u090F\u0902",
|
|
115
|
-
download: "\u0921\u093E\u0909\u0928\u0932\u094B\u0921",
|
|
116
|
-
find_layer_by_name: "\u0928\u093E\u092E \u0938\u0947 \u092A\u0930\u0924 \u0916\u094B\u091C\u0947\u0902",
|
|
117
|
-
infobar: "\u0915\u094D\u0932\u093F\u0915 \u0915\u093F\u090F \u0917\u090F \u0938\u094D\u0925\u093E\u0928 \u092A\u0930 \u0935\u093F\u0936\u0947\u0937\u0924\u093E\u090F\u0902",
|
|
118
|
-
information: "\u091C\u093E\u0928\u0915\u093E\u0930\u0940",
|
|
119
|
-
layer_selection_all: "\u0938\u092D\u0940 \u092A\u0930\u0924\u0947\u0902",
|
|
120
|
-
layer_selection_top: "\u0915\u0947\u0935\u0932 \u0936\u0940\u0930\u094D\u0937 \u092A\u0930\u0924",
|
|
121
|
-
layer_selection: "\u092A\u0930\u0924 \u091A\u092F\u0928",
|
|
122
|
-
layers: "\u092A\u0930\u0924\u0947\u0902",
|
|
123
|
-
legend: "\u0915\u093F\u0902\u0935\u0926\u0902\u0924\u0940",
|
|
124
|
-
less: "\u0915\u092E",
|
|
125
|
-
license: "\u0932\u093E\u0907\u0938\u0947\u0902\u0938",
|
|
126
|
-
list_layers: "\u0938\u0942\u091A\u0940 \u092A\u0930\u0924\u0947\u0902",
|
|
127
|
-
pending: "\u0932\u0902\u092C\u093F\u0924",
|
|
128
|
-
publish: "\u092A\u094D\u0930\u0915\u093E\u0936\u093F\u0924",
|
|
129
|
-
remove: "\u0939\u091F\u093E\u0928\u093E",
|
|
130
|
-
selected: "\u091A\u092F\u0928\u093F\u0924",
|
|
131
|
-
settings: "\u0938\u092E\u093E\u092F\u094B\u091C\u0928",
|
|
132
|
-
square: "\u0938\u094D\u0915\u094D\u0935\u093E\u092F\u0930",
|
|
133
|
-
tags: "\u091F\u0948\u0917",
|
|
134
|
-
toggle: "\u092A\u094D\u0930\u0915\u093E\u0936\u0928 \u091F\u0949\u0917\u0932 \u0915\u0930\u0947\u0902",
|
|
135
|
-
uploaded: "\u0905\u092A\u0932\u094B\u0921 \u0915\u093F\u092F\u093E \u0917\u092F\u093E",
|
|
136
|
-
url: "\u092F\u0942\u0906\u0930\u090F\u0932"
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// locales/index.ts
|
|
140
|
-
var locales_default = { en: en_default, fr: fr_default, hi: hi_default };
|
|
141
|
-
|
|
142
|
-
// src/components/map/index.tsx
|
|
143
|
-
var import_naksha_commons13 = require("@biodiv-platform/naksha-commons");
|
|
144
|
-
var import_react13 = require("react");
|
|
145
|
-
var import_maplibre9 = __toESM(require("react-map-gl/maplibre"), 1);
|
|
146
|
-
var import_twind20 = require("twind");
|
|
147
|
-
|
|
148
|
-
// src/hooks/use-layers.tsx
|
|
149
|
-
var import_naksha_commons2 = require("@biodiv-platform/naksha-commons");
|
|
150
|
-
var import_react = __toESM(require("react"), 1);
|
|
151
|
-
var import_maplibre = require("react-map-gl/maplibre");
|
|
152
|
-
|
|
153
|
-
// src/services/naksha.ts
|
|
154
|
-
var import_colorbrewer = __toESM(require("colorbrewer"), 1);
|
|
155
|
-
var import_redaxios = __toESM(require("redaxios"), 1);
|
|
156
|
-
|
|
157
|
-
// src/utils/grid.ts
|
|
158
|
-
var import_boundingbox = __toESM(require("boundingbox"), 1);
|
|
159
|
-
var import_geohash = require("geohash");
|
|
160
|
-
|
|
161
|
-
// src/static/constants.tsx
|
|
162
|
-
var import_naksha_commons = require("@biodiv-platform/naksha-commons");
|
|
163
|
-
var defaultNakshaProps = {
|
|
164
|
-
defaultViewState: import_naksha_commons.defaultViewState,
|
|
165
|
-
nakshaApiEndpoint: "/naksha-api/api",
|
|
166
|
-
geoserver: { endpoint: "/geoserver", workspace: "biodiv", store: "ibp" },
|
|
167
|
-
mapStyle: import_naksha_commons.MapStyles.MAP_STREETS,
|
|
168
|
-
layers: [],
|
|
169
|
-
selectedLayers: []
|
|
170
|
-
};
|
|
171
|
-
var FALLBACK_THUMB = "data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cpath fill='%23fff' d='M0 0h72v72H0z'/%3E%3Cpath d='M35.981 48.293l-13.853-10.77-3.045 2.368L36 53.048l16.917-13.157-3.064-2.387-13.872 10.789zM36 43.519l13.834-10.77 3.083-2.388L36 17.204 19.083 30.36l3.064 2.387L36 43.518z' fill='%23A0AEC0'/%3E%3C/svg%3E";
|
|
172
|
-
var overflowStyle = {
|
|
173
|
-
display: "-webkit-box",
|
|
174
|
-
WebkitLineClamp: 1,
|
|
175
|
-
WebkitBoxOrient: "vertical",
|
|
176
|
-
overflow: "hidden",
|
|
177
|
-
wordBreak: "break-word"
|
|
178
|
-
};
|
|
179
|
-
var overflowStyle2 = {
|
|
180
|
-
...overflowStyle,
|
|
181
|
-
WebkitLineClamp: 2
|
|
182
|
-
};
|
|
183
|
-
var PROPERTY_ID = "ogc_fid";
|
|
184
|
-
var LAYER_STATUS = {
|
|
185
|
-
ACTIVE: "Active",
|
|
186
|
-
PENDING: "Pending"
|
|
187
|
-
};
|
|
188
|
-
var SELECTION_STYLE = {
|
|
189
|
-
TOP: "layer_selection_top",
|
|
190
|
-
ALL: "layer_selection_all"
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// src/utils/grid.ts
|
|
194
|
-
var getZoomConfig = (zoom) => {
|
|
195
|
-
if (zoom < 6) return [4, 1, 39.2];
|
|
196
|
-
else if (zoom < 7) return [5, 0, 19.6];
|
|
197
|
-
else if (zoom < 8) return [5, 1, 9.8];
|
|
198
|
-
else if (zoom < 9) return [5, -1, 4.9];
|
|
199
|
-
else if (zoom < 10) return [6, 0, 2.45];
|
|
200
|
-
else if (zoom < 11) return [6, 1, 1.225];
|
|
201
|
-
else if (zoom < 12) return [7, 0, 0.612];
|
|
202
|
-
else if (zoom < 13) return [7, 1, 0.306];
|
|
203
|
-
else if (zoom < 14) return [7, -1, 0.153];
|
|
204
|
-
else if (zoom < 15) return [8, 0, 0.077];
|
|
205
|
-
return [8, 1, 0.039];
|
|
206
|
-
};
|
|
207
|
-
var BASE32 = "0123456789bcdefghjkmnpqrstuvwxyz";
|
|
208
|
-
var aggregateGeohashKey = (key, level, binSize) => {
|
|
209
|
-
binSize = binSize || 16 / 2 ** (1 - key.length & 1) / 4 ** level;
|
|
210
|
-
const keyExceptLast = key.slice(0, -1);
|
|
211
|
-
const binnedCharAt = ~~(BASE32.indexOf(key.slice(-1)) / binSize);
|
|
212
|
-
return [
|
|
213
|
-
keyExceptLast + BASE32[binSize * binnedCharAt],
|
|
214
|
-
keyExceptLast + BASE32[binSize * (binnedCharAt + 1) - 1]
|
|
215
|
-
];
|
|
216
|
-
};
|
|
217
|
-
var processRectangles = function(data, level) {
|
|
218
|
-
var counts = /* @__PURE__ */ new Map();
|
|
219
|
-
var bins = /* @__PURE__ */ new Map();
|
|
220
|
-
const features = [];
|
|
221
|
-
for (const [hash, count] of Object.entries(data)) {
|
|
222
|
-
const [kStart, kEnd] = aggregateGeohashKey(hash, level);
|
|
223
|
-
bins.set(kStart, kEnd);
|
|
224
|
-
if (!counts.has(kStart)) {
|
|
225
|
-
counts.set(kStart, 0);
|
|
226
|
-
}
|
|
227
|
-
counts.set(kStart, counts.get(kStart) + count);
|
|
228
|
-
}
|
|
229
|
-
counts.forEach((count, hash) => {
|
|
230
|
-
const bboxStart = import_geohash.GeoHash.decodeGeoHash(hash);
|
|
231
|
-
const bboxEnd = import_geohash.GeoHash.decodeGeoHash(bins.get(hash));
|
|
232
|
-
const feature = new import_boundingbox.default({
|
|
233
|
-
minlat: bboxStart.latitude[0],
|
|
234
|
-
minlon: bboxStart.longitude[0],
|
|
235
|
-
maxlat: bboxEnd.latitude[1],
|
|
236
|
-
maxlon: bboxEnd.longitude[1]
|
|
237
|
-
}).toGeoJSON();
|
|
238
|
-
features.push({ ...feature, properties: { count, [PROPERTY_ID]: hash } });
|
|
239
|
-
});
|
|
240
|
-
return features;
|
|
241
|
-
};
|
|
242
|
-
var processSquares = (data) => {
|
|
243
|
-
const features = [];
|
|
244
|
-
for (const [hash, count] of Object.entries(data)) {
|
|
245
|
-
const bbox2 = import_geohash.GeoHash.decodeGeoHash(hash);
|
|
246
|
-
const feature = new import_boundingbox.default({
|
|
247
|
-
minlat: bbox2.latitude[0],
|
|
248
|
-
minlon: bbox2.longitude[0],
|
|
249
|
-
maxlat: bbox2.latitude[1],
|
|
250
|
-
maxlon: bbox2.longitude[1]
|
|
251
|
-
}).toGeoJSON();
|
|
252
|
-
features.push({ ...feature, properties: { count, [PROPERTY_ID]: hash } });
|
|
253
|
-
}
|
|
254
|
-
return features;
|
|
255
|
-
};
|
|
256
|
-
var geohashToJSON = (data, level) => ({
|
|
257
|
-
type: "FeatureCollection",
|
|
258
|
-
features: Object.keys(data).length === 0 ? [] : level === -1 ? processSquares(data) : processRectangles(data, level)
|
|
259
|
-
});
|
|
260
|
-
var getDataBins = (data, binCount) => {
|
|
261
|
-
const sortedData = Object.values(data).sort((a, b) => a - b);
|
|
262
|
-
const cutoff = Math.floor(sortedData.length / binCount);
|
|
263
|
-
const tBins = new Array(binCount - 1).fill(0).map((_, index) => sortedData[cutoff * (index + 1)]);
|
|
264
|
-
tBins.push(sortedData[sortedData.length - 1]);
|
|
265
|
-
return tBins;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// src/utils/naksha.ts
|
|
269
|
-
var import_immer = require("immer");
|
|
270
|
-
var parseGeoserverLayersXml = async (layers, nakshaApiEndpoint, geoserver, selectedLayers) => {
|
|
271
|
-
const parsedLayers = [];
|
|
272
|
-
for (const l of layers) {
|
|
273
|
-
const isAdded = selectedLayers.includes(l.name);
|
|
274
|
-
const _l = {
|
|
275
|
-
...l,
|
|
276
|
-
id: l.name,
|
|
277
|
-
thumbnail: nakshaApiEndpoint + l.thumbnail,
|
|
278
|
-
source: {
|
|
279
|
-
type: l.layerType.toLowerCase() === "raster" ? "raster" : "vector",
|
|
280
|
-
scheme: "tms",
|
|
281
|
-
tiles: [
|
|
282
|
-
`${geoserver.endpoint}/gwc/service/tms/1.0.0/${geoserver.workspace}:${l.name}@EPSG%3A900913@pbf/{z}/{x}/{y}.pbf`
|
|
283
|
-
]
|
|
284
|
-
},
|
|
285
|
-
data: { styles: [] },
|
|
286
|
-
isAdded
|
|
287
|
-
};
|
|
288
|
-
if (isAdded) {
|
|
289
|
-
const _ld = await getLayerStyle(_l, 0, nakshaApiEndpoint, geoserver);
|
|
290
|
-
parsedLayers.push({ ..._l, data: _ld });
|
|
291
|
-
} else {
|
|
292
|
-
parsedLayers.push(_l);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return parsedLayers;
|
|
296
|
-
};
|
|
297
|
-
var getLayerStyle = async (layer, styleIndex, nakshaApiEndpoint, geoserver) => {
|
|
298
|
-
const nextSl = (0, import_immer.produce)(layer.data, async (_draft) => {
|
|
299
|
-
if (_draft.styles.length === 0) {
|
|
300
|
-
const { success, data } = await axGetGeoserverLayerStyleList(
|
|
301
|
-
layer.id,
|
|
302
|
-
nakshaApiEndpoint
|
|
303
|
-
);
|
|
304
|
-
if (success) {
|
|
305
|
-
_draft.layerName = data.layerName;
|
|
306
|
-
_draft.styles = data.styles;
|
|
307
|
-
_draft.summaryColumn = data.summaryColumn;
|
|
308
|
-
_draft.titleColumn = data.titleColumn;
|
|
309
|
-
_draft.propertyMap = Object.fromEntries(
|
|
310
|
-
data.styles.map((o) => [o.styleName, o.styleTitle])
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
if (_draft.styles[styleIndex] && !_draft.styles[styleIndex]?.colors) {
|
|
315
|
-
_draft.styles[styleIndex].colors = await axGetGeoserverLayerStyle(
|
|
316
|
-
layer.id,
|
|
317
|
-
geoserver?.workspace,
|
|
318
|
-
_draft.styles[styleIndex].styleName,
|
|
319
|
-
nakshaApiEndpoint
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
_draft.styleIndex = styleIndex;
|
|
323
|
-
});
|
|
324
|
-
return nextSl;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// src/services/naksha.ts
|
|
328
|
-
var axGetGeoserverLayers = async (nakshaEndpointToken, nakshaApiEndpoint, geoserver, selectedLayers) => {
|
|
329
|
-
try {
|
|
330
|
-
const res = await import_redaxios.default.get(`${nakshaApiEndpoint}/layer/all`, {
|
|
331
|
-
headers: { Authorization: nakshaEndpointToken }
|
|
332
|
-
});
|
|
333
|
-
const finalLayers = await parseGeoserverLayersXml(
|
|
334
|
-
res.data,
|
|
335
|
-
nakshaApiEndpoint,
|
|
336
|
-
geoserver,
|
|
337
|
-
selectedLayers
|
|
338
|
-
);
|
|
339
|
-
return finalLayers;
|
|
340
|
-
} catch (e) {
|
|
341
|
-
console.error(e);
|
|
342
|
-
return [];
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
var axGetGeoserverLayerStyleList = async (id, endpoint) => {
|
|
346
|
-
try {
|
|
347
|
-
const { data } = await import_redaxios.default.get(`${endpoint}/layer/onClick/${id}`);
|
|
348
|
-
return { success: true, data };
|
|
349
|
-
} catch (e) {
|
|
350
|
-
console.error(e);
|
|
351
|
-
return { success: false };
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
var axGexGetRasterInfoWithLonLat = async (endpoint, workspace, params) => {
|
|
355
|
-
const RasterInfoParams = {
|
|
356
|
-
service: "WMS",
|
|
357
|
-
version: "1.1.1",
|
|
358
|
-
request: "GetFeatureInfo",
|
|
359
|
-
info_format: "application/json",
|
|
360
|
-
width: 100,
|
|
361
|
-
height: 100,
|
|
362
|
-
x: 50,
|
|
363
|
-
y: 50,
|
|
364
|
-
srs: "EPSG:4326"
|
|
365
|
-
};
|
|
366
|
-
try {
|
|
367
|
-
const res = await import_redaxios.default.get(`${endpoint}/${workspace}/wms`, {
|
|
368
|
-
params: { ...params, ...RasterInfoParams }
|
|
369
|
-
});
|
|
370
|
-
return { success: true, data: res.data };
|
|
371
|
-
} catch (e) {
|
|
372
|
-
console.error(e);
|
|
373
|
-
return { success: false, data: [] };
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
var axToggleLayerPublishing = async (nakshaEndpointToken, nakshaApiEndpoint, layerId, isActive) => {
|
|
377
|
-
try {
|
|
378
|
-
await import_redaxios.default.put(
|
|
379
|
-
`${nakshaApiEndpoint}/layer/${isActive ? "active" : "pending"}/${layerId}`,
|
|
380
|
-
{},
|
|
381
|
-
{ headers: { Authorization: nakshaEndpointToken } }
|
|
382
|
-
);
|
|
383
|
-
return true;
|
|
384
|
-
} catch (e) {
|
|
385
|
-
console.error(e);
|
|
386
|
-
return false;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
var axDeleteLayer = async (nakshaEndpointToken, nakshaApiEndpoint, layerId) => {
|
|
390
|
-
try {
|
|
391
|
-
await import_redaxios.default.delete(`${nakshaApiEndpoint}/layer/${layerId}`, {
|
|
392
|
-
headers: { Authorization: nakshaEndpointToken }
|
|
393
|
-
});
|
|
394
|
-
return true;
|
|
395
|
-
} catch (e) {
|
|
396
|
-
console.error(e);
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
var axGetGeoserverLayerStyle = async (layername, workspace, styleName, endpoint) => {
|
|
401
|
-
try {
|
|
402
|
-
const res = await import_redaxios.default.get(
|
|
403
|
-
`${endpoint}/geoserver/workspaces/${workspace}/styles/${layername}_${styleName}.mbstyle`
|
|
404
|
-
);
|
|
405
|
-
return res.data?.layers?.[0];
|
|
406
|
-
} catch (e) {
|
|
407
|
-
console.error(e);
|
|
408
|
-
return {};
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
var getGridLayerData = async (fetcher, bounds, zoom, binCount = 6, colorScheme = "YlOrRd") => {
|
|
412
|
-
try {
|
|
413
|
-
const [geoAggegationPrecision, level, squareSize] = getZoomConfig(zoom);
|
|
414
|
-
const { _ne, _sw } = bounds;
|
|
415
|
-
const params = {
|
|
416
|
-
top: _ne.lat,
|
|
417
|
-
left: _sw.lng,
|
|
418
|
-
bottom: _sw.lat,
|
|
419
|
-
right: _ne.lng,
|
|
420
|
-
geoAggegationPrecision
|
|
421
|
-
};
|
|
422
|
-
const data = await fetcher(params);
|
|
423
|
-
const geojson = geohashToJSON(data, level);
|
|
424
|
-
const bins = getDataBins(data, binCount);
|
|
425
|
-
const stops = bins.map((bin, index) => [
|
|
426
|
-
bin,
|
|
427
|
-
import_colorbrewer.default[colorScheme][binCount][index]
|
|
428
|
-
]);
|
|
429
|
-
const paint2 = {
|
|
430
|
-
"fill-color": {
|
|
431
|
-
property: "count",
|
|
432
|
-
default: "yellow",
|
|
433
|
-
stops
|
|
434
|
-
},
|
|
435
|
-
"fill-outline-color": "rgba(0,0,0,0.2)",
|
|
436
|
-
"fill-opacity": 0.7
|
|
437
|
-
};
|
|
438
|
-
return { success: true, geojson, paint: paint2, stops, squareSize };
|
|
439
|
-
} catch (e) {
|
|
440
|
-
console.error(e);
|
|
441
|
-
return { success: false, geojson: {}, paint: {}, stops: [], squareSize: 0 };
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
var axDownloadLayer = async (endpoint, token, layerName, layerTitle) => {
|
|
445
|
-
try {
|
|
446
|
-
await import_redaxios.default.post(
|
|
447
|
-
`${endpoint}/layer/download`,
|
|
448
|
-
{ layerName, layerTitle, attributeList: [], filterArray: [] },
|
|
449
|
-
{ headers: { Authorization: token } }
|
|
450
|
-
);
|
|
451
|
-
} catch (e) {
|
|
452
|
-
console.error(e);
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
// src/hooks/use-layers.tsx
|
|
457
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
458
|
-
var LayersContext = (0, import_react.createContext)(
|
|
459
|
-
{}
|
|
460
|
-
);
|
|
461
|
-
var LayersProvider = ({ mp: _mp, children }) => {
|
|
462
|
-
const [mp, setMP] = (0, import_react.useState)(_mp);
|
|
463
|
-
const { mapl } = (0, import_maplibre.useMap)();
|
|
464
|
-
const [queryTerm, setQueryTerm] = (0, import_react.useState)("");
|
|
465
|
-
const queryTermDebounced = (0, import_naksha_commons2.useDebounce)(queryTerm, 500);
|
|
466
|
-
const styles = mp.mapStyles && mp.mapStyles.length > 0 ? mp.mapStyles : import_naksha_commons2.defaultMapStyles;
|
|
467
|
-
const [mapStyle, setMapStyle] = (0, import_react.useState)(
|
|
468
|
-
styles[mp?.mapStyle || 0]?.style
|
|
469
|
-
);
|
|
470
|
-
const [maxZoom, setMaxZoom] = (0, import_react.useState)(
|
|
471
|
-
styles[mp?.mapStyle || 0]?.maxZoom
|
|
472
|
-
);
|
|
473
|
-
const [selectionStyle, setSelectionStyle] = (0, import_react.useState)(
|
|
474
|
-
SELECTION_STYLE.TOP
|
|
475
|
-
);
|
|
476
|
-
const [gridLegends, setGridLegends] = (0, import_react.useState)({});
|
|
477
|
-
const [isInfoBarOpen, setIsInfoBarOpen] = (0, import_react.useState)(true);
|
|
478
|
-
const [clickedLngLat, setClickedLngLat] = (0, import_react.useState)();
|
|
479
|
-
const [layers, setLayers] = (0, import_react.useState)(_mp.layers || []);
|
|
480
|
-
const [selectedLayerIds, setSelectedLayerIds] = (0, import_react.useState)(
|
|
481
|
-
mp.selectedLayers || []
|
|
482
|
-
);
|
|
483
|
-
const [hoverFeatures, setHoverFeatures] = (0, import_react.useState)();
|
|
484
|
-
const [selectedFeatures, setSelectedFeatures] = (0, import_react.useState)();
|
|
485
|
-
const selectedFeaturesId = (0, import_react.useMemo)(() => {
|
|
486
|
-
const meta = {};
|
|
487
|
-
for (const qr of selectedFeatures || []) {
|
|
488
|
-
meta[qr.sourceLayer] = [
|
|
489
|
-
...meta[qr.sourceLayer] || [],
|
|
490
|
-
qr?.properties?.[PROPERTY_ID]
|
|
491
|
-
];
|
|
492
|
-
}
|
|
493
|
-
return Object.keys(meta).length ? meta : void 0;
|
|
494
|
-
}, [selectedFeatures]);
|
|
495
|
-
const selectedLayers = import_react.default.useMemo(() => {
|
|
496
|
-
const unsortedLayers = layers.filter(
|
|
497
|
-
(_layer) => selectedLayerIds.includes(_layer.id)
|
|
498
|
-
);
|
|
499
|
-
const sortedLayers = new Array(selectedLayerIds.length);
|
|
500
|
-
for (const layerToSort of unsortedLayers) {
|
|
501
|
-
const idx = selectedLayerIds.findIndex((l) => layerToSort.id === l);
|
|
502
|
-
if (idx > -1) {
|
|
503
|
-
sortedLayers[idx] = layerToSort;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return sortedLayers;
|
|
507
|
-
}, [layers, selectedLayerIds]);
|
|
508
|
-
const getLayerIndexById = (layerId) => {
|
|
509
|
-
return layers.findIndex((layer) => layer.id === layerId);
|
|
510
|
-
};
|
|
511
|
-
const updateLayerById = (layerId, updatedLayer) => {
|
|
512
|
-
setLayers(
|
|
513
|
-
(_layers) => _layers.map((l) => l.id === layerId ? { ...l, ...updatedLayer } : l)
|
|
514
|
-
);
|
|
515
|
-
};
|
|
516
|
-
const toggleVectorLayer = async (layerIndex, styleIndex, focus) => {
|
|
517
|
-
const layer = layers[layerIndex];
|
|
518
|
-
const layerData = await getLayerStyle(
|
|
519
|
-
layer,
|
|
520
|
-
styleIndex,
|
|
521
|
-
mp.nakshaApiEndpoint,
|
|
522
|
-
mp.geoserver
|
|
523
|
-
);
|
|
524
|
-
updateLayerById(layer.id, { data: layerData });
|
|
525
|
-
focus && mapl?.fitBounds(layer.bbox, { padding: 40, duration: 1e3 });
|
|
526
|
-
};
|
|
527
|
-
const updateLayerStyle = async (layerId, styleIndex) => {
|
|
528
|
-
const layerIndex = getLayerIndexById(layerId);
|
|
529
|
-
toggleVectorLayer(layerIndex, styleIndex, false);
|
|
530
|
-
};
|
|
531
|
-
const onMapHover = async (e) => {
|
|
532
|
-
if (!selectedLayerIds.length || !mapl) return;
|
|
533
|
-
try {
|
|
534
|
-
const lastLayerId = selectedLayerIds[0];
|
|
535
|
-
const feats = mapl.queryRenderedFeatures(e.point, {
|
|
536
|
-
layers: [lastLayerId]
|
|
537
|
-
});
|
|
538
|
-
if (feats.length) {
|
|
539
|
-
const fId = feats[0]?.id || feats[0]?.properties?.[PROPERTY_ID];
|
|
540
|
-
if (fId === hoverFeatures?.id) return;
|
|
541
|
-
const layer = layers[getLayerIndexById(lastLayerId)];
|
|
542
|
-
const hoverProperties = layer?.data?.summaryColumn.map((sc) => [
|
|
543
|
-
layer.data?.propertyMap?.[sc] || sc,
|
|
544
|
-
feats[0].properties?.[sc]
|
|
545
|
-
]);
|
|
546
|
-
setHoverFeatures({
|
|
547
|
-
id: fId,
|
|
548
|
-
title: layer.title,
|
|
549
|
-
data: hoverProperties
|
|
550
|
-
});
|
|
551
|
-
} else {
|
|
552
|
-
setHoverFeatures(void 0);
|
|
553
|
-
}
|
|
554
|
-
} catch (e2) {
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
const toggleLayer = async ({
|
|
558
|
-
layerId,
|
|
559
|
-
add,
|
|
560
|
-
styleIndex = 0,
|
|
561
|
-
focus = true
|
|
562
|
-
}) => {
|
|
563
|
-
if (!add) {
|
|
564
|
-
setSelectedLayerIds(
|
|
565
|
-
selectedLayerIds.filter((_lyrId) => layerId !== _lyrId)
|
|
566
|
-
);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
const layerIndex = getLayerIndexById(layerId);
|
|
570
|
-
const sourceType = layers[layerIndex]?.source.type;
|
|
571
|
-
if (sourceType === "grid") {
|
|
572
|
-
setSelectedLayerIds((_slIds) => [
|
|
573
|
-
layerId,
|
|
574
|
-
..._slIds.filter((lid) => lid !== layerId)
|
|
575
|
-
]);
|
|
576
|
-
if (focus && layers[layerIndex]?.bbox) {
|
|
577
|
-
setTimeout(() => {
|
|
578
|
-
mapl?.fitBounds(layers[layerIndex].bbox, {
|
|
579
|
-
padding: 40,
|
|
580
|
-
duration: 1e3
|
|
581
|
-
});
|
|
582
|
-
}, 100);
|
|
583
|
-
}
|
|
584
|
-
} else {
|
|
585
|
-
await toggleVectorLayer(layerIndex, styleIndex, focus);
|
|
586
|
-
setSelectedLayerIds((_slIds) => [
|
|
587
|
-
layerId,
|
|
588
|
-
..._slIds.filter((lid) => lid !== layerId)
|
|
589
|
-
]);
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
const clearAllLayers = async () => setSelectedLayerIds([]);
|
|
593
|
-
const updateMP = (key, value) => {
|
|
594
|
-
setMP({ ...mp, [key]: value });
|
|
595
|
-
};
|
|
596
|
-
const toggleLayerPublishing = (layerId, layerStatus) => {
|
|
597
|
-
const isActive = layerStatus === LAYER_STATUS.PENDING;
|
|
598
|
-
axToggleLayerPublishing(
|
|
599
|
-
mp.nakshaEndpointToken,
|
|
600
|
-
mp.nakshaApiEndpoint,
|
|
601
|
-
layerId,
|
|
602
|
-
isActive
|
|
603
|
-
);
|
|
604
|
-
updateLayerById(layerId, {
|
|
605
|
-
layerStatus: isActive ? LAYER_STATUS.ACTIVE : LAYER_STATUS.PENDING
|
|
606
|
-
});
|
|
607
|
-
};
|
|
608
|
-
const deleteLayer = async (layerId, message) => {
|
|
609
|
-
if (confirm(message)) {
|
|
610
|
-
axDeleteLayer(mp.nakshaEndpointToken, mp.nakshaApiEndpoint, layerId);
|
|
611
|
-
setLayers(layers.filter((l) => l.id !== layerId));
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
const zoomToExtent = (layerId) => {
|
|
615
|
-
const layerIndex = getLayerIndexById(layerId);
|
|
616
|
-
const layer = layers[layerIndex];
|
|
617
|
-
mapl?.fitBounds(layer.bbox, { padding: 40, duration: 1e3 });
|
|
618
|
-
};
|
|
619
|
-
const getBBoxFromLngLat = () => {
|
|
620
|
-
return [
|
|
621
|
-
clickedLngLat.lng,
|
|
622
|
-
clickedLngLat.lat,
|
|
623
|
-
clickedLngLat.lng + 0.1,
|
|
624
|
-
clickedLngLat.lat + 0.1
|
|
625
|
-
];
|
|
626
|
-
};
|
|
627
|
-
const handleSelectStyle = (value) => {
|
|
628
|
-
setSelectionStyle(value);
|
|
629
|
-
if (value === SELECTION_STYLE.TOP) {
|
|
630
|
-
featuresAtLatLng(value);
|
|
631
|
-
}
|
|
632
|
-
};
|
|
633
|
-
const featuresAtLatLng = (value) => {
|
|
634
|
-
if (!clickedLngLat) return;
|
|
635
|
-
try {
|
|
636
|
-
const finalXY = mapl?.project([clickedLngLat.lng, clickedLngLat.lat]);
|
|
637
|
-
let queryFeat = mapl?.queryRenderedFeatures(finalXY, {
|
|
638
|
-
layers: selectionStyle === SELECTION_STYLE.TOP ? [selectedLayerIds[0]] : selectedLayerIds
|
|
639
|
-
});
|
|
640
|
-
if ((value || selectionStyle) === SELECTION_STYLE.ALL) {
|
|
641
|
-
const rasterLayerFeat = selectedLayers.filter((item) => item.layerType == "RASTER").map((item) => ({
|
|
642
|
-
sourceLayer: item.id,
|
|
643
|
-
layerType: "raster",
|
|
644
|
-
bbox: getBBoxFromLngLat()
|
|
645
|
-
}));
|
|
646
|
-
queryFeat = [...queryFeat, ...rasterLayerFeat];
|
|
647
|
-
}
|
|
648
|
-
setSelectedFeatures(
|
|
649
|
-
// if fist layer is raster and select all in not set
|
|
650
|
-
// send a raster based feature object
|
|
651
|
-
selectedLayers?.[0].layerType === "RASTER" && selectionStyle !== SELECTION_STYLE.ALL ? selectedLayerIds.length && queryFeat?.length ? queryFeat : [
|
|
652
|
-
{
|
|
653
|
-
sourceLayer: selectedLayerIds[0],
|
|
654
|
-
layerType: "raster",
|
|
655
|
-
bbox: getBBoxFromLngLat()
|
|
656
|
-
}
|
|
657
|
-
] : queryFeat
|
|
658
|
-
);
|
|
659
|
-
} catch (e) {
|
|
660
|
-
console.error(e);
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
(0, import_react.useEffect)(() => {
|
|
664
|
-
if (mp.onSelectedLayersChange) {
|
|
665
|
-
mp.onSelectedLayersChange(selectedLayerIds);
|
|
666
|
-
}
|
|
667
|
-
}, [selectedLayerIds]);
|
|
668
|
-
(0, import_react.useEffect)(() => {
|
|
669
|
-
setTimeout(featuresAtLatLng, 300);
|
|
670
|
-
}, [clickedLngLat, selectionStyle, selectedLayerIds]);
|
|
671
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
672
|
-
LayersContext.Provider,
|
|
673
|
-
{
|
|
674
|
-
value: {
|
|
675
|
-
mp,
|
|
676
|
-
updateMP,
|
|
677
|
-
layer: {
|
|
678
|
-
mapStyle,
|
|
679
|
-
featuresAtLatLng,
|
|
680
|
-
setMapStyle,
|
|
681
|
-
maxZoom,
|
|
682
|
-
setMaxZoom,
|
|
683
|
-
mapStyles: styles,
|
|
684
|
-
all: layers,
|
|
685
|
-
setAll: setLayers,
|
|
686
|
-
selectedIds: selectedLayerIds,
|
|
687
|
-
handleSelectStyle,
|
|
688
|
-
setSelectedIds: setSelectedLayerIds,
|
|
689
|
-
selectedLayers,
|
|
690
|
-
clearAll: clearAllLayers,
|
|
691
|
-
toggle: toggleLayer,
|
|
692
|
-
updateStyle: updateLayerStyle,
|
|
693
|
-
selectedFeatures,
|
|
694
|
-
selectedFeaturesId,
|
|
695
|
-
setSelectedFeatures,
|
|
696
|
-
togglePublish: toggleLayerPublishing,
|
|
697
|
-
delete: deleteLayer,
|
|
698
|
-
selectionStyle,
|
|
699
|
-
setSelectionStyle,
|
|
700
|
-
zoomToExtent,
|
|
701
|
-
gridLegends,
|
|
702
|
-
setGridLegends
|
|
703
|
-
},
|
|
704
|
-
query: {
|
|
705
|
-
term: queryTermDebounced,
|
|
706
|
-
setTerm: setQueryTerm,
|
|
707
|
-
clickedLngLat,
|
|
708
|
-
setClickedLngLat
|
|
709
|
-
},
|
|
710
|
-
isInfoBarOpen,
|
|
711
|
-
setIsInfoBarOpen,
|
|
712
|
-
hover: {
|
|
713
|
-
onHover: onMapHover,
|
|
714
|
-
features: hoverFeatures
|
|
715
|
-
}
|
|
716
|
-
},
|
|
717
|
-
children
|
|
718
|
-
}
|
|
719
|
-
);
|
|
720
|
-
};
|
|
721
|
-
function useLayers() {
|
|
722
|
-
return (0, import_react.useContext)(LayersContext);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// src/components/core/button.tsx
|
|
726
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
727
|
-
var import_twind2 = require("twind");
|
|
728
|
-
|
|
729
|
-
// src/components/core/icons.tsx
|
|
730
|
-
var import_twind = require("twind");
|
|
731
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
732
|
-
var SearchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
733
|
-
"svg",
|
|
734
|
-
{
|
|
735
|
-
fill: "none",
|
|
736
|
-
className: import_twind.tw`w-5 h-5 text-gray-400`,
|
|
737
|
-
width: "24",
|
|
738
|
-
height: "24",
|
|
739
|
-
viewBox: "0 0 24 24",
|
|
740
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
741
|
-
"path",
|
|
742
|
-
{
|
|
743
|
-
stroke: "currentColor",
|
|
744
|
-
strokeLinecap: "round",
|
|
745
|
-
strokeLinejoin: "round",
|
|
746
|
-
strokeWidth: "2",
|
|
747
|
-
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
748
|
-
}
|
|
749
|
-
)
|
|
750
|
-
}
|
|
751
|
-
);
|
|
752
|
-
var LayersIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
753
|
-
"svg",
|
|
754
|
-
{
|
|
755
|
-
width: "18",
|
|
756
|
-
height: "18",
|
|
757
|
-
fill: "none",
|
|
758
|
-
stroke: "currentColor",
|
|
759
|
-
strokeLinecap: "round",
|
|
760
|
-
strokeLinejoin: "round",
|
|
761
|
-
strokeWidth: "2",
|
|
762
|
-
viewBox: "0 0 24 24",
|
|
763
|
-
children: [
|
|
764
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 2L2 7 12 12 22 7 12 2z" }),
|
|
765
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M2 17L12 22 22 17" }),
|
|
766
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M2 12L12 17 22 12" })
|
|
767
|
-
]
|
|
768
|
-
}
|
|
769
|
-
);
|
|
770
|
-
var InfoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
771
|
-
"svg",
|
|
772
|
-
{
|
|
773
|
-
width: "16",
|
|
774
|
-
height: "16",
|
|
775
|
-
viewBox: "0 0 24 24",
|
|
776
|
-
fill: "none",
|
|
777
|
-
stroke: "currentColor",
|
|
778
|
-
strokeWidth: "2",
|
|
779
|
-
strokeLinecap: "round",
|
|
780
|
-
strokeLinejoin: "round",
|
|
781
|
-
children: [
|
|
782
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
783
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
784
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
785
|
-
]
|
|
786
|
-
}
|
|
787
|
-
);
|
|
788
|
-
var SlidersIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
789
|
-
"svg",
|
|
790
|
-
{
|
|
791
|
-
width: "18",
|
|
792
|
-
height: "18",
|
|
793
|
-
fill: "none",
|
|
794
|
-
stroke: "currentColor",
|
|
795
|
-
strokeLinecap: "round",
|
|
796
|
-
strokeLinejoin: "round",
|
|
797
|
-
strokeWidth: "2",
|
|
798
|
-
viewBox: "0 0 24 24",
|
|
799
|
-
children: [
|
|
800
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 21L4 14" }),
|
|
801
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 10L4 3" }),
|
|
802
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 21L12 12" }),
|
|
803
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 8L12 3" }),
|
|
804
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 21L20 16" }),
|
|
805
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 12L20 3" }),
|
|
806
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M1 14L7 14" }),
|
|
807
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9 8L15 8" }),
|
|
808
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M17 16L23 16" })
|
|
809
|
-
]
|
|
810
|
-
}
|
|
811
|
-
);
|
|
812
|
-
function AttributionIcon() {
|
|
813
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
814
|
-
"svg",
|
|
815
|
-
{
|
|
816
|
-
width: "14",
|
|
817
|
-
height: "14",
|
|
818
|
-
viewBox: "0 0 16 16",
|
|
819
|
-
style: { display: "inline-block" },
|
|
820
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
821
|
-
"path",
|
|
822
|
-
{
|
|
823
|
-
fillRule: "evenodd",
|
|
824
|
-
fill: "currentColor",
|
|
825
|
-
d: "M5.5 3.5a2 2 0 100 4 2 2 0 000-4zM2 5.5a3.5 3.5 0 115.898 2.549 5.507 5.507 0 013.034 4.084.75.75 0 11-1.482.235 4.001 4.001 0 00-7.9 0 .75.75 0 01-1.482-.236A5.507 5.507 0 013.102 8.05 3.49 3.49 0 012 5.5zM11 4a.75.75 0 100 1.5 1.5 1.5 0 01.666 2.844.75.75 0 00-.416.672v.352a.75.75 0 00.574.73c1.2.289 2.162 1.2 2.522 2.372a.75.75 0 101.434-.44 5.01 5.01 0 00-2.56-3.012A3 3 0 0011 4z"
|
|
826
|
-
}
|
|
827
|
-
)
|
|
828
|
-
}
|
|
829
|
-
);
|
|
830
|
-
}
|
|
831
|
-
function TagIcon() {
|
|
832
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
833
|
-
"svg",
|
|
834
|
-
{
|
|
835
|
-
width: "14",
|
|
836
|
-
height: "14",
|
|
837
|
-
viewBox: "0 0 16 16",
|
|
838
|
-
style: { display: "inline-block" },
|
|
839
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
840
|
-
"path",
|
|
841
|
-
{
|
|
842
|
-
fillRule: "evenodd",
|
|
843
|
-
fill: "currentColor",
|
|
844
|
-
d: "M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"
|
|
845
|
-
}
|
|
846
|
-
)
|
|
847
|
-
}
|
|
848
|
-
);
|
|
849
|
-
}
|
|
850
|
-
function LicenseIcon() {
|
|
851
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
852
|
-
"svg",
|
|
853
|
-
{
|
|
854
|
-
width: "14",
|
|
855
|
-
height: "14",
|
|
856
|
-
viewBox: "0 0 16 16",
|
|
857
|
-
style: { display: "inline-block" },
|
|
858
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
859
|
-
"path",
|
|
860
|
-
{
|
|
861
|
-
fillRule: "evenodd",
|
|
862
|
-
fill: "currentColor",
|
|
863
|
-
d: "M8.75.75a.75.75 0 00-1.5 0V2h-.984c-.305 0-.604.08-.869.23l-1.288.737A.25.25 0 013.984 3H1.75a.75.75 0 000 1.5h.428L.066 9.192a.75.75 0 00.154.838l.53-.53-.53.53v.001l.002.002.002.002.006.006.016.015.045.04a3.514 3.514 0 00.686.45A4.492 4.492 0 003 11c.88 0 1.556-.22 2.023-.454a3.515 3.515 0 00.686-.45l.045-.04.016-.015.006-.006.002-.002.001-.002L5.25 9.5l.53.53a.75.75 0 00.154-.838L3.822 4.5h.162c.305 0 .604-.08.869-.23l1.289-.737a.25.25 0 01.124-.033h.984V13h-2.5a.75.75 0 000 1.5h6.5a.75.75 0 000-1.5h-2.5V3.5h.984a.25.25 0 01.124.033l1.29.736c.264.152.563.231.868.231h.162l-2.112 4.692a.75.75 0 00.154.838l.53-.53-.53.53v.001l.002.002.002.002.006.006.016.015.045.04a3.517 3.517 0 00.686.45A4.492 4.492 0 0013 11c.88 0 1.556-.22 2.023-.454a3.512 3.512 0 00.686-.45l.045-.04.01-.01.006-.005.006-.006.002-.002.001-.002-.529-.531.53.53a.75.75 0 00.154-.838L13.823 4.5h.427a.75.75 0 000-1.5h-2.234a.25.25 0 01-.124-.033l-1.29-.736A1.75 1.75 0 009.735 2H8.75V.75zM1.695 9.227c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327l-1.305 2.9zm10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327l-1.305 2.9z"
|
|
864
|
-
}
|
|
865
|
-
)
|
|
866
|
-
}
|
|
867
|
-
);
|
|
868
|
-
}
|
|
869
|
-
function EyeIcon() {
|
|
870
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
871
|
-
"svg",
|
|
872
|
-
{
|
|
873
|
-
viewBox: "0 0 16 16",
|
|
874
|
-
width: "14",
|
|
875
|
-
height: "14",
|
|
876
|
-
style: { display: "inline-block" },
|
|
877
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
878
|
-
"path",
|
|
879
|
-
{
|
|
880
|
-
fillRule: "evenodd",
|
|
881
|
-
fill: "currentColor",
|
|
882
|
-
d: "M1.679 7.932c.412-.621 1.242-1.75 2.366-2.717C5.175 4.242 6.527 3.5 8 3.5c1.473 0 2.824.742 3.955 1.715 1.124.967 1.954 2.096 2.366 2.717a.119.119 0 010 .136c-.412.621-1.242 1.75-2.366 2.717C10.825 11.758 9.473 12.5 8 12.5c-1.473 0-2.824-.742-3.955-1.715C2.92 9.818 2.09 8.69 1.679 8.068a.119.119 0 010-.136zM8 2c-1.981 0-3.67.992-4.933 2.078C1.797 5.169.88 6.423.43 7.1a1.619 1.619 0 000 1.798c.45.678 1.367 1.932 2.637 3.024C4.329 13.008 6.019 14 8 14c1.981 0 3.67-.992 4.933-2.078 1.27-1.091 2.187-2.345 2.637-3.023a1.619 1.619 0 000-1.798c-.45-.678-1.367-1.932-2.637-3.023C11.671 2.992 9.981 2 8 2zm0 8a2 2 0 100-4 2 2 0 000 4z"
|
|
883
|
-
}
|
|
884
|
-
)
|
|
885
|
-
}
|
|
886
|
-
);
|
|
887
|
-
}
|
|
888
|
-
function ClockIcon() {
|
|
889
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
890
|
-
"svg",
|
|
891
|
-
{
|
|
892
|
-
viewBox: "0 0 16 16",
|
|
893
|
-
width: "14",
|
|
894
|
-
height: "14",
|
|
895
|
-
style: { display: "inline-block" },
|
|
896
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
897
|
-
"path",
|
|
898
|
-
{
|
|
899
|
-
fillRule: "evenodd",
|
|
900
|
-
fill: "currentColor",
|
|
901
|
-
d: "M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zm.5 4.75a.75.75 0 00-1.5 0v3.5a.75.75 0 00.471.696l2.5 1a.75.75 0 00.557-1.392L8.5 7.742V4.75z"
|
|
902
|
-
}
|
|
903
|
-
)
|
|
904
|
-
}
|
|
905
|
-
);
|
|
906
|
-
}
|
|
907
|
-
function DownloadIcon() {
|
|
908
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
909
|
-
"svg",
|
|
910
|
-
{
|
|
911
|
-
viewBox: "0 0 16 16",
|
|
912
|
-
width: "16",
|
|
913
|
-
height: "16",
|
|
914
|
-
style: { display: "inline-block" },
|
|
915
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
916
|
-
"path",
|
|
917
|
-
{
|
|
918
|
-
fillRule: "evenodd",
|
|
919
|
-
fill: "currentColor",
|
|
920
|
-
d: "M7.47 10.78a.75.75 0 001.06 0l3.75-3.75a.75.75 0 00-1.06-1.06L8.75 8.44V1.75a.75.75 0 00-1.5 0v6.69L4.78 5.97a.75.75 0 00-1.06 1.06l3.75 3.75zM3.75 13a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5z"
|
|
921
|
-
}
|
|
922
|
-
)
|
|
923
|
-
}
|
|
924
|
-
);
|
|
925
|
-
}
|
|
926
|
-
function ZoomExtentIcon() {
|
|
927
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
928
|
-
"svg",
|
|
929
|
-
{
|
|
930
|
-
viewBox: "0 0 24 24",
|
|
931
|
-
width: "16",
|
|
932
|
-
height: "16",
|
|
933
|
-
fill: "none",
|
|
934
|
-
stroke: "currentColor",
|
|
935
|
-
strokeWidth: "2",
|
|
936
|
-
strokeLinecap: "round",
|
|
937
|
-
strokeLinejoin: "round",
|
|
938
|
-
style: { display: "inline-block" },
|
|
939
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" })
|
|
940
|
-
}
|
|
941
|
-
);
|
|
942
|
-
}
|
|
943
|
-
function ShareIcon() {
|
|
944
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
945
|
-
"svg",
|
|
946
|
-
{
|
|
947
|
-
viewBox: "0 0 24 24",
|
|
948
|
-
width: "16",
|
|
949
|
-
height: "16",
|
|
950
|
-
fill: "none",
|
|
951
|
-
stroke: "currentColor",
|
|
952
|
-
strokeWidth: "2",
|
|
953
|
-
strokeLinecap: "round",
|
|
954
|
-
strokeLinejoin: "round",
|
|
955
|
-
style: { display: "inline-block" },
|
|
956
|
-
children: [
|
|
957
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "18", cy: "5", r: "3" }),
|
|
958
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "6", cy: "12", r: "3" }),
|
|
959
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "18", cy: "19", r: "3" }),
|
|
960
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "8.59", y1: "13.51", x2: "15.42", y2: "17.49" }),
|
|
961
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "15.41", y1: "6.51", x2: "8.59", y2: "10.49" })
|
|
962
|
-
]
|
|
963
|
-
}
|
|
964
|
-
);
|
|
965
|
-
}
|
|
966
|
-
function GrabberIcon() {
|
|
967
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
968
|
-
"svg",
|
|
969
|
-
{
|
|
970
|
-
viewBox: "0 0 16 16",
|
|
971
|
-
width: "16",
|
|
972
|
-
height: "16",
|
|
973
|
-
style: { display: "inline-block" },
|
|
974
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
975
|
-
"path",
|
|
976
|
-
{
|
|
977
|
-
fillRule: "evenodd",
|
|
978
|
-
d: "M10 13a1 1 0 100-2 1 1 0 000 2zm-4 0a1 1 0 100-2 1 1 0 000 2zm1-5a1 1 0 11-2 0 1 1 0 012 0zm3 1a1 1 0 100-2 1 1 0 000 2zm1-5a1 1 0 11-2 0 1 1 0 012 0zM6 5a1 1 0 100-2 1 1 0 000 2z"
|
|
979
|
-
}
|
|
980
|
-
)
|
|
981
|
-
}
|
|
982
|
-
);
|
|
983
|
-
}
|
|
984
|
-
function CrossHairIcon() {
|
|
985
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
986
|
-
"svg",
|
|
987
|
-
{
|
|
988
|
-
style: { display: "inline-block" },
|
|
989
|
-
width: "18",
|
|
990
|
-
height: "18",
|
|
991
|
-
viewBox: "0 0 24 24",
|
|
992
|
-
fill: "none",
|
|
993
|
-
stroke: "currentColor",
|
|
994
|
-
strokeWidth: "2",
|
|
995
|
-
strokeLinecap: "round",
|
|
996
|
-
strokeLinejoin: "round",
|
|
997
|
-
children: [
|
|
998
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
999
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "22", y1: "12", x2: "18", y2: "12" }),
|
|
1000
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "6", y1: "12", x2: "2", y2: "12" }),
|
|
1001
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "6", x2: "12", y2: "2" }),
|
|
1002
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "22", x2: "12", y2: "18" })
|
|
1003
|
-
]
|
|
1004
|
-
}
|
|
1005
|
-
);
|
|
1006
|
-
}
|
|
1007
|
-
function DownIcon() {
|
|
1008
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1009
|
-
"svg",
|
|
1010
|
-
{
|
|
1011
|
-
width: "18",
|
|
1012
|
-
height: "18",
|
|
1013
|
-
viewBox: "0 0 24 24",
|
|
1014
|
-
fill: "none",
|
|
1015
|
-
stroke: "currentColor",
|
|
1016
|
-
strokeWidth: "2",
|
|
1017
|
-
strokeLinecap: "round",
|
|
1018
|
-
strokeLinejoin: "round",
|
|
1019
|
-
style: { display: "inline-block" },
|
|
1020
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
1021
|
-
}
|
|
1022
|
-
);
|
|
1023
|
-
}
|
|
1024
|
-
function UpIcon() {
|
|
1025
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1026
|
-
"svg",
|
|
1027
|
-
{
|
|
1028
|
-
width: "18",
|
|
1029
|
-
height: "18",
|
|
1030
|
-
viewBox: "0 0 24 24",
|
|
1031
|
-
fill: "none",
|
|
1032
|
-
stroke: "currentColor",
|
|
1033
|
-
strokeWidth: "2",
|
|
1034
|
-
strokeLinecap: "round",
|
|
1035
|
-
strokeLinejoin: "round",
|
|
1036
|
-
style: { display: "inline-block" },
|
|
1037
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "18 15 12 9 6 15" })
|
|
1038
|
-
}
|
|
1039
|
-
);
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
// src/components/core/button.tsx
|
|
1043
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1044
|
-
var Button = import_react2.default.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1045
|
-
"button",
|
|
1046
|
-
{
|
|
1047
|
-
ref,
|
|
1048
|
-
type: "button",
|
|
1049
|
-
className: import_twind2.tw`h-8 px-3 py-2 rounded-md focus:outline-none focus:ring cursor-pointer text-md flex align-middle items-center gap-2 bg-gray-100 hover:bg-gray-200 text-gray-700 disabled:cursor-not-allowed disabled:bg-gray-100! disabled:opacity-50`,
|
|
1050
|
-
...props
|
|
1051
|
-
}
|
|
1052
|
-
));
|
|
1053
|
-
var CloseButton = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1054
|
-
"button",
|
|
1055
|
-
{
|
|
1056
|
-
className: import_twind2.tw`absolute top-0 right-0 h-12 w-12 bg-red-100 cursor-pointer hover:bg-red-200 text-red-800 text-lg`,
|
|
1057
|
-
children: "\u2715",
|
|
1058
|
-
...props
|
|
1059
|
-
}
|
|
1060
|
-
);
|
|
1061
|
-
var LayersButton = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1062
|
-
"button",
|
|
1063
|
-
{
|
|
1064
|
-
className: import_twind2.tw`absolute top-4 left-4 rounded-lg z-10 h-10 w-10 bg-white cursor-pointer hover:bg-gray-100 text-gray-700 text-lg flex items-center justify-center`,
|
|
1065
|
-
...props,
|
|
1066
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LayersIcon, {})
|
|
1067
|
-
}
|
|
1068
|
-
);
|
|
1069
|
-
var InfobarButton = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1070
|
-
"button",
|
|
1071
|
-
{
|
|
1072
|
-
className: import_twind2.tw`absolute top-4 right-4 rounded-lg z-10 h-10 w-10 bg-white cursor-pointer hover:bg-gray-100 text-gray-700 text-lg flex items-center justify-center`,
|
|
1073
|
-
...props,
|
|
1074
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InfoIcon, {})
|
|
1075
|
-
}
|
|
1076
|
-
);
|
|
1077
|
-
|
|
1078
|
-
// src/components/core/input.tsx
|
|
1079
|
-
var import_twind3 = require("twind");
|
|
1080
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1081
|
-
var SelectInput = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
1082
|
-
props.label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: import_twind3.tw`text-gray-700`, htmlFor: props.name, children: props.label }),
|
|
1083
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1084
|
-
"select",
|
|
1085
|
-
{
|
|
1086
|
-
id: props.name,
|
|
1087
|
-
name: props.name,
|
|
1088
|
-
className: import_twind3.tw`block w-full px-4 py-2 mt-2 text-gray-700 border bg-white border-gray-200 rounded-md focus:outline-none focus:ring appearance-none text-base`,
|
|
1089
|
-
style: {
|
|
1090
|
-
backgroundImage: `url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E")`,
|
|
1091
|
-
backgroundPosition: "right 0.75rem center",
|
|
1092
|
-
backgroundSize: "16px 12px",
|
|
1093
|
-
backgroundRepeat: "no-repeat"
|
|
1094
|
-
},
|
|
1095
|
-
...props
|
|
1096
|
-
}
|
|
1097
|
-
)
|
|
1098
|
-
] });
|
|
1099
|
-
var SearchInput = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", children: [
|
|
1100
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: import_twind3.tw`absolute inset-y-0 left-0 flex items-center pl-3`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SearchIcon, {}) }),
|
|
1101
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1102
|
-
"input",
|
|
1103
|
-
{
|
|
1104
|
-
type: "search",
|
|
1105
|
-
className: import_twind3.tw`w-full py-2 pl-10 pr-4 text-gray-700 bg-white border border-gray-300 text-base rounded-md focus:outline-none focus:ring`,
|
|
1106
|
-
...props
|
|
1107
|
-
}
|
|
1108
|
-
)
|
|
1109
|
-
] });
|
|
1110
|
-
var CheckboxInput = (props) => props.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1111
|
-
"svg",
|
|
1112
|
-
{
|
|
1113
|
-
width: "20px",
|
|
1114
|
-
height: "20px",
|
|
1115
|
-
viewBox: "0 0 20 20",
|
|
1116
|
-
version: "1.1",
|
|
1117
|
-
className: import_twind3.tw`inline text-gray-200 animate-spin dark:text-gray-600`,
|
|
1118
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("g", { fill: "#212121", fillRule: "nonzero", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10,3 C6.13401,3 3,6.13401 3,10 C3,10.2761 2.77614,10.5 2.5,10.5 C2.22386,10.5 2,10.2761 2,10 C2,5.58172 5.58172,2 10,2 C14.4183,2 18,5.58172 18,10 C18,14.4183 14.4183,18 10,18 C9.72386,18 9.5,17.7761 9.5,17.5 C9.5,17.2239 9.72386,17 10,17 C13.866,17 17,13.866 17,10 C17,6.13401 13.866,3 10,3 Z" }) }) })
|
|
1119
|
-
}
|
|
1120
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1121
|
-
"input",
|
|
1122
|
-
{
|
|
1123
|
-
type: "checkbox",
|
|
1124
|
-
className: import_twind3.tw`w-5 h-5 border-gray-100 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80`,
|
|
1125
|
-
name: props.name,
|
|
1126
|
-
checked: props.checked,
|
|
1127
|
-
onChange: props.onChange
|
|
1128
|
-
}
|
|
1129
|
-
);
|
|
1130
|
-
|
|
1131
|
-
// src/components/core/tabs.tsx
|
|
1132
|
-
var import_tabs = require("@bumaga/tabs");
|
|
1133
|
-
var import_clsx = __toESM(require("clsx"), 1);
|
|
1134
|
-
var import_twind4 = require("twind");
|
|
1135
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1136
|
-
var IconTab = ({ children, icon }) => {
|
|
1137
|
-
const { onClick, isActive } = (0, import_tabs.useTabState)();
|
|
1138
|
-
const classes = (0, import_clsx.default)([
|
|
1139
|
-
"flex items-center justify-center h-12 px-2 py-2 bg-transparent -mb-px border-b-2 -px-1 whitespace-nowrap focus:outline-none w-full cursor-pointer",
|
|
1140
|
-
{
|
|
1141
|
-
"text-blue-600 border-blue-500": isActive,
|
|
1142
|
-
"text-gray-700 border-gray-300 hover:border-gray-400": !isActive
|
|
1143
|
-
}
|
|
1144
|
-
]);
|
|
1145
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { className: (0, import_twind4.tw)(classes), onClick, children: [
|
|
1146
|
-
icon,
|
|
1147
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: import_twind4.tw`ml-2 text-base`, children })
|
|
1148
|
-
] });
|
|
1149
|
-
};
|
|
1150
|
-
var Panel = ({ children }) => {
|
|
1151
|
-
const isActive = (0, import_tabs.usePanelState)();
|
|
1152
|
-
return isActive ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: import_twind4.tw`w-full flex flex-grow-1 overflow-auto`, children }) : null;
|
|
1153
|
-
};
|
|
1154
|
-
var TabHeader = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1155
|
-
"div",
|
|
1156
|
-
{
|
|
1157
|
-
className: import_twind4.tw`flex flex-shrink-0 border-b border-gray-200 justify-around pr-12`,
|
|
1158
|
-
children
|
|
1159
|
-
}
|
|
1160
|
-
);
|
|
1161
|
-
|
|
1162
|
-
// src/components/infobar/content.tsx
|
|
1163
|
-
var import_naksha_commons4 = require("@biodiv-platform/naksha-commons");
|
|
1164
|
-
var import_twind6 = require("twind");
|
|
1165
|
-
|
|
1166
|
-
// src/components/sidebar/settings/layer-selection.tsx
|
|
1167
|
-
var import_naksha_commons3 = require("@biodiv-platform/naksha-commons");
|
|
1168
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1169
|
-
function LayerSelection({ hideLabel }) {
|
|
1170
|
-
const {
|
|
1171
|
-
layer: { selectionStyle, handleSelectStyle }
|
|
1172
|
-
} = useLayers();
|
|
1173
|
-
const { t } = (0, import_naksha_commons3.useT)();
|
|
1174
|
-
const handleOnSelectionStyleChange = (e) => {
|
|
1175
|
-
handleSelectStyle(e.target.value);
|
|
1176
|
-
};
|
|
1177
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1178
|
-
SelectInput,
|
|
1179
|
-
{
|
|
1180
|
-
name: "layer_selection",
|
|
1181
|
-
label: hideLabel ? null : t("layer_selection"),
|
|
1182
|
-
defaultValue: selectionStyle,
|
|
1183
|
-
onChange: handleOnSelectionStyleChange,
|
|
1184
|
-
children: Object.values(SELECTION_STYLE).map((ss) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: ss, children: t(ss) }, ss))
|
|
1185
|
-
}
|
|
1186
|
-
);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
// src/components/infobar/infobar-panel.tsx
|
|
1190
|
-
var import_clsx2 = __toESM(require("clsx"), 1);
|
|
1191
|
-
var import_react3 = require("react");
|
|
1192
|
-
var import_twind5 = require("twind");
|
|
1193
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1194
|
-
function InfoBarPanel({ data: payload }) {
|
|
1195
|
-
const [isOpen, setIsOpen] = (0, import_react3.useState)(true);
|
|
1196
|
-
const [layerInfo, setLayerInfo] = (0, import_react3.useState)({
|
|
1197
|
-
title: payload.sourceLayer,
|
|
1198
|
-
properties: []
|
|
1199
|
-
});
|
|
1200
|
-
const {
|
|
1201
|
-
layer,
|
|
1202
|
-
mp,
|
|
1203
|
-
query: { clickedLngLat }
|
|
1204
|
-
} = useLayers();
|
|
1205
|
-
const getPropertyData = async () => {
|
|
1206
|
-
let properties;
|
|
1207
|
-
const currentLayer = layer.selectedLayers.find(
|
|
1208
|
-
(l) => l.id === (payload.sourceLayer || payload.source)
|
|
1209
|
-
);
|
|
1210
|
-
if (currentLayer.layerType.toLowerCase() === "raster") {
|
|
1211
|
-
const { data } = await axGexGetRasterInfoWithLonLat(
|
|
1212
|
-
mp.geoserver?.endpoint,
|
|
1213
|
-
mp.geoserver?.workspace,
|
|
1214
|
-
{
|
|
1215
|
-
bbox: payload.bbox.toString(),
|
|
1216
|
-
query_layers: `${mp.geoserver?.workspace}:${currentLayer.id}`,
|
|
1217
|
-
layers: `${mp.geoserver?.workspace}:${currentLayer.id}`
|
|
1218
|
-
}
|
|
1219
|
-
);
|
|
1220
|
-
properties = data?.features[0] ? Object.entries(data.features[0]?.properties).map(([v, k]) => [
|
|
1221
|
-
k || "-"
|
|
1222
|
-
]) : [];
|
|
1223
|
-
} else {
|
|
1224
|
-
properties = Object.entries(currentLayer?.data?.propertyMap || {}).map(
|
|
1225
|
-
([k, v]) => [v, payload?.properties?.[k]]
|
|
1226
|
-
);
|
|
1227
|
-
}
|
|
1228
|
-
setLayerInfo({ title: currentLayer.title, properties });
|
|
1229
|
-
};
|
|
1230
|
-
(0, import_react3.useEffect)(() => {
|
|
1231
|
-
getPropertyData();
|
|
1232
|
-
}, [clickedLngLat]);
|
|
1233
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: import_twind5.tw`bg-gray-100 rounded-lg`, children: [
|
|
1234
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1235
|
-
"button",
|
|
1236
|
-
{
|
|
1237
|
-
className: (0, import_twind5.tw)(
|
|
1238
|
-
(0, import_clsx2.default)([
|
|
1239
|
-
`px-4 h-10 flex items-center justify-between bg-gray-100 hover:bg-gray-200 transition-colors cursor-pointer w-full focus:outline-none focus:ring`,
|
|
1240
|
-
{ "bg-gray-200 rounded-t-lg": isOpen, "rounded-lg": !isOpen }
|
|
1241
|
-
])
|
|
1242
|
-
),
|
|
1243
|
-
onClick: () => setIsOpen(!isOpen),
|
|
1244
|
-
children: [
|
|
1245
|
-
layerInfo.title,
|
|
1246
|
-
" ",
|
|
1247
|
-
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(UpIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DownIcon, {})
|
|
1248
|
-
]
|
|
1249
|
-
}
|
|
1250
|
-
),
|
|
1251
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: import_twind5.tw`px-4 py-3 flex flex-col gap-3`, children: layerInfo.properties.map(([k, v], index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1252
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: import_twind5.tw`text-gray-600`, children: k }),
|
|
1253
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: v })
|
|
1254
|
-
] }, k + v + index)) })
|
|
1255
|
-
] });
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
// src/components/infobar/content.tsx
|
|
1259
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1260
|
-
function InfoBarContent({ onClose }) {
|
|
1261
|
-
const {
|
|
1262
|
-
layer: { selectedFeatures, selectedLayers, selectionStyle }
|
|
1263
|
-
} = useLayers();
|
|
1264
|
-
const { t } = (0, import_naksha_commons4.useT)();
|
|
1265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1266
|
-
"div",
|
|
1267
|
-
{
|
|
1268
|
-
className: import_twind6.tw`absolute top-0 right-0 bottom-0 left-0 md:top-4 md:right-4 md:bottom-4 md:left-auto bg-white rounded-lg overflow-hidden shadow-md md:max-w-sm w-full z-20 flex flex-col`,
|
|
1269
|
-
children: [
|
|
1270
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex w-full", children: [
|
|
1271
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1272
|
-
"div",
|
|
1273
|
-
{
|
|
1274
|
-
className: import_twind6.tw`h-12 px-4 flex items-center gap-3 flex-grow bg-gray-200`,
|
|
1275
|
-
children: [
|
|
1276
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CrossHairIcon, {}),
|
|
1277
|
-
" ",
|
|
1278
|
-
t("infobar")
|
|
1279
|
-
]
|
|
1280
|
-
}
|
|
1281
|
-
),
|
|
1282
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseButton, { onClick: onClose })
|
|
1283
|
-
] }),
|
|
1284
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: import_twind6.tw`bg-gray-100 p-4 flex-shrink-0 rt`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayerSelection, { hideLabel: true }) }),
|
|
1285
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: import_twind6.tw`flex flex-col flex-grow overflow-auto gap-3 p-4`, children: selectedFeatures.flat(1)?.map((data) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1286
|
-
InfoBarPanel,
|
|
1287
|
-
{
|
|
1288
|
-
data
|
|
1289
|
-
},
|
|
1290
|
-
selectedLayers?.[0]?.source.type === "raster" || selectionStyle === SELECTION_STYLE.ALL ? data?.sourceLayer : data?.sourceLayer + data?.properties[PROPERTY_ID]
|
|
1291
|
-
)) })
|
|
1292
|
-
]
|
|
1293
|
-
}
|
|
1294
|
-
);
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
// src/components/infobar/index.tsx
|
|
1298
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1299
|
-
function InfoBar() {
|
|
1300
|
-
const { layer, isInfoBarOpen, setIsInfoBarOpen } = useLayers();
|
|
1301
|
-
if (!layer.selectedFeatures?.length) return null;
|
|
1302
|
-
const toggleOpen = () => setIsInfoBarOpen(!isInfoBarOpen);
|
|
1303
|
-
return isInfoBarOpen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InfoBarContent, { onClose: toggleOpen }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InfobarButton, { onClick: toggleOpen });
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
// src/components/sidebar/index.tsx
|
|
1307
|
-
var import_react9 = require("react");
|
|
1308
|
-
var import_maplibre2 = require("react-map-gl/maplibre");
|
|
1309
|
-
|
|
1310
|
-
// src/components/sidebar/tabs.tsx
|
|
1311
|
-
var import_naksha_commons12 = require("@biodiv-platform/naksha-commons");
|
|
1312
|
-
var import_twind18 = require("twind");
|
|
1313
|
-
|
|
1314
|
-
// src/components/sidebar/layers/index.tsx
|
|
1315
|
-
var import_twind15 = require("twind");
|
|
1316
|
-
|
|
1317
|
-
// src/components/sidebar/layers/layer-list.tsx
|
|
1318
|
-
var import_react8 = __toESM(require("react"), 1);
|
|
1319
|
-
var import_react_virtual = require("react-virtual");
|
|
1320
|
-
var import_react_virtualized_auto_sizer = require("react-virtualized-auto-sizer");
|
|
1321
|
-
var import_twind13 = require("twind");
|
|
1322
|
-
|
|
1323
|
-
// src/components/sidebar/common/layer-item.tsx
|
|
1324
|
-
var import_naksha_commons8 = require("@biodiv-platform/naksha-commons");
|
|
1325
|
-
var import_react7 = require("react");
|
|
1326
|
-
var import_react_web_share = require("react-web-share");
|
|
1327
|
-
var import_twind12 = require("twind");
|
|
1328
|
-
|
|
1329
|
-
// src/components/core/highlighter.tsx
|
|
1330
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1331
|
-
var Highlighted = ({ text = "", highlight = "" }) => {
|
|
1332
|
-
if (!highlight.trim()) {
|
|
1333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: text });
|
|
1334
|
-
}
|
|
1335
|
-
const regex = new RegExp(`(${highlight})`, "gi");
|
|
1336
|
-
const parts = text.split(regex);
|
|
1337
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: parts.filter((part) => part).map(
|
|
1338
|
-
(part, i) => regex.test(part) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("mark", { children: part }, i) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: part }, i)
|
|
1339
|
-
) });
|
|
1340
|
-
};
|
|
1341
|
-
|
|
1342
|
-
// src/components/sidebar/common/grid-legend.tsx
|
|
1343
|
-
var import_twind8 = require("twind");
|
|
1344
|
-
|
|
1345
|
-
// src/components/sidebar/common/moreless.tsx
|
|
1346
|
-
var import_naksha_commons5 = require("@biodiv-platform/naksha-commons");
|
|
1347
|
-
var import_react4 = require("react");
|
|
1348
|
-
var import_twind7 = require("twind");
|
|
1349
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1350
|
-
function MoreLess({ children }) {
|
|
1351
|
-
const [showMore, setShowMore] = (0, import_react4.useState)(false);
|
|
1352
|
-
const { t } = (0, import_naksha_commons5.useT)();
|
|
1353
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
1354
|
-
showMore && children,
|
|
1355
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1356
|
-
"button",
|
|
1357
|
-
{
|
|
1358
|
-
onClick: () => setShowMore(!showMore),
|
|
1359
|
-
className: import_twind7.tw`text-blue-600 focus:outline-none focus:outline focus:ring`,
|
|
1360
|
-
children: showMore ? t("less") : t("legend")
|
|
1361
|
-
}
|
|
1362
|
-
)
|
|
1363
|
-
] });
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
// src/components/sidebar/common/grid-legend.tsx
|
|
1367
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1368
|
-
function GridLegend({ item }) {
|
|
1369
|
-
const { layer } = useLayers();
|
|
1370
|
-
const legendInfo = layer.gridLegends[item.id];
|
|
1371
|
-
if (!legendInfo) return null;
|
|
1372
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MoreLess, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("ul", { style: { margin: 0, padding: 0 }, children: [
|
|
1373
|
-
legendInfo?.stops.map(([stop, color], index, stopsArr) => {
|
|
1374
|
-
const prevStop = (stopsArr[index - 1] || [0])[0];
|
|
1375
|
-
if (prevStop === stop) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {}, color);
|
|
1376
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: import_twind8.tw`flex gap-2 items-center mb-1`, children: [
|
|
1377
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { viewBox: "0 0 24 24", height: "14", width: "14", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1378
|
-
"circle",
|
|
1379
|
-
{
|
|
1380
|
-
cx: "12",
|
|
1381
|
-
fill: color,
|
|
1382
|
-
cy: "12",
|
|
1383
|
-
r: "12",
|
|
1384
|
-
stroke: "none"
|
|
1385
|
-
}
|
|
1386
|
-
) }),
|
|
1387
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
1388
|
-
prevStop,
|
|
1389
|
-
" - ",
|
|
1390
|
-
stop
|
|
1391
|
-
] })
|
|
1392
|
-
] }, color);
|
|
1393
|
-
}),
|
|
1394
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { children: [
|
|
1395
|
-
"1 Square = ",
|
|
1396
|
-
legendInfo?.squareSize,
|
|
1397
|
-
" x ",
|
|
1398
|
-
legendInfo?.squareSize,
|
|
1399
|
-
" km"
|
|
1400
|
-
] })
|
|
1401
|
-
] }) });
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
// src/components/sidebar/common/info-popover.tsx
|
|
1405
|
-
var import_naksha_commons6 = require("@biodiv-platform/naksha-commons");
|
|
1406
|
-
var import_react5 = require("react");
|
|
1407
|
-
var import_react_tiny_popover = require("react-tiny-popover");
|
|
1408
|
-
var import_twind9 = require("twind");
|
|
1409
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1410
|
-
var LayerInfoLine = ({
|
|
1411
|
-
icon,
|
|
1412
|
-
name,
|
|
1413
|
-
title,
|
|
1414
|
-
link,
|
|
1415
|
-
children
|
|
1416
|
-
}) => {
|
|
1417
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: children || "-" });
|
|
1418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1419
|
-
"div",
|
|
1420
|
-
{
|
|
1421
|
-
className: import_twind9.tw`flex gap-3 text-sm text-gray-600 break-all`,
|
|
1422
|
-
title: name && title && `${name}: ${title}`,
|
|
1423
|
-
children: [
|
|
1424
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: icon }),
|
|
1425
|
-
link ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1426
|
-
"a",
|
|
1427
|
-
{
|
|
1428
|
-
className: import_twind9.tw`text-blue-700 focus:outline-none focus:ring`,
|
|
1429
|
-
target: "_blank",
|
|
1430
|
-
rel: "noopener",
|
|
1431
|
-
href: link,
|
|
1432
|
-
children: content
|
|
1433
|
-
}
|
|
1434
|
-
) : content
|
|
1435
|
-
]
|
|
1436
|
-
}
|
|
1437
|
-
);
|
|
1438
|
-
};
|
|
1439
|
-
function InfoPopover({ item, containerStyle }) {
|
|
1440
|
-
const { t } = (0, import_naksha_commons6.useT)();
|
|
1441
|
-
const { layer, mp } = useLayers();
|
|
1442
|
-
const license = item.license || "CC-BY";
|
|
1443
|
-
const createdOn = item?.createdDate && new Date(item.createdDate).toLocaleDateString();
|
|
1444
|
-
const tags = item.tags?.join(", ");
|
|
1445
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1446
|
-
"div",
|
|
1447
|
-
{
|
|
1448
|
-
className: import_twind9.tw`flex flex-col gap-1 bg-white p-4 rounded-lg w-72 border border-gray-300 border-solid`,
|
|
1449
|
-
style: containerStyle,
|
|
1450
|
-
children: [
|
|
1451
|
-
mp.managePublishing && item.layerStatus && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1452
|
-
LayerInfoLine,
|
|
1453
|
-
{
|
|
1454
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EyeIcon, {}),
|
|
1455
|
-
name: t("visiblity"),
|
|
1456
|
-
title: item.layerStatus,
|
|
1457
|
-
children: [
|
|
1458
|
-
item.layerStatus,
|
|
1459
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1460
|
-
"button",
|
|
1461
|
-
{
|
|
1462
|
-
className: import_twind9.tw`text-blue-600 focus:outline-none ml-4`,
|
|
1463
|
-
onClick: () => layer.togglePublish(item.id, item?.layerStatus),
|
|
1464
|
-
children: t("toggle")
|
|
1465
|
-
}
|
|
1466
|
-
),
|
|
1467
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1468
|
-
"button",
|
|
1469
|
-
{
|
|
1470
|
-
className: import_twind9.tw`text-red-600 focus:outline-none ml-4`,
|
|
1471
|
-
onClick: () => layer.delete(item.id, t("are_you_sure")),
|
|
1472
|
-
children: t("delete")
|
|
1473
|
-
}
|
|
1474
|
-
)
|
|
1475
|
-
]
|
|
1476
|
-
}
|
|
1477
|
-
),
|
|
1478
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1479
|
-
LayerInfoLine,
|
|
1480
|
-
{
|
|
1481
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AttributionIcon, {}),
|
|
1482
|
-
link: item.url,
|
|
1483
|
-
name: t("uploader"),
|
|
1484
|
-
title: item.createdBy,
|
|
1485
|
-
children: item.createdBy
|
|
1486
|
-
}
|
|
1487
|
-
),
|
|
1488
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1489
|
-
LayerInfoLine,
|
|
1490
|
-
{
|
|
1491
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AttributionIcon, {}),
|
|
1492
|
-
link: item.url,
|
|
1493
|
-
name: t("created_by"),
|
|
1494
|
-
title: item.attribution,
|
|
1495
|
-
children: item.attribution
|
|
1496
|
-
}
|
|
1497
|
-
),
|
|
1498
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1499
|
-
LayerInfoLine,
|
|
1500
|
-
{
|
|
1501
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ClockIcon, {}),
|
|
1502
|
-
name: t("created_on"),
|
|
1503
|
-
title: createdOn,
|
|
1504
|
-
children: createdOn
|
|
1505
|
-
}
|
|
1506
|
-
),
|
|
1507
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1508
|
-
LayerInfoLine,
|
|
1509
|
-
{
|
|
1510
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TagIcon, {}),
|
|
1511
|
-
name: t("tags"),
|
|
1512
|
-
title: tags,
|
|
1513
|
-
children: tags
|
|
1514
|
-
}
|
|
1515
|
-
),
|
|
1516
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1517
|
-
LayerInfoLine,
|
|
1518
|
-
{
|
|
1519
|
-
name: t("license"),
|
|
1520
|
-
title: license,
|
|
1521
|
-
link: license && import_naksha_commons6.LICENSES[license],
|
|
1522
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LicenseIcon, {}),
|
|
1523
|
-
children: license
|
|
1524
|
-
}
|
|
1525
|
-
)
|
|
1526
|
-
]
|
|
1527
|
-
}
|
|
1528
|
-
);
|
|
1529
|
-
}
|
|
1530
|
-
var PopoverWrapper = ({ item }) => {
|
|
1531
|
-
const [isPopoverOpen, setIsPopoverOpen] = (0, import_react5.useState)(false);
|
|
1532
|
-
const togglePopover = () => setIsPopoverOpen(!isPopoverOpen);
|
|
1533
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1534
|
-
import_react_tiny_popover.Popover,
|
|
1535
|
-
{
|
|
1536
|
-
isOpen: isPopoverOpen,
|
|
1537
|
-
padding: 10,
|
|
1538
|
-
positions: ["right"],
|
|
1539
|
-
containerStyle: { zIndex: 99 },
|
|
1540
|
-
onClickOutside: togglePopover,
|
|
1541
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InfoPopover, { item }),
|
|
1542
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1543
|
-
Button,
|
|
1544
|
-
{
|
|
1545
|
-
onClick: togglePopover,
|
|
1546
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InfoIcon, {}),
|
|
1547
|
-
title: "Information"
|
|
1548
|
-
}
|
|
1549
|
-
)
|
|
1550
|
-
}
|
|
1551
|
-
);
|
|
1552
|
-
};
|
|
1553
|
-
|
|
1554
|
-
// src/components/sidebar/common/layer-item-style.tsx
|
|
1555
|
-
var import_twind11 = require("twind");
|
|
1556
|
-
|
|
1557
|
-
// src/components/sidebar/common/style-legend.tsx
|
|
1558
|
-
var import_react6 = require("react");
|
|
1559
|
-
var import_naksha_commons7 = require("@biodiv-platform/naksha-commons");
|
|
1560
|
-
var import_twind10 = require("twind");
|
|
1561
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1562
|
-
function StyleLegend({ item }) {
|
|
1563
|
-
const [showImage, setShowImage] = (0, import_react6.useState)(true);
|
|
1564
|
-
const { mp } = useLayers();
|
|
1565
|
-
const { t } = (0, import_naksha_commons7.useT)();
|
|
1566
|
-
const legendStyles = (0, import_react6.useMemo)(
|
|
1567
|
-
() => item?.data?.styles?.[item.data.styleIndex]?.colors?.paint?.["fill-color"]?.stops || item?.data?.styles?.[item.data.styleIndex]?.colors?.paint?.["circle-color"]?.stops || [],
|
|
1568
|
-
[item]
|
|
1569
|
-
);
|
|
1570
|
-
const vectorLegend = () => {
|
|
1571
|
-
return legendStyles.map(([title, color]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: import_twind10.tw`flex gap-2 items-center mb-1`, children: [
|
|
1572
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 24 24", height: "14", width: "14", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "12", fill: color, cy: "12", r: "12", stroke: "none" }) }),
|
|
1573
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: title })
|
|
1574
|
-
] }, color));
|
|
1575
|
-
};
|
|
1576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { style: { margin: 0, padding: 0 }, children: item.layerType !== "RASTER" ? vectorLegend() : showImage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1577
|
-
"img",
|
|
1578
|
-
{
|
|
1579
|
-
style: { margin: "5px" },
|
|
1580
|
-
onError: () => setShowImage(false),
|
|
1581
|
-
src: `${mp?.geoserver?.endpoint}/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&WIDTH=20&HEIGHT=20&STRICT=false&layer=biodiv:${item.id}`
|
|
1582
|
-
}
|
|
1583
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: t("raster_style_not_found") }) });
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
// src/components/sidebar/common/layer-item-style.tsx
|
|
1587
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1588
|
-
function LayerItemStyle({ item }) {
|
|
1589
|
-
if (!item.data?.styles) return null;
|
|
1590
|
-
const { layer } = useLayers();
|
|
1591
|
-
const onStyleChange = (e) => {
|
|
1592
|
-
layer.updateStyle(item.id, Number(e.target.value));
|
|
1593
|
-
};
|
|
1594
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: import_twind11.tw`flex flex-col gap-4 pt-2`, children: [
|
|
1595
|
-
item.layerType !== "RASTER" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectInput, { onChange: onStyleChange, children: item.data?.styles.map((opt, idx) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: idx, children: opt.styleTitle }, idx)) }),
|
|
1596
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MoreLess, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyleLegend, { item }) })
|
|
1597
|
-
] });
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
// src/components/sidebar/common/layer-item.tsx
|
|
1601
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1602
|
-
function DragHandle({
|
|
1603
|
-
dragHandleProps
|
|
1604
|
-
}) {
|
|
1605
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1606
|
-
"div",
|
|
1607
|
-
{
|
|
1608
|
-
className: import_twind12.tw`mt-1 w-6 text-center cursor-move`,
|
|
1609
|
-
style: { touchAction: "none" },
|
|
1610
|
-
...dragHandleProps,
|
|
1611
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GrabberIcon, {})
|
|
1612
|
-
}
|
|
1613
|
-
);
|
|
1614
|
-
}
|
|
1615
|
-
function LayerItem({
|
|
1616
|
-
item,
|
|
1617
|
-
extended,
|
|
1618
|
-
dragHandleProps
|
|
1619
|
-
}) {
|
|
1620
|
-
const { t } = (0, import_naksha_commons8.useT)();
|
|
1621
|
-
const {
|
|
1622
|
-
layer,
|
|
1623
|
-
query,
|
|
1624
|
-
mp,
|
|
1625
|
-
query: { setClickedLngLat },
|
|
1626
|
-
setIsInfoBarOpen
|
|
1627
|
-
} = useLayers();
|
|
1628
|
-
const [isAdded, setIsAdded] = (0, import_react7.useState)(layer.selectedIds.includes(item.id));
|
|
1629
|
-
const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
|
|
1630
|
-
const shareData = (0, import_react7.useMemo)(
|
|
1631
|
-
() => mp.canLayerShare ? {
|
|
1632
|
-
url: `${window.location.href.split("?")[0]}?layers=${item.id}`,
|
|
1633
|
-
title: item.title
|
|
1634
|
-
} : void 0,
|
|
1635
|
-
[item.id]
|
|
1636
|
-
);
|
|
1637
|
-
const onToggleLayer = async () => {
|
|
1638
|
-
setIsLoading(true);
|
|
1639
|
-
setIsInfoBarOpen(true);
|
|
1640
|
-
layer.setSelectedFeatures([]);
|
|
1641
|
-
setClickedLngLat(null);
|
|
1642
|
-
await layer.toggle({ layerId: item.id, add: !isAdded });
|
|
1643
|
-
setIsAdded(!isAdded);
|
|
1644
|
-
setIsLoading(false);
|
|
1645
|
-
};
|
|
1646
|
-
const onDownloadLayer = async () => {
|
|
1647
|
-
await axDownloadLayer(
|
|
1648
|
-
mp.nakshaApiEndpoint,
|
|
1649
|
-
mp.nakshaEndpointToken,
|
|
1650
|
-
item.id,
|
|
1651
|
-
item.title
|
|
1652
|
-
);
|
|
1653
|
-
mp?.onLayerDownload(item.id);
|
|
1654
|
-
};
|
|
1655
|
-
const handleOnZoom = () => layer.zoomToExtent(item.id);
|
|
1656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1657
|
-
"div",
|
|
1658
|
-
{
|
|
1659
|
-
className: import_twind12.tw`z-20 p-3 bg-white`,
|
|
1660
|
-
style: { borderTop: "1px solid #e5e7eb" },
|
|
1661
|
-
children: [
|
|
1662
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: import_twind12.tw`flex gap-3`, children: [
|
|
1663
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: import_twind12.tw`flex-shrink-0`, children: [
|
|
1664
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1665
|
-
CheckboxInput,
|
|
1666
|
-
{
|
|
1667
|
-
name: item.id,
|
|
1668
|
-
checked: isAdded,
|
|
1669
|
-
onChange: onToggleLayer,
|
|
1670
|
-
isLoading
|
|
1671
|
-
}
|
|
1672
|
-
),
|
|
1673
|
-
extended && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DragHandle, { dragHandleProps })
|
|
1674
|
-
] }),
|
|
1675
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1676
|
-
"img",
|
|
1677
|
-
{
|
|
1678
|
-
className: import_twind12.tw`flex-shrink-0 overflow-hidden h-16 w-16 p-1 mb-2 object-cover border border-gray-200 rounded`,
|
|
1679
|
-
src: item.thumbnail || FALLBACK_THUMB
|
|
1680
|
-
}
|
|
1681
|
-
),
|
|
1682
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
1683
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1684
|
-
"div",
|
|
1685
|
-
{
|
|
1686
|
-
title: item.title,
|
|
1687
|
-
className: import_twind12.tw`mb-1 leading-tight`,
|
|
1688
|
-
style: overflowStyle,
|
|
1689
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Highlighted, { text: item.title, highlight: query.term })
|
|
1690
|
-
}
|
|
1691
|
-
),
|
|
1692
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1693
|
-
"p",
|
|
1694
|
-
{
|
|
1695
|
-
title: item.description,
|
|
1696
|
-
className: import_twind12.tw`text-gray-600 text-sm`,
|
|
1697
|
-
style: overflowStyle2,
|
|
1698
|
-
children: item.description
|
|
1699
|
-
}
|
|
1700
|
-
)
|
|
1701
|
-
] })
|
|
1702
|
-
] }),
|
|
1703
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: import_twind12.tw`flex justify-between`, children: [
|
|
1704
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Button, { onClick: onDownloadLayer, disabled: !item.isDownloadable, children: [
|
|
1705
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DownloadIcon, {}),
|
|
1706
|
-
" ",
|
|
1707
|
-
t("download")
|
|
1708
|
-
] }),
|
|
1709
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: import_twind12.tw`flex gap-3`, children: [
|
|
1710
|
-
shareData && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_web_share.RWebShare, { data: shareData, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { title: "Share", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ShareIcon, {}) }) }),
|
|
1711
|
-
extended && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1712
|
-
Button,
|
|
1713
|
-
{
|
|
1714
|
-
onClick: handleOnZoom,
|
|
1715
|
-
title: "Zoom To Extent",
|
|
1716
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ZoomExtentIcon, {})
|
|
1717
|
-
}
|
|
1718
|
-
),
|
|
1719
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PopoverWrapper, { item })
|
|
1720
|
-
] })
|
|
1721
|
-
] }),
|
|
1722
|
-
extended && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LayerItemStyle, { item }),
|
|
1723
|
-
extended && item.source.type === "grid" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GridLegend, { item })
|
|
1724
|
-
]
|
|
1725
|
-
}
|
|
1726
|
-
);
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
// src/components/sidebar/layers/layer-list.tsx
|
|
1730
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1731
|
-
function LayerList() {
|
|
1732
|
-
const { layer, query } = useLayers();
|
|
1733
|
-
const filteredLayers = (0, import_react8.useMemo)(
|
|
1734
|
-
() => query.term ? layer.all.filter(
|
|
1735
|
-
(_l) => _l.title.toLowerCase().includes(query.term.toLowerCase())
|
|
1736
|
-
) : layer.all,
|
|
1737
|
-
[layer.all, query.term]
|
|
1738
|
-
);
|
|
1739
|
-
const parentRef = import_react8.default.useRef();
|
|
1740
|
-
const rowVirtualizer = (0, import_react_virtual.useVirtual)({
|
|
1741
|
-
size: filteredLayers.length,
|
|
1742
|
-
parentRef
|
|
1743
|
-
});
|
|
1744
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: import_twind13.tw`flex-grow-1 relative`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_virtualized_auto_sizer.AutoSizer, { disableWidth: true, children: (p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1745
|
-
"div",
|
|
1746
|
-
{
|
|
1747
|
-
ref: parentRef,
|
|
1748
|
-
className: "List",
|
|
1749
|
-
style: { height: p.height, overflow: "auto" },
|
|
1750
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1751
|
-
"div",
|
|
1752
|
-
{
|
|
1753
|
-
style: {
|
|
1754
|
-
height: rowVirtualizer.totalSize,
|
|
1755
|
-
width: "100%",
|
|
1756
|
-
position: "relative"
|
|
1757
|
-
},
|
|
1758
|
-
children: rowVirtualizer.virtualItems.map((virtualRow) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1759
|
-
"div",
|
|
1760
|
-
{
|
|
1761
|
-
ref: virtualRow.measureRef,
|
|
1762
|
-
className: import_twind13.tw`absolute top-0 left-0 w-full`,
|
|
1763
|
-
style: { transform: `translateY(${virtualRow.start}px)` },
|
|
1764
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { height: 146 }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerItem, { item: filteredLayers[virtualRow.index] }) })
|
|
1765
|
-
},
|
|
1766
|
-
virtualRow.index
|
|
1767
|
-
))
|
|
1768
|
-
}
|
|
1769
|
-
)
|
|
1770
|
-
}
|
|
1771
|
-
) }) });
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
// src/components/sidebar/layers/search.tsx
|
|
1775
|
-
var import_naksha_commons9 = require("@biodiv-platform/naksha-commons");
|
|
1776
|
-
var import_twind14 = require("twind");
|
|
1777
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1778
|
-
function LayerSearch() {
|
|
1779
|
-
const { t } = (0, import_naksha_commons9.useT)();
|
|
1780
|
-
const { query } = useLayers();
|
|
1781
|
-
const handleOnSearchChange = (e) => query.setTerm(e.target.value);
|
|
1782
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: import_twind14.tw`flex-shrink-0 border-b-2 p-4`, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1783
|
-
SearchInput,
|
|
1784
|
-
{
|
|
1785
|
-
name: "lyr_search",
|
|
1786
|
-
placeholder: t("find_layer_by_name"),
|
|
1787
|
-
onChange: handleOnSearchChange
|
|
1788
|
-
}
|
|
1789
|
-
) });
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
// src/components/sidebar/layers/index.tsx
|
|
1793
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1794
|
-
function LayersTabPanel() {
|
|
1795
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: import_twind15.tw`flex flex-col w-full`, children: [
|
|
1796
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LayerSearch, {}),
|
|
1797
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LayerList, {})
|
|
1798
|
-
] });
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
// src/utils/array-move.ts
|
|
1802
|
-
function arrayMoveMutable(array, fromIndex, toIndex) {
|
|
1803
|
-
const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;
|
|
1804
|
-
if (startIndex >= 0 && startIndex < array.length) {
|
|
1805
|
-
const endIndex = toIndex < 0 ? array.length + toIndex : toIndex;
|
|
1806
|
-
const [item] = array.splice(fromIndex, 1);
|
|
1807
|
-
array.splice(endIndex, 0, item);
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
function arrayMoveImmutable(array, fromIndex, toIndex) {
|
|
1811
|
-
array = [...array];
|
|
1812
|
-
arrayMoveMutable(array, fromIndex, toIndex);
|
|
1813
|
-
return array;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
// src/components/sidebar/selected/selected-item-list.tsx
|
|
1817
|
-
var import_core9 = require("@dnd-kit/core");
|
|
1818
|
-
var import_sortable = require("@dnd-kit/sortable");
|
|
1819
|
-
var import_utilities = require("@dnd-kit/utilities");
|
|
1820
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1821
|
-
function SortableSelectedItem({ item, extended }) {
|
|
1822
|
-
const {
|
|
1823
|
-
attributes,
|
|
1824
|
-
listeners,
|
|
1825
|
-
setNodeRef,
|
|
1826
|
-
transform,
|
|
1827
|
-
transition,
|
|
1828
|
-
isDragging
|
|
1829
|
-
} = (0, import_sortable.useSortable)({
|
|
1830
|
-
id: item.id
|
|
1831
|
-
});
|
|
1832
|
-
const style = {
|
|
1833
|
-
transform: import_utilities.CSS.Transform.toString(transform),
|
|
1834
|
-
transition,
|
|
1835
|
-
opacity: isDragging ? 0.5 : 1
|
|
1836
|
-
};
|
|
1837
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref: setNodeRef, style, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1838
|
-
LayerItem,
|
|
1839
|
-
{
|
|
1840
|
-
item,
|
|
1841
|
-
extended,
|
|
1842
|
-
dragHandleProps: { ...attributes, ...listeners }
|
|
1843
|
-
}
|
|
1844
|
-
) });
|
|
1845
|
-
}
|
|
1846
|
-
var SelectedItemList = ({
|
|
1847
|
-
layerList,
|
|
1848
|
-
onSortEnd
|
|
1849
|
-
}) => {
|
|
1850
|
-
const sensors = (0, import_core9.useSensors)(
|
|
1851
|
-
(0, import_core9.useSensor)(import_core9.PointerSensor, { activationConstraint: { distance: 4 } })
|
|
1852
|
-
);
|
|
1853
|
-
const handleDragEnd = (event) => {
|
|
1854
|
-
const { active, over } = event;
|
|
1855
|
-
if (over && active.id !== over.id) {
|
|
1856
|
-
const oldIndex = layerList.findIndex((item) => item.id === active.id);
|
|
1857
|
-
const newIndex = layerList.findIndex((item) => item.id === over.id);
|
|
1858
|
-
if (oldIndex !== -1 && newIndex !== -1) {
|
|
1859
|
-
onSortEnd({ oldIndex, newIndex });
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
};
|
|
1863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1864
|
-
import_core9.DndContext,
|
|
1865
|
-
{
|
|
1866
|
-
sensors,
|
|
1867
|
-
collisionDetection: import_core9.closestCenter,
|
|
1868
|
-
onDragEnd: handleDragEnd,
|
|
1869
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1870
|
-
import_sortable.SortableContext,
|
|
1871
|
-
{
|
|
1872
|
-
items: layerList.map((item) => item.id),
|
|
1873
|
-
strategy: import_sortable.verticalListSortingStrategy,
|
|
1874
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: layerList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SortableSelectedItem, { item, extended: true }, item.id)) })
|
|
1875
|
-
}
|
|
1876
|
-
)
|
|
1877
|
-
}
|
|
1878
|
-
);
|
|
1879
|
-
};
|
|
1880
|
-
|
|
1881
|
-
// src/components/sidebar/selected/index.tsx
|
|
1882
|
-
var import_naksha_commons10 = require("@biodiv-platform/naksha-commons");
|
|
1883
|
-
var import_twind16 = require("twind");
|
|
1884
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1885
|
-
function SelectedTabPanel() {
|
|
1886
|
-
const { layer } = useLayers();
|
|
1887
|
-
const { t } = (0, import_naksha_commons10.useT)();
|
|
1888
|
-
const onSortEnd = ({ oldIndex, newIndex }) => {
|
|
1889
|
-
layer.setSelectedIds(
|
|
1890
|
-
arrayMoveImmutable(layer.selectedIds, oldIndex, newIndex)
|
|
1891
|
-
);
|
|
1892
|
-
};
|
|
1893
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: import_twind16.tw`flex flex-col gap-3 w-full`, children: [
|
|
1894
|
-
layer.selectedIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: import_twind16.tw`p-3 pb-0`, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Button, { onClick: () => layer.clearAll(), children: [
|
|
1895
|
-
"\u2715 ",
|
|
1896
|
-
t("clear")
|
|
1897
|
-
] }) }),
|
|
1898
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1899
|
-
SelectedItemList,
|
|
1900
|
-
{
|
|
1901
|
-
layerList: layer.selectedLayers,
|
|
1902
|
-
useDragHandle: true,
|
|
1903
|
-
onSortEnd
|
|
1904
|
-
}
|
|
1905
|
-
)
|
|
1906
|
-
] });
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
// src/components/sidebar/settings/index.tsx
|
|
1910
|
-
var import_naksha_commons11 = require("@biodiv-platform/naksha-commons");
|
|
1911
|
-
var import_twind17 = require("twind");
|
|
1912
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1913
|
-
function SettingsTabPanel() {
|
|
1914
|
-
const { layer } = useLayers();
|
|
1915
|
-
const { t } = (0, import_naksha_commons11.useT)();
|
|
1916
|
-
const handleOnStyleChange = (e) => {
|
|
1917
|
-
layer.setMapStyle(e.target.value);
|
|
1918
|
-
layer.setMaxZoom(
|
|
1919
|
-
layer.mapStyles.find((ms) => ms.style === e.target.value)?.maxZoom
|
|
1920
|
-
);
|
|
1921
|
-
};
|
|
1922
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: import_twind17.tw`w-full p-4 flex flex-col gap-4`, children: [
|
|
1923
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1924
|
-
SelectInput,
|
|
1925
|
-
{
|
|
1926
|
-
name: "base_style",
|
|
1927
|
-
label: t("base_style"),
|
|
1928
|
-
defaultValue: layer.mapStyle,
|
|
1929
|
-
onChange: handleOnStyleChange,
|
|
1930
|
-
children: layer.mapStyles.map((ms) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: ms.style, children: ms.text }, ms.key))
|
|
1931
|
-
}
|
|
1932
|
-
),
|
|
1933
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LayerSelection, {})
|
|
1934
|
-
] });
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
// src/components/sidebar/tabs.tsx
|
|
1938
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1939
|
-
function SidebarTabs({ onClose }) {
|
|
1940
|
-
const { t } = (0, import_naksha_commons12.useT)();
|
|
1941
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1942
|
-
"div",
|
|
1943
|
-
{
|
|
1944
|
-
className: import_twind18.tw`absolute top-0 right-0 bottom-0 left-0 md:right-auto md:top-4 md:left-4 md:bottom-4 bg-white rounded-lg shadow-md md:max-w-sm w-full z-20 overflow-hidden`,
|
|
1945
|
-
children: [
|
|
1946
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CloseButton, { onClick: onClose }),
|
|
1947
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: import_twind18.tw`flex flex-col h-full`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_tabs.Tabs, { children: [
|
|
1948
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(TabHeader, { children: [
|
|
1949
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconTab, { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersIcon, {}), children: t("layers") }),
|
|
1950
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconTab, { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersIcon, {}), children: t("selected") }),
|
|
1951
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconTab, { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SlidersIcon, {}), children: t("settings") })
|
|
1952
|
-
] }),
|
|
1953
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LayersTabPanel, {}) }),
|
|
1954
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectedTabPanel, {}) }),
|
|
1955
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SettingsTabPanel, {}) })
|
|
1956
|
-
] }) })
|
|
1957
|
-
]
|
|
1958
|
-
}
|
|
1959
|
-
);
|
|
1960
|
-
}
|
|
1961
|
-
|
|
1962
|
-
// src/components/sidebar/index.tsx
|
|
1963
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1964
|
-
function Sidebar() {
|
|
1965
|
-
const { mp, layer } = useLayers();
|
|
1966
|
-
const [isOpen, setIsOpen] = (0, import_react9.useState)(mp.showToC);
|
|
1967
|
-
const { mapl } = (0, import_maplibre2.useMap)();
|
|
1968
|
-
const toggleOpen = () => setIsOpen(!isOpen);
|
|
1969
|
-
async function loadToC() {
|
|
1970
|
-
const _layers = await axGetGeoserverLayers(
|
|
1971
|
-
mp.nakshaEndpointToken,
|
|
1972
|
-
mp.nakshaApiEndpoint,
|
|
1973
|
-
mp.geoserver,
|
|
1974
|
-
mp.selectedLayers
|
|
1975
|
-
);
|
|
1976
|
-
const _newLayers = [...mp.layers || [], ..._layers];
|
|
1977
|
-
layer.setAll(_newLayers);
|
|
1978
|
-
if (layer.selectedIds.length) {
|
|
1979
|
-
const _layer = _newLayers.find((l) => l.id === layer.selectedIds[0]);
|
|
1980
|
-
_layer?.bbox && mapl?.fitBounds(_layer.bbox, { padding: 40, duration: 1e3 });
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
(0, import_react9.useEffect)(() => {
|
|
1984
|
-
if (mapl && mp.loadToC) {
|
|
1985
|
-
loadToC();
|
|
1986
|
-
}
|
|
1987
|
-
}, [mapl]);
|
|
1988
|
-
return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SidebarTabs, { onClose: toggleOpen }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LayersButton, { onClick: toggleOpen });
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
// src/components/map/layers/index.tsx
|
|
1992
|
-
var import_maplibre6 = require("react-map-gl/maplibre");
|
|
1993
|
-
|
|
1994
|
-
// src/components/map/layers/grid/index.tsx
|
|
1995
|
-
var import_bbox = __toESM(require("@turf/bbox"), 1);
|
|
1996
|
-
var import_react10 = require("react");
|
|
1997
|
-
var import_maplibre3 = require("react-map-gl/maplibre");
|
|
1998
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1999
|
-
function GridLayer({
|
|
2000
|
-
data,
|
|
2001
|
-
beforeId
|
|
2002
|
-
}) {
|
|
2003
|
-
const { layer } = useLayers();
|
|
2004
|
-
const { mapl } = (0, import_maplibre3.useMap)();
|
|
2005
|
-
const [layerData, setLayerData] = (0, import_react10.useState)({ geojson: {}, paint: {} });
|
|
2006
|
-
const isSelected = layer.selectedIds.includes(data.id);
|
|
2007
|
-
const isLastSelected = layer.selectedIds[0] === data.id;
|
|
2008
|
-
const fetchGridData = async (shouldFitBounds = false) => {
|
|
2009
|
-
const { success, geojson, paint: paint2, stops, squareSize } = await getGridLayerData(
|
|
2010
|
-
data.source.fetcher,
|
|
2011
|
-
mapl?.getBounds(),
|
|
2012
|
-
mapl?.getZoom()
|
|
2013
|
-
);
|
|
2014
|
-
if (success) {
|
|
2015
|
-
setLayerData({ geojson, paint: paint2 });
|
|
2016
|
-
if (shouldFitBounds && isLastSelected && data.zoomToFit) {
|
|
2017
|
-
try {
|
|
2018
|
-
const [minLon, minLat, maxLon, maxLat] = (0, import_bbox.default)(geojson);
|
|
2019
|
-
mapl?.fitBounds(
|
|
2020
|
-
[
|
|
2021
|
-
[minLon, minLat],
|
|
2022
|
-
[maxLon, maxLat]
|
|
2023
|
-
],
|
|
2024
|
-
{ padding: 40, animate: true }
|
|
2025
|
-
);
|
|
2026
|
-
} catch (e) {
|
|
2027
|
-
console.warn("Failed to compute bbox", e);
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
layer.setGridLegends({
|
|
2031
|
-
[data.id]: { stops, squareSize }
|
|
2032
|
-
});
|
|
2033
|
-
}
|
|
2034
|
-
};
|
|
2035
|
-
(0, import_react10.useEffect)(() => {
|
|
2036
|
-
if (isSelected && isLastSelected) {
|
|
2037
|
-
fetchGridData(true);
|
|
2038
|
-
} else if (isSelected) {
|
|
2039
|
-
fetchGridData(false);
|
|
2040
|
-
}
|
|
2041
|
-
}, [isSelected, isLastSelected]);
|
|
2042
|
-
(0, import_react10.useEffect)(() => {
|
|
2043
|
-
if (!isSelected || !mapl) return;
|
|
2044
|
-
const handleIdle = () => fetchGridData(false);
|
|
2045
|
-
mapl.on("idle", handleIdle);
|
|
2046
|
-
return () => {
|
|
2047
|
-
mapl.off("idle", handleIdle);
|
|
2048
|
-
};
|
|
2049
|
-
}, [isSelected, mapl]);
|
|
2050
|
-
(0, import_react10.useEffect)(() => {
|
|
2051
|
-
return () => {
|
|
2052
|
-
layer.setGridLegends((prev) => {
|
|
2053
|
-
const newLegends = { ...prev };
|
|
2054
|
-
delete newLegends[data.id];
|
|
2055
|
-
return newLegends;
|
|
2056
|
-
});
|
|
2057
|
-
};
|
|
2058
|
-
}, [data.id]);
|
|
2059
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_maplibre3.Source, { id: data.id, type: "geojson", data: layerData.geojson, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2060
|
-
import_maplibre3.Layer,
|
|
2061
|
-
{
|
|
2062
|
-
beforeId,
|
|
2063
|
-
id: data.id,
|
|
2064
|
-
type: "fill",
|
|
2065
|
-
paint: layerData.paint
|
|
2066
|
-
}
|
|
2067
|
-
) });
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
// src/components/map/layers/vector/index.tsx
|
|
2071
|
-
var import_react11 = require("react");
|
|
2072
|
-
var import_maplibre4 = require("react-map-gl/maplibre");
|
|
2073
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2074
|
-
var paint = {
|
|
2075
|
-
fill: {
|
|
2076
|
-
"line-color": "red",
|
|
2077
|
-
"line-width": 2
|
|
2078
|
-
},
|
|
2079
|
-
circle: {
|
|
2080
|
-
"circle-stroke-color": "red",
|
|
2081
|
-
"circle-stroke-width": 2,
|
|
2082
|
-
"circle-opacity": 0
|
|
2083
|
-
}
|
|
2084
|
-
};
|
|
2085
|
-
function VectorLayer({ layer: data, beforeId }) {
|
|
2086
|
-
const { layer } = useLayers();
|
|
2087
|
-
const layerProps = (0, import_react11.useMemo)(
|
|
2088
|
-
() => data.data?.styles?.[data.data?.styleIndex]?.colors,
|
|
2089
|
-
[data, layer.selectedFeatures]
|
|
2090
|
-
);
|
|
2091
|
-
const highlightData = layer.selectedFeaturesId?.[data.id];
|
|
2092
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_maplibre4.Source, { ...data.source, children: [
|
|
2093
|
-
layerProps && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_maplibre4.Layer, { beforeId, ...layerProps }),
|
|
2094
|
-
highlightData && layerProps && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2095
|
-
import_maplibre4.Layer,
|
|
2096
|
-
{
|
|
2097
|
-
...layerProps,
|
|
2098
|
-
beforeId,
|
|
2099
|
-
id: `hl_${data.id}`,
|
|
2100
|
-
filter: ["in", PROPERTY_ID, ...highlightData],
|
|
2101
|
-
type: layerProps.type === "fill" ? "line" : layerProps.type,
|
|
2102
|
-
paint: paint[layerProps.type]
|
|
2103
|
-
}
|
|
2104
|
-
)
|
|
2105
|
-
] });
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
// src/components/map/layers/raster/index.tsx
|
|
2109
|
-
var import_maplibre5 = require("react-map-gl/maplibre");
|
|
2110
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2111
|
-
function RasterLayer({
|
|
2112
|
-
data,
|
|
2113
|
-
beforeId
|
|
2114
|
-
}) {
|
|
2115
|
-
const { mp } = useLayers();
|
|
2116
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2117
|
-
import_maplibre5.Source,
|
|
2118
|
-
{
|
|
2119
|
-
id: data.id,
|
|
2120
|
-
type: "raster",
|
|
2121
|
-
tiles: [
|
|
2122
|
-
`${mp?.geoserver?.endpoint}/wms?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&width=256&height=256&transparent=true&layers=biodiv:${data.id}`
|
|
2123
|
-
],
|
|
2124
|
-
tileSize: 256,
|
|
2125
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2126
|
-
import_maplibre5.Layer,
|
|
2127
|
-
{
|
|
2128
|
-
id: data.id,
|
|
2129
|
-
beforeId,
|
|
2130
|
-
type: "raster",
|
|
2131
|
-
source: "biodiv",
|
|
2132
|
-
layout: { visibility: "visible" },
|
|
2133
|
-
paint: {}
|
|
2134
|
-
}
|
|
2135
|
-
)
|
|
2136
|
-
}
|
|
2137
|
-
);
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
// src/components/map/layers/index.tsx
|
|
2141
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2142
|
-
function MapLayer({
|
|
2143
|
-
layer,
|
|
2144
|
-
beforeId
|
|
2145
|
-
}) {
|
|
2146
|
-
const { mapl } = (0, import_maplibre6.useMap)();
|
|
2147
|
-
if (!mapl) {
|
|
2148
|
-
return null;
|
|
2149
|
-
}
|
|
2150
|
-
switch (layer.source.type) {
|
|
2151
|
-
case "vector":
|
|
2152
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(VectorLayer, { beforeId, layer });
|
|
2153
|
-
case "grid":
|
|
2154
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(GridLayer, { beforeId, data: layer });
|
|
2155
|
-
case "raster":
|
|
2156
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RasterLayer, { beforeId, data: layer });
|
|
2157
|
-
default:
|
|
2158
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(VectorLayer, { beforeId, layer });
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
// src/components/map/markers-list/index.tsx
|
|
2163
|
-
var import_react12 = require("react");
|
|
2164
|
-
var import_maplibre7 = require("react-map-gl/maplibre");
|
|
2165
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2166
|
-
var Marker1 = import_maplibre7.Marker;
|
|
2167
|
-
var MarkersList = () => {
|
|
2168
|
-
const { mp } = useLayers();
|
|
2169
|
-
const markersMemoized = (0, import_react12.useMemo)(() => mp.markers, [mp.markers]);
|
|
2170
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: markersMemoized?.map(
|
|
2171
|
-
({ latitude, longitude, colorHex, anchor = "bottom", iconUrl }, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2172
|
-
Marker1,
|
|
2173
|
-
{
|
|
2174
|
-
latitude,
|
|
2175
|
-
longitude,
|
|
2176
|
-
anchor,
|
|
2177
|
-
subpixelPositioning: true,
|
|
2178
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2179
|
-
"img",
|
|
2180
|
-
{
|
|
2181
|
-
style: {
|
|
2182
|
-
cursor: "pointer",
|
|
2183
|
-
display: "block",
|
|
2184
|
-
width: "25px",
|
|
2185
|
-
height: "41px"
|
|
2186
|
-
},
|
|
2187
|
-
width: 25,
|
|
2188
|
-
height: 41,
|
|
2189
|
-
alt: "Marker",
|
|
2190
|
-
src: iconUrl || "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png"
|
|
2191
|
-
}
|
|
2192
|
-
)
|
|
2193
|
-
},
|
|
2194
|
-
index
|
|
2195
|
-
)
|
|
2196
|
-
) });
|
|
2197
|
-
};
|
|
2198
|
-
var markers_list_default = MarkersList;
|
|
2199
|
-
|
|
2200
|
-
// src/components/map/popup/index.tsx
|
|
2201
|
-
var import_clsx3 = __toESM(require("clsx"), 1);
|
|
2202
|
-
var import_maplibre8 = require("react-map-gl/maplibre");
|
|
2203
|
-
var import_twind19 = require("twind");
|
|
2204
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2205
|
-
var Pop = import_maplibre8.Popup;
|
|
2206
|
-
function HoverPopup({ coordinates }) {
|
|
2207
|
-
const { hover } = useLayers();
|
|
2208
|
-
return coordinates?.lat && hover.features ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2209
|
-
Pop,
|
|
2210
|
-
{
|
|
2211
|
-
latitude: coordinates.lat,
|
|
2212
|
-
longitude: coordinates.lng,
|
|
2213
|
-
closeButton: false,
|
|
2214
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("table", { className: import_twind19.tw`table-auto border`, children: [
|
|
2215
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("th", { className: import_twind19.tw`bg-gray-200 py-1 px-2`, colSpan: 2, children: hover.features.title }) }) }),
|
|
2216
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("tbody", { children: hover.features.data.map(([k, v], idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2217
|
-
"tr",
|
|
2218
|
-
{
|
|
2219
|
-
className: (0, import_twind19.tw)(
|
|
2220
|
-
(0, import_clsx3.default)({
|
|
2221
|
-
"bg-gray-50": idx % 2 === 0,
|
|
2222
|
-
"border-gray-100 border-t": 1
|
|
2223
|
-
})
|
|
2224
|
-
),
|
|
2225
|
-
children: [
|
|
2226
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: import_twind19.tw`py-1 px-2`, children: k }),
|
|
2227
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: import_twind19.tw`py-1 px-2 border-l border-gray-100`, children: v })
|
|
2228
|
-
]
|
|
2229
|
-
},
|
|
2230
|
-
k + v
|
|
2231
|
-
)) })
|
|
2232
|
-
] })
|
|
2233
|
-
}
|
|
2234
|
-
) : null;
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
// src/components/map/index.tsx
|
|
2238
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2239
|
-
var NavControl = import_maplibre9.NavigationControl;
|
|
2240
|
-
function Map2() {
|
|
2241
|
-
const { mp, layer, hover, query } = useLayers();
|
|
2242
|
-
const [coordinates, setCoordinates] = (0, import_react13.useState)();
|
|
2243
|
-
const viewState = (0, import_react13.useMemo)(
|
|
2244
|
-
() => mp.defaultViewState || import_naksha_commons13.defaultViewState,
|
|
2245
|
-
[mp.defaultViewState]
|
|
2246
|
-
);
|
|
2247
|
-
const onMapClick = (e) => query.setClickedLngLat(e.lngLat);
|
|
2248
|
-
const handleOnMouseMove = (event) => {
|
|
2249
|
-
setCoordinates(event.lngLat);
|
|
2250
|
-
hover.onHover(event);
|
|
2251
|
-
};
|
|
2252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: import_twind20.tw`h-full w-full relative bg-gray-100`, children: [
|
|
2253
|
-
mp.loadToC && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Sidebar, {}),
|
|
2254
|
-
layer.selectedFeatures?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(InfoBar, {}),
|
|
2255
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2256
|
-
import_maplibre9.default,
|
|
2257
|
-
{
|
|
2258
|
-
id: "mapl",
|
|
2259
|
-
cursor: "default",
|
|
2260
|
-
initialViewState: viewState,
|
|
2261
|
-
style: { width: "100%", height: "100%" },
|
|
2262
|
-
mapStyle: layer.mapStyle,
|
|
2263
|
-
maxZoom: layer.maxZoom,
|
|
2264
|
-
onClick: onMapClick,
|
|
2265
|
-
onMouseMove: handleOnMouseMove,
|
|
2266
|
-
children: [
|
|
2267
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2268
|
-
NavControl,
|
|
2269
|
-
{
|
|
2270
|
-
position: "bottom-right",
|
|
2271
|
-
showZoom: true,
|
|
2272
|
-
showCompass: true
|
|
2273
|
-
}
|
|
2274
|
-
),
|
|
2275
|
-
mp.showFullscreenControl && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_maplibre9.FullscreenControl, { position: "bottom-right" }),
|
|
2276
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(markers_list_default, {}),
|
|
2277
|
-
layer.selectedLayers.map((_l, index) => {
|
|
2278
|
-
const beforeId = index > 0 ? layer.selectedIds[index - 1] : void 0;
|
|
2279
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MapLayer, { layer: _l, beforeId }, _l.id);
|
|
2280
|
-
}),
|
|
2281
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(HoverPopup, { coordinates }, "popup")
|
|
2282
|
-
]
|
|
2283
|
-
}
|
|
2284
|
-
)
|
|
2285
|
-
] });
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
|
-
// src/index.tsx
|
|
2289
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2290
|
-
(0, import_twind21.setup)({ preflight: false });
|
|
2291
|
-
var NakshaMaplibreLayers = (props) => {
|
|
2292
|
-
const mp = import_react14.default.useMemo(
|
|
2293
|
-
() => ({ ...defaultNakshaProps, ...props }),
|
|
2294
|
-
[props]
|
|
2295
|
-
);
|
|
2296
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_maplibre10.MapProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_naksha_commons14.TranslationProvider, { localeStrings: locales_default, lang: mp.lang, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayersProvider, { mp, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Map2, {}) }) }) });
|
|
2297
|
-
};
|
|
2298
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2299
|
-
0 && (module.exports = {
|
|
2300
|
-
NakshaMaplibreLayers
|
|
2301
|
-
});
|
|
1
|
+
"use strict";var Vo=Object.create;var Ze=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var Zo=Object.getOwnPropertyNames;var Yo=Object.getPrototypeOf,Ko=Object.prototype.hasOwnProperty;var jo=(e,r)=>{for(var t in r)Ze(e,t,{get:r[t],enumerable:!0})},tr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Zo(r))!Ko.call(e,o)&&o!==t&&Ze(e,o,{get:()=>r[o],enumerable:!(n=Uo(r,o))||n.enumerable});return e};var T=(e,r,t)=>(t=e!=null?Vo(Yo(e)):{},tr(r||!e||!e.__esModule?Ze(t,"default",{value:e,enumerable:!0}):t,e)),Jo=e=>tr(Ze({},"__esModule",{value:!0}),e);var yn={};jo(yn,{NakshaMaplibreLayers:()=>fn});module.exports=Jo(yn);var Ho=require("@biodiv-platform/naksha-commons"),Fo=T(require("react"),1),$o=require("react-map-gl/maplibre"),Wo=require("twind");var rr={are_you_sure:"Are you sure?",base_style:"Base Style",clear:"Clear Selection",created_by:"Attribution",created_on:"Created On",delete:"Delete",download:"Download",find_layer_by_name:"Find layer by name",infobar:"Attributes at Clicked Location",information:"Information",layer_selection:"Layer Selection",layer_selection_all:"All Layers",layer_selection_top:"Top Layer Only",layers:"Layers",legend:"Legend",less:"Less",license:"License",list_layers:"List Layers",pending:"Pending",publish:"Publish",published:"Published",raster_style_not_found:"Style not available for the given layer",remove:"Remove",selected:"Selected",settings:"Settings",square:"Square",tags:"Tags",toggle:"Toggle Publishing",uploaded:"Uploaded",uploader:"Uploader",url:"URL",visiblity:"Visiblity"};var or={are_you_sure:"\xCAtes-vous s\xFBr?",base_style:"Style de base",clear:"Effacer la s\xE9lection",created_by:"Attribution",created_on:"Cr\xE9\xE9 sur",delete:"Effacer",download:"T\xE9l\xE9charger",find_layer_by_name:"Trouver la couche par nom",infobar:"Attributs \xE0 l'emplacement cliqu\xE9",information:"Informations",layer_selection_all:"Toutes les couches",layer_selection_top:"Couche sup\xE9rieure uniquement",layer_selection:"S\xE9lection de calque",layers:"Couches",legend:"L\xE9gende",less:"Moins",license:"Licence",list_layers:"Liste des couches",pending:"En attente",publish:"Publier",published:"Publi\xE9",remove:"Supprimer",selected:"Choisie",settings:"Param\xE8tres",square:"Carr\xE9",toggle:"Basculer la publication",uploaded:"T\xE9l\xE9charg\xE9",url:"url"};var nr={are_you_sure:"\u0915\u094D\u092F\u093E \u0906\u092A\u0915\u094B \u092F\u0915\u0940\u0928 \u0939\u0948?",base_style:"\u0906\u0927\u093E\u0930 \u0936\u0948\u0932\u0940",clear:"\u091A\u092F\u0928 \u0938\u093E\u092B\u093C \u0915\u0930\u0947\u0902",created_by:"\u0906\u0930\u094B\u092A\u0923",created_on:"\u092A\u0930 \u092C\u0928\u093E\u092F\u093E",delete:"\u0939\u091F\u093E\u090F\u0902",download:"\u0921\u093E\u0909\u0928\u0932\u094B\u0921",find_layer_by_name:"\u0928\u093E\u092E \u0938\u0947 \u092A\u0930\u0924 \u0916\u094B\u091C\u0947\u0902",infobar:"\u0915\u094D\u0932\u093F\u0915 \u0915\u093F\u090F \u0917\u090F \u0938\u094D\u0925\u093E\u0928 \u092A\u0930 \u0935\u093F\u0936\u0947\u0937\u0924\u093E\u090F\u0902",information:"\u091C\u093E\u0928\u0915\u093E\u0930\u0940",layer_selection_all:"\u0938\u092D\u0940 \u092A\u0930\u0924\u0947\u0902",layer_selection_top:"\u0915\u0947\u0935\u0932 \u0936\u0940\u0930\u094D\u0937 \u092A\u0930\u0924",layer_selection:"\u092A\u0930\u0924 \u091A\u092F\u0928",layers:"\u092A\u0930\u0924\u0947\u0902",legend:"\u0915\u093F\u0902\u0935\u0926\u0902\u0924\u0940",less:"\u0915\u092E",license:"\u0932\u093E\u0907\u0938\u0947\u0902\u0938",list_layers:"\u0938\u0942\u091A\u0940 \u092A\u0930\u0924\u0947\u0902",pending:"\u0932\u0902\u092C\u093F\u0924",publish:"\u092A\u094D\u0930\u0915\u093E\u0936\u093F\u0924",published:"\u092A\u094D\u0930\u0915\u093E\u0936\u093F\u0924",remove:"\u0939\u091F\u093E\u0928\u093E",selected:"\u091A\u092F\u0928\u093F\u0924",settings:"\u0938\u092E\u093E\u092F\u094B\u091C\u0928",square:"\u0938\u094D\u0915\u094D\u0935\u093E\u092F\u0930",tags:"\u091F\u0948\u0917",toggle:"\u092A\u094D\u0930\u0915\u093E\u0936\u0928 \u091F\u0949\u0917\u0932 \u0915\u0930\u0947\u0902",uploaded:"\u0905\u092A\u0932\u094B\u0921 \u0915\u093F\u092F\u093E \u0917\u092F\u093E",url:"\u092F\u0942\u0906\u0930\u090F\u0932"};var ar={en:rr,fr:or,hi:nr};var Go=require("@biodiv-platform/naksha-commons"),_=T(require("react"),1),xe=T(require("react-map-gl/maplibre"),1),Do=require("maplibre-gl"),zo=require("twind");var Je=require("@biodiv-platform/naksha-commons"),c=T(require("react"),1),xr=require("react-map-gl/maplibre");var fr=T(require("colorbrewer"),1),Y=T(require("redaxios"),1);var mt=T(require("boundingbox"),1),Ke=require("geohash");var Ye=require("@biodiv-platform/naksha-commons"),sr={defaultViewState:Ye.defaultViewState,nakshaApiEndpoint:"/naksha-api/api",geoserver:{endpoint:"/geoserver",workspace:"biodiv",store:"ibp"},mapStyle:Ye.MapStyles.MAP_STREETS,layers:[],selectedLayers:[]},ir="data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cpath fill='%23fff' d='M0 0h72v72H0z'/%3E%3Cpath d='M35.981 48.293l-13.853-10.77-3.045 2.368L36 53.048l16.917-13.157-3.064-2.387-13.872 10.789zM36 43.519l13.834-10.77 3.083-2.388L36 17.204 19.083 30.36l3.064 2.387L36 43.518z' fill='%23A0AEC0'/%3E%3C/svg%3E",pt={display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},lr={...pt,WebkitLineClamp:2},O="ogc_fid",pe={ACTIVE:"Active",PENDING:"Pending"},G={TOP:"layer_selection_top",ALL:"layer_selection_all"};var je=e=>e<6?[4,1,39.2]:e<7?[5,0,19.6]:e<8?[5,1,9.8]:e<9?[5,-1,4.9]:e<10?[6,0,2.45]:e<11?[6,1,1.225]:e<12?[7,0,.612]:e<13?[7,1,.306]:e<14?[7,-1,.153]:e<15?[8,0,.077]:[8,1,.039],ut="0123456789bcdefghjkmnpqrstuvwxyz",tn=(e,r,t)=>{t=t||16/2**(1-e.length&1)/4**r;let n=e.slice(0,-1),o=~~(ut.indexOf(e.slice(-1))/t);return[n+ut[t*o],n+ut[t*(o+1)-1]]},rn=function(e,r){var t=new Map,n=new Map;let o=[];for(let[a,s]of Object.entries(e)){let[l,d]=tn(a,r);n.set(l,d),t.has(l)||t.set(l,0),t.set(l,t.get(l)+s)}return t.forEach((a,s)=>{let l=Ke.GeoHash.decodeGeoHash(s),d=Ke.GeoHash.decodeGeoHash(n.get(s)),m=new mt.default({minlat:l.latitude[0],minlon:l.longitude[0],maxlat:d.latitude[1],maxlon:d.longitude[1]}).toGeoJSON();o.push({...m,properties:{count:a,[O]:s}})}),o},on=e=>{let r=[];for(let[t,n]of Object.entries(e)){let o=Ke.GeoHash.decodeGeoHash(t),a=new mt.default({minlat:o.latitude[0],minlon:o.longitude[0],maxlat:o.latitude[1],maxlon:o.longitude[1]}).toGeoJSON();r.push({...a,properties:{count:n,[O]:t}})}return r},cr=(e,r)=>({type:"FeatureCollection",features:Object.keys(e).length===0?[]:r===-1?on(e):rn(e,r)}),dr=(e,r)=>{let t=Object.values(e).sort((a,s)=>a-s),n=Math.floor(t.length/r),o=new Array(r-1).fill(0).map((a,s)=>t[n*(s+1)]);return o.push(t[t.length-1]),o};var pr=async(e,r,t,n)=>Promise.all((e||[]).map(async o=>{let a=n?.includes(o.name),s=o.layerType?.toLowerCase()==="raster",l={...o,id:o.name,thumbnail:r+o.thumbnail,source:{type:s?"raster":"vector",scheme:"tms",tiles:[`${t.endpoint}/gwc/service/tms/1.0.0/${t.workspace}:${o.name}@EPSG%3A900913@pbf/{z}/{x}/{y}.pbf`]},data:{styles:[]},isAdded:a};if(a&&!s){let d=await ft(l,0,r,t);return{...l,data:d}}return l})),ft=async(e,r,t,n)=>{let o=e.data||{styles:[]},a=o.layerName,s=o.styles?[...o.styles]:[],l=o.summaryColumn,d=o.titleColumn,m=o.propertyMap;if(s.length===0){let{success:f,data:y}=await ur(e.id,t);f&&y&&(a=y.layerName,s=(y.styles||[]).map(w=>({...w})),l=y.summaryColumn,d=y.titleColumn,m=Object.fromEntries((y.styles||[]).map(w=>[w.styleName,w.styleTitle])))}if(s[r]&&!s[r]?.colors){let f=await mr(e.id,n?.workspace,s[r].styleName,t);s[r]={...s[r],colors:f}}return{...o,layerName:a,styles:s,summaryColumn:l,titleColumn:d,propertyMap:m,styleIndex:r}};var yr=async(e,r,t,n)=>{try{let o=await Y.default.get(`${r}/layer/all`,{headers:{Authorization:e}});return await pr(o.data,r,t,n)}catch(o){return console.error(o),[]}},ur=async(e,r)=>{try{let{data:t}=await Y.default.get(`${r}/layer/onClick/${e}`);return{success:!0,data:t}}catch(t){return console.error(t),{success:!1}}},gr=async(e,r,t)=>{let n={service:"WMS",version:"1.1.1",request:"GetFeatureInfo",info_format:"application/json",width:100,height:100,x:50,y:50,srs:"EPSG:4326"};try{return{success:!0,data:(await Y.default.get(`${e}/${r}/wms`,{params:{...t,...n}})).data}}catch(o){return console.error(o),{success:!1,data:[]}}},hr=async(e,r,t,n)=>{try{return await Y.default.put(`${r}/layer/${n?"active":"pending"}/${t}`,{},{headers:{Authorization:e}}),!0}catch(o){return console.error(o),!1}},br=async(e,r,t)=>{try{return await Y.default.delete(`${r}/layer/${t}`,{headers:{Authorization:e}}),!0}catch(n){return console.error(n),!1}},mr=async(e,r,t,n)=>{try{return(await Y.default.get(`${n}/geoserver/workspaces/${r}/styles/${e}_${t}.mbstyle`)).data?.layers?.[0]}catch(o){return console.error(o),{}}},Lr=async(e,r,t,n=6,o="YlOrRd")=>{try{let[a,s,l]=je(t),{_ne:d,_sw:m}=r,f={top:d.lat,left:m.lng,bottom:m.lat,right:d.lng,geoAggegationPrecision:a},y=await e(f),w=cr(y,s),A=dr(y,n).map((U,ie)=>[U,fr.default[o][n][ie]]);return{success:!0,geojson:w,paint:{"fill-color":{property:"count",default:"yellow",stops:A},"fill-outline-color":"rgba(0,0,0,0.2)","fill-opacity":.7},stops:A,squareSize:l}}catch(a){return console.error(a),{success:!1,geojson:{},paint:{},stops:[],squareSize:0}}},vr=async(e,r,t,n)=>{try{await Y.default.post(`${e}/layer/download`,{layerName:t,layerTitle:n,attributeList:[],filterArray:[]},{headers:{Authorization:r}})}catch(o){console.error(o)}};var kr=require("react/jsx-runtime"),wr=(0,c.createContext)({}),Sr=({mp:e,children:r})=>{let[t,n]=(0,c.useState)(e),{mapl:o}=(0,xr.useMap)();(0,c.useEffect)(()=>{n(p=>({...p,...e}))},[e]);let[a,s]=(0,c.useState)(""),l=(0,Je.useDebounce)(a,500),d=t.mapStyles&&t.mapStyles.length>0?t.mapStyles:Je.defaultMapStyles,[m,f]=(0,c.useState)(d[t?.mapStyle||0]?.style),[y,w]=(0,c.useState)(d[t?.mapStyle||0]?.maxZoom),[I,A]=(0,c.useState)(G.TOP),[V,U]=(0,c.useState)({}),[ie,Fe]=(0,c.useState)(!0),[C,ct]=(0,c.useState)(),[k,B]=(0,c.useState)(e.layers||[]),[x,Z]=(0,c.useState)(t.selectedLayers||[]);(0,c.useEffect)(()=>{t.selectedLayers&&t.selectedLayers.join(",")!==x.join(",")&&Z(t.selectedLayers)},[t.selectedLayers]);let[le,$e]=(0,c.useState)(),[We,Ht]=(0,c.useState)(),Ft=(0,c.useMemo)(()=>{let p={};for(let g of We||[])p[g.sourceLayer]=[...p[g.sourceLayer]||[],g?.properties?.[O]];return Object.keys(p).length?p:void 0},[We]),we=c.default.useMemo(()=>{let p=k.filter(h=>x.includes(h.id)),g=new Array(x.length);for(let h of p){let v=x.findIndex(P=>h.id===P);v>-1&&(g[v]=h)}return g},[k,x]),ce=(0,c.useCallback)(p=>k.findIndex(g=>g.id===p),[k]),qe=(0,c.useCallback)((p,g)=>{B(h=>h.map(v=>v.id===p?{...v,...g}:v))},[]),Ve=(0,c.useCallback)(async(p,g,h)=>{let v=k[p];if(!v)return;let P=await ft(v,g,t.nakshaApiEndpoint,t.geoserver);qe(v.id,{data:P}),h&&o?.fitBounds(v.bbox,{padding:40,duration:1e3})},[k,t.nakshaApiEndpoint,t.geoserver,qe,o]),$t=(0,c.useCallback)(async(p,g)=>{let h=ce(p);Ve(h,g,!1)},[ce,Ve]),Wt=(0,c.useCallback)(async p=>{if(!(!x.length||!o))try{let g=x[0],h=o.queryRenderedFeatures(p.point,{layers:[g]});if(h.length){let v=h[0]?.id||h[0]?.properties?.[O];if(v===le?.id)return;let P=k[ce(g)];if(!P)return;let Se=P?.data?.summaryColumn?.map(Ue=>[P.data?.propertyMap?.[Ue]||Ue,h[0].properties?.[Ue]]);$e({id:v,title:P.title,data:Se||[],coordinates:p.lngLat})}else $e(v=>v!==void 0?void 0:v)}catch{}},[x,o,le?.id,k,ce]),qt=(0,c.useCallback)(async({layerId:p,add:g,styleIndex:h=0,focus:v=!0})=>{if(!g){Z(ke=>ke.filter(Ie=>p!==Ie));return}let P=ce(p),Se=k[P];Se?.source.type==="grid"?(Z(ke=>[p,...ke.filter(Ie=>Ie!==p)]),v&&Se?.bbox&&setTimeout(()=>{o?.fitBounds(Se.bbox,{padding:40,duration:1e3})},100)):(await Ve(P,h,v),Z(ke=>[p,...ke.filter(Ie=>Ie!==p)]))},[ce,k,o,Ve]),Vt=(0,c.useCallback)(async()=>Z([]),[]),Ut=(0,c.useCallback)((p,g)=>{n(h=>({...h,[p]:g}))},[]),Zt=(0,c.useCallback)((p,g)=>{let h=g===pe.PENDING;hr(t.nakshaEndpointToken,t.nakshaApiEndpoint,p,h),qe(p,{layerStatus:h?pe.ACTIVE:pe.PENDING})},[t.nakshaEndpointToken,t.nakshaApiEndpoint,qe]),Yt=(0,c.useCallback)(async(p,g)=>{confirm(g)&&(br(t.nakshaEndpointToken,t.nakshaApiEndpoint,p),B(h=>h.filter(v=>v.id!==p)))},[t.nakshaEndpointToken,t.nakshaApiEndpoint]),Kt=(0,c.useCallback)(p=>{let g=k.find(h=>h.id===p);g?.bbox&&o?.fitBounds(g.bbox,{padding:40,duration:1e3})},[k,o]),dt=(0,c.useCallback)(()=>C?[C.lng,C.lat,C.lng+.1,C.lat+.1]:[0,0,0,0],[C]),de=(0,c.useCallback)(p=>{if(!(!C||!o))try{let g=o.project([C.lng,C.lat]),h=o.queryRenderedFeatures(g,{layers:I===G.TOP?[x[0]]:x});if((p||I)===G.ALL){let v=we.filter(P=>P.layerType=="RASTER").map(P=>({sourceLayer:P.id,layerType:"raster",bbox:dt()}));h=[...h,...v]}Ht(we?.[0]?.layerType==="RASTER"&&I!==G.ALL?x.length&&h?.length?h:[{sourceLayer:x[0],layerType:"raster",bbox:dt()}]:h)}catch(g){console.error(g)}},[C,o,I,x,we,dt]),jt=(0,c.useCallback)(p=>{A(p),p===G.TOP&&de(p)},[de]),Jt=(0,c.useRef)(!0);(0,c.useEffect)(()=>{if(Jt.current){Jt.current=!1;return}t.onSelectedLayersChange&&t.onSelectedLayersChange(x)},[x]),(0,c.useEffect)(()=>{let p=setTimeout(de,300);return()=>clearTimeout(p)},[C,I,x,de]);let Xt=(0,c.useMemo)(()=>({mapStyle:m,featuresAtLatLng:de,setMapStyle:f,maxZoom:y,setMaxZoom:w,mapStyles:d,all:k,setAll:B,selectedIds:x,handleSelectStyle:jt,setSelectedIds:Z,selectedLayers:we,clearAll:Vt,toggle:qt,updateStyle:$t,selectedFeatures:We,selectedFeaturesId:Ft,setSelectedFeatures:Ht,togglePublish:Zt,delete:Yt,selectionStyle:I,setSelectionStyle:A,zoomToExtent:Kt,gridLegends:V,setGridLegends:U}),[m,de,y,d,k,x,jt,we,Vt,qt,$t,We,Ft,Zt,Yt,I,Kt,V]),Qt=(0,c.useMemo)(()=>({term:l,setTerm:s,clickedLngLat:C,setClickedLngLat:ct}),[l,C]),er=(0,c.useMemo)(()=>({onHover:Wt,features:le}),[Wt,le]),qo=(0,c.useMemo)(()=>({mp:t,updateMP:Ut,layer:Xt,query:Qt,isInfoBarOpen:ie,setIsInfoBarOpen:Fe,hover:er}),[t,Ut,Xt,Qt,ie,er]);return(0,kr.jsx)(wr.Provider,{value:qo,children:r})};function u(){return(0,c.useContext)(wr)}var Hr=T(require("react"),1),Pe=require("twind");var Ir=require("twind"),i=require("react/jsx-runtime"),Cr=()=>(0,i.jsx)("svg",{fill:"none",className:Ir.tw`w-5 h-5 text-gray-400`,width:"24",height:"24",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),Ce=()=>(0,i.jsxs)("svg",{width:"18",height:"18",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,i.jsx)("path",{d:"M12 2L2 7 12 12 22 7 12 2z"}),(0,i.jsx)("path",{d:"M2 17L12 22 22 17"}),(0,i.jsx)("path",{d:"M2 12L12 17 22 12"})]}),Xe=()=>(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,i.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),Pr=()=>(0,i.jsxs)("svg",{width:"18",height:"18",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,i.jsx)("path",{d:"M4 21L4 14"}),(0,i.jsx)("path",{d:"M4 10L4 3"}),(0,i.jsx)("path",{d:"M12 21L12 12"}),(0,i.jsx)("path",{d:"M12 8L12 3"}),(0,i.jsx)("path",{d:"M20 21L20 16"}),(0,i.jsx)("path",{d:"M20 12L20 3"}),(0,i.jsx)("path",{d:"M1 14L7 14"}),(0,i.jsx)("path",{d:"M9 8L15 8"}),(0,i.jsx)("path",{d:"M17 16L23 16"})]});function yt(){return(0,i.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",fill:"currentColor",d:"M5.5 3.5a2 2 0 100 4 2 2 0 000-4zM2 5.5a3.5 3.5 0 115.898 2.549 5.507 5.507 0 013.034 4.084.75.75 0 11-1.482.235 4.001 4.001 0 00-7.9 0 .75.75 0 01-1.482-.236A5.507 5.507 0 013.102 8.05 3.49 3.49 0 012 5.5zM11 4a.75.75 0 100 1.5 1.5 1.5 0 01.666 2.844.75.75 0 00-.416.672v.352a.75.75 0 00.574.73c1.2.289 2.162 1.2 2.522 2.372a.75.75 0 101.434-.44 5.01 5.01 0 00-2.56-3.012A3 3 0 0011 4z"})})}function Tr(){return(0,i.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",fill:"currentColor",d:"M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"})})}function Rr(){return(0,i.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",fill:"currentColor",d:"M8.75.75a.75.75 0 00-1.5 0V2h-.984c-.305 0-.604.08-.869.23l-1.288.737A.25.25 0 013.984 3H1.75a.75.75 0 000 1.5h.428L.066 9.192a.75.75 0 00.154.838l.53-.53-.53.53v.001l.002.002.002.002.006.006.016.015.045.04a3.514 3.514 0 00.686.45A4.492 4.492 0 003 11c.88 0 1.556-.22 2.023-.454a3.515 3.515 0 00.686-.45l.045-.04.016-.015.006-.006.002-.002.001-.002L5.25 9.5l.53.53a.75.75 0 00.154-.838L3.822 4.5h.162c.305 0 .604-.08.869-.23l1.289-.737a.25.25 0 01.124-.033h.984V13h-2.5a.75.75 0 000 1.5h6.5a.75.75 0 000-1.5h-2.5V3.5h.984a.25.25 0 01.124.033l1.29.736c.264.152.563.231.868.231h.162l-2.112 4.692a.75.75 0 00.154.838l.53-.53-.53.53v.001l.002.002.002.002.006.006.016.015.045.04a3.517 3.517 0 00.686.45A4.492 4.492 0 0013 11c.88 0 1.556-.22 2.023-.454a3.512 3.512 0 00.686-.45l.045-.04.01-.01.006-.005.006-.006.002-.002.001-.002-.529-.531.53.53a.75.75 0 00.154-.838L13.823 4.5h.427a.75.75 0 000-1.5h-2.234a.25.25 0 01-.124-.033l-1.29-.736A1.75 1.75 0 009.735 2H8.75V.75zM1.695 9.227c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327l-1.305 2.9zm10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327l-1.305 2.9z"})})}function Mr(){return(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",fill:"currentColor",d:"M1.679 7.932c.412-.621 1.242-1.75 2.366-2.717C5.175 4.242 6.527 3.5 8 3.5c1.473 0 2.824.742 3.955 1.715 1.124.967 1.954 2.096 2.366 2.717a.119.119 0 010 .136c-.412.621-1.242 1.75-2.366 2.717C10.825 11.758 9.473 12.5 8 12.5c-1.473 0-2.824-.742-3.955-1.715C2.92 9.818 2.09 8.69 1.679 8.068a.119.119 0 010-.136zM8 2c-1.981 0-3.67.992-4.933 2.078C1.797 5.169.88 6.423.43 7.1a1.619 1.619 0 000 1.798c.45.678 1.367 1.932 2.637 3.024C4.329 13.008 6.019 14 8 14c1.981 0 3.67-.992 4.933-2.078 1.27-1.091 2.187-2.345 2.637-3.023a1.619 1.619 0 000-1.798c-.45-.678-1.367-1.932-2.637-3.023C11.671 2.992 9.981 2 8 2zm0 8a2 2 0 100-4 2 2 0 000 4z"})})}function Er(){return(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",fill:"currentColor",d:"M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zm.5 4.75a.75.75 0 00-1.5 0v3.5a.75.75 0 00.471.696l2.5 1a.75.75 0 00.557-1.392L8.5 7.742V4.75z"})})}function Nr(){return(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",fill:"currentColor",d:"M7.47 10.78a.75.75 0 001.06 0l3.75-3.75a.75.75 0 00-1.06-1.06L8.75 8.44V1.75a.75.75 0 00-1.5 0v6.69L4.78 5.97a.75.75 0 00-1.06 1.06l3.75 3.75zM3.75 13a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5z"})})}function _r(){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline-block"},children:(0,i.jsx)("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}function Ar(){return(0,i.jsxs)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline-block"},children:[(0,i.jsx)("circle",{cx:"18",cy:"5",r:"3"}),(0,i.jsx)("circle",{cx:"6",cy:"12",r:"3"}),(0,i.jsx)("circle",{cx:"18",cy:"19",r:"3"}),(0,i.jsx)("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),(0,i.jsx)("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]})}function Br(){return(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16",style:{display:"inline-block"},children:(0,i.jsx)("path",{fillRule:"evenodd",d:"M10 13a1 1 0 100-2 1 1 0 000 2zm-4 0a1 1 0 100-2 1 1 0 000 2zm1-5a1 1 0 11-2 0 1 1 0 012 0zm3 1a1 1 0 100-2 1 1 0 000 2zm1-5a1 1 0 11-2 0 1 1 0 012 0zM6 5a1 1 0 100-2 1 1 0 000 2z"})})}function Or(){return(0,i.jsxs)("svg",{style:{display:"inline-block"},width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,i.jsx)("line",{x1:"22",y1:"12",x2:"18",y2:"12"}),(0,i.jsx)("line",{x1:"6",y1:"12",x2:"2",y2:"12"}),(0,i.jsx)("line",{x1:"12",y1:"6",x2:"12",y2:"2"}),(0,i.jsx)("line",{x1:"12",y1:"22",x2:"12",y2:"18"})]})}function Gr(){return(0,i.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline-block"},children:(0,i.jsx)("polyline",{points:"6 9 12 15 18 9"})})}function Dr(){return(0,i.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline-block"},children:(0,i.jsx)("polyline",{points:"18 15 12 9 6 15"})})}function zr(){return(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline-block"},children:[(0,i.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,i.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),(0,i.jsx)("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),(0,i.jsx)("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}var te=require("react/jsx-runtime"),K=Hr.default.forwardRef((e,r)=>(0,te.jsx)("button",{ref:r,type:"button",className:Pe.tw`h-8 px-3 py-2 rounded-md focus:outline-none focus:ring cursor-pointer text-md flex align-middle items-center gap-2 bg-gray-100 hover:bg-gray-200 text-gray-700 disabled:cursor-not-allowed disabled:bg-gray-100! disabled:opacity-50`,...e}));var Qe=e=>(0,te.jsx)("button",{className:Pe.tw`absolute top-0 right-0 h-12 w-12 bg-red-100 cursor-pointer hover:bg-red-200 text-red-800 text-lg`,children:"\u2715",...e}),Fr=e=>(0,te.jsx)("button",{className:Pe.tw`absolute top-4 left-4 rounded-lg z-10 h-10 w-10 bg-white cursor-pointer hover:bg-gray-100 text-gray-700 text-lg flex items-center justify-center`,...e,children:(0,te.jsx)(Ce,{})}),$r=e=>(0,te.jsx)("button",{className:Pe.tw`absolute top-4 right-4 rounded-lg z-10 h-10 w-10 bg-white cursor-pointer hover:bg-gray-100 text-gray-700 text-lg flex items-center justify-center`,...e,children:(0,te.jsx)(Xe,{})});var re=require("twind");var R=require("react/jsx-runtime");var ue=e=>(0,R.jsxs)("div",{children:[e.label&&(0,R.jsx)("label",{className:re.tw`text-gray-700`,htmlFor:e.name,children:e.label}),(0,R.jsx)("select",{id:e.name,name:e.name,className:re.tw`block w-full px-4 py-2 mt-2 text-gray-700 border bg-white border-gray-200 rounded-md focus:outline-none focus:ring appearance-none text-base`,style:{backgroundImage:`url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E")`,backgroundPosition:"right 0.75rem center",backgroundSize:"16px 12px",backgroundRepeat:"no-repeat"},...e})]}),Wr=e=>(0,R.jsxs)("div",{className:"relative",children:[(0,R.jsx)("span",{className:re.tw`absolute inset-y-0 left-0 flex items-center pl-3`,children:(0,R.jsx)(Cr,{})}),(0,R.jsx)("input",{type:"search",className:re.tw`w-full py-2 pl-10 pr-4 text-gray-700 bg-white border border-gray-300 text-base rounded-md focus:outline-none focus:ring`,...e})]}),qr=e=>e.isLoading?(0,R.jsx)("svg",{width:"20px",height:"20px",viewBox:"0 0 20 20",version:"1.1",className:re.tw`inline text-gray-200 animate-spin dark:text-gray-600`,children:(0,R.jsx)("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:(0,R.jsx)("g",{fill:"#212121",fillRule:"nonzero",children:(0,R.jsx)("path",{d:"M10,3 C6.13401,3 3,6.13401 3,10 C3,10.2761 2.77614,10.5 2.5,10.5 C2.22386,10.5 2,10.2761 2,10 C2,5.58172 5.58172,2 10,2 C14.4183,2 18,5.58172 18,10 C18,14.4183 14.4183,18 10,18 C9.72386,18 9.5,17.7761 9.5,17.5 C9.5,17.2239 9.72386,17 10,17 C13.866,17 17,13.866 17,10 C17,6.13401 13.866,3 10,3 Z"})})})}):(0,R.jsx)("input",{type:"checkbox",className:re.tw`w-5 h-5 border-gray-100 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80`,name:e.name,checked:e.checked,onChange:e.onChange});var oe=require("@bumaga/tabs"),Vr=T(require("clsx"),1),Te=require("twind"),me=require("react/jsx-runtime"),et=({children:e,icon:r})=>{let{onClick:t,isActive:n}=(0,oe.useTabState)(),o=(0,Vr.default)(["flex items-center justify-center h-12 px-2 py-2 bg-transparent -mb-px border-b-2 -px-1 whitespace-nowrap focus:outline-none w-full cursor-pointer",{"text-blue-600 border-blue-500":n,"text-gray-700 border-gray-300 hover:border-gray-400":!n}]);return(0,me.jsxs)("button",{className:(0,Te.tw)(o),onClick:t,children:[r,(0,me.jsx)("span",{className:Te.tw`ml-2 text-base`,children:e})]})},tt=({children:e})=>(0,oe.usePanelState)()?(0,me.jsx)("div",{className:Te.tw`w-full flex flex-grow-1 overflow-auto`,children:e}):null,Ur=({children:e})=>(0,me.jsx)("div",{className:Te.tw`flex flex-shrink-0 border-b border-gray-200 justify-around pr-12`,children:e});var ne=require("twind"),j=require("react/jsx-runtime"),Zr=({checked:e=!1,onChange:r,disabled:t=!1,label:n,title:o,id:a})=>(0,j.jsxs)("label",{htmlFor:a,title:o,className:ne.tw`inline-flex items-center gap-2 cursor-pointer select-none ${t?"opacity-50 cursor-not-allowed":""}`,children:[n&&(0,j.jsx)("span",{className:ne.tw`text-sm text-gray-600 font-normal`,children:n}),(0,j.jsxs)("span",{className:ne.tw`relative inline-flex items-center`,children:[(0,j.jsx)("input",{id:a,type:"checkbox",role:"switch","aria-checked":e,checked:e,disabled:t,onChange:s=>r?.(s.target.checked),className:ne.tw`sr-only`}),(0,j.jsx)("div",{className:ne.tw`w-8 h-4 rounded-full transition-colors duration-200 ease-in-out ${e?"bg-blue-600":"bg-gray-300"}`}),(0,j.jsx)("div",{className:ne.tw`absolute left-0.5 top-0.5 bg-white w-3 h-3 rounded-full shadow-sm transition-transform duration-200 ease-in-out ${e?"transform translate-x-4":""}`})]})]});var jr=require("@biodiv-platform/naksha-commons"),Ne=require("twind");var Yr=require("@biodiv-platform/naksha-commons");var gt=require("react/jsx-runtime");function Re({hideLabel:e}){let{layer:{selectionStyle:r,handleSelectStyle:t}}=u(),{t:n}=(0,Yr.useT)(),o=a=>{t(a.target.value)};return(0,gt.jsx)(ue,{name:"layer_selection",label:e?null:n("layer_selection"),defaultValue:r,onChange:o,children:Object.values(G).map(a=>(0,gt.jsx)("option",{value:a,children:n(a)},a))})}var Kr=T(require("clsx"),1),Ee=require("react"),Me=require("twind");var D=require("react/jsx-runtime");function ht({data:e}){let[r,t]=(0,Ee.useState)(!0),[n,o]=(0,Ee.useState)({title:e.sourceLayer,properties:[]}),{layer:a,mp:s,query:{clickedLngLat:l}}=u(),d=async()=>{let m,f=a.selectedLayers.find(y=>y.id===(e.sourceLayer||e.source));if(f.layerType.toLowerCase()==="raster"){let{data:y}=await gr(s.geoserver?.endpoint,s.geoserver?.workspace,{bbox:e.bbox.toString(),query_layers:`${s.geoserver?.workspace}:${f.id}`,layers:`${s.geoserver?.workspace}:${f.id}`});m=y?.features[0]?Object.entries(y.features[0]?.properties).map(([w,I])=>[I||"-"]):[]}else m=Object.entries(f?.data?.propertyMap||{}).map(([y,w])=>[w,e?.properties?.[y]||"-"]);o({title:f.title,properties:m})};return(0,Ee.useEffect)(()=>{d()},[l]),(0,D.jsxs)("div",{className:Me.tw`bg-gray-100 rounded-lg`,children:[(0,D.jsxs)("button",{className:(0,Me.tw)((0,Kr.default)(["px-4 h-10 flex items-center justify-between bg-gray-100 hover:bg-gray-200 transition-colors cursor-pointer w-full focus:outline-none focus:ring",{"bg-gray-200 rounded-t-lg":r,"rounded-lg":!r}])),onClick:()=>t(!r),children:[n.title," ",r?(0,D.jsx)(Dr,{}):(0,D.jsx)(Gr,{})]}),r&&(0,D.jsx)("div",{className:Me.tw`px-4 py-3 flex flex-col gap-3`,children:n.properties.map(([m,f],y)=>(0,D.jsxs)("div",{children:[(0,D.jsx)("div",{className:Me.tw`text-gray-600`,children:m}),(0,D.jsx)("div",{children:f})]},m+f+y))})]})}var M=require("react/jsx-runtime");function bt({onClose:e}){let{layer:{selectedFeatures:r,selectedLayers:t,selectionStyle:n}}=u(),{t:o}=(0,jr.useT)();return(0,M.jsxs)("div",{className:Ne.tw`absolute top-0 right-0 bottom-0 left-0 md:top-4 md:right-4 md:bottom-4 md:left-auto bg-white rounded-lg overflow-hidden shadow-md md:max-w-sm w-full z-20 flex flex-col`,children:[(0,M.jsxs)("div",{className:"flex w-full",children:[(0,M.jsxs)("div",{className:Ne.tw`h-12 px-4 flex items-center gap-3 flex-grow bg-gray-200`,children:[(0,M.jsx)(Or,{})," ",o("infobar")]}),(0,M.jsx)(Qe,{onClick:e})]}),(0,M.jsx)("div",{className:Ne.tw`bg-gray-100 p-4 flex-shrink-0 rt`,children:(0,M.jsx)(Re,{hideLabel:!0})}),(0,M.jsx)("div",{className:Ne.tw`flex flex-col flex-grow overflow-auto gap-3 p-4`,children:r.flat(1)?.map(a=>(0,M.jsx)(ht,{data:a},t?.[0]?.source.type==="raster"||n===G.ALL?a?.sourceLayer:a?.sourceLayer+a?.properties[O]))})]})}var Lt=require("react/jsx-runtime");function vt(){let{layer:e,isInfoBarOpen:r,setIsInfoBarOpen:t}=u();if(!e.selectedFeatures?.length)return null;let n=()=>t(!r);return r?(0,Lt.jsx)(bt,{onClose:n}):(0,Lt.jsx)($r,{onClick:n})}var W=T(require("react"),1),Io=require("react-map-gl/maplibre");var ko=require("@biodiv-platform/naksha-commons"),Mt=require("twind");var ho=require("twind");var at=T(require("react"),1),uo=require("react-virtual"),mo=require("react-virtualized-auto-sizer"),St=require("twind");var co=require("@biodiv-platform/naksha-commons"),Ae=require("react"),po=require("react-web-share"),F=require("twind");var J=require("react/jsx-runtime"),Jr=({text:e="",highlight:r=""})=>{if(!r.trim())return(0,J.jsx)(J.Fragment,{children:e});let t=new RegExp(`(${r})`,"gi"),n=e.split(t);return(0,J.jsx)(J.Fragment,{children:n.filter(o=>o).map((o,a)=>t.test(o)?(0,J.jsx)("mark",{children:o},a):(0,J.jsx)("span",{children:o},a))})};var to=require("twind");var Xr=require("@biodiv-platform/naksha-commons"),Qr=require("react"),eo=require("twind"),rt=require("react/jsx-runtime");function _e({children:e}){let[r,t]=(0,Qr.useState)(!1),{t:n}=(0,Xr.useT)();return(0,rt.jsxs)("div",{children:[r&&e,(0,rt.jsx)("button",{onClick:()=>t(!r),className:eo.tw`text-blue-600 focus:outline-none focus:outline focus:ring`,children:n(r?"less":"legend")})]})}var z=require("react/jsx-runtime");function xt({item:e}){let{layer:r}=u(),t=r.gridLegends[e.id];return t?(0,z.jsx)(_e,{children:(0,z.jsxs)("ul",{style:{margin:0,padding:0},children:[t?.stops.map(([n,o],a,s)=>{let l=(s[a-1]||[0])[0];return l===n?(0,z.jsx)("div",{},o):(0,z.jsxs)("li",{className:to.tw`flex gap-2 items-center mb-1`,children:[(0,z.jsx)("svg",{viewBox:"0 0 24 24",height:"14",width:"14",focusable:"false",children:(0,z.jsx)("circle",{cx:"12",fill:o,cy:"12",r:"12",stroke:"none"})}),(0,z.jsxs)("div",{children:[l," - ",n]})]},o)}),(0,z.jsxs)("li",{children:["1 Square = ",t?.squareSize," x ",t?.squareSize," km"]})]})}):null}var ot=require("@biodiv-platform/naksha-commons"),ro=require("react"),oo=require("react-tiny-popover"),X=require("twind");var b=require("react/jsx-runtime"),fe=({icon:e,name:r,title:t,link:n,children:o})=>{let a=(0,b.jsx)("span",{className:X.tw`flex-1`,children:o||"-"});return(0,b.jsxs)("div",{className:X.tw`flex items-center gap-3 text-sm text-gray-600 break-all`,title:r&&t&&`${r}: ${t}`,children:[(0,b.jsx)("div",{className:X.tw`flex-shrink-0`,children:e}),n?(0,b.jsx)("a",{className:X.tw`text-blue-700 focus:outline-none focus:ring flex-1`,target:"_blank",rel:"noopener",href:n,children:a}):a]})};function nn({item:e,containerStyle:r}){let{t}=(0,ot.useT)(),{layer:n,mp:o}=u(),a=e.license||"CC-BY",s=e?.createdDate&&new Date(e.createdDate).toLocaleDateString(),l=e.tags?.join(", ");return(0,b.jsxs)("div",{className:X.tw`flex flex-col gap-1 bg-white p-4 rounded-lg w-72 border border-gray-300 border-solid`,style:r,children:[o.managePublishing&&e.layerStatus&&(0,b.jsx)(fe,{icon:(0,b.jsx)(Mr,{}),name:t("visiblity"),title:e.layerStatus,children:(0,b.jsxs)("div",{className:X.tw`flex items-center gap-3`,children:[(0,b.jsx)("span",{children:e.layerStatus}),(0,b.jsx)(Zr,{label:t("published"),checked:e.layerStatus?.toLowerCase()===pe.ACTIVE.toLowerCase(),onChange:()=>n.togglePublish(e.id,e?.layerStatus)}),(0,b.jsx)("button",{type:"button",title:t("delete"),className:X.tw`text-red-500 hover:text-red-700 focus:outline-none cursor-pointer flex items-center p-0.5 rounded hover:bg-red-50 transition-colors`,onClick:()=>n.delete(e.id,t("are_you_sure")),children:(0,b.jsx)(zr,{})})]})}),(0,b.jsx)(fe,{icon:(0,b.jsx)(yt,{}),link:e.url,name:t("uploader"),title:e.createdBy,children:e.createdBy}),(0,b.jsx)(fe,{icon:(0,b.jsx)(yt,{}),link:e.url,name:t("created_by"),title:e.attribution,children:e.attribution}),(0,b.jsx)(fe,{icon:(0,b.jsx)(Er,{}),name:t("created_on"),title:s,children:s}),(0,b.jsx)(fe,{icon:(0,b.jsx)(Tr,{}),name:t("tags"),title:l,children:l}),(0,b.jsx)(fe,{name:t("license"),title:a,link:a&&ot.LICENSES[a],icon:(0,b.jsx)(Rr,{}),children:a})]})}var no=({item:e})=>{let[r,t]=(0,ro.useState)(!1),n=()=>t(!r);return(0,b.jsx)(oo.Popover,{isOpen:r,padding:10,positions:["right"],containerStyle:{zIndex:"99"},onClickOutside:n,content:(0,b.jsx)(nn,{item:e}),children:(0,b.jsx)(K,{onClick:n,children:(0,b.jsx)(Xe,{}),title:"Information"})})};var lo=require("twind");var nt=require("react"),ao=require("@biodiv-platform/naksha-commons"),so=require("twind");var H=require("react/jsx-runtime");function io({item:e}){let[r,t]=(0,nt.useState)(!0),{mp:n}=u(),{t:o}=(0,ao.useT)(),a=(0,nt.useMemo)(()=>e?.data?.styles?.[e.data.styleIndex]?.colors?.paint?.["fill-color"]?.stops||e?.data?.styles?.[e.data.styleIndex]?.colors?.paint?.["circle-color"]?.stops||[],[e]),s=()=>a.map(([l,d])=>(0,H.jsxs)("li",{className:so.tw`flex gap-2 items-center mb-1`,children:[(0,H.jsx)("svg",{viewBox:"0 0 24 24",height:"14",width:"14",focusable:"false",children:(0,H.jsx)("circle",{cx:"12",fill:d,cy:"12",r:"12",stroke:"none"})}),(0,H.jsx)("div",{children:l})]},d));return(0,H.jsx)("ul",{style:{margin:0,padding:0},children:e.layerType!=="RASTER"?s():r?(0,H.jsx)("li",{children:(0,H.jsx)("img",{style:{margin:"5px"},onError:()=>t(!1),src:`${n?.geoserver?.endpoint}/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&WIDTH=20&HEIGHT=20&STRICT=false&layer=biodiv:${e.id}`})}):(0,H.jsx)("div",{children:o("raster_style_not_found")})})}var ae=require("react/jsx-runtime");function wt({item:e}){if(!e.data?.styles)return null;let{layer:r}=u(),t=n=>{r.updateStyle(e.id,Number(n.target.value))};return(0,ae.jsxs)("div",{className:lo.tw`flex flex-col gap-4 pt-2`,children:[e.layerType!=="RASTER"&&(0,ae.jsx)(ue,{onChange:t,children:e.data?.styles.map((n,o)=>(0,ae.jsx)("option",{value:o,children:n.styleTitle},o))}),(0,ae.jsx)(_e,{children:(0,ae.jsx)(io,{item:e})})]})}var L=require("react/jsx-runtime");function an({dragHandleProps:e}){return(0,L.jsx)("div",{className:F.tw`mt-1 w-6 text-center cursor-move`,style:{touchAction:"none"},...e,children:(0,L.jsx)(Br,{})})}function Be({item:e,extended:r,dragHandleProps:t}){let{t:n}=(0,co.useT)(),{layer:o,query:a,mp:s,query:{setClickedLngLat:l},setIsInfoBarOpen:d}=u(),[m,f]=(0,Ae.useState)(o.selectedIds.includes(e.id)),[y,w]=(0,Ae.useState)(!1),I=(0,Ae.useMemo)(()=>s.canLayerShare?{url:typeof window<"u"?`${window.location.href.split("?")[0]}?layers=${e.id}`:"",title:e.title}:void 0,[s.canLayerShare,e.id,e.title]),A=async()=>{w(!0),d(!0),o.setSelectedFeatures([]),l(null),await o.toggle({layerId:e.id,add:!m}),f(!m),w(!1)},V=async()=>{await vr(s.nakshaApiEndpoint,s.nakshaEndpointToken,e.id,e.title),s?.onLayerDownload(e.id)},U=()=>o.zoomToExtent(e.id);return(0,L.jsxs)("div",{className:F.tw`z-20 p-3 bg-white`,style:{borderTop:"1px solid #e5e7eb"},children:[(0,L.jsxs)("div",{className:F.tw`flex gap-3`,children:[(0,L.jsxs)("div",{className:F.tw`flex-shrink-0`,children:[(0,L.jsx)(qr,{name:e.id,checked:m,onChange:A,isLoading:y}),r&&(0,L.jsx)(an,{dragHandleProps:t})]}),(0,L.jsx)("img",{className:F.tw`flex-shrink-0 overflow-hidden h-16 w-16 p-1 mb-2 object-cover border border-gray-200 rounded`,src:e.thumbnail||ir}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{title:e.title,className:F.tw`mb-1 leading-tight`,style:pt,children:(0,L.jsx)(Jr,{text:e.title,highlight:a.term})}),(0,L.jsx)("p",{title:e.description,className:F.tw`text-gray-600 text-sm`,style:lr,children:e.description})]})]}),(0,L.jsxs)("div",{className:F.tw`flex justify-between`,children:[(0,L.jsxs)(K,{onClick:V,disabled:!e.isDownloadable,children:[(0,L.jsx)(Nr,{})," ",n("download")]}),(0,L.jsxs)("div",{className:F.tw`flex gap-3`,children:[I&&(0,L.jsx)(po.RWebShare,{data:I,children:(0,L.jsx)(K,{title:"Share",children:(0,L.jsx)(Ar,{})})}),r&&(0,L.jsx)(K,{onClick:U,title:"Zoom To Extent",children:(0,L.jsx)(_r,{})}),(0,L.jsx)(no,{item:e})]})]}),r&&(0,L.jsx)(wt,{item:e}),r&&e.source.type==="grid"&&(0,L.jsx)(xt,{item:e})]})}var Q=require("react/jsx-runtime");function fo(){let{layer:e,query:r}=u(),t=(0,at.useMemo)(()=>r.term?e.all.filter(a=>a.title.toLowerCase().includes(r.term.toLowerCase())):e.all,[e.all,r.term]),n=at.default.useRef(null),o=(0,uo.useVirtual)({size:t.length,parentRef:n});return(0,Q.jsx)("div",{className:St.tw`flex-grow-1 relative`,children:(0,Q.jsx)(mo.AutoSizer,{renderProp:a=>(0,Q.jsx)("div",{ref:n,className:"List",style:{height:a.height,overflow:"auto"},children:(0,Q.jsx)("div",{style:{height:o.totalSize,width:"100%",position:"relative"},children:o.virtualItems.map(s=>(0,Q.jsx)("div",{ref:s.measureRef,className:St.tw`absolute top-0 left-0 w-full`,style:{transform:`translateY(${s.start}px)`},children:(0,Q.jsx)("div",{style:{height:146},children:(0,Q.jsx)(Be,{item:t[s.index]})})},s.index))})})})})}var yo=require("@biodiv-platform/naksha-commons"),go=require("twind");var kt=require("react/jsx-runtime");function It(){let{t:e}=(0,yo.useT)(),{query:r}=u(),t=n=>r.setTerm(n.target.value);return(0,kt.jsx)("div",{className:go.tw`flex-shrink-0 border-b-2 p-4`,children:(0,kt.jsx)(Wr,{name:"lyr_search",placeholder:e("find_layer_by_name"),onChange:t})})}var Oe=require("react/jsx-runtime");function Ct(){return(0,Oe.jsxs)("div",{className:ho.tw`flex flex-col w-full`,children:[(0,Oe.jsx)(It,{}),(0,Oe.jsx)(fo,{})]})}function sn(e,r,t){let n=r<0?e.length+r:r;if(n>=0&&n<e.length){let o=t<0?e.length+t:t,[a]=e.splice(r,1);e.splice(o,0,a)}}function bo(e,r,t){return e=[...e],sn(e,r,t),e}var $=require("@dnd-kit/core"),ye=require("@dnd-kit/sortable"),Lo=require("@dnd-kit/utilities");var se=require("react/jsx-runtime");function ln({item:e,extended:r}){let{attributes:t,listeners:n,setNodeRef:o,transform:a,transition:s,isDragging:l}=(0,ye.useSortable)({id:e.id}),d={transform:Lo.CSS.Transform.toString(a),transition:s,opacity:l?.5:1};return(0,se.jsx)("div",{ref:o,style:d,children:(0,se.jsx)(Be,{item:e,extended:r,dragHandleProps:{...t,...n}})})}var vo=({layerList:e,onSortEnd:r})=>{let t=(0,$.useSensors)((0,$.useSensor)($.PointerSensor,{activationConstraint:{distance:4}}));return(0,se.jsx)($.DndContext,{sensors:t,collisionDetection:$.closestCenter,onDragEnd:o=>{let{active:a,over:s}=o;if(s&&a.id!==s.id){let l=e.findIndex(m=>m.id===a.id),d=e.findIndex(m=>m.id===s.id);l!==-1&&d!==-1&&r({oldIndex:l,newIndex:d})}},children:(0,se.jsx)(ye.SortableContext,{items:e.map(o=>o.id),strategy:ye.verticalListSortingStrategy,children:(0,se.jsx)("div",{children:e.map(o=>(0,se.jsx)(ln,{item:o,extended:!0},o.id))})})})};var xo=require("@biodiv-platform/naksha-commons"),Pt=require("twind"),ge=require("react/jsx-runtime");function Tt(){let{layer:e}=u(),{t:r}=(0,xo.useT)(),t=({oldIndex:n,newIndex:o})=>{e.setSelectedIds(bo(e.selectedIds,n,o))};return(0,ge.jsxs)("div",{className:Pt.tw`flex flex-col gap-3 w-full`,children:[e.selectedIds.length>0&&(0,ge.jsx)("div",{className:Pt.tw`p-3 pb-0`,children:(0,ge.jsxs)(K,{onClick:()=>e.clearAll(),children:["\u2715 ",r("clear")]})}),(0,ge.jsx)(vo,{layerList:e.selectedLayers,useDragHandle:!0,onSortEnd:t})]})}var wo=require("@biodiv-platform/naksha-commons"),So=require("twind");var he=require("react/jsx-runtime");function Rt(){let{layer:e}=u(),{t:r}=(0,wo.useT)(),t=n=>{e.setMapStyle(n.target.value),e.setMaxZoom(e.mapStyles.find(o=>o.style===n.target.value)?.maxZoom)};return(0,he.jsxs)("div",{className:So.tw`w-full p-4 flex flex-col gap-4`,children:[(0,he.jsx)(ue,{name:"base_style",label:r("base_style"),defaultValue:e.mapStyle,onChange:t,children:e.mapStyles.map(n=>(0,he.jsx)("option",{value:n.style,children:n.text},n.key))}),(0,he.jsx)(Re,{})]})}var S=require("react/jsx-runtime");function Et({onClose:e}){let{t:r}=(0,ko.useT)();return(0,S.jsxs)("div",{className:Mt.tw`absolute top-0 right-0 bottom-0 left-0 md:right-auto md:top-4 md:left-4 md:bottom-4 bg-white rounded-lg shadow-md md:max-w-sm w-full z-20 overflow-hidden`,children:[(0,S.jsx)(Qe,{onClick:e}),(0,S.jsx)("div",{className:Mt.tw`flex flex-col h-full`,children:(0,S.jsxs)(oe.Tabs,{children:[(0,S.jsxs)(Ur,{children:[(0,S.jsx)(et,{icon:(0,S.jsx)(Ce,{}),children:r("layers")}),(0,S.jsx)(et,{icon:(0,S.jsx)(Ce,{}),children:r("selected")}),(0,S.jsx)(et,{icon:(0,S.jsx)(Pr,{}),children:r("settings")})]}),(0,S.jsx)(tt,{children:(0,S.jsx)(Ct,{})}),(0,S.jsx)(tt,{children:(0,S.jsx)(Tt,{})}),(0,S.jsx)(tt,{children:(0,S.jsx)(Rt,{})})]})})]})}var Nt=require("react/jsx-runtime");function _t(){let{mp:e,layer:r}=u(),[t,n]=(0,W.useState)(e.showToC),{mapl:o}=(0,Io.useMap)(),a=(0,W.useRef)(!1),s=W.default.useCallback(()=>n(d=>!d),[]),l=W.default.useCallback(async()=>{let d=await yr(e.nakshaEndpointToken,e.nakshaApiEndpoint,e.geoserver,e.selectedLayers),m=[...e.layers||[],...d];if(r.setAll(m),r.selectedIds.length){let f=m.find(y=>y.id===r.selectedIds[0]);f?.bbox&&o?.fitBounds(f.bbox,{padding:40,duration:1e3})}},[e.nakshaEndpointToken,e.nakshaApiEndpoint,e.geoserver,e.selectedLayers,e.layers,r.setAll,r.selectedIds,o]);return(0,W.useEffect)(()=>{e.loadToC&&!a.current&&(a.current=!0,l())},[e.loadToC]),(0,W.useEffect)(()=>{if(o&&r.selectedIds.length&&r.all?.length){let d=r.all.find(m=>m.id===r.selectedIds[0]);d?.bbox&&o.fitBounds(d.bbox,{padding:40,duration:1e3})}},[o]),t?(0,Nt.jsx)(Et,{onClose:s}):(0,Nt.jsx)(Fr,{onClick:s})}var q=require("maplibre-gl"),Co="https://unpkg.com/maplibre-gl@6.16.0/dist/maplibre-gl-worker.mjs";typeof window<"u"&&!q.config.WORKER_URL&&(q.config.WORKER_URL="/maplibre-gl-worker.mjs");var st=null;async function Po(e){return e?(q.config.WORKER_URL=e,e):q.config.WORKER_URL&&q.config.WORKER_URL!=="/maplibre-gl-worker.mjs"?q.config.WORKER_URL:typeof window>"u"?"":st||(st=(async()=>{try{let r=await fetch("/maplibre-gl-worker.mjs",{method:"HEAD"}),t=r.headers.get("content-type")||"";if(r.ok&&!t.includes("text/html"))return q.config.WORKER_URL="/maplibre-gl-worker.mjs","/maplibre-gl-worker.mjs"}catch{}return q.config.WORKER_URL=Co,Co})(),st)}var Mo=require("react-map-gl/maplibre");var To=T(require("@turf/bbox"),1),ee=require("react"),be=require("react-map-gl/maplibre");var At=require("react/jsx-runtime");function Bt({data:e,beforeId:r}){let{layer:t}=u(),{mapl:n}=(0,be.useMap)(),[o,a]=(0,ee.useState)({geojson:{},paint:{}}),s=(0,ee.useRef)(""),l=t.selectedIds.includes(e.id),d=t.selectedIds[0]===e.id,m=async(f=!1)=>{if(!n)return;let y=n.getBounds(),w=n.getZoom();if(!y)return;let[I]=je(w),{_ne:A,_sw:V}=y,U=`${A.lat.toFixed(4)},${V.lng.toFixed(4)},${V.lat.toFixed(4)},${A.lng.toFixed(4)},${I}`;if(U===s.current)return;s.current=U;let{success:ie,geojson:Fe,paint:C,stops:ct,squareSize:k}=await Lr(e.source.fetcher,y,w);if(ie){if(a({geojson:Fe,paint:C}),f&&d&&e.zoomToFit)try{let B=(0,To.default)(Fe);if(B.every(Number.isFinite)){let[x,Z,le,$e]=B;n.fitBounds([[x,Z],[le,$e]],{padding:40,animate:!0})}}catch(B){console.warn("Failed to compute bbox",B)}t.setGridLegends(B=>({...B,[e.id]:{stops:ct,squareSize:k}}))}};return(0,ee.useEffect)(()=>{l&&d?m(!0):l&&m(!1)},[l,d]),(0,ee.useEffect)(()=>{if(!l||!n)return;let f=()=>m(!1);return n.on("moveend",f),()=>{n.off("moveend",f)}},[l,n]),(0,ee.useEffect)(()=>()=>{t.setGridLegends(f=>{let y={...f};return delete y[e.id],y})},[e.id]),(0,At.jsx)(be.Source,{id:e.id,type:"geojson",data:o.geojson,children:(0,At.jsx)(be.Layer,{beforeId:r,id:e.id,type:"fill",paint:o.paint})})}var Ro=require("react"),Ge=require("react-map-gl/maplibre");var De=require("react/jsx-runtime"),cn={fill:{"line-color":"red","line-width":2},circle:{"circle-stroke-color":"red","circle-stroke-width":2,"circle-opacity":0}};function it({layer:e,beforeId:r}){let{layer:t}=u(),n=(0,Ro.useMemo)(()=>e.data?.styles?.[e.data?.styleIndex]?.colors,[e,t.selectedFeatures]),o=t.selectedFeaturesId?.[e.id];return(0,De.jsxs)(Ge.Source,{...e.source,children:[n&&(0,De.jsx)(Ge.Layer,{beforeId:r,...n}),o&&n&&(0,De.jsx)(Ge.Layer,{...n,beforeId:r,id:`hl_${e.id}`,filter:["in",O,...o],type:n.type==="fill"?"line":n.type,paint:cn[n.type]})]})}var lt=require("react-map-gl/maplibre");var Ot=require("react/jsx-runtime");function Gt({data:e,beforeId:r}){let{mp:t}=u();return(0,Ot.jsx)(lt.Source,{id:e.id,type:"raster",tiles:[`${t?.geoserver?.endpoint}/wms?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&width=256&height=256&transparent=true&layers=biodiv:${e.id}`],tileSize:256,children:(0,Ot.jsx)(lt.Layer,{id:e.id,beforeId:r,type:"raster",source:"biodiv",layout:{visibility:"visible"},paint:{}})})}var ze=require("react/jsx-runtime");function Eo({layer:e,beforeId:r}){let{mapl:t}=(0,Mo.useMap)();if(!t)return null;switch(e.source.type){case"vector":return(0,ze.jsx)(it,{beforeId:r,layer:e});case"grid":return(0,ze.jsx)(Bt,{beforeId:r,data:e});case"raster":return(0,ze.jsx)(Gt,{beforeId:r,data:e});default:return(0,ze.jsx)(it,{beforeId:r,layer:e})}}var No=require("react"),_o=require("react-map-gl/maplibre");var Le=require("react/jsx-runtime"),dn=_o.Marker,pn=()=>{let{mp:e}=u(),r=(0,No.useMemo)(()=>e.markers,[e.markers]);return(0,Le.jsx)(Le.Fragment,{children:r?.map(({latitude:t,longitude:n,colorHex:o,anchor:a="bottom",iconUrl:s},l)=>(0,Le.jsx)(dn,{latitude:t,longitude:n,anchor:a,subpixelPositioning:!0,children:(0,Le.jsx)("img",{style:{cursor:"pointer",display:"block",width:"25px",height:"41px"},width:25,height:41,alt:"Marker",src:s||"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png"})},l))})},Ao=pn;var Bo=T(require("clsx"),1),Oo=require("react-map-gl/maplibre"),ve=require("twind");var E=require("react/jsx-runtime"),un=Oo.Popup;function Dt({coordinates:e}){let{hover:r}=u(),t=e||r.features?.coordinates;return t?.lat&&r.features?(0,E.jsx)(un,{latitude:t.lat,longitude:t.lng,closeButton:!1,children:(0,E.jsxs)("table",{className:ve.tw`table-auto border`,children:[(0,E.jsx)("thead",{children:(0,E.jsx)("tr",{children:(0,E.jsx)("th",{className:ve.tw`bg-gray-200 py-1 px-2`,colSpan:2,children:r.features.title})})}),(0,E.jsx)("tbody",{children:r.features.data.map(([n,o],a)=>(0,E.jsxs)("tr",{className:(0,ve.tw)((0,Bo.default)({"bg-gray-50":a%2===0,"border-gray-100 border-t":1})),children:[(0,E.jsx)("td",{className:ve.tw`py-1 px-2`,children:n}),(0,E.jsx)("td",{className:ve.tw`py-1 px-2 border-l border-gray-100`,children:o})]},n+o))})]})}):null}var N=require("react/jsx-runtime"),mn=xe.NavigationControl;function zt(){let{mp:e,layer:r,hover:t,query:n}=u(),[o,a]=(0,_.useState)(e.workerUrl||(typeof window<"u"?Do.config.WORKER_URL||"/maplibre-gl-worker.mjs":void 0));(0,_.useEffect)(()=>{Po(e.workerUrl).then(a)},[e.workerUrl]);let s=(0,_.useMemo)(()=>e.defaultViewState||Go.defaultViewState,[e.defaultViewState]),l=_.default.useCallback(f=>n.setClickedLngLat(f.lngLat),[n]),d=_.default.useRef(null),m=_.default.useCallback(f=>{d.current||(d.current=requestAnimationFrame(()=>{d.current=null,t.onHover(f)}))},[t]);return(0,_.useEffect)(()=>()=>{d.current&&cancelAnimationFrame(d.current)},[]),(0,N.jsxs)("div",{className:zo.tw`h-full w-full relative bg-gray-100`,children:[e.loadToC&&(0,N.jsx)(_t,{}),r.selectedFeatures?.length>0&&(0,N.jsx)(vt,{}),(0,N.jsxs)(xe.default,{id:"mapl",workerUrl:o,cursor:"default",initialViewState:s,style:{width:"100%",height:"100%"},mapStyle:r.mapStyle,maxZoom:r.maxZoom,onClick:l,onMouseMove:m,children:[(0,N.jsx)(mn,{position:"bottom-right",showZoom:!0,showCompass:!0}),e.showFullscreenControl&&(0,N.jsx)(xe.FullscreenControl,{position:"bottom-right"}),(0,N.jsx)(Ao,{}),r.selectedLayers.map((f,y)=>{let w=y>0?r.selectedIds[y-1]:void 0;return(0,N.jsx)(Eo,{layer:f,beforeId:w},f.id)}),(0,N.jsx)(Dt,{},"popup")]})]})}var He=require("react/jsx-runtime");(0,Wo.setup)({preflight:!1});var fn=e=>{let r=Fo.default.useMemo(()=>({...sr,...e}),[e]);return(0,He.jsx)($o.MapProvider,{children:(0,He.jsx)(Ho.TranslationProvider,{localeStrings:ar,lang:r.lang,children:(0,He.jsx)(Sr,{mp:r,children:(0,He.jsx)(zt,{})})})})};0&&(module.exports={NakshaMaplibreLayers});
|