@edugis-org/webmapx 0.1.13 → 0.1.14
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/{webmapx-coordinates-tool-Dr0il_IE.js → webmapx-coordinates-tool-BJd6idRr.js}
RENAMED
|
@@ -3,7 +3,7 @@ import { t } from "./webmapx-base-tool-Bc9Wz0yA.js";
|
|
|
3
3
|
import { css as n, html as r, nothing as i } from "lit";
|
|
4
4
|
import { customElement as a, query as o, state as s } from "lit/decorators.js";
|
|
5
5
|
//#region src/utils/epsg-lookup-manager.ts
|
|
6
|
-
var c = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.
|
|
6
|
+
var c = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.14/public", l = 6e4, u = new class {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.worker = null, this.isReady = !1, this.isInitializing = !1, this.initPromise = null, this.pendingRequests = /* @__PURE__ */ new Map(), this.requestCounter = 0, this.idleTimeout = null, this.idleTimeoutMs = l;
|
|
9
9
|
}
|
package/dist-lib/webmapx.js
CHANGED
|
@@ -27,7 +27,7 @@ var a = {
|
|
|
27
27
|
"3d": () => import("./webmapx-3d-tool-CKoLGMpk.js"),
|
|
28
28
|
truearea: () => import("./webmapx-truearea-tool-dxSgcbOj.js"),
|
|
29
29
|
"view-mode": () => import("./webmapx-view-mode-tool-DVSMakdh.js"),
|
|
30
|
-
coordinates: () => import("./webmapx-coordinates-tool-
|
|
30
|
+
coordinates: () => import("./webmapx-coordinates-tool-BJd6idRr.js"),
|
|
31
31
|
settings: () => import("./webmapx-settings-B0AT9Vjn.js"),
|
|
32
32
|
"config-edit": () => import("./webmapx-config-edit-tool-7265_DNz.js")
|
|
33
33
|
};
|
|
@@ -110,7 +110,7 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
110
110
|
"\"": """,
|
|
111
111
|
"'": "'",
|
|
112
112
|
"/": "/"
|
|
113
|
-
},
|
|
113
|
+
}, w = (e) => l(e) ? e.replace(/[&<>"'\/]/g, (e) => C[e]) : e, T = class {
|
|
114
114
|
constructor(e) {
|
|
115
115
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
116
116
|
}
|
|
@@ -120,23 +120,23 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
120
120
|
let n = new RegExp(e);
|
|
121
121
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
122
122
|
}
|
|
123
|
-
},
|
|
123
|
+
}, E = [
|
|
124
124
|
" ",
|
|
125
125
|
",",
|
|
126
126
|
"?",
|
|
127
127
|
"!",
|
|
128
128
|
";"
|
|
129
|
-
],
|
|
129
|
+
], D = new T(20), O = (e, t, n) => {
|
|
130
130
|
t ||= "", n ||= "";
|
|
131
|
-
let r =
|
|
131
|
+
let r = E.filter((e) => !t.includes(e) && !n.includes(e));
|
|
132
132
|
if (r.length === 0) return !0;
|
|
133
|
-
let i =
|
|
133
|
+
let i = D.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
134
134
|
if (!a) {
|
|
135
135
|
let t = e.indexOf(n);
|
|
136
136
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
137
137
|
}
|
|
138
138
|
return a;
|
|
139
|
-
},
|
|
139
|
+
}, k = (e, t, n = ".") => {
|
|
140
140
|
if (!e) return;
|
|
141
141
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
142
142
|
let r = t.split(n), i = e;
|
|
@@ -155,7 +155,7 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
155
155
|
i = t;
|
|
156
156
|
}
|
|
157
157
|
return i;
|
|
158
|
-
},
|
|
158
|
+
}, A = (e) => e?.replace(/_/g, "-"), ee = {
|
|
159
159
|
type: "logger",
|
|
160
160
|
log(e) {
|
|
161
161
|
this.output("log", e);
|
|
@@ -169,12 +169,12 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
169
169
|
output(e, t) {
|
|
170
170
|
console?.[e]?.apply?.(console, t);
|
|
171
171
|
}
|
|
172
|
-
},
|
|
172
|
+
}, j = new class e {
|
|
173
173
|
constructor(e, t = {}) {
|
|
174
174
|
this.init(e, t);
|
|
175
175
|
}
|
|
176
176
|
init(e, t = {}) {
|
|
177
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
177
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || ee, this.options = t, this.debug = t.debug;
|
|
178
178
|
}
|
|
179
179
|
log(...e) {
|
|
180
180
|
return this.forward(e, "log", "", !0);
|
|
@@ -200,7 +200,7 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
200
200
|
clone(t) {
|
|
201
201
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
202
202
|
}
|
|
203
|
-
}(),
|
|
203
|
+
}(), M = class {
|
|
204
204
|
constructor() {
|
|
205
205
|
this.observers = {};
|
|
206
206
|
}
|
|
@@ -233,7 +233,7 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
233
233
|
for (let i = 0; i < r; i++) n(e, ...t);
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, te = class extends M {
|
|
237
237
|
constructor(e, t = {
|
|
238
238
|
ns: ["translation"],
|
|
239
239
|
defaultNS: "translation"
|
|
@@ -251,7 +251,7 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
251
251
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
252
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
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 :
|
|
254
|
+
return !s && !t && !n && e.includes(".") && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !l(n) ? s : k(this.data?.[e]?.[t], n, i);
|
|
255
255
|
}
|
|
256
256
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
257
257
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
@@ -292,7 +292,7 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
292
292
|
toJSON() {
|
|
293
293
|
return this.data;
|
|
294
294
|
}
|
|
295
|
-
},
|
|
295
|
+
}, N = {
|
|
296
296
|
processors: {},
|
|
297
297
|
addPostProcessor(e) {
|
|
298
298
|
this.processors[e.name] = e;
|
|
@@ -302,20 +302,20 @@ var l = (e) => typeof e == "string", u = () => {
|
|
|
302
302
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
303
303
|
}), t;
|
|
304
304
|
}
|
|
305
|
-
},
|
|
306
|
-
function
|
|
305
|
+
}, P = Symbol("i18next/PATH_KEY");
|
|
306
|
+
function ne() {
|
|
307
307
|
let e = [], t = Object.create(null), n;
|
|
308
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
308
|
+
return t.get = (r, i) => (n?.revoke?.(), i === P ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
let { [
|
|
310
|
+
function F(e, t) {
|
|
311
|
+
let { [P]: n } = e(ne()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":", a = t?.enableSelector === "strict";
|
|
312
312
|
if (n.length > 1 && i) {
|
|
313
313
|
let e = t?.ns, o = a ? Array.isArray(e) ? e : e ? [e] : null : Array.isArray(e) ? e : null;
|
|
314
314
|
if (o && (a ? o : o.length > 1 ? o.slice(1) : []).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
315
315
|
}
|
|
316
316
|
return n.join(r);
|
|
317
317
|
}
|
|
318
|
-
var
|
|
318
|
+
var I = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", re = class e extends M {
|
|
319
319
|
constructor(e, t = {}) {
|
|
320
320
|
super(), f([
|
|
321
321
|
"resourceStore",
|
|
@@ -325,7 +325,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
325
325
|
"backendConnector",
|
|
326
326
|
"i18nFormat",
|
|
327
327
|
"utils"
|
|
328
|
-
], 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 = j.create("translator"), this.checkedLoadedFor = {};
|
|
329
329
|
}
|
|
330
330
|
changeLanguage(e) {
|
|
331
331
|
e && (this.language = e);
|
|
@@ -335,13 +335,13 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
335
335
|
if (e == null) return !1;
|
|
336
336
|
let r = this.resolve(e, n);
|
|
337
337
|
if (r?.res === void 0) return !1;
|
|
338
|
-
let i =
|
|
338
|
+
let i = I(r.res);
|
|
339
339
|
return !(n.returnObjects === !1 && i);
|
|
340
340
|
}
|
|
341
341
|
extractFromKey(e, t) {
|
|
342
342
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
343
343
|
n === void 0 && (n = ":");
|
|
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 && !
|
|
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 && !O(e, n, r);
|
|
345
345
|
if (a && !o) {
|
|
346
346
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
347
347
|
if (t && t.length > 0) return {
|
|
@@ -359,10 +359,10 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
359
359
|
translate(t, n, r) {
|
|
360
360
|
let i = typeof n == "object" ? { ...n } : n;
|
|
361
361
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
362
|
-
typeof t == "function" && (t =
|
|
362
|
+
typeof t == "function" && (t = F(t, {
|
|
363
363
|
...this.options,
|
|
364
364
|
...i
|
|
365
|
-
})), 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" ? F(e, {
|
|
366
366
|
...this.options,
|
|
367
367
|
...i
|
|
368
368
|
}) : String(e));
|
|
@@ -388,42 +388,42 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
388
388
|
"[object Number]",
|
|
389
389
|
"[object Function]",
|
|
390
390
|
"[object RegExp]"
|
|
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) : "",
|
|
392
|
-
b && !h && S && (
|
|
393
|
-
let
|
|
394
|
-
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) : "", w = i.ordinal && x ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", T = x && !i.ordinal && i.count === 0, E = T && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${C}`] || i[`defaultValue${w}`] || i.defaultValue, D = h;
|
|
392
|
+
b && !h && S && (D = E);
|
|
393
|
+
let O = I(D), k = Object.prototype.toString.apply(D);
|
|
394
|
+
if (b && D && O && !v.includes(k) && !(l(y) && Array.isArray(D))) {
|
|
395
395
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
396
396
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
397
|
-
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g,
|
|
397
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, D, {
|
|
398
398
|
...i,
|
|
399
399
|
ns: c
|
|
400
400
|
}) : `key '${s} (${this.language})' returned an object instead of string.`;
|
|
401
401
|
return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
|
|
402
402
|
}
|
|
403
403
|
if (o) {
|
|
404
|
-
let e = Array.isArray(
|
|
405
|
-
for (let e in
|
|
404
|
+
let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ : g;
|
|
405
|
+
for (let e in D) if (Object.prototype.hasOwnProperty.call(D, e)) {
|
|
406
406
|
let r = `${n}${o}${e}`;
|
|
407
407
|
S && !h ? t[e] = this.translate(r, {
|
|
408
408
|
...i,
|
|
409
|
-
defaultValue:
|
|
409
|
+
defaultValue: I(E) ? E[e] : void 0,
|
|
410
410
|
joinArrays: !1,
|
|
411
411
|
ns: c
|
|
412
412
|
}) : t[e] = this.translate(r, {
|
|
413
413
|
...i,
|
|
414
414
|
joinArrays: !1,
|
|
415
415
|
ns: c
|
|
416
|
-
}), t[e] === r && (t[e] =
|
|
416
|
+
}), t[e] === r && (t[e] = D[e]);
|
|
417
417
|
}
|
|
418
418
|
h = t;
|
|
419
419
|
}
|
|
420
420
|
} else if (b && l(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, t, i, r);
|
|
421
421
|
else {
|
|
422
422
|
let e = !1, n = !1;
|
|
423
|
-
!this.isValidLookup(h) && S && (e = !0, h =
|
|
424
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S &&
|
|
423
|
+
!this.isValidLookup(h) && S && (e = !0, h = E), this.isValidLookup(h) || (n = !0, h = s);
|
|
424
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S && E !== h && this.options.updateMissing;
|
|
425
425
|
if (n || e || c) {
|
|
426
|
-
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 ? E : h), o) {
|
|
427
427
|
let e = this.resolve(s, {
|
|
428
428
|
...i,
|
|
429
429
|
keySeparator: !1
|
|
@@ -439,10 +439,10 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
439
439
|
};
|
|
440
440
|
this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
|
|
441
441
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
442
|
-
|
|
443
|
-
n([e], s + t, i[`defaultValue${t}`] ||
|
|
442
|
+
T && 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}`] || E);
|
|
444
444
|
});
|
|
445
|
-
}) : n(e, s,
|
|
445
|
+
}) : n(e, s, E));
|
|
446
446
|
}
|
|
447
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));
|
|
448
448
|
}
|
|
@@ -477,7 +477,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
477
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();
|
|
478
478
|
}
|
|
479
479
|
let a = n.postProcess || this.options.postProcess, o = l(a) ? [a] : a;
|
|
480
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
480
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = N.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
481
481
|
i18nResolved: {
|
|
482
482
|
...r,
|
|
483
483
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -487,7 +487,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
487
487
|
}
|
|
488
488
|
resolve(e, t = {}) {
|
|
489
489
|
let n, r, i, a, o;
|
|
490
|
-
return l(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ?
|
|
490
|
+
return l(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? F(e, {
|
|
491
491
|
...this.options,
|
|
492
492
|
...t
|
|
493
493
|
}) : e)), e.forEach((e) => {
|
|
@@ -561,17 +561,17 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
561
561
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.startsWith("defaultValue") && e[t] !== void 0) return !0;
|
|
562
562
|
return !1;
|
|
563
563
|
}
|
|
564
|
-
},
|
|
564
|
+
}, ie = class {
|
|
565
565
|
constructor(e) {
|
|
566
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
566
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = j.create("languageUtils");
|
|
567
567
|
}
|
|
568
568
|
getScriptPartFromCode(e) {
|
|
569
|
-
if (e =
|
|
569
|
+
if (e = A(e), !e || !e.includes("-")) return null;
|
|
570
570
|
let t = e.split("-");
|
|
571
571
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
572
572
|
}
|
|
573
573
|
getLanguagePartFromCode(e) {
|
|
574
|
-
if (e =
|
|
574
|
+
if (e = A(e), !e || !e.includes("-")) return e;
|
|
575
575
|
let t = e.split("-");
|
|
576
576
|
return this.formatLanguageCode(t[0]);
|
|
577
577
|
}
|
|
@@ -619,25 +619,25 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
619
619
|
r.includes(e) || i(this.formatLanguageCode(e));
|
|
620
620
|
}), r;
|
|
621
621
|
}
|
|
622
|
-
},
|
|
622
|
+
}, ae = {
|
|
623
623
|
zero: 0,
|
|
624
624
|
one: 1,
|
|
625
625
|
two: 2,
|
|
626
626
|
few: 3,
|
|
627
627
|
many: 4,
|
|
628
628
|
other: 5
|
|
629
|
-
},
|
|
629
|
+
}, oe = {
|
|
630
630
|
select: (e) => e === 1 ? "one" : "other",
|
|
631
631
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
632
|
-
},
|
|
632
|
+
}, se = class {
|
|
633
633
|
constructor(e, t = {}) {
|
|
634
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
634
|
+
this.languageUtils = e, this.options = t, this.logger = j.create("pluralResolver"), this.pluralRulesCache = {};
|
|
635
635
|
}
|
|
636
636
|
clearCache() {
|
|
637
637
|
this.pluralRulesCache = {};
|
|
638
638
|
}
|
|
639
639
|
getRule(e, t = {}) {
|
|
640
|
-
let n =
|
|
640
|
+
let n = A(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
641
641
|
cleanedCode: n,
|
|
642
642
|
type: r
|
|
643
643
|
});
|
|
@@ -646,8 +646,8 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
646
646
|
try {
|
|
647
647
|
a = new Intl.PluralRules(n, { type: r });
|
|
648
648
|
} catch {
|
|
649
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
650
|
-
if (!e.match(/-|_/)) return
|
|
649
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), oe;
|
|
650
|
+
if (!e.match(/-|_/)) return oe;
|
|
651
651
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
652
652
|
a = this.getRule(n, t);
|
|
653
653
|
}
|
|
@@ -662,23 +662,23 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
662
662
|
}
|
|
663
663
|
getSuffixes(e, t = {}) {
|
|
664
664
|
let n = this.getRule(e, t);
|
|
665
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
665
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => ae[e] - ae[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
666
666
|
}
|
|
667
667
|
getSuffix(e, t, n = {}) {
|
|
668
668
|
let r = this.getRule(e, n);
|
|
669
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));
|
|
670
670
|
}
|
|
671
|
-
},
|
|
671
|
+
}, ce = (e, t, n, r = ".", i = !0) => {
|
|
672
672
|
let a = b(e, t, n);
|
|
673
|
-
return !a && i && l(n) && (a =
|
|
674
|
-
},
|
|
673
|
+
return !a && i && l(n) && (a = k(e, n, r), a === void 0 && (a = k(t, n, r))), a;
|
|
674
|
+
}, L = (e) => e.replace(/\$/g, "$$$$"), R = class {
|
|
675
675
|
constructor(e = {}) {
|
|
676
|
-
this.logger =
|
|
676
|
+
this.logger = j.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
677
677
|
}
|
|
678
678
|
init(e = {}) {
|
|
679
679
|
e.interpolation ||= { escapeValue: !0 };
|
|
680
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;
|
|
681
|
-
this.escape = t === void 0 ?
|
|
681
|
+
this.escape = t === void 0 ? w : 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();
|
|
682
682
|
}
|
|
683
683
|
reset() {
|
|
684
684
|
this.options && this.init(this.options);
|
|
@@ -690,7 +690,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
690
690
|
interpolate(e, t, n, r) {
|
|
691
691
|
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
692
692
|
if (!e.includes(this.formatSeparator)) {
|
|
693
|
-
let i =
|
|
693
|
+
let i = ce(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
694
694
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
695
695
|
...r,
|
|
696
696
|
...t,
|
|
@@ -698,7 +698,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
698
698
|
}) : i;
|
|
699
699
|
}
|
|
700
700
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
701
|
-
return this.format(
|
|
701
|
+
return this.format(ce(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
702
702
|
...r,
|
|
703
703
|
...t,
|
|
704
704
|
interpolationkey: a
|
|
@@ -708,10 +708,10 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
708
708
|
let u = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
709
709
|
return [{
|
|
710
710
|
regex: this.regexpUnescape,
|
|
711
|
-
safeValue: (e) =>
|
|
711
|
+
safeValue: (e) => L(e)
|
|
712
712
|
}, {
|
|
713
713
|
regex: this.regexp,
|
|
714
|
-
safeValue: (e) => this.escapeValue ?
|
|
714
|
+
safeValue: (e) => this.escapeValue ? L(this.escape(e)) : L(e)
|
|
715
715
|
}].forEach((t) => {
|
|
716
716
|
for (o = 0; i = t.regex.exec(e);) {
|
|
717
717
|
let n = i[1].trim();
|
|
@@ -759,7 +759,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
759
759
|
}
|
|
760
760
|
return e;
|
|
761
761
|
}
|
|
762
|
-
},
|
|
762
|
+
}, le = (e) => {
|
|
763
763
|
let t = e.toLowerCase().trim(), n = {};
|
|
764
764
|
if (e.includes("(")) {
|
|
765
765
|
let r = e.split("(");
|
|
@@ -776,7 +776,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
776
776
|
formatName: t,
|
|
777
777
|
formatOptions: n
|
|
778
778
|
};
|
|
779
|
-
},
|
|
779
|
+
}, z = (e) => {
|
|
780
780
|
let t = {};
|
|
781
781
|
return (n, r, i) => {
|
|
782
782
|
let a = i;
|
|
@@ -785,15 +785,15 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
785
785
|
[i.interpolationkey]: void 0
|
|
786
786
|
});
|
|
787
787
|
let o = r + JSON.stringify(a), s = t[o];
|
|
788
|
-
return s || (s = e(
|
|
788
|
+
return s || (s = e(A(r), i), t[o] = s), s(n);
|
|
789
789
|
};
|
|
790
|
-
},
|
|
790
|
+
}, ue = (e) => (t, n, r) => e(A(n), r)(t), de = class {
|
|
791
791
|
constructor(e = {}) {
|
|
792
|
-
this.logger =
|
|
792
|
+
this.logger = j.create("formatter"), this.options = e, this.init(e);
|
|
793
793
|
}
|
|
794
794
|
init(e, t = { interpolation: {} }) {
|
|
795
795
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
796
|
-
let n = t.cacheInBuiltFormats ?
|
|
796
|
+
let n = t.cacheInBuiltFormats ? z : ue;
|
|
797
797
|
this.formats = {
|
|
798
798
|
number: n((e, t) => {
|
|
799
799
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -824,7 +824,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
824
824
|
this.formats[e.toLowerCase().trim()] = t;
|
|
825
825
|
}
|
|
826
826
|
addCached(e, t) {
|
|
827
|
-
this.formats[e.toLowerCase().trim()] =
|
|
827
|
+
this.formats[e.toLowerCase().trim()] = z(t);
|
|
828
828
|
}
|
|
829
829
|
format(e, t, n, r = {}) {
|
|
830
830
|
if (!t || e == null) return e;
|
|
@@ -834,7 +834,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
834
834
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
835
835
|
}
|
|
836
836
|
return i.reduce((e, t) => {
|
|
837
|
-
let { formatName: i, formatOptions: a } =
|
|
837
|
+
let { formatName: i, formatOptions: a } = le(t);
|
|
838
838
|
if (this.formats[i]) {
|
|
839
839
|
let t = e;
|
|
840
840
|
try {
|
|
@@ -852,11 +852,11 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
852
852
|
return e;
|
|
853
853
|
}, e);
|
|
854
854
|
}
|
|
855
|
-
},
|
|
855
|
+
}, fe = (e, t) => {
|
|
856
856
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
857
|
-
},
|
|
857
|
+
}, pe = class extends M {
|
|
858
858
|
constructor(e, t, n, r = {}) {
|
|
859
|
-
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 = j.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);
|
|
860
860
|
}
|
|
861
861
|
queueLoad(e, t, n, r) {
|
|
862
862
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -884,7 +884,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
884
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);
|
|
885
885
|
let o = {};
|
|
886
886
|
this.queue.forEach((n) => {
|
|
887
|
-
v(n.loaded, [i], a),
|
|
887
|
+
v(n.loaded, [i], a), fe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
888
888
|
o[e] || (o[e] = {});
|
|
889
889
|
let t = n.loaded[e];
|
|
890
890
|
t.length && t.forEach((t) => {
|
|
@@ -974,7 +974,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
974
974
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
|
-
},
|
|
977
|
+
}, B = () => ({
|
|
978
978
|
debug: !1,
|
|
979
979
|
initAsync: !0,
|
|
980
980
|
ns: ["translation"],
|
|
@@ -1030,13 +1030,13 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1030
1030
|
skipOnVariables: !0
|
|
1031
1031
|
},
|
|
1032
1032
|
cacheInBuiltFormats: !0
|
|
1033
|
-
}),
|
|
1033
|
+
}), V = (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), H = () => {}, me = (e) => {
|
|
1034
1034
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1035
1035
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1036
1036
|
});
|
|
1037
|
-
},
|
|
1037
|
+
}, U = class e extends M {
|
|
1038
1038
|
constructor(e = {}, t) {
|
|
1039
|
-
if (super(), this.options =
|
|
1039
|
+
if (super(), this.options = V(e), this.services = {}, this.logger = j, this.modules = { external: [] }, me(this), t && !this.isInitialized && !e.isClone) {
|
|
1040
1040
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1041
1041
|
setTimeout(() => {
|
|
1042
1042
|
this.init(e, t);
|
|
@@ -1045,32 +1045,32 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1045
1045
|
}
|
|
1046
1046
|
init(e = {}, t) {
|
|
1047
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 =
|
|
1048
|
+
let n = B();
|
|
1049
1049
|
this.options = {
|
|
1050
1050
|
...n,
|
|
1051
1051
|
...this.options,
|
|
1052
|
-
...
|
|
1052
|
+
...V(e)
|
|
1053
1053
|
}, this.options.interpolation = {
|
|
1054
1054
|
...n.interpolation,
|
|
1055
1055
|
...this.options.interpolation
|
|
1056
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);
|
|
1057
1057
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1058
1058
|
if (!this.options.isClone) {
|
|
1059
|
-
this.modules.logger ?
|
|
1059
|
+
this.modules.logger ? j.init(r(this.modules.logger), this.options) : j.init(null, this.options);
|
|
1060
1060
|
let e;
|
|
1061
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1062
|
-
let t = new
|
|
1063
|
-
this.store = new
|
|
1061
|
+
e = this.modules.formatter ? this.modules.formatter : de;
|
|
1062
|
+
let t = new ie(this.options);
|
|
1063
|
+
this.store = new te(this.options.resources, this.options);
|
|
1064
1064
|
let n = this.services;
|
|
1065
|
-
n.logger =
|
|
1065
|
+
n.logger = j, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new se(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 R(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new pe(r(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
|
|
1066
1066
|
this.emit(e, ...t);
|
|
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
|
|
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 re(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1068
1068
|
this.emit(e, ...t);
|
|
1069
1069
|
}), this.modules.external.forEach((e) => {
|
|
1070
1070
|
e.init && e.init(this);
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
|
-
if (this.format = this.options.interpolation.format, t ||=
|
|
1073
|
+
if (this.format = this.options.interpolation.format, t ||= H, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1074
1074
|
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1075
1075
|
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1076
1076
|
}
|
|
@@ -1098,7 +1098,7 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1098
1098
|
};
|
|
1099
1099
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1100
1100
|
}
|
|
1101
|
-
loadResources(e, t =
|
|
1101
|
+
loadResources(e, t = H) {
|
|
1102
1102
|
let n = t, r = l(e) ? e : this.language;
|
|
1103
1103
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1104
1104
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
@@ -1114,14 +1114,14 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1114
1114
|
}
|
|
1115
1115
|
reloadResources(e, t, n) {
|
|
1116
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 ||=
|
|
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 ||= H, this.services.backendConnector.reload(e, t, (e) => {
|
|
1118
1118
|
r.resolve(), n(e);
|
|
1119
1119
|
}), r;
|
|
1120
1120
|
}
|
|
1121
1121
|
use(e) {
|
|
1122
1122
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1123
1123
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
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" &&
|
|
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" && N.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1125
1125
|
}
|
|
1126
1126
|
setResolvedLanguage(e) {
|
|
1127
1127
|
if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) {
|
|
@@ -1162,9 +1162,9 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1162
1162
|
...this.options,
|
|
1163
1163
|
...o
|
|
1164
1164
|
};
|
|
1165
|
-
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 = F(o.keyPrefix, c));
|
|
1166
1166
|
let l = this.options.keySeparator || ".", u;
|
|
1167
|
-
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 = F(e, c)), `${o.keyPrefix}${l}${e}`)) : (typeof e == "function" && (e = F(e, c)), u = o.keyPrefix ? `${o.keyPrefix}${l}${e}` : e), this.t(u, o);
|
|
1168
1168
|
};
|
|
1169
1169
|
return l(e) ? a.lng = e : a.lngs = e, a.ns = t, a.keyPrefix = n, a;
|
|
1170
1170
|
}
|
|
@@ -1217,14 +1217,14 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1217
1217
|
if (e && e.direction) return e.direction;
|
|
1218
1218
|
}
|
|
1219
1219
|
} catch {}
|
|
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
|
|
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 ie(B());
|
|
1221
1221
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.includes(n.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1222
1222
|
}
|
|
1223
1223
|
static createInstance(t = {}, n) {
|
|
1224
1224
|
let r = new e(t, n);
|
|
1225
1225
|
return r.createInstance = e.createInstance, r;
|
|
1226
1226
|
}
|
|
1227
|
-
cloneInstance(t = {}, n =
|
|
1227
|
+
cloneInstance(t = {}, n = H) {
|
|
1228
1228
|
let r = t.forkResourceStore;
|
|
1229
1229
|
r && delete t.forkResourceStore;
|
|
1230
1230
|
let i = {
|
|
@@ -1238,18 +1238,18 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1238
1238
|
"language"
|
|
1239
1239
|
].forEach((e) => {
|
|
1240
1240
|
a[e] = this[e];
|
|
1241
|
-
}), 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 te(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) {
|
|
1242
1242
|
let e = {
|
|
1243
|
-
...
|
|
1243
|
+
...B().interpolation,
|
|
1244
1244
|
...this.options.interpolation,
|
|
1245
1245
|
...t.interpolation
|
|
1246
1246
|
}, n = {
|
|
1247
1247
|
...i,
|
|
1248
1248
|
interpolation: e
|
|
1249
1249
|
};
|
|
1250
|
-
a.services.interpolator = new
|
|
1250
|
+
a.services.interpolator = new R(n);
|
|
1251
1251
|
}
|
|
1252
|
-
return a.translator = new
|
|
1252
|
+
return a.translator = new re(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1253
1253
|
a.emit(e, ...t);
|
|
1254
1254
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1255
1255
|
}
|
|
@@ -1263,8 +1263,8 @@ var F = (e) => !l(e) && typeof e != "boolean" && typeof e != "number", ie = clas
|
|
|
1263
1263
|
};
|
|
1264
1264
|
}
|
|
1265
1265
|
}.createInstance();
|
|
1266
|
-
|
|
1267
|
-
var
|
|
1266
|
+
U.createInstance, U.dir, U.init, U.loadResources, U.reloadResources, U.use, U.changeLanguage, U.getFixedT, U.t, U.exists, U.setDefaultNamespace, U.hasLoadedNamespace, U.loadNamespaces, U.loadLanguages;
|
|
1267
|
+
var he = {
|
|
1268
1268
|
tools: {
|
|
1269
1269
|
draw: "Draw",
|
|
1270
1270
|
measure: "Measure",
|
|
@@ -1283,34 +1283,34 @@ var ge = {
|
|
|
1283
1283
|
ok: "OK",
|
|
1284
1284
|
loading: "Loading..."
|
|
1285
1285
|
}
|
|
1286
|
-
},
|
|
1287
|
-
async function
|
|
1288
|
-
|
|
1286
|
+
}, W = U.createInstance(), G = !1;
|
|
1287
|
+
async function ge() {
|
|
1288
|
+
G || (G = !0, await W.init({
|
|
1289
1289
|
lng: "en",
|
|
1290
1290
|
fallbackLng: "en",
|
|
1291
1291
|
ns: ["webmapx"],
|
|
1292
1292
|
defaultNS: "webmapx",
|
|
1293
|
-
resources: { en: { webmapx:
|
|
1293
|
+
resources: { en: { webmapx: he } },
|
|
1294
1294
|
interpolation: { escapeValue: !1 }
|
|
1295
1295
|
}));
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1298
|
-
return
|
|
1297
|
+
function _e(e, t) {
|
|
1298
|
+
return W.t(e, t);
|
|
1299
1299
|
}
|
|
1300
1300
|
//#endregion
|
|
1301
1301
|
//#region src/bootstrap/locale-loader.ts
|
|
1302
|
-
var
|
|
1303
|
-
async function
|
|
1304
|
-
if (
|
|
1305
|
-
await
|
|
1302
|
+
var ve = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.14/src/locales";
|
|
1303
|
+
async function ye(e) {
|
|
1304
|
+
if (W.hasResourceBundle(e, "webmapx")) {
|
|
1305
|
+
await W.changeLanguage(e);
|
|
1306
1306
|
return;
|
|
1307
1307
|
}
|
|
1308
1308
|
try {
|
|
1309
|
-
let t = `${
|
|
1309
|
+
let t = `${ve}/${e}/core.json`, n = await fetch(t).then((e) => {
|
|
1310
1310
|
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
1311
1311
|
return e.json();
|
|
1312
1312
|
});
|
|
1313
|
-
|
|
1313
|
+
W.addResourceBundle(e, "webmapx", n), await W.changeLanguage(e);
|
|
1314
1314
|
} catch (t) {
|
|
1315
1315
|
console.error(`[webmapx] Failed to load locale "${e}", falling back to EN`, t);
|
|
1316
1316
|
}
|
|
@@ -2552,17 +2552,17 @@ var Xe = class {
|
|
|
2552
2552
|
if (!e.ok) throw Error(`[webmapx] Failed to load config: ${n.config}`);
|
|
2553
2553
|
return e.json();
|
|
2554
2554
|
}) : n.config;
|
|
2555
|
-
e(qe), await
|
|
2555
|
+
e(qe), await ge();
|
|
2556
2556
|
let a = r.engine ?? "maplibre", s = Array.isArray(r.tools) ? r.tools : [];
|
|
2557
2557
|
await Promise.all([
|
|
2558
2558
|
i(a),
|
|
2559
2559
|
o(s),
|
|
2560
2560
|
r.plugins?.length ? c(r.plugins) : Promise.resolve()
|
|
2561
|
-
]), r.locale && r.locale !== "en" && await
|
|
2561
|
+
]), r.locale && r.locale !== "en" && await ye(r.locale);
|
|
2562
2562
|
let l = document.querySelector(t);
|
|
2563
2563
|
if (!l) throw Error(`[webmapx] Mount target not found: "${t}"`);
|
|
2564
2564
|
let u = t.replace(/^#/, "").replace(/[^a-zA-Z0-9_-]/g, "-") || "webmapx-map";
|
|
2565
|
-
l.innerHTML = `<webmapx-map id="${u}" adapter="${a}"
|
|
2565
|
+
l.innerHTML = `<webmapx-map id="${u}" adapter="${a}"></webmapx-map>`;
|
|
2566
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
2568
|
map: {
|
|
@@ -2574,27 +2574,26 @@ var Xe = class {
|
|
|
2574
2574
|
...v ? { tools: v } : {}
|
|
2575
2575
|
}, "WebMapX.mount");
|
|
2576
2576
|
d.setConfig(y);
|
|
2577
|
-
let b = d.
|
|
2578
|
-
if (b
|
|
2579
|
-
let { buildLayoutFromConfig: e } = await import("./dynamic-layout-DmLc5_yX.js");
|
|
2580
|
-
e(b, v ?? y.tools);
|
|
2581
|
-
}
|
|
2582
|
-
let x = await d.getAdapterAsync?.();
|
|
2583
|
-
if (!x) {
|
|
2577
|
+
let b = await d.getAdapterAsync?.();
|
|
2578
|
+
if (!b) {
|
|
2584
2579
|
console.error("[webmapx] Adapter not available — check engine config.");
|
|
2585
2580
|
return;
|
|
2586
2581
|
}
|
|
2587
|
-
let
|
|
2582
|
+
let x = f?.style ?? Je, S = {
|
|
2588
2583
|
center: f?.center ?? [0, 0],
|
|
2589
2584
|
zoom: f?.zoom ?? 2,
|
|
2590
2585
|
...f?.bearing == null ? {} : { bearing: f.bearing },
|
|
2591
2586
|
...f?.pitch == null ? {} : { pitch: f.pitch },
|
|
2592
2587
|
...f?.minZoom == null ? {} : { minZoom: f.minZoom },
|
|
2593
2588
|
...f?.maxZoom == null ? {} : { maxZoom: f.maxZoom },
|
|
2594
|
-
...typeof
|
|
2589
|
+
...typeof x == "string" ? { styleUrl: x } : { style: x }
|
|
2595
2590
|
};
|
|
2596
|
-
|
|
2591
|
+
b.initialize(u, S);
|
|
2592
|
+
let C = document.createElement("webmapx-layout");
|
|
2593
|
+
d.appendChild(C);
|
|
2594
|
+
let { buildLayoutFromConfig: w } = await import("./dynamic-layout-DmLc5_yX.js");
|
|
2595
|
+
w(C, v ?? y.tools);
|
|
2597
2596
|
}
|
|
2598
2597
|
};
|
|
2599
2598
|
//#endregion
|
|
2600
|
-
export { Xe as WebMapX, t as WebmapxBaseTool, n as WebmapxPluginTool,
|
|
2599
|
+
export { Xe as WebMapX, t as WebmapxBaseTool, n as WebmapxPluginTool, ye as changeLocale, W as i18n, _e as t };
|
package/package.json
CHANGED