@incodetech/web 0.0.0-dev-20260403-eccc51c → 0.0.0-dev-20260407-4677d7f

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