@edugis-org/webmapx 0.1.9 → 0.1.11
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-lib/alert-C_G5X6J8.js +311 -0
- package/dist-lib/button-BlZd3WPH.js +744 -0
- package/dist-lib/checkbox-DB4oPyyw.js +287 -0
- package/dist-lib/chunk.36O46B5H-km1dakSW.js +77 -0
- package/dist-lib/chunk.3RPBFEDE-Cxq6VVR6.js +138 -0
- package/dist-lib/chunk.3Y6SB6QS-DUJ8Ickw.js +18 -0
- package/dist-lib/chunk.5JY5FUCG-CYkzbQXS.js +1071 -0
- package/dist-lib/chunk.6CTB5ZDJ-DjZrBd6Y.js +99 -0
- package/dist-lib/chunk.AJ3ENQ5C-DXVGX5Dn.js +177 -0
- package/dist-lib/chunk.LD4M4QGE-CiCfhE8r.js +8 -0
- package/dist-lib/chunk.NYIIDP5N-B4UCI-rQ.js +34 -0
- package/dist-lib/chunk.RWUUFNUL-DFztA4uV.js +43 -0
- package/dist-lib/chunk.SI4ACBFK-CLb9VfMG.js +61 -0
- package/dist-lib/chunk.YHLNUJ7P-ByKy0MKm.js +251 -0
- package/dist-lib/{decorate-DnZTfaod.js → decorate-CKr8yG1g.js} +1 -1
- package/dist-lib/divider-BOFbR_Ny.js +41 -0
- package/dist-lib/icon-CBNpO1lq.js +9 -0
- package/dist-lib/icon-button-B5rXu3Gg.js +410 -0
- package/dist-lib/input-B212BH6L.js +575 -0
- package/dist-lib/option-BQN9Zz_8.js +1108 -0
- package/dist-lib/spinner-DdcBaa3z.js +6 -0
- package/dist-lib/{toast-BsoXOdeA.js → toast-Bq2PmEpm.js} +1 -1
- package/dist-lib/tooltip-CBGOiZwJ.js +197 -0
- package/dist-lib/{webmapx-3d-tool-CLppA7mK.js → webmapx-3d-tool-CKoLGMpk.js} +2 -2
- package/dist-lib/{webmapx-base-tool-DfRa7TlD.js → webmapx-base-tool-Bc9Wz0yA.js} +1 -1
- package/dist-lib/{webmapx-config-edit-tool-BztWspia.js → webmapx-config-edit-tool-7265_DNz.js} +7 -7
- package/dist-lib/{webmapx-coordinates-tool-DnTSkrRG.js → webmapx-coordinates-tool-C964bdEG.js} +3 -3
- package/dist-lib/{webmapx-core-bundle-CH-5vYXU.js → webmapx-core-bundle-Q6mWOib1.js} +1579 -671
- package/dist-lib/webmapx-draw-tool-6QRr5Gip.js +4315 -0
- package/dist-lib/{webmapx-geolocation-tool-DIMh2kIr.js → webmapx-geolocation-tool-qxN5aaVB.js} +6 -7
- package/dist-lib/{webmapx-import-layer-tool-DMiC1TpU.js → webmapx-import-layer-tool-tJ374qHR.js} +2 -2
- package/dist-lib/{webmapx-info-tool-D-XbAU9J.js → webmapx-info-tool-C3txgv3v.js} +4 -4
- package/dist-lib/{webmapx-language-osmvector-BAw9TR-M.js → webmapx-language-osmvector-jQzTOPU1.js} +3 -4
- package/dist-lib/{webmapx-measure-tool-CXlg11s8.js → webmapx-measure-tool-Cxxrzgdf.js} +4 -4
- package/dist-lib/{webmapx-modal-tool-Cs7LRrgW.js → webmapx-modal-tool-DQVHNXqX.js} +2 -2
- package/dist-lib/{webmapx-plugin-tool-qe2yTrWB.js → webmapx-plugin-tool-BNZ61x6s.js} +1 -1
- package/dist-lib/{webmapx-print-tool-DrK9sLC7.js → webmapx-print-tool-BDOTbS6u.js} +7 -8
- package/dist-lib/{webmapx-search-tool-H7NisgWH.js → webmapx-search-tool-CHlsE2Wx.js} +2 -2
- package/dist-lib/webmapx-settings-B0AT9Vjn.js +482 -0
- package/dist-lib/{webmapx-truearea-tool-CSU9mE1D.js → webmapx-truearea-tool-dxSgcbOj.js} +2 -2
- package/dist-lib/{webmapx-view-mode-tool-D1QyQfq8.js → webmapx-view-mode-tool-DVSMakdh.js} +2 -2
- package/dist-lib/webmapx.js +312 -311
- package/package.json +1 -1
- package/dist-lib/webmapx-draw-tool-DxQgUF1Q.js +0 -2117
- package/dist-lib/webmapx-settings-EHSm-AGU.js +0 -167
package/dist-lib/webmapx.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./webmapx-
|
|
1
|
+
import { n as e } from "./chunk.3Y6SB6QS-DUJ8Ickw.js";
|
|
2
|
+
import { t } from "./webmapx-base-tool-Bc9Wz0yA.js";
|
|
3
|
+
import { t as n } from "./webmapx-plugin-tool-BNZ61x6s.js";
|
|
3
4
|
//#region src/bootstrap/engine-loader.ts
|
|
4
|
-
var
|
|
5
|
+
var r = {
|
|
5
6
|
maplibre: () => import("./maplibre-adapter-Cy6yX6o7.js"),
|
|
6
7
|
openlayers: () => import("./openlayers-adapter-B8WtV1tn.js"),
|
|
7
8
|
leaflet: () => import("./leaflet-adapter-A0rte-c7.js"),
|
|
8
9
|
cesium: () => import("./cesium-adapter-BHXNytkU.js")
|
|
9
10
|
};
|
|
10
|
-
async function
|
|
11
|
-
let t =
|
|
12
|
-
if (!t) throw Error(`[webmapx] Unknown engine: "${e}". Valid: ${Object.keys(
|
|
11
|
+
async function i(e) {
|
|
12
|
+
let t = r[e];
|
|
13
|
+
if (!t) throw Error(`[webmapx] Unknown engine: "${e}". Valid: ${Object.keys(r).join(", ")}`);
|
|
13
14
|
await t();
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region src/bootstrap/tool-loader.ts
|
|
17
|
-
var
|
|
18
|
-
draw: () => import("./webmapx-draw-tool-
|
|
19
|
-
measure: () => import("./webmapx-measure-tool-
|
|
20
|
-
print: () => import("./webmapx-print-tool-
|
|
21
|
-
import: () => import("./webmapx-import-layer-tool-
|
|
22
|
-
search: () => import("./webmapx-search-tool-
|
|
23
|
-
geolocation: () => import("./webmapx-geolocation-tool-
|
|
24
|
-
info: () => import("./webmapx-info-tool-
|
|
25
|
-
"language-osmvector": () => import("./webmapx-language-osmvector-
|
|
26
|
-
"3d": () => import("./webmapx-3d-tool-
|
|
27
|
-
truearea: () => import("./webmapx-truearea-tool-
|
|
28
|
-
"view-mode": () => import("./webmapx-view-mode-tool-
|
|
29
|
-
coordinates: () => import("./webmapx-coordinates-tool-
|
|
30
|
-
settings: () => import("./webmapx-settings-
|
|
31
|
-
"config-edit": () => import("./webmapx-config-edit-tool-
|
|
18
|
+
var a = {
|
|
19
|
+
draw: () => import("./webmapx-draw-tool-6QRr5Gip.js"),
|
|
20
|
+
measure: () => import("./webmapx-measure-tool-Cxxrzgdf.js"),
|
|
21
|
+
print: () => import("./webmapx-print-tool-BDOTbS6u.js"),
|
|
22
|
+
import: () => import("./webmapx-import-layer-tool-tJ374qHR.js"),
|
|
23
|
+
search: () => import("./webmapx-search-tool-CHlsE2Wx.js"),
|
|
24
|
+
geolocation: () => import("./webmapx-geolocation-tool-qxN5aaVB.js"),
|
|
25
|
+
info: () => import("./webmapx-info-tool-C3txgv3v.js"),
|
|
26
|
+
"language-osmvector": () => import("./webmapx-language-osmvector-jQzTOPU1.js"),
|
|
27
|
+
"3d": () => import("./webmapx-3d-tool-CKoLGMpk.js"),
|
|
28
|
+
truearea: () => import("./webmapx-truearea-tool-dxSgcbOj.js"),
|
|
29
|
+
"view-mode": () => import("./webmapx-view-mode-tool-DVSMakdh.js"),
|
|
30
|
+
coordinates: () => import("./webmapx-coordinates-tool-C964bdEG.js"),
|
|
31
|
+
settings: () => import("./webmapx-settings-B0AT9Vjn.js"),
|
|
32
|
+
"config-edit": () => import("./webmapx-config-edit-tool-7265_DNz.js")
|
|
32
33
|
};
|
|
33
|
-
async function
|
|
34
|
-
await import("./webmapx-core-bundle-
|
|
35
|
-
let t =
|
|
34
|
+
async function o(e) {
|
|
35
|
+
await import("./webmapx-core-bundle-Q6mWOib1.js"), await Promise.all(e.map((e) => {
|
|
36
|
+
let t = a[e];
|
|
36
37
|
return t ? t() : (console.warn(`[webmapx] Unknown tool: "${e}" — skipped`), Promise.resolve());
|
|
37
38
|
}));
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/bootstrap/plugin-loader.ts
|
|
41
|
-
var
|
|
42
|
+
var s = [
|
|
42
43
|
"https://cdn.jsdelivr.net/npm/",
|
|
43
44
|
"https://unpkg.com/",
|
|
44
45
|
"https://esm.sh/"
|
|
45
46
|
];
|
|
46
|
-
async function
|
|
47
|
+
async function c(e) {
|
|
47
48
|
for (let t of e) {
|
|
48
|
-
if (!
|
|
49
|
-
console.warn(`[webmapx] Plugin URL not from a trusted CDN — skipped: ${t}`), console.warn("[webmapx] Allowed CDNs: " +
|
|
49
|
+
if (!s.some((e) => t.startsWith(e))) {
|
|
50
|
+
console.warn(`[webmapx] Plugin URL not from a trusted CDN — skipped: ${t}`), console.warn("[webmapx] Allowed CDNs: " + s.join(", "));
|
|
50
51
|
continue;
|
|
51
52
|
}
|
|
52
53
|
try {
|
|
@@ -61,55 +62,55 @@ async function s(e) {
|
|
|
61
62
|
}
|
|
62
63
|
//#endregion
|
|
63
64
|
//#region node_modules/i18next/dist/esm/i18next.js
|
|
64
|
-
var
|
|
65
|
+
var l = (e) => typeof e == "string", u = () => {
|
|
65
66
|
let e, t, n = new Promise((n, r) => {
|
|
66
67
|
e = n, t = r;
|
|
67
68
|
});
|
|
68
69
|
return n.resolve = e, n.reject = t, n;
|
|
69
|
-
},
|
|
70
|
+
}, d = (e) => e == null ? "" : String(e), f = (e, t, n) => {
|
|
70
71
|
e.forEach((e) => {
|
|
71
72
|
t[e] && (n[e] = t[e]);
|
|
72
73
|
});
|
|
73
|
-
},
|
|
74
|
-
let r =
|
|
74
|
+
}, p = /###/g, m = (e) => e && e.includes("###") ? e.replace(p, ".") : e, h = (e) => !e || l(e), g = (e, t, n) => {
|
|
75
|
+
let r = l(t) ? t.split(".") : t, i = 0;
|
|
75
76
|
for (; i < r.length - 1;) {
|
|
76
|
-
if (
|
|
77
|
-
let t =
|
|
77
|
+
if (h(e)) return {};
|
|
78
|
+
let t = m(r[i]);
|
|
78
79
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
79
80
|
}
|
|
80
|
-
return
|
|
81
|
+
return h(e) ? {} : {
|
|
81
82
|
obj: e,
|
|
82
|
-
k:
|
|
83
|
+
k: m(r[i])
|
|
83
84
|
};
|
|
84
|
-
},
|
|
85
|
-
let { obj: r, k: i } =
|
|
85
|
+
}, _ = (e, t, n) => {
|
|
86
|
+
let { obj: r, k: i } = g(e, t, Object);
|
|
86
87
|
if (r !== void 0 || t.length === 1) {
|
|
87
88
|
r[i] = n;
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
91
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
91
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = g(e, o, Object);
|
|
92
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = g(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
92
93
|
s.obj[`${s.k}.${a}`] = n;
|
|
93
|
-
},
|
|
94
|
-
let { obj: i, k: a } =
|
|
94
|
+
}, v = (e, t, n, r) => {
|
|
95
|
+
let { obj: i, k: a } = g(e, t, Object);
|
|
95
96
|
i[a] = i[a] || [], i[a].push(n);
|
|
96
|
-
},
|
|
97
|
-
let { obj: n, k: r } =
|
|
97
|
+
}, y = (e, t) => {
|
|
98
|
+
let { obj: n, k: r } = g(e, t);
|
|
98
99
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
99
|
-
}, y = (e, t, n) => {
|
|
100
|
-
let r = v(e, n);
|
|
101
|
-
return r === void 0 ? v(t, n) : r;
|
|
102
100
|
}, b = (e, t, n) => {
|
|
103
|
-
|
|
101
|
+
let r = y(e, n);
|
|
102
|
+
return r === void 0 ? y(t, n) : r;
|
|
103
|
+
}, x = (e, t, n) => {
|
|
104
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? l(e[r]) || e[r] instanceof String || l(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : x(e[r], t[r], n) : e[r] = t[r]);
|
|
104
105
|
return e;
|
|
105
|
-
},
|
|
106
|
+
}, S = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), C = {
|
|
106
107
|
"&": "&",
|
|
107
108
|
"<": "<",
|
|
108
109
|
">": ">",
|
|
109
110
|
"\"": """,
|
|
110
111
|
"'": "'",
|
|
111
112
|
"/": "/"
|
|
112
|
-
}, ee = (e) =>
|
|
113
|
+
}, ee = (e) => l(e) ? e.replace(/[&<>"'\/]/g, (e) => C[e]) : e, w = class {
|
|
113
114
|
constructor(e) {
|
|
114
115
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
115
116
|
}
|
|
@@ -119,23 +120,23 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
119
120
|
let n = new RegExp(e);
|
|
120
121
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
121
122
|
}
|
|
122
|
-
},
|
|
123
|
+
}, T = [
|
|
123
124
|
" ",
|
|
124
125
|
",",
|
|
125
126
|
"?",
|
|
126
127
|
"!",
|
|
127
128
|
";"
|
|
128
|
-
],
|
|
129
|
+
], E = new w(20), te = (e, t, n) => {
|
|
129
130
|
t ||= "", n ||= "";
|
|
130
|
-
let r =
|
|
131
|
+
let r = T.filter((e) => !t.includes(e) && !n.includes(e));
|
|
131
132
|
if (r.length === 0) return !0;
|
|
132
|
-
let i =
|
|
133
|
+
let i = E.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
133
134
|
if (!a) {
|
|
134
135
|
let t = e.indexOf(n);
|
|
135
136
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
136
137
|
}
|
|
137
138
|
return a;
|
|
138
|
-
},
|
|
139
|
+
}, D = (e, t, n = ".") => {
|
|
139
140
|
if (!e) return;
|
|
140
141
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
141
142
|
let r = t.split(n), i = e;
|
|
@@ -154,7 +155,7 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
154
155
|
i = t;
|
|
155
156
|
}
|
|
156
157
|
return i;
|
|
157
|
-
},
|
|
158
|
+
}, O = (e) => e?.replace(/_/g, "-"), ne = {
|
|
158
159
|
type: "logger",
|
|
159
160
|
log(e) {
|
|
160
161
|
this.output("log", e);
|
|
@@ -168,7 +169,7 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
168
169
|
output(e, t) {
|
|
169
170
|
console?.[e]?.apply?.(console, t);
|
|
170
171
|
}
|
|
171
|
-
},
|
|
172
|
+
}, k = new class e {
|
|
172
173
|
constructor(e, t = {}) {
|
|
173
174
|
this.init(e, t);
|
|
174
175
|
}
|
|
@@ -188,7 +189,7 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
188
189
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
189
190
|
}
|
|
190
191
|
forward(e, t, n, r) {
|
|
191
|
-
return r && !this.debug ? null : (e = e.map((e) =>
|
|
192
|
+
return r && !this.debug ? null : (e = e.map((e) => l(e) ? e.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : e), l(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
192
193
|
}
|
|
193
194
|
create(t) {
|
|
194
195
|
return new e(this.logger, {
|
|
@@ -199,7 +200,7 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
199
200
|
clone(t) {
|
|
200
201
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
201
202
|
}
|
|
202
|
-
}(),
|
|
203
|
+
}(), A = class {
|
|
203
204
|
constructor() {
|
|
204
205
|
this.observers = {};
|
|
205
206
|
}
|
|
@@ -232,7 +233,7 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
232
233
|
for (let i = 0; i < r; i++) n(e, ...t);
|
|
233
234
|
});
|
|
234
235
|
}
|
|
235
|
-
},
|
|
236
|
+
}, j = class extends A {
|
|
236
237
|
constructor(e, t = {
|
|
237
238
|
ns: ["translation"],
|
|
238
239
|
defaultNS: "translation"
|
|
@@ -248,16 +249,16 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
248
249
|
}
|
|
249
250
|
getResource(e, t, n, r = {}) {
|
|
250
251
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
251
|
-
e.includes(".") ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
252
|
-
let s =
|
|
253
|
-
return !s && !t && !n && e.includes(".") && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !
|
|
252
|
+
e.includes(".") ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : l(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
253
|
+
let s = y(this.data, o);
|
|
254
|
+
return !s && !t && !n && e.includes(".") && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !l(n) ? s : D(this.data?.[e]?.[t], n, i);
|
|
254
255
|
}
|
|
255
256
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
256
257
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
257
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.includes(".") && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
258
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.includes(".") && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), _(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
258
259
|
}
|
|
259
260
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
260
|
-
for (let r in n) (
|
|
261
|
+
for (let r in n) (l(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
261
262
|
r.silent || this.emit("added", e, t, n);
|
|
262
263
|
}
|
|
263
264
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -266,11 +267,11 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
266
267
|
}) {
|
|
267
268
|
let o = [e, t];
|
|
268
269
|
e.includes(".") && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
269
|
-
let s =
|
|
270
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
270
|
+
let s = y(this.data, o) || {};
|
|
271
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? x(s, n, i) : s = {
|
|
271
272
|
...s,
|
|
272
273
|
...n
|
|
273
|
-
},
|
|
274
|
+
}, _(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
274
275
|
}
|
|
275
276
|
removeResourceBundle(e, t) {
|
|
276
277
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -291,7 +292,7 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
291
292
|
toJSON() {
|
|
292
293
|
return this.data;
|
|
293
294
|
}
|
|
294
|
-
},
|
|
295
|
+
}, M = {
|
|
295
296
|
processors: {},
|
|
296
297
|
addPostProcessor(e) {
|
|
297
298
|
this.processors[e.name] = e;
|
|
@@ -301,22 +302,22 @@ var c = (e) => typeof e == "string", l = () => {
|
|
|
301
302
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
302
303
|
}), t;
|
|
303
304
|
}
|
|
304
|
-
},
|
|
305
|
+
}, N = Symbol("i18next/PATH_KEY");
|
|
305
306
|
function re() {
|
|
306
307
|
let e = [], t = Object.create(null), n;
|
|
307
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
308
|
+
return t.get = (r, i) => (n?.revoke?.(), i === N ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
-
let { [
|
|
310
|
+
function P(e, t) {
|
|
311
|
+
let { [N]: n } = e(re()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":", a = t?.enableSelector === "strict";
|
|
311
312
|
if (n.length > 1 && i) {
|
|
312
313
|
let e = t?.ns, o = a ? Array.isArray(e) ? e : e ? [e] : null : Array.isArray(e) ? e : null;
|
|
313
314
|
if (o && (a ? o : o.length > 1 ? o.slice(1) : []).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
314
315
|
}
|
|
315
316
|
return n.join(r);
|
|
316
317
|
}
|
|
317
|
-
var
|
|
318
|
+
var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = class e extends A {
|
|
318
319
|
constructor(e, t = {}) {
|
|
319
|
-
super(),
|
|
320
|
+
super(), f([
|
|
320
321
|
"resourceStore",
|
|
321
322
|
"languageUtils",
|
|
322
323
|
"pluralResolver",
|
|
@@ -324,7 +325,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
324
325
|
"backendConnector",
|
|
325
326
|
"i18nFormat",
|
|
326
327
|
"utils"
|
|
327
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
328
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = k.create("translator"), this.checkedLoadedFor = {};
|
|
328
329
|
}
|
|
329
330
|
changeLanguage(e) {
|
|
330
331
|
e && (this.language = e);
|
|
@@ -334,38 +335,38 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
334
335
|
if (e == null) return !1;
|
|
335
336
|
let r = this.resolve(e, n);
|
|
336
337
|
if (r?.res === void 0) return !1;
|
|
337
|
-
let i =
|
|
338
|
+
let i = F(r.res);
|
|
338
339
|
return !(n.returnObjects === !1 && i);
|
|
339
340
|
}
|
|
340
341
|
extractFromKey(e, t) {
|
|
341
342
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
342
343
|
n === void 0 && (n = ":");
|
|
343
|
-
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.includes(n), o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !
|
|
344
|
+
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.includes(n), o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !te(e, n, r);
|
|
344
345
|
if (a && !o) {
|
|
345
346
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
346
347
|
if (t && t.length > 0) return {
|
|
347
348
|
key: e,
|
|
348
|
-
namespaces:
|
|
349
|
+
namespaces: l(i) ? [i] : i
|
|
349
350
|
};
|
|
350
351
|
let a = e.split(n);
|
|
351
352
|
(n !== r || n === r && this.options.ns.includes(a[0])) && (i = a.shift()), e = a.join(r);
|
|
352
353
|
}
|
|
353
354
|
return {
|
|
354
355
|
key: e,
|
|
355
|
-
namespaces:
|
|
356
|
+
namespaces: l(i) ? [i] : i
|
|
356
357
|
};
|
|
357
358
|
}
|
|
358
359
|
translate(t, n, r) {
|
|
359
360
|
let i = typeof n == "object" ? { ...n } : n;
|
|
360
361
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
361
|
-
typeof t == "function" && (t =
|
|
362
|
+
typeof t == "function" && (t = P(t, {
|
|
362
363
|
...this.options,
|
|
363
364
|
...i
|
|
364
|
-
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ?
|
|
365
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? P(e, {
|
|
365
366
|
...this.options,
|
|
366
367
|
...i
|
|
367
368
|
}) : String(e));
|
|
368
|
-
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces:
|
|
369
|
+
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), u = c[c.length - 1], d = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
|
|
369
370
|
d === void 0 && (d = ":");
|
|
370
371
|
let f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
371
372
|
if (f?.toLowerCase() === "cimode") return p ? a ? {
|
|
@@ -387,42 +388,42 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
387
388
|
"[object Number]",
|
|
388
389
|
"[object Function]",
|
|
389
390
|
"[object RegExp]"
|
|
390
|
-
], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !
|
|
391
|
-
b && !h && S && (
|
|
392
|
-
let
|
|
393
|
-
if (b &&
|
|
391
|
+
], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !l(i.count), S = e.hasDefaultValue(i), C = x ? this.pluralResolver.getSuffix(f, i.count, i) : "", ee = i.ordinal && x ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", w = x && !i.ordinal && i.count === 0, T = w && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${C}`] || i[`defaultValue${ee}`] || i.defaultValue, E = h;
|
|
392
|
+
b && !h && S && (E = T);
|
|
393
|
+
let te = F(E), D = Object.prototype.toString.apply(E);
|
|
394
|
+
if (b && E && te && !v.includes(D) && !(l(y) && Array.isArray(E))) {
|
|
394
395
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
395
396
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
396
|
-
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g,
|
|
397
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, E, {
|
|
397
398
|
...i,
|
|
398
|
-
ns:
|
|
399
|
+
ns: c
|
|
399
400
|
}) : `key '${s} (${this.language})' returned an object instead of string.`;
|
|
400
401
|
return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
|
|
401
402
|
}
|
|
402
403
|
if (o) {
|
|
403
|
-
let e = Array.isArray(
|
|
404
|
-
for (let e in
|
|
404
|
+
let e = Array.isArray(E), t = e ? [] : {}, n = e ? _ : g;
|
|
405
|
+
for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
|
|
405
406
|
let r = `${n}${o}${e}`;
|
|
406
407
|
S && !h ? t[e] = this.translate(r, {
|
|
407
408
|
...i,
|
|
408
|
-
defaultValue:
|
|
409
|
+
defaultValue: F(T) ? T[e] : void 0,
|
|
409
410
|
joinArrays: !1,
|
|
410
|
-
ns:
|
|
411
|
+
ns: c
|
|
411
412
|
}) : t[e] = this.translate(r, {
|
|
412
413
|
...i,
|
|
413
414
|
joinArrays: !1,
|
|
414
|
-
ns:
|
|
415
|
-
}), t[e] === r && (t[e] =
|
|
415
|
+
ns: c
|
|
416
|
+
}), t[e] === r && (t[e] = E[e]);
|
|
416
417
|
}
|
|
417
418
|
h = t;
|
|
418
419
|
}
|
|
419
|
-
} else if (b &&
|
|
420
|
+
} else if (b && l(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, t, i, r);
|
|
420
421
|
else {
|
|
421
422
|
let e = !1, n = !1;
|
|
422
|
-
!this.isValidLookup(h) && S && (e = !0, h =
|
|
423
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S &&
|
|
423
|
+
!this.isValidLookup(h) && S && (e = !0, h = T), this.isValidLookup(h) || (n = !0, h = s);
|
|
424
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S && T !== h && this.options.updateMissing;
|
|
424
425
|
if (n || e || c) {
|
|
425
|
-
if (this.logger.log(c ? "updateKey" : "missingKey", f, u, x && !c ? `${s}${this.pluralResolver.getSuffix(f, i.count, i)}` : s, c ?
|
|
426
|
+
if (this.logger.log(c ? "updateKey" : "missingKey", f, u, x && !c ? `${s}${this.pluralResolver.getSuffix(f, i.count, i)}` : s, c ? T : h), o) {
|
|
426
427
|
let e = this.resolve(s, {
|
|
427
428
|
...i,
|
|
428
429
|
keySeparator: !1
|
|
@@ -438,10 +439,10 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
438
439
|
};
|
|
439
440
|
this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
|
|
440
441
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
441
|
-
|
|
442
|
-
n([e], s + t, i[`defaultValue${t}`] ||
|
|
442
|
+
w && i[`defaultValue${this.options.pluralSeparator}zero`] && !t.includes(`${this.options.pluralSeparator}zero`) && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
443
|
+
n([e], s + t, i[`defaultValue${t}`] || T);
|
|
443
444
|
});
|
|
444
|
-
}) : n(e, s,
|
|
445
|
+
}) : n(e, s, T));
|
|
445
446
|
}
|
|
446
447
|
h = this.extendTranslation(h, t, i, m, r), n && h === s && this.options.appendNamespaceToMissingKey && (h = `${u}${d}${s}`), (n || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${d}${s}` : s, e ? h : void 0, i));
|
|
447
448
|
}
|
|
@@ -460,12 +461,12 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
460
461
|
...n.interpolation
|
|
461
462
|
}
|
|
462
463
|
});
|
|
463
|
-
let a =
|
|
464
|
+
let a = l(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
464
465
|
if (a) {
|
|
465
466
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
466
467
|
o = t && t.length;
|
|
467
468
|
}
|
|
468
|
-
let s = n.replace && !
|
|
469
|
+
let s = n.replace && !l(n.replace) ? n.replace : n;
|
|
469
470
|
if (this.options.interpolation.defaultVariables && (s = {
|
|
470
471
|
...this.options.interpolation.defaultVariables,
|
|
471
472
|
...s
|
|
@@ -475,8 +476,8 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
475
476
|
}
|
|
476
477
|
!n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
|
|
477
478
|
}
|
|
478
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
479
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
479
|
+
let a = n.postProcess || this.options.postProcess, o = l(a) ? [a] : a;
|
|
480
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = M.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
480
481
|
i18nResolved: {
|
|
481
482
|
...r,
|
|
482
483
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -486,28 +487,28 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
486
487
|
}
|
|
487
488
|
resolve(e, t = {}) {
|
|
488
489
|
let n, r, i, a, o;
|
|
489
|
-
return
|
|
490
|
+
return l(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? P(e, {
|
|
490
491
|
...this.options,
|
|
491
492
|
...t
|
|
492
493
|
}) : e)), e.forEach((e) => {
|
|
493
494
|
if (this.isValidLookup(n)) return;
|
|
494
|
-
let s = this.extractFromKey(e, t),
|
|
495
|
-
r =
|
|
495
|
+
let s = this.extractFromKey(e, t), c = s.key;
|
|
496
|
+
r = c;
|
|
496
497
|
let u = s.namespaces;
|
|
497
498
|
this.options.fallbackNS && (u = u.concat(this.options.fallbackNS));
|
|
498
|
-
let d = t.count !== void 0 && !
|
|
499
|
+
let d = t.count !== void 0 && !l(t.count), f = d && !t.ordinal && t.count === 0, p = t.context !== void 0 && (l(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
499
500
|
u.forEach((e) => {
|
|
500
501
|
this.isValidLookup(n) || (o = e, !this.checkedLoadedFor[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (this.checkedLoadedFor[`${m[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${m.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((r) => {
|
|
501
502
|
if (this.isValidLookup(n)) return;
|
|
502
503
|
a = r;
|
|
503
|
-
let o = [
|
|
504
|
-
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o,
|
|
504
|
+
let o = [c];
|
|
505
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
|
|
505
506
|
else {
|
|
506
507
|
let e;
|
|
507
508
|
d && (e = this.pluralResolver.getSuffix(r, t.count, t));
|
|
508
509
|
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
509
|
-
if (d && (t.ordinal && e.startsWith(i) && o.push(
|
|
510
|
-
let r = `${
|
|
510
|
+
if (d && (t.ordinal && e.startsWith(i) && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), f && o.push(c + n)), p) {
|
|
511
|
+
let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
511
512
|
o.push(r), d && (t.ordinal && e.startsWith(i) && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), f && o.push(r + n));
|
|
512
513
|
}
|
|
513
514
|
}
|
|
@@ -546,7 +547,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
546
547
|
"joinArrays",
|
|
547
548
|
"postProcess",
|
|
548
549
|
"interpolation"
|
|
549
|
-
], n = e.replace && !
|
|
550
|
+
], n = e.replace && !l(e.replace), r = n ? e.replace : e;
|
|
550
551
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
551
552
|
...this.options.interpolation.defaultVariables,
|
|
552
553
|
...r
|
|
@@ -562,20 +563,20 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
562
563
|
}
|
|
563
564
|
}, ae = class {
|
|
564
565
|
constructor(e) {
|
|
565
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
566
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = k.create("languageUtils");
|
|
566
567
|
}
|
|
567
568
|
getScriptPartFromCode(e) {
|
|
568
|
-
if (e =
|
|
569
|
+
if (e = O(e), !e || !e.includes("-")) return null;
|
|
569
570
|
let t = e.split("-");
|
|
570
571
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
571
572
|
}
|
|
572
573
|
getLanguagePartFromCode(e) {
|
|
573
|
-
if (e =
|
|
574
|
+
if (e = O(e), !e || !e.includes("-")) return e;
|
|
574
575
|
let t = e.split("-");
|
|
575
576
|
return this.formatLanguageCode(t[0]);
|
|
576
577
|
}
|
|
577
578
|
formatLanguageCode(e) {
|
|
578
|
-
if (
|
|
579
|
+
if (l(e) && e.includes("-")) {
|
|
579
580
|
let t;
|
|
580
581
|
try {
|
|
581
582
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -605,7 +606,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
605
606
|
}
|
|
606
607
|
getFallbackCodes(e, t) {
|
|
607
608
|
if (!e) return [];
|
|
608
|
-
if (typeof e == "function" && (e = e(t)),
|
|
609
|
+
if (typeof e == "function" && (e = e(t)), l(e) && (e = [e]), Array.isArray(e)) return e;
|
|
609
610
|
if (!t) return e.default || [];
|
|
610
611
|
let n = e[t];
|
|
611
612
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -614,7 +615,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
614
615
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
615
616
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
616
617
|
};
|
|
617
|
-
return
|
|
618
|
+
return l(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : l(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
618
619
|
r.includes(e) || i(this.formatLanguageCode(e));
|
|
619
620
|
}), r;
|
|
620
621
|
}
|
|
@@ -630,13 +631,13 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
630
631
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
631
632
|
}, ce = class {
|
|
632
633
|
constructor(e, t = {}) {
|
|
633
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
634
|
+
this.languageUtils = e, this.options = t, this.logger = k.create("pluralResolver"), this.pluralRulesCache = {};
|
|
634
635
|
}
|
|
635
636
|
clearCache() {
|
|
636
637
|
this.pluralRulesCache = {};
|
|
637
638
|
}
|
|
638
639
|
getRule(e, t = {}) {
|
|
639
|
-
let n =
|
|
640
|
+
let n = O(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
640
641
|
cleanedCode: n,
|
|
641
642
|
type: r
|
|
642
643
|
});
|
|
@@ -668,16 +669,16 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
668
669
|
return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
669
670
|
}
|
|
670
671
|
}, le = (e, t, n, r = ".", i = !0) => {
|
|
671
|
-
let a =
|
|
672
|
-
return !a && i &&
|
|
673
|
-
},
|
|
672
|
+
let a = b(e, t, n);
|
|
673
|
+
return !a && i && l(n) && (a = D(e, n, r), a === void 0 && (a = D(t, n, r))), a;
|
|
674
|
+
}, I = (e) => e.replace(/\$/g, "$$$$"), L = class {
|
|
674
675
|
constructor(e = {}) {
|
|
675
|
-
this.logger =
|
|
676
|
+
this.logger = k.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
676
677
|
}
|
|
677
678
|
init(e = {}) {
|
|
678
679
|
e.interpolation ||= { escapeValue: !0 };
|
|
679
680
|
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
|
|
680
|
-
this.escape = t === void 0 ? ee : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ?
|
|
681
|
+
this.escape = t === void 0 ? ee : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? S(i) : a || "{{", this.suffix = o ? S(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u ? S(u) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : l ? S(l) : "", this.nestingPrefix = d ? S(d) : f || S("$t("), this.nestingSuffix = p ? S(p) : m || S(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
|
|
681
682
|
}
|
|
682
683
|
reset() {
|
|
683
684
|
this.options && this.init(this.options);
|
|
@@ -687,7 +688,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
687
688
|
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
688
689
|
}
|
|
689
690
|
interpolate(e, t, n, r) {
|
|
690
|
-
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {},
|
|
691
|
+
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
691
692
|
if (!e.includes(this.formatSeparator)) {
|
|
692
693
|
let i = le(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
693
694
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
@@ -704,25 +705,25 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
704
705
|
});
|
|
705
706
|
};
|
|
706
707
|
this.resetRegExp(), !this.escapeValue && typeof e == "string" && /\$t\([^)]*\{[^}]*\{\{/.test(e) && this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");
|
|
707
|
-
let
|
|
708
|
+
let u = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
708
709
|
return [{
|
|
709
710
|
regex: this.regexpUnescape,
|
|
710
|
-
safeValue: (e) =>
|
|
711
|
+
safeValue: (e) => I(e)
|
|
711
712
|
}, {
|
|
712
713
|
regex: this.regexp,
|
|
713
|
-
safeValue: (e) => this.escapeValue ?
|
|
714
|
+
safeValue: (e) => this.escapeValue ? I(this.escape(e)) : I(e)
|
|
714
715
|
}].forEach((t) => {
|
|
715
716
|
for (o = 0; i = t.regex.exec(e);) {
|
|
716
717
|
let n = i[1].trim();
|
|
717
|
-
if (a =
|
|
718
|
-
let t =
|
|
719
|
-
a =
|
|
718
|
+
if (a = c(n), a === void 0) if (typeof u == "function") {
|
|
719
|
+
let t = u(e, i, r);
|
|
720
|
+
a = l(t) ? t : "";
|
|
720
721
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
721
722
|
else if (f) {
|
|
722
723
|
a = i[0];
|
|
723
724
|
continue;
|
|
724
725
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
725
|
-
else !
|
|
726
|
+
else !l(a) && !this.useRawValueToEscape && (a = d(a));
|
|
726
727
|
let s = t.safeValue(a);
|
|
727
728
|
if (e = e.replace(i[0], s), f ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
|
|
728
729
|
}
|
|
@@ -732,7 +733,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
732
733
|
let r, i, a, o = (e, t) => {
|
|
733
734
|
let n = this.nestingOptionsSeparator;
|
|
734
735
|
if (!e.includes(n)) return e;
|
|
735
|
-
let r = e.split(RegExp(`${
|
|
736
|
+
let r = e.split(RegExp(`${S(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
736
737
|
e = r[0], i = this.interpolate(i, a);
|
|
737
738
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
738
739
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -748,10 +749,10 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
748
749
|
};
|
|
749
750
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
750
751
|
let s = [];
|
|
751
|
-
a = { ...n }, a = a.replace && !
|
|
752
|
-
let
|
|
753
|
-
if (
|
|
754
|
-
|
|
752
|
+
a = { ...n }, a = a.replace && !l(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
753
|
+
let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
754
|
+
if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !l(i)) return i;
|
|
755
|
+
l(i) || (i = d(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
|
|
755
756
|
...n,
|
|
756
757
|
interpolationkey: r[1].trim()
|
|
757
758
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
@@ -775,7 +776,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
775
776
|
formatName: t,
|
|
776
777
|
formatOptions: n
|
|
777
778
|
};
|
|
778
|
-
},
|
|
779
|
+
}, R = (e) => {
|
|
779
780
|
let t = {};
|
|
780
781
|
return (n, r, i) => {
|
|
781
782
|
let a = i;
|
|
@@ -784,15 +785,15 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
784
785
|
[i.interpolationkey]: void 0
|
|
785
786
|
});
|
|
786
787
|
let o = r + JSON.stringify(a), s = t[o];
|
|
787
|
-
return s || (s = e(
|
|
788
|
+
return s || (s = e(O(r), i), t[o] = s), s(n);
|
|
788
789
|
};
|
|
789
|
-
}, de = (e) => (t, n, r) => e(
|
|
790
|
+
}, de = (e) => (t, n, r) => e(O(n), r)(t), fe = class {
|
|
790
791
|
constructor(e = {}) {
|
|
791
|
-
this.logger =
|
|
792
|
+
this.logger = k.create("formatter"), this.options = e, this.init(e);
|
|
792
793
|
}
|
|
793
794
|
init(e, t = { interpolation: {} }) {
|
|
794
795
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
795
|
-
let n = t.cacheInBuiltFormats ?
|
|
796
|
+
let n = t.cacheInBuiltFormats ? R : de;
|
|
796
797
|
this.formats = {
|
|
797
798
|
number: n((e, t) => {
|
|
798
799
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -823,7 +824,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
823
824
|
this.formats[e.toLowerCase().trim()] = t;
|
|
824
825
|
}
|
|
825
826
|
addCached(e, t) {
|
|
826
|
-
this.formats[e.toLowerCase().trim()] =
|
|
827
|
+
this.formats[e.toLowerCase().trim()] = R(t);
|
|
827
828
|
}
|
|
828
829
|
format(e, t, n, r = {}) {
|
|
829
830
|
if (!t || e == null) return e;
|
|
@@ -853,9 +854,9 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
853
854
|
}
|
|
854
855
|
}, pe = (e, t) => {
|
|
855
856
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
856
|
-
}, me = class extends
|
|
857
|
+
}, me = class extends A {
|
|
857
858
|
constructor(e, t, n, r = {}) {
|
|
858
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
859
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = k.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
|
|
859
860
|
}
|
|
860
861
|
queueLoad(e, t, n, r) {
|
|
861
862
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -883,7 +884,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
883
884
|
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
884
885
|
let o = {};
|
|
885
886
|
this.queue.forEach((n) => {
|
|
886
|
-
|
|
887
|
+
v(n.loaded, [i], a), pe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
887
888
|
o[e] || (o[e] = {});
|
|
888
889
|
let t = n.loaded[e];
|
|
889
890
|
t.length && t.forEach((t) => {
|
|
@@ -932,7 +933,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
932
933
|
}
|
|
933
934
|
prepareLoading(e, t, n = {}, r) {
|
|
934
935
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
935
|
-
|
|
936
|
+
l(e) && (e = this.languageUtils.toResolveHierarchy(e)), l(t) && (t = [t]);
|
|
936
937
|
let i = this.queueLoad(e, t, n, r);
|
|
937
938
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
938
939
|
i.toLoad.forEach((e) => {
|
|
@@ -973,7 +974,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
973
974
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
974
975
|
}
|
|
975
976
|
}
|
|
976
|
-
},
|
|
977
|
+
}, z = () => ({
|
|
977
978
|
debug: !1,
|
|
978
979
|
initAsync: !0,
|
|
979
980
|
ns: ["translation"],
|
|
@@ -1008,7 +1009,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1008
1009
|
appendNamespaceToCIMode: !1,
|
|
1009
1010
|
overloadTranslationOptionHandler: (e) => {
|
|
1010
1011
|
let t = {};
|
|
1011
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1012
|
+
if (typeof e[1] == "object" && (t = e[1]), l(e[1]) && (t.defaultValue = e[1]), l(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1012
1013
|
let n = e[3] || e[2];
|
|
1013
1014
|
Object.keys(n).forEach((e) => {
|
|
1014
1015
|
t[e] = n[e];
|
|
@@ -1029,13 +1030,13 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1029
1030
|
skipOnVariables: !0
|
|
1030
1031
|
},
|
|
1031
1032
|
cacheInBuiltFormats: !0
|
|
1032
|
-
}),
|
|
1033
|
+
}), B = (e) => (l(e.ns) && (e.ns = [e.ns]), l(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), l(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs && !e.supportedLngs.includes("cimode") && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), e), V = () => {}, he = (e) => {
|
|
1033
1034
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1034
1035
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1035
1036
|
});
|
|
1036
|
-
},
|
|
1037
|
+
}, H = class e extends A {
|
|
1037
1038
|
constructor(e = {}, t) {
|
|
1038
|
-
if (super(), this.options =
|
|
1039
|
+
if (super(), this.options = B(e), this.services = {}, this.logger = k, this.modules = { external: [] }, he(this), t && !this.isInitialized && !e.isClone) {
|
|
1039
1040
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1040
1041
|
setTimeout(() => {
|
|
1041
1042
|
this.init(e, t);
|
|
@@ -1043,25 +1044,25 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1043
1044
|
}
|
|
1044
1045
|
}
|
|
1045
1046
|
init(e = {}, t) {
|
|
1046
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1047
|
-
let n =
|
|
1047
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (l(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0]));
|
|
1048
|
+
let n = z();
|
|
1048
1049
|
this.options = {
|
|
1049
1050
|
...n,
|
|
1050
1051
|
...this.options,
|
|
1051
|
-
...
|
|
1052
|
+
...B(e)
|
|
1052
1053
|
}, this.options.interpolation = {
|
|
1053
1054
|
...n.interpolation,
|
|
1054
1055
|
...this.options.interpolation
|
|
1055
1056
|
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler);
|
|
1056
1057
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1057
1058
|
if (!this.options.isClone) {
|
|
1058
|
-
this.modules.logger ?
|
|
1059
|
+
this.modules.logger ? k.init(r(this.modules.logger), this.options) : k.init(null, this.options);
|
|
1059
1060
|
let e;
|
|
1060
1061
|
e = this.modules.formatter ? this.modules.formatter : fe;
|
|
1061
1062
|
let t = new ae(this.options);
|
|
1062
|
-
this.store = new
|
|
1063
|
+
this.store = new j(this.options.resources, this.options);
|
|
1063
1064
|
let n = this.services;
|
|
1064
|
-
n.logger =
|
|
1065
|
+
n.logger = k, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new ce(t, { prepend: this.options.pluralSeparator }), e && (n.formatter = r(e), n.formatter.init && n.formatter.init(n, this.options), this.options.interpolation.format = n.formatter.format.bind(n.formatter)), n.interpolator = new L(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new me(r(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
|
|
1065
1066
|
this.emit(e, ...t);
|
|
1066
1067
|
}), this.modules.languageDetector && (n.languageDetector = r(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = r(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new ie(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1067
1068
|
this.emit(e, ...t);
|
|
@@ -1069,7 +1070,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1069
1070
|
e.init && e.init(this);
|
|
1070
1071
|
});
|
|
1071
1072
|
}
|
|
1072
|
-
if (this.format = this.options.interpolation.format, t ||=
|
|
1073
|
+
if (this.format = this.options.interpolation.format, t ||= V, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1073
1074
|
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1074
1075
|
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1075
1076
|
}
|
|
@@ -1088,7 +1089,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1088
1089
|
].forEach((e) => {
|
|
1089
1090
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1090
1091
|
});
|
|
1091
|
-
let i =
|
|
1092
|
+
let i = u(), a = () => {
|
|
1092
1093
|
let e = (e, n) => {
|
|
1093
1094
|
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), i.resolve(n), t(e, n);
|
|
1094
1095
|
};
|
|
@@ -1097,8 +1098,8 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1097
1098
|
};
|
|
1098
1099
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1099
1100
|
}
|
|
1100
|
-
loadResources(e, t =
|
|
1101
|
-
let n = t, r =
|
|
1101
|
+
loadResources(e, t = V) {
|
|
1102
|
+
let n = t, r = l(e) ? e : this.language;
|
|
1102
1103
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1103
1104
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1104
1105
|
let e = [], t = (t) => {
|
|
@@ -1112,15 +1113,15 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1112
1113
|
} else n(null);
|
|
1113
1114
|
}
|
|
1114
1115
|
reloadResources(e, t, n) {
|
|
1115
|
-
let r =
|
|
1116
|
-
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||=
|
|
1116
|
+
let r = u();
|
|
1117
|
+
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= V, this.services.backendConnector.reload(e, t, (e) => {
|
|
1117
1118
|
r.resolve(), n(e);
|
|
1118
1119
|
}), r;
|
|
1119
1120
|
}
|
|
1120
1121
|
use(e) {
|
|
1121
1122
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1122
1123
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1123
|
-
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" &&
|
|
1124
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && M.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1124
1125
|
}
|
|
1125
1126
|
setResolvedLanguage(e) {
|
|
1126
1127
|
if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) {
|
|
@@ -1136,7 +1137,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1136
1137
|
}
|
|
1137
1138
|
changeLanguage(e, t) {
|
|
1138
1139
|
this.isLanguageChangingTo = e;
|
|
1139
|
-
let n =
|
|
1140
|
+
let n = u();
|
|
1140
1141
|
this.emit("languageChanging", e);
|
|
1141
1142
|
let r = (e) => {
|
|
1142
1143
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1144,7 +1145,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1144
1145
|
a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
|
|
1145
1146
|
}, a = (t) => {
|
|
1146
1147
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1147
|
-
let n =
|
|
1148
|
+
let n = l(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(l(t) ? [t] : t);
|
|
1148
1149
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1149
1150
|
i(e, a);
|
|
1150
1151
|
});
|
|
@@ -1161,11 +1162,11 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1161
1162
|
...this.options,
|
|
1162
1163
|
...o
|
|
1163
1164
|
};
|
|
1164
|
-
Array.isArray(i) && !s && (c.ns = i), typeof o.keyPrefix == "function" && (o.keyPrefix =
|
|
1165
|
+
Array.isArray(i) && !s && (c.ns = i), typeof o.keyPrefix == "function" && (o.keyPrefix = P(o.keyPrefix, c));
|
|
1165
1166
|
let l = this.options.keySeparator || ".", u;
|
|
1166
|
-
return o.keyPrefix && Array.isArray(e) ? u = e.map((e) => (typeof e == "function" && (e =
|
|
1167
|
+
return o.keyPrefix && Array.isArray(e) ? u = e.map((e) => (typeof e == "function" && (e = P(e, c)), `${o.keyPrefix}${l}${e}`)) : (typeof e == "function" && (e = P(e, c)), u = o.keyPrefix ? `${o.keyPrefix}${l}${e}` : e), this.t(u, o);
|
|
1167
1168
|
};
|
|
1168
|
-
return
|
|
1169
|
+
return l(e) ? a.lng = e : a.lngs = e, a.ns = t, a.keyPrefix = n, a;
|
|
1169
1170
|
}
|
|
1170
1171
|
t(...e) {
|
|
1171
1172
|
return this.translator?.translate(...e);
|
|
@@ -1192,16 +1193,16 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1192
1193
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1193
1194
|
}
|
|
1194
1195
|
loadNamespaces(e, t) {
|
|
1195
|
-
let n =
|
|
1196
|
-
return this.options.ns ? (
|
|
1196
|
+
let n = u();
|
|
1197
|
+
return this.options.ns ? (l(e) && (e = [e]), e.forEach((e) => {
|
|
1197
1198
|
this.options.ns.includes(e) || this.options.ns.push(e);
|
|
1198
1199
|
}), this.loadResources((e) => {
|
|
1199
1200
|
n.resolve(), t && t(e);
|
|
1200
1201
|
}), n) : (t && t(), Promise.resolve());
|
|
1201
1202
|
}
|
|
1202
1203
|
loadLanguages(e, t) {
|
|
1203
|
-
let n =
|
|
1204
|
-
|
|
1204
|
+
let n = u();
|
|
1205
|
+
l(e) && (e = [e]);
|
|
1205
1206
|
let r = this.options.preload || [], i = e.filter((e) => !r.includes(e) && this.services.languageUtils.isSupportedCode(e));
|
|
1206
1207
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1207
1208
|
n.resolve(), t && t(e);
|
|
@@ -1216,14 +1217,14 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1216
1217
|
if (e && e.direction) return e.direction;
|
|
1217
1218
|
}
|
|
1218
1219
|
} catch {}
|
|
1219
|
-
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new ae(
|
|
1220
|
+
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new ae(z());
|
|
1220
1221
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.includes(n.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1221
1222
|
}
|
|
1222
1223
|
static createInstance(t = {}, n) {
|
|
1223
1224
|
let r = new e(t, n);
|
|
1224
1225
|
return r.createInstance = e.createInstance, r;
|
|
1225
1226
|
}
|
|
1226
|
-
cloneInstance(t = {}, n =
|
|
1227
|
+
cloneInstance(t = {}, n = V) {
|
|
1227
1228
|
let r = t.forkResourceStore;
|
|
1228
1229
|
r && delete t.forkResourceStore;
|
|
1229
1230
|
let i = {
|
|
@@ -1237,16 +1238,16 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1237
1238
|
"language"
|
|
1238
1239
|
].forEach((e) => {
|
|
1239
1240
|
a[e] = this[e];
|
|
1240
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1241
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new j(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
|
|
1241
1242
|
let e = {
|
|
1242
|
-
...
|
|
1243
|
+
...z().interpolation,
|
|
1243
1244
|
...this.options.interpolation,
|
|
1244
1245
|
...t.interpolation
|
|
1245
1246
|
}, n = {
|
|
1246
1247
|
...i,
|
|
1247
1248
|
interpolation: e
|
|
1248
1249
|
};
|
|
1249
|
-
a.services.interpolator = new
|
|
1250
|
+
a.services.interpolator = new L(n);
|
|
1250
1251
|
}
|
|
1251
1252
|
return a.translator = new ie(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1252
1253
|
a.emit(e, ...t);
|
|
@@ -1262,7 +1263,7 @@ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1262
1263
|
};
|
|
1263
1264
|
}
|
|
1264
1265
|
}.createInstance();
|
|
1265
|
-
|
|
1266
|
+
H.createInstance, H.dir, H.init, H.loadResources, H.reloadResources, H.use, H.changeLanguage, H.getFixedT, H.t, H.exists, H.setDefaultNamespace, H.hasLoadedNamespace, H.loadNamespaces, H.loadLanguages;
|
|
1266
1267
|
var ge = {
|
|
1267
1268
|
tools: {
|
|
1268
1269
|
draw: "Draw",
|
|
@@ -1282,9 +1283,9 @@ var ge = {
|
|
|
1282
1283
|
ok: "OK",
|
|
1283
1284
|
loading: "Loading..."
|
|
1284
1285
|
}
|
|
1285
|
-
},
|
|
1286
|
+
}, U = H.createInstance(), W = !1;
|
|
1286
1287
|
async function _e() {
|
|
1287
|
-
|
|
1288
|
+
W || (W = !0, await U.init({
|
|
1288
1289
|
lng: "en",
|
|
1289
1290
|
fallbackLng: "en",
|
|
1290
1291
|
ns: ["webmapx"],
|
|
@@ -1294,14 +1295,14 @@ async function _e() {
|
|
|
1294
1295
|
}));
|
|
1295
1296
|
}
|
|
1296
1297
|
function ve(e, t) {
|
|
1297
|
-
return
|
|
1298
|
+
return U.t(e, t);
|
|
1298
1299
|
}
|
|
1299
1300
|
//#endregion
|
|
1300
1301
|
//#region src/bootstrap/locale-loader.ts
|
|
1301
|
-
var ye = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.
|
|
1302
|
-
async function
|
|
1303
|
-
if (
|
|
1304
|
-
await
|
|
1302
|
+
var ye = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.11/src/locales";
|
|
1303
|
+
async function G(e) {
|
|
1304
|
+
if (U.hasResourceBundle(e, "webmapx")) {
|
|
1305
|
+
await U.changeLanguage(e);
|
|
1305
1306
|
return;
|
|
1306
1307
|
}
|
|
1307
1308
|
try {
|
|
@@ -1309,14 +1310,14 @@ async function W(e) {
|
|
|
1309
1310
|
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
1310
1311
|
return e.json();
|
|
1311
1312
|
});
|
|
1312
|
-
|
|
1313
|
+
U.addResourceBundle(e, "webmapx", n), await U.changeLanguage(e);
|
|
1313
1314
|
} catch (t) {
|
|
1314
1315
|
console.error(`[webmapx] Failed to load locale "${e}", falling back to EN`, t);
|
|
1315
1316
|
}
|
|
1316
1317
|
}
|
|
1317
1318
|
//#endregion
|
|
1318
1319
|
//#region src/config/validator.ts
|
|
1319
|
-
var be = new Set(["nominatim"]),
|
|
1320
|
+
var be = new Set(["nominatim"]), K = {
|
|
1320
1321
|
root: [
|
|
1321
1322
|
"version",
|
|
1322
1323
|
"project",
|
|
@@ -1510,17 +1511,17 @@ var be = new Set(["nominatim"]), G = {
|
|
|
1510
1511
|
"provider",
|
|
1511
1512
|
"attribution"
|
|
1512
1513
|
]
|
|
1513
|
-
},
|
|
1514
|
+
}, xe = [
|
|
1514
1515
|
"maplibre",
|
|
1515
1516
|
"openlayers",
|
|
1516
1517
|
"leaflet",
|
|
1517
1518
|
"cesium"
|
|
1518
|
-
],
|
|
1519
|
+
], Se = [
|
|
1519
1520
|
"raster",
|
|
1520
1521
|
"geojson",
|
|
1521
1522
|
"vector",
|
|
1522
1523
|
"raster-dem"
|
|
1523
|
-
],
|
|
1524
|
+
], Ce = [
|
|
1524
1525
|
"xyz",
|
|
1525
1526
|
"wms",
|
|
1526
1527
|
"wmts"
|
|
@@ -1534,8 +1535,8 @@ var be = new Set(["nominatim"]), G = {
|
|
|
1534
1535
|
"fill-extrusion",
|
|
1535
1536
|
"heatmap",
|
|
1536
1537
|
"hillshade"
|
|
1537
|
-
],
|
|
1538
|
-
function
|
|
1538
|
+
], we = ["multiple", "single"];
|
|
1539
|
+
function Te(e) {
|
|
1539
1540
|
let t = [], n = [];
|
|
1540
1541
|
if (!J(e)) return t.push({
|
|
1541
1542
|
severity: "error",
|
|
@@ -1547,28 +1548,28 @@ function we(e) {
|
|
|
1547
1548
|
warnings: n
|
|
1548
1549
|
};
|
|
1549
1550
|
let r = e;
|
|
1550
|
-
Y(r,
|
|
1551
|
+
Y(r, K.root, "", n), De(r.map, t, n), Oe(r.runtimeMap, t, n);
|
|
1551
1552
|
let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
1552
|
-
if (r.layerData !== void 0 && ({sourceIds: i, layerIds: a} =
|
|
1553
|
+
if (r.layerData !== void 0 && ({sourceIds: i, layerIds: a} = Ee(r.layerData, t, n, "layerData")), r.catalog !== void 0) {
|
|
1553
1554
|
n.push({
|
|
1554
1555
|
severity: "warning",
|
|
1555
1556
|
path: "catalog",
|
|
1556
1557
|
message: "\"catalog\" is deprecated; use \"layerData\" and place tree under layerTree tool config"
|
|
1557
1558
|
});
|
|
1558
|
-
let e =
|
|
1559
|
+
let e = ke(r.catalog, t, n);
|
|
1559
1560
|
r.layerData === void 0 && (e.sourceIds, a = e.layerIds);
|
|
1560
1561
|
}
|
|
1561
1562
|
return r.layerData === void 0 && r.catalog === void 0 && t.push({
|
|
1562
1563
|
severity: "error",
|
|
1563
1564
|
path: "layerData",
|
|
1564
1565
|
message: "Missing required \"layerData\" section"
|
|
1565
|
-
}),
|
|
1566
|
+
}), Ae(r.state, a, t, n), r.tools !== void 0 && Ie(r.tools, "tools", a, t, n), {
|
|
1566
1567
|
valid: t.length === 0,
|
|
1567
1568
|
errors: t,
|
|
1568
1569
|
warnings: n
|
|
1569
1570
|
};
|
|
1570
1571
|
}
|
|
1571
|
-
function
|
|
1572
|
+
function Ee(e, t, n, r) {
|
|
1572
1573
|
let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
1573
1574
|
if (!J(e)) return t.push({
|
|
1574
1575
|
severity: "error",
|
|
@@ -1579,11 +1580,11 @@ function Te(e, t, n, r) {
|
|
|
1579
1580
|
layerIds: a
|
|
1580
1581
|
};
|
|
1581
1582
|
let o = e;
|
|
1582
|
-
return Y(o,
|
|
1583
|
+
return Y(o, K.layerData, r, n), o.sources === void 0 ? t.push({
|
|
1583
1584
|
severity: "error",
|
|
1584
1585
|
path: `${r}.sources`,
|
|
1585
1586
|
message: "Missing required \"sources\" array"
|
|
1586
|
-
}) : Array.isArray(o.sources) ?
|
|
1587
|
+
}) : Array.isArray(o.sources) ? je(o.sources, `${r}.sources`, i, t, n) : t.push({
|
|
1587
1588
|
severity: "error",
|
|
1588
1589
|
path: `${r}.sources`,
|
|
1589
1590
|
message: "\"sources\" must be an array"
|
|
@@ -1591,7 +1592,7 @@ function Te(e, t, n, r) {
|
|
|
1591
1592
|
severity: "error",
|
|
1592
1593
|
path: `${r}.layers`,
|
|
1593
1594
|
message: "Missing required \"layers\" array"
|
|
1594
|
-
}) : Array.isArray(o.layers) ? (
|
|
1595
|
+
}) : Array.isArray(o.layers) ? (Me(o.layers, `${r}.layers`, i, a, t, n), o.layers.forEach((e, n) => {
|
|
1595
1596
|
if (!J(e)) return;
|
|
1596
1597
|
let i = e, o = `${r}.layers[${n}]`;
|
|
1597
1598
|
if (i.fallbackLayerId !== void 0 && typeof i.fallbackLayerId != "string") {
|
|
@@ -1616,7 +1617,7 @@ function Te(e, t, n, r) {
|
|
|
1616
1617
|
layerIds: a
|
|
1617
1618
|
};
|
|
1618
1619
|
}
|
|
1619
|
-
function
|
|
1620
|
+
function De(e, t, n) {
|
|
1620
1621
|
if (e === void 0) {
|
|
1621
1622
|
t.push({
|
|
1622
1623
|
severity: "error",
|
|
@@ -1634,11 +1635,11 @@ function Ee(e, t, n) {
|
|
|
1634
1635
|
return;
|
|
1635
1636
|
}
|
|
1636
1637
|
let r = e;
|
|
1637
|
-
Y(r,
|
|
1638
|
+
Y(r, K.map, "map", n), r.center === void 0 ? t.push({
|
|
1638
1639
|
severity: "error",
|
|
1639
1640
|
path: "map.center",
|
|
1640
1641
|
message: "Missing required \"center\""
|
|
1641
|
-
}) :
|
|
1642
|
+
}) : ze(r.center) || t.push({
|
|
1642
1643
|
severity: "error",
|
|
1643
1644
|
path: "map.center",
|
|
1644
1645
|
message: "\"center\" must be [longitude, latitude] array with valid values"
|
|
@@ -1654,10 +1655,10 @@ function Ee(e, t, n) {
|
|
|
1654
1655
|
severity: "error",
|
|
1655
1656
|
path: "map.type",
|
|
1656
1657
|
message: "Missing required \"type\""
|
|
1657
|
-
}) :
|
|
1658
|
+
}) : xe.includes(r.type) || t.push({
|
|
1658
1659
|
severity: "error",
|
|
1659
1660
|
path: "map.type",
|
|
1660
|
-
message: `"type" must be one of: ${
|
|
1661
|
+
message: `"type" must be one of: ${xe.join(", ")}`
|
|
1661
1662
|
}), r.minZoom !== void 0 && (typeof r.minZoom != "number" || r.minZoom < 0 || r.minZoom > 24) ? t.push({
|
|
1662
1663
|
severity: "error",
|
|
1663
1664
|
path: "map.minZoom",
|
|
@@ -1700,7 +1701,7 @@ function Ee(e, t, n) {
|
|
|
1700
1701
|
message: "\"minPitch\" cannot be greater than \"maxPitch\""
|
|
1701
1702
|
});
|
|
1702
1703
|
}
|
|
1703
|
-
function
|
|
1704
|
+
function Oe(e, t, n) {
|
|
1704
1705
|
let r = "runtimeMap";
|
|
1705
1706
|
if (e === void 0) return;
|
|
1706
1707
|
if (!J(e)) {
|
|
@@ -1712,7 +1713,7 @@ function De(e, t, n) {
|
|
|
1712
1713
|
return;
|
|
1713
1714
|
}
|
|
1714
1715
|
let i = e;
|
|
1715
|
-
Y(i,
|
|
1716
|
+
Y(i, K.runtimeMap, r, n), i.minZoom !== void 0 && (typeof i.minZoom != "number" || i.minZoom < 0 || i.minZoom > 24) && t.push({
|
|
1716
1717
|
severity: "error",
|
|
1717
1718
|
path: `${r}.minZoom`,
|
|
1718
1719
|
message: "\"minZoom\" must be a number between 0 and 24"
|
|
@@ -1738,7 +1739,7 @@ function De(e, t, n) {
|
|
|
1738
1739
|
message: "\"minPitch\" cannot be greater than \"maxPitch\""
|
|
1739
1740
|
});
|
|
1740
1741
|
}
|
|
1741
|
-
function
|
|
1742
|
+
function ke(e, t, n) {
|
|
1742
1743
|
let r = "catalog", i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
1743
1744
|
if (e === void 0) return t.push({
|
|
1744
1745
|
severity: "error",
|
|
@@ -1757,11 +1758,11 @@ function Oe(e, t, n) {
|
|
|
1757
1758
|
layerIds: a
|
|
1758
1759
|
};
|
|
1759
1760
|
let o = e;
|
|
1760
|
-
return Y(o,
|
|
1761
|
+
return Y(o, K.catalog, r, n), o.sources === void 0 ? t.push({
|
|
1761
1762
|
severity: "error",
|
|
1762
1763
|
path: `${r}.sources`,
|
|
1763
1764
|
message: "Missing required \"sources\" array"
|
|
1764
|
-
}) : Array.isArray(o.sources) ?
|
|
1765
|
+
}) : Array.isArray(o.sources) ? je(o.sources, `${r}.sources`, i, t, n) : t.push({
|
|
1765
1766
|
severity: "error",
|
|
1766
1767
|
path: `${r}.sources`,
|
|
1767
1768
|
message: "\"sources\" must be an array"
|
|
@@ -1769,7 +1770,7 @@ function Oe(e, t, n) {
|
|
|
1769
1770
|
severity: "error",
|
|
1770
1771
|
path: `${r}.layers`,
|
|
1771
1772
|
message: "Missing required \"layers\" array"
|
|
1772
|
-
}) : Array.isArray(o.layers) ? (
|
|
1773
|
+
}) : Array.isArray(o.layers) ? (Me(o.layers, `${r}.layers`, i, a, t, n), o.layers.forEach((e, n) => {
|
|
1773
1774
|
if (!J(e)) return;
|
|
1774
1775
|
let i = e, o = `${r}.layers[${n}]`;
|
|
1775
1776
|
if (i.fallbackLayerId !== void 0 && typeof i.fallbackLayerId != "string") {
|
|
@@ -1793,7 +1794,7 @@ function Oe(e, t, n) {
|
|
|
1793
1794
|
severity: "error",
|
|
1794
1795
|
path: `${r}.tree`,
|
|
1795
1796
|
message: "Missing required \"tree\" array"
|
|
1796
|
-
}) : Array.isArray(o.tree) ?
|
|
1797
|
+
}) : Array.isArray(o.tree) ? Pe(o.tree, `${r}.tree`, a, t, n) : t.push({
|
|
1797
1798
|
severity: "error",
|
|
1798
1799
|
path: `${r}.tree`,
|
|
1799
1800
|
message: "\"tree\" must be an array"
|
|
@@ -1802,7 +1803,7 @@ function Oe(e, t, n) {
|
|
|
1802
1803
|
layerIds: a
|
|
1803
1804
|
};
|
|
1804
1805
|
}
|
|
1805
|
-
function
|
|
1806
|
+
function Ae(e, t, n, r) {
|
|
1806
1807
|
let i = "state";
|
|
1807
1808
|
if (e === void 0) return;
|
|
1808
1809
|
if (!J(e)) {
|
|
@@ -1814,7 +1815,7 @@ function ke(e, t, n, r) {
|
|
|
1814
1815
|
return;
|
|
1815
1816
|
}
|
|
1816
1817
|
let a = e;
|
|
1817
|
-
Y(a,
|
|
1818
|
+
Y(a, K.state, i, r), a.activeBackground !== void 0 && typeof a.activeBackground != "string" && n.push({
|
|
1818
1819
|
severity: "error",
|
|
1819
1820
|
path: `${i}.activeBackground`,
|
|
1820
1821
|
message: "\"activeBackground\" must be a string"
|
|
@@ -1837,7 +1838,7 @@ function ke(e, t, n, r) {
|
|
|
1837
1838
|
return;
|
|
1838
1839
|
}
|
|
1839
1840
|
let s = e;
|
|
1840
|
-
Y(s,
|
|
1841
|
+
Y(s, K.stateLayer, o, r);
|
|
1841
1842
|
let c = typeof s.ref == "string" ? s.ref : typeof s.layerId == "string" ? s.layerId : null;
|
|
1842
1843
|
c && !t.has(c) && n.push({
|
|
1843
1844
|
severity: "error",
|
|
@@ -1873,7 +1874,7 @@ function ke(e, t, n, r) {
|
|
|
1873
1874
|
message: "\"activeExclusiveLayers\" must be an object"
|
|
1874
1875
|
}));
|
|
1875
1876
|
}
|
|
1876
|
-
function
|
|
1877
|
+
function je(e, t, n, r, i) {
|
|
1877
1878
|
e.forEach((e, a) => {
|
|
1878
1879
|
let o = `${t}[${a}]`;
|
|
1879
1880
|
if (!J(e)) {
|
|
@@ -1893,26 +1894,26 @@ function Ae(e, t, n, r, i) {
|
|
|
1893
1894
|
severity: "error",
|
|
1894
1895
|
path: `${o}.id`,
|
|
1895
1896
|
message: `Duplicate source ID: "${s.id}"`
|
|
1896
|
-
}), n.add(s.id)), !
|
|
1897
|
+
}), n.add(s.id)), !Se.includes(s.type)) {
|
|
1897
1898
|
r.push({
|
|
1898
1899
|
severity: "error",
|
|
1899
1900
|
path: `${o}.type`,
|
|
1900
|
-
message: `Source "type" must be one of: ${
|
|
1901
|
+
message: `Source "type" must be one of: ${Se.join(", ")}`
|
|
1901
1902
|
});
|
|
1902
1903
|
return;
|
|
1903
1904
|
}
|
|
1904
|
-
let c = [...
|
|
1905
|
+
let c = [...K.sourceBase];
|
|
1905
1906
|
if (s.type === "raster") {
|
|
1906
|
-
c.push(...
|
|
1907
|
+
c.push(...K.sourceRaster);
|
|
1907
1908
|
let e = typeof s.url == "string" && s.url.length > 0, t = Array.isArray(s.url) && s.url.length > 0 && s.url.every((e) => typeof e == "string" && e.length > 0);
|
|
1908
1909
|
!e && !t && r.push({
|
|
1909
1910
|
severity: "error",
|
|
1910
1911
|
path: `${o}.url`,
|
|
1911
1912
|
message: "Raster source requires a non-empty string \"url\" or string array"
|
|
1912
|
-
}), s.service !== void 0 && !
|
|
1913
|
+
}), s.service !== void 0 && !Ce.includes(s.service) && r.push({
|
|
1913
1914
|
severity: "error",
|
|
1914
1915
|
path: `${o}.service`,
|
|
1915
|
-
message: `Raster "service" must be one of: ${
|
|
1916
|
+
message: `Raster "service" must be one of: ${Ce.join(", ")}`
|
|
1916
1917
|
}), s.tileSize !== void 0 && (typeof s.tileSize != "number" || s.tileSize <= 0) && r.push({
|
|
1917
1918
|
severity: "error",
|
|
1918
1919
|
path: `${o}.tileSize`,
|
|
@@ -1940,7 +1941,7 @@ function Ae(e, t, n, r, i) {
|
|
|
1940
1941
|
path: `${o}.minzoom`,
|
|
1941
1942
|
message: "\"minzoom\" cannot be greater than \"maxzoom\""
|
|
1942
1943
|
});
|
|
1943
|
-
} else if (s.type === "geojson") c.push(...
|
|
1944
|
+
} else if (s.type === "geojson") c.push(...K.sourceGeojson), s.data === void 0 ? r.push({
|
|
1944
1945
|
severity: "error",
|
|
1945
1946
|
path: `${o}.data`,
|
|
1946
1947
|
message: "GeoJSON source requires \"data\""
|
|
@@ -1950,14 +1951,14 @@ function Ae(e, t, n, r, i) {
|
|
|
1950
1951
|
message: "\"data\" must be a URL string or GeoJSON object"
|
|
1951
1952
|
});
|
|
1952
1953
|
else if (s.type === "vector") {
|
|
1953
|
-
c.push(...
|
|
1954
|
+
c.push(...K.sourceVector);
|
|
1954
1955
|
let e = typeof s.url == "string" && s.url.length > 0, t = Array.isArray(s.tiles) && s.tiles.length > 0;
|
|
1955
1956
|
!e && !t && r.push({
|
|
1956
1957
|
severity: "error",
|
|
1957
1958
|
path: `${o}.url`,
|
|
1958
1959
|
message: "Vector source requires a \"url\" or \"tiles\""
|
|
1959
1960
|
});
|
|
1960
|
-
} else s.type === "raster-dem" && (c.push(...
|
|
1961
|
+
} else s.type === "raster-dem" && (c.push(...K.sourceRasterDem), Array.isArray(s.tiles) && s.tiles.length > 0 && s.tiles.every((e) => typeof e == "string" && e.length > 0) || r.push({
|
|
1961
1962
|
severity: "error",
|
|
1962
1963
|
path: `${o}.tiles`,
|
|
1963
1964
|
message: "Raster-dem source requires a non-empty \"tiles\" string array"
|
|
@@ -1969,7 +1970,7 @@ function Ae(e, t, n, r, i) {
|
|
|
1969
1970
|
});
|
|
1970
1971
|
});
|
|
1971
1972
|
}
|
|
1972
|
-
function
|
|
1973
|
+
function Me(e, t, n, r, i, a) {
|
|
1973
1974
|
e.forEach((e, o) => {
|
|
1974
1975
|
let s = `${t}[${o}]`;
|
|
1975
1976
|
if (!J(e)) {
|
|
@@ -1982,10 +1983,10 @@ function je(e, t, n, r, i, a) {
|
|
|
1982
1983
|
}
|
|
1983
1984
|
let c = e;
|
|
1984
1985
|
Y(c, c.type === "style" ? [
|
|
1985
|
-
...
|
|
1986
|
+
...K.layer,
|
|
1986
1987
|
"attribution",
|
|
1987
1988
|
"version"
|
|
1988
|
-
] :
|
|
1989
|
+
] : K.layer, s, a), typeof c.id != "string" || c.id.length === 0 ? i.push({
|
|
1989
1990
|
severity: "error",
|
|
1990
1991
|
path: `${s}.id`,
|
|
1991
1992
|
message: "Layer must have a non-empty string \"id\""
|
|
@@ -1999,7 +2000,7 @@ function je(e, t, n, r, i, a) {
|
|
|
1999
2000
|
severity: "error",
|
|
2000
2001
|
path: `${s}.annotation`,
|
|
2001
2002
|
message: "Allmaps layer must have an \"annotation\" URL"
|
|
2002
|
-
}) : l === "style" ? Array.isArray(c.layers) && c.layers.length > 0 &&
|
|
2003
|
+
}) : l === "style" ? Array.isArray(c.layers) && c.layers.length > 0 && Ne(c.layers, `${s}.layers`, n, i, a) : typeof l == "string" && q.includes(l) ? typeof c.source != "string" && a.push({
|
|
2003
2004
|
severity: "warning",
|
|
2004
2005
|
path: `${s}.source`,
|
|
2005
2006
|
message: "Standard layer should have a \"source\""
|
|
@@ -2010,7 +2011,7 @@ function je(e, t, n, r, i, a) {
|
|
|
2010
2011
|
});
|
|
2011
2012
|
});
|
|
2012
2013
|
}
|
|
2013
|
-
function
|
|
2014
|
+
function Ne(e, t, n, r, i) {
|
|
2014
2015
|
e.forEach((e, a) => {
|
|
2015
2016
|
let o = `${t}[${a}]`;
|
|
2016
2017
|
if (!J(e)) {
|
|
@@ -2022,7 +2023,7 @@ function Me(e, t, n, r, i) {
|
|
|
2022
2023
|
return;
|
|
2023
2024
|
}
|
|
2024
2025
|
let s = e;
|
|
2025
|
-
Y(s,
|
|
2026
|
+
Y(s, K.styleLayer, o, i), s.minZoom !== void 0 && r.push({
|
|
2026
2027
|
severity: "error",
|
|
2027
2028
|
path: `${o}.minZoom`,
|
|
2028
2029
|
message: "\"minZoom\" is not supported; use \"minzoom\" (Mapbox/MapLibre style spec)"
|
|
@@ -2053,12 +2054,12 @@ function Me(e, t, n, r, i) {
|
|
|
2053
2054
|
}));
|
|
2054
2055
|
});
|
|
2055
2056
|
}
|
|
2056
|
-
function
|
|
2057
|
+
function Pe(e, t, n, r, i) {
|
|
2057
2058
|
e.forEach((e, a) => {
|
|
2058
|
-
|
|
2059
|
+
Fe(e, `${t}[${a}]`, n, r, i);
|
|
2059
2060
|
});
|
|
2060
2061
|
}
|
|
2061
|
-
function
|
|
2062
|
+
function Fe(e, t, n, r, i) {
|
|
2062
2063
|
if (!J(e)) {
|
|
2063
2064
|
r.push({
|
|
2064
2065
|
severity: "error",
|
|
@@ -2068,7 +2069,7 @@ function Pe(e, t, n, r, i) {
|
|
|
2068
2069
|
return;
|
|
2069
2070
|
}
|
|
2070
2071
|
let a = e;
|
|
2071
|
-
if (Y(a,
|
|
2072
|
+
if (Y(a, K.treeNode, t, i), a.separator === !0) {
|
|
2072
2073
|
(typeof a.label != "string" || a.label.length === 0) && r.push({
|
|
2073
2074
|
severity: "error",
|
|
2074
2075
|
path: `${t}.label`,
|
|
@@ -2095,7 +2096,7 @@ function Pe(e, t, n, r, i) {
|
|
|
2095
2096
|
path: `${t}.layerId`,
|
|
2096
2097
|
message: "\"layerId\" must be a string"
|
|
2097
2098
|
})), s && (Array.isArray(a.children) ? a.children.forEach((e, a) => {
|
|
2098
|
-
|
|
2099
|
+
Fe(e, `${t}.children[${a}]`, n, r, i);
|
|
2099
2100
|
}) : r.push({
|
|
2100
2101
|
severity: "error",
|
|
2101
2102
|
path: `${t}.children`,
|
|
@@ -2108,10 +2109,10 @@ function Pe(e, t, n, r, i) {
|
|
|
2108
2109
|
severity: "error",
|
|
2109
2110
|
path: `${t}.expanded`,
|
|
2110
2111
|
message: "\"expanded\" must be a boolean"
|
|
2111
|
-
}), a.selectionMode !== void 0 && !
|
|
2112
|
+
}), a.selectionMode !== void 0 && !we.includes(a.selectionMode) && r.push({
|
|
2112
2113
|
severity: "error",
|
|
2113
2114
|
path: `${t}.selectionMode`,
|
|
2114
|
-
message: `"selectionMode" must be one of: ${
|
|
2115
|
+
message: `"selectionMode" must be one of: ${we.join(", ")}`
|
|
2115
2116
|
}), a.selectionGroup !== void 0 && typeof a.selectionGroup != "string" && r.push({
|
|
2116
2117
|
severity: "error",
|
|
2117
2118
|
path: `${t}.selectionGroup`,
|
|
@@ -2134,7 +2135,7 @@ function Pe(e, t, n, r, i) {
|
|
|
2134
2135
|
message: "\"allowNone\" only applies when \"selectionMode\" is \"single\""
|
|
2135
2136
|
});
|
|
2136
2137
|
}
|
|
2137
|
-
function
|
|
2138
|
+
function Ie(e, t, n, r, i) {
|
|
2138
2139
|
if (!J(e)) {
|
|
2139
2140
|
i.push({
|
|
2140
2141
|
severity: "warning",
|
|
@@ -2162,10 +2163,10 @@ function Fe(e, t, n, r, i) {
|
|
|
2162
2163
|
severity: "warning",
|
|
2163
2164
|
path: `${o}.enabled`,
|
|
2164
2165
|
message: "\"enabled\" should be a boolean"
|
|
2165
|
-
}),
|
|
2166
|
+
}), Le(s, o, i), Array.isArray(s.items) && s.items.forEach((e, t) => {
|
|
2166
2167
|
if (!J(e)) return;
|
|
2167
2168
|
let a = `${o}.items[${t}]`, s = e;
|
|
2168
|
-
if (
|
|
2169
|
+
if (Le(s, a, i), s.type === "layerTree") {
|
|
2169
2170
|
if (s.catalog !== void 0 && i.push({
|
|
2170
2171
|
severity: "warning",
|
|
2171
2172
|
path: `${a}.catalog`,
|
|
@@ -2186,9 +2187,9 @@ function Fe(e, t, n, r, i) {
|
|
|
2186
2187
|
});
|
|
2187
2188
|
return;
|
|
2188
2189
|
}
|
|
2189
|
-
|
|
2190
|
+
Pe(s.tree, `${a}.tree`, n, r, i);
|
|
2190
2191
|
}
|
|
2191
|
-
}), e === "search" && (Y(s,
|
|
2192
|
+
}), e === "search" && (Y(s, K.toolSearch, o, i), s.provider !== void 0 && (typeof s.provider == "string" ? be.has(s.provider.toLowerCase()) || i.push({
|
|
2192
2193
|
severity: "warning",
|
|
2193
2194
|
path: `${o}.provider`,
|
|
2194
2195
|
message: `Unknown search provider "${s.provider}"`
|
|
@@ -2200,7 +2201,7 @@ function Fe(e, t, n, r, i) {
|
|
|
2200
2201
|
severity: "warning",
|
|
2201
2202
|
path: `${o}.attribution`,
|
|
2202
2203
|
message: "\"attribution\" should be a string"
|
|
2203
|
-
})), e === "insetMap" && (Y(s,
|
|
2204
|
+
})), e === "insetMap" && (Y(s, K.toolInsetMap, o, i), s.zoomOffset !== void 0 && (typeof s.zoomOffset != "number" || !Number.isFinite(s.zoomOffset)) && i.push({
|
|
2204
2205
|
severity: "warning",
|
|
2205
2206
|
path: `${o}.zoomOffset`,
|
|
2206
2207
|
message: "\"zoomOffset\" should be a finite number"
|
|
@@ -2219,7 +2220,7 @@ function Fe(e, t, n, r, i) {
|
|
|
2219
2220
|
});
|
|
2220
2221
|
else {
|
|
2221
2222
|
let e = s.background;
|
|
2222
|
-
Y(e,
|
|
2223
|
+
Y(e, K.toolInsetMapBackground, `${o}.background`, i), e.service !== "xyz" && i.push({
|
|
2223
2224
|
severity: "warning",
|
|
2224
2225
|
path: `${o}.background.service`,
|
|
2225
2226
|
message: "Only \"xyz\" background service is currently supported"
|
|
@@ -2249,7 +2250,7 @@ function Fe(e, t, n, r, i) {
|
|
|
2249
2250
|
}
|
|
2250
2251
|
});
|
|
2251
2252
|
}
|
|
2252
|
-
function
|
|
2253
|
+
function Le(e, t, n) {
|
|
2253
2254
|
e.label !== void 0 && typeof e.label != "string" && n.push({
|
|
2254
2255
|
severity: "warning",
|
|
2255
2256
|
path: `${t}.label`,
|
|
@@ -2258,9 +2259,9 @@ function Ie(e, t, n) {
|
|
|
2258
2259
|
severity: "warning",
|
|
2259
2260
|
path: `${t}.title`,
|
|
2260
2261
|
message: "\"title\" should be a string"
|
|
2261
|
-
}),
|
|
2262
|
+
}), Re(e.icon, `${t}.icon`, n);
|
|
2262
2263
|
}
|
|
2263
|
-
function
|
|
2264
|
+
function Re(e, t, n) {
|
|
2264
2265
|
if (e === void 0) return;
|
|
2265
2266
|
if (typeof e == "string") {
|
|
2266
2267
|
e.trim().length === 0 && n.push({
|
|
@@ -2300,7 +2301,7 @@ function Le(e, t, n) {
|
|
|
2300
2301
|
function J(e) {
|
|
2301
2302
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2302
2303
|
}
|
|
2303
|
-
function
|
|
2304
|
+
function ze(e) {
|
|
2304
2305
|
if (!Array.isArray(e) || e.length !== 2) return !1;
|
|
2305
2306
|
let [t, n] = e;
|
|
2306
2307
|
return typeof t == "number" && typeof n == "number" && t >= -180 && t <= 180 && n >= -90 && n <= 90;
|
|
@@ -2331,20 +2332,20 @@ function Z(e, t) {
|
|
|
2331
2332
|
};
|
|
2332
2333
|
return n.type === "raster" && n.url === void 0 && Array.isArray(n.tiles) && (n.url = n.tiles), n.type === "raster" && n.service === void 0 && (n.service = "xyz"), n;
|
|
2333
2334
|
}
|
|
2334
|
-
function
|
|
2335
|
+
function Be(e) {
|
|
2335
2336
|
return X(e) ? Object.entries(e).map(([e, t]) => Z(e, t)) : [];
|
|
2336
2337
|
}
|
|
2337
|
-
function
|
|
2338
|
+
function Q(e, t) {
|
|
2338
2339
|
let n = typeof e.source == "string" ? t?.get(e.source) ?? e.source : void 0, r = e["source-layer"] ?? e.sourceLayer, i = e.minzoom ?? e.minZoom, a = e.maxzoom ?? e.maxZoom, o = { ...e };
|
|
2339
2340
|
return n !== void 0 && (o.source = n), r !== void 0 && (o["source-layer"] = r), i !== void 0 && (o.minzoom = i), a !== void 0 && (o.maxzoom = a), delete o.sourceLayer, delete o.minZoom, delete o.maxZoom, o;
|
|
2340
2341
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return Array.isArray(e) ? e.filter(X).map((e) =>
|
|
2342
|
+
function Ve(e, t) {
|
|
2343
|
+
return Array.isArray(e) ? e.filter(X).map((e) => $(e, t)) : X(e) ? Object.entries(e).map(([e, n]) => X(n) ? $({
|
|
2343
2344
|
id: e,
|
|
2344
2345
|
...n
|
|
2345
2346
|
}, t) : null).filter(Boolean) : [];
|
|
2346
2347
|
}
|
|
2347
|
-
function
|
|
2348
|
+
function $(e, t) {
|
|
2348
2349
|
let n = typeof e.id == "string" ? e.id : null;
|
|
2349
2350
|
if (!n) return null;
|
|
2350
2351
|
let r = typeof e.fallbackLayerId == "string" ? e.fallbackLayerId : typeof e.fallbackRef == "string" ? e.fallbackRef : void 0, i = typeof e.singleGroup == "string" ? e.singleGroup : typeof e.selectionGroup == "string" ? e.selectionGroup : void 0, a = X(e.metadata) ? {
|
|
@@ -2374,7 +2375,7 @@ function Be(e, t) {
|
|
|
2374
2375
|
let e = `${n}:${a}`;
|
|
2375
2376
|
i.set(a, e), t.push(Z(e, o)), r[a] = o;
|
|
2376
2377
|
}
|
|
2377
|
-
let a = Array.isArray(e.layers) ? e.layers.filter(X).map((e) =>
|
|
2378
|
+
let a = Array.isArray(e.layers) ? e.layers.filter(X).map((e) => Q(e, i)) : [];
|
|
2378
2379
|
return {
|
|
2379
2380
|
...o,
|
|
2380
2381
|
type: "style",
|
|
@@ -2387,7 +2388,7 @@ function Be(e, t) {
|
|
|
2387
2388
|
return t !== void 0 && (i["source-layer"] = t), n !== void 0 && (i.minzoom = n), r !== void 0 && (i.maxzoom = r), delete i.sourceLayer, delete i.minZoom, delete i.maxZoom, i;
|
|
2388
2389
|
}
|
|
2389
2390
|
if (Array.isArray(e.layerset)) {
|
|
2390
|
-
let t = e.layerset.filter(X).map((e) =>
|
|
2391
|
+
let t = e.layerset.filter(X).map((e) => Q(e));
|
|
2391
2392
|
return {
|
|
2392
2393
|
...o,
|
|
2393
2394
|
type: "style",
|
|
@@ -2401,7 +2402,7 @@ function Be(e, t) {
|
|
|
2401
2402
|
let r = `${n}:${e}`;
|
|
2402
2403
|
i.set(e, r), t.push(Z(r, o)), a[e] = o;
|
|
2403
2404
|
}
|
|
2404
|
-
let s = Array.isArray(r.layers) ? r.layers.filter(X).map((e) =>
|
|
2405
|
+
let s = Array.isArray(r.layers) ? r.layers.filter(X).map((e) => Q(e, i)) : [], c = typeof r.url == "string" ? r.url : void 0;
|
|
2405
2406
|
return {
|
|
2406
2407
|
...o,
|
|
2407
2408
|
type: "style",
|
|
@@ -2413,7 +2414,7 @@ function Be(e, t) {
|
|
|
2413
2414
|
}
|
|
2414
2415
|
return null;
|
|
2415
2416
|
}
|
|
2416
|
-
function
|
|
2417
|
+
function He(e, t) {
|
|
2417
2418
|
let n = (e) => {
|
|
2418
2419
|
let t = e.selectionMode;
|
|
2419
2420
|
if (t === "single" || t === "multiple") return t;
|
|
@@ -2455,7 +2456,7 @@ function Ve(e, t) {
|
|
|
2455
2456
|
layerId: e.id
|
|
2456
2457
|
}).filter(Boolean);
|
|
2457
2458
|
}
|
|
2458
|
-
function
|
|
2459
|
+
function Ue(e, t) {
|
|
2459
2460
|
if (!X(e)) return;
|
|
2460
2461
|
let n = JSON.parse(JSON.stringify(e)), r = Object.values(n).filter((e) => X(e));
|
|
2461
2462
|
for (let e of r) {
|
|
@@ -2464,12 +2465,12 @@ function He(e, t) {
|
|
|
2464
2465
|
}
|
|
2465
2466
|
return n;
|
|
2466
2467
|
}
|
|
2467
|
-
function
|
|
2468
|
+
function We(e) {
|
|
2468
2469
|
if (!X(e)) return {
|
|
2469
2470
|
sources: [],
|
|
2470
2471
|
layers: []
|
|
2471
2472
|
};
|
|
2472
|
-
let t = e, n = Array.isArray(t.sources) ? t.sources :
|
|
2473
|
+
let t = e, n = Array.isArray(t.sources) ? t.sources : Be(t.sources), r = [], i = Ve(t.layers, r), a = /* @__PURE__ */ new Map();
|
|
2473
2474
|
for (let e of [...n, ...r]) X(e) && typeof e.id == "string" && !a.has(e.id) && a.set(e.id, e);
|
|
2474
2475
|
return {
|
|
2475
2476
|
sources: Array.from(a.values()),
|
|
@@ -2489,12 +2490,12 @@ function Ue(e) {
|
|
|
2489
2490
|
})
|
|
2490
2491
|
};
|
|
2491
2492
|
}
|
|
2492
|
-
function
|
|
2493
|
+
function Ge(e) {
|
|
2493
2494
|
if (!X(e)) return e;
|
|
2494
2495
|
let t = e;
|
|
2495
2496
|
if (X(t.layerData)) return {
|
|
2496
2497
|
...t,
|
|
2497
|
-
layerData:
|
|
2498
|
+
layerData: We(t.layerData)
|
|
2498
2499
|
};
|
|
2499
2500
|
if (X(t.catalog)) {
|
|
2500
2501
|
let e = t.catalog;
|
|
@@ -2508,7 +2509,7 @@ function We(e) {
|
|
|
2508
2509
|
};
|
|
2509
2510
|
}
|
|
2510
2511
|
if (!X(t.library)) return t;
|
|
2511
|
-
let n = t.library, r =
|
|
2512
|
+
let n = t.library, r = Be(n.sources), i = Ve(n.layers, r), a = He(n.catalogs, i);
|
|
2512
2513
|
return {
|
|
2513
2514
|
map: t.map,
|
|
2514
2515
|
runtimeMap: X(t.runtimeMap) ? t.runtimeMap : void 0,
|
|
@@ -2516,14 +2517,14 @@ function We(e) {
|
|
|
2516
2517
|
sources: r,
|
|
2517
2518
|
layers: i
|
|
2518
2519
|
},
|
|
2519
|
-
tools:
|
|
2520
|
+
tools: Ue(t.tools, a),
|
|
2520
2521
|
state: X(t.state) ? t.state : void 0,
|
|
2521
2522
|
version: typeof t.version == "number" ? t.version : void 0,
|
|
2522
2523
|
project: X(t.project) ? t.project : void 0
|
|
2523
2524
|
};
|
|
2524
2525
|
}
|
|
2525
|
-
function
|
|
2526
|
-
let n =
|
|
2526
|
+
function Ke(e, t) {
|
|
2527
|
+
let n = Ge(e), r = Te(n);
|
|
2527
2528
|
if (!r.valid) {
|
|
2528
2529
|
let e = r.errors.map((e) => ` ${e.path}: ${e.message}`).join("\n");
|
|
2529
2530
|
throw Error(`Invalid config from "${t}":\n${e}`);
|
|
@@ -2532,12 +2533,12 @@ function Ge(e, t) {
|
|
|
2532
2533
|
}
|
|
2533
2534
|
//#endregion
|
|
2534
2535
|
//#region src/bootstrap/WebMapX.ts
|
|
2535
|
-
var
|
|
2536
|
+
var qe = "https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2/cdn/", Je = {
|
|
2536
2537
|
version: 8,
|
|
2537
2538
|
sources: {},
|
|
2538
2539
|
layers: []
|
|
2539
2540
|
};
|
|
2540
|
-
function
|
|
2541
|
+
function Ye(e) {
|
|
2541
2542
|
return { mainToolbar: {
|
|
2542
2543
|
type: "toolbar",
|
|
2543
2544
|
enabled: !0,
|
|
@@ -2545,55 +2546,55 @@ function qe(e) {
|
|
|
2545
2546
|
items: e.map((e) => ({ tool: e }))
|
|
2546
2547
|
} };
|
|
2547
2548
|
}
|
|
2548
|
-
var
|
|
2549
|
-
static async mount(
|
|
2550
|
-
let
|
|
2551
|
-
if (!e.ok) throw Error(`[webmapx] Failed to load config: ${
|
|
2549
|
+
var Xe = class {
|
|
2550
|
+
static async mount(t, n) {
|
|
2551
|
+
let r = typeof n.config == "string" ? await fetch(n.config).then((e) => {
|
|
2552
|
+
if (!e.ok) throw Error(`[webmapx] Failed to load config: ${n.config}`);
|
|
2552
2553
|
return e.json();
|
|
2553
|
-
}) :
|
|
2554
|
-
await _e();
|
|
2555
|
-
let
|
|
2554
|
+
}) : n.config;
|
|
2555
|
+
e(qe), await _e();
|
|
2556
|
+
let a = r.engine ?? "maplibre", s = Array.isArray(r.tools) ? r.tools : [];
|
|
2556
2557
|
await Promise.all([
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
]),
|
|
2561
|
-
let
|
|
2562
|
-
if (!
|
|
2563
|
-
let
|
|
2564
|
-
|
|
2565
|
-
let
|
|
2566
|
-
...
|
|
2558
|
+
i(a),
|
|
2559
|
+
o(s),
|
|
2560
|
+
r.plugins?.length ? c(r.plugins) : Promise.resolve()
|
|
2561
|
+
]), r.locale && r.locale !== "en" && await G(r.locale);
|
|
2562
|
+
let l = document.querySelector(t);
|
|
2563
|
+
if (!l) throw Error(`[webmapx] Mount target not found: "${t}"`);
|
|
2564
|
+
let u = t.replace(/^#/, "").replace(/[^a-zA-Z0-9_-]/g, "-") || "webmapx-map";
|
|
2565
|
+
l.innerHTML = `<webmapx-map id="${u}" adapter="${a}"><div slot="map-view" style="position:absolute;inset:0;"></div><webmapx-layout></webmapx-layout></webmapx-map>`;
|
|
2566
|
+
let d = l.querySelector("webmapx-map"), f = r.map, { engine: p, tools: m, locale: h, plugins: g, ..._ } = r, v = s.length > 0 ? Ye(s) : typeof m == "object" && !Array.isArray(m) ? m : void 0, y = Ke({
|
|
2567
|
+
..._,
|
|
2567
2568
|
map: {
|
|
2568
|
-
type:
|
|
2569
|
+
type: a,
|
|
2569
2570
|
center: [0, 0],
|
|
2570
2571
|
zoom: 2,
|
|
2571
|
-
...
|
|
2572
|
+
...f
|
|
2572
2573
|
},
|
|
2573
|
-
...
|
|
2574
|
+
...v ? { tools: v } : {}
|
|
2574
2575
|
}, "WebMapX.mount");
|
|
2575
|
-
|
|
2576
|
-
let
|
|
2577
|
-
if (
|
|
2576
|
+
d.setConfig(y);
|
|
2577
|
+
let b = d.querySelector("webmapx-layout");
|
|
2578
|
+
if (b && b.childElementCount === 0) {
|
|
2578
2579
|
let { buildLayoutFromConfig: e } = await import("./dynamic-layout-DmLc5_yX.js");
|
|
2579
|
-
e(
|
|
2580
|
+
e(b, v ?? y.tools);
|
|
2580
2581
|
}
|
|
2581
|
-
let
|
|
2582
|
-
if (!
|
|
2582
|
+
let x = await d.getAdapterAsync?.();
|
|
2583
|
+
if (!x) {
|
|
2583
2584
|
console.error("[webmapx] Adapter not available — check engine config.");
|
|
2584
2585
|
return;
|
|
2585
2586
|
}
|
|
2586
|
-
let
|
|
2587
|
-
center:
|
|
2588
|
-
zoom:
|
|
2589
|
-
...
|
|
2590
|
-
...
|
|
2591
|
-
...
|
|
2592
|
-
...
|
|
2593
|
-
...typeof
|
|
2587
|
+
let S = f?.style ?? Je, C = {
|
|
2588
|
+
center: f?.center ?? [0, 0],
|
|
2589
|
+
zoom: f?.zoom ?? 2,
|
|
2590
|
+
...f?.bearing == null ? {} : { bearing: f.bearing },
|
|
2591
|
+
...f?.pitch == null ? {} : { pitch: f.pitch },
|
|
2592
|
+
...f?.minZoom == null ? {} : { minZoom: f.minZoom },
|
|
2593
|
+
...f?.maxZoom == null ? {} : { maxZoom: f.maxZoom },
|
|
2594
|
+
...typeof S == "string" ? { styleUrl: S } : { style: S }
|
|
2594
2595
|
};
|
|
2595
|
-
|
|
2596
|
+
x.initialize(u, C);
|
|
2596
2597
|
}
|
|
2597
2598
|
};
|
|
2598
2599
|
//#endregion
|
|
2599
|
-
export {
|
|
2600
|
+
export { Xe as WebMapX, t as WebmapxBaseTool, n as WebmapxPluginTool, G as changeLocale, U as i18n, ve as t };
|