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