@incodetech/web 2.0.0-rc.0 → 2.0.0

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