@ledgerhq/lumen-ui-react 0.1.62 → 0.1.64

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 (179) hide show
  1. package/ai-rules/RULES.md +1 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +80 -78
  5. package/dist/lib/Components/core/AddressInput/AddressInput.js +1 -1
  6. package/dist/lib/Components/core/AmountDisplay/AmountDisplay.js +1 -1
  7. package/dist/lib/Components/core/AmountInput/AmountInput.js +22 -22
  8. package/dist/lib/Components/core/Avatar/Avatar.js +7 -7
  9. package/dist/lib/Components/core/AvatarButton/AvatarButton.js +8 -8
  10. package/dist/lib/Components/core/Banner/Banner.js +1 -1
  11. package/dist/lib/Components/core/Button/Button.js +6 -6
  12. package/dist/lib/Components/core/Card/Card.js +17 -17
  13. package/dist/lib/Components/core/ContentBanner/ContentBanner.d.ts +1 -1
  14. package/dist/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
  15. package/dist/lib/Components/core/DataTable/DataTable.js +45 -45
  16. package/dist/lib/Components/core/Dialog/DialogHeader/DialogHeader.js +1 -1
  17. package/dist/lib/Components/core/Divider/Divider.js +4 -4
  18. package/dist/lib/Components/core/DotCount/DotCount.js +3 -3
  19. package/dist/lib/Components/core/DotIcon/DotIcon.js +4 -4
  20. package/dist/lib/Components/core/DotSymbol/DotSymbol.js +18 -18
  21. package/dist/lib/Components/core/Link/Link.d.ts.map +1 -1
  22. package/dist/lib/Components/core/Link/Link.js +25 -24
  23. package/dist/lib/Components/core/ListItem/ListItem.d.ts +1 -1
  24. package/dist/lib/Components/core/ListItem/ListItem.js +4 -4
  25. package/dist/lib/Components/core/MediaBanner/MediaBanner.js +16 -16
  26. package/dist/lib/Components/core/MediaButton/MediaButton.js +2 -2
  27. package/dist/lib/Components/core/MediaCard/MediaCard.js +1 -1
  28. package/dist/lib/Components/core/MediaImage/MediaImage.js +5 -5
  29. package/dist/lib/Components/core/Menu/Menu.js +25 -25
  30. package/dist/lib/Components/core/NavBar/CoinCapsule.js +4 -4
  31. package/dist/lib/Components/core/NavBar/NavBar.js +3 -3
  32. package/dist/lib/Components/core/PageIndicator/PageIndicator.js +5 -5
  33. package/dist/lib/Components/core/Pagination/Pagination.js +15 -15
  34. package/dist/lib/Components/core/Popover/Popover.js +13 -13
  35. package/dist/lib/Components/core/SearchInput/SearchInput.js +5 -5
  36. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  37. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +78 -82
  38. package/dist/lib/Components/core/Select/Select.d.ts.map +1 -1
  39. package/dist/lib/Components/core/Select/Select.js +105 -104
  40. package/dist/lib/Components/core/SideBar/SideBar.js +28 -28
  41. package/dist/lib/Components/core/Spinner/Spinner.js +5 -5
  42. package/dist/lib/Components/core/Spot/Spot.d.ts +7 -25
  43. package/dist/lib/Components/core/Spot/Spot.d.ts.map +1 -1
  44. package/dist/lib/Components/core/Spot/Spot.js +33 -102
  45. package/dist/lib/Components/core/Spot/SpotNumber.d.ts +16 -0
  46. package/dist/lib/Components/core/Spot/SpotNumber.d.ts.map +1 -0
  47. package/dist/lib/Components/core/Spot/SpotNumber.js +46 -0
  48. package/dist/lib/Components/core/Spot/index.d.ts +1 -0
  49. package/dist/lib/Components/core/Spot/index.d.ts.map +1 -1
  50. package/dist/lib/Components/core/Spot/styles.d.ts +14 -0
  51. package/dist/lib/Components/core/Spot/styles.d.ts.map +1 -0
  52. package/dist/lib/Components/core/Spot/styles.js +275 -0
  53. package/dist/lib/Components/core/Spot/types.d.ts +27 -38
  54. package/dist/lib/Components/core/Spot/types.d.ts.map +1 -1
  55. package/dist/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
  56. package/dist/lib/Components/core/Stepper/Stepper.js +51 -48
  57. package/dist/lib/Components/core/Subheader/Subheader.d.ts.map +1 -1
  58. package/dist/lib/Components/core/Subheader/Subheader.js +33 -29
  59. package/dist/lib/Components/core/Switch/Switch.js +5 -5
  60. package/dist/lib/Components/core/Table/Table.d.ts.map +1 -1
  61. package/dist/lib/Components/core/Table/Table.js +64 -63
  62. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.js +6 -6
  63. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts +1 -1
  64. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts.map +1 -1
  65. package/dist/lib/Components/core/Tile/Tile.d.ts +2 -2
  66. package/dist/lib/Components/core/TileButton/TileButton.js +8 -8
  67. package/dist/lib/Components/core/Timeline/Timeline.js +16 -16
  68. package/dist/lib/Components/core/Toast/Toast.js +4 -4
  69. package/dist/lib/Components/core/Toast/Toaster.js +9 -9
  70. package/dist/lib/Components/core/Trend/Trend.js +3 -3
  71. package/dist/lib/Components/internal/BaseButton/BaseButton.js +9 -9
  72. package/dist/lib/Components/internal/BaseInput/BaseInput.js +21 -21
  73. package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.js +4 -4
  74. package/dist/lib/Components/internal/BaseTag/BaseTag.js +4 -4
  75. package/dist/lib/Components/symbols/Icon/Icon.js +4 -4
  76. package/dist/lib/Components/symbols/Icon/createIcon.js +5 -5
  77. package/dist/lib/Components/symbols/icons/AiBubble.d.ts +29 -0
  78. package/dist/lib/Components/symbols/icons/AiBubble.d.ts.map +1 -0
  79. package/dist/lib/Components/symbols/icons/AiBubble.js +30 -0
  80. package/dist/lib/Components/symbols/icons/ArrowBottomLeft.d.ts +29 -0
  81. package/dist/lib/Components/symbols/icons/ArrowBottomLeft.d.ts.map +1 -0
  82. package/dist/lib/Components/symbols/icons/ArrowBottomLeft.js +27 -0
  83. package/dist/lib/Components/symbols/icons/Bug.js +3 -3
  84. package/dist/lib/Components/symbols/icons/Hourglass.d.ts +29 -0
  85. package/dist/lib/Components/symbols/icons/Hourglass.d.ts.map +1 -0
  86. package/dist/lib/Components/symbols/icons/Hourglass.js +27 -0
  87. package/dist/lib/Components/symbols/icons/Repeat.d.ts +29 -0
  88. package/dist/lib/Components/symbols/icons/Repeat.d.ts.map +1 -0
  89. package/dist/lib/Components/symbols/icons/Repeat.js +27 -0
  90. package/dist/lib/Components/symbols/icons/Robot.d.ts +29 -0
  91. package/dist/lib/Components/symbols/icons/Robot.d.ts.map +1 -0
  92. package/dist/lib/Components/symbols/icons/Robot.js +29 -0
  93. package/dist/lib/Components/symbols/icons/Switch.d.ts.map +1 -1
  94. package/dist/lib/Components/symbols/icons/Switch.js +24 -12
  95. package/dist/lib/Components/symbols/icons/Wifi.d.ts +29 -0
  96. package/dist/lib/Components/symbols/icons/Wifi.d.ts.map +1 -0
  97. package/dist/lib/Components/symbols/icons/Wifi.js +36 -0
  98. package/dist/lib/Components/symbols/index.d.ts +6 -0
  99. package/dist/lib/Components/symbols/index.d.ts.map +1 -1
  100. package/dist/lib/Components/symbols/index.js +610 -598
  101. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -1
  102. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.js +36 -35
  103. package/dist/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
  104. package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -1
  105. package/dist/lib/Components/visualization/DonutChart/DonutChart.js +31 -31
  106. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +4 -4
  107. package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -1
  108. package/dist/lib/Components/visualization/DonutChart/DonutRing.js +13 -12
  109. package/dist/lib/Components/visualization/DonutChart/donutSizeContext.js +2 -2
  110. package/dist/lib/Components/visualization/DonutChart/types.d.ts +1 -1
  111. package/dist/lib/Components/visualization/Legend/Legend.d.ts +1 -1
  112. package/dist/lib/Components/visualization/Legend/Legend.d.ts.map +1 -1
  113. package/dist/lib/Components/visualization/Legend/Legend.js +7 -11
  114. package/dist/lib/Components/visualization/Legend/types.d.ts +2 -2
  115. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts +1 -1
  116. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -1
  117. package/dist/lib/Components/visualization/LineChart/LineChart.js +90 -84
  118. package/dist/lib/Components/visualization/LineChart/types.d.ts +1 -1
  119. package/dist/lib/Components/visualization/LineChart/utils.d.ts +2 -1
  120. package/dist/lib/Components/visualization/LineChart/utils.d.ts.map +1 -1
  121. package/dist/lib/Components/visualization/LineChart/utils.js +23 -22
  122. package/dist/lib/Components/visualization/config.d.ts +0 -3
  123. package/dist/lib/Components/visualization/config.d.ts.map +1 -1
  124. package/dist/lib/Components/visualization/config.js +3 -6
  125. package/dist/libs/utils-shared/dist/index.js +191 -143
  126. package/dist/package.json +4 -6
  127. package/dist/translations/index.d.ts +3 -0
  128. package/dist/translations/index.d.ts.map +1 -0
  129. package/dist/{i18n → translations}/languages.d.ts +0 -5
  130. package/dist/translations/languages.d.ts.map +1 -0
  131. package/dist/{i18n → translations}/languages.js +1 -2
  132. package/dist/{i18n → translations}/locales/en.json.d.ts +11 -0
  133. package/dist/{i18n → translations}/locales/en.json.js +2 -2
  134. package/dist/translations/translations.d.ts +727 -0
  135. package/dist/translations/translations.d.ts.map +1 -0
  136. package/dist/translations/translations.js +22 -0
  137. package/package.json +4 -6
  138. package/dist/_virtual/dynamic-import-helper.js +0 -9
  139. package/dist/i18n/I18nProvider.d.ts +0 -8
  140. package/dist/i18n/I18nProvider.d.ts.map +0 -1
  141. package/dist/i18n/I18nProvider.js +0 -14
  142. package/dist/i18n/i18n.d.ts +0 -12
  143. package/dist/i18n/i18n.d.ts.map +0 -1
  144. package/dist/i18n/i18n.js +0 -42
  145. package/dist/i18n/index.d.ts +0 -4
  146. package/dist/i18n/index.d.ts.map +0 -1
  147. package/dist/i18n/languages.d.ts.map +0 -1
  148. package/dist/i18n/useCommonTranslation.d.ts +0 -2
  149. package/dist/i18n/useCommonTranslation.d.ts.map +0 -1
  150. package/dist/i18n/useCommonTranslation.js +0 -6
  151. package/dist/node_modules/i18next/dist/esm/i18next.js +0 -1479
  152. package/dist/node_modules/react-i18next/dist/es/I18nextProvider.js +0 -19
  153. package/dist/node_modules/react-i18next/dist/es/context.js +0 -17
  154. package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
  155. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -8
  156. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -11
  157. package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -25
  158. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -65
  159. package/dist/node_modules/react-i18next/dist/es/utils.js +0 -57
  160. /package/dist/{i18n → translations}/locales/de.json.d.ts +0 -0
  161. /package/dist/{i18n → translations}/locales/de.json.js +0 -0
  162. /package/dist/{i18n → translations}/locales/es.json.d.ts +0 -0
  163. /package/dist/{i18n → translations}/locales/es.json.js +0 -0
  164. /package/dist/{i18n → translations}/locales/fr.json.d.ts +0 -0
  165. /package/dist/{i18n → translations}/locales/fr.json.js +0 -0
  166. /package/dist/{i18n → translations}/locales/ja.json.d.ts +0 -0
  167. /package/dist/{i18n → translations}/locales/ja.json.js +0 -0
  168. /package/dist/{i18n → translations}/locales/ko.json.d.ts +0 -0
  169. /package/dist/{i18n → translations}/locales/ko.json.js +0 -0
  170. /package/dist/{i18n → translations}/locales/pt.json.d.ts +0 -0
  171. /package/dist/{i18n → translations}/locales/pt.json.js +0 -0
  172. /package/dist/{i18n → translations}/locales/ru.json.d.ts +0 -0
  173. /package/dist/{i18n → translations}/locales/ru.json.js +0 -0
  174. /package/dist/{i18n → translations}/locales/th.json.d.ts +0 -0
  175. /package/dist/{i18n → translations}/locales/th.json.js +0 -0
  176. /package/dist/{i18n → translations}/locales/tr.json.d.ts +0 -0
  177. /package/dist/{i18n → translations}/locales/tr.json.js +0 -0
  178. /package/dist/{i18n → translations}/locales/zh.json.d.ts +0 -0
  179. /package/dist/{i18n → translations}/locales/zh.json.js +0 -0
@@ -1,1479 +0,0 @@
1
- const d = (n) => typeof n == "string", I = () => {
2
- let n, e;
3
- const t = new Promise((s, i) => {
4
- n = s, e = i;
5
- });
6
- return t.resolve = n, t.reject = e, t;
7
- }, X = (n) => n == null ? "" : "" + n, ge = (n, e, t) => {
8
- n.forEach((s) => {
9
- e[s] && (t[s] = e[s]);
10
- });
11
- }, ce = /###/g, q = (n) => n && n.indexOf("###") > -1 ? n.replace(ce, ".") : n, _ = (n) => !n || d(n), A = (n, e, t) => {
12
- const s = d(e) ? e.split(".") : e;
13
- let i = 0;
14
- for (; i < s.length - 1; ) {
15
- if (_(n)) return {};
16
- const r = q(s[i]);
17
- !n[r] && t && (n[r] = new t()), Object.prototype.hasOwnProperty.call(n, r) ? n = n[r] : n = {}, ++i;
18
- }
19
- return _(n) ? {} : {
20
- obj: n,
21
- k: q(s[i])
22
- };
23
- }, ee = (n, e, t) => {
24
- const {
25
- obj: s,
26
- k: i
27
- } = A(n, e, Object);
28
- if (s !== void 0 || e.length === 1) {
29
- s[i] = t;
30
- return;
31
- }
32
- let r = e[e.length - 1], a = e.slice(0, e.length - 1), o = A(n, a, Object);
33
- for (; o.obj === void 0 && a.length; )
34
- r = `${a[a.length - 1]}.${r}`, a = a.slice(0, a.length - 1), o = A(n, a, Object), o && o.obj && typeof o.obj[`${o.k}.${r}`] < "u" && (o.obj = void 0);
35
- o.obj[`${o.k}.${r}`] = t;
36
- }, de = (n, e, t, s) => {
37
- const {
38
- obj: i,
39
- k: r
40
- } = A(n, e, Object);
41
- i[r] = i[r] || [], i[r].push(t);
42
- }, U = (n, e) => {
43
- const {
44
- obj: t,
45
- k: s
46
- } = A(n, e);
47
- if (t)
48
- return t[s];
49
- }, pe = (n, e, t) => {
50
- const s = U(n, t);
51
- return s !== void 0 ? s : U(e, t);
52
- }, le = (n, e, t) => {
53
- for (const s in e)
54
- s !== "__proto__" && s !== "constructor" && (s in n ? d(n[s]) || n[s] instanceof String || d(e[s]) || e[s] instanceof String ? t && (n[s] = e[s]) : le(n[s], e[s], t) : n[s] = e[s]);
55
- return n;
56
- }, R = (n) => n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
57
- var me = {
58
- "&": "&amp;",
59
- "<": "&lt;",
60
- ">": "&gt;",
61
- '"': "&quot;",
62
- "'": "&#39;",
63
- "/": "&#x2F;"
64
- };
65
- const xe = (n) => d(n) ? n.replace(/[&<>"'\/]/g, (e) => me[e]) : n;
66
- class be {
67
- constructor(e) {
68
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
69
- }
70
- getRegExp(e) {
71
- const t = this.regExpMap.get(e);
72
- if (t !== void 0)
73
- return t;
74
- const s = new RegExp(e);
75
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
76
- }
77
- }
78
- const ye = [" ", ",", "?", "!", ";"], Se = new be(20), Oe = (n, e, t) => {
79
- e = e || "", t = t || "";
80
- const s = ye.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
81
- if (s.length === 0) return !0;
82
- const i = Se.getRegExp(`(${s.map((a) => a === "?" ? "\\?" : a).join("|")})`);
83
- let r = !i.test(n);
84
- if (!r) {
85
- const a = n.indexOf(t);
86
- a > 0 && !i.test(n.substring(0, a)) && (r = !0);
87
- }
88
- return r;
89
- }, Q = function(n, e) {
90
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
91
- if (!n) return;
92
- if (n[e]) return n[e];
93
- const s = e.split(t);
94
- let i = n;
95
- for (let r = 0; r < s.length; ) {
96
- if (!i || typeof i != "object")
97
- return;
98
- let a, o = "";
99
- for (let l = r; l < s.length; ++l)
100
- if (l !== r && (o += t), o += s[l], a = i[o], a !== void 0) {
101
- if (["string", "number", "boolean"].indexOf(typeof a) > -1 && l < s.length - 1)
102
- continue;
103
- r += l - r + 1;
104
- break;
105
- }
106
- i = a;
107
- }
108
- return i;
109
- }, M = (n) => n && n.replace("_", "-"), Le = {
110
- type: "logger",
111
- log(n) {
112
- this.output("log", n);
113
- },
114
- warn(n) {
115
- this.output("warn", n);
116
- },
117
- error(n) {
118
- this.output("error", n);
119
- },
120
- output(n, e) {
121
- console && console[n] && console[n].apply(console, e);
122
- }
123
- };
124
- class H {
125
- constructor(e) {
126
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
127
- this.init(e, t);
128
- }
129
- init(e) {
130
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
131
- this.prefix = t.prefix || "i18next:", this.logger = e || Le, this.options = t, this.debug = t.debug;
132
- }
133
- log() {
134
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
135
- t[s] = arguments[s];
136
- return this.forward(t, "log", "", !0);
137
- }
138
- warn() {
139
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
140
- t[s] = arguments[s];
141
- return this.forward(t, "warn", "", !0);
142
- }
143
- error() {
144
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
145
- t[s] = arguments[s];
146
- return this.forward(t, "error", "");
147
- }
148
- deprecate() {
149
- for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
150
- t[s] = arguments[s];
151
- return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
152
- }
153
- forward(e, t, s, i) {
154
- return i && !this.debug ? null : (d(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
155
- }
156
- create(e) {
157
- return new H(this.logger, {
158
- prefix: `${this.prefix}:${e}:`,
159
- ...this.options
160
- });
161
- }
162
- clone(e) {
163
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new H(this.logger, e);
164
- }
165
- }
166
- var C = new H();
167
- class J {
168
- constructor() {
169
- this.observers = {};
170
- }
171
- on(e, t) {
172
- return e.split(" ").forEach((s) => {
173
- this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
174
- const i = this.observers[s].get(t) || 0;
175
- this.observers[s].set(t, i + 1);
176
- }), this;
177
- }
178
- off(e, t) {
179
- if (this.observers[e]) {
180
- if (!t) {
181
- delete this.observers[e];
182
- return;
183
- }
184
- this.observers[e].delete(t);
185
- }
186
- }
187
- emit(e) {
188
- for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
189
- s[i - 1] = arguments[i];
190
- this.observers[e] && Array.from(this.observers[e].entries()).forEach((a) => {
191
- let [o, l] = a;
192
- for (let f = 0; f < l; f++)
193
- o(...s);
194
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((a) => {
195
- let [o, l] = a;
196
- for (let f = 0; f < l; f++)
197
- o.apply(o, [e, ...s]);
198
- });
199
- }
200
- }
201
- class te extends J {
202
- constructor(e) {
203
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
204
- ns: ["translation"],
205
- defaultNS: "translation"
206
- };
207
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
208
- }
209
- addNamespaces(e) {
210
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
211
- }
212
- removeNamespaces(e) {
213
- const t = this.options.ns.indexOf(e);
214
- t > -1 && this.options.ns.splice(t, 1);
215
- }
216
- getResource(e, t, s) {
217
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
218
- const r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, a = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
219
- let o;
220
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : d(s) && r ? o.push(...s.split(r)) : o.push(s)));
221
- const l = U(this.data, o);
222
- return !l && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), l || !a || !d(s) ? l : Q(this.data && this.data[e] && this.data[e][t], s, r);
223
- }
224
- addResource(e, t, s, i) {
225
- let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
226
- silent: !1
227
- };
228
- const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
229
- let o = [e, t];
230
- s && (o = o.concat(a ? s.split(a) : s)), e.indexOf(".") > -1 && (o = e.split("."), i = t, t = o[1]), this.addNamespaces(t), ee(this.data, o, i), r.silent || this.emit("added", e, t, s, i);
231
- }
232
- addResources(e, t, s) {
233
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
234
- silent: !1
235
- };
236
- for (const r in s)
237
- (d(s[r]) || Array.isArray(s[r])) && this.addResource(e, t, r, s[r], {
238
- silent: !0
239
- });
240
- i.silent || this.emit("added", e, t, s);
241
- }
242
- addResourceBundle(e, t, s, i, r) {
243
- let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
244
- silent: !1,
245
- skipCopy: !1
246
- }, o = [e, t];
247
- e.indexOf(".") > -1 && (o = e.split("."), i = s, s = t, t = o[1]), this.addNamespaces(t);
248
- let l = U(this.data, o) || {};
249
- a.skipCopy || (s = JSON.parse(JSON.stringify(s))), i ? le(l, s, r) : l = {
250
- ...l,
251
- ...s
252
- }, ee(this.data, o, l), a.silent || this.emit("added", e, t, s);
253
- }
254
- removeResourceBundle(e, t) {
255
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
256
- }
257
- hasResourceBundle(e, t) {
258
- return this.getResource(e, t) !== void 0;
259
- }
260
- getResourceBundle(e, t) {
261
- return t || (t = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? {
262
- ...this.getResource(e, t)
263
- } : this.getResource(e, t);
264
- }
265
- getDataByLanguage(e) {
266
- return this.data[e];
267
- }
268
- hasLanguageSomeTranslations(e) {
269
- const t = this.getDataByLanguage(e);
270
- return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
271
- }
272
- toJSON() {
273
- return this.data;
274
- }
275
- }
276
- var ue = {
277
- processors: {},
278
- addPostProcessor(n) {
279
- this.processors[n.name] = n;
280
- },
281
- handle(n, e, t, s, i) {
282
- return n.forEach((r) => {
283
- this.processors[r] && (e = this.processors[r].process(e, t, s, i));
284
- }), e;
285
- }
286
- };
287
- const se = {};
288
- class z extends J {
289
- constructor(e) {
290
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
291
- super(), ge(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = C.create("translator");
292
- }
293
- changeLanguage(e) {
294
- e && (this.language = e);
295
- }
296
- exists(e) {
297
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
298
- interpolation: {}
299
- };
300
- if (e == null)
301
- return !1;
302
- const s = this.resolve(e, t);
303
- return s && s.res !== void 0;
304
- }
305
- extractFromKey(e, t) {
306
- let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
307
- s === void 0 && (s = ":");
308
- const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
309
- let r = t.ns || this.options.defaultNS || [];
310
- const a = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Oe(e, s, i);
311
- if (a && !o) {
312
- const l = e.match(this.interpolator.nestingRegexp);
313
- if (l && l.length > 0)
314
- return {
315
- key: e,
316
- namespaces: d(r) ? [r] : r
317
- };
318
- const f = e.split(s);
319
- (s !== i || s === i && this.options.ns.indexOf(f[0]) > -1) && (r = f.shift()), e = f.join(i);
320
- }
321
- return {
322
- key: e,
323
- namespaces: d(r) ? [r] : r
324
- };
325
- }
326
- translate(e, t, s) {
327
- if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
328
- ...t
329
- }), t || (t = {}), e == null) return "";
330
- Array.isArray(e) || (e = [String(e)]);
331
- const i = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
332
- key: a,
333
- namespaces: o
334
- } = this.extractFromKey(e[e.length - 1], t), l = o[o.length - 1], f = t.lng || this.language, h = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
335
- if (f && f.toLowerCase() === "cimode") {
336
- if (h) {
337
- const b = t.nsSeparator || this.options.nsSeparator;
338
- return i ? {
339
- res: `${l}${b}${a}`,
340
- usedKey: a,
341
- exactUsedKey: a,
342
- usedLng: f,
343
- usedNS: l,
344
- usedParams: this.getUsedParamsDetails(t)
345
- } : `${l}${b}${a}`;
346
- }
347
- return i ? {
348
- res: a,
349
- usedKey: a,
350
- exactUsedKey: a,
351
- usedLng: f,
352
- usedNS: l,
353
- usedParams: this.getUsedParamsDetails(t)
354
- } : a;
355
- }
356
- const g = this.resolve(e, t);
357
- let u = g && g.res;
358
- const c = g && g.usedKey || a, p = g && g.exactUsedKey || a, x = Object.prototype.toString.apply(u), m = ["[object Number]", "[object Function]", "[object RegExp]"], O = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, $ = !d(u) && typeof u != "boolean" && typeof u != "number";
359
- if (y && u && $ && m.indexOf(x) < 0 && !(d(O) && Array.isArray(u))) {
360
- if (!t.returnObjects && !this.options.returnObjects) {
361
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
362
- const b = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(c, u, {
363
- ...t,
364
- ns: o
365
- }) : `key '${a} (${this.language})' returned an object instead of string.`;
366
- return i ? (g.res = b, g.usedParams = this.getUsedParamsDetails(t), g) : b;
367
- }
368
- if (r) {
369
- const b = Array.isArray(u), L = b ? [] : {}, w = b ? p : c;
370
- for (const S in u)
371
- if (Object.prototype.hasOwnProperty.call(u, S)) {
372
- const D = `${w}${r}${S}`;
373
- L[S] = this.translate(D, {
374
- ...t,
375
- joinArrays: !1,
376
- ns: o
377
- }), L[S] === D && (L[S] = u[S]);
378
- }
379
- u = L;
380
- }
381
- } else if (y && d(O) && Array.isArray(u))
382
- u = u.join(O), u && (u = this.extendTranslation(u, e, t, s));
383
- else {
384
- let b = !1, L = !1;
385
- const w = t.count !== void 0 && !d(t.count), S = z.hasDefaultValue(t), D = w ? this.pluralResolver.getSuffix(f, t.count, t) : "", fe = t.ordinal && w ? this.pluralResolver.getSuffix(f, t.count, {
386
- ordinal: !1
387
- }) : "", Y = w && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), k = Y && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${D}`] || t[`defaultValue${fe}`] || t.defaultValue;
388
- !this.isValidLookup(u) && S && (b = !0, u = k), this.isValidLookup(u) || (L = !0, u = a);
389
- const he = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && L ? void 0 : u, E = S && k !== u && this.options.updateMissing;
390
- if (L || b || E) {
391
- if (this.logger.log(E ? "updateKey" : "missingKey", f, l, a, E ? k : u), r) {
392
- const v = this.resolve(a, {
393
- ...t,
394
- keySeparator: !1
395
- });
396
- v && v.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
397
- }
398
- let F = [];
399
- const T = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
400
- if (this.options.saveMissingTo === "fallback" && T && T[0])
401
- for (let v = 0; v < T.length; v++)
402
- F.push(T[v]);
403
- else this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(t.lng || this.language) : F.push(t.lng || this.language);
404
- const G = (v, N, j) => {
405
- const Z = S && j !== u ? j : he;
406
- this.options.missingKeyHandler ? this.options.missingKeyHandler(v, l, N, Z, E, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(v, l, N, Z, E, t), this.emit("missingKey", v, l, N, u);
407
- };
408
- this.options.saveMissing && (this.options.saveMissingPlurals && w ? F.forEach((v) => {
409
- const N = this.pluralResolver.getSuffixes(v, t);
410
- Y && t[`defaultValue${this.options.pluralSeparator}zero`] && N.indexOf(`${this.options.pluralSeparator}zero`) < 0 && N.push(`${this.options.pluralSeparator}zero`), N.forEach((j) => {
411
- G([v], a + j, t[`defaultValue${j}`] || k);
412
- });
413
- }) : G(F, a, k));
414
- }
415
- u = this.extendTranslation(u, e, t, g, s), L && u === a && this.options.appendNamespaceToMissingKey && (u = `${l}:${a}`), (L || b) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? u = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${a}` : a, b ? u : void 0) : u = this.options.parseMissingKeyHandler(u));
416
- }
417
- return i ? (g.res = u, g.usedParams = this.getUsedParamsDetails(t), g) : u;
418
- }
419
- extendTranslation(e, t, s, i, r) {
420
- var a = this;
421
- if (this.i18nFormat && this.i18nFormat.parse)
422
- e = this.i18nFormat.parse(e, {
423
- ...this.options.interpolation.defaultVariables,
424
- ...s
425
- }, s.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
426
- resolved: i
427
- });
428
- else if (!s.skipInterpolation) {
429
- s.interpolation && this.interpolator.init({
430
- ...s,
431
- interpolation: {
432
- ...this.options.interpolation,
433
- ...s.interpolation
434
- }
435
- });
436
- const f = d(e) && (s && s.interpolation && s.interpolation.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
437
- let h;
438
- if (f) {
439
- const u = e.match(this.interpolator.nestingRegexp);
440
- h = u && u.length;
441
- }
442
- let g = s.replace && !d(s.replace) ? s.replace : s;
443
- if (this.options.interpolation.defaultVariables && (g = {
444
- ...this.options.interpolation.defaultVariables,
445
- ...g
446
- }), e = this.interpolator.interpolate(e, g, s.lng || this.language || i.usedLng, s), f) {
447
- const u = e.match(this.interpolator.nestingRegexp), c = u && u.length;
448
- h < c && (s.nest = !1);
449
- }
450
- !s.lng && this.options.compatibilityAPI !== "v1" && i && i.res && (s.lng = this.language || i.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
451
- for (var u = arguments.length, c = new Array(u), p = 0; p < u; p++)
452
- c[p] = arguments[p];
453
- return r && r[0] === c[0] && !s.context ? (a.logger.warn(`It seems you are nesting recursively key: ${c[0]} in key: ${t[0]}`), null) : a.translate(...c, t);
454
- }, s)), s.interpolation && this.interpolator.reset();
455
- }
456
- const o = s.postProcess || this.options.postProcess, l = d(o) ? [o] : o;
457
- return e != null && l && l.length && s.applyPostProcessor !== !1 && (e = ue.handle(l, e, t, this.options && this.options.postProcessPassResolved ? {
458
- i18nResolved: {
459
- ...i,
460
- usedParams: this.getUsedParamsDetails(s)
461
- },
462
- ...s
463
- } : s, this)), e;
464
- }
465
- resolve(e) {
466
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, i, r, a, o;
467
- return d(e) && (e = [e]), e.forEach((l) => {
468
- if (this.isValidLookup(s)) return;
469
- const f = this.extractFromKey(l, t), h = f.key;
470
- i = h;
471
- let g = f.namespaces;
472
- this.options.fallbackNS && (g = g.concat(this.options.fallbackNS));
473
- const u = t.count !== void 0 && !d(t.count), c = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), p = t.context !== void 0 && (d(t.context) || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
474
- g.forEach((m) => {
475
- this.isValidLookup(s) || (o = m, !se[`${x[0]}-${m}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(o) && (se[`${x[0]}-${m}`] = !0, this.logger.warn(`key "${i}" for languages "${x.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!!!")), x.forEach((O) => {
476
- if (this.isValidLookup(s)) return;
477
- a = O;
478
- const y = [h];
479
- if (this.i18nFormat && this.i18nFormat.addLookupKeys)
480
- this.i18nFormat.addLookupKeys(y, h, O, m, t);
481
- else {
482
- let b;
483
- u && (b = this.pluralResolver.getSuffix(O, t.count, t));
484
- const L = `${this.options.pluralSeparator}zero`, w = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
485
- if (u && (y.push(h + b), t.ordinal && b.indexOf(w) === 0 && y.push(h + b.replace(w, this.options.pluralSeparator)), c && y.push(h + L)), p) {
486
- const S = `${h}${this.options.contextSeparator}${t.context}`;
487
- y.push(S), u && (y.push(S + b), t.ordinal && b.indexOf(w) === 0 && y.push(S + b.replace(w, this.options.pluralSeparator)), c && y.push(S + L));
488
- }
489
- }
490
- let $;
491
- for (; $ = y.pop(); )
492
- this.isValidLookup(s) || (r = $, s = this.getResource(O, m, $, t));
493
- }));
494
- });
495
- }), {
496
- res: s,
497
- usedKey: i,
498
- exactUsedKey: r,
499
- usedLng: a,
500
- usedNS: o
501
- };
502
- }
503
- isValidLookup(e) {
504
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
505
- }
506
- getResource(e, t, s) {
507
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
508
- return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, t, s, i) : this.resourceStore.getResource(e, t, s, i);
509
- }
510
- getUsedParamsDetails() {
511
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
512
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !d(e.replace);
513
- let i = s ? e.replace : e;
514
- if (s && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
515
- ...this.options.interpolation.defaultVariables,
516
- ...i
517
- }), !s) {
518
- i = {
519
- ...i
520
- };
521
- for (const r of t)
522
- delete i[r];
523
- }
524
- return i;
525
- }
526
- static hasDefaultValue(e) {
527
- const t = "defaultValue";
528
- for (const s in e)
529
- if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
530
- return !0;
531
- return !1;
532
- }
533
- }
534
- const B = (n) => n.charAt(0).toUpperCase() + n.slice(1);
535
- class ie {
536
- constructor(e) {
537
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = C.create("languageUtils");
538
- }
539
- getScriptPartFromCode(e) {
540
- if (e = M(e), !e || e.indexOf("-") < 0) return null;
541
- const t = e.split("-");
542
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
543
- }
544
- getLanguagePartFromCode(e) {
545
- if (e = M(e), !e || e.indexOf("-") < 0) return e;
546
- const t = e.split("-");
547
- return this.formatLanguageCode(t[0]);
548
- }
549
- formatLanguageCode(e) {
550
- if (d(e) && e.indexOf("-") > -1) {
551
- if (typeof Intl < "u" && typeof Intl.getCanonicalLocales < "u")
552
- try {
553
- let i = Intl.getCanonicalLocales(e)[0];
554
- if (i && this.options.lowerCaseLng && (i = i.toLowerCase()), i) return i;
555
- } catch {
556
- }
557
- const t = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
558
- let s = e.split("-");
559
- return this.options.lowerCaseLng ? s = s.map((i) => i.toLowerCase()) : s.length === 2 ? (s[0] = s[0].toLowerCase(), s[1] = s[1].toUpperCase(), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = B(s[1].toLowerCase()))) : s.length === 3 && (s[0] = s[0].toLowerCase(), s[1].length === 2 && (s[1] = s[1].toUpperCase()), s[0] !== "sgn" && s[2].length === 2 && (s[2] = s[2].toUpperCase()), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = B(s[1].toLowerCase())), t.indexOf(s[2].toLowerCase()) > -1 && (s[2] = B(s[2].toLowerCase()))), s.join("-");
560
- }
561
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
562
- }
563
- isSupportedCode(e) {
564
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
565
- }
566
- getBestMatchFromCodes(e) {
567
- if (!e) return null;
568
- let t;
569
- return e.forEach((s) => {
570
- if (t) return;
571
- const i = this.formatLanguageCode(s);
572
- (!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
573
- }), !t && this.options.supportedLngs && e.forEach((s) => {
574
- if (t) return;
575
- const i = this.getLanguagePartFromCode(s);
576
- if (this.isSupportedCode(i)) return t = i;
577
- t = this.options.supportedLngs.find((r) => {
578
- if (r === i) return r;
579
- if (!(r.indexOf("-") < 0 && i.indexOf("-") < 0) && (r.indexOf("-") > 0 && i.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === i || r.indexOf(i) === 0 && i.length > 1))
580
- return r;
581
- });
582
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
583
- }
584
- getFallbackCodes(e, t) {
585
- if (!e) return [];
586
- if (typeof e == "function" && (e = e(t)), d(e) && (e = [e]), Array.isArray(e)) return e;
587
- if (!t) return e.default || [];
588
- let s = e[t];
589
- return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
590
- }
591
- toResolveHierarchy(e, t) {
592
- const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), i = [], r = (a) => {
593
- a && (this.isSupportedCode(a) ? i.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
594
- };
595
- return d(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && r(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && r(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && r(this.getLanguagePartFromCode(e))) : d(e) && r(this.formatLanguageCode(e)), s.forEach((a) => {
596
- i.indexOf(a) < 0 && r(this.formatLanguageCode(a));
597
- }), i;
598
- }
599
- }
600
- let ve = [{
601
- lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
602
- nr: [1, 2],
603
- fc: 1
604
- }, {
605
- lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
606
- nr: [1, 2],
607
- fc: 2
608
- }, {
609
- lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
610
- nr: [1],
611
- fc: 3
612
- }, {
613
- lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
614
- nr: [1, 2, 5],
615
- fc: 4
616
- }, {
617
- lngs: ["ar"],
618
- nr: [0, 1, 2, 3, 11, 100],
619
- fc: 5
620
- }, {
621
- lngs: ["cs", "sk"],
622
- nr: [1, 2, 5],
623
- fc: 6
624
- }, {
625
- lngs: ["csb", "pl"],
626
- nr: [1, 2, 5],
627
- fc: 7
628
- }, {
629
- lngs: ["cy"],
630
- nr: [1, 2, 3, 8],
631
- fc: 8
632
- }, {
633
- lngs: ["fr"],
634
- nr: [1, 2],
635
- fc: 9
636
- }, {
637
- lngs: ["ga"],
638
- nr: [1, 2, 3, 7, 11],
639
- fc: 10
640
- }, {
641
- lngs: ["gd"],
642
- nr: [1, 2, 3, 20],
643
- fc: 11
644
- }, {
645
- lngs: ["is"],
646
- nr: [1, 2],
647
- fc: 12
648
- }, {
649
- lngs: ["jv"],
650
- nr: [0, 1],
651
- fc: 13
652
- }, {
653
- lngs: ["kw"],
654
- nr: [1, 2, 3, 4],
655
- fc: 14
656
- }, {
657
- lngs: ["lt"],
658
- nr: [1, 2, 10],
659
- fc: 15
660
- }, {
661
- lngs: ["lv"],
662
- nr: [1, 2, 0],
663
- fc: 16
664
- }, {
665
- lngs: ["mk"],
666
- nr: [1, 2],
667
- fc: 17
668
- }, {
669
- lngs: ["mnk"],
670
- nr: [0, 1, 2],
671
- fc: 18
672
- }, {
673
- lngs: ["mt"],
674
- nr: [1, 2, 11, 20],
675
- fc: 19
676
- }, {
677
- lngs: ["or"],
678
- nr: [2, 1],
679
- fc: 2
680
- }, {
681
- lngs: ["ro"],
682
- nr: [1, 2, 20],
683
- fc: 20
684
- }, {
685
- lngs: ["sl"],
686
- nr: [5, 1, 2, 3],
687
- fc: 21
688
- }, {
689
- lngs: ["he", "iw"],
690
- nr: [1, 2, 20, 21],
691
- fc: 22
692
- }], we = {
693
- 1: (n) => +(n > 1),
694
- 2: (n) => +(n != 1),
695
- 3: (n) => 0,
696
- 4: (n) => n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
697
- 5: (n) => n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5,
698
- 6: (n) => n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2,
699
- 7: (n) => n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
700
- 8: (n) => n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3,
701
- 9: (n) => +(n >= 2),
702
- 10: (n) => n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4,
703
- 11: (n) => n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3,
704
- 12: (n) => +(n % 10 != 1 || n % 100 == 11),
705
- 13: (n) => +(n !== 0),
706
- 14: (n) => n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3,
707
- 15: (n) => n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
708
- 16: (n) => n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2,
709
- 17: (n) => n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1,
710
- 18: (n) => n == 0 ? 0 : n == 1 ? 1 : 2,
711
- 19: (n) => n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3,
712
- 20: (n) => n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2,
713
- 21: (n) => n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0,
714
- 22: (n) => n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3
715
- };
716
- const Ce = ["v1", "v2", "v3"], Ne = ["v4"], ne = {
717
- zero: 0,
718
- one: 1,
719
- two: 2,
720
- few: 3,
721
- many: 4,
722
- other: 5
723
- }, Re = () => {
724
- const n = {};
725
- return ve.forEach((e) => {
726
- e.lngs.forEach((t) => {
727
- n[t] = {
728
- numbers: e.nr,
729
- plurals: we[e.fc]
730
- };
731
- });
732
- }), n;
733
- };
734
- class Pe {
735
- constructor(e) {
736
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
737
- this.languageUtils = e, this.options = t, this.logger = C.create("pluralResolver"), (!this.options.compatibilityJSON || Ne.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = Re(), this.pluralRulesCache = {};
738
- }
739
- addRule(e, t) {
740
- this.rules[e] = t;
741
- }
742
- clearCache() {
743
- this.pluralRulesCache = {};
744
- }
745
- getRule(e) {
746
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
747
- if (this.shouldUseIntlApi()) {
748
- const s = M(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", r = JSON.stringify({
749
- cleanedCode: s,
750
- type: i
751
- });
752
- if (r in this.pluralRulesCache)
753
- return this.pluralRulesCache[r];
754
- let a;
755
- try {
756
- a = new Intl.PluralRules(s, {
757
- type: i
758
- });
759
- } catch {
760
- if (!e.match(/-|_/)) return;
761
- const l = this.languageUtils.getLanguagePartFromCode(e);
762
- a = this.getRule(l, t);
763
- }
764
- return this.pluralRulesCache[r] = a, a;
765
- }
766
- return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)];
767
- }
768
- needsPlural(e) {
769
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
770
- const s = this.getRule(e, t);
771
- return this.shouldUseIntlApi() ? s && s.resolvedOptions().pluralCategories.length > 1 : s && s.numbers.length > 1;
772
- }
773
- getPluralFormsOfKey(e, t) {
774
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
775
- return this.getSuffixes(e, s).map((i) => `${t}${i}`);
776
- }
777
- getSuffixes(e) {
778
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
779
- const s = this.getRule(e, t);
780
- return s ? this.shouldUseIntlApi() ? s.resolvedOptions().pluralCategories.sort((i, r) => ne[i] - ne[r]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : s.numbers.map((i) => this.getSuffix(e, i, t)) : [];
781
- }
782
- getSuffix(e, t) {
783
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
784
- const i = this.getRule(e, s);
785
- return i ? this.shouldUseIntlApi() ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : this.getSuffixRetroCompatible(i, t) : (this.logger.warn(`no plural rule found for: ${e}`), "");
786
- }
787
- getSuffixRetroCompatible(e, t) {
788
- const s = e.noAbs ? e.plurals(t) : e.plurals(Math.abs(t));
789
- let i = e.numbers[s];
790
- this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 && (i === 2 ? i = "plural" : i === 1 && (i = ""));
791
- const r = () => this.options.prepend && i.toString() ? this.options.prepend + i.toString() : i.toString();
792
- return this.options.compatibilityJSON === "v1" ? i === 1 ? "" : typeof i == "number" ? `_plural_${i.toString()}` : r() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? r() : this.options.prepend && s.toString() ? this.options.prepend + s.toString() : s.toString();
793
- }
794
- shouldUseIntlApi() {
795
- return !Ce.includes(this.options.compatibilityJSON);
796
- }
797
- }
798
- const re = function(n, e, t) {
799
- let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, r = pe(n, e, t);
800
- return !r && i && d(t) && (r = Q(n, t, s), r === void 0 && (r = Q(e, t, s))), r;
801
- }, W = (n) => n.replace(/\$/g, "$$$$");
802
- class $e {
803
- constructor() {
804
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
805
- this.logger = C.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
806
- }
807
- init() {
808
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
809
- e.interpolation || (e.interpolation = {
810
- escapeValue: !0
811
- });
812
- const {
813
- escape: t,
814
- escapeValue: s,
815
- useRawValueToEscape: i,
816
- prefix: r,
817
- prefixEscaped: a,
818
- suffix: o,
819
- suffixEscaped: l,
820
- formatSeparator: f,
821
- unescapeSuffix: h,
822
- unescapePrefix: g,
823
- nestingPrefix: u,
824
- nestingPrefixEscaped: c,
825
- nestingSuffix: p,
826
- nestingSuffixEscaped: x,
827
- nestingOptionsSeparator: m,
828
- maxReplaces: O,
829
- alwaysFormat: y
830
- } = e.interpolation;
831
- this.escape = t !== void 0 ? t : xe, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = r ? R(r) : a || "{{", this.suffix = o ? R(o) : l || "}}", this.formatSeparator = f || ",", this.unescapePrefix = h ? "" : g || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = u ? R(u) : c || R("$t("), this.nestingSuffix = p ? R(p) : x || R(")"), this.nestingOptionsSeparator = m || ",", this.maxReplaces = O || 1e3, this.alwaysFormat = y !== void 0 ? y : !1, this.resetRegExp();
832
- }
833
- reset() {
834
- this.options && this.init(this.options);
835
- }
836
- resetRegExp() {
837
- const e = (t, s) => t && t.source === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
838
- 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}`);
839
- }
840
- interpolate(e, t, s, i) {
841
- let r, a, o;
842
- const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, f = (c) => {
843
- if (c.indexOf(this.formatSeparator) < 0) {
844
- const O = re(t, l, c, this.options.keySeparator, this.options.ignoreJSONStructure);
845
- return this.alwaysFormat ? this.format(O, void 0, s, {
846
- ...i,
847
- ...t,
848
- interpolationkey: c
849
- }) : O;
850
- }
851
- const p = c.split(this.formatSeparator), x = p.shift().trim(), m = p.join(this.formatSeparator).trim();
852
- return this.format(re(t, l, x, this.options.keySeparator, this.options.ignoreJSONStructure), m, s, {
853
- ...i,
854
- ...t,
855
- interpolationkey: x
856
- });
857
- };
858
- this.resetRegExp();
859
- const h = i && i.missingInterpolationHandler || this.options.missingInterpolationHandler, g = i && i.interpolation && i.interpolation.skipOnVariables !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
860
- return [{
861
- regex: this.regexpUnescape,
862
- safeValue: (c) => W(c)
863
- }, {
864
- regex: this.regexp,
865
- safeValue: (c) => this.escapeValue ? W(this.escape(c)) : W(c)
866
- }].forEach((c) => {
867
- for (o = 0; r = c.regex.exec(e); ) {
868
- const p = r[1].trim();
869
- if (a = f(p), a === void 0)
870
- if (typeof h == "function") {
871
- const m = h(e, r, i);
872
- a = d(m) ? m : "";
873
- } else if (i && Object.prototype.hasOwnProperty.call(i, p))
874
- a = "";
875
- else if (g) {
876
- a = r[0];
877
- continue;
878
- } else
879
- this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), a = "";
880
- else !d(a) && !this.useRawValueToEscape && (a = X(a));
881
- const x = c.safeValue(a);
882
- if (e = e.replace(r[0], x), g ? (c.regex.lastIndex += a.length, c.regex.lastIndex -= r[0].length) : c.regex.lastIndex = 0, o++, o >= this.maxReplaces)
883
- break;
884
- }
885
- }), e;
886
- }
887
- nest(e, t) {
888
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, r, a;
889
- const o = (l, f) => {
890
- const h = this.nestingOptionsSeparator;
891
- if (l.indexOf(h) < 0) return l;
892
- const g = l.split(new RegExp(`${h}[ ]*{`));
893
- let u = `{${g[1]}`;
894
- l = g[0], u = this.interpolate(u, a);
895
- const c = u.match(/'/g), p = u.match(/"/g);
896
- (c && c.length % 2 === 0 && !p || p.length % 2 !== 0) && (u = u.replace(/'/g, '"'));
897
- try {
898
- a = JSON.parse(u), f && (a = {
899
- ...f,
900
- ...a
901
- });
902
- } catch (x) {
903
- return this.logger.warn(`failed parsing options string in nesting for key ${l}`, x), `${l}${h}${u}`;
904
- }
905
- return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, l;
906
- };
907
- for (; i = this.nestingRegexp.exec(e); ) {
908
- let l = [];
909
- a = {
910
- ...s
911
- }, a = a.replace && !d(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
912
- let f = !1;
913
- if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) {
914
- const h = i[1].split(this.formatSeparator).map((g) => g.trim());
915
- i[1] = h.shift(), l = h, f = !0;
916
- }
917
- if (r = t(o.call(this, i[1].trim(), a), a), r && i[0] === e && !d(r)) return r;
918
- d(r) || (r = X(r)), r || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), r = ""), f && (r = l.reduce((h, g) => this.format(h, g, s.lng, {
919
- ...s,
920
- interpolationkey: i[1].trim()
921
- }), r.trim())), e = e.replace(i[0], r), this.regexp.lastIndex = 0;
922
- }
923
- return e;
924
- }
925
- }
926
- const ke = (n) => {
927
- let e = n.toLowerCase().trim();
928
- const t = {};
929
- if (n.indexOf("(") > -1) {
930
- const s = n.split("(");
931
- e = s[0].toLowerCase().trim();
932
- const i = s[1].substring(0, s[1].length - 1);
933
- e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((a) => {
934
- if (a) {
935
- const [o, ...l] = a.split(":"), f = l.join(":").trim().replace(/^'+|'+$/g, ""), h = o.trim();
936
- t[h] || (t[h] = f), f === "false" && (t[h] = !1), f === "true" && (t[h] = !0), isNaN(f) || (t[h] = parseInt(f, 10));
937
- }
938
- });
939
- }
940
- return {
941
- formatName: e,
942
- formatOptions: t
943
- };
944
- }, P = (n) => {
945
- const e = {};
946
- return (t, s, i) => {
947
- let r = i;
948
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (r = {
949
- ...r,
950
- [i.interpolationkey]: void 0
951
- });
952
- const a = s + JSON.stringify(r);
953
- let o = e[a];
954
- return o || (o = n(M(s), i), e[a] = o), o(t);
955
- };
956
- };
957
- class Ee {
958
- constructor() {
959
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
960
- this.logger = C.create("formatter"), this.options = e, this.formats = {
961
- number: P((t, s) => {
962
- const i = new Intl.NumberFormat(t, {
963
- ...s
964
- });
965
- return (r) => i.format(r);
966
- }),
967
- currency: P((t, s) => {
968
- const i = new Intl.NumberFormat(t, {
969
- ...s,
970
- style: "currency"
971
- });
972
- return (r) => i.format(r);
973
- }),
974
- datetime: P((t, s) => {
975
- const i = new Intl.DateTimeFormat(t, {
976
- ...s
977
- });
978
- return (r) => i.format(r);
979
- }),
980
- relativetime: P((t, s) => {
981
- const i = new Intl.RelativeTimeFormat(t, {
982
- ...s
983
- });
984
- return (r) => i.format(r, s.range || "day");
985
- }),
986
- list: P((t, s) => {
987
- const i = new Intl.ListFormat(t, {
988
- ...s
989
- });
990
- return (r) => i.format(r);
991
- })
992
- }, this.init(e);
993
- }
994
- init(e) {
995
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
996
- interpolation: {}
997
- };
998
- this.formatSeparator = t.interpolation.formatSeparator || ",";
999
- }
1000
- add(e, t) {
1001
- this.formats[e.toLowerCase().trim()] = t;
1002
- }
1003
- addCached(e, t) {
1004
- this.formats[e.toLowerCase().trim()] = P(t);
1005
- }
1006
- format(e, t, s) {
1007
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1008
- const r = t.split(this.formatSeparator);
1009
- if (r.length > 1 && r[0].indexOf("(") > 1 && r[0].indexOf(")") < 0 && r.find((o) => o.indexOf(")") > -1)) {
1010
- const o = r.findIndex((l) => l.indexOf(")") > -1);
1011
- r[0] = [r[0], ...r.splice(1, o)].join(this.formatSeparator);
1012
- }
1013
- return r.reduce((o, l) => {
1014
- const {
1015
- formatName: f,
1016
- formatOptions: h
1017
- } = ke(l);
1018
- if (this.formats[f]) {
1019
- let g = o;
1020
- try {
1021
- const u = i && i.formatParams && i.formatParams[i.interpolationkey] || {}, c = u.locale || u.lng || i.locale || i.lng || s;
1022
- g = this.formats[f](o, c, {
1023
- ...h,
1024
- ...i,
1025
- ...u
1026
- });
1027
- } catch (u) {
1028
- this.logger.warn(u);
1029
- }
1030
- return g;
1031
- } else
1032
- this.logger.warn(`there was no format function for ${f}`);
1033
- return o;
1034
- }, e);
1035
- }
1036
- }
1037
- const Fe = (n, e) => {
1038
- n.pending[e] !== void 0 && (delete n.pending[e], n.pendingCount--);
1039
- };
1040
- class je extends J {
1041
- constructor(e, t, s) {
1042
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1043
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = i, this.logger = C.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(s, i.backend, i);
1044
- }
1045
- queueLoad(e, t, s, i) {
1046
- const r = {}, a = {}, o = {}, l = {};
1047
- return e.forEach((f) => {
1048
- let h = !0;
1049
- t.forEach((g) => {
1050
- const u = `${f}|${g}`;
1051
- !s.reload && this.store.hasResourceBundle(f, g) ? this.state[u] = 2 : this.state[u] < 0 || (this.state[u] === 1 ? a[u] === void 0 && (a[u] = !0) : (this.state[u] = 1, h = !1, a[u] === void 0 && (a[u] = !0), r[u] === void 0 && (r[u] = !0), l[g] === void 0 && (l[g] = !0)));
1052
- }), h || (o[f] = !0);
1053
- }), (Object.keys(r).length || Object.keys(a).length) && this.queue.push({
1054
- pending: a,
1055
- pendingCount: Object.keys(a).length,
1056
- loaded: {},
1057
- errors: [],
1058
- callback: i
1059
- }), {
1060
- toLoad: Object.keys(r),
1061
- pending: Object.keys(a),
1062
- toLoadLanguages: Object.keys(o),
1063
- toLoadNamespaces: Object.keys(l)
1064
- };
1065
- }
1066
- loaded(e, t, s) {
1067
- const i = e.split("|"), r = i[0], a = i[1];
1068
- t && this.emit("failedLoading", r, a, t), !t && s && this.store.addResourceBundle(r, a, s, void 0, void 0, {
1069
- skipCopy: !0
1070
- }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
1071
- const o = {};
1072
- this.queue.forEach((l) => {
1073
- de(l.loaded, [r], a), Fe(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((f) => {
1074
- o[f] || (o[f] = {});
1075
- const h = l.loaded[f];
1076
- h.length && h.forEach((g) => {
1077
- o[f][g] === void 0 && (o[f][g] = !0);
1078
- });
1079
- }), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
1080
- }), this.emit("loaded", o), this.queue = this.queue.filter((l) => !l.done);
1081
- }
1082
- read(e, t, s) {
1083
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0;
1084
- if (!e.length) return a(null, {});
1085
- if (this.readingCalls >= this.maxParallelReads) {
1086
- this.waitingReads.push({
1087
- lng: e,
1088
- ns: t,
1089
- fcName: s,
1090
- tried: i,
1091
- wait: r,
1092
- callback: a
1093
- });
1094
- return;
1095
- }
1096
- this.readingCalls++;
1097
- const o = (f, h) => {
1098
- if (this.readingCalls--, this.waitingReads.length > 0) {
1099
- const g = this.waitingReads.shift();
1100
- this.read(g.lng, g.ns, g.fcName, g.tried, g.wait, g.callback);
1101
- }
1102
- if (f && h && i < this.maxRetries) {
1103
- setTimeout(() => {
1104
- this.read.call(this, e, t, s, i + 1, r * 2, a);
1105
- }, r);
1106
- return;
1107
- }
1108
- a(f, h);
1109
- }, l = this.backend[s].bind(this.backend);
1110
- if (l.length === 2) {
1111
- try {
1112
- const f = l(e, t);
1113
- f && typeof f.then == "function" ? f.then((h) => o(null, h)).catch(o) : o(null, f);
1114
- } catch (f) {
1115
- o(f);
1116
- }
1117
- return;
1118
- }
1119
- return l(e, t, o);
1120
- }
1121
- prepareLoading(e, t) {
1122
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0;
1123
- if (!this.backend)
1124
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
1125
- d(e) && (e = this.languageUtils.toResolveHierarchy(e)), d(t) && (t = [t]);
1126
- const r = this.queueLoad(e, t, s, i);
1127
- if (!r.toLoad.length)
1128
- return r.pending.length || i(), null;
1129
- r.toLoad.forEach((a) => {
1130
- this.loadOne(a);
1131
- });
1132
- }
1133
- load(e, t, s) {
1134
- this.prepareLoading(e, t, {}, s);
1135
- }
1136
- reload(e, t, s) {
1137
- this.prepareLoading(e, t, {
1138
- reload: !0
1139
- }, s);
1140
- }
1141
- loadOne(e) {
1142
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1143
- const s = e.split("|"), i = s[0], r = s[1];
1144
- this.read(i, r, "read", void 0, void 0, (a, o) => {
1145
- a && this.logger.warn(`${t}loading namespace ${r} for language ${i} failed`, a), !a && o && this.logger.log(`${t}loaded namespace ${r} for language ${i}`, o), this.loaded(e, a, o);
1146
- });
1147
- }
1148
- saveMissing(e, t, s, i, r) {
1149
- let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1150
- };
1151
- if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(t)) {
1152
- this.logger.warn(`did not save key "${s}" 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!!!");
1153
- return;
1154
- }
1155
- if (!(s == null || s === "")) {
1156
- if (this.backend && this.backend.create) {
1157
- const l = {
1158
- ...a,
1159
- isUpdate: r
1160
- }, f = this.backend.create.bind(this.backend);
1161
- if (f.length < 6)
1162
- try {
1163
- let h;
1164
- f.length === 5 ? h = f(e, t, s, i, l) : h = f(e, t, s, i), h && typeof h.then == "function" ? h.then((g) => o(null, g)).catch(o) : o(null, h);
1165
- } catch (h) {
1166
- o(h);
1167
- }
1168
- else
1169
- f(e, t, s, i, o, l);
1170
- }
1171
- !e || !e[0] || this.store.addResource(e[0], t, s, i);
1172
- }
1173
- }
1174
- }
1175
- const ae = () => ({
1176
- debug: !1,
1177
- initImmediate: !0,
1178
- ns: ["translation"],
1179
- defaultNS: ["translation"],
1180
- fallbackLng: ["dev"],
1181
- fallbackNS: !1,
1182
- supportedLngs: !1,
1183
- nonExplicitSupportedLngs: !1,
1184
- load: "all",
1185
- preload: !1,
1186
- simplifyPluralSuffix: !0,
1187
- keySeparator: ".",
1188
- nsSeparator: ":",
1189
- pluralSeparator: "_",
1190
- contextSeparator: "_",
1191
- partialBundledLanguages: !1,
1192
- saveMissing: !1,
1193
- updateMissing: !1,
1194
- saveMissingTo: "fallback",
1195
- saveMissingPlurals: !0,
1196
- missingKeyHandler: !1,
1197
- missingInterpolationHandler: !1,
1198
- postProcess: !1,
1199
- postProcessPassResolved: !1,
1200
- returnNull: !1,
1201
- returnEmptyString: !0,
1202
- returnObjects: !1,
1203
- joinArrays: !1,
1204
- returnedObjectHandler: !1,
1205
- parseMissingKeyHandler: !1,
1206
- appendNamespaceToMissingKey: !1,
1207
- appendNamespaceToCIMode: !1,
1208
- overloadTranslationOptionHandler: (n) => {
1209
- let e = {};
1210
- if (typeof n[1] == "object" && (e = n[1]), d(n[1]) && (e.defaultValue = n[1]), d(n[2]) && (e.tDescription = n[2]), typeof n[2] == "object" || typeof n[3] == "object") {
1211
- const t = n[3] || n[2];
1212
- Object.keys(t).forEach((s) => {
1213
- e[s] = t[s];
1214
- });
1215
- }
1216
- return e;
1217
- },
1218
- interpolation: {
1219
- escapeValue: !0,
1220
- format: (n) => n,
1221
- prefix: "{{",
1222
- suffix: "}}",
1223
- formatSeparator: ",",
1224
- unescapePrefix: "-",
1225
- nestingPrefix: "$t(",
1226
- nestingSuffix: ")",
1227
- nestingOptionsSeparator: ",",
1228
- maxReplaces: 1e3,
1229
- skipOnVariables: !0
1230
- }
1231
- }), oe = (n) => (d(n.ns) && (n.ns = [n.ns]), d(n.fallbackLng) && (n.fallbackLng = [n.fallbackLng]), d(n.fallbackNS) && (n.fallbackNS = [n.fallbackNS]), n.supportedLngs && n.supportedLngs.indexOf("cimode") < 0 && (n.supportedLngs = n.supportedLngs.concat(["cimode"])), n), K = () => {
1232
- }, Ie = (n) => {
1233
- Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((t) => {
1234
- typeof n[t] == "function" && (n[t] = n[t].bind(n));
1235
- });
1236
- };
1237
- class V extends J {
1238
- constructor() {
1239
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1240
- if (super(), this.options = oe(e), this.services = {}, this.logger = C, this.modules = {
1241
- external: []
1242
- }, Ie(this), t && !this.isInitialized && !e.isClone) {
1243
- if (!this.options.initImmediate)
1244
- return this.init(e, t), this;
1245
- setTimeout(() => {
1246
- this.init(e, t);
1247
- }, 0);
1248
- }
1249
- }
1250
- init() {
1251
- var e = this;
1252
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
1253
- this.isInitializing = !0, typeof t == "function" && (s = t, t = {}), !t.defaultNS && t.defaultNS !== !1 && t.ns && (d(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
1254
- const i = ae();
1255
- this.options = {
1256
- ...i,
1257
- ...this.options,
1258
- ...oe(t)
1259
- }, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = {
1260
- ...i.interpolation,
1261
- ...this.options.interpolation
1262
- }), t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1263
- const r = (h) => h ? typeof h == "function" ? new h() : h : null;
1264
- if (!this.options.isClone) {
1265
- this.modules.logger ? C.init(r(this.modules.logger), this.options) : C.init(null, this.options);
1266
- let h;
1267
- this.modules.formatter ? h = this.modules.formatter : typeof Intl < "u" && (h = Ee);
1268
- const g = new ie(this.options);
1269
- this.store = new te(this.options.resources, this.options);
1270
- const u = this.services;
1271
- u.logger = C, u.resourceStore = this.store, u.languageUtils = g, u.pluralResolver = new Pe(g, {
1272
- prepend: this.options.pluralSeparator,
1273
- compatibilityJSON: this.options.compatibilityJSON,
1274
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1275
- }), h && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (u.formatter = r(h), u.formatter.init(u, this.options), this.options.interpolation.format = u.formatter.format.bind(u.formatter)), u.interpolator = new $e(this.options), u.utils = {
1276
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1277
- }, u.backendConnector = new je(r(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", function(c) {
1278
- for (var p = arguments.length, x = new Array(p > 1 ? p - 1 : 0), m = 1; m < p; m++)
1279
- x[m - 1] = arguments[m];
1280
- e.emit(c, ...x);
1281
- }), this.modules.languageDetector && (u.languageDetector = r(this.modules.languageDetector), u.languageDetector.init && u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = r(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new z(this.services, this.options), this.translator.on("*", function(c) {
1282
- for (var p = arguments.length, x = new Array(p > 1 ? p - 1 : 0), m = 1; m < p; m++)
1283
- x[m - 1] = arguments[m];
1284
- e.emit(c, ...x);
1285
- }), this.modules.external.forEach((c) => {
1286
- c.init && c.init(this);
1287
- });
1288
- }
1289
- if (this.format = this.options.interpolation.format, s || (s = K), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1290
- const h = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1291
- h.length > 0 && h[0] !== "dev" && (this.options.lng = h[0]);
1292
- }
1293
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((h) => {
1294
- this[h] = function() {
1295
- return e.store[h](...arguments);
1296
- };
1297
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((h) => {
1298
- this[h] = function() {
1299
- return e.store[h](...arguments), e;
1300
- };
1301
- });
1302
- const l = I(), f = () => {
1303
- const h = (g, u) => {
1304
- 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), l.resolve(u), s(g, u);
1305
- };
1306
- if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return h(null, this.t.bind(this));
1307
- this.changeLanguage(this.options.lng, h);
1308
- };
1309
- return this.options.resources || !this.options.initImmediate ? f() : setTimeout(f, 0), l;
1310
- }
1311
- loadResources(e) {
1312
- let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : K;
1313
- const i = d(e) ? e : this.language;
1314
- if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1315
- if (i && i.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1316
- const r = [], a = (o) => {
1317
- if (!o || o === "cimode") return;
1318
- this.services.languageUtils.toResolveHierarchy(o).forEach((f) => {
1319
- f !== "cimode" && r.indexOf(f) < 0 && r.push(f);
1320
- });
1321
- };
1322
- i ? a(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => a(l)), this.options.preload && this.options.preload.forEach((o) => a(o)), this.services.backendConnector.load(r, this.options.ns, (o) => {
1323
- !o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(o);
1324
- });
1325
- } else
1326
- s(null);
1327
- }
1328
- reloadResources(e, t, s) {
1329
- const i = I();
1330
- return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = K), this.services.backendConnector.reload(e, t, (r) => {
1331
- i.resolve(), s(r);
1332
- }), i;
1333
- }
1334
- use(e) {
1335
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1336
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1337
- 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" && ue.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1338
- }
1339
- setResolvedLanguage(e) {
1340
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1341
- for (let t = 0; t < this.languages.length; t++) {
1342
- const s = this.languages[t];
1343
- if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1344
- this.resolvedLanguage = s;
1345
- break;
1346
- }
1347
- }
1348
- }
1349
- changeLanguage(e, t) {
1350
- var s = this;
1351
- this.isLanguageChangingTo = e;
1352
- const i = I();
1353
- this.emit("languageChanging", e);
1354
- const r = (l) => {
1355
- this.language = l, this.languages = this.services.languageUtils.toResolveHierarchy(l), this.resolvedLanguage = void 0, this.setResolvedLanguage(l);
1356
- }, a = (l, f) => {
1357
- f ? (r(f), this.translator.changeLanguage(f), this.isLanguageChangingTo = void 0, this.emit("languageChanged", f), this.logger.log("languageChanged", f)) : this.isLanguageChangingTo = void 0, i.resolve(function() {
1358
- return s.t(...arguments);
1359
- }), t && t(l, function() {
1360
- return s.t(...arguments);
1361
- });
1362
- }, o = (l) => {
1363
- !e && !l && this.services.languageDetector && (l = []);
1364
- const f = d(l) ? l : this.services.languageUtils.getBestMatchFromCodes(l);
1365
- f && (this.language || r(f), this.translator.language || this.translator.changeLanguage(f), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(f)), this.loadResources(f, (h) => {
1366
- a(h, f);
1367
- });
1368
- };
1369
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? o(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(o) : this.services.languageDetector.detect(o) : o(e), i;
1370
- }
1371
- getFixedT(e, t, s) {
1372
- var i = this;
1373
- const r = function(a, o) {
1374
- let l;
1375
- if (typeof o != "object") {
1376
- for (var f = arguments.length, h = new Array(f > 2 ? f - 2 : 0), g = 2; g < f; g++)
1377
- h[g - 2] = arguments[g];
1378
- l = i.options.overloadTranslationOptionHandler([a, o].concat(h));
1379
- } else
1380
- l = {
1381
- ...o
1382
- };
1383
- l.lng = l.lng || r.lng, l.lngs = l.lngs || r.lngs, l.ns = l.ns || r.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || s || r.keyPrefix);
1384
- const u = i.options.keySeparator || ".";
1385
- let c;
1386
- return l.keyPrefix && Array.isArray(a) ? c = a.map((p) => `${l.keyPrefix}${u}${p}`) : c = l.keyPrefix ? `${l.keyPrefix}${u}${a}` : a, i.t(c, l);
1387
- };
1388
- return d(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = s, r;
1389
- }
1390
- t() {
1391
- return this.translator && this.translator.translate(...arguments);
1392
- }
1393
- exists() {
1394
- return this.translator && this.translator.exists(...arguments);
1395
- }
1396
- setDefaultNamespace(e) {
1397
- this.options.defaultNS = e;
1398
- }
1399
- hasLoadedNamespace(e) {
1400
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1401
- if (!this.isInitialized)
1402
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1403
- if (!this.languages || !this.languages.length)
1404
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1405
- const s = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
1406
- if (s.toLowerCase() === "cimode") return !0;
1407
- const a = (o, l) => {
1408
- const f = this.services.backendConnector.state[`${o}|${l}`];
1409
- return f === -1 || f === 0 || f === 2;
1410
- };
1411
- if (t.precheck) {
1412
- const o = t.precheck(this, a);
1413
- if (o !== void 0) return o;
1414
- }
1415
- return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(s, e) && (!i || a(r, e)));
1416
- }
1417
- loadNamespaces(e, t) {
1418
- const s = I();
1419
- return this.options.ns ? (d(e) && (e = [e]), e.forEach((i) => {
1420
- this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
1421
- }), this.loadResources((i) => {
1422
- s.resolve(), t && t(i);
1423
- }), s) : (t && t(), Promise.resolve());
1424
- }
1425
- loadLanguages(e, t) {
1426
- const s = I();
1427
- d(e) && (e = [e]);
1428
- const i = this.options.preload || [], r = e.filter((a) => i.indexOf(a) < 0 && this.services.languageUtils.isSupportedCode(a));
1429
- return r.length ? (this.options.preload = i.concat(r), this.loadResources((a) => {
1430
- s.resolve(), t && t(a);
1431
- }), s) : (t && t(), Promise.resolve());
1432
- }
1433
- dir(e) {
1434
- if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1435
- const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], s = this.services && this.services.languageUtils || new ie(ae());
1436
- return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1437
- }
1438
- static createInstance() {
1439
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1440
- return new V(e, t);
1441
- }
1442
- cloneInstance() {
1443
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : K;
1444
- const s = e.forkResourceStore;
1445
- s && delete e.forkResourceStore;
1446
- const i = {
1447
- ...this.options,
1448
- ...e,
1449
- isClone: !0
1450
- }, r = new V(i);
1451
- return (e.debug !== void 0 || e.prefix !== void 0) && (r.logger = r.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
1452
- r[o] = this[o];
1453
- }), r.services = {
1454
- ...this.services
1455
- }, r.services.utils = {
1456
- hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1457
- }, s && (r.store = new te(this.store.data, i), r.services.resourceStore = r.store), r.translator = new z(r.services, i), r.translator.on("*", function(o) {
1458
- for (var l = arguments.length, f = new Array(l > 1 ? l - 1 : 0), h = 1; h < l; h++)
1459
- f[h - 1] = arguments[h];
1460
- r.emit(o, ...f);
1461
- }), r.init(i, t), r.translator.options = i, r.translator.backendConnector.services.utils = {
1462
- hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1463
- }, r;
1464
- }
1465
- toJSON() {
1466
- return {
1467
- options: this.options,
1468
- store: this.store,
1469
- language: this.language,
1470
- languages: this.languages,
1471
- resolvedLanguage: this.resolvedLanguage
1472
- };
1473
- }
1474
- }
1475
- const Ae = V.createInstance();
1476
- Ae.createInstance = V.createInstance;
1477
- export {
1478
- Ae as default
1479
- };