@edugis-org/webmapx 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +149 -0
  2. package/dist-lib/WMTS-DCN4zX0-.js +1169 -0
  3. package/dist-lib/alert-GeHlqlN8.js +310 -0
  4. package/dist-lib/assets/epsg-lookup.worker-J7TVnHDq.js +1 -0
  5. package/dist-lib/assets/shapefile.worker-kQfZj6G2.js +4 -0
  6. package/dist-lib/attribution-format-B4f05_u0.js +62 -0
  7. package/dist-lib/button-DFdGkRPQ.js +741 -0
  8. package/dist-lib/cesium-adapter-BHXNytkU.js +1488 -0
  9. package/dist-lib/checkbox-QoR4S8tV.js +284 -0
  10. package/dist-lib/chunk-HEgqtunE.js +20 -0
  11. package/dist-lib/chunk.36O46B5H-B6ZL7Sm1.js +77 -0
  12. package/dist-lib/chunk.3RPBFEDE-BFO1fHVm.js +138 -0
  13. package/dist-lib/chunk.5JY5FUCG-DTXsslmx.js +1090 -0
  14. package/dist-lib/chunk.6CTB5ZDJ-DjZrBd6Y.js +99 -0
  15. package/dist-lib/chunk.AJ3ENQ5C-Ci7Gm2b6.js +175 -0
  16. package/dist-lib/chunk.LD4M4QGE-CiCfhE8r.js +8 -0
  17. package/dist-lib/chunk.NYIIDP5N-BikXIStD.js +99 -0
  18. package/dist-lib/chunk.RWUUFNUL-DFztA4uV.js +43 -0
  19. package/dist-lib/chunk.SI4ACBFK-CLb9VfMG.js +61 -0
  20. package/dist-lib/chunk.YHLNUJ7P-D-kanrCf.js +503 -0
  21. package/dist-lib/core-CMAlSR68.js +22 -0
  22. package/dist-lib/decorate-CWgUV1hU.js +1139 -0
  23. package/dist-lib/decorators-B35AgiCU.js +351 -0
  24. package/dist-lib/deferred-query-service-BJDcngw6.js +386 -0
  25. package/dist-lib/dist-Dm6b7XCs.js +12318 -0
  26. package/dist-lib/dist-Ha9LQCut.js +244 -0
  27. package/dist-lib/dist-c1PlDAd1.js +2359 -0
  28. package/dist-lib/dist-kKlmcBXq.js +50 -0
  29. package/dist-lib/divider-CPm675yY.js +41 -0
  30. package/dist-lib/dropped-config-C_GyVa8o.js +17 -0
  31. package/dist-lib/dropped-layer-builder-DAaYgUPk.js +396 -0
  32. package/dist-lib/epsg-definitions-BZLZWa8Q.js +668 -0
  33. package/dist-lib/esm-CTuscnN5.js +46 -0
  34. package/dist-lib/file-sniff-Dhxj3KTF.js +251 -0
  35. package/dist-lib/geo-calculations-DbFJAUoI.js +30 -0
  36. package/dist-lib/icon-CEOgWlro.js +9 -0
  37. package/dist-lib/icon-button-Da_nBTy3.js +408 -0
  38. package/dist-lib/input-CeGntPlT.js +590 -0
  39. package/dist-lib/layer-discovery-afWzu5hY.js +2825 -0
  40. package/dist-lib/leaflet-adapter-D9djjrKv.js +1227 -0
  41. package/dist-lib/lib-CdHVicAE.js +4074 -0
  42. package/dist-lib/map-layer-registry-2cmkiRDK.js +62 -0
  43. package/dist-lib/maplibre-adapter-TFc3e0G9.js +1190 -0
  44. package/dist-lib/maplibre-expression-evaluator-DCWUcpwf.js +7233 -0
  45. package/dist-lib/marker-utils-DztWXeop.js +12 -0
  46. package/dist-lib/ol-tilegrid-9VtyxaLG.js +64 -0
  47. package/dist-lib/openlayers-adapter-DVW1KCRv.js +13307 -0
  48. package/dist-lib/option-CBxl1mZP.js +1106 -0
  49. package/dist-lib/papaparse.min-B7v3c0D7.js +501 -0
  50. package/dist-lib/rbush-C8k41T4z.js +254 -0
  51. package/dist-lib/shapefile-SawVY6xg.js +207 -0
  52. package/dist-lib/spinner-DysxdNG9.js +6 -0
  53. package/dist-lib/src-CL94RDe3.js +111 -0
  54. package/dist-lib/throttle-BeneRNYK.js +16 -0
  55. package/dist-lib/toast-Cm28o9U6.js +15 -0
  56. package/dist-lib/togeojson.es-DAgiTBvg.js +579 -0
  57. package/dist-lib/tooltip-Cucn1SiD.js +197 -0
  58. package/dist-lib/webmapx-3d-tool-D4CTD2gB.js +176 -0
  59. package/dist-lib/webmapx-base-tool-Dm9NAWLD.js +75 -0
  60. package/dist-lib/webmapx-config-edit-tool-DCTyxqTk.js +389 -0
  61. package/dist-lib/webmapx-coordinates-tool-jeWohup9.js +648 -0
  62. package/dist-lib/webmapx-core-bundle-BDImi1RE.js +8203 -0
  63. package/dist-lib/webmapx-draw-tool-DooAV8cF.js +4336 -0
  64. package/dist-lib/webmapx-geolocation-tool-Rw3-Iad1.js +788 -0
  65. package/dist-lib/webmapx-import-layer-tool-DRYviHd5.js +250 -0
  66. package/dist-lib/webmapx-info-tool-BJA157cy.js +412 -0
  67. package/dist-lib/webmapx-language-osmvector-M5y_lwOg.js +489 -0
  68. package/dist-lib/webmapx-measure-tool-BXhMJFC6.js +590 -0
  69. package/dist-lib/webmapx-modal-tool-eF6Naluv.js +84 -0
  70. package/dist-lib/webmapx-plugin-tool-D2Hghf9n.js +45 -0
  71. package/dist-lib/webmapx-print-tool-ob1bOsR5.js +348 -0
  72. package/dist-lib/webmapx-search-tool-Cv8BrYvY.js +437 -0
  73. package/dist-lib/webmapx-settings-DDEJ8aoV.js +479 -0
  74. package/dist-lib/webmapx-truearea-tool-CMB4Orm-.js +615 -0
  75. package/dist-lib/webmapx-view-mode-tool-CUpLNjOj.js +106 -0
  76. package/dist-lib/webmapx.css +2 -0
  77. package/dist-lib/webmapx.js +1321 -0
  78. package/dist-lib/wms-feature-info-C0RVMEQC.js +145 -0
  79. package/dist-lib/wms-url-builder-DIJLQ1v2.js +54 -0
  80. package/dist-lib/zip.js-DVhmtjxZ.js +3615 -0
  81. package/package.json +107 -0
  82. package/public/data/country-epsg-codes.json +297 -0
  83. package/public/data/world-countries-simplified.topojson +1 -0
  84. package/src/locales/en/core.json +20 -0
@@ -0,0 +1,648 @@
1
+ import { t as e } from "./decorate-CWgUV1hU.js";
2
+ import { t } from "./webmapx-base-tool-Dm9NAWLD.js";
3
+ import { i as n, n as r, o as i } from "./decorators-B35AgiCU.js";
4
+ import { css as a, html as o, nothing as s } from "lit";
5
+ //#region src/utils/epsg-lookup-manager.ts
6
+ var c = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.0/public", l = 6e4, u = new class {
7
+ constructor() {
8
+ this.worker = null, this.isReady = !1, this.isInitializing = !1, this.initPromise = null, this.pendingRequests = /* @__PURE__ */ new Map(), this.requestCounter = 0, this.idleTimeout = null, this.idleTimeoutMs = l;
9
+ }
10
+ setIdleTimeout(e) {
11
+ this.idleTimeoutMs = e;
12
+ }
13
+ async initialize() {
14
+ return this.initPromise ? this.initPromise : this.isReady && this.worker ? Promise.resolve() : (this.isInitializing = !0, this.initPromise = new Promise((e, t) => {
15
+ try {
16
+ this.worker = new Worker(new URL(
17
+ /* @vite-ignore */
18
+ "/assets/epsg-lookup.worker-J7TVnHDq.js",
19
+ "" + import.meta.url
20
+ ), { type: "module" }), this.worker.onmessage = (n) => {
21
+ let r = n.data;
22
+ r.type === "worker-initialized" ? this.worker?.postMessage({
23
+ type: "loadData",
24
+ baseUrl: c
25
+ }) : r.type === "ready" ? r.success ? (this.isReady = !0, this.isInitializing = !1, this.resetIdleTimeout(), e()) : (this.isInitializing = !1, this.cleanup(), t(Error(r.error || "Failed to load data"))) : this.handleWorkerMessage(n);
26
+ }, this.worker.onerror = (e) => {
27
+ console.error("EPSG Lookup Worker error:", e), this.cleanup(), t(/* @__PURE__ */ Error("Worker initialization failed"));
28
+ }, setTimeout(() => {
29
+ this.isInitializing && (this.cleanup(), t(/* @__PURE__ */ Error("Worker initialization timeout")));
30
+ }, 1e4);
31
+ } catch (e) {
32
+ this.isInitializing = !1, this.cleanup(), t(e instanceof Error ? e : Error(String(e)));
33
+ }
34
+ }), this.initPromise);
35
+ }
36
+ handleWorkerMessage(e) {
37
+ let t = e.data;
38
+ if (t.type === "lookup-result") {
39
+ let e = this.pendingRequests.get(t.requestId);
40
+ if (e) {
41
+ this.pendingRequests.delete(t.requestId);
42
+ let n = {
43
+ success: t.success,
44
+ countryCode: t.countryCode,
45
+ countryName: t.countryName,
46
+ epsgCodes: t.epsgCodes,
47
+ primaryEpsg: t.primaryEpsg,
48
+ alternativeMatches: t.alternativeMatches,
49
+ error: t.error
50
+ };
51
+ e.resolve(n), this.resetIdleTimeout();
52
+ }
53
+ }
54
+ }
55
+ resetIdleTimeout() {
56
+ this.idleTimeout !== null && clearTimeout(this.idleTimeout), this.idleTimeout = window.setTimeout(() => {
57
+ this.cleanup();
58
+ }, this.idleTimeoutMs);
59
+ }
60
+ async lookup(e, t) {
61
+ try {
62
+ if (this.isReady || await this.initialize(), !this.worker) throw Error("Worker not available");
63
+ let n = `req_${++this.requestCounter}_${Date.now()}`, r = new Promise((e, t) => {
64
+ this.pendingRequests.set(n, {
65
+ resolve: e,
66
+ reject: t
67
+ }), setTimeout(() => {
68
+ this.pendingRequests.get(n) && (this.pendingRequests.delete(n), t(/* @__PURE__ */ Error("Request timeout")));
69
+ }, 5e3);
70
+ });
71
+ return this.worker.postMessage({
72
+ type: "lookup",
73
+ lat: e,
74
+ lng: t,
75
+ requestId: n
76
+ }), await r;
77
+ } catch (e) {
78
+ return {
79
+ success: !1,
80
+ error: e instanceof Error ? e.message : String(e)
81
+ };
82
+ }
83
+ }
84
+ cleanup() {
85
+ if (this.idleTimeout !== null && (clearTimeout(this.idleTimeout), this.idleTimeout = null), this.pendingRequests.forEach((e) => {
86
+ e.reject(/* @__PURE__ */ Error("Worker terminated"));
87
+ }), this.pendingRequests.clear(), this.worker) {
88
+ try {
89
+ this.worker.postMessage({ type: "shutdown" });
90
+ } catch {}
91
+ this.worker.terminate(), this.worker = null;
92
+ }
93
+ this.isReady = !1, this.isInitializing = !1, this.initPromise = null;
94
+ }
95
+ get ready() {
96
+ return this.isReady;
97
+ }
98
+ }(), d = 1 / 1e3, f = {
99
+ en: {
100
+ N: "N",
101
+ E: "E",
102
+ S: "S",
103
+ W: "W"
104
+ },
105
+ nl: {
106
+ N: "N",
107
+ E: "O",
108
+ S: "Z",
109
+ W: "W"
110
+ },
111
+ fr: {
112
+ N: "N",
113
+ E: "E",
114
+ S: "S",
115
+ W: "O"
116
+ },
117
+ de: {
118
+ N: "N",
119
+ E: "O",
120
+ S: "S",
121
+ W: "W"
122
+ },
123
+ es: {
124
+ N: "N",
125
+ E: "E",
126
+ S: "S",
127
+ W: "O"
128
+ }
129
+ }, p = null, m = null, h = class extends t {
130
+ constructor(...e) {
131
+ super(...e), this.cursorCoords = null, this.pinnedCoords = null, this.resolution = null, this.pinnedResolution = null, this.showPopup = !1, this.popupDirection = "up", this.localCRS = [], this.loadingCRS = !1, this.handleOutsideClick = (e) => {
132
+ if (this.showPopup) {
133
+ let t = e.target;
134
+ this.shadowRoot?.contains(t) || (this.showPopup = !1);
135
+ }
136
+ };
137
+ }
138
+ static {
139
+ this.styles = a`
140
+ :host {
141
+ display: inline-flex;
142
+ pointer-events: auto;
143
+ font-size: var(--webmapx-coordinates-font-size, var(--font-size-small));
144
+ position: relative;
145
+ }
146
+
147
+ .coordinates-shell {
148
+ display: inline-flex;
149
+ flex-direction: column;
150
+ border: var(--webmapx-coordinates-border, 1px solid var(--color-border));
151
+ background: var(--webmapx-coordinates-bg, var(--color-background-secondary));
152
+ color: var(--webmapx-coordinates-color, var(--color-text-primary));
153
+ padding: var(--compact-padding-vertical) var(--compact-padding-horizontal);
154
+ font-variant-numeric: tabular-nums;
155
+ line-height: 1.3;
156
+ min-width: 150px;
157
+ pointer-events: auto;
158
+ }
159
+
160
+ .value-line {
161
+ display: flex;
162
+ align-items: center;
163
+ gap: var(--compact-gap);
164
+ white-space: nowrap;
165
+ }
166
+
167
+ .value-line + .value-line {
168
+ border-top: 1px solid var(--color-border-light);
169
+ padding-top: var(--compact-padding-vertical);
170
+ margin-top: var(--compact-padding-vertical);
171
+ }
172
+
173
+ .click-row {
174
+ position: relative;
175
+ cursor: pointer;
176
+ transition: background-color 0.15s ease;
177
+ pointer-events: auto;
178
+ }
179
+
180
+ .click-row:hover {
181
+ background-color: var(--color-background-hover, rgba(0, 0, 0, 0.05));
182
+ }
183
+
184
+ .value {
185
+ font-weight: 600;
186
+ letter-spacing: 0.01em;
187
+ }
188
+
189
+ .click-label {
190
+ text-transform: uppercase;
191
+ letter-spacing: 0.08em;
192
+ font-weight: 600;
193
+ color: var(--color-text-secondary);
194
+ font-size: 0.75em;
195
+ }
196
+
197
+ .popup-container {
198
+ position: absolute;
199
+ left: 0;
200
+ right: 0;
201
+ background: var(--color-background-primary, #ffffff);
202
+ border: 1px solid var(--color-border);
203
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
204
+ padding: 8px;
205
+ min-width: 250px;
206
+ max-width: 400px;
207
+ pointer-events: auto;
208
+ }
209
+
210
+ .popup-container.direction-up {
211
+ bottom: 100%;
212
+ margin-bottom: 4px;
213
+ }
214
+
215
+ .popup-container.direction-down {
216
+ top: 100%;
217
+ margin-top: 4px;
218
+ }
219
+
220
+ .format-line {
221
+ display: flex;
222
+ align-items: center;
223
+ justify-content: space-between;
224
+ padding: 6px 8px;
225
+ gap: 12px;
226
+ transition: background-color 0.15s ease;
227
+ }
228
+
229
+ .format-line:hover {
230
+ background-color: var(--color-background-hover, rgba(0, 0, 0, 0.05));
231
+ }
232
+
233
+ .format-line + .format-line {
234
+ border-top: 1px solid var(--color-border-light, #e0e0e0);
235
+ }
236
+
237
+ .format-content {
238
+ flex: 1;
239
+ display: flex;
240
+ flex-direction: column;
241
+ gap: 2px;
242
+ min-width: 0;
243
+ }
244
+
245
+ .format-label {
246
+ font-size: 0.75em;
247
+ color: var(--color-text-secondary, #666);
248
+ text-transform: uppercase;
249
+ letter-spacing: 0.05em;
250
+ font-weight: 600;
251
+ }
252
+
253
+ .format-value {
254
+ font-family: monospace;
255
+ font-size: 0.9em;
256
+ color: var(--color-text-primary, #000);
257
+ overflow: hidden;
258
+ text-overflow: ellipsis;
259
+ white-space: nowrap;
260
+ }
261
+
262
+ .copy-button {
263
+ flex-shrink: 0;
264
+ padding: 4px 8px;
265
+ background: transparent;
266
+ border: 1px solid var(--color-border, #ccc);
267
+ border-radius: 3px;
268
+ cursor: pointer;
269
+ color: var(--color-text-primary, #000);
270
+ font-size: 0.85em;
271
+ transition: all 0.15s ease;
272
+ display: flex;
273
+ align-items: center;
274
+ gap: 4px;
275
+ }
276
+
277
+ .copy-button:hover {
278
+ background: var(--color-primary, #007acc);
279
+ color: white;
280
+ border-color: var(--color-primary, #007acc);
281
+ }
282
+
283
+ .copy-button:active {
284
+ transform: scale(0.95);
285
+ }
286
+
287
+ .copy-button:disabled {
288
+ opacity: 0.5;
289
+ cursor: not-allowed;
290
+ }
291
+
292
+ .copy-icon {
293
+ width: 14px;
294
+ height: 14px;
295
+ }
296
+
297
+ .loading-indicator {
298
+ padding: 8px;
299
+ text-align: center;
300
+ color: var(--color-text-secondary, #666);
301
+ font-size: 0.85em;
302
+ font-style: italic;
303
+ }
304
+
305
+ .crs-section-header {
306
+ padding: 8px;
307
+ font-size: 0.75em;
308
+ color: var(--color-text-secondary, #666);
309
+ text-transform: uppercase;
310
+ letter-spacing: 0.05em;
311
+ font-weight: 600;
312
+ background: var(--color-background-hover, rgba(0, 0, 0, 0.02));
313
+ margin: 4px 0;
314
+ }
315
+
316
+ .accuracy-note {
317
+ font-size: 0.7em;
318
+ color: var(--color-text-secondary, #999);
319
+ font-style: italic;
320
+ margin-top: 2px;
321
+ }
322
+ `;
323
+ }
324
+ onStateChanged(e) {
325
+ this.cursorCoords = e.pointerCoordinates;
326
+ let t = this.pinnedCoords;
327
+ this.pinnedCoords = e.lastClickedCoordinates, this.resolution = e.pointerResolution, this.pinnedResolution = e.lastClickedResolution, this.showPopup && this.pinnedCoords && this.pinnedCoords !== t && this.fetchLocalCRS(this.pinnedCoords);
328
+ }
329
+ formatPair(e, t) {
330
+ if (!e) return "—";
331
+ let [n, r] = e;
332
+ return `${this.formatCoordinate(r, "lat", t, "en")} ${this.formatCoordinate(n, "lng", t, "en")}`;
333
+ }
334
+ renderClickRow() {
335
+ return this.pinnedCoords ? o`
336
+ <div class="value-line click-row" @click=${this.handleClickRowClick}>
337
+ <span class="click-label">Click</span>
338
+ <span class="value">${this.formatPair(this.pinnedCoords, this.pinnedResolution)}</span>
339
+ </div>
340
+ ${this.renderPopup()}
341
+ ` : s;
342
+ }
343
+ renderPopup() {
344
+ if (!this.showPopup || !this.pinnedCoords) return s;
345
+ let [e, t] = this.pinnedCoords;
346
+ return o`
347
+ <div class="popup-container direction-${this.popupDirection}" @click=${(e) => e.stopPropagation()}>
348
+ <div class="format-line">
349
+ <div class="format-content">
350
+ <div class="format-label">Lon, Lat</div>
351
+ <div class="format-value">${this.formatLonLat(this.pinnedCoords, this.pinnedResolution)}</div>
352
+ </div>
353
+ <button
354
+ class="copy-button"
355
+ @click=${(e) => this.copyToClipboard(this.formatLonLat(this.pinnedCoords, this.pinnedResolution), e)}
356
+ title="Copy to clipboard"
357
+ >
358
+ <svg class="copy-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
359
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
360
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
361
+ </svg>
362
+ </button>
363
+ </div>
364
+
365
+ <div class="format-line">
366
+ <div class="format-content">
367
+ <div class="format-label">Lat, Lon</div>
368
+ <div class="format-value">${this.formatLatLon(this.pinnedCoords, this.pinnedResolution)}</div>
369
+ </div>
370
+ <button
371
+ class="copy-button"
372
+ @click=${(e) => this.copyToClipboard(this.formatLatLon(this.pinnedCoords, this.pinnedResolution), e)}
373
+ title="Copy to clipboard"
374
+ >
375
+ <svg class="copy-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
376
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
377
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
378
+ </svg>
379
+ </button>
380
+ </div>
381
+
382
+ <div class="format-line">
383
+ <div class="format-content">
384
+ <div class="format-label">Geographic (English)</div>
385
+ <div class="format-value">${this.formatGeographic(this.pinnedCoords, this.pinnedResolution, "en")}</div>
386
+ </div>
387
+ <button
388
+ class="copy-button"
389
+ @click=${(e) => this.copyToClipboard(this.formatGeographic(this.pinnedCoords, this.pinnedResolution, "en"), e)}
390
+ title="Copy to clipboard"
391
+ >
392
+ <svg class="copy-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
393
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
394
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
395
+ </svg>
396
+ </button>
397
+ </div>
398
+
399
+ ${this.shouldShowLocalizedFormat() ? o`
400
+ <div class="format-line">
401
+ <div class="format-content">
402
+ <div class="format-label">Geographic (${this.getLanguageName(this.getBrowserLanguage())})</div>
403
+ <div class="format-value">${this.formatGeographic(this.pinnedCoords, this.pinnedResolution, this.getBrowserLanguage())}</div>
404
+ </div>
405
+ <button
406
+ class="copy-button"
407
+ @click=${(e) => this.copyToClipboard(this.formatGeographic(this.pinnedCoords, this.pinnedResolution, this.getBrowserLanguage()), e)}
408
+ title="Copy to clipboard"
409
+ >
410
+ <svg class="copy-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
411
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
412
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
413
+ </svg>
414
+ </button>
415
+ </div>
416
+ ` : s}
417
+
418
+ ${this.loadingCRS ? o`
419
+ <div class="loading-indicator">Loading local coordinate systems...</div>
420
+ ` : s}
421
+
422
+ ${this.localCRS.length > 0 ? o`
423
+ <div class="crs-section-header">Local Coordinate Systems</div>
424
+ ${this.localCRS.map((e) => o`
425
+ <div class="format-line">
426
+ <div class="format-content">
427
+ <div class="format-label">${e.name} (${e.code})</div>
428
+ <div class="format-value">${e.coords || "Transforming..."}</div>
429
+ ${e.accuracy ? o`<div class="accuracy-note">Accuracy: ${e.accuracy}</div>` : s}
430
+ </div>
431
+ <button
432
+ class="copy-button"
433
+ ?disabled=${!e.coords}
434
+ @click=${(t) => e.coords && this.copyToClipboard(e.coords, t)}
435
+ title="Copy to clipboard"
436
+ >
437
+ <svg class="copy-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
438
+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
439
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
440
+ </svg>
441
+ </button>
442
+ </div>
443
+ `)}
444
+ ` : s}
445
+ </div>
446
+ `;
447
+ }
448
+ render() {
449
+ return o`
450
+ <div class="coordinates-shell" role="status" aria-live="polite" tabindex="0" aria-label="Cursor coordinates">
451
+ <div class="value-line">
452
+ <span class="value">${this.formatPair(this.cursorCoords, this.resolution)}</span>
453
+ </div>
454
+ ${this.renderClickRow()}
455
+ </div>
456
+ `;
457
+ }
458
+ formatCoordinate(e, t, n, r = "en") {
459
+ let i = this.getDegreeStep(t, n), a = this.quantize(e, i), o = f[r] || f.en, s = t === "lat" ? a >= 0 ? o.N : o.S : a >= 0 ? o.E : o.W, c = Math.abs(a), l = Math.floor(c), u = (c - l) * 60;
460
+ u >= 59.9995 && (l += 1, u = 0), t === "lat" && l > 90 && (l = 90, u = 0), t === "lng" && l > 180 && (l = 180, u = 0);
461
+ let d = this.computeMinuteDecimals(i * 60), p = u.toFixed(d);
462
+ return `${l}° ${p}' ${s}`;
463
+ }
464
+ getDegreeStep(e, t) {
465
+ let n = d;
466
+ if (!t) return n;
467
+ let r = e === "lat" ? t.lat : t.lng;
468
+ return !isFinite(r) || r <= 0 ? n : Math.max(r, 1e-12);
469
+ }
470
+ quantize(e, t) {
471
+ return !isFinite(t) || t <= 0 ? e : Math.round(e / t) * t;
472
+ }
473
+ computeMinuteDecimals(e) {
474
+ if (!isFinite(e) || e <= 0) return 2;
475
+ let t = Math.ceil(-Math.log10(e));
476
+ return t < 0 ? 0 : Math.min(t, 6);
477
+ }
478
+ getDecimalPrecision(e, t) {
479
+ if (!e) return 6;
480
+ let n = t === "lat" ? e.lat : e.lng;
481
+ if (!isFinite(n) || n <= 0) return 6;
482
+ let r = Math.ceil(-Math.log10(n));
483
+ return Math.max(0, Math.min(r, 8));
484
+ }
485
+ formatLonLat(e, t) {
486
+ let [n, r] = e, i = this.getDecimalPrecision(t, "lng"), a = this.getDecimalPrecision(t, "lat");
487
+ return `${n.toFixed(i)}, ${r.toFixed(a)}`;
488
+ }
489
+ formatLatLon(e, t) {
490
+ let [n, r] = e, i = this.getDecimalPrecision(t, "lng"), a = this.getDecimalPrecision(t, "lat");
491
+ return `${r.toFixed(a)}, ${n.toFixed(i)}`;
492
+ }
493
+ formatGeographic(e, t, n = "en") {
494
+ let [r, i] = e;
495
+ return `${this.formatCoordinate(i, "lat", t, n)}, ${this.formatCoordinate(r, "lng", t, n)}`;
496
+ }
497
+ getBrowserLanguage() {
498
+ return (navigator.language || navigator.userLanguage || "en").split("-")[0].toLowerCase();
499
+ }
500
+ getLanguageName(e) {
501
+ return {
502
+ nl: "Nederlands",
503
+ fr: "Français",
504
+ de: "Deutsch",
505
+ es: "Español"
506
+ }[e] || e;
507
+ }
508
+ shouldShowLocalizedFormat() {
509
+ let e = this.getBrowserLanguage();
510
+ return e !== "en" && f.hasOwnProperty(e);
511
+ }
512
+ handleClickRowClick(e) {
513
+ if (e.stopPropagation(), !this.clickRowElement) return;
514
+ let t = this.clickRowElement.getBoundingClientRect(), n = t.top;
515
+ window.innerHeight - t.bottom;
516
+ let r = 150 + this.localCRS.length * 60;
517
+ this.popupDirection = n >= r ? "up" : "down";
518
+ let i = this.showPopup;
519
+ this.showPopup = !this.showPopup, !i && this.showPopup && this.pinnedCoords && this.fetchLocalCRS(this.pinnedCoords);
520
+ }
521
+ async fetchLocalCRS(e) {
522
+ let [t, n] = e;
523
+ this.loadingCRS = !0, this.localCRS = [];
524
+ try {
525
+ if (!p) {
526
+ let [e, t] = await Promise.all([import("./lib-CdHVicAE.js").then((e) => e.t), import("./epsg-definitions-BZLZWa8Q.js").then((e) => e.n)]);
527
+ p = e.default, m = t, Object.entries(m.EPSG_DEFS).forEach(([e, t]) => {
528
+ p.defs(`EPSG:${e}`, t);
529
+ });
530
+ }
531
+ let r = /* @__PURE__ */ new Map();
532
+ try {
533
+ let e = await u.lookup(n, t);
534
+ if (e.success && e.epsgCodes) {
535
+ if (r.set(e.countryCode, {
536
+ name: e.countryName,
537
+ codes: e.epsgCodes
538
+ }), e.alternativeMatches && e.alternativeMatches.length > 0) {
539
+ console.log(`Border area detected: ${e.alternativeMatches.length} additional countries`);
540
+ for (let t of e.alternativeMatches) r.set(t.countryCode, {
541
+ name: t.countryName,
542
+ codes: t.epsgCodes
543
+ });
544
+ }
545
+ let t = Array.from(r.values()).map((e) => e.name).join(", ");
546
+ console.log(`Found EPSG codes for ${t}`);
547
+ }
548
+ } catch (e) {
549
+ console.warn("EPSG lookup worker failed, falling back to regional bounds:", e);
550
+ }
551
+ let i = [];
552
+ if (r.size > 0) {
553
+ let e = [];
554
+ for (let [t, { name: n, codes: i }] of r) for (let t of i) t !== "4326" && e.push({
555
+ code: t,
556
+ countryName: n
557
+ });
558
+ i = e.map(({ code: e, countryName: t }) => {
559
+ let n = m.REGIONAL_CRS.find((t) => t.code === e);
560
+ if (n) return {
561
+ ...n,
562
+ name: `${n.name} (${t})`
563
+ };
564
+ let r = `EPSG:${e}`, i = p.defs(r) || m.EPSG_DEFS[e];
565
+ return i ? (p.defs(r) || p.defs(r, i), {
566
+ code: e,
567
+ name: `EPSG:${e} (${t})`,
568
+ bounds: [
569
+ -180,
570
+ -90,
571
+ 180,
572
+ 90
573
+ ],
574
+ proj4: i
575
+ }) : null;
576
+ }).filter(Boolean);
577
+ let t = /* @__PURE__ */ new Map();
578
+ for (let e of i) t.has(e.code) || t.set(e.code, e);
579
+ i = Array.from(t.values());
580
+ }
581
+ if (i.length === 0 && (i = m.REGIONAL_CRS.filter((e) => {
582
+ let [r, i, a, o] = e.bounds;
583
+ return t >= r && t <= a && n >= i && n <= o;
584
+ })), i.length === 0) {
585
+ let e = Math.floor((t + 180) / 6) + 1, r = n >= 0, a = r ? `326${e.toString().padStart(2, "0")}` : `327${e.toString().padStart(2, "0")}`, o = `EPSG:${a}`;
586
+ if (!p.defs(o)) {
587
+ let t = `+proj=utm +zone=${e} ${r ? "" : "+south "}+datum=WGS84 +units=m +no_defs`;
588
+ p.defs(o, t);
589
+ }
590
+ i.push({
591
+ code: a,
592
+ name: `WGS 84 / UTM zone ${e}${r ? "N" : "S"}`,
593
+ bounds: [
594
+ -180,
595
+ -90,
596
+ 180,
597
+ 90
598
+ ],
599
+ proj4: p.defs(o)
600
+ });
601
+ }
602
+ let a = r.size > 1 ? 5 : 3, o = i.slice(0, a);
603
+ this.localCRS = o.map((t) => {
604
+ let n = this.transformCoordinatesClientSide(e, t.code);
605
+ return {
606
+ code: t.code,
607
+ name: t.name,
608
+ coords: n
609
+ };
610
+ });
611
+ } catch (e) {
612
+ console.error("Error determining local coordinate systems:", e);
613
+ } finally {
614
+ this.loadingCRS = !1;
615
+ }
616
+ }
617
+ transformCoordinatesClientSide(e, t) {
618
+ if (!p) return "Error: proj4 not loaded";
619
+ try {
620
+ let [n, r] = e, i = p("EPSG:4326", `EPSG:${t}`, [n, r]);
621
+ if (!i || !Array.isArray(i)) return "Transformation failed";
622
+ let [a, o] = i, s = this.getTransformedPrecision(t);
623
+ return `${a.toFixed(s)}, ${o.toFixed(s)}`;
624
+ } catch (e) {
625
+ return console.error(`Error transforming to EPSG:${t}:`, e), "Transformation failed";
626
+ }
627
+ }
628
+ getTransformedPrecision(e) {
629
+ return 2;
630
+ }
631
+ async copyToClipboard(e, t) {
632
+ t.stopPropagation();
633
+ try {
634
+ await navigator.clipboard.writeText(e);
635
+ } catch (e) {
636
+ console.error("Failed to copy to clipboard:", e);
637
+ }
638
+ }
639
+ connectedCallback() {
640
+ super.connectedCallback(), document.addEventListener("click", this.handleOutsideClick);
641
+ }
642
+ disconnectedCallback() {
643
+ super.disconnectedCallback(), document.removeEventListener("click", this.handleOutsideClick);
644
+ }
645
+ };
646
+ e([n()], h.prototype, "cursorCoords", void 0), e([n()], h.prototype, "pinnedCoords", void 0), e([n()], h.prototype, "resolution", void 0), e([n()], h.prototype, "pinnedResolution", void 0), e([n()], h.prototype, "showPopup", void 0), e([n()], h.prototype, "popupDirection", void 0), e([n()], h.prototype, "localCRS", void 0), e([n()], h.prototype, "loadingCRS", void 0), e([r(".click-row")], h.prototype, "clickRowElement", void 0), h = e([i("webmapx-coordinates-tool")], h);
647
+ //#endregion
648
+ export { h as WebmapxCoordinatesTool };