@incodetech/web 0.0.0-dev-20260403-eccc51c → 0.0.0-dev-20260407-4580f1c
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/AsYouType-DPWqJvFu.js +2482 -0
- package/dist/addressAutocomplete-B3f6PGTT.js +108 -0
- package/dist/aligndevicelottie-C9xl1spu.js +12757 -0
- package/dist/antifraud/antifraud.es.js +17 -18
- package/dist/antifraud/styles.css +1 -1
- package/dist/authentication/authentication.es.js +28 -50
- package/dist/back-horizontal-hint-Be3dUGk6.js +137 -0
- package/dist/back-tutorial-BNTyW-1N.js +14584 -0
- package/dist/back-vertical-hint-Bz_rnhd-.js +128 -0
- package/dist/backdevicelottie-DBB1YCtW.js +16678 -0
- package/dist/base.css +327 -67
- package/dist/blurdevicelottie-9WvZCZ6C.js +15939 -0
- package/dist/browser-ponyfill-B4Qc6yfW.js +299 -0
- package/dist/button-DhL5eRT3.js +123 -0
- package/dist/checkbox-l8NxPf4o.js +85 -0
- package/dist/consent/consent.es.js +82 -89
- package/dist/consent/styles.css +1 -1
- package/dist/countries-y2ydYDhN.js +8323 -0
- package/dist/curp-validation/curp-validation.es.js +271 -313
- package/dist/curp-validation/styles.css +1 -1
- package/dist/dateInputComposed-B9WqdYx9.js +2 -0
- package/dist/dateInputComposed-ndsGHX1M.js +94 -0
- package/dist/defineProperty-brqHEHA_.js +39 -0
- package/dist/document-capture/styles.css +1 -1
- package/dist/documentCapture-wDgRLdon.js +784 -0
- package/dist/dropdownComposed-_Ey7wJNG.js +258 -0
- package/dist/ekyb/ekyb.es.js +2 -0
- package/dist/ekyb/styles.css +1 -1
- package/dist/ekybModule-BBOm1y49.js +2 -0
- package/dist/ekybModule-fz6i9ZRt.js +286 -0
- package/dist/ekyc/ekyc.es.js +2 -0
- package/dist/ekyc/styles.css +1 -1
- package/dist/ekycModule-SeTFG3AJ.js +233 -0
- package/dist/ekycModule-hxIcNX8n.js +2 -0
- package/dist/email/email.es.js +110 -154
- package/dist/email/styles.css +1 -1
- package/dist/extensibility-DJihqIzM.js +2248 -0
- package/dist/extensibility.es.js +22 -150
- package/dist/face-match/styles.css +147 -73
- package/dist/faceMatch-DH8sLx34.js +191 -0
- package/dist/flip-animation-DOJzdXB-.js +6983 -0
- package/dist/flow/flow.es.js +2273 -2613
- package/dist/flow/styles.css +432 -73
- package/dist/formField-BRTbY8w9.js +100 -0
- package/dist/front-horizontal-hint-aGAhadA2.js +380 -0
- package/dist/front-vertical-hint-DZz1VeNp.js +420 -0
- package/dist/frontdevicelottie-DadDp6be.js +17302 -0
- package/dist/geolocation/geolocation.es.js +852 -832
- package/dist/geolocation/styles.css +1 -1
- package/dist/glaredevicelottie-BfI84cPw.js +14466 -0
- package/dist/governmentValidation/governmentValidation.es.js +100 -106
- package/dist/governmentValidation/styles.css +1 -1
- package/dist/i18n-DZOHbK9q.js +1916 -0
- package/dist/icons-BHbofCgJ.js +245 -0
- package/dist/id/id.es.js +53 -59
- package/dist/id/styles.css +1 -1
- package/dist/id-laser-h-BWyU3VgL.js +467 -0
- package/dist/id-laser-v-JiWXUlv0.js +467 -0
- package/dist/id-tutorial-Cc9xg5_J.js +13152 -0
- package/dist/incodeModule-Bf6yJ8RB.js +18 -0
- package/dist/index.es.js +4 -25
- package/dist/inputComposed-BhbfD8Ru.js +77 -0
- package/dist/loadingIcon-CeQt7Zgb.js +146 -0
- package/dist/mandatoryConsent-LBS8E0rj.js +101 -0
- package/dist/numberedStep-CQVRixRP.js +11 -0
- package/dist/otpInput-CDIG9el7.js +143 -0
- package/dist/page-SvlJWUfz.js +61 -0
- package/dist/passport-horizontal-hint-CFsGs7Dp.js +293 -0
- package/dist/passport-tutorial-z0LN7Hsp.js +11688 -0
- package/dist/passport-vertical-hint-BnCpKWeN.js +267 -0
- package/dist/phone/phone.es.js +87 -121
- package/dist/phone/styles.css +1 -1
- package/dist/phoneInput-C9T_8FJt.js +138 -0
- package/dist/phoneInputComposed-B-0zieIW.js +407 -0
- package/dist/processing-B5zhNH6I.js +15 -0
- package/dist/redirect-to-mobile/styles.css +1 -1
- package/dist/richText-Db0PfpkE.js +1973 -0
- package/dist/rolldown-runtime-CjdbFOpI.js +13 -0
- package/dist/selfie/selfie.es.js +29 -50
- package/dist/selfie/styles.css +170 -66
- package/dist/selfieTutorial-B0MIyPrk.js +2676 -0
- package/dist/setup-Dq2bzNKH.js +15 -0
- package/dist/signature/signature.es.js +557 -707
- package/dist/signature/styles.css +1 -1
- package/dist/spacer-DCljE53A.js +59 -0
- package/dist/spinner-Bk0YuoLu.js +1 -0
- package/dist/spinner-snIGzmm8.js +41 -0
- package/dist/successIcon-AHrfmJvv.js +17 -0
- package/dist/tutorial-DNOd11tg.js +2780 -0
- package/dist/types/ekyb.d.ts +29 -0
- package/dist/types/ekyc.d.ts +29 -0
- package/dist/types/index.d.ts +0 -8
- package/dist/typography-BNbFNFek.js +1 -0
- package/dist/typography-DvHeVWfY.js +29 -0
- package/dist/uiConfig-CwpQ-IM6.js +20 -0
- package/dist/vendor-preact-D6SntenC.js +958 -0
- package/dist/warningIcon-Cvj-ayg1.js +17 -0
- package/package.json +8 -11
- package/dist/AsYouType-D1H_js4X.js +0 -2607
- package/dist/Trans-aTzdT_SA.js +0 -55
- package/dist/addressAutocomplete-C8-wL1j_.js +0 -153
- package/dist/aligndevicelottie-DlQCRPfM.js +0 -29
- package/dist/back-horizontal-hint-CSlf9KI1.js +0 -5
- package/dist/back-tutorial-An9AcMSe.js +0 -29
- package/dist/back-vertical-hint-CNieqiCr.js +0 -5
- package/dist/backdevicelottie-B4NgyWmX.js +0 -29
- package/dist/blurdevicelottie-_BZRug1c.js +0 -29
- package/dist/browser-ponyfill-B6W6hHVY.js +0 -344
- package/dist/button-CE9kRlem.js +0 -184
- package/dist/cameraView-C2X7klNb.js +0 -55
- package/dist/captureOverlay-tCb4R4WE.js +0 -592
- package/dist/checkbox-B5X-mfqq.js +0 -137
- package/dist/chevronDown-DSHaPKbi.js +0 -23
- package/dist/closeIcon-9Hc97omv.js +0 -28
- package/dist/countries-DfLkrF0x.js +0 -616
- package/dist/dateInputComposed-C7PCzh-U.js +0 -173
- package/dist/documentCapture-C0mO-RGE.js +0 -692
- package/dist/dropdownComposed-BpinYlrx.js +0 -367
- package/dist/ekybModule-Dr6LJUg-.js +0 -357
- package/dist/ekycModule-C3mswduI.js +0 -291
- package/dist/errorContent-Cb8nmQAE.js +0 -44
- package/dist/errorIcon-DEARBrGx.js +0 -26
- package/dist/faceMatch-DbDp7D3d.js +0 -237
- package/dist/fileIcon-CCSvS10T.js +0 -52
- package/dist/flip-animation-COR596wy.js +0 -29
- package/dist/flipAnimation-BqV462TA.js +0 -2059
- package/dist/formField-CP6wDdfA.js +0 -106
- package/dist/front-horizontal-hint-lRLKd7vY.js +0 -7
- package/dist/front-vertical-hint-qQoJXRE3.js +0 -7
- package/dist/frontdevicelottie-KhKxT5n9.js +0 -29
- package/dist/glaredevicelottie-DLuIStvb.js +0 -29
- package/dist/id-laser-h-BBV3r3rz.js +0 -29
- package/dist/id-laser-v-BTHJaSfx.js +0 -29
- package/dist/id-tutorial-B-F5Q28m.js +0 -29
- package/dist/incodeModule-C4XIllao.js +0 -96
- package/dist/inputComposed-fUbAGrDy.js +0 -103
- package/dist/instance-BWYzq8dk.js +0 -2163
- package/dist/loadingIcon-DmuPXh70.js +0 -195
- package/dist/mandatoryConsent-5xPI0cor.js +0 -94
- package/dist/manualCaptureButton-BvFmTyJe.js +0 -372
- package/dist/numberedStep-DwUB__mh.js +0 -5
- package/dist/otpInput-BFXhqFRT.js +0 -156
- package/dist/page-SrUl0qtN.js +0 -69
- package/dist/passport-horizontal-hint-BCtpMp1Y.js +0 -5
- package/dist/passport-tutorial-CaYBFTqt.js +0 -29
- package/dist/passport-vertical-hint-GaLnzqHP.js +0 -5
- package/dist/permissions-DT4Fz9MR.js +0 -709
- package/dist/phoneInput-CGr8TxOO.js +0 -158
- package/dist/phoneInputComposed-Cm9O2Jba.js +0 -206
- package/dist/processing-szVOCQwZ.js +0 -19
- package/dist/richText-cspvNz2a.js +0 -1807
- package/dist/selfieTutorial-Dm_p0ke9.js +0 -29
- package/dist/spinner-DygONskw.js +0 -60
- package/dist/successIcon-Bjsdc4lF.js +0 -26
- package/dist/tutorial-Cdz1025D.js +0 -473
- package/dist/types/ekyb/styles.d.ts +0 -1
- package/dist/types/ekyc/styles.d.ts +0 -1
- package/dist/typography-BDACYR5i.js +0 -14
- package/dist/uiConfig-Dnt-2YWB.js +0 -23
- package/dist/useMediaQuery-lJdQBmC2.js +0 -18
- package/dist/vendor-preact-BoMmvSgn.js +0 -694
- package/dist/warningIcon-DQq_MrOB.js +0 -26
|
@@ -0,0 +1,1916 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-CjdbFOpI.js";
|
|
2
|
+
import { S as t, _ as n, b as r, d as i, p as a, v as o } from "./vendor-preact-D6SntenC.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/i18next@25.7.1_typescript@5.9.3/node_modules/i18next/dist/esm/i18next.js
|
|
4
|
+
var s = (e) => typeof e == "string", c = () => {
|
|
5
|
+
let e, t, n = new Promise((n, r) => {
|
|
6
|
+
e = n, t = r;
|
|
7
|
+
});
|
|
8
|
+
return n.resolve = e, n.reject = t, n;
|
|
9
|
+
}, l = (e) => e == null ? "" : "" + e, u = (e, t, n) => {
|
|
10
|
+
e.forEach((e) => {
|
|
11
|
+
t[e] && (n[e] = t[e]);
|
|
12
|
+
});
|
|
13
|
+
}, d = /###/g, f = (e) => e && e.indexOf("###") > -1 ? e.replace(d, ".") : e, p = (e) => !e || s(e), m = (e, t, n) => {
|
|
14
|
+
let r = s(t) ? t.split(".") : t, i = 0;
|
|
15
|
+
for (; i < r.length - 1;) {
|
|
16
|
+
if (p(e)) return {};
|
|
17
|
+
let t = f(r[i]);
|
|
18
|
+
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
19
|
+
}
|
|
20
|
+
return p(e) ? {} : {
|
|
21
|
+
obj: e,
|
|
22
|
+
k: f(r[i])
|
|
23
|
+
};
|
|
24
|
+
}, h = (e, t, n) => {
|
|
25
|
+
let { obj: r, k: i } = m(e, t, Object);
|
|
26
|
+
if (r !== void 0 || t.length === 1) {
|
|
27
|
+
r[i] = n;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = m(e, o, Object);
|
|
31
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = m(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
32
|
+
s.obj[`${s.k}.${a}`] = n;
|
|
33
|
+
}, g = (e, t, n, r) => {
|
|
34
|
+
let { obj: i, k: a } = m(e, t, Object);
|
|
35
|
+
i[a] = i[a] || [], i[a].push(n);
|
|
36
|
+
}, _ = (e, t) => {
|
|
37
|
+
let { obj: n, k: r } = m(e, t);
|
|
38
|
+
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
39
|
+
}, ee = (e, t, n) => {
|
|
40
|
+
let r = _(e, n);
|
|
41
|
+
return r === void 0 ? _(t, n) : r;
|
|
42
|
+
}, v = (e, t, n) => {
|
|
43
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? s(e[r]) || e[r] instanceof String || s(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : v(e[r], t[r], n) : e[r] = t[r]);
|
|
44
|
+
return e;
|
|
45
|
+
}, y = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), b = {
|
|
46
|
+
"&": "&",
|
|
47
|
+
"<": "<",
|
|
48
|
+
">": ">",
|
|
49
|
+
"\"": """,
|
|
50
|
+
"'": "'",
|
|
51
|
+
"/": "/"
|
|
52
|
+
}, x = (e) => s(e) ? e.replace(/[&<>"'\/]/g, (e) => b[e]) : e, te = class {
|
|
53
|
+
constructor(e) {
|
|
54
|
+
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
55
|
+
}
|
|
56
|
+
getRegExp(e) {
|
|
57
|
+
let t = this.regExpMap.get(e);
|
|
58
|
+
if (t !== void 0) return t;
|
|
59
|
+
let n = new RegExp(e);
|
|
60
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
61
|
+
}
|
|
62
|
+
}, S = [
|
|
63
|
+
" ",
|
|
64
|
+
",",
|
|
65
|
+
"?",
|
|
66
|
+
"!",
|
|
67
|
+
";"
|
|
68
|
+
], C = new te(20), w = (e, t, n) => {
|
|
69
|
+
t ||= "", n ||= "";
|
|
70
|
+
let r = S.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
71
|
+
if (r.length === 0) return !0;
|
|
72
|
+
let i = C.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
73
|
+
if (!a) {
|
|
74
|
+
let t = e.indexOf(n);
|
|
75
|
+
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
76
|
+
}
|
|
77
|
+
return a;
|
|
78
|
+
}, T = (e, t, n = ".") => {
|
|
79
|
+
if (!e) return;
|
|
80
|
+
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
81
|
+
let r = t.split(n), i = e;
|
|
82
|
+
for (let e = 0; e < r.length;) {
|
|
83
|
+
if (!i || typeof i != "object") return;
|
|
84
|
+
let t, a = "";
|
|
85
|
+
for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
|
|
86
|
+
if ([
|
|
87
|
+
"string",
|
|
88
|
+
"number",
|
|
89
|
+
"boolean"
|
|
90
|
+
].indexOf(typeof t) > -1 && o < r.length - 1) continue;
|
|
91
|
+
e += o - e + 1;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
i = t;
|
|
95
|
+
}
|
|
96
|
+
return i;
|
|
97
|
+
}, E = (e) => e?.replace("_", "-"), ne = {
|
|
98
|
+
type: "logger",
|
|
99
|
+
log(e) {
|
|
100
|
+
this.output("log", e);
|
|
101
|
+
},
|
|
102
|
+
warn(e) {
|
|
103
|
+
this.output("warn", e);
|
|
104
|
+
},
|
|
105
|
+
error(e) {
|
|
106
|
+
this.output("error", e);
|
|
107
|
+
},
|
|
108
|
+
output(e, t) {
|
|
109
|
+
console?.[e]?.apply?.(console, t);
|
|
110
|
+
}
|
|
111
|
+
}, D = new class e {
|
|
112
|
+
constructor(e, t = {}) {
|
|
113
|
+
this.init(e, t);
|
|
114
|
+
}
|
|
115
|
+
init(e, t = {}) {
|
|
116
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || ne, this.options = t, this.debug = t.debug;
|
|
117
|
+
}
|
|
118
|
+
log(...e) {
|
|
119
|
+
return this.forward(e, "log", "", !0);
|
|
120
|
+
}
|
|
121
|
+
warn(...e) {
|
|
122
|
+
return this.forward(e, "warn", "", !0);
|
|
123
|
+
}
|
|
124
|
+
error(...e) {
|
|
125
|
+
return this.forward(e, "error", "");
|
|
126
|
+
}
|
|
127
|
+
deprecate(...e) {
|
|
128
|
+
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
129
|
+
}
|
|
130
|
+
forward(e, t, n, r) {
|
|
131
|
+
return r && !this.debug ? null : (s(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
132
|
+
}
|
|
133
|
+
create(t) {
|
|
134
|
+
return new e(this.logger, {
|
|
135
|
+
prefix: `${this.prefix}:${t}:`,
|
|
136
|
+
...this.options
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
clone(t) {
|
|
140
|
+
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
141
|
+
}
|
|
142
|
+
}(), O = class {
|
|
143
|
+
constructor() {
|
|
144
|
+
this.observers = {};
|
|
145
|
+
}
|
|
146
|
+
on(e, t) {
|
|
147
|
+
return e.split(" ").forEach((e) => {
|
|
148
|
+
this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
|
|
149
|
+
let n = this.observers[e].get(t) || 0;
|
|
150
|
+
this.observers[e].set(t, n + 1);
|
|
151
|
+
}), this;
|
|
152
|
+
}
|
|
153
|
+
off(e, t) {
|
|
154
|
+
if (this.observers[e]) {
|
|
155
|
+
if (!t) {
|
|
156
|
+
delete this.observers[e];
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
this.observers[e].delete(t);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
emit(e, ...t) {
|
|
163
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
|
|
164
|
+
for (let r = 0; r < n; r++) e(...t);
|
|
165
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
|
|
166
|
+
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}, k = class extends O {
|
|
170
|
+
constructor(e, t = {
|
|
171
|
+
ns: ["translation"],
|
|
172
|
+
defaultNS: "translation"
|
|
173
|
+
}) {
|
|
174
|
+
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
175
|
+
}
|
|
176
|
+
addNamespaces(e) {
|
|
177
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
178
|
+
}
|
|
179
|
+
removeNamespaces(e) {
|
|
180
|
+
let t = this.options.ns.indexOf(e);
|
|
181
|
+
t > -1 && this.options.ns.splice(t, 1);
|
|
182
|
+
}
|
|
183
|
+
getResource(e, t, n, r = {}) {
|
|
184
|
+
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
185
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : s(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
186
|
+
let c = _(this.data, o);
|
|
187
|
+
return !c && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), c || !a || !s(n) ? c : T(this.data?.[e]?.[t], n, i);
|
|
188
|
+
}
|
|
189
|
+
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
190
|
+
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
191
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), h(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
192
|
+
}
|
|
193
|
+
addResources(e, t, n, r = { silent: !1 }) {
|
|
194
|
+
for (let r in n) (s(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
195
|
+
r.silent || this.emit("added", e, t, n);
|
|
196
|
+
}
|
|
197
|
+
addResourceBundle(e, t, n, r, i, a = {
|
|
198
|
+
silent: !1,
|
|
199
|
+
skipCopy: !1
|
|
200
|
+
}) {
|
|
201
|
+
let o = [e, t];
|
|
202
|
+
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
203
|
+
let s = _(this.data, o) || {};
|
|
204
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? v(s, n, i) : s = {
|
|
205
|
+
...s,
|
|
206
|
+
...n
|
|
207
|
+
}, h(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
208
|
+
}
|
|
209
|
+
removeResourceBundle(e, t) {
|
|
210
|
+
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
211
|
+
}
|
|
212
|
+
hasResourceBundle(e, t) {
|
|
213
|
+
return this.getResource(e, t) !== void 0;
|
|
214
|
+
}
|
|
215
|
+
getResourceBundle(e, t) {
|
|
216
|
+
return t ||= this.options.defaultNS, this.getResource(e, t);
|
|
217
|
+
}
|
|
218
|
+
getDataByLanguage(e) {
|
|
219
|
+
return this.data[e];
|
|
220
|
+
}
|
|
221
|
+
hasLanguageSomeTranslations(e) {
|
|
222
|
+
let t = this.getDataByLanguage(e);
|
|
223
|
+
return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
|
|
224
|
+
}
|
|
225
|
+
toJSON() {
|
|
226
|
+
return this.data;
|
|
227
|
+
}
|
|
228
|
+
}, A = {
|
|
229
|
+
processors: {},
|
|
230
|
+
addPostProcessor(e) {
|
|
231
|
+
this.processors[e.name] = e;
|
|
232
|
+
},
|
|
233
|
+
handle(e, t, n, r, i) {
|
|
234
|
+
return e.forEach((e) => {
|
|
235
|
+
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
236
|
+
}), t;
|
|
237
|
+
}
|
|
238
|
+
}, re = Symbol("i18next/PATH_KEY");
|
|
239
|
+
function ie() {
|
|
240
|
+
let e = [], t = Object.create(null), n;
|
|
241
|
+
return t.get = (r, i) => (n?.revoke?.(), i === re ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
242
|
+
}
|
|
243
|
+
function j(e, t) {
|
|
244
|
+
let { [re]: n } = e(ie());
|
|
245
|
+
return n.join(t?.keySeparator ?? ".");
|
|
246
|
+
}
|
|
247
|
+
var ae = {}, M = (e) => !s(e) && typeof e != "boolean" && typeof e != "number", oe = class e extends O {
|
|
248
|
+
constructor(e, t = {}) {
|
|
249
|
+
super(), u([
|
|
250
|
+
"resourceStore",
|
|
251
|
+
"languageUtils",
|
|
252
|
+
"pluralResolver",
|
|
253
|
+
"interpolator",
|
|
254
|
+
"backendConnector",
|
|
255
|
+
"i18nFormat",
|
|
256
|
+
"utils"
|
|
257
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = D.create("translator");
|
|
258
|
+
}
|
|
259
|
+
changeLanguage(e) {
|
|
260
|
+
e && (this.language = e);
|
|
261
|
+
}
|
|
262
|
+
exists(e, t = { interpolation: {} }) {
|
|
263
|
+
let n = { ...t };
|
|
264
|
+
if (e == null) return !1;
|
|
265
|
+
let r = this.resolve(e, n);
|
|
266
|
+
if (r?.res === void 0) return !1;
|
|
267
|
+
let i = M(r.res);
|
|
268
|
+
return !(n.returnObjects === !1 && i);
|
|
269
|
+
}
|
|
270
|
+
extractFromKey(e, t) {
|
|
271
|
+
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
272
|
+
n === void 0 && (n = ":");
|
|
273
|
+
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !w(e, n, r);
|
|
274
|
+
if (a && !o) {
|
|
275
|
+
let t = e.match(this.interpolator.nestingRegexp);
|
|
276
|
+
if (t && t.length > 0) return {
|
|
277
|
+
key: e,
|
|
278
|
+
namespaces: s(i) ? [i] : i
|
|
279
|
+
};
|
|
280
|
+
let a = e.split(n);
|
|
281
|
+
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
key: e,
|
|
285
|
+
namespaces: s(i) ? [i] : i
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
translate(t, n, r) {
|
|
289
|
+
let i = typeof n == "object" ? { ...n } : n;
|
|
290
|
+
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
291
|
+
typeof t == "function" && (t = j(t, {
|
|
292
|
+
...this.options,
|
|
293
|
+
...i
|
|
294
|
+
})), Array.isArray(t) || (t = [String(t)]);
|
|
295
|
+
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: c, namespaces: l } = this.extractFromKey(t[t.length - 1], i), u = l[l.length - 1], d = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
|
|
296
|
+
d === void 0 && (d = ":");
|
|
297
|
+
let f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
298
|
+
if (f?.toLowerCase() === "cimode") return p ? a ? {
|
|
299
|
+
res: `${u}${d}${c}`,
|
|
300
|
+
usedKey: c,
|
|
301
|
+
exactUsedKey: c,
|
|
302
|
+
usedLng: f,
|
|
303
|
+
usedNS: u,
|
|
304
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
305
|
+
} : `${u}${d}${c}` : a ? {
|
|
306
|
+
res: c,
|
|
307
|
+
usedKey: c,
|
|
308
|
+
exactUsedKey: c,
|
|
309
|
+
usedLng: f,
|
|
310
|
+
usedNS: u,
|
|
311
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
312
|
+
} : c;
|
|
313
|
+
let m = this.resolve(t, i), h = m?.res, g = m?.usedKey || c, _ = m?.exactUsedKey || c, ee = [
|
|
314
|
+
"[object Number]",
|
|
315
|
+
"[object Function]",
|
|
316
|
+
"[object RegExp]"
|
|
317
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !s(i.count), x = e.hasDefaultValue(i), te = b ? this.pluralResolver.getSuffix(f, i.count, i) : "", S = i.ordinal && b ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", C = b && !i.ordinal && i.count === 0, w = C && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${te}`] || i[`defaultValue${S}`] || i.defaultValue, T = h;
|
|
318
|
+
y && !h && x && (T = w);
|
|
319
|
+
let E = M(T), ne = Object.prototype.toString.apply(T);
|
|
320
|
+
if (y && T && E && ee.indexOf(ne) < 0 && !(s(v) && Array.isArray(T))) {
|
|
321
|
+
if (!i.returnObjects && !this.options.returnObjects) {
|
|
322
|
+
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
323
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, T, {
|
|
324
|
+
...i,
|
|
325
|
+
ns: l
|
|
326
|
+
}) : `key '${c} (${this.language})' returned an object instead of string.`;
|
|
327
|
+
return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
|
|
328
|
+
}
|
|
329
|
+
if (o) {
|
|
330
|
+
let e = Array.isArray(T), t = e ? [] : {}, n = e ? _ : g;
|
|
331
|
+
for (let e in T) if (Object.prototype.hasOwnProperty.call(T, e)) {
|
|
332
|
+
let r = `${n}${o}${e}`;
|
|
333
|
+
x && !h ? t[e] = this.translate(r, {
|
|
334
|
+
...i,
|
|
335
|
+
defaultValue: M(w) ? w[e] : void 0,
|
|
336
|
+
joinArrays: !1,
|
|
337
|
+
ns: l
|
|
338
|
+
}) : t[e] = this.translate(r, {
|
|
339
|
+
...i,
|
|
340
|
+
joinArrays: !1,
|
|
341
|
+
ns: l
|
|
342
|
+
}), t[e] === r && (t[e] = T[e]);
|
|
343
|
+
}
|
|
344
|
+
h = t;
|
|
345
|
+
}
|
|
346
|
+
} else if (y && s(v) && Array.isArray(h)) h = h.join(v), h &&= this.extendTranslation(h, t, i, r);
|
|
347
|
+
else {
|
|
348
|
+
let e = !1, n = !1;
|
|
349
|
+
!this.isValidLookup(h) && x && (e = !0, h = w), this.isValidLookup(h) || (n = !0, h = c);
|
|
350
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, s = x && w !== h && this.options.updateMissing;
|
|
351
|
+
if (n || e || s) {
|
|
352
|
+
if (this.logger.log(s ? "updateKey" : "missingKey", f, u, c, s ? w : h), o) {
|
|
353
|
+
let e = this.resolve(c, {
|
|
354
|
+
...i,
|
|
355
|
+
keySeparator: !1
|
|
356
|
+
});
|
|
357
|
+
e && e.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
358
|
+
}
|
|
359
|
+
let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
|
|
360
|
+
if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
361
|
+
else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
|
|
362
|
+
let n = (e, t, n) => {
|
|
363
|
+
let r = x && n !== h ? n : a;
|
|
364
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, u, t, r, s, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, u, t, r, s, i), this.emit("missingKey", e, u, t, h);
|
|
365
|
+
};
|
|
366
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
|
|
367
|
+
let t = this.pluralResolver.getSuffixes(e, i);
|
|
368
|
+
C && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
369
|
+
n([e], c + t, i[`defaultValue${t}`] || w);
|
|
370
|
+
});
|
|
371
|
+
}) : n(e, c, w));
|
|
372
|
+
}
|
|
373
|
+
h = this.extendTranslation(h, t, i, m, r), n && h === c && this.options.appendNamespaceToMissingKey && (h = `${u}${d}${c}`), (n || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${d}${c}` : c, e ? h : void 0, i));
|
|
374
|
+
}
|
|
375
|
+
return a ? (m.res = h, m.usedParams = this.getUsedParamsDetails(i), m) : h;
|
|
376
|
+
}
|
|
377
|
+
extendTranslation(e, t, n, r, i) {
|
|
378
|
+
if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
|
|
379
|
+
...this.options.interpolation.defaultVariables,
|
|
380
|
+
...n
|
|
381
|
+
}, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
|
|
382
|
+
else if (!n.skipInterpolation) {
|
|
383
|
+
n.interpolation && this.interpolator.init({
|
|
384
|
+
...n,
|
|
385
|
+
interpolation: {
|
|
386
|
+
...this.options.interpolation,
|
|
387
|
+
...n.interpolation
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
let a = s(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
391
|
+
if (a) {
|
|
392
|
+
let t = e.match(this.interpolator.nestingRegexp);
|
|
393
|
+
o = t && t.length;
|
|
394
|
+
}
|
|
395
|
+
let c = n.replace && !s(n.replace) ? n.replace : n;
|
|
396
|
+
if (this.options.interpolation.defaultVariables && (c = {
|
|
397
|
+
...this.options.interpolation.defaultVariables,
|
|
398
|
+
...c
|
|
399
|
+
}), e = this.interpolator.interpolate(e, c, n.lng || this.language || r.usedLng, n), a) {
|
|
400
|
+
let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
|
|
401
|
+
o < r && (n.nest = !1);
|
|
402
|
+
}
|
|
403
|
+
!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();
|
|
404
|
+
}
|
|
405
|
+
let a = n.postProcess || this.options.postProcess, o = s(a) ? [a] : a;
|
|
406
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = A.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
407
|
+
i18nResolved: {
|
|
408
|
+
...r,
|
|
409
|
+
usedParams: this.getUsedParamsDetails(n)
|
|
410
|
+
},
|
|
411
|
+
...n
|
|
412
|
+
} : n, this)), e;
|
|
413
|
+
}
|
|
414
|
+
resolve(e, t = {}) {
|
|
415
|
+
let n, r, i, a, o;
|
|
416
|
+
return s(e) && (e = [e]), e.forEach((e) => {
|
|
417
|
+
if (this.isValidLookup(n)) return;
|
|
418
|
+
let c = this.extractFromKey(e, t), l = c.key;
|
|
419
|
+
r = l;
|
|
420
|
+
let u = c.namespaces;
|
|
421
|
+
this.options.fallbackNS && (u = u.concat(this.options.fallbackNS));
|
|
422
|
+
let d = t.count !== void 0 && !s(t.count), f = d && !t.ordinal && t.count === 0, p = t.context !== void 0 && (s(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
423
|
+
u.forEach((e) => {
|
|
424
|
+
this.isValidLookup(n) || (o = e, !ae[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (ae[`${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) => {
|
|
425
|
+
if (this.isValidLookup(n)) return;
|
|
426
|
+
a = r;
|
|
427
|
+
let o = [l];
|
|
428
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, l, r, e, t);
|
|
429
|
+
else {
|
|
430
|
+
let e;
|
|
431
|
+
d && (e = this.pluralResolver.getSuffix(r, t.count, t));
|
|
432
|
+
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
433
|
+
if (d && (t.ordinal && e.indexOf(i) === 0 && o.push(l + e.replace(i, this.options.pluralSeparator)), o.push(l + e), f && o.push(l + n)), p) {
|
|
434
|
+
let r = `${l}${this.options.contextSeparator || "_"}${t.context}`;
|
|
435
|
+
o.push(r), d && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), f && o.push(r + n));
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
let s;
|
|
439
|
+
for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
|
|
440
|
+
}));
|
|
441
|
+
});
|
|
442
|
+
}), {
|
|
443
|
+
res: n,
|
|
444
|
+
usedKey: r,
|
|
445
|
+
exactUsedKey: i,
|
|
446
|
+
usedLng: a,
|
|
447
|
+
usedNS: o
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
isValidLookup(e) {
|
|
451
|
+
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
452
|
+
}
|
|
453
|
+
getResource(e, t, n, r = {}) {
|
|
454
|
+
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
|
|
455
|
+
}
|
|
456
|
+
getUsedParamsDetails(e = {}) {
|
|
457
|
+
let t = [
|
|
458
|
+
"defaultValue",
|
|
459
|
+
"ordinal",
|
|
460
|
+
"context",
|
|
461
|
+
"replace",
|
|
462
|
+
"lng",
|
|
463
|
+
"lngs",
|
|
464
|
+
"fallbackLng",
|
|
465
|
+
"ns",
|
|
466
|
+
"keySeparator",
|
|
467
|
+
"nsSeparator",
|
|
468
|
+
"returnObjects",
|
|
469
|
+
"returnDetails",
|
|
470
|
+
"joinArrays",
|
|
471
|
+
"postProcess",
|
|
472
|
+
"interpolation"
|
|
473
|
+
], n = e.replace && !s(e.replace), r = n ? e.replace : e;
|
|
474
|
+
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
475
|
+
...this.options.interpolation.defaultVariables,
|
|
476
|
+
...r
|
|
477
|
+
}), !n) {
|
|
478
|
+
r = { ...r };
|
|
479
|
+
for (let e of t) delete r[e];
|
|
480
|
+
}
|
|
481
|
+
return r;
|
|
482
|
+
}
|
|
483
|
+
static hasDefaultValue(e) {
|
|
484
|
+
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
485
|
+
return !1;
|
|
486
|
+
}
|
|
487
|
+
}, se = class {
|
|
488
|
+
constructor(e) {
|
|
489
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = D.create("languageUtils");
|
|
490
|
+
}
|
|
491
|
+
getScriptPartFromCode(e) {
|
|
492
|
+
if (e = E(e), !e || e.indexOf("-") < 0) return null;
|
|
493
|
+
let t = e.split("-");
|
|
494
|
+
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
495
|
+
}
|
|
496
|
+
getLanguagePartFromCode(e) {
|
|
497
|
+
if (e = E(e), !e || e.indexOf("-") < 0) return e;
|
|
498
|
+
let t = e.split("-");
|
|
499
|
+
return this.formatLanguageCode(t[0]);
|
|
500
|
+
}
|
|
501
|
+
formatLanguageCode(e) {
|
|
502
|
+
if (s(e) && e.indexOf("-") > -1) {
|
|
503
|
+
let t;
|
|
504
|
+
try {
|
|
505
|
+
t = Intl.getCanonicalLocales(e)[0];
|
|
506
|
+
} catch {}
|
|
507
|
+
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
508
|
+
}
|
|
509
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
510
|
+
}
|
|
511
|
+
isSupportedCode(e) {
|
|
512
|
+
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
|
|
513
|
+
}
|
|
514
|
+
getBestMatchFromCodes(e) {
|
|
515
|
+
if (!e) return null;
|
|
516
|
+
let t;
|
|
517
|
+
return e.forEach((e) => {
|
|
518
|
+
if (t) return;
|
|
519
|
+
let n = this.formatLanguageCode(e);
|
|
520
|
+
(!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
|
|
521
|
+
}), !t && this.options.supportedLngs && e.forEach((e) => {
|
|
522
|
+
if (t) return;
|
|
523
|
+
let n = this.getScriptPartFromCode(e);
|
|
524
|
+
if (this.isSupportedCode(n)) return t = n;
|
|
525
|
+
let r = this.getLanguagePartFromCode(e);
|
|
526
|
+
if (this.isSupportedCode(r)) return t = r;
|
|
527
|
+
t = this.options.supportedLngs.find((e) => {
|
|
528
|
+
if (e === r || !(e.indexOf("-") < 0 && r.indexOf("-") < 0) && (e.indexOf("-") > 0 && r.indexOf("-") < 0 && e.substring(0, e.indexOf("-")) === r || e.indexOf(r) === 0 && r.length > 1)) return e;
|
|
529
|
+
});
|
|
530
|
+
}), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
|
|
531
|
+
}
|
|
532
|
+
getFallbackCodes(e, t) {
|
|
533
|
+
if (!e) return [];
|
|
534
|
+
if (typeof e == "function" && (e = e(t)), s(e) && (e = [e]), Array.isArray(e)) return e;
|
|
535
|
+
if (!t) return e.default || [];
|
|
536
|
+
let n = e[t];
|
|
537
|
+
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
538
|
+
}
|
|
539
|
+
toResolveHierarchy(e, t) {
|
|
540
|
+
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
541
|
+
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
542
|
+
};
|
|
543
|
+
return s(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (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))) : s(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
544
|
+
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
545
|
+
}), r;
|
|
546
|
+
}
|
|
547
|
+
}, ce = {
|
|
548
|
+
zero: 0,
|
|
549
|
+
one: 1,
|
|
550
|
+
two: 2,
|
|
551
|
+
few: 3,
|
|
552
|
+
many: 4,
|
|
553
|
+
other: 5
|
|
554
|
+
}, le = {
|
|
555
|
+
select: (e) => e === 1 ? "one" : "other",
|
|
556
|
+
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
557
|
+
}, ue = class {
|
|
558
|
+
constructor(e, t = {}) {
|
|
559
|
+
this.languageUtils = e, this.options = t, this.logger = D.create("pluralResolver"), this.pluralRulesCache = {};
|
|
560
|
+
}
|
|
561
|
+
addRule(e, t) {
|
|
562
|
+
this.rules[e] = t;
|
|
563
|
+
}
|
|
564
|
+
clearCache() {
|
|
565
|
+
this.pluralRulesCache = {};
|
|
566
|
+
}
|
|
567
|
+
getRule(e, t = {}) {
|
|
568
|
+
let n = E(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
569
|
+
cleanedCode: n,
|
|
570
|
+
type: r
|
|
571
|
+
});
|
|
572
|
+
if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
|
|
573
|
+
let a;
|
|
574
|
+
try {
|
|
575
|
+
a = new Intl.PluralRules(n, { type: r });
|
|
576
|
+
} catch {
|
|
577
|
+
if (!Intl) return this.logger.error("No Intl support, please use an Intl polyfill!"), le;
|
|
578
|
+
if (!e.match(/-|_/)) return le;
|
|
579
|
+
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
580
|
+
a = this.getRule(n, t);
|
|
581
|
+
}
|
|
582
|
+
return this.pluralRulesCache[i] = a, a;
|
|
583
|
+
}
|
|
584
|
+
needsPlural(e, t = {}) {
|
|
585
|
+
let n = this.getRule(e, t);
|
|
586
|
+
return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
|
|
587
|
+
}
|
|
588
|
+
getPluralFormsOfKey(e, t, n = {}) {
|
|
589
|
+
return this.getSuffixes(e, n).map((e) => `${t}${e}`);
|
|
590
|
+
}
|
|
591
|
+
getSuffixes(e, t = {}) {
|
|
592
|
+
let n = this.getRule(e, t);
|
|
593
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => ce[e] - ce[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
594
|
+
}
|
|
595
|
+
getSuffix(e, t, n = {}) {
|
|
596
|
+
let r = this.getRule(e, n);
|
|
597
|
+
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));
|
|
598
|
+
}
|
|
599
|
+
}, de = (e, t, n, r = ".", i = !0) => {
|
|
600
|
+
let a = ee(e, t, n);
|
|
601
|
+
return !a && i && s(n) && (a = T(e, n, r), a === void 0 && (a = T(t, n, r))), a;
|
|
602
|
+
}, N = (e) => e.replace(/\$/g, "$$$$"), fe = class {
|
|
603
|
+
constructor(e = {}) {
|
|
604
|
+
this.logger = D.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
605
|
+
}
|
|
606
|
+
init(e = {}) {
|
|
607
|
+
e.interpolation ||= { escapeValue: !0 };
|
|
608
|
+
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;
|
|
609
|
+
this.escape = t === void 0 ? x : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? y(i) : a || "{{", this.suffix = o ? y(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? y(d) : f || y("$t("), this.nestingSuffix = p ? y(p) : m || y(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
|
|
610
|
+
}
|
|
611
|
+
reset() {
|
|
612
|
+
this.options && this.init(this.options);
|
|
613
|
+
}
|
|
614
|
+
resetRegExp() {
|
|
615
|
+
let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
|
|
616
|
+
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}`);
|
|
617
|
+
}
|
|
618
|
+
interpolate(e, t, n, r) {
|
|
619
|
+
let i, a, o, c = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (e) => {
|
|
620
|
+
if (e.indexOf(this.formatSeparator) < 0) {
|
|
621
|
+
let i = de(t, c, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
622
|
+
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
623
|
+
...r,
|
|
624
|
+
...t,
|
|
625
|
+
interpolationkey: e
|
|
626
|
+
}) : i;
|
|
627
|
+
}
|
|
628
|
+
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
629
|
+
return this.format(de(t, c, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
630
|
+
...r,
|
|
631
|
+
...t,
|
|
632
|
+
interpolationkey: a
|
|
633
|
+
});
|
|
634
|
+
};
|
|
635
|
+
this.resetRegExp();
|
|
636
|
+
let d = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
637
|
+
return [{
|
|
638
|
+
regex: this.regexpUnescape,
|
|
639
|
+
safeValue: (e) => N(e)
|
|
640
|
+
}, {
|
|
641
|
+
regex: this.regexp,
|
|
642
|
+
safeValue: (e) => this.escapeValue ? N(this.escape(e)) : N(e)
|
|
643
|
+
}].forEach((t) => {
|
|
644
|
+
for (o = 0; i = t.regex.exec(e);) {
|
|
645
|
+
let n = i[1].trim();
|
|
646
|
+
if (a = u(n), a === void 0) if (typeof d == "function") {
|
|
647
|
+
let t = d(e, i, r);
|
|
648
|
+
a = s(t) ? t : "";
|
|
649
|
+
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
650
|
+
else if (f) {
|
|
651
|
+
a = i[0];
|
|
652
|
+
continue;
|
|
653
|
+
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
654
|
+
else !s(a) && !this.useRawValueToEscape && (a = l(a));
|
|
655
|
+
let c = t.safeValue(a);
|
|
656
|
+
if (e = e.replace(i[0], c), f ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
|
|
657
|
+
}
|
|
658
|
+
}), e;
|
|
659
|
+
}
|
|
660
|
+
nest(e, t, n = {}) {
|
|
661
|
+
let r, i, a, o = (e, t) => {
|
|
662
|
+
let n = this.nestingOptionsSeparator;
|
|
663
|
+
if (e.indexOf(n) < 0) return e;
|
|
664
|
+
let r = e.split(RegExp(`${n}[ ]*{`)), i = `{${r[1]}`;
|
|
665
|
+
e = r[0], i = this.interpolate(i, a);
|
|
666
|
+
let o = i.match(/'/g), s = i.match(/"/g);
|
|
667
|
+
((o?.length ?? 0) % 2 == 0 && !s || s.length % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
668
|
+
try {
|
|
669
|
+
a = JSON.parse(i), t && (a = {
|
|
670
|
+
...t,
|
|
671
|
+
...a
|
|
672
|
+
});
|
|
673
|
+
} catch (t) {
|
|
674
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
|
|
675
|
+
}
|
|
676
|
+
return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
|
|
677
|
+
};
|
|
678
|
+
for (; r = this.nestingRegexp.exec(e);) {
|
|
679
|
+
let c = [];
|
|
680
|
+
a = { ...n }, a = a.replace && !s(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
681
|
+
let u = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
682
|
+
if (u !== -1 && (c = r[1].slice(u).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, u)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !s(i)) return i;
|
|
683
|
+
s(i) || (i = l(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), c.length && (i = c.reduce((e, t) => this.format(e, t, n.lng, {
|
|
684
|
+
...n,
|
|
685
|
+
interpolationkey: r[1].trim()
|
|
686
|
+
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
687
|
+
}
|
|
688
|
+
return e;
|
|
689
|
+
}
|
|
690
|
+
}, pe = (e) => {
|
|
691
|
+
let t = e.toLowerCase().trim(), n = {};
|
|
692
|
+
if (e.indexOf("(") > -1) {
|
|
693
|
+
let r = e.split("(");
|
|
694
|
+
t = r[0].toLowerCase().trim();
|
|
695
|
+
let i = r[1].substring(0, r[1].length - 1);
|
|
696
|
+
t === "currency" && i.indexOf(":") < 0 ? n.currency ||= i.trim() : t === "relativetime" && i.indexOf(":") < 0 ? n.range ||= i.trim() : i.split(";").forEach((e) => {
|
|
697
|
+
if (e) {
|
|
698
|
+
let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
|
|
699
|
+
n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
return {
|
|
704
|
+
formatName: t,
|
|
705
|
+
formatOptions: n
|
|
706
|
+
};
|
|
707
|
+
}, P = (e) => {
|
|
708
|
+
let t = {};
|
|
709
|
+
return (n, r, i) => {
|
|
710
|
+
let a = i;
|
|
711
|
+
i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
|
|
712
|
+
...a,
|
|
713
|
+
[i.interpolationkey]: void 0
|
|
714
|
+
});
|
|
715
|
+
let o = r + JSON.stringify(a), s = t[o];
|
|
716
|
+
return s || (s = e(E(r), i), t[o] = s), s(n);
|
|
717
|
+
};
|
|
718
|
+
}, me = (e) => (t, n, r) => e(E(n), r)(t), he = class {
|
|
719
|
+
constructor(e = {}) {
|
|
720
|
+
this.logger = D.create("formatter"), this.options = e, this.init(e);
|
|
721
|
+
}
|
|
722
|
+
init(e, t = { interpolation: {} }) {
|
|
723
|
+
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
724
|
+
let n = t.cacheInBuiltFormats ? P : me;
|
|
725
|
+
this.formats = {
|
|
726
|
+
number: n((e, t) => {
|
|
727
|
+
let n = new Intl.NumberFormat(e, { ...t });
|
|
728
|
+
return (e) => n.format(e);
|
|
729
|
+
}),
|
|
730
|
+
currency: n((e, t) => {
|
|
731
|
+
let n = new Intl.NumberFormat(e, {
|
|
732
|
+
...t,
|
|
733
|
+
style: "currency"
|
|
734
|
+
});
|
|
735
|
+
return (e) => n.format(e);
|
|
736
|
+
}),
|
|
737
|
+
datetime: n((e, t) => {
|
|
738
|
+
let n = new Intl.DateTimeFormat(e, { ...t });
|
|
739
|
+
return (e) => n.format(e);
|
|
740
|
+
}),
|
|
741
|
+
relativetime: n((e, t) => {
|
|
742
|
+
let n = new Intl.RelativeTimeFormat(e, { ...t });
|
|
743
|
+
return (e) => n.format(e, t.range || "day");
|
|
744
|
+
}),
|
|
745
|
+
list: n((e, t) => {
|
|
746
|
+
let n = new Intl.ListFormat(e, { ...t });
|
|
747
|
+
return (e) => n.format(e);
|
|
748
|
+
})
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
add(e, t) {
|
|
752
|
+
this.formats[e.toLowerCase().trim()] = t;
|
|
753
|
+
}
|
|
754
|
+
addCached(e, t) {
|
|
755
|
+
this.formats[e.toLowerCase().trim()] = P(t);
|
|
756
|
+
}
|
|
757
|
+
format(e, t, n, r = {}) {
|
|
758
|
+
let i = t.split(this.formatSeparator);
|
|
759
|
+
if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((e) => e.indexOf(")") > -1)) {
|
|
760
|
+
let e = i.findIndex((e) => e.indexOf(")") > -1);
|
|
761
|
+
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
762
|
+
}
|
|
763
|
+
return i.reduce((e, t) => {
|
|
764
|
+
let { formatName: i, formatOptions: a } = pe(t);
|
|
765
|
+
if (this.formats[i]) {
|
|
766
|
+
let t = e;
|
|
767
|
+
try {
|
|
768
|
+
let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
|
|
769
|
+
t = this.formats[i](e, s, {
|
|
770
|
+
...a,
|
|
771
|
+
...r,
|
|
772
|
+
...o
|
|
773
|
+
});
|
|
774
|
+
} catch (e) {
|
|
775
|
+
this.logger.warn(e);
|
|
776
|
+
}
|
|
777
|
+
return t;
|
|
778
|
+
} else this.logger.warn(`there was no format function for ${i}`);
|
|
779
|
+
return e;
|
|
780
|
+
}, e);
|
|
781
|
+
}
|
|
782
|
+
}, ge = (e, t) => {
|
|
783
|
+
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
784
|
+
}, _e = class extends O {
|
|
785
|
+
constructor(e, t, n, r = {}) {
|
|
786
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = D.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);
|
|
787
|
+
}
|
|
788
|
+
queueLoad(e, t, n, r) {
|
|
789
|
+
let i = {}, a = {}, o = {}, s = {};
|
|
790
|
+
return e.forEach((e) => {
|
|
791
|
+
let r = !0;
|
|
792
|
+
t.forEach((t) => {
|
|
793
|
+
let o = `${e}|${t}`;
|
|
794
|
+
!n.reload && this.store.hasResourceBundle(e, t) ? this.state[o] = 2 : this.state[o] < 0 || (this.state[o] === 1 ? a[o] === void 0 && (a[o] = !0) : (this.state[o] = 1, r = !1, a[o] === void 0 && (a[o] = !0), i[o] === void 0 && (i[o] = !0), s[t] === void 0 && (s[t] = !0)));
|
|
795
|
+
}), r || (o[e] = !0);
|
|
796
|
+
}), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
|
|
797
|
+
pending: a,
|
|
798
|
+
pendingCount: Object.keys(a).length,
|
|
799
|
+
loaded: {},
|
|
800
|
+
errors: [],
|
|
801
|
+
callback: r
|
|
802
|
+
}), {
|
|
803
|
+
toLoad: Object.keys(i),
|
|
804
|
+
pending: Object.keys(a),
|
|
805
|
+
toLoadLanguages: Object.keys(o),
|
|
806
|
+
toLoadNamespaces: Object.keys(s)
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
loaded(e, t, n) {
|
|
810
|
+
let r = e.split("|"), i = r[0], a = r[1];
|
|
811
|
+
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);
|
|
812
|
+
let o = {};
|
|
813
|
+
this.queue.forEach((n) => {
|
|
814
|
+
g(n.loaded, [i], a), ge(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
815
|
+
o[e] || (o[e] = {});
|
|
816
|
+
let t = n.loaded[e];
|
|
817
|
+
t.length && t.forEach((t) => {
|
|
818
|
+
o[e][t] === void 0 && (o[e][t] = !0);
|
|
819
|
+
});
|
|
820
|
+
}), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
|
|
821
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
|
|
822
|
+
}
|
|
823
|
+
read(e, t, n, r = 0, i = this.retryTimeout, a) {
|
|
824
|
+
if (!e.length) return a(null, {});
|
|
825
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
826
|
+
this.waitingReads.push({
|
|
827
|
+
lng: e,
|
|
828
|
+
ns: t,
|
|
829
|
+
fcName: n,
|
|
830
|
+
tried: r,
|
|
831
|
+
wait: i,
|
|
832
|
+
callback: a
|
|
833
|
+
});
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
this.readingCalls++;
|
|
837
|
+
let o = (o, s) => {
|
|
838
|
+
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
839
|
+
let e = this.waitingReads.shift();
|
|
840
|
+
this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
|
|
841
|
+
}
|
|
842
|
+
if (o && s && r < this.maxRetries) {
|
|
843
|
+
setTimeout(() => {
|
|
844
|
+
this.read.call(this, e, t, n, r + 1, i * 2, a);
|
|
845
|
+
}, i);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
a(o, s);
|
|
849
|
+
}, s = this.backend[n].bind(this.backend);
|
|
850
|
+
if (s.length === 2) {
|
|
851
|
+
try {
|
|
852
|
+
let n = s(e, t);
|
|
853
|
+
n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
|
|
854
|
+
} catch (e) {
|
|
855
|
+
o(e);
|
|
856
|
+
}
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
return s(e, t, o);
|
|
860
|
+
}
|
|
861
|
+
prepareLoading(e, t, n = {}, r) {
|
|
862
|
+
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
863
|
+
s(e) && (e = this.languageUtils.toResolveHierarchy(e)), s(t) && (t = [t]);
|
|
864
|
+
let i = this.queueLoad(e, t, n, r);
|
|
865
|
+
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
866
|
+
i.toLoad.forEach((e) => {
|
|
867
|
+
this.loadOne(e);
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
load(e, t, n) {
|
|
871
|
+
this.prepareLoading(e, t, {}, n);
|
|
872
|
+
}
|
|
873
|
+
reload(e, t, n) {
|
|
874
|
+
this.prepareLoading(e, t, { reload: !0 }, n);
|
|
875
|
+
}
|
|
876
|
+
loadOne(e, t = "") {
|
|
877
|
+
let n = e.split("|"), r = n[0], i = n[1];
|
|
878
|
+
this.read(r, i, "read", void 0, void 0, (n, a) => {
|
|
879
|
+
n && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, n), !n && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, n, a);
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
|
|
883
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
|
|
884
|
+
this.logger.warn(`did not save key "${n}" as the namespace "${t}" 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!!!");
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
if (!(n == null || n === "")) {
|
|
888
|
+
if (this.backend?.create) {
|
|
889
|
+
let s = {
|
|
890
|
+
...a,
|
|
891
|
+
isUpdate: i
|
|
892
|
+
}, c = this.backend.create.bind(this.backend);
|
|
893
|
+
if (c.length < 6) try {
|
|
894
|
+
let i;
|
|
895
|
+
i = c.length === 5 ? c(e, t, n, r, s) : c(e, t, n, r), i && typeof i.then == "function" ? i.then((e) => o(null, e)).catch(o) : o(null, i);
|
|
896
|
+
} catch (e) {
|
|
897
|
+
o(e);
|
|
898
|
+
}
|
|
899
|
+
else c(e, t, n, r, o, s);
|
|
900
|
+
}
|
|
901
|
+
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}, F = () => ({
|
|
905
|
+
debug: !1,
|
|
906
|
+
initAsync: !0,
|
|
907
|
+
ns: ["translation"],
|
|
908
|
+
defaultNS: ["translation"],
|
|
909
|
+
fallbackLng: ["dev"],
|
|
910
|
+
fallbackNS: !1,
|
|
911
|
+
supportedLngs: !1,
|
|
912
|
+
nonExplicitSupportedLngs: !1,
|
|
913
|
+
load: "all",
|
|
914
|
+
preload: !1,
|
|
915
|
+
simplifyPluralSuffix: !0,
|
|
916
|
+
keySeparator: ".",
|
|
917
|
+
nsSeparator: ":",
|
|
918
|
+
pluralSeparator: "_",
|
|
919
|
+
contextSeparator: "_",
|
|
920
|
+
partialBundledLanguages: !1,
|
|
921
|
+
saveMissing: !1,
|
|
922
|
+
updateMissing: !1,
|
|
923
|
+
saveMissingTo: "fallback",
|
|
924
|
+
saveMissingPlurals: !0,
|
|
925
|
+
missingKeyHandler: !1,
|
|
926
|
+
missingInterpolationHandler: !1,
|
|
927
|
+
postProcess: !1,
|
|
928
|
+
postProcessPassResolved: !1,
|
|
929
|
+
returnNull: !1,
|
|
930
|
+
returnEmptyString: !0,
|
|
931
|
+
returnObjects: !1,
|
|
932
|
+
joinArrays: !1,
|
|
933
|
+
returnedObjectHandler: !1,
|
|
934
|
+
parseMissingKeyHandler: !1,
|
|
935
|
+
appendNamespaceToMissingKey: !1,
|
|
936
|
+
appendNamespaceToCIMode: !1,
|
|
937
|
+
overloadTranslationOptionHandler: (e) => {
|
|
938
|
+
let t = {};
|
|
939
|
+
if (typeof e[1] == "object" && (t = e[1]), s(e[1]) && (t.defaultValue = e[1]), s(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
940
|
+
let n = e[3] || e[2];
|
|
941
|
+
Object.keys(n).forEach((e) => {
|
|
942
|
+
t[e] = n[e];
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
return t;
|
|
946
|
+
},
|
|
947
|
+
interpolation: {
|
|
948
|
+
escapeValue: !0,
|
|
949
|
+
format: (e) => e,
|
|
950
|
+
prefix: "{{",
|
|
951
|
+
suffix: "}}",
|
|
952
|
+
formatSeparator: ",",
|
|
953
|
+
unescapePrefix: "-",
|
|
954
|
+
nestingPrefix: "$t(",
|
|
955
|
+
nestingSuffix: ")",
|
|
956
|
+
nestingOptionsSeparator: ",",
|
|
957
|
+
maxReplaces: 1e3,
|
|
958
|
+
skipOnVariables: !0
|
|
959
|
+
},
|
|
960
|
+
cacheInBuiltFormats: !0
|
|
961
|
+
}), I = (e) => (s(e.ns) && (e.ns = [e.ns]), s(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), s(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs?.indexOf?.("cimode") < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e), L = () => {}, ve = (e) => {
|
|
962
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
963
|
+
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
964
|
+
});
|
|
965
|
+
}, R = class e extends O {
|
|
966
|
+
constructor(e = {}, t) {
|
|
967
|
+
if (super(), this.options = I(e), this.services = {}, this.logger = D, this.modules = { external: [] }, ve(this), t && !this.isInitialized && !e.isClone) {
|
|
968
|
+
if (!this.options.initAsync) return this.init(e, t), this;
|
|
969
|
+
setTimeout(() => {
|
|
970
|
+
this.init(e, t);
|
|
971
|
+
}, 0);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
init(e = {}, t) {
|
|
975
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (s(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
976
|
+
let n = F();
|
|
977
|
+
this.options = {
|
|
978
|
+
...n,
|
|
979
|
+
...this.options,
|
|
980
|
+
...I(e)
|
|
981
|
+
}, this.options.interpolation = {
|
|
982
|
+
...n.interpolation,
|
|
983
|
+
...this.options.interpolation
|
|
984
|
+
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator);
|
|
985
|
+
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
986
|
+
if (!this.options.isClone) {
|
|
987
|
+
this.modules.logger ? D.init(r(this.modules.logger), this.options) : D.init(null, this.options);
|
|
988
|
+
let e;
|
|
989
|
+
e = this.modules.formatter ? this.modules.formatter : he;
|
|
990
|
+
let t = new se(this.options);
|
|
991
|
+
this.store = new k(this.options.resources, this.options);
|
|
992
|
+
let i = this.services;
|
|
993
|
+
i.logger = D, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new ue(t, {
|
|
994
|
+
prepend: this.options.pluralSeparator,
|
|
995
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
996
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new fe(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new _e(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
997
|
+
this.emit(e, ...t);
|
|
998
|
+
}), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new oe(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
999
|
+
this.emit(e, ...t);
|
|
1000
|
+
}), this.modules.external.forEach((e) => {
|
|
1001
|
+
e.init && e.init(this);
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
if (this.format = this.options.interpolation.format, t ||= L, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1005
|
+
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1006
|
+
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1007
|
+
}
|
|
1008
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
|
|
1009
|
+
"getResource",
|
|
1010
|
+
"hasResourceBundle",
|
|
1011
|
+
"getResourceBundle",
|
|
1012
|
+
"getDataByLanguage"
|
|
1013
|
+
].forEach((e) => {
|
|
1014
|
+
this[e] = (...t) => this.store[e](...t);
|
|
1015
|
+
}), [
|
|
1016
|
+
"addResource",
|
|
1017
|
+
"addResources",
|
|
1018
|
+
"addResourceBundle",
|
|
1019
|
+
"removeResourceBundle"
|
|
1020
|
+
].forEach((e) => {
|
|
1021
|
+
this[e] = (...t) => (this.store[e](...t), this);
|
|
1022
|
+
});
|
|
1023
|
+
let i = c(), a = () => {
|
|
1024
|
+
let e = (e, n) => {
|
|
1025
|
+
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);
|
|
1026
|
+
};
|
|
1027
|
+
if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
|
|
1028
|
+
this.changeLanguage(this.options.lng, e);
|
|
1029
|
+
};
|
|
1030
|
+
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1031
|
+
}
|
|
1032
|
+
loadResources(e, t = L) {
|
|
1033
|
+
let n = t, r = s(e) ? e : this.language;
|
|
1034
|
+
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1035
|
+
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1036
|
+
let e = [], t = (t) => {
|
|
1037
|
+
t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
|
|
1038
|
+
t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
|
|
1039
|
+
});
|
|
1040
|
+
};
|
|
1041
|
+
r ? t(r) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e) => t(e)), this.options.preload?.forEach?.((e) => t(e)), this.services.backendConnector.load(e, this.options.ns, (e) => {
|
|
1042
|
+
!e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
|
|
1043
|
+
});
|
|
1044
|
+
} else n(null);
|
|
1045
|
+
}
|
|
1046
|
+
reloadResources(e, t, n) {
|
|
1047
|
+
let r = c();
|
|
1048
|
+
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 ||= L, this.services.backendConnector.reload(e, t, (e) => {
|
|
1049
|
+
r.resolve(), n(e);
|
|
1050
|
+
}), r;
|
|
1051
|
+
}
|
|
1052
|
+
use(e) {
|
|
1053
|
+
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1054
|
+
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1055
|
+
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" && A.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1056
|
+
}
|
|
1057
|
+
setResolvedLanguage(e) {
|
|
1058
|
+
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
1059
|
+
for (let e = 0; e < this.languages.length; e++) {
|
|
1060
|
+
let t = this.languages[e];
|
|
1061
|
+
if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
|
|
1062
|
+
this.resolvedLanguage = t;
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
!this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
changeLanguage(e, t) {
|
|
1070
|
+
this.isLanguageChangingTo = e;
|
|
1071
|
+
let n = c();
|
|
1072
|
+
this.emit("languageChanging", e);
|
|
1073
|
+
let r = (e) => {
|
|
1074
|
+
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
1075
|
+
}, i = (i, a) => {
|
|
1076
|
+
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));
|
|
1077
|
+
}, a = (t) => {
|
|
1078
|
+
!e && !t && this.services.languageDetector && (t = []);
|
|
1079
|
+
let n = s(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(s(t) ? [t] : t);
|
|
1080
|
+
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1081
|
+
i(e, a);
|
|
1082
|
+
});
|
|
1083
|
+
};
|
|
1084
|
+
return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), n;
|
|
1085
|
+
}
|
|
1086
|
+
getFixedT(e, t, n) {
|
|
1087
|
+
let r = (e, t, ...i) => {
|
|
1088
|
+
let a;
|
|
1089
|
+
a = typeof t == "object" ? { ...t } : this.options.overloadTranslationOptionHandler([e, t].concat(i)), a.lng = a.lng || r.lng, a.lngs = a.lngs || r.lngs, a.ns = a.ns || r.ns, a.keyPrefix !== "" && (a.keyPrefix = a.keyPrefix || n || r.keyPrefix);
|
|
1090
|
+
let o = this.options.keySeparator || ".", s;
|
|
1091
|
+
return a.keyPrefix && Array.isArray(e) ? s = e.map((e) => (typeof e == "function" && (e = j(e, {
|
|
1092
|
+
...this.options,
|
|
1093
|
+
...t
|
|
1094
|
+
})), `${a.keyPrefix}${o}${e}`)) : (typeof e == "function" && (e = j(e, {
|
|
1095
|
+
...this.options,
|
|
1096
|
+
...t
|
|
1097
|
+
})), s = a.keyPrefix ? `${a.keyPrefix}${o}${e}` : e), this.t(s, a);
|
|
1098
|
+
};
|
|
1099
|
+
return s(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1100
|
+
}
|
|
1101
|
+
t(...e) {
|
|
1102
|
+
return this.translator?.translate(...e);
|
|
1103
|
+
}
|
|
1104
|
+
exists(...e) {
|
|
1105
|
+
return this.translator?.exists(...e);
|
|
1106
|
+
}
|
|
1107
|
+
setDefaultNamespace(e) {
|
|
1108
|
+
this.options.defaultNS = e;
|
|
1109
|
+
}
|
|
1110
|
+
hasLoadedNamespace(e, t = {}) {
|
|
1111
|
+
if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1112
|
+
if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1113
|
+
let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
|
|
1114
|
+
if (n.toLowerCase() === "cimode") return !0;
|
|
1115
|
+
let a = (e, t) => {
|
|
1116
|
+
let n = this.services.backendConnector.state[`${e}|${t}`];
|
|
1117
|
+
return n === -1 || n === 0 || n === 2;
|
|
1118
|
+
};
|
|
1119
|
+
if (t.precheck) {
|
|
1120
|
+
let e = t.precheck(this, a);
|
|
1121
|
+
if (e !== void 0) return e;
|
|
1122
|
+
}
|
|
1123
|
+
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1124
|
+
}
|
|
1125
|
+
loadNamespaces(e, t) {
|
|
1126
|
+
let n = c();
|
|
1127
|
+
return this.options.ns ? (s(e) && (e = [e]), e.forEach((e) => {
|
|
1128
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1129
|
+
}), this.loadResources((e) => {
|
|
1130
|
+
n.resolve(), t && t(e);
|
|
1131
|
+
}), n) : (t && t(), Promise.resolve());
|
|
1132
|
+
}
|
|
1133
|
+
loadLanguages(e, t) {
|
|
1134
|
+
let n = c();
|
|
1135
|
+
s(e) && (e = [e]);
|
|
1136
|
+
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1137
|
+
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1138
|
+
n.resolve(), t && t(e);
|
|
1139
|
+
}), n) : (t && t(), Promise.resolve());
|
|
1140
|
+
}
|
|
1141
|
+
dir(e) {
|
|
1142
|
+
if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
|
|
1143
|
+
try {
|
|
1144
|
+
let t = new Intl.Locale(e);
|
|
1145
|
+
if (t && t.getTextInfo) {
|
|
1146
|
+
let e = t.getTextInfo();
|
|
1147
|
+
if (e && e.direction) return e.direction;
|
|
1148
|
+
}
|
|
1149
|
+
} catch {}
|
|
1150
|
+
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 se(F());
|
|
1151
|
+
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1152
|
+
}
|
|
1153
|
+
static createInstance(t = {}, n) {
|
|
1154
|
+
let r = new e(t, n);
|
|
1155
|
+
return r.createInstance = e.createInstance, r;
|
|
1156
|
+
}
|
|
1157
|
+
cloneInstance(t = {}, n = L) {
|
|
1158
|
+
let r = t.forkResourceStore;
|
|
1159
|
+
r && delete t.forkResourceStore;
|
|
1160
|
+
let i = {
|
|
1161
|
+
...this.options,
|
|
1162
|
+
...t,
|
|
1163
|
+
isClone: !0
|
|
1164
|
+
}, a = new e(i);
|
|
1165
|
+
return (t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
|
|
1166
|
+
"store",
|
|
1167
|
+
"services",
|
|
1168
|
+
"language"
|
|
1169
|
+
].forEach((e) => {
|
|
1170
|
+
a[e] = this[e];
|
|
1171
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new k(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 && (a.services.interpolator = new fe(i)), a.translator = new oe(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1172
|
+
a.emit(e, ...t);
|
|
1173
|
+
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1174
|
+
}
|
|
1175
|
+
toJSON() {
|
|
1176
|
+
return {
|
|
1177
|
+
options: this.options,
|
|
1178
|
+
store: this.store,
|
|
1179
|
+
language: this.language,
|
|
1180
|
+
languages: this.languages,
|
|
1181
|
+
resolvedLanguage: this.resolvedLanguage
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
}.createInstance();
|
|
1185
|
+
R.createInstance, R.dir, R.init, R.loadResources, R.reloadResources, R.use, R.changeLanguage, R.getFixedT, R.t, R.exists, R.setDefaultNamespace, R.hasLoadedNamespace, R.loadNamespaces, R.loadLanguages;
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region ../../node_modules/.pnpm/i18next-browser-languagedetector@8.2.0/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js
|
|
1188
|
+
var { slice: ye, forEach: be } = [];
|
|
1189
|
+
function xe(e) {
|
|
1190
|
+
return be.call(ye.call(arguments, 1), (t) => {
|
|
1191
|
+
if (t) for (let n in t) e[n] === void 0 && (e[n] = t[n]);
|
|
1192
|
+
}), e;
|
|
1193
|
+
}
|
|
1194
|
+
function Se(e) {
|
|
1195
|
+
return typeof e == "string" ? [
|
|
1196
|
+
/<\s*script.*?>/i,
|
|
1197
|
+
/<\s*\/\s*script\s*>/i,
|
|
1198
|
+
/<\s*img.*?on\w+\s*=/i,
|
|
1199
|
+
/<\s*\w+\s*on\w+\s*=.*?>/i,
|
|
1200
|
+
/javascript\s*:/i,
|
|
1201
|
+
/vbscript\s*:/i,
|
|
1202
|
+
/expression\s*\(/i,
|
|
1203
|
+
/eval\s*\(/i,
|
|
1204
|
+
/alert\s*\(/i,
|
|
1205
|
+
/document\.cookie/i,
|
|
1206
|
+
/document\.write\s*\(/i,
|
|
1207
|
+
/window\.location/i,
|
|
1208
|
+
/innerHTML/i
|
|
1209
|
+
].some((t) => t.test(e)) : !1;
|
|
1210
|
+
}
|
|
1211
|
+
var z = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Ce = function(e, t) {
|
|
1212
|
+
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { path: "/" }, r = `${e}=${encodeURIComponent(t)}`;
|
|
1213
|
+
if (n.maxAge > 0) {
|
|
1214
|
+
let e = n.maxAge - 0;
|
|
1215
|
+
if (Number.isNaN(e)) throw Error("maxAge should be a Number");
|
|
1216
|
+
r += `; Max-Age=${Math.floor(e)}`;
|
|
1217
|
+
}
|
|
1218
|
+
if (n.domain) {
|
|
1219
|
+
if (!z.test(n.domain)) throw TypeError("option domain is invalid");
|
|
1220
|
+
r += `; Domain=${n.domain}`;
|
|
1221
|
+
}
|
|
1222
|
+
if (n.path) {
|
|
1223
|
+
if (!z.test(n.path)) throw TypeError("option path is invalid");
|
|
1224
|
+
r += `; Path=${n.path}`;
|
|
1225
|
+
}
|
|
1226
|
+
if (n.expires) {
|
|
1227
|
+
if (typeof n.expires.toUTCString != "function") throw TypeError("option expires is invalid");
|
|
1228
|
+
r += `; Expires=${n.expires.toUTCString()}`;
|
|
1229
|
+
}
|
|
1230
|
+
if (n.httpOnly && (r += "; HttpOnly"), n.secure && (r += "; Secure"), n.sameSite) switch (typeof n.sameSite == "string" ? n.sameSite.toLowerCase() : n.sameSite) {
|
|
1231
|
+
case !0:
|
|
1232
|
+
r += "; SameSite=Strict";
|
|
1233
|
+
break;
|
|
1234
|
+
case "lax":
|
|
1235
|
+
r += "; SameSite=Lax";
|
|
1236
|
+
break;
|
|
1237
|
+
case "strict":
|
|
1238
|
+
r += "; SameSite=Strict";
|
|
1239
|
+
break;
|
|
1240
|
+
case "none":
|
|
1241
|
+
r += "; SameSite=None";
|
|
1242
|
+
break;
|
|
1243
|
+
default: throw TypeError("option sameSite is invalid");
|
|
1244
|
+
}
|
|
1245
|
+
return n.partitioned && (r += "; Partitioned"), r;
|
|
1246
|
+
}, B = {
|
|
1247
|
+
create(e, t, n, r) {
|
|
1248
|
+
let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
1249
|
+
path: "/",
|
|
1250
|
+
sameSite: "strict"
|
|
1251
|
+
};
|
|
1252
|
+
n && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + n * 60 * 1e3)), r && (i.domain = r), document.cookie = Ce(e, t, i);
|
|
1253
|
+
},
|
|
1254
|
+
read(e) {
|
|
1255
|
+
let t = `${e}=`, n = document.cookie.split(";");
|
|
1256
|
+
for (let e = 0; e < n.length; e++) {
|
|
1257
|
+
let r = n[e];
|
|
1258
|
+
for (; r.charAt(0) === " ";) r = r.substring(1, r.length);
|
|
1259
|
+
if (r.indexOf(t) === 0) return r.substring(t.length, r.length);
|
|
1260
|
+
}
|
|
1261
|
+
return null;
|
|
1262
|
+
},
|
|
1263
|
+
remove(e, t) {
|
|
1264
|
+
this.create(e, "", -1, t);
|
|
1265
|
+
}
|
|
1266
|
+
}, we = {
|
|
1267
|
+
name: "cookie",
|
|
1268
|
+
lookup(e) {
|
|
1269
|
+
let { lookupCookie: t } = e;
|
|
1270
|
+
if (t && typeof document < "u") return B.read(t) || void 0;
|
|
1271
|
+
},
|
|
1272
|
+
cacheUserLanguage(e, t) {
|
|
1273
|
+
let { lookupCookie: n, cookieMinutes: r, cookieDomain: i, cookieOptions: a } = t;
|
|
1274
|
+
n && typeof document < "u" && B.create(n, e, r, i, a);
|
|
1275
|
+
}
|
|
1276
|
+
}, Te = {
|
|
1277
|
+
name: "querystring",
|
|
1278
|
+
lookup(e) {
|
|
1279
|
+
let { lookupQuerystring: t } = e, n;
|
|
1280
|
+
if (typeof window < "u") {
|
|
1281
|
+
let { search: e } = window.location;
|
|
1282
|
+
!window.location.search && window.location.hash?.indexOf("?") > -1 && (e = window.location.hash.substring(window.location.hash.indexOf("?")));
|
|
1283
|
+
let r = e.substring(1).split("&");
|
|
1284
|
+
for (let e = 0; e < r.length; e++) {
|
|
1285
|
+
let i = r[e].indexOf("=");
|
|
1286
|
+
i > 0 && r[e].substring(0, i) === t && (n = r[e].substring(i + 1));
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
return n;
|
|
1290
|
+
}
|
|
1291
|
+
}, Ee = {
|
|
1292
|
+
name: "hash",
|
|
1293
|
+
lookup(e) {
|
|
1294
|
+
let { lookupHash: t, lookupFromHashIndex: n } = e, r;
|
|
1295
|
+
if (typeof window < "u") {
|
|
1296
|
+
let { hash: e } = window.location;
|
|
1297
|
+
if (e && e.length > 2) {
|
|
1298
|
+
let i = e.substring(1);
|
|
1299
|
+
if (t) {
|
|
1300
|
+
let e = i.split("&");
|
|
1301
|
+
for (let n = 0; n < e.length; n++) {
|
|
1302
|
+
let i = e[n].indexOf("=");
|
|
1303
|
+
i > 0 && e[n].substring(0, i) === t && (r = e[n].substring(i + 1));
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
if (r) return r;
|
|
1307
|
+
if (!r && n > -1) {
|
|
1308
|
+
let t = e.match(/\/([a-zA-Z-]*)/g);
|
|
1309
|
+
return Array.isArray(t) ? t[typeof n == "number" ? n : 0]?.replace("/", "") : void 0;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return r;
|
|
1314
|
+
}
|
|
1315
|
+
}, V = null, H = () => {
|
|
1316
|
+
if (V !== null) return V;
|
|
1317
|
+
try {
|
|
1318
|
+
if (V = typeof window < "u" && window.localStorage !== null, !V) return !1;
|
|
1319
|
+
let e = "i18next.translate.boo";
|
|
1320
|
+
window.localStorage.setItem(e, "foo"), window.localStorage.removeItem(e);
|
|
1321
|
+
} catch {
|
|
1322
|
+
V = !1;
|
|
1323
|
+
}
|
|
1324
|
+
return V;
|
|
1325
|
+
}, De = {
|
|
1326
|
+
name: "localStorage",
|
|
1327
|
+
lookup(e) {
|
|
1328
|
+
let { lookupLocalStorage: t } = e;
|
|
1329
|
+
if (t && H()) return window.localStorage.getItem(t) || void 0;
|
|
1330
|
+
},
|
|
1331
|
+
cacheUserLanguage(e, t) {
|
|
1332
|
+
let { lookupLocalStorage: n } = t;
|
|
1333
|
+
n && H() && window.localStorage.setItem(n, e);
|
|
1334
|
+
}
|
|
1335
|
+
}, U = null, Oe = () => {
|
|
1336
|
+
if (U !== null) return U;
|
|
1337
|
+
try {
|
|
1338
|
+
if (U = typeof window < "u" && window.sessionStorage !== null, !U) return !1;
|
|
1339
|
+
let e = "i18next.translate.boo";
|
|
1340
|
+
window.sessionStorage.setItem(e, "foo"), window.sessionStorage.removeItem(e);
|
|
1341
|
+
} catch {
|
|
1342
|
+
U = !1;
|
|
1343
|
+
}
|
|
1344
|
+
return U;
|
|
1345
|
+
}, ke = {
|
|
1346
|
+
name: "sessionStorage",
|
|
1347
|
+
lookup(e) {
|
|
1348
|
+
let { lookupSessionStorage: t } = e;
|
|
1349
|
+
if (t && Oe()) return window.sessionStorage.getItem(t) || void 0;
|
|
1350
|
+
},
|
|
1351
|
+
cacheUserLanguage(e, t) {
|
|
1352
|
+
let { lookupSessionStorage: n } = t;
|
|
1353
|
+
n && Oe() && window.sessionStorage.setItem(n, e);
|
|
1354
|
+
}
|
|
1355
|
+
}, Ae = {
|
|
1356
|
+
name: "navigator",
|
|
1357
|
+
lookup(e) {
|
|
1358
|
+
let t = [];
|
|
1359
|
+
if (typeof navigator < "u") {
|
|
1360
|
+
let { languages: e, userLanguage: n, language: r } = navigator;
|
|
1361
|
+
if (e) for (let n = 0; n < e.length; n++) t.push(e[n]);
|
|
1362
|
+
n && t.push(n), r && t.push(r);
|
|
1363
|
+
}
|
|
1364
|
+
return t.length > 0 ? t : void 0;
|
|
1365
|
+
}
|
|
1366
|
+
}, je = {
|
|
1367
|
+
name: "htmlTag",
|
|
1368
|
+
lookup(e) {
|
|
1369
|
+
let { htmlTag: t } = e, n, r = t || (typeof document < "u" ? document.documentElement : null);
|
|
1370
|
+
return r && typeof r.getAttribute == "function" && (n = r.getAttribute("lang")), n;
|
|
1371
|
+
}
|
|
1372
|
+
}, Me = {
|
|
1373
|
+
name: "path",
|
|
1374
|
+
lookup(e) {
|
|
1375
|
+
let { lookupFromPathIndex: t } = e;
|
|
1376
|
+
if (typeof window > "u") return;
|
|
1377
|
+
let n = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
1378
|
+
if (Array.isArray(n)) return n[typeof t == "number" ? t : 0]?.replace("/", "");
|
|
1379
|
+
}
|
|
1380
|
+
}, Ne = {
|
|
1381
|
+
name: "subdomain",
|
|
1382
|
+
lookup(e) {
|
|
1383
|
+
let { lookupFromSubdomainIndex: t } = e, n = typeof t == "number" ? t + 1 : 1, r = typeof window < "u" && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
|
|
1384
|
+
if (r) return r[n];
|
|
1385
|
+
}
|
|
1386
|
+
}, Pe = !1;
|
|
1387
|
+
try {
|
|
1388
|
+
document.cookie, Pe = !0;
|
|
1389
|
+
} catch {}
|
|
1390
|
+
var Fe = [
|
|
1391
|
+
"querystring",
|
|
1392
|
+
"cookie",
|
|
1393
|
+
"localStorage",
|
|
1394
|
+
"sessionStorage",
|
|
1395
|
+
"navigator",
|
|
1396
|
+
"htmlTag"
|
|
1397
|
+
];
|
|
1398
|
+
Pe || Fe.splice(1, 1);
|
|
1399
|
+
var Ie = () => ({
|
|
1400
|
+
order: Fe,
|
|
1401
|
+
lookupQuerystring: "lng",
|
|
1402
|
+
lookupCookie: "i18next",
|
|
1403
|
+
lookupLocalStorage: "i18nextLng",
|
|
1404
|
+
lookupSessionStorage: "i18nextLng",
|
|
1405
|
+
caches: ["localStorage"],
|
|
1406
|
+
excludeCacheFor: ["cimode"],
|
|
1407
|
+
convertDetectedLanguage: (e) => e
|
|
1408
|
+
}), Le = class {
|
|
1409
|
+
constructor(e) {
|
|
1410
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1411
|
+
this.type = "languageDetector", this.detectors = {}, this.init(e, t);
|
|
1412
|
+
}
|
|
1413
|
+
init() {
|
|
1414
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { languageUtils: {} }, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1415
|
+
this.services = e, this.options = xe(t, this.options || {}, Ie()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (e) => e.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = n, this.addDetector(we), this.addDetector(Te), this.addDetector(De), this.addDetector(ke), this.addDetector(Ae), this.addDetector(je), this.addDetector(Me), this.addDetector(Ne), this.addDetector(Ee);
|
|
1416
|
+
}
|
|
1417
|
+
addDetector(e) {
|
|
1418
|
+
return this.detectors[e.name] = e, this;
|
|
1419
|
+
}
|
|
1420
|
+
detect() {
|
|
1421
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.order, t = [];
|
|
1422
|
+
return e.forEach((e) => {
|
|
1423
|
+
if (this.detectors[e]) {
|
|
1424
|
+
let n = this.detectors[e].lookup(this.options);
|
|
1425
|
+
n && typeof n == "string" && (n = [n]), n && (t = t.concat(n));
|
|
1426
|
+
}
|
|
1427
|
+
}), t = t.filter((e) => e != null && !Se(e)).map((e) => this.options.convertDetectedLanguage(e)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
|
|
1428
|
+
}
|
|
1429
|
+
cacheUserLanguage(e) {
|
|
1430
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
|
|
1431
|
+
t && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || t.forEach((t) => {
|
|
1432
|
+
this.detectors[t] && this.detectors[t].cacheUserLanguage(e, this.options);
|
|
1433
|
+
}));
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
Le.type = "languageDetector";
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region ../../node_modules/.pnpm/i18next-http-backend@3.0.2/node_modules/i18next-http-backend/esm/utils.js
|
|
1439
|
+
function W(e) {
|
|
1440
|
+
"@babel/helpers - typeof";
|
|
1441
|
+
return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1442
|
+
return typeof e;
|
|
1443
|
+
} : function(e) {
|
|
1444
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1445
|
+
}, W(e);
|
|
1446
|
+
}
|
|
1447
|
+
var Re = [];
|
|
1448
|
+
Re.forEach, Re.slice;
|
|
1449
|
+
function ze() {
|
|
1450
|
+
return typeof XMLHttpRequest == "function" || (typeof XMLHttpRequest > "u" ? "undefined" : W(XMLHttpRequest)) === "object";
|
|
1451
|
+
}
|
|
1452
|
+
function Be(e) {
|
|
1453
|
+
return !!e && typeof e.then == "function";
|
|
1454
|
+
}
|
|
1455
|
+
function Ve(e) {
|
|
1456
|
+
return Be(e) ? e : Promise.resolve(e);
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region ../../node_modules/.pnpm/i18next-http-backend@3.0.2/node_modules/i18next-http-backend/esm/request.js
|
|
1460
|
+
function He(e, t) {
|
|
1461
|
+
var n = Object.keys(e);
|
|
1462
|
+
if (Object.getOwnPropertySymbols) {
|
|
1463
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
1464
|
+
t && (r = r.filter(function(t) {
|
|
1465
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
1466
|
+
})), n.push.apply(n, r);
|
|
1467
|
+
}
|
|
1468
|
+
return n;
|
|
1469
|
+
}
|
|
1470
|
+
function Ue(e) {
|
|
1471
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1472
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
1473
|
+
t % 2 ? He(Object(n), !0).forEach(function(t) {
|
|
1474
|
+
We(e, t, n[t]);
|
|
1475
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : He(Object(n)).forEach(function(t) {
|
|
1476
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
return e;
|
|
1480
|
+
}
|
|
1481
|
+
function We(e, t, n) {
|
|
1482
|
+
return (t = Ge(t)) in e ? Object.defineProperty(e, t, {
|
|
1483
|
+
value: n,
|
|
1484
|
+
enumerable: !0,
|
|
1485
|
+
configurable: !0,
|
|
1486
|
+
writable: !0
|
|
1487
|
+
}) : e[t] = n, e;
|
|
1488
|
+
}
|
|
1489
|
+
function Ge(e) {
|
|
1490
|
+
var t = Ke(e, "string");
|
|
1491
|
+
return G(t) == "symbol" ? t : t + "";
|
|
1492
|
+
}
|
|
1493
|
+
function Ke(e, t) {
|
|
1494
|
+
if (G(e) != "object" || !e) return e;
|
|
1495
|
+
var n = e[Symbol.toPrimitive];
|
|
1496
|
+
if (n !== void 0) {
|
|
1497
|
+
var r = n.call(e, t || "default");
|
|
1498
|
+
if (G(r) != "object") return r;
|
|
1499
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
1500
|
+
}
|
|
1501
|
+
return (t === "string" ? String : Number)(e);
|
|
1502
|
+
}
|
|
1503
|
+
function G(e) {
|
|
1504
|
+
"@babel/helpers - typeof";
|
|
1505
|
+
return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1506
|
+
return typeof e;
|
|
1507
|
+
} : function(e) {
|
|
1508
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1509
|
+
}, G(e);
|
|
1510
|
+
}
|
|
1511
|
+
var K = typeof fetch == "function" ? fetch : void 0;
|
|
1512
|
+
typeof global < "u" && global.fetch ? K = global.fetch : typeof window < "u" && window.fetch && (K = window.fetch);
|
|
1513
|
+
var q;
|
|
1514
|
+
ze() && (typeof global < "u" && global.XMLHttpRequest ? q = global.XMLHttpRequest : typeof window < "u" && window.XMLHttpRequest && (q = window.XMLHttpRequest));
|
|
1515
|
+
var J;
|
|
1516
|
+
if (typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObject ? J = global.ActiveXObject : typeof window < "u" && window.ActiveXObject && (J = window.ActiveXObject)), typeof K != "function" && (K = void 0), !K && !q && !J) try {
|
|
1517
|
+
import("./browser-ponyfill-B4Qc6yfW.js").then((t) => /* @__PURE__ */ e(t.default, 1)).then(function(e) {
|
|
1518
|
+
K = e.default;
|
|
1519
|
+
}).catch(function() {});
|
|
1520
|
+
} catch {}
|
|
1521
|
+
var Y = function(e, t) {
|
|
1522
|
+
if (t && G(t) === "object") {
|
|
1523
|
+
var n = "";
|
|
1524
|
+
for (var r in t) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t[r]);
|
|
1525
|
+
if (!n) return e;
|
|
1526
|
+
e = e + (e.indexOf("?") === -1 ? "?" : "&") + n.slice(1);
|
|
1527
|
+
}
|
|
1528
|
+
return e;
|
|
1529
|
+
}, qe = function(e, t, n, r) {
|
|
1530
|
+
var i = function(e) {
|
|
1531
|
+
if (!e.ok) return n(e.statusText || "Error", { status: e.status });
|
|
1532
|
+
e.text().then(function(t) {
|
|
1533
|
+
n(null, {
|
|
1534
|
+
status: e.status,
|
|
1535
|
+
data: t
|
|
1536
|
+
});
|
|
1537
|
+
}).catch(n);
|
|
1538
|
+
};
|
|
1539
|
+
if (r) {
|
|
1540
|
+
var a = r(e, t);
|
|
1541
|
+
if (a instanceof Promise) {
|
|
1542
|
+
a.then(i).catch(n);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
typeof fetch == "function" ? fetch(e, t).then(i).catch(n) : K(e, t).then(i).catch(n);
|
|
1547
|
+
}, Je = !1, Ye = function(e, t, n, r) {
|
|
1548
|
+
e.queryStringParams && (t = Y(t, e.queryStringParams));
|
|
1549
|
+
var i = Ue({}, typeof e.customHeaders == "function" ? e.customHeaders() : e.customHeaders);
|
|
1550
|
+
typeof window > "u" && typeof global < "u" && global.process !== void 0 && global.process.versions && global.process.versions.node && (i["User-Agent"] = `i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`), n && (i["Content-Type"] = "application/json");
|
|
1551
|
+
var a = typeof e.requestOptions == "function" ? e.requestOptions(n) : e.requestOptions, o = Ue({
|
|
1552
|
+
method: n ? "POST" : "GET",
|
|
1553
|
+
body: n ? e.stringify(n) : void 0,
|
|
1554
|
+
headers: i
|
|
1555
|
+
}, Je ? {} : a), s = typeof e.alternateFetch == "function" && e.alternateFetch.length >= 1 ? e.alternateFetch : void 0;
|
|
1556
|
+
try {
|
|
1557
|
+
qe(t, o, r, s);
|
|
1558
|
+
} catch (e) {
|
|
1559
|
+
if (!a || Object.keys(a).length === 0 || !e.message || e.message.indexOf("not implemented") < 0) return r(e);
|
|
1560
|
+
try {
|
|
1561
|
+
Object.keys(a).forEach(function(e) {
|
|
1562
|
+
delete o[e];
|
|
1563
|
+
}), qe(t, o, r, s), Je = !0;
|
|
1564
|
+
} catch (e) {
|
|
1565
|
+
r(e);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}, Xe = function(e, t, n, r) {
|
|
1569
|
+
n && G(n) === "object" && (n = Y("", n).slice(1)), e.queryStringParams && (t = Y(t, e.queryStringParams));
|
|
1570
|
+
try {
|
|
1571
|
+
var i = q ? new q() : new J("MSXML2.XMLHTTP.3.0");
|
|
1572
|
+
i.open(n ? "POST" : "GET", t, 1), e.crossDomain || i.setRequestHeader("X-Requested-With", "XMLHttpRequest"), i.withCredentials = !!e.withCredentials, n && i.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), i.overrideMimeType && i.overrideMimeType("application/json");
|
|
1573
|
+
var a = e.customHeaders;
|
|
1574
|
+
if (a = typeof a == "function" ? a() : a, a) for (var o in a) i.setRequestHeader(o, a[o]);
|
|
1575
|
+
i.onreadystatechange = function() {
|
|
1576
|
+
i.readyState > 3 && r(i.status >= 400 ? i.statusText : null, {
|
|
1577
|
+
status: i.status,
|
|
1578
|
+
data: i.responseText
|
|
1579
|
+
});
|
|
1580
|
+
}, i.send(n);
|
|
1581
|
+
} catch (e) {
|
|
1582
|
+
console && console.log(e);
|
|
1583
|
+
}
|
|
1584
|
+
}, Ze = function(e, t, n, r) {
|
|
1585
|
+
if (typeof n == "function" && (r = n, n = void 0), r ||= function() {}, K && t.indexOf("file:") !== 0) return Ye(e, t, n, r);
|
|
1586
|
+
if (ze() || typeof ActiveXObject == "function") return Xe(e, t, n, r);
|
|
1587
|
+
r(/* @__PURE__ */ Error("No fetch and no xhr implementation found!"));
|
|
1588
|
+
};
|
|
1589
|
+
//#endregion
|
|
1590
|
+
//#region ../../node_modules/.pnpm/i18next-http-backend@3.0.2/node_modules/i18next-http-backend/esm/index.js
|
|
1591
|
+
function X(e) {
|
|
1592
|
+
"@babel/helpers - typeof";
|
|
1593
|
+
return X = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1594
|
+
return typeof e;
|
|
1595
|
+
} : function(e) {
|
|
1596
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1597
|
+
}, X(e);
|
|
1598
|
+
}
|
|
1599
|
+
function Qe(e, t) {
|
|
1600
|
+
var n = Object.keys(e);
|
|
1601
|
+
if (Object.getOwnPropertySymbols) {
|
|
1602
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
1603
|
+
t && (r = r.filter(function(t) {
|
|
1604
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
1605
|
+
})), n.push.apply(n, r);
|
|
1606
|
+
}
|
|
1607
|
+
return n;
|
|
1608
|
+
}
|
|
1609
|
+
function Z(e) {
|
|
1610
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1611
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
1612
|
+
t % 2 ? Qe(Object(n), !0).forEach(function(t) {
|
|
1613
|
+
nt(e, t, n[t]);
|
|
1614
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Qe(Object(n)).forEach(function(t) {
|
|
1615
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
return e;
|
|
1619
|
+
}
|
|
1620
|
+
function $e(e, t) {
|
|
1621
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
1622
|
+
}
|
|
1623
|
+
function et(e, t) {
|
|
1624
|
+
for (var n = 0; n < t.length; n++) {
|
|
1625
|
+
var r = t[n];
|
|
1626
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, Q(r.key), r);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
function tt(e, t, n) {
|
|
1630
|
+
return t && et(e.prototype, t), n && et(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1631
|
+
}
|
|
1632
|
+
function nt(e, t, n) {
|
|
1633
|
+
return (t = Q(t)) in e ? Object.defineProperty(e, t, {
|
|
1634
|
+
value: n,
|
|
1635
|
+
enumerable: !0,
|
|
1636
|
+
configurable: !0,
|
|
1637
|
+
writable: !0
|
|
1638
|
+
}) : e[t] = n, e;
|
|
1639
|
+
}
|
|
1640
|
+
function Q(e) {
|
|
1641
|
+
var t = rt(e, "string");
|
|
1642
|
+
return X(t) == "symbol" ? t : t + "";
|
|
1643
|
+
}
|
|
1644
|
+
function rt(e, t) {
|
|
1645
|
+
if (X(e) != "object" || !e) return e;
|
|
1646
|
+
var n = e[Symbol.toPrimitive];
|
|
1647
|
+
if (n !== void 0) {
|
|
1648
|
+
var r = n.call(e, t || "default");
|
|
1649
|
+
if (X(r) != "object") return r;
|
|
1650
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
1651
|
+
}
|
|
1652
|
+
return (t === "string" ? String : Number)(e);
|
|
1653
|
+
}
|
|
1654
|
+
var it = function() {
|
|
1655
|
+
return {
|
|
1656
|
+
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
1657
|
+
addPath: "/locales/add/{{lng}}/{{ns}}",
|
|
1658
|
+
parse: function(e) {
|
|
1659
|
+
return JSON.parse(e);
|
|
1660
|
+
},
|
|
1661
|
+
stringify: JSON.stringify,
|
|
1662
|
+
parsePayload: function(e, t, n) {
|
|
1663
|
+
return nt({}, t, n || "");
|
|
1664
|
+
},
|
|
1665
|
+
parseLoadPayload: function(e, t) {},
|
|
1666
|
+
request: Ze,
|
|
1667
|
+
reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
|
|
1668
|
+
customHeaders: {},
|
|
1669
|
+
queryStringParams: {},
|
|
1670
|
+
crossDomain: !1,
|
|
1671
|
+
withCredentials: !1,
|
|
1672
|
+
overrideMimeType: !1,
|
|
1673
|
+
requestOptions: {
|
|
1674
|
+
mode: "cors",
|
|
1675
|
+
credentials: "same-origin",
|
|
1676
|
+
cache: "default"
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
}, at = function() {
|
|
1680
|
+
function e(t) {
|
|
1681
|
+
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1682
|
+
$e(this, e), this.services = t, this.options = n, this.allOptions = r, this.type = "backend", this.init(t, n, r);
|
|
1683
|
+
}
|
|
1684
|
+
return tt(e, [
|
|
1685
|
+
{
|
|
1686
|
+
key: "init",
|
|
1687
|
+
value: function(e) {
|
|
1688
|
+
var t = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1689
|
+
if (this.services = e, this.options = Z(Z(Z({}, it()), this.options || {}), n), this.allOptions = r, this.services && this.options.reloadInterval) {
|
|
1690
|
+
var i = setInterval(function() {
|
|
1691
|
+
return t.reload();
|
|
1692
|
+
}, this.options.reloadInterval);
|
|
1693
|
+
X(i) === "object" && typeof i.unref == "function" && i.unref();
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
key: "readMulti",
|
|
1699
|
+
value: function(e, t, n) {
|
|
1700
|
+
this._readAny(e, e, t, t, n);
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
key: "read",
|
|
1705
|
+
value: function(e, t, n) {
|
|
1706
|
+
this._readAny([e], e, [t], t, n);
|
|
1707
|
+
}
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
key: "_readAny",
|
|
1711
|
+
value: function(e, t, n, r, i) {
|
|
1712
|
+
var a = this, o = this.options.loadPath;
|
|
1713
|
+
typeof this.options.loadPath == "function" && (o = this.options.loadPath(e, n)), o = Ve(o), o.then(function(o) {
|
|
1714
|
+
if (!o) return i(null, {});
|
|
1715
|
+
var s = a.services.interpolator.interpolate(o, {
|
|
1716
|
+
lng: e.join("+"),
|
|
1717
|
+
ns: n.join("+")
|
|
1718
|
+
});
|
|
1719
|
+
a.loadUrl(s, i, t, r);
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
key: "loadUrl",
|
|
1725
|
+
value: function(e, t, n, r) {
|
|
1726
|
+
var i = this, a = typeof n == "string" ? [n] : n, o = typeof r == "string" ? [r] : r, s = this.options.parseLoadPayload(a, o);
|
|
1727
|
+
this.options.request(this.options, e, s, function(a, o) {
|
|
1728
|
+
if (o && (o.status >= 500 && o.status < 600 || !o.status)) return t("failed loading " + e + "; status code: " + o.status, !0);
|
|
1729
|
+
if (o && o.status >= 400 && o.status < 500) return t("failed loading " + e + "; status code: " + o.status, !1);
|
|
1730
|
+
if (!o && a && a.message) {
|
|
1731
|
+
var s = a.message.toLowerCase();
|
|
1732
|
+
if ([
|
|
1733
|
+
"failed",
|
|
1734
|
+
"fetch",
|
|
1735
|
+
"network",
|
|
1736
|
+
"load"
|
|
1737
|
+
].find(function(e) {
|
|
1738
|
+
return s.indexOf(e) > -1;
|
|
1739
|
+
})) return t("failed loading " + e + ": " + a.message, !0);
|
|
1740
|
+
}
|
|
1741
|
+
if (a) return t(a, !1);
|
|
1742
|
+
var c, l;
|
|
1743
|
+
try {
|
|
1744
|
+
c = typeof o.data == "string" ? i.options.parse(o.data, n, r) : o.data;
|
|
1745
|
+
} catch {
|
|
1746
|
+
l = "failed parsing " + e + " to json";
|
|
1747
|
+
}
|
|
1748
|
+
if (l) return t(l, !1);
|
|
1749
|
+
t(null, c);
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
key: "create",
|
|
1755
|
+
value: function(e, t, n, r, i) {
|
|
1756
|
+
var a = this;
|
|
1757
|
+
if (this.options.addPath) {
|
|
1758
|
+
typeof e == "string" && (e = [e]);
|
|
1759
|
+
var o = this.options.parsePayload(t, n, r), s = 0, c = [], l = [];
|
|
1760
|
+
e.forEach(function(n) {
|
|
1761
|
+
var r = a.options.addPath;
|
|
1762
|
+
typeof a.options.addPath == "function" && (r = a.options.addPath(n, t));
|
|
1763
|
+
var u = a.services.interpolator.interpolate(r, {
|
|
1764
|
+
lng: n,
|
|
1765
|
+
ns: t
|
|
1766
|
+
});
|
|
1767
|
+
a.options.request(a.options, u, o, function(t, n) {
|
|
1768
|
+
s += 1, c.push(t), l.push(n), s === e.length && typeof i == "function" && i(c, l);
|
|
1769
|
+
});
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
key: "reload",
|
|
1776
|
+
value: function() {
|
|
1777
|
+
var e = this, t = this.services, n = t.backendConnector, r = t.languageUtils, i = t.logger, a = n.language;
|
|
1778
|
+
if (!(a && a.toLowerCase() === "cimode")) {
|
|
1779
|
+
var o = [], s = function(e) {
|
|
1780
|
+
r.toResolveHierarchy(e).forEach(function(e) {
|
|
1781
|
+
o.indexOf(e) < 0 && o.push(e);
|
|
1782
|
+
});
|
|
1783
|
+
};
|
|
1784
|
+
s(a), this.allOptions.preload && this.allOptions.preload.forEach(function(e) {
|
|
1785
|
+
return s(e);
|
|
1786
|
+
}), o.forEach(function(t) {
|
|
1787
|
+
e.allOptions.ns.forEach(function(e) {
|
|
1788
|
+
n.read(t, e, "read", null, null, function(r, a) {
|
|
1789
|
+
r && i.warn(`loading namespace ${e} for language ${t} failed`, r), !r && a && i.log(`loaded namespace ${e} for language ${t}`, a), n.loaded(`${t}|${e}`, r, a);
|
|
1790
|
+
});
|
|
1791
|
+
});
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
]);
|
|
1797
|
+
}();
|
|
1798
|
+
at.type = "backend";
|
|
1799
|
+
//#endregion
|
|
1800
|
+
//#region src/i18n/setup.ts
|
|
1801
|
+
var ot = /* @__PURE__ */ "en.en-DG.es.es-ES.sr.sr-Latn.fr.pt-BR.pt.bn.zh.hi.id.ms.tr.vi.ht.it.de.nl.tl-PH.pl.hu.ro.hmn.so.ca.af-ZA.ar.ar-EG.ar-AE.zh-CN.zh-TW.zh-HANT.cs-CZ.da-DK.fi-FI.fr-CA.el-GR.he.ja.ja-JP.ko-KP.nb-NO.fa-IR.pt-PT.ru-RU.sr-YU.es-419.es-MX.sv-SE.th-TH.uk-UA.am.az.bs.my.ceb.cs.et.ka.el.jv.kk.km.ko.ky.lo.lv.lt.mk.mn.ne.ru.sk.sl.sw.tl.th.uk.ur.uz.hr".split("."), st = (e) => {
|
|
1802
|
+
let t = e.replace(/([A-Z])/g, " $1");
|
|
1803
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
1804
|
+
}, ct = (e) => {
|
|
1805
|
+
let t = e.split("."), n = t[t.length - 1];
|
|
1806
|
+
return st(n || "missing key");
|
|
1807
|
+
}, lt = new Le();
|
|
1808
|
+
lt.addDetector({
|
|
1809
|
+
name: "navigatorOnlyLanguage",
|
|
1810
|
+
lookup() {
|
|
1811
|
+
if (typeof navigator > "u") return "en";
|
|
1812
|
+
let e = navigator.language;
|
|
1813
|
+
return ot.includes(e) ? e : e.split("-")[0];
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
var ut = "https://api.i18nexus.com/project_resources/translations/{{lng}}/{{ns}}.json?api_key=cg41dUINoxdp8BaHDQLJhA";
|
|
1817
|
+
function dt(e, t) {
|
|
1818
|
+
for (let [n, r] of Object.entries(t)) r && e.addResourceBundle(n, "default", r, !0, !0);
|
|
1819
|
+
}
|
|
1820
|
+
function ft(e = {}) {
|
|
1821
|
+
let { lang: t, translations: n } = e, r = R.createInstance();
|
|
1822
|
+
return r.use(at).use(lt).init({
|
|
1823
|
+
lng: t,
|
|
1824
|
+
fallbackLng: "en",
|
|
1825
|
+
supportedLngs: ot,
|
|
1826
|
+
ns: ["default"],
|
|
1827
|
+
defaultNS: "default",
|
|
1828
|
+
partialBundledLanguages: !0,
|
|
1829
|
+
keySeparator: ".",
|
|
1830
|
+
interpolation: { escapeValue: !1 },
|
|
1831
|
+
backend: { loadPath: ut },
|
|
1832
|
+
detection: {
|
|
1833
|
+
order: [
|
|
1834
|
+
"querystring",
|
|
1835
|
+
"cookie",
|
|
1836
|
+
"localStorage",
|
|
1837
|
+
"sessionStorage",
|
|
1838
|
+
"navigatorOnlyLanguage",
|
|
1839
|
+
"htmlTag",
|
|
1840
|
+
"path",
|
|
1841
|
+
"subdomain"
|
|
1842
|
+
],
|
|
1843
|
+
lookupQuerystring: "lang"
|
|
1844
|
+
},
|
|
1845
|
+
initImmediate: !1,
|
|
1846
|
+
parseMissingKeyHandler: ct
|
|
1847
|
+
}), n && (dt(r, n), r.on("loaded", () => {
|
|
1848
|
+
dt(r, n);
|
|
1849
|
+
})), r;
|
|
1850
|
+
}
|
|
1851
|
+
//#endregion
|
|
1852
|
+
//#region src/i18n/instance.ts
|
|
1853
|
+
var $ = null;
|
|
1854
|
+
function pt(e) {
|
|
1855
|
+
$ = e;
|
|
1856
|
+
}
|
|
1857
|
+
function mt() {
|
|
1858
|
+
return $ ||= ft(), $;
|
|
1859
|
+
}
|
|
1860
|
+
//#endregion
|
|
1861
|
+
//#region src/shared/icons/arrowIcon.tsx
|
|
1862
|
+
var ht = ({ class: e }) => /* @__PURE__ */ o("svg", {
|
|
1863
|
+
width: "13",
|
|
1864
|
+
height: "14",
|
|
1865
|
+
viewBox: "0 0 13 14",
|
|
1866
|
+
fill: "none",
|
|
1867
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1868
|
+
"aria-hidden": "true",
|
|
1869
|
+
class: e,
|
|
1870
|
+
children: /* @__PURE__ */ o("path", {
|
|
1871
|
+
d: "M0 8.08009V5.92009H9.198L4.698 1.87009L6.228 0.340088L12.6 6.28009V7.70209L6.228 13.6601L4.698 12.1301L9.198 8.08009H0Z",
|
|
1872
|
+
fill: "currentColor"
|
|
1873
|
+
})
|
|
1874
|
+
});
|
|
1875
|
+
//#endregion
|
|
1876
|
+
//#region src/i18n/useTranslation.ts
|
|
1877
|
+
function gt() {
|
|
1878
|
+
let e = mt(), [, t] = a(0), [r, o] = a(e.isInitialized);
|
|
1879
|
+
return n(() => {
|
|
1880
|
+
let n = () => {
|
|
1881
|
+
t((e) => e + 1);
|
|
1882
|
+
}, r = () => {
|
|
1883
|
+
o(!0), t((e) => e + 1);
|
|
1884
|
+
};
|
|
1885
|
+
return e.on("languageChanged", n), e.on("initialized", r), e.on("loaded", n), () => {
|
|
1886
|
+
e.off("languageChanged", n), e.off("initialized", r), e.off("loaded", n);
|
|
1887
|
+
};
|
|
1888
|
+
}, [e]), {
|
|
1889
|
+
t: i(() => e.t.bind(e), [e]),
|
|
1890
|
+
ready: r,
|
|
1891
|
+
i18n: e
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
//#endregion
|
|
1895
|
+
//#region src/i18n/Trans.tsx
|
|
1896
|
+
var _t = ({ i18nKey: e, boldClass: n = "IncodeTransBold", arrowClass: i = "IncodeTransArrow", components: a, defaultValue: s }) => {
|
|
1897
|
+
let { t: c } = gt(), l = s ? c(e, { defaultValue: s }) : c(e), u = "<strong>|<\\/strong>|<br\\s*\\/?>|<arrow\\s*\\/>", d = a ? Object.keys(a).map((e) => `<${e}>|<\\/${e}>`).join("|") : "", f = d ? `${u}|${d}` : u, p = l.split(RegExp(`(${f})`, "g")), m = !1, h = null;
|
|
1898
|
+
return /* @__PURE__ */ o(t, { children: p.map((e, s) => {
|
|
1899
|
+
if (e === "<strong>") return m = !0, null;
|
|
1900
|
+
if (e === "</strong>") return m = !1, null;
|
|
1901
|
+
if (/^<br\s*\/?>$/.test(e)) return /* @__PURE__ */ o("br", {}, s);
|
|
1902
|
+
if (/^<arrow\s*\/>$/.test(e)) return /* @__PURE__ */ o(ht, { class: i }, s);
|
|
1903
|
+
if (a) {
|
|
1904
|
+
let t = e.match(/^<(\w+)>$/);
|
|
1905
|
+
if (t && a[t[1]]) return h = t[1], null;
|
|
1906
|
+
let n = e.match(/^<\/(\w+)>$/);
|
|
1907
|
+
if (n && a[n[1]]) return h = null, null;
|
|
1908
|
+
}
|
|
1909
|
+
return e ? h && a ? r(a[h], { key: s }, e) : m ? /* @__PURE__ */ o("span", {
|
|
1910
|
+
class: n,
|
|
1911
|
+
children: e
|
|
1912
|
+
}, s) : /* @__PURE__ */ o(t, { children: e }, s) : null;
|
|
1913
|
+
}) });
|
|
1914
|
+
};
|
|
1915
|
+
//#endregion
|
|
1916
|
+
export { ft as i, gt as n, pt as r, _t as t };
|