@snmt-react-ui/city-select 2.6.21 → 2.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/city-select.js +357 -351
- package/package.json +3 -3
package/dist/city-select.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var we = Object.defineProperty;
|
|
2
2
|
var ke = (i, e, t) => e in i ? we(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
-
var
|
|
3
|
+
var B1 = (i, e, t) => ke(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import "./index.css";
|
|
5
5
|
import { jsx as r, Fragment as i1, jsxs as C } from "react/jsx-runtime";
|
|
6
6
|
import { SNMTUiContext as Le } from "@snmt-react-ui/core";
|
|
@@ -14,11 +14,11 @@ function Oe() {
|
|
|
14
14
|
n1(e[0]) && (e[0] = `react-i18next:: ${e[0]}`), console.warn(...e);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const D1 = {};
|
|
18
18
|
function S1() {
|
|
19
19
|
for (var i = arguments.length, e = new Array(i), t = 0; t < i; t++)
|
|
20
20
|
e[t] = arguments[t];
|
|
21
|
-
n1(e[0]) &&
|
|
21
|
+
n1(e[0]) && D1[e[0]] || (n1(e[0]) && (D1[e[0]] = /* @__PURE__ */ new Date()), Oe(...e));
|
|
22
22
|
}
|
|
23
23
|
const ae = (i, e) => () => {
|
|
24
24
|
if (i.isInitialized)
|
|
@@ -41,8 +41,8 @@ const ae = (i, e) => () => {
|
|
|
41
41
|
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
42
42
|
const n = e.languages[0], s = e.options ? e.options.fallbackLng : !1, a = e.languages[e.languages.length - 1];
|
|
43
43
|
if (n.toLowerCase() === "cimode") return !0;
|
|
44
|
-
const c = (o,
|
|
45
|
-
const d = e.services.backendConnector.state[`${o}|${
|
|
44
|
+
const c = (o, u) => {
|
|
45
|
+
const d = e.services.backendConnector.state[`${o}|${u}`];
|
|
46
46
|
return d === -1 || d === 2;
|
|
47
47
|
};
|
|
48
48
|
return t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !c(e.isLanguageChangingTo, i) ? !1 : !!(e.hasResourceBundle(n, i) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || c(n, i) && (!s || c(a, i)));
|
|
@@ -75,7 +75,7 @@ const ae = (i, e) => () => {
|
|
|
75
75
|
"…": "…",
|
|
76
76
|
"/": "/",
|
|
77
77
|
"/": "/"
|
|
78
|
-
},
|
|
78
|
+
}, Be = (i) => Ze[i], De = (i) => i.replace(Te, Be);
|
|
79
79
|
let je = {
|
|
80
80
|
bindI18n: "languageChanged",
|
|
81
81
|
bindI18nStore: "",
|
|
@@ -84,7 +84,7 @@ let je = {
|
|
|
84
84
|
transWrapTextNodes: "",
|
|
85
85
|
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
86
86
|
useSuspense: !0,
|
|
87
|
-
unescape:
|
|
87
|
+
unescape: De
|
|
88
88
|
};
|
|
89
89
|
const We = () => je;
|
|
90
90
|
let Ge;
|
|
@@ -124,35 +124,35 @@ const Fe = (i, e) => {
|
|
|
124
124
|
...e
|
|
125
125
|
}, {
|
|
126
126
|
useSuspense: o,
|
|
127
|
-
keyPrefix:
|
|
127
|
+
keyPrefix: u
|
|
128
128
|
} = c;
|
|
129
129
|
let d = i;
|
|
130
130
|
d = n1(d) ? [d] : d || ["translation"], a.reportNamespaces.addUsedNamespaces && a.reportNamespaces.addUsedNamespaces(d);
|
|
131
|
-
const l = (a.isInitialized || a.initializedStoreOnce) && d.every((f) => Ve(f, a, c)), h = Ye(a, e.lng || null, c.nsMode === "fallback" ? d : d[0],
|
|
132
|
-
let
|
|
133
|
-
e.lng && (
|
|
134
|
-
const _ = Fe(
|
|
131
|
+
const l = (a.isInitialized || a.initializedStoreOnce) && d.every((f) => Ve(f, a, c)), h = Ye(a, e.lng || null, c.nsMode === "fallback" ? d : d[0], u), g = () => h, p = () => le(a, e.lng || null, c.nsMode === "fallback" ? d : d[0], u), [w, v] = V(g);
|
|
132
|
+
let m = d.join();
|
|
133
|
+
e.lng && (m = `${e.lng}${m}`);
|
|
134
|
+
const _ = Fe(m), R = Y(!0);
|
|
135
135
|
T(() => {
|
|
136
136
|
const {
|
|
137
137
|
bindI18n: f,
|
|
138
138
|
bindI18nStore: k
|
|
139
139
|
} = c;
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
R.current = !0, !l && !o && (e.lng ? W1(a, e.lng, d, () => {
|
|
141
|
+
R.current && v(p);
|
|
142
142
|
}) : j1(a, d, () => {
|
|
143
|
-
|
|
144
|
-
})), l && _ && _ !==
|
|
143
|
+
R.current && v(p);
|
|
144
|
+
})), l && _ && _ !== m && R.current && v(p);
|
|
145
145
|
const x = () => {
|
|
146
|
-
|
|
146
|
+
R.current && v(p);
|
|
147
147
|
};
|
|
148
148
|
return f && a && a.on(f, x), k && a && a.store.on(k, x), () => {
|
|
149
|
-
|
|
149
|
+
R.current = !1, f && a && f.split(" ").forEach((L) => a.off(L, x)), k && a && k.split(" ").forEach((L) => a.store.off(L, x));
|
|
150
150
|
};
|
|
151
|
-
}, [a,
|
|
152
|
-
|
|
153
|
-
}, [a,
|
|
154
|
-
const H = [
|
|
155
|
-
if (H.t =
|
|
151
|
+
}, [a, m]), T(() => {
|
|
152
|
+
R.current && l && v(g);
|
|
153
|
+
}, [a, u, l]);
|
|
154
|
+
const H = [w, a, l];
|
|
155
|
+
if (H.t = w, H.i18n = a, H.ready = l, l || !l && !o) return H;
|
|
156
156
|
throw new Promise((f) => {
|
|
157
157
|
e.lng ? W1(a, e.lng, d, () => f()) : j1(a, d, () => f());
|
|
158
158
|
});
|
|
@@ -206,7 +206,7 @@ const Je = ({
|
|
|
206
206
|
disabled: s = !1,
|
|
207
207
|
disableUncheck: a = !1
|
|
208
208
|
}) => {
|
|
209
|
-
const [c, o] = V(i), [
|
|
209
|
+
const [c, o] = V(i), [u, d] = V(e);
|
|
210
210
|
T(() => {
|
|
211
211
|
o(i), d(e);
|
|
212
212
|
}, [i, e]);
|
|
@@ -216,7 +216,7 @@ const Je = ({
|
|
|
216
216
|
{
|
|
217
217
|
className: `snmt-checkbox snmt-checkbox-${l}`,
|
|
218
218
|
checked: c,
|
|
219
|
-
indeterminate:
|
|
219
|
+
indeterminate: u,
|
|
220
220
|
onChange: (h) => {
|
|
221
221
|
a && c || (d(!1), o(h.target.checked), n && n(h));
|
|
222
222
|
},
|
|
@@ -793,7 +793,7 @@ const qe = ({
|
|
|
793
793
|
)
|
|
794
794
|
]
|
|
795
795
|
}
|
|
796
|
-
),
|
|
796
|
+
), ut = ({
|
|
797
797
|
width: i = 18,
|
|
798
798
|
height: e = 16,
|
|
799
799
|
color: t = "#001E52",
|
|
@@ -832,7 +832,7 @@ const qe = ({
|
|
|
832
832
|
)
|
|
833
833
|
]
|
|
834
834
|
}
|
|
835
|
-
),
|
|
835
|
+
), gt = ({
|
|
836
836
|
width: i = 20,
|
|
837
837
|
height: e = 20,
|
|
838
838
|
color: t = "#001E52",
|
|
@@ -1668,7 +1668,7 @@ const qe = ({
|
|
|
1668
1668
|
}
|
|
1669
1669
|
)
|
|
1670
1670
|
}
|
|
1671
|
-
),
|
|
1671
|
+
), Bt = ({
|
|
1672
1672
|
className: i,
|
|
1673
1673
|
color: e = y.GREY_DARK_5,
|
|
1674
1674
|
height: t = 24,
|
|
@@ -1727,7 +1727,7 @@ const qe = ({
|
|
|
1727
1727
|
)
|
|
1728
1728
|
]
|
|
1729
1729
|
}
|
|
1730
|
-
),
|
|
1730
|
+
), Dt = ({
|
|
1731
1731
|
className: i,
|
|
1732
1732
|
color: e = y.GREY_DARK_5,
|
|
1733
1733
|
height: t = 24,
|
|
@@ -2697,7 +2697,7 @@ const qe = ({
|
|
|
2697
2697
|
}
|
|
2698
2698
|
)
|
|
2699
2699
|
}
|
|
2700
|
-
),
|
|
2700
|
+
), g1 = ({
|
|
2701
2701
|
name: i,
|
|
2702
2702
|
width: e,
|
|
2703
2703
|
height: t,
|
|
@@ -2706,13 +2706,13 @@ const qe = ({
|
|
|
2706
2706
|
disabled: a = !1,
|
|
2707
2707
|
onClick: c
|
|
2708
2708
|
}) => {
|
|
2709
|
-
const [o,
|
|
2709
|
+
const [o, u] = V(s), { theme: d } = r1(he), l = a ? d && d === "dark" ? y.GREY_LIGHT_4 : y.GREY_DARK_1 : n, h = a ? void 0 : c;
|
|
2710
2710
|
return T(() => {
|
|
2711
2711
|
if (s) {
|
|
2712
|
-
h && !a &&
|
|
2712
|
+
h && !a && u(`${s} clickable`);
|
|
2713
2713
|
return;
|
|
2714
2714
|
}
|
|
2715
|
-
h && !a &&
|
|
2715
|
+
h && !a && u("clickable");
|
|
2716
2716
|
}, [h, s, a]), /* @__PURE__ */ r(i1, { children: (() => {
|
|
2717
2717
|
switch (i) {
|
|
2718
2718
|
case "nextIcon":
|
|
@@ -2762,9 +2762,9 @@ const qe = ({
|
|
|
2762
2762
|
onClick: h
|
|
2763
2763
|
});
|
|
2764
2764
|
case "history":
|
|
2765
|
-
return gt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2766
|
-
case "logOut":
|
|
2767
2765
|
return ut({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2766
|
+
case "logOut":
|
|
2767
|
+
return gt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2768
2768
|
case "settings":
|
|
2769
2769
|
return Ct({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2770
2770
|
case "trash":
|
|
@@ -2844,11 +2844,11 @@ const qe = ({
|
|
|
2844
2844
|
case "telegram":
|
|
2845
2845
|
return Zt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2846
2846
|
case "mail":
|
|
2847
|
-
return
|
|
2847
|
+
return Dt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2848
2848
|
case "github":
|
|
2849
2849
|
return Tt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2850
2850
|
case "linkedIn":
|
|
2851
|
-
return
|
|
2851
|
+
return Bt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2852
2852
|
case "emptyStateIcon":
|
|
2853
2853
|
return jt({ width: e, height: t, color: l, className: o, onClick: h });
|
|
2854
2854
|
case "filtersIcon":
|
|
@@ -2913,7 +2913,7 @@ const qe = ({
|
|
|
2913
2913
|
placement: s,
|
|
2914
2914
|
children: i
|
|
2915
2915
|
}
|
|
2916
|
-
), { Title:
|
|
2916
|
+
), { Title: u2, Text: g2 } = oe, C2 = {
|
|
2917
2917
|
h1: 1,
|
|
2918
2918
|
h2: 2,
|
|
2919
2919
|
h3: 3,
|
|
@@ -2929,28 +2929,31 @@ const qe = ({
|
|
|
2929
2929
|
whiteSpace: c = "normal",
|
|
2930
2930
|
/** This prop allows you to enable tooltip if text size is too big */
|
|
2931
2931
|
trim: o = !1
|
|
2932
|
-
},
|
|
2932
|
+
}, u) => {
|
|
2933
2933
|
const d = Y(null);
|
|
2934
|
-
E1(
|
|
2934
|
+
E1(u, () => d.current);
|
|
2935
2935
|
const [l, h] = V(!1);
|
|
2936
2936
|
T(() => {
|
|
2937
|
+
var m;
|
|
2937
2938
|
if (!o) return;
|
|
2938
|
-
const
|
|
2939
|
+
const _ = () => {
|
|
2939
2940
|
d.current && h(d.current.scrollWidth > d.current.clientWidth);
|
|
2940
|
-
}, _ = new ResizeObserver(w);
|
|
2941
|
-
return d.current && _.observe(d.current), () => {
|
|
2942
|
-
_.disconnect();
|
|
2943
2941
|
};
|
|
2944
|
-
|
|
2945
|
-
|
|
2942
|
+
_();
|
|
2943
|
+
const R = new ResizeObserver(_);
|
|
2944
|
+
return d.current && R.observe(d.current), (m = d.current) != null && m.parentElement && R.observe(d.current.parentElement), () => {
|
|
2945
|
+
R.disconnect();
|
|
2946
|
+
};
|
|
2947
|
+
}, [o]);
|
|
2948
|
+
const g = e === "h1" || e === "h2" || e === "h3" || e === "h4";
|
|
2946
2949
|
let p = `snmt-typography snmt-typography-${e}`;
|
|
2947
2950
|
i && i !== "inherit" && (p += ` snmt-typography-align-${i}`), a && (p += " collapsed"), o && (p += " collapsed");
|
|
2948
|
-
const
|
|
2951
|
+
const w = {
|
|
2949
2952
|
className: p,
|
|
2950
2953
|
style: { color: t, whiteSpace: o ? "nowrap" : c, display: o ? "block" : "" },
|
|
2951
2954
|
onClick: s,
|
|
2952
2955
|
ref: d
|
|
2953
|
-
}, v =
|
|
2956
|
+
}, v = g ? /* @__PURE__ */ r(u2, { level: C2[e], ...w, children: n }) : /* @__PURE__ */ r(g2, { ...w, children: n });
|
|
2954
2957
|
return o && l ? /* @__PURE__ */ r(d2, { placement: "top", title: n, children: v }) : v;
|
|
2955
2958
|
}
|
|
2956
2959
|
);
|
|
@@ -3774,7 +3777,7 @@ const f2 = ({
|
|
|
3774
3777
|
)
|
|
3775
3778
|
]
|
|
3776
3779
|
}
|
|
3777
|
-
),
|
|
3780
|
+
), B2 = ({
|
|
3778
3781
|
width: i = 10,
|
|
3779
3782
|
height: e = 10,
|
|
3780
3783
|
color: t = "#88A4FF",
|
|
@@ -3822,7 +3825,7 @@ const f2 = ({
|
|
|
3822
3825
|
)
|
|
3823
3826
|
]
|
|
3824
3827
|
}
|
|
3825
|
-
),
|
|
3828
|
+
), D2 = ({
|
|
3826
3829
|
width: i = 14,
|
|
3827
3830
|
height: e = 14,
|
|
3828
3831
|
color: t = "#8E8E93",
|
|
@@ -4750,7 +4753,7 @@ const f2 = ({
|
|
|
4750
4753
|
)
|
|
4751
4754
|
]
|
|
4752
4755
|
}
|
|
4753
|
-
),
|
|
4756
|
+
), u5 = ({
|
|
4754
4757
|
className: i,
|
|
4755
4758
|
color: e = E.GREY_DARK_5,
|
|
4756
4759
|
height: t = 24,
|
|
@@ -4789,7 +4792,7 @@ const f2 = ({
|
|
|
4789
4792
|
)
|
|
4790
4793
|
]
|
|
4791
4794
|
}
|
|
4792
|
-
),
|
|
4795
|
+
), g5 = ({
|
|
4793
4796
|
className: i,
|
|
4794
4797
|
color: e = E.GREY_DARK_5,
|
|
4795
4798
|
height: t = 24,
|
|
@@ -5435,13 +5438,13 @@ const f2 = ({
|
|
|
5435
5438
|
disabled: a = !1,
|
|
5436
5439
|
onClick: c
|
|
5437
5440
|
}) => {
|
|
5438
|
-
const [o,
|
|
5441
|
+
const [o, u] = V(s), { theme: d } = r1(ce), l = a ? d && d === "dark" ? E.GREY_LIGHT_4 : E.GREY_DARK_1 : n, h = a ? void 0 : c;
|
|
5439
5442
|
return T(() => {
|
|
5440
5443
|
if (s) {
|
|
5441
|
-
h && !a &&
|
|
5444
|
+
h && !a && u(`${s} clickable`);
|
|
5442
5445
|
return;
|
|
5443
5446
|
}
|
|
5444
|
-
h && !a &&
|
|
5447
|
+
h && !a && u("clickable");
|
|
5445
5448
|
}, [h, s, a]), /* @__PURE__ */ r(i1, { children: (() => {
|
|
5446
5449
|
switch (i) {
|
|
5447
5450
|
case "nextIcon":
|
|
@@ -5505,9 +5508,9 @@ const f2 = ({
|
|
|
5505
5508
|
case "checkCircle":
|
|
5506
5509
|
return Z2({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5507
5510
|
case "errorSmall":
|
|
5508
|
-
return D2({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5509
|
-
case "infoMedium":
|
|
5510
5511
|
return B2({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5512
|
+
case "infoMedium":
|
|
5513
|
+
return D2({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5511
5514
|
case "attentionMedium":
|
|
5512
5515
|
return j2({
|
|
5513
5516
|
width: e,
|
|
@@ -5593,9 +5596,9 @@ const f2 = ({
|
|
|
5593
5596
|
case "bell":
|
|
5594
5597
|
return d5({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5595
5598
|
case "contract":
|
|
5596
|
-
return u5({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5597
|
-
case "trash2":
|
|
5598
5599
|
return g5({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5600
|
+
case "trash2":
|
|
5601
|
+
return u5({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5599
5602
|
case "resourceManager":
|
|
5600
5603
|
return C5({ width: e, height: t, color: l, className: o, onClick: h });
|
|
5601
5604
|
case "settings2":
|
|
@@ -5703,28 +5706,31 @@ const de = ({
|
|
|
5703
5706
|
whiteSpace: c = "normal",
|
|
5704
5707
|
/** This prop allows you to enable tooltip if text size is too big */
|
|
5705
5708
|
trim: o = !1
|
|
5706
|
-
},
|
|
5709
|
+
}, u) => {
|
|
5707
5710
|
const d = Y(null);
|
|
5708
|
-
E1(
|
|
5711
|
+
E1(u, () => d.current);
|
|
5709
5712
|
const [l, h] = V(!1);
|
|
5710
5713
|
T(() => {
|
|
5714
|
+
var m;
|
|
5711
5715
|
if (!o) return;
|
|
5712
|
-
const
|
|
5716
|
+
const _ = () => {
|
|
5713
5717
|
d.current && h(d.current.scrollWidth > d.current.clientWidth);
|
|
5714
|
-
}, _ = new ResizeObserver(w);
|
|
5715
|
-
return d.current && _.observe(d.current), () => {
|
|
5716
|
-
_.disconnect();
|
|
5717
5718
|
};
|
|
5718
|
-
|
|
5719
|
-
|
|
5719
|
+
_();
|
|
5720
|
+
const R = new ResizeObserver(_);
|
|
5721
|
+
return d.current && R.observe(d.current), (m = d.current) != null && m.parentElement && R.observe(d.current.parentElement), () => {
|
|
5722
|
+
R.disconnect();
|
|
5723
|
+
};
|
|
5724
|
+
}, [o]);
|
|
5725
|
+
const g = e === "h1" || e === "h2" || e === "h3" || e === "h4";
|
|
5720
5726
|
let p = `snmt-typography snmt-typography-${e}`;
|
|
5721
5727
|
i && i !== "inherit" && (p += ` snmt-typography-align-${i}`), a && (p += " collapsed"), o && (p += " collapsed");
|
|
5722
|
-
const
|
|
5728
|
+
const w = {
|
|
5723
5729
|
className: p,
|
|
5724
5730
|
style: { color: t, whiteSpace: o ? "nowrap" : c, display: o ? "block" : "" },
|
|
5725
5731
|
onClick: s,
|
|
5726
5732
|
ref: d
|
|
5727
|
-
}, v =
|
|
5733
|
+
}, v = g ? /* @__PURE__ */ r(S5, { level: A5[e], ...w, children: n }) : /* @__PURE__ */ r(V5, { ...w, children: n });
|
|
5728
5734
|
return o && l ? /* @__PURE__ */ r(O5, { placement: "top", title: n, children: v }) : v;
|
|
5729
5735
|
}
|
|
5730
5736
|
), Z5 = ({
|
|
@@ -5745,14 +5751,14 @@ const de = ({
|
|
|
5745
5751
|
trigger: "click",
|
|
5746
5752
|
overlayClassName: `snmt-popover ${a ? "" : "padding"}`,
|
|
5747
5753
|
open: t ?? c,
|
|
5748
|
-
onOpenChange: (
|
|
5749
|
-
o(
|
|
5754
|
+
onOpenChange: (u) => {
|
|
5755
|
+
o(u), n == null || n(u);
|
|
5750
5756
|
},
|
|
5751
5757
|
children: /* @__PURE__ */ r("div", { className: "wrapper", children: i })
|
|
5752
5758
|
}
|
|
5753
5759
|
);
|
|
5754
5760
|
};
|
|
5755
|
-
var
|
|
5761
|
+
var B5 = { exports: {} };
|
|
5756
5762
|
(function(i, e) {
|
|
5757
5763
|
(function(t, n) {
|
|
5758
5764
|
i.exports = n();
|
|
@@ -5762,8 +5768,8 @@ var D5 = { exports: {} };
|
|
|
5762
5768
|
return "[" + t + (n[(s - 20) % 10] || n[s] || n[0]) + "]";
|
|
5763
5769
|
} };
|
|
5764
5770
|
});
|
|
5765
|
-
})(
|
|
5766
|
-
const
|
|
5771
|
+
})(B5);
|
|
5772
|
+
const D5 = ({
|
|
5767
5773
|
values: i,
|
|
5768
5774
|
onTagClose: e,
|
|
5769
5775
|
maxWidth: t,
|
|
@@ -5772,29 +5778,29 @@ const B5 = ({
|
|
|
5772
5778
|
options: a,
|
|
5773
5779
|
extraOptions: c
|
|
5774
5780
|
}) => {
|
|
5775
|
-
const { locale: o } = r1(Z1), { t:
|
|
5781
|
+
const { locale: o } = r1(Z1), { t: u } = Ue("common", { lng: o }), [d, l] = V(!1);
|
|
5776
5782
|
if (T(() => {
|
|
5777
5783
|
i.length || l(!1);
|
|
5778
5784
|
}, [i]), !i.length)
|
|
5779
5785
|
return null;
|
|
5780
|
-
const h = (
|
|
5781
|
-
var p,
|
|
5782
|
-
return ((p = a == null ? void 0 : a.find((v) => v.value ===
|
|
5786
|
+
const h = (g) => {
|
|
5787
|
+
var p, w;
|
|
5788
|
+
return ((p = a == null ? void 0 : a.find((v) => v.value === g)) == null ? void 0 : p.label) || ((w = c == null ? void 0 : c.find((v) => v.value === g)) == null ? void 0 : w.label) || g;
|
|
5783
5789
|
};
|
|
5784
5790
|
return /* @__PURE__ */ C(
|
|
5785
5791
|
Z5,
|
|
5786
5792
|
{
|
|
5787
5793
|
content: (
|
|
5788
5794
|
// 90: paddings + margins + gaps and so on
|
|
5789
|
-
/* @__PURE__ */ r("div", { style: { maxWidth: t - 90 }, className: "snmt-popover-from-select", children: /* @__PURE__ */ r(p1, { gap: 6, flexWrap: "wrap", children: i.map(({ value:
|
|
5795
|
+
/* @__PURE__ */ r("div", { style: { maxWidth: t - 90 }, className: "snmt-popover-from-select", children: /* @__PURE__ */ r(p1, { gap: 6, flexWrap: "wrap", children: i.map(({ value: g }) => /* @__PURE__ */ r(
|
|
5790
5796
|
de,
|
|
5791
5797
|
{
|
|
5792
|
-
onClose: () => e(
|
|
5798
|
+
onClose: () => e(g),
|
|
5793
5799
|
closable: n,
|
|
5794
5800
|
disabled: s,
|
|
5795
|
-
children: h(
|
|
5801
|
+
children: h(g)
|
|
5796
5802
|
},
|
|
5797
|
-
|
|
5803
|
+
g
|
|
5798
5804
|
)) }) })
|
|
5799
5805
|
),
|
|
5800
5806
|
placement: "bottomRight",
|
|
@@ -5803,7 +5809,7 @@ const B5 = ({
|
|
|
5803
5809
|
children: [
|
|
5804
5810
|
i.length,
|
|
5805
5811
|
" ",
|
|
5806
|
-
|
|
5812
|
+
u("more")
|
|
5807
5813
|
]
|
|
5808
5814
|
}
|
|
5809
5815
|
);
|
|
@@ -5825,34 +5831,34 @@ const B5 = ({
|
|
|
5825
5831
|
options: a,
|
|
5826
5832
|
width: c,
|
|
5827
5833
|
disabled: o = !1,
|
|
5828
|
-
required:
|
|
5834
|
+
required: u = !1,
|
|
5829
5835
|
clearable: d = !1,
|
|
5830
5836
|
scrollThresholdValue: l = 50,
|
|
5831
5837
|
onSearchChange: h,
|
|
5832
|
-
onDropdownVisibleChange:
|
|
5838
|
+
onDropdownVisibleChange: g,
|
|
5833
5839
|
onScrollToEnd: p,
|
|
5834
|
-
onPopupScroll:
|
|
5840
|
+
onPopupScroll: w,
|
|
5835
5841
|
id: v,
|
|
5836
|
-
extraOptions:
|
|
5842
|
+
extraOptions: m,
|
|
5837
5843
|
dropdownRender: _,
|
|
5838
|
-
optionRender:
|
|
5844
|
+
optionRender: R,
|
|
5839
5845
|
isLoading: H,
|
|
5840
5846
|
readOnly: f,
|
|
5841
5847
|
error: k
|
|
5842
5848
|
}, x) => {
|
|
5843
|
-
const [L, I] = V(!1), [Z,
|
|
5849
|
+
const [L, I] = V(!1), [Z, D] = V(!1), [G, Q] = V(!0), [O, K] = V(i), U = Y(null);
|
|
5844
5850
|
T(() => {
|
|
5845
5851
|
K(i);
|
|
5846
5852
|
}, [i]);
|
|
5847
5853
|
const q = (N) => {
|
|
5848
|
-
I(N),
|
|
5854
|
+
I(N), g && g(N);
|
|
5849
5855
|
}, X = (N, b) => {
|
|
5850
5856
|
var A;
|
|
5851
5857
|
return !!((A = b == null ? void 0 : b.label) != null && A.toString().toLowerCase().includes(N.toLowerCase()));
|
|
5852
|
-
},
|
|
5853
|
-
|
|
5858
|
+
}, B = () => {
|
|
5859
|
+
D(!0);
|
|
5854
5860
|
}, $ = () => {
|
|
5855
|
-
|
|
5861
|
+
D(!1);
|
|
5856
5862
|
}, P = j(
|
|
5857
5863
|
(N) => {
|
|
5858
5864
|
if (K(N), n) {
|
|
@@ -5878,7 +5884,7 @@ const B5 = ({
|
|
|
5878
5884
|
P(b), K(b);
|
|
5879
5885
|
},
|
|
5880
5886
|
[P, O]
|
|
5881
|
-
),
|
|
5887
|
+
), u1 = j(
|
|
5882
5888
|
(N) => (O == null ? void 0 : O.indexOf(N)) === 0 ? (
|
|
5883
5889
|
// if the search input is empty
|
|
5884
5890
|
// then display the placeholder, else do not display it
|
|
@@ -5889,20 +5895,20 @@ const B5 = ({
|
|
|
5889
5895
|
N.preventDefault(), N.stopPropagation();
|
|
5890
5896
|
}, v1 = async (N) => {
|
|
5891
5897
|
const { target: b } = N;
|
|
5892
|
-
b.scrollTop + b.offsetHeight >= b.scrollHeight - l && (p == null || p(!0)),
|
|
5898
|
+
b.scrollTop + b.offsetHeight >= b.scrollHeight - l && (p == null || p(!0)), w && await w(N);
|
|
5893
5899
|
}, o1 = j(
|
|
5894
5900
|
(N) => {
|
|
5895
5901
|
var b, A;
|
|
5896
|
-
return ((b = a.find((a1) => a1.value === N)) == null ? void 0 : b.label) || ((A =
|
|
5902
|
+
return ((b = a.find((a1) => a1.value === N)) == null ? void 0 : b.label) || ((A = m == null ? void 0 : m.find(
|
|
5897
5903
|
(a1) => a1.value === N
|
|
5898
5904
|
)) == null ? void 0 : A.label) || N;
|
|
5899
5905
|
},
|
|
5900
|
-
[
|
|
5906
|
+
[m, a]
|
|
5901
5907
|
), N1 = j(
|
|
5902
5908
|
(N) => {
|
|
5903
5909
|
var b;
|
|
5904
5910
|
return /* @__PURE__ */ r(
|
|
5905
|
-
|
|
5911
|
+
D5,
|
|
5906
5912
|
{
|
|
5907
5913
|
values: N,
|
|
5908
5914
|
onTagClose: t1,
|
|
@@ -5910,14 +5916,14 @@ const B5 = ({
|
|
|
5910
5916
|
disabled: o,
|
|
5911
5917
|
closable: !f,
|
|
5912
5918
|
options: a,
|
|
5913
|
-
extraOptions:
|
|
5919
|
+
extraOptions: m
|
|
5914
5920
|
}
|
|
5915
5921
|
);
|
|
5916
5922
|
},
|
|
5917
|
-
[o,
|
|
5923
|
+
[o, m, t1, a, f]
|
|
5918
5924
|
), S = j(
|
|
5919
|
-
({ label: N, value: b, mode: A }) => A === "filter" ?
|
|
5920
|
-
[o, o1, t1,
|
|
5925
|
+
({ label: N, value: b, mode: A }) => A === "filter" ? u1(b) : /* @__PURE__ */ r("div", { onMouseDown: L1, className: "tag-wrapper", children: /* @__PURE__ */ r(de, { onClose: () => t1(b), disabled: o, children: typeof N == "object" ? N : o1(b) }) }),
|
|
5926
|
+
[o, o1, t1, u1]
|
|
5921
5927
|
), F = Array.isArray(O) && O.length > 0 || !!O && typeof O == "string" && O.trim() !== "";
|
|
5922
5928
|
return /* @__PURE__ */ C("div", { className: "snmt-select-container", children: [
|
|
5923
5929
|
/* @__PURE__ */ C(
|
|
@@ -5946,7 +5952,7 @@ const B5 = ({
|
|
|
5946
5952
|
},
|
|
5947
5953
|
mode: n === "filter" ? "multiple" : n,
|
|
5948
5954
|
onChange: P,
|
|
5949
|
-
onFocus:
|
|
5955
|
+
onFocus: B,
|
|
5950
5956
|
onBlur: $,
|
|
5951
5957
|
onSearch: (N) => {
|
|
5952
5958
|
Q(!N), h && h(N);
|
|
@@ -5967,7 +5973,7 @@ const B5 = ({
|
|
|
5967
5973
|
cursor: o ? "not-allowed" : "pointer"
|
|
5968
5974
|
},
|
|
5969
5975
|
children: /* @__PURE__ */ r(
|
|
5970
|
-
|
|
5976
|
+
g1,
|
|
5971
5977
|
{
|
|
5972
5978
|
name: "cancel",
|
|
5973
5979
|
color: o ? z.GREY_DARK_1 : z.GREY_DARK_5
|
|
@@ -5976,7 +5982,7 @@ const B5 = ({
|
|
|
5976
5982
|
}
|
|
5977
5983
|
),
|
|
5978
5984
|
/* @__PURE__ */ r(
|
|
5979
|
-
|
|
5985
|
+
g1,
|
|
5980
5986
|
{
|
|
5981
5987
|
name: "selectArrowIcon",
|
|
5982
5988
|
color: o ? z.GREY_DARK_1 : z.GREY_DARK_5,
|
|
@@ -5985,9 +5991,9 @@ const B5 = ({
|
|
|
5985
5991
|
}
|
|
5986
5992
|
)
|
|
5987
5993
|
] }) }),
|
|
5988
|
-
removeIcon: /* @__PURE__ */ r(
|
|
5994
|
+
removeIcon: /* @__PURE__ */ r(g1, { name: "errorSmall", color: z.GREY_DARK_1 }),
|
|
5989
5995
|
options: a,
|
|
5990
|
-
optionRender: (N) =>
|
|
5996
|
+
optionRender: (N) => R ? R(N.data) : /* @__PURE__ */ C(p1, { justifyContent: "space-between", alignItems: "center", flex: "1", children: [
|
|
5991
5997
|
/* @__PURE__ */ C(p1, { alignItems: "center", gap: 12, children: [
|
|
5992
5998
|
n && /* @__PURE__ */ r(
|
|
5993
5999
|
Je,
|
|
@@ -6001,7 +6007,7 @@ const B5 = ({
|
|
|
6001
6007
|
] })
|
|
6002
6008
|
] }),
|
|
6003
6009
|
!n && O === N.value && /* @__PURE__ */ r(
|
|
6004
|
-
|
|
6010
|
+
g1,
|
|
6005
6011
|
{
|
|
6006
6012
|
name: "ok",
|
|
6007
6013
|
color: z.BLUE_PRIMARY,
|
|
@@ -6021,14 +6027,14 @@ const B5 = ({
|
|
|
6021
6027
|
"label",
|
|
6022
6028
|
{
|
|
6023
6029
|
className: `${Z || F ? "label-floating" : ""} ${o ? "label-disabled" : ""} ${Z ? "label-focused" : ""} ${H ? "label-loading" : ""} ${k ? "label-error" : ""}`,
|
|
6024
|
-
children:
|
|
6030
|
+
children: u ? `${t}*` : t
|
|
6025
6031
|
}
|
|
6026
6032
|
),
|
|
6027
6033
|
/* @__PURE__ */ r(
|
|
6028
6034
|
"fieldset",
|
|
6029
6035
|
{
|
|
6030
6036
|
className: `${Z ? "fieldset-focused" : ""} ${o ? "fieldset-disabled" : ""} ${F ? "fieldset-filled" : ""} ${k ? "fieldset-error" : ""}`,
|
|
6031
|
-
children: /* @__PURE__ */ r("legend", { children: /* @__PURE__ */ r("span", { children:
|
|
6037
|
+
children: /* @__PURE__ */ r("legend", { children: /* @__PURE__ */ r("span", { children: u ? `${t}*` : t }) })
|
|
6032
6038
|
}
|
|
6033
6039
|
)
|
|
6034
6040
|
] })
|
|
@@ -6037,7 +6043,7 @@ const B5 = ({
|
|
|
6037
6043
|
),
|
|
6038
6044
|
k && /* @__PURE__ */ C(p1, { justifyContent: "flex-start", gap: 6, children: [
|
|
6039
6045
|
/* @__PURE__ */ r(
|
|
6040
|
-
|
|
6046
|
+
g1,
|
|
6041
6047
|
{
|
|
6042
6048
|
name: "attention",
|
|
6043
6049
|
color: z.NOTIFICATION_ERROR_DARK,
|
|
@@ -6079,21 +6085,21 @@ const H1 = 100, l1 = {
|
|
|
6079
6085
|
disabled: a,
|
|
6080
6086
|
scrollThresholdValue: c,
|
|
6081
6087
|
placeholder: o,
|
|
6082
|
-
mode:
|
|
6088
|
+
mode: u,
|
|
6083
6089
|
loadOnClosedState: d,
|
|
6084
6090
|
preloadOptions: l,
|
|
6085
6091
|
extraOptions: h,
|
|
6086
|
-
onDropdownVisibleChange:
|
|
6092
|
+
onDropdownVisibleChange: g,
|
|
6087
6093
|
optionRender: p,
|
|
6088
|
-
dropdownRender:
|
|
6094
|
+
dropdownRender: w,
|
|
6089
6095
|
readOnly: v,
|
|
6090
|
-
clearable:
|
|
6096
|
+
clearable: m = !1,
|
|
6091
6097
|
required: _ = !1,
|
|
6092
|
-
error:
|
|
6098
|
+
error: R
|
|
6093
6099
|
}, H) => {
|
|
6094
|
-
const [f, k] = V(), [x, L] = V(l1), [I, Z] = V(!1), [
|
|
6100
|
+
const [f, k] = V(), [x, L] = V(l1), [I, Z] = V(!1), [D, G] = V(), [Q, O] = V(!1), [K, U] = V(
|
|
6095
6101
|
h ?? []
|
|
6096
|
-
), q = P1(x.offset), X = P1(
|
|
6102
|
+
), q = P1(x.offset), X = P1(D), [B, $] = V(!1), P = Y(!1), e1 = j(
|
|
6097
6103
|
async ({
|
|
6098
6104
|
limit: S = H1,
|
|
6099
6105
|
offset: F,
|
|
@@ -6121,7 +6127,7 @@ const H1 = 100, l1 = {
|
|
|
6121
6127
|
[i]
|
|
6122
6128
|
), t1 = j5((S) => {
|
|
6123
6129
|
G(S), S || L(l1);
|
|
6124
|
-
}),
|
|
6130
|
+
}), u1 = j(
|
|
6125
6131
|
(S) => t1(S),
|
|
6126
6132
|
[t1]
|
|
6127
6133
|
), L1 = j(
|
|
@@ -6134,13 +6140,13 @@ const H1 = 100, l1 = {
|
|
|
6134
6140
|
[I, f == null ? void 0 : f.length, x.count]
|
|
6135
6141
|
), v1 = j(
|
|
6136
6142
|
(S) => {
|
|
6137
|
-
O(S), !S &&
|
|
6143
|
+
O(S), !S && D && (G(void 0), L(l1), $(!0)), g == null || g(S);
|
|
6138
6144
|
},
|
|
6139
|
-
[
|
|
6145
|
+
[g, D]
|
|
6140
6146
|
);
|
|
6141
6147
|
T(() => {
|
|
6142
|
-
!P.current || I || (
|
|
6143
|
-
}, [
|
|
6148
|
+
!P.current || I || (B || Q && (q !== x.offset || X !== D || !f)) && (e1({ offset: x.offset, limit: H1, search: D }), B && $(!1));
|
|
6149
|
+
}, [B, Q, x.offset, D, q, X, f, I]), T(() => {
|
|
6144
6150
|
(d || l) && e1(l1), P.current = !0;
|
|
6145
6151
|
}, []), T(() => {
|
|
6146
6152
|
h && U((S) => {
|
|
@@ -6154,7 +6160,7 @@ const H1 = 100, l1 = {
|
|
|
6154
6160
|
(S) => {
|
|
6155
6161
|
t && t(S);
|
|
6156
6162
|
let F = [];
|
|
6157
|
-
if (
|
|
6163
|
+
if (u ? F = Array.isArray(S) ? S : [] : F = S ? [S] : [], D) {
|
|
6158
6164
|
const N = F.filter(
|
|
6159
6165
|
(b) => !(K != null && K.some((A) => A.value === b))
|
|
6160
6166
|
);
|
|
@@ -6170,7 +6176,7 @@ const H1 = 100, l1 = {
|
|
|
6170
6176
|
]), G(void 0), L(l1), $(!0);
|
|
6171
6177
|
}
|
|
6172
6178
|
},
|
|
6173
|
-
[t,
|
|
6179
|
+
[t, D, u, f, K]
|
|
6174
6180
|
), N1 = ve(
|
|
6175
6181
|
() => ({
|
|
6176
6182
|
id: s,
|
|
@@ -6181,7 +6187,7 @@ const H1 = 100, l1 = {
|
|
|
6181
6187
|
placeholder: o,
|
|
6182
6188
|
search: !0,
|
|
6183
6189
|
value: n,
|
|
6184
|
-
onSearchChange:
|
|
6190
|
+
onSearchChange: u1,
|
|
6185
6191
|
onDropdownVisibleChange: v1,
|
|
6186
6192
|
scrollThresholdValue: c,
|
|
6187
6193
|
onScrollToEnd: L1,
|
|
@@ -6189,11 +6195,11 @@ const H1 = 100, l1 = {
|
|
|
6189
6195
|
extraOptions: K,
|
|
6190
6196
|
isLoading: I,
|
|
6191
6197
|
optionRender: p,
|
|
6192
|
-
dropdownRender:
|
|
6198
|
+
dropdownRender: w,
|
|
6193
6199
|
readOnly: v,
|
|
6194
|
-
clearable:
|
|
6200
|
+
clearable: m,
|
|
6195
6201
|
required: _,
|
|
6196
|
-
error:
|
|
6202
|
+
error: R
|
|
6197
6203
|
}),
|
|
6198
6204
|
[
|
|
6199
6205
|
s,
|
|
@@ -6203,7 +6209,7 @@ const H1 = 100, l1 = {
|
|
|
6203
6209
|
H,
|
|
6204
6210
|
o,
|
|
6205
6211
|
n,
|
|
6206
|
-
|
|
6212
|
+
u1,
|
|
6207
6213
|
v1,
|
|
6208
6214
|
c,
|
|
6209
6215
|
L1,
|
|
@@ -6211,20 +6217,20 @@ const H1 = 100, l1 = {
|
|
|
6211
6217
|
K,
|
|
6212
6218
|
I,
|
|
6213
6219
|
p,
|
|
6214
|
-
m,
|
|
6215
|
-
v,
|
|
6216
6220
|
w,
|
|
6221
|
+
v,
|
|
6222
|
+
m,
|
|
6217
6223
|
_,
|
|
6218
|
-
|
|
6224
|
+
R
|
|
6219
6225
|
]
|
|
6220
6226
|
);
|
|
6221
6227
|
return E1(H, () => ({
|
|
6222
6228
|
refetchOptions: async () => {
|
|
6223
6229
|
L(l1), G(void 0), $(!0);
|
|
6224
6230
|
}
|
|
6225
|
-
})),
|
|
6231
|
+
})), u ? /* @__PURE__ */ r(K1, { ...N1, value: n, mode: u }) : /* @__PURE__ */ r("div", { className: "snmt-async-select", children: /* @__PURE__ */ r(K1, { ...N1, value: n }) });
|
|
6226
6232
|
}
|
|
6227
|
-
),
|
|
6233
|
+
), M = (i) => typeof i == "string", C1 = () => {
|
|
6228
6234
|
let i, e;
|
|
6229
6235
|
const t = new Promise((n, s) => {
|
|
6230
6236
|
i = n, e = s;
|
|
@@ -6234,8 +6240,8 @@ const H1 = 100, l1 = {
|
|
|
6234
6240
|
i.forEach((n) => {
|
|
6235
6241
|
e[n] && (t[n] = e[n]);
|
|
6236
6242
|
});
|
|
6237
|
-
}, K5 = /###/g, F1 = (i) => i && i.indexOf("###") > -1 ? i.replace(K5, ".") : i, Y1 = (i) => !i ||
|
|
6238
|
-
const n =
|
|
6243
|
+
}, K5 = /###/g, F1 = (i) => i && i.indexOf("###") > -1 ? i.replace(K5, ".") : i, Y1 = (i) => !i || M(i), m1 = (i, e, t) => {
|
|
6244
|
+
const n = M(e) ? e.split(".") : e;
|
|
6239
6245
|
let s = 0;
|
|
6240
6246
|
for (; s < n.length - 1; ) {
|
|
6241
6247
|
if (Y1(i)) return {};
|
|
@@ -6275,9 +6281,9 @@ const H1 = 100, l1 = {
|
|
|
6275
6281
|
}, $5 = (i, e, t) => {
|
|
6276
6282
|
const n = R1(i, t);
|
|
6277
6283
|
return n !== void 0 ? n : R1(e, t);
|
|
6278
|
-
},
|
|
6284
|
+
}, ue = (i, e, t) => {
|
|
6279
6285
|
for (const n in e)
|
|
6280
|
-
n !== "__proto__" && n !== "constructor" && (n in i ?
|
|
6286
|
+
n !== "__proto__" && n !== "constructor" && (n in i ? M(i[n]) || i[n] instanceof String || M(e[n]) || e[n] instanceof String ? t && (i[n] = e[n]) : ue(i[n], e[n], t) : i[n] = e[n]);
|
|
6281
6287
|
return i;
|
|
6282
6288
|
}, h1 = (i) => i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
6283
6289
|
var F5 = {
|
|
@@ -6288,7 +6294,7 @@ var F5 = {
|
|
|
6288
6294
|
"'": "'",
|
|
6289
6295
|
"/": "/"
|
|
6290
6296
|
};
|
|
6291
|
-
const Y5 = (i) =>
|
|
6297
|
+
const Y5 = (i) => M(i) ? i.replace(/[&<>"'\/]/g, (e) => F5[e]) : i;
|
|
6292
6298
|
class U5 {
|
|
6293
6299
|
constructor(e) {
|
|
6294
6300
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
@@ -6322,11 +6328,11 @@ const z5 = [" ", ",", "?", "!", ";"], J5 = new U5(20), q5 = (i, e, t) => {
|
|
|
6322
6328
|
if (!s || typeof s != "object")
|
|
6323
6329
|
return;
|
|
6324
6330
|
let c, o = "";
|
|
6325
|
-
for (let
|
|
6326
|
-
if (
|
|
6327
|
-
if (["string", "number", "boolean"].indexOf(typeof c) > -1 &&
|
|
6331
|
+
for (let u = a; u < n.length; ++u)
|
|
6332
|
+
if (u !== a && (o += t), o += n[u], c = s[o], c !== void 0) {
|
|
6333
|
+
if (["string", "number", "boolean"].indexOf(typeof c) > -1 && u < n.length - 1)
|
|
6328
6334
|
continue;
|
|
6329
|
-
a +=
|
|
6335
|
+
a += u - a + 1;
|
|
6330
6336
|
break;
|
|
6331
6337
|
}
|
|
6332
6338
|
s = c;
|
|
@@ -6377,7 +6383,7 @@ class b1 {
|
|
|
6377
6383
|
return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
|
|
6378
6384
|
}
|
|
6379
6385
|
forward(e, t, n, s) {
|
|
6380
|
-
return s && !this.debug ? null : (
|
|
6386
|
+
return s && !this.debug ? null : (M(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
6381
6387
|
}
|
|
6382
6388
|
create(e) {
|
|
6383
6389
|
return new b1(this.logger, {
|
|
@@ -6414,12 +6420,12 @@ class _1 {
|
|
|
6414
6420
|
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
6415
6421
|
n[s - 1] = arguments[s];
|
|
6416
6422
|
this.observers[e] && Array.from(this.observers[e].entries()).forEach((c) => {
|
|
6417
|
-
let [o,
|
|
6418
|
-
for (let d = 0; d <
|
|
6423
|
+
let [o, u] = c;
|
|
6424
|
+
for (let d = 0; d < u; d++)
|
|
6419
6425
|
o(...n);
|
|
6420
6426
|
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((c) => {
|
|
6421
|
-
let [o,
|
|
6422
|
-
for (let d = 0; d <
|
|
6427
|
+
let [o, u] = c;
|
|
6428
|
+
for (let d = 0; d < u; d++)
|
|
6423
6429
|
o.apply(o, [e, ...n]);
|
|
6424
6430
|
});
|
|
6425
6431
|
}
|
|
@@ -6443,9 +6449,9 @@ class z1 extends _1 {
|
|
|
6443
6449
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
6444
6450
|
const a = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, c = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
6445
6451
|
let o;
|
|
6446
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
6447
|
-
const
|
|
6448
|
-
return !
|
|
6452
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : M(n) && a ? o.push(...n.split(a)) : o.push(n)));
|
|
6453
|
+
const u = R1(this.data, o);
|
|
6454
|
+
return !u && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), u || !c || !M(n) ? u : V1(this.data && this.data[e] && this.data[e][t], n, a);
|
|
6449
6455
|
}
|
|
6450
6456
|
addResource(e, t, n, s) {
|
|
6451
6457
|
let a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
@@ -6460,7 +6466,7 @@ class z1 extends _1 {
|
|
|
6460
6466
|
silent: !1
|
|
6461
6467
|
};
|
|
6462
6468
|
for (const a in n)
|
|
6463
|
-
(
|
|
6469
|
+
(M(n[a]) || Array.isArray(n[a])) && this.addResource(e, t, a, n[a], {
|
|
6464
6470
|
silent: !0
|
|
6465
6471
|
});
|
|
6466
6472
|
s.silent || this.emit("added", e, t, n);
|
|
@@ -6471,11 +6477,11 @@ class z1 extends _1 {
|
|
|
6471
6477
|
skipCopy: !1
|
|
6472
6478
|
}, o = [e, t];
|
|
6473
6479
|
e.indexOf(".") > -1 && (o = e.split("."), s = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
6474
|
-
let
|
|
6475
|
-
c.skipCopy || (n = JSON.parse(JSON.stringify(n))), s ?
|
|
6476
|
-
...
|
|
6480
|
+
let u = R1(this.data, o) || {};
|
|
6481
|
+
c.skipCopy || (n = JSON.parse(JSON.stringify(n))), s ? ue(u, n, a) : u = {
|
|
6482
|
+
...u,
|
|
6477
6483
|
...n
|
|
6478
|
-
}, U1(this.data, o,
|
|
6484
|
+
}, U1(this.data, o, u), c.silent || this.emit("added", e, t, n);
|
|
6479
6485
|
}
|
|
6480
6486
|
removeResourceBundle(e, t) {
|
|
6481
6487
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -6499,7 +6505,7 @@ class z1 extends _1 {
|
|
|
6499
6505
|
return this.data;
|
|
6500
6506
|
}
|
|
6501
6507
|
}
|
|
6502
|
-
var
|
|
6508
|
+
var ge = {
|
|
6503
6509
|
processors: {},
|
|
6504
6510
|
addPostProcessor(i) {
|
|
6505
6511
|
this.processors[i.name] = i;
|
|
@@ -6535,18 +6541,18 @@ class y1 extends _1 {
|
|
|
6535
6541
|
let a = t.ns || this.options.defaultNS || [];
|
|
6536
6542
|
const c = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !q5(e, n, s);
|
|
6537
6543
|
if (c && !o) {
|
|
6538
|
-
const
|
|
6539
|
-
if (
|
|
6544
|
+
const u = e.match(this.interpolator.nestingRegexp);
|
|
6545
|
+
if (u && u.length > 0)
|
|
6540
6546
|
return {
|
|
6541
6547
|
key: e,
|
|
6542
|
-
namespaces:
|
|
6548
|
+
namespaces: M(a) ? [a] : a
|
|
6543
6549
|
};
|
|
6544
6550
|
const d = e.split(n);
|
|
6545
6551
|
(n !== s || n === s && this.options.ns.indexOf(d[0]) > -1) && (a = d.shift()), e = d.join(s);
|
|
6546
6552
|
}
|
|
6547
6553
|
return {
|
|
6548
6554
|
key: e,
|
|
6549
|
-
namespaces:
|
|
6555
|
+
namespaces: M(a) ? [a] : a
|
|
6550
6556
|
};
|
|
6551
6557
|
}
|
|
6552
6558
|
translate(e, t, n) {
|
|
@@ -6557,90 +6563,90 @@ class y1 extends _1 {
|
|
|
6557
6563
|
const s = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, a = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
|
|
6558
6564
|
key: c,
|
|
6559
6565
|
namespaces: o
|
|
6560
|
-
} = this.extractFromKey(e[e.length - 1], t),
|
|
6566
|
+
} = this.extractFromKey(e[e.length - 1], t), u = o[o.length - 1], d = t.lng || this.language, l = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
6561
6567
|
if (d && d.toLowerCase() === "cimode") {
|
|
6562
6568
|
if (l) {
|
|
6563
6569
|
const f = t.nsSeparator || this.options.nsSeparator;
|
|
6564
6570
|
return s ? {
|
|
6565
|
-
res: `${
|
|
6571
|
+
res: `${u}${f}${c}`,
|
|
6566
6572
|
usedKey: c,
|
|
6567
6573
|
exactUsedKey: c,
|
|
6568
6574
|
usedLng: d,
|
|
6569
|
-
usedNS:
|
|
6575
|
+
usedNS: u,
|
|
6570
6576
|
usedParams: this.getUsedParamsDetails(t)
|
|
6571
|
-
} : `${
|
|
6577
|
+
} : `${u}${f}${c}`;
|
|
6572
6578
|
}
|
|
6573
6579
|
return s ? {
|
|
6574
6580
|
res: c,
|
|
6575
6581
|
usedKey: c,
|
|
6576
6582
|
exactUsedKey: c,
|
|
6577
6583
|
usedLng: d,
|
|
6578
|
-
usedNS:
|
|
6584
|
+
usedNS: u,
|
|
6579
6585
|
usedParams: this.getUsedParamsDetails(t)
|
|
6580
6586
|
} : c;
|
|
6581
6587
|
}
|
|
6582
6588
|
const h = this.resolve(e, t);
|
|
6583
|
-
let
|
|
6584
|
-
const p = h && h.usedKey || c,
|
|
6585
|
-
if (
|
|
6589
|
+
let g = h && h.res;
|
|
6590
|
+
const p = h && h.usedKey || c, w = h && h.exactUsedKey || c, v = Object.prototype.toString.apply(g), m = ["[object Number]", "[object Function]", "[object RegExp]"], _ = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, R = !this.i18nFormat || this.i18nFormat.handleAsObject, H = !M(g) && typeof g != "boolean" && typeof g != "number";
|
|
6591
|
+
if (R && g && H && m.indexOf(v) < 0 && !(M(_) && Array.isArray(g))) {
|
|
6586
6592
|
if (!t.returnObjects && !this.options.returnObjects) {
|
|
6587
6593
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
6588
|
-
const f = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p,
|
|
6594
|
+
const f = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, g, {
|
|
6589
6595
|
...t,
|
|
6590
6596
|
ns: o
|
|
6591
6597
|
}) : `key '${c} (${this.language})' returned an object instead of string.`;
|
|
6592
6598
|
return s ? (h.res = f, h.usedParams = this.getUsedParamsDetails(t), h) : f;
|
|
6593
6599
|
}
|
|
6594
6600
|
if (a) {
|
|
6595
|
-
const f = Array.isArray(
|
|
6596
|
-
for (const L in
|
|
6597
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
6601
|
+
const f = Array.isArray(g), k = f ? [] : {}, x = f ? w : p;
|
|
6602
|
+
for (const L in g)
|
|
6603
|
+
if (Object.prototype.hasOwnProperty.call(g, L)) {
|
|
6598
6604
|
const I = `${x}${a}${L}`;
|
|
6599
6605
|
k[L] = this.translate(I, {
|
|
6600
6606
|
...t,
|
|
6601
6607
|
joinArrays: !1,
|
|
6602
6608
|
ns: o
|
|
6603
|
-
}), k[L] === I && (k[L] =
|
|
6609
|
+
}), k[L] === I && (k[L] = g[L]);
|
|
6604
6610
|
}
|
|
6605
|
-
|
|
6611
|
+
g = k;
|
|
6606
6612
|
}
|
|
6607
|
-
} else if (
|
|
6608
|
-
|
|
6613
|
+
} else if (R && M(_) && Array.isArray(g))
|
|
6614
|
+
g = g.join(_), g && (g = this.extendTranslation(g, e, t, n));
|
|
6609
6615
|
else {
|
|
6610
6616
|
let f = !1, k = !1;
|
|
6611
|
-
const x = t.count !== void 0 && !
|
|
6617
|
+
const x = t.count !== void 0 && !M(t.count), L = y1.hasDefaultValue(t), I = x ? this.pluralResolver.getSuffix(d, t.count, t) : "", Z = t.ordinal && x ? this.pluralResolver.getSuffix(d, t.count, {
|
|
6612
6618
|
ordinal: !1
|
|
6613
|
-
}) : "",
|
|
6614
|
-
!this.isValidLookup(
|
|
6615
|
-
const O = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && k ? void 0 :
|
|
6619
|
+
}) : "", D = x && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), G = D && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${I}`] || t[`defaultValue${Z}`] || t.defaultValue;
|
|
6620
|
+
!this.isValidLookup(g) && L && (f = !0, g = G), this.isValidLookup(g) || (k = !0, g = c);
|
|
6621
|
+
const O = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && k ? void 0 : g, K = L && G !== g && this.options.updateMissing;
|
|
6616
6622
|
if (k || f || K) {
|
|
6617
|
-
if (this.logger.log(K ? "updateKey" : "missingKey", d,
|
|
6618
|
-
const
|
|
6623
|
+
if (this.logger.log(K ? "updateKey" : "missingKey", d, u, c, K ? G : g), a) {
|
|
6624
|
+
const B = this.resolve(c, {
|
|
6619
6625
|
...t,
|
|
6620
6626
|
keySeparator: !1
|
|
6621
6627
|
});
|
|
6622
|
-
|
|
6628
|
+
B && B.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.");
|
|
6623
6629
|
}
|
|
6624
6630
|
let U = [];
|
|
6625
6631
|
const q = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
|
|
6626
6632
|
if (this.options.saveMissingTo === "fallback" && q && q[0])
|
|
6627
|
-
for (let
|
|
6628
|
-
U.push(q[
|
|
6633
|
+
for (let B = 0; B < q.length; B++)
|
|
6634
|
+
U.push(q[B]);
|
|
6629
6635
|
else this.options.saveMissingTo === "all" ? U = this.languageUtils.toResolveHierarchy(t.lng || this.language) : U.push(t.lng || this.language);
|
|
6630
|
-
const X = (
|
|
6631
|
-
const e1 = L && P !==
|
|
6632
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(
|
|
6636
|
+
const X = (B, $, P) => {
|
|
6637
|
+
const e1 = L && P !== g ? P : O;
|
|
6638
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(B, u, $, e1, K, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(B, u, $, e1, K, t), this.emit("missingKey", B, u, $, g);
|
|
6633
6639
|
};
|
|
6634
|
-
this.options.saveMissing && (this.options.saveMissingPlurals && x ? U.forEach((
|
|
6635
|
-
const $ = this.pluralResolver.getSuffixes(
|
|
6636
|
-
|
|
6637
|
-
X([
|
|
6640
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && x ? U.forEach((B) => {
|
|
6641
|
+
const $ = this.pluralResolver.getSuffixes(B, t);
|
|
6642
|
+
D && t[`defaultValue${this.options.pluralSeparator}zero`] && $.indexOf(`${this.options.pluralSeparator}zero`) < 0 && $.push(`${this.options.pluralSeparator}zero`), $.forEach((P) => {
|
|
6643
|
+
X([B], c + P, t[`defaultValue${P}`] || G);
|
|
6638
6644
|
});
|
|
6639
6645
|
}) : X(U, c, G));
|
|
6640
6646
|
}
|
|
6641
|
-
|
|
6647
|
+
g = this.extendTranslation(g, e, t, h, n), k && g === c && this.options.appendNamespaceToMissingKey && (g = `${u}:${c}`), (k || f) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? g = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}:${c}` : c, f ? g : void 0) : g = this.options.parseMissingKeyHandler(g));
|
|
6642
6648
|
}
|
|
6643
|
-
return s ? (h.res =
|
|
6649
|
+
return s ? (h.res = g, h.usedParams = this.getUsedParamsDetails(t), h) : g;
|
|
6644
6650
|
}
|
|
6645
6651
|
extendTranslation(e, t, n, s, a) {
|
|
6646
6652
|
var c = this;
|
|
@@ -6659,28 +6665,28 @@ class y1 extends _1 {
|
|
|
6659
6665
|
...n.interpolation
|
|
6660
6666
|
}
|
|
6661
6667
|
});
|
|
6662
|
-
const d =
|
|
6668
|
+
const d = M(e) && (n && n.interpolation && n.interpolation.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
6663
6669
|
let l;
|
|
6664
6670
|
if (d) {
|
|
6665
|
-
const
|
|
6666
|
-
l =
|
|
6671
|
+
const g = e.match(this.interpolator.nestingRegexp);
|
|
6672
|
+
l = g && g.length;
|
|
6667
6673
|
}
|
|
6668
|
-
let h = n.replace && !
|
|
6674
|
+
let h = n.replace && !M(n.replace) ? n.replace : n;
|
|
6669
6675
|
if (this.options.interpolation.defaultVariables && (h = {
|
|
6670
6676
|
...this.options.interpolation.defaultVariables,
|
|
6671
6677
|
...h
|
|
6672
6678
|
}), e = this.interpolator.interpolate(e, h, n.lng || this.language || s.usedLng, n), d) {
|
|
6673
|
-
const
|
|
6679
|
+
const g = e.match(this.interpolator.nestingRegexp), p = g && g.length;
|
|
6674
6680
|
l < p && (n.nest = !1);
|
|
6675
6681
|
}
|
|
6676
6682
|
!n.lng && this.options.compatibilityAPI !== "v1" && s && s.res && (n.lng = this.language || s.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, function() {
|
|
6677
|
-
for (var
|
|
6678
|
-
p[
|
|
6683
|
+
for (var g = arguments.length, p = new Array(g), w = 0; w < g; w++)
|
|
6684
|
+
p[w] = arguments[w];
|
|
6679
6685
|
return a && a[0] === p[0] && !n.context ? (c.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`), null) : c.translate(...p, t);
|
|
6680
6686
|
}, n)), n.interpolation && this.interpolator.reset();
|
|
6681
6687
|
}
|
|
6682
|
-
const o = n.postProcess || this.options.postProcess,
|
|
6683
|
-
return e != null &&
|
|
6688
|
+
const o = n.postProcess || this.options.postProcess, u = M(o) ? [o] : o;
|
|
6689
|
+
return e != null && u && u.length && n.applyPostProcessor !== !1 && (e = ge.handle(u, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
6684
6690
|
i18nResolved: {
|
|
6685
6691
|
...s,
|
|
6686
6692
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -6690,32 +6696,32 @@ class y1 extends _1 {
|
|
|
6690
6696
|
}
|
|
6691
6697
|
resolve(e) {
|
|
6692
6698
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n, s, a, c, o;
|
|
6693
|
-
return
|
|
6699
|
+
return M(e) && (e = [e]), e.forEach((u) => {
|
|
6694
6700
|
if (this.isValidLookup(n)) return;
|
|
6695
|
-
const d = this.extractFromKey(
|
|
6701
|
+
const d = this.extractFromKey(u, t), l = d.key;
|
|
6696
6702
|
s = l;
|
|
6697
6703
|
let h = d.namespaces;
|
|
6698
6704
|
this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
|
|
6699
|
-
const
|
|
6700
|
-
h.forEach((
|
|
6701
|
-
this.isValidLookup(n) || (o =
|
|
6705
|
+
const g = t.count !== void 0 && !M(t.count), p = g && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), w = t.context !== void 0 && (M(t.context) || typeof t.context == "number") && t.context !== "", v = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
6706
|
+
h.forEach((m) => {
|
|
6707
|
+
this.isValidLookup(n) || (o = m, !J1[`${v[0]}-${m}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(o) && (J1[`${v[0]}-${m}`] = !0, this.logger.warn(`key "${s}" for languages "${v.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!!!")), v.forEach((_) => {
|
|
6702
6708
|
if (this.isValidLookup(n)) return;
|
|
6703
6709
|
c = _;
|
|
6704
|
-
const
|
|
6710
|
+
const R = [l];
|
|
6705
6711
|
if (this.i18nFormat && this.i18nFormat.addLookupKeys)
|
|
6706
|
-
this.i18nFormat.addLookupKeys(
|
|
6712
|
+
this.i18nFormat.addLookupKeys(R, l, _, m, t);
|
|
6707
6713
|
else {
|
|
6708
6714
|
let f;
|
|
6709
|
-
|
|
6715
|
+
g && (f = this.pluralResolver.getSuffix(_, t.count, t));
|
|
6710
6716
|
const k = `${this.options.pluralSeparator}zero`, x = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
6711
|
-
if (
|
|
6717
|
+
if (g && (R.push(l + f), t.ordinal && f.indexOf(x) === 0 && R.push(l + f.replace(x, this.options.pluralSeparator)), p && R.push(l + k)), w) {
|
|
6712
6718
|
const L = `${l}${this.options.contextSeparator}${t.context}`;
|
|
6713
|
-
|
|
6719
|
+
R.push(L), g && (R.push(L + f), t.ordinal && f.indexOf(x) === 0 && R.push(L + f.replace(x, this.options.pluralSeparator)), p && R.push(L + k));
|
|
6714
6720
|
}
|
|
6715
6721
|
}
|
|
6716
6722
|
let H;
|
|
6717
|
-
for (; H =
|
|
6718
|
-
this.isValidLookup(n) || (a = H, n = this.getResource(_,
|
|
6723
|
+
for (; H = R.pop(); )
|
|
6724
|
+
this.isValidLookup(n) || (a = H, n = this.getResource(_, m, H, t));
|
|
6719
6725
|
}));
|
|
6720
6726
|
});
|
|
6721
6727
|
}), {
|
|
@@ -6735,7 +6741,7 @@ class y1 extends _1 {
|
|
|
6735
6741
|
}
|
|
6736
6742
|
getUsedParamsDetails() {
|
|
6737
6743
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
6738
|
-
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !
|
|
6744
|
+
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = e.replace && !M(e.replace);
|
|
6739
6745
|
let s = n ? e.replace : e;
|
|
6740
6746
|
if (n && typeof e.count < "u" && (s.count = e.count), this.options.interpolation.defaultVariables && (s = {
|
|
6741
6747
|
...this.options.interpolation.defaultVariables,
|
|
@@ -6773,7 +6779,7 @@ class q1 {
|
|
|
6773
6779
|
return this.formatLanguageCode(t[0]);
|
|
6774
6780
|
}
|
|
6775
6781
|
formatLanguageCode(e) {
|
|
6776
|
-
if (
|
|
6782
|
+
if (M(e) && e.indexOf("-") > -1) {
|
|
6777
6783
|
if (typeof Intl < "u" && typeof Intl.getCanonicalLocales < "u")
|
|
6778
6784
|
try {
|
|
6779
6785
|
let s = Intl.getCanonicalLocales(e)[0];
|
|
@@ -6809,7 +6815,7 @@ class q1 {
|
|
|
6809
6815
|
}
|
|
6810
6816
|
getFallbackCodes(e, t) {
|
|
6811
6817
|
if (!e) return [];
|
|
6812
|
-
if (typeof e == "function" && (e = e(t)),
|
|
6818
|
+
if (typeof e == "function" && (e = e(t)), M(e) && (e = [e]), Array.isArray(e)) return e;
|
|
6813
6819
|
if (!t) return e.default || [];
|
|
6814
6820
|
let n = e[t];
|
|
6815
6821
|
return n || (n = e[this.getScriptPartFromCode(t)]), n || (n = e[this.formatLanguageCode(t)]), n || (n = e[this.getLanguagePartFromCode(t)]), n || (n = e.default), n || [];
|
|
@@ -6818,7 +6824,7 @@ class q1 {
|
|
|
6818
6824
|
const n = this.getFallbackCodes(t || this.options.fallbackLng || [], e), s = [], a = (c) => {
|
|
6819
6825
|
c && (this.isSupportedCode(c) ? s.push(c) : this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`));
|
|
6820
6826
|
};
|
|
6821
|
-
return
|
|
6827
|
+
return M(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && a(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && a(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && a(this.getLanguagePartFromCode(e))) : M(e) && a(this.formatLanguageCode(e)), n.forEach((c) => {
|
|
6822
6828
|
s.indexOf(c) < 0 && a(this.formatLanguageCode(c));
|
|
6823
6829
|
}), s;
|
|
6824
6830
|
}
|
|
@@ -6984,8 +6990,8 @@ class si {
|
|
|
6984
6990
|
});
|
|
6985
6991
|
} catch {
|
|
6986
6992
|
if (!e.match(/-|_/)) return;
|
|
6987
|
-
const
|
|
6988
|
-
c = this.getRule(
|
|
6993
|
+
const u = this.languageUtils.getLanguagePartFromCode(e);
|
|
6994
|
+
c = this.getRule(u, t);
|
|
6989
6995
|
}
|
|
6990
6996
|
return this.pluralRulesCache[a] = c, c;
|
|
6991
6997
|
}
|
|
@@ -7023,7 +7029,7 @@ class si {
|
|
|
7023
7029
|
}
|
|
7024
7030
|
const X1 = function(i, e, t) {
|
|
7025
7031
|
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = $5(i, e, t);
|
|
7026
|
-
return !a && s &&
|
|
7032
|
+
return !a && s && M(t) && (a = V1(i, t, n), a === void 0 && (a = V1(e, t, n))), a;
|
|
7027
7033
|
}, O1 = (i) => i.replace(/\$/g, "$$$$");
|
|
7028
7034
|
class ri {
|
|
7029
7035
|
constructor() {
|
|
@@ -7042,19 +7048,19 @@ class ri {
|
|
|
7042
7048
|
prefix: a,
|
|
7043
7049
|
prefixEscaped: c,
|
|
7044
7050
|
suffix: o,
|
|
7045
|
-
suffixEscaped:
|
|
7051
|
+
suffixEscaped: u,
|
|
7046
7052
|
formatSeparator: d,
|
|
7047
7053
|
unescapeSuffix: l,
|
|
7048
7054
|
unescapePrefix: h,
|
|
7049
|
-
nestingPrefix:
|
|
7055
|
+
nestingPrefix: g,
|
|
7050
7056
|
nestingPrefixEscaped: p,
|
|
7051
|
-
nestingSuffix:
|
|
7057
|
+
nestingSuffix: w,
|
|
7052
7058
|
nestingSuffixEscaped: v,
|
|
7053
|
-
nestingOptionsSeparator:
|
|
7059
|
+
nestingOptionsSeparator: m,
|
|
7054
7060
|
maxReplaces: _,
|
|
7055
|
-
alwaysFormat:
|
|
7061
|
+
alwaysFormat: R
|
|
7056
7062
|
} = e.interpolation;
|
|
7057
|
-
this.escape = t !== void 0 ? t : Y5, this.escapeValue = n !== void 0 ? n : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = a ? h1(a) : c || "{{", this.suffix = o ? h1(o) :
|
|
7063
|
+
this.escape = t !== void 0 ? t : Y5, this.escapeValue = n !== void 0 ? n : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = a ? h1(a) : c || "{{", this.suffix = o ? h1(o) : u || "}}", this.formatSeparator = d || ",", this.unescapePrefix = l ? "" : h || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = g ? h1(g) : p || h1("$t("), this.nestingSuffix = w ? h1(w) : v || h1(")"), this.nestingOptionsSeparator = m || ",", this.maxReplaces = _ || 1e3, this.alwaysFormat = R !== void 0 ? R : !1, this.resetRegExp();
|
|
7058
7064
|
}
|
|
7059
7065
|
reset() {
|
|
7060
7066
|
this.options && this.init(this.options);
|
|
@@ -7065,17 +7071,17 @@ class ri {
|
|
|
7065
7071
|
}
|
|
7066
7072
|
interpolate(e, t, n, s) {
|
|
7067
7073
|
let a, c, o;
|
|
7068
|
-
const
|
|
7074
|
+
const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, d = (p) => {
|
|
7069
7075
|
if (p.indexOf(this.formatSeparator) < 0) {
|
|
7070
|
-
const _ = X1(t,
|
|
7076
|
+
const _ = X1(t, u, p, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
7071
7077
|
return this.alwaysFormat ? this.format(_, void 0, n, {
|
|
7072
7078
|
...s,
|
|
7073
7079
|
...t,
|
|
7074
7080
|
interpolationkey: p
|
|
7075
7081
|
}) : _;
|
|
7076
7082
|
}
|
|
7077
|
-
const
|
|
7078
|
-
return this.format(X1(t,
|
|
7083
|
+
const w = p.split(this.formatSeparator), v = w.shift().trim(), m = w.join(this.formatSeparator).trim();
|
|
7084
|
+
return this.format(X1(t, u, v, this.options.keySeparator, this.options.ignoreJSONStructure), m, n, {
|
|
7079
7085
|
...s,
|
|
7080
7086
|
...t,
|
|
7081
7087
|
interpolationkey: v
|
|
@@ -7091,19 +7097,19 @@ class ri {
|
|
|
7091
7097
|
safeValue: (p) => this.escapeValue ? O1(this.escape(p)) : O1(p)
|
|
7092
7098
|
}].forEach((p) => {
|
|
7093
7099
|
for (o = 0; a = p.regex.exec(e); ) {
|
|
7094
|
-
const
|
|
7095
|
-
if (c = d(
|
|
7100
|
+
const w = a[1].trim();
|
|
7101
|
+
if (c = d(w), c === void 0)
|
|
7096
7102
|
if (typeof l == "function") {
|
|
7097
|
-
const
|
|
7098
|
-
c =
|
|
7099
|
-
} else if (s && Object.prototype.hasOwnProperty.call(s,
|
|
7103
|
+
const m = l(e, a, s);
|
|
7104
|
+
c = M(m) ? m : "";
|
|
7105
|
+
} else if (s && Object.prototype.hasOwnProperty.call(s, w))
|
|
7100
7106
|
c = "";
|
|
7101
7107
|
else if (h) {
|
|
7102
7108
|
c = a[0];
|
|
7103
7109
|
continue;
|
|
7104
7110
|
} else
|
|
7105
|
-
this.logger.warn(`missed to pass in variable ${
|
|
7106
|
-
else !
|
|
7111
|
+
this.logger.warn(`missed to pass in variable ${w} for interpolating ${e}`), c = "";
|
|
7112
|
+
else !M(c) && !this.useRawValueToEscape && (c = $1(c));
|
|
7107
7113
|
const v = p.safeValue(c);
|
|
7108
7114
|
if (e = e.replace(a[0], v), h ? (p.regex.lastIndex += c.length, p.regex.lastIndex -= a[0].length) : p.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
7109
7115
|
break;
|
|
@@ -7112,36 +7118,36 @@ class ri {
|
|
|
7112
7118
|
}
|
|
7113
7119
|
nest(e, t) {
|
|
7114
7120
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s, a, c;
|
|
7115
|
-
const o = (
|
|
7121
|
+
const o = (u, d) => {
|
|
7116
7122
|
const l = this.nestingOptionsSeparator;
|
|
7117
|
-
if (
|
|
7118
|
-
const h =
|
|
7119
|
-
let
|
|
7120
|
-
|
|
7121
|
-
const p =
|
|
7122
|
-
(p && p.length % 2 === 0 && !
|
|
7123
|
+
if (u.indexOf(l) < 0) return u;
|
|
7124
|
+
const h = u.split(new RegExp(`${l}[ ]*{`));
|
|
7125
|
+
let g = `{${h[1]}`;
|
|
7126
|
+
u = h[0], g = this.interpolate(g, c);
|
|
7127
|
+
const p = g.match(/'/g), w = g.match(/"/g);
|
|
7128
|
+
(p && p.length % 2 === 0 && !w || w.length % 2 !== 0) && (g = g.replace(/'/g, '"'));
|
|
7123
7129
|
try {
|
|
7124
|
-
c = JSON.parse(
|
|
7130
|
+
c = JSON.parse(g), d && (c = {
|
|
7125
7131
|
...d,
|
|
7126
7132
|
...c
|
|
7127
7133
|
});
|
|
7128
7134
|
} catch (v) {
|
|
7129
|
-
return this.logger.warn(`failed parsing options string in nesting for key ${
|
|
7135
|
+
return this.logger.warn(`failed parsing options string in nesting for key ${u}`, v), `${u}${l}${g}`;
|
|
7130
7136
|
}
|
|
7131
|
-
return c.defaultValue && c.defaultValue.indexOf(this.prefix) > -1 && delete c.defaultValue,
|
|
7137
|
+
return c.defaultValue && c.defaultValue.indexOf(this.prefix) > -1 && delete c.defaultValue, u;
|
|
7132
7138
|
};
|
|
7133
7139
|
for (; s = this.nestingRegexp.exec(e); ) {
|
|
7134
|
-
let
|
|
7140
|
+
let u = [];
|
|
7135
7141
|
c = {
|
|
7136
7142
|
...n
|
|
7137
|
-
}, c = c.replace && !
|
|
7143
|
+
}, c = c.replace && !M(c.replace) ? c.replace : c, c.applyPostProcessor = !1, delete c.defaultValue;
|
|
7138
7144
|
let d = !1;
|
|
7139
7145
|
if (s[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(s[1])) {
|
|
7140
7146
|
const l = s[1].split(this.formatSeparator).map((h) => h.trim());
|
|
7141
|
-
s[1] = l.shift(),
|
|
7147
|
+
s[1] = l.shift(), u = l, d = !0;
|
|
7142
7148
|
}
|
|
7143
|
-
if (a = t(o.call(this, s[1].trim(), c), c), a && s[0] === e && !
|
|
7144
|
-
|
|
7149
|
+
if (a = t(o.call(this, s[1].trim(), c), c), a && s[0] === e && !M(a)) return a;
|
|
7150
|
+
M(a) || (a = $1(a)), a || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), a = ""), d && (a = u.reduce((l, h) => this.format(l, h, n.lng, {
|
|
7145
7151
|
...n,
|
|
7146
7152
|
interpolationkey: s[1].trim()
|
|
7147
7153
|
}), a.trim())), e = e.replace(s[0], a), this.regexp.lastIndex = 0;
|
|
@@ -7158,7 +7164,7 @@ const oi = (i) => {
|
|
|
7158
7164
|
const s = n[1].substring(0, n[1].length - 1);
|
|
7159
7165
|
e === "currency" && s.indexOf(":") < 0 ? t.currency || (t.currency = s.trim()) : e === "relativetime" && s.indexOf(":") < 0 ? t.range || (t.range = s.trim()) : s.split(";").forEach((c) => {
|
|
7160
7166
|
if (c) {
|
|
7161
|
-
const [o, ...
|
|
7167
|
+
const [o, ...u] = c.split(":"), d = u.join(":").trim().replace(/^'+|'+$/g, ""), l = o.trim();
|
|
7162
7168
|
t[l] || (t[l] = d), d === "false" && (t[l] = !1), d === "true" && (t[l] = !0), isNaN(d) || (t[l] = parseInt(d, 10));
|
|
7163
7169
|
}
|
|
7164
7170
|
});
|
|
@@ -7233,25 +7239,25 @@ class ai {
|
|
|
7233
7239
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
7234
7240
|
const a = t.split(this.formatSeparator);
|
|
7235
7241
|
if (a.length > 1 && a[0].indexOf("(") > 1 && a[0].indexOf(")") < 0 && a.find((o) => o.indexOf(")") > -1)) {
|
|
7236
|
-
const o = a.findIndex((
|
|
7242
|
+
const o = a.findIndex((u) => u.indexOf(")") > -1);
|
|
7237
7243
|
a[0] = [a[0], ...a.splice(1, o)].join(this.formatSeparator);
|
|
7238
7244
|
}
|
|
7239
|
-
return a.reduce((o,
|
|
7245
|
+
return a.reduce((o, u) => {
|
|
7240
7246
|
const {
|
|
7241
7247
|
formatName: d,
|
|
7242
7248
|
formatOptions: l
|
|
7243
|
-
} = oi(
|
|
7249
|
+
} = oi(u);
|
|
7244
7250
|
if (this.formats[d]) {
|
|
7245
7251
|
let h = o;
|
|
7246
7252
|
try {
|
|
7247
|
-
const
|
|
7253
|
+
const g = s && s.formatParams && s.formatParams[s.interpolationkey] || {}, p = g.locale || g.lng || s.locale || s.lng || n;
|
|
7248
7254
|
h = this.formats[d](o, p, {
|
|
7249
7255
|
...l,
|
|
7250
7256
|
...s,
|
|
7251
|
-
...
|
|
7257
|
+
...g
|
|
7252
7258
|
});
|
|
7253
|
-
} catch (
|
|
7254
|
-
this.logger.warn(
|
|
7259
|
+
} catch (g) {
|
|
7260
|
+
this.logger.warn(g);
|
|
7255
7261
|
}
|
|
7256
7262
|
return h;
|
|
7257
7263
|
} else
|
|
@@ -7269,12 +7275,12 @@ class hi extends _1 {
|
|
|
7269
7275
|
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = s, this.logger = J.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = s.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = s.maxRetries >= 0 ? s.maxRetries : 5, this.retryTimeout = s.retryTimeout >= 1 ? s.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(n, s.backend, s);
|
|
7270
7276
|
}
|
|
7271
7277
|
queueLoad(e, t, n, s) {
|
|
7272
|
-
const a = {}, c = {}, o = {},
|
|
7278
|
+
const a = {}, c = {}, o = {}, u = {};
|
|
7273
7279
|
return e.forEach((d) => {
|
|
7274
7280
|
let l = !0;
|
|
7275
7281
|
t.forEach((h) => {
|
|
7276
|
-
const
|
|
7277
|
-
!n.reload && this.store.hasResourceBundle(d, h) ? this.state[
|
|
7282
|
+
const g = `${d}|${h}`;
|
|
7283
|
+
!n.reload && this.store.hasResourceBundle(d, h) ? this.state[g] = 2 : this.state[g] < 0 || (this.state[g] === 1 ? c[g] === void 0 && (c[g] = !0) : (this.state[g] = 1, l = !1, c[g] === void 0 && (c[g] = !0), a[g] === void 0 && (a[g] = !0), u[h] === void 0 && (u[h] = !0)));
|
|
7278
7284
|
}), l || (o[d] = !0);
|
|
7279
7285
|
}), (Object.keys(a).length || Object.keys(c).length) && this.queue.push({
|
|
7280
7286
|
pending: c,
|
|
@@ -7286,7 +7292,7 @@ class hi extends _1 {
|
|
|
7286
7292
|
toLoad: Object.keys(a),
|
|
7287
7293
|
pending: Object.keys(c),
|
|
7288
7294
|
toLoadLanguages: Object.keys(o),
|
|
7289
|
-
toLoadNamespaces: Object.keys(
|
|
7295
|
+
toLoadNamespaces: Object.keys(u)
|
|
7290
7296
|
};
|
|
7291
7297
|
}
|
|
7292
7298
|
loaded(e, t, n) {
|
|
@@ -7295,15 +7301,15 @@ class hi extends _1 {
|
|
|
7295
7301
|
skipCopy: !0
|
|
7296
7302
|
}), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
7297
7303
|
const o = {};
|
|
7298
|
-
this.queue.forEach((
|
|
7299
|
-
P5(
|
|
7304
|
+
this.queue.forEach((u) => {
|
|
7305
|
+
P5(u.loaded, [a], c), li(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((d) => {
|
|
7300
7306
|
o[d] || (o[d] = {});
|
|
7301
|
-
const l =
|
|
7307
|
+
const l = u.loaded[d];
|
|
7302
7308
|
l.length && l.forEach((h) => {
|
|
7303
7309
|
o[d][h] === void 0 && (o[d][h] = !0);
|
|
7304
7310
|
});
|
|
7305
|
-
}),
|
|
7306
|
-
}), this.emit("loaded", o), this.queue = this.queue.filter((
|
|
7311
|
+
}), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
|
|
7312
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((u) => !u.done);
|
|
7307
7313
|
}
|
|
7308
7314
|
read(e, t, n) {
|
|
7309
7315
|
let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, c = arguments.length > 5 ? arguments[5] : void 0;
|
|
@@ -7332,23 +7338,23 @@ class hi extends _1 {
|
|
|
7332
7338
|
return;
|
|
7333
7339
|
}
|
|
7334
7340
|
c(d, l);
|
|
7335
|
-
},
|
|
7336
|
-
if (
|
|
7341
|
+
}, u = this.backend[n].bind(this.backend);
|
|
7342
|
+
if (u.length === 2) {
|
|
7337
7343
|
try {
|
|
7338
|
-
const d =
|
|
7344
|
+
const d = u(e, t);
|
|
7339
7345
|
d && typeof d.then == "function" ? d.then((l) => o(null, l)).catch(o) : o(null, d);
|
|
7340
7346
|
} catch (d) {
|
|
7341
7347
|
o(d);
|
|
7342
7348
|
}
|
|
7343
7349
|
return;
|
|
7344
7350
|
}
|
|
7345
|
-
return
|
|
7351
|
+
return u(e, t, o);
|
|
7346
7352
|
}
|
|
7347
7353
|
prepareLoading(e, t) {
|
|
7348
7354
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 ? arguments[3] : void 0;
|
|
7349
7355
|
if (!this.backend)
|
|
7350
7356
|
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
|
|
7351
|
-
|
|
7357
|
+
M(e) && (e = this.languageUtils.toResolveHierarchy(e)), M(t) && (t = [t]);
|
|
7352
7358
|
const a = this.queueLoad(e, t, n, s);
|
|
7353
7359
|
if (!a.toLoad.length)
|
|
7354
7360
|
return a.pending.length || s(), null;
|
|
@@ -7380,19 +7386,19 @@ class hi extends _1 {
|
|
|
7380
7386
|
}
|
|
7381
7387
|
if (!(n == null || n === "")) {
|
|
7382
7388
|
if (this.backend && this.backend.create) {
|
|
7383
|
-
const
|
|
7389
|
+
const u = {
|
|
7384
7390
|
...c,
|
|
7385
7391
|
isUpdate: a
|
|
7386
7392
|
}, d = this.backend.create.bind(this.backend);
|
|
7387
7393
|
if (d.length < 6)
|
|
7388
7394
|
try {
|
|
7389
7395
|
let l;
|
|
7390
|
-
d.length === 5 ? l = d(e, t, n, s,
|
|
7396
|
+
d.length === 5 ? l = d(e, t, n, s, u) : l = d(e, t, n, s), l && typeof l.then == "function" ? l.then((h) => o(null, h)).catch(o) : o(null, l);
|
|
7391
7397
|
} catch (l) {
|
|
7392
7398
|
o(l);
|
|
7393
7399
|
}
|
|
7394
7400
|
else
|
|
7395
|
-
d(e, t, n, s, o,
|
|
7401
|
+
d(e, t, n, s, o, u);
|
|
7396
7402
|
}
|
|
7397
7403
|
!e || !e[0] || this.store.addResource(e[0], t, n, s);
|
|
7398
7404
|
}
|
|
@@ -7433,7 +7439,7 @@ const ee = () => ({
|
|
|
7433
7439
|
appendNamespaceToCIMode: !1,
|
|
7434
7440
|
overloadTranslationOptionHandler: (i) => {
|
|
7435
7441
|
let e = {};
|
|
7436
|
-
if (typeof i[1] == "object" && (e = i[1]),
|
|
7442
|
+
if (typeof i[1] == "object" && (e = i[1]), M(i[1]) && (e.defaultValue = i[1]), M(i[2]) && (e.tDescription = i[2]), typeof i[2] == "object" || typeof i[3] == "object") {
|
|
7437
7443
|
const t = i[3] || i[2];
|
|
7438
7444
|
Object.keys(t).forEach((n) => {
|
|
7439
7445
|
e[n] = t[n];
|
|
@@ -7454,7 +7460,7 @@ const ee = () => ({
|
|
|
7454
7460
|
maxReplaces: 1e3,
|
|
7455
7461
|
skipOnVariables: !0
|
|
7456
7462
|
}
|
|
7457
|
-
}), te = (i) => (
|
|
7463
|
+
}), te = (i) => (M(i.ns) && (i.ns = [i.ns]), M(i.fallbackLng) && (i.fallbackLng = [i.fallbackLng]), M(i.fallbackNS) && (i.fallbackNS = [i.fallbackNS]), i.supportedLngs && i.supportedLngs.indexOf("cimode") < 0 && (i.supportedLngs = i.supportedLngs.concat(["cimode"])), i), x1 = () => {
|
|
7458
7464
|
}, ci = (i) => {
|
|
7459
7465
|
Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t) => {
|
|
7460
7466
|
typeof i[t] == "function" && (i[t] = i[t].bind(i));
|
|
@@ -7476,7 +7482,7 @@ class w1 extends _1 {
|
|
|
7476
7482
|
init() {
|
|
7477
7483
|
var e = this;
|
|
7478
7484
|
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0;
|
|
7479
|
-
this.isInitializing = !0, typeof t == "function" && (n = t, t = {}), !t.defaultNS && t.defaultNS !== !1 && t.ns && (
|
|
7485
|
+
this.isInitializing = !0, typeof t == "function" && (n = t, t = {}), !t.defaultNS && t.defaultNS !== !1 && t.ns && (M(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
|
|
7480
7486
|
const s = ee();
|
|
7481
7487
|
this.options = {
|
|
7482
7488
|
...s,
|
|
@@ -7493,20 +7499,20 @@ class w1 extends _1 {
|
|
|
7493
7499
|
this.modules.formatter ? l = this.modules.formatter : typeof Intl < "u" && (l = ai);
|
|
7494
7500
|
const h = new q1(this.options);
|
|
7495
7501
|
this.store = new z1(this.options.resources, this.options);
|
|
7496
|
-
const
|
|
7497
|
-
|
|
7502
|
+
const g = this.services;
|
|
7503
|
+
g.logger = J, g.resourceStore = this.store, g.languageUtils = h, g.pluralResolver = new si(h, {
|
|
7498
7504
|
prepend: this.options.pluralSeparator,
|
|
7499
7505
|
compatibilityJSON: this.options.compatibilityJSON,
|
|
7500
7506
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
7501
|
-
}), l && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (
|
|
7507
|
+
}), l && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (g.formatter = a(l), g.formatter.init(g, this.options), this.options.interpolation.format = g.formatter.format.bind(g.formatter)), g.interpolator = new ri(this.options), g.utils = {
|
|
7502
7508
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
7503
|
-
},
|
|
7504
|
-
for (var
|
|
7505
|
-
v[
|
|
7509
|
+
}, g.backendConnector = new hi(a(this.modules.backend), g.resourceStore, g, this.options), g.backendConnector.on("*", function(p) {
|
|
7510
|
+
for (var w = arguments.length, v = new Array(w > 1 ? w - 1 : 0), m = 1; m < w; m++)
|
|
7511
|
+
v[m - 1] = arguments[m];
|
|
7506
7512
|
e.emit(p, ...v);
|
|
7507
|
-
}), this.modules.languageDetector && (
|
|
7508
|
-
for (var
|
|
7509
|
-
v[
|
|
7513
|
+
}), this.modules.languageDetector && (g.languageDetector = a(this.modules.languageDetector), g.languageDetector.init && g.languageDetector.init(g, this.options.detection, this.options)), this.modules.i18nFormat && (g.i18nFormat = a(this.modules.i18nFormat), g.i18nFormat.init && g.i18nFormat.init(this)), this.translator = new y1(this.services, this.options), this.translator.on("*", function(p) {
|
|
7514
|
+
for (var w = arguments.length, v = new Array(w > 1 ? w - 1 : 0), m = 1; m < w; m++)
|
|
7515
|
+
v[m - 1] = arguments[m];
|
|
7510
7516
|
e.emit(p, ...v);
|
|
7511
7517
|
}), this.modules.external.forEach((p) => {
|
|
7512
7518
|
p.init && p.init(this);
|
|
@@ -7525,18 +7531,18 @@ class w1 extends _1 {
|
|
|
7525
7531
|
return e.store[l](...arguments), e;
|
|
7526
7532
|
};
|
|
7527
7533
|
});
|
|
7528
|
-
const
|
|
7529
|
-
const l = (h,
|
|
7530
|
-
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),
|
|
7534
|
+
const u = C1(), d = () => {
|
|
7535
|
+
const l = (h, g) => {
|
|
7536
|
+
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), u.resolve(g), n(h, g);
|
|
7531
7537
|
};
|
|
7532
7538
|
if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return l(null, this.t.bind(this));
|
|
7533
7539
|
this.changeLanguage(this.options.lng, l);
|
|
7534
7540
|
};
|
|
7535
|
-
return this.options.resources || !this.options.initImmediate ? d() : setTimeout(d, 0),
|
|
7541
|
+
return this.options.resources || !this.options.initImmediate ? d() : setTimeout(d, 0), u;
|
|
7536
7542
|
}
|
|
7537
7543
|
loadResources(e) {
|
|
7538
7544
|
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x1;
|
|
7539
|
-
const s =
|
|
7545
|
+
const s = M(e) ? e : this.language;
|
|
7540
7546
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
7541
7547
|
if (s && s.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
7542
7548
|
const a = [], c = (o) => {
|
|
@@ -7545,7 +7551,7 @@ class w1 extends _1 {
|
|
|
7545
7551
|
d !== "cimode" && a.indexOf(d) < 0 && a.push(d);
|
|
7546
7552
|
});
|
|
7547
7553
|
};
|
|
7548
|
-
s ? c(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((
|
|
7554
|
+
s ? c(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((u) => c(u)), this.options.preload && this.options.preload.forEach((o) => c(o)), this.services.backendConnector.load(a, this.options.ns, (o) => {
|
|
7549
7555
|
!o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(o);
|
|
7550
7556
|
});
|
|
7551
7557
|
} else
|
|
@@ -7560,7 +7566,7 @@ class w1 extends _1 {
|
|
|
7560
7566
|
use(e) {
|
|
7561
7567
|
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
7562
7568
|
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
7563
|
-
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" &&
|
|
7569
|
+
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" && ge.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
7564
7570
|
}
|
|
7565
7571
|
setResolvedLanguage(e) {
|
|
7566
7572
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
|
|
@@ -7577,17 +7583,17 @@ class w1 extends _1 {
|
|
|
7577
7583
|
this.isLanguageChangingTo = e;
|
|
7578
7584
|
const s = C1();
|
|
7579
7585
|
this.emit("languageChanging", e);
|
|
7580
|
-
const a = (
|
|
7581
|
-
this.language =
|
|
7582
|
-
}, c = (
|
|
7586
|
+
const a = (u) => {
|
|
7587
|
+
this.language = u, this.languages = this.services.languageUtils.toResolveHierarchy(u), this.resolvedLanguage = void 0, this.setResolvedLanguage(u);
|
|
7588
|
+
}, c = (u, d) => {
|
|
7583
7589
|
d ? (a(d), this.translator.changeLanguage(d), this.isLanguageChangingTo = void 0, this.emit("languageChanged", d), this.logger.log("languageChanged", d)) : this.isLanguageChangingTo = void 0, s.resolve(function() {
|
|
7584
7590
|
return n.t(...arguments);
|
|
7585
|
-
}), t && t(
|
|
7591
|
+
}), t && t(u, function() {
|
|
7586
7592
|
return n.t(...arguments);
|
|
7587
7593
|
});
|
|
7588
|
-
}, o = (
|
|
7589
|
-
!e && !
|
|
7590
|
-
const d =
|
|
7594
|
+
}, o = (u) => {
|
|
7595
|
+
!e && !u && this.services.languageDetector && (u = []);
|
|
7596
|
+
const d = M(u) ? u : this.services.languageUtils.getBestMatchFromCodes(u);
|
|
7591
7597
|
d && (this.language || a(d), this.translator.language || this.translator.changeLanguage(d), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(d)), this.loadResources(d, (l) => {
|
|
7592
7598
|
c(l, d);
|
|
7593
7599
|
});
|
|
@@ -7597,21 +7603,21 @@ class w1 extends _1 {
|
|
|
7597
7603
|
getFixedT(e, t, n) {
|
|
7598
7604
|
var s = this;
|
|
7599
7605
|
const a = function(c, o) {
|
|
7600
|
-
let
|
|
7606
|
+
let u;
|
|
7601
7607
|
if (typeof o != "object") {
|
|
7602
7608
|
for (var d = arguments.length, l = new Array(d > 2 ? d - 2 : 0), h = 2; h < d; h++)
|
|
7603
7609
|
l[h - 2] = arguments[h];
|
|
7604
|
-
|
|
7610
|
+
u = s.options.overloadTranslationOptionHandler([c, o].concat(l));
|
|
7605
7611
|
} else
|
|
7606
|
-
|
|
7612
|
+
u = {
|
|
7607
7613
|
...o
|
|
7608
7614
|
};
|
|
7609
|
-
|
|
7610
|
-
const
|
|
7615
|
+
u.lng = u.lng || a.lng, u.lngs = u.lngs || a.lngs, u.ns = u.ns || a.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || n || a.keyPrefix);
|
|
7616
|
+
const g = s.options.keySeparator || ".";
|
|
7611
7617
|
let p;
|
|
7612
|
-
return
|
|
7618
|
+
return u.keyPrefix && Array.isArray(c) ? p = c.map((w) => `${u.keyPrefix}${g}${w}`) : p = u.keyPrefix ? `${u.keyPrefix}${g}${c}` : c, s.t(p, u);
|
|
7613
7619
|
};
|
|
7614
|
-
return
|
|
7620
|
+
return M(e) ? a.lng = e : a.lngs = e, a.ns = t, a.keyPrefix = n, a;
|
|
7615
7621
|
}
|
|
7616
7622
|
t() {
|
|
7617
7623
|
return this.translator && this.translator.translate(...arguments);
|
|
@@ -7630,8 +7636,8 @@ class w1 extends _1 {
|
|
|
7630
7636
|
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
7631
7637
|
const n = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, a = this.languages[this.languages.length - 1];
|
|
7632
7638
|
if (n.toLowerCase() === "cimode") return !0;
|
|
7633
|
-
const c = (o,
|
|
7634
|
-
const d = this.services.backendConnector.state[`${o}|${
|
|
7639
|
+
const c = (o, u) => {
|
|
7640
|
+
const d = this.services.backendConnector.state[`${o}|${u}`];
|
|
7635
7641
|
return d === -1 || d === 0 || d === 2;
|
|
7636
7642
|
};
|
|
7637
7643
|
if (t.precheck) {
|
|
@@ -7642,7 +7648,7 @@ class w1 extends _1 {
|
|
|
7642
7648
|
}
|
|
7643
7649
|
loadNamespaces(e, t) {
|
|
7644
7650
|
const n = C1();
|
|
7645
|
-
return this.options.ns ? (
|
|
7651
|
+
return this.options.ns ? (M(e) && (e = [e]), e.forEach((s) => {
|
|
7646
7652
|
this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
|
|
7647
7653
|
}), this.loadResources((s) => {
|
|
7648
7654
|
n.resolve(), t && t(s);
|
|
@@ -7650,7 +7656,7 @@ class w1 extends _1 {
|
|
|
7650
7656
|
}
|
|
7651
7657
|
loadLanguages(e, t) {
|
|
7652
7658
|
const n = C1();
|
|
7653
|
-
|
|
7659
|
+
M(e) && (e = [e]);
|
|
7654
7660
|
const s = this.options.preload || [], a = e.filter((c) => s.indexOf(c) < 0 && this.services.languageUtils.isSupportedCode(c));
|
|
7655
7661
|
return a.length ? (this.options.preload = s.concat(a), this.loadResources((c) => {
|
|
7656
7662
|
n.resolve(), t && t(c);
|
|
@@ -7681,7 +7687,7 @@ class w1 extends _1 {
|
|
|
7681
7687
|
}, a.services.utils = {
|
|
7682
7688
|
hasLoadedNamespace: a.hasLoadedNamespace.bind(a)
|
|
7683
7689
|
}, n && (a.store = new z1(this.store.data, s), a.services.resourceStore = a.store), a.translator = new y1(a.services, s), a.translator.on("*", function(o) {
|
|
7684
|
-
for (var
|
|
7690
|
+
for (var u = arguments.length, d = new Array(u > 1 ? u - 1 : 0), l = 1; l < u; l++)
|
|
7685
7691
|
d[l - 1] = arguments[l];
|
|
7686
7692
|
a.emit(o, ...d);
|
|
7687
7693
|
}), a.init(s, t), a.translator.options = s, a.translator.backendConnector.services.utils = {
|
|
@@ -7744,23 +7750,23 @@ const Ce = (i, e) => () => {
|
|
|
7744
7750
|
s1(t) && (t = [t]), t.forEach((s) => {
|
|
7745
7751
|
i.options.ns.indexOf(s) < 0 && i.options.ns.push(s);
|
|
7746
7752
|
}), i.loadLanguages(e, Ce(i, n));
|
|
7747
|
-
},
|
|
7753
|
+
}, ui = function(i, e) {
|
|
7748
7754
|
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
7749
7755
|
const n = e.languages[0], s = e.options ? e.options.fallbackLng : !1, a = e.languages[e.languages.length - 1];
|
|
7750
7756
|
if (n.toLowerCase() === "cimode") return !0;
|
|
7751
|
-
const c = (o,
|
|
7752
|
-
const d = e.services.backendConnector.state[`${o}|${
|
|
7757
|
+
const c = (o, u) => {
|
|
7758
|
+
const d = e.services.backendConnector.state[`${o}|${u}`];
|
|
7753
7759
|
return d === -1 || d === 2;
|
|
7754
7760
|
};
|
|
7755
7761
|
return t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !c(e.isLanguageChangingTo, i) ? !1 : !!(e.hasResourceBundle(n, i) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || c(n, i) && (!s || c(a, i)));
|
|
7756
|
-
},
|
|
7762
|
+
}, gi = function(i, e) {
|
|
7757
7763
|
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
7758
7764
|
return !e.languages || !e.languages.length ? (A1("i18n.languages were undefined or empty", e.languages), !0) : e.options.ignoreJSONStructure !== void 0 ? e.hasLoadedNamespace(i, {
|
|
7759
7765
|
lng: t.lng,
|
|
7760
7766
|
precheck: (s, a) => {
|
|
7761
7767
|
if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && s.services.backendConnector.backend && s.isLanguageChangingTo && !a(s.isLanguageChangingTo, i)) return !1;
|
|
7762
7768
|
}
|
|
7763
|
-
}) :
|
|
7769
|
+
}) : ui(i, e, t);
|
|
7764
7770
|
}, s1 = (i) => typeof i == "string", Ci = (i) => typeof i == "object" && i !== null, pi = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, fi = {
|
|
7765
7771
|
"&": "&",
|
|
7766
7772
|
"&": "&",
|
|
@@ -7811,7 +7817,7 @@ const vi = (i) => {
|
|
|
7811
7817
|
}, Ri = d1();
|
|
7812
7818
|
class Mi {
|
|
7813
7819
|
constructor() {
|
|
7814
|
-
|
|
7820
|
+
B1(this, "getUsedNamespaces", () => Object.keys(this.usedNamespaces));
|
|
7815
7821
|
this.usedNamespaces = {};
|
|
7816
7822
|
}
|
|
7817
7823
|
addUsedNamespaces(e) {
|
|
@@ -7845,35 +7851,35 @@ const bi = (i, e) => {
|
|
|
7845
7851
|
...e
|
|
7846
7852
|
}, {
|
|
7847
7853
|
useSuspense: o,
|
|
7848
|
-
keyPrefix:
|
|
7854
|
+
keyPrefix: u
|
|
7849
7855
|
} = c;
|
|
7850
7856
|
let d = i;
|
|
7851
7857
|
d = s1(d) ? [d] : d || ["translation"], a.reportNamespaces.addUsedNamespaces && a.reportNamespaces.addUsedNamespaces(d);
|
|
7852
|
-
const l = (a.isInitialized || a.initializedStoreOnce) && d.every((f) =>
|
|
7853
|
-
let
|
|
7854
|
-
e.lng && (
|
|
7855
|
-
const _ = bi(
|
|
7858
|
+
const l = (a.isInitialized || a.initializedStoreOnce) && d.every((f) => gi(f, a, c)), h = yi(a, e.lng || null, c.nsMode === "fallback" ? d : d[0], u), g = () => h, p = () => fe(a, e.lng || null, c.nsMode === "fallback" ? d : d[0], u), [w, v] = V(g);
|
|
7859
|
+
let m = d.join();
|
|
7860
|
+
e.lng && (m = `${e.lng}${m}`);
|
|
7861
|
+
const _ = bi(m), R = Y(!0);
|
|
7856
7862
|
T(() => {
|
|
7857
7863
|
const {
|
|
7858
7864
|
bindI18n: f,
|
|
7859
7865
|
bindI18nStore: k
|
|
7860
7866
|
} = c;
|
|
7861
|
-
|
|
7862
|
-
|
|
7867
|
+
R.current = !0, !l && !o && (e.lng ? se(a, e.lng, d, () => {
|
|
7868
|
+
R.current && v(p);
|
|
7863
7869
|
}) : ne(a, d, () => {
|
|
7864
|
-
|
|
7865
|
-
})), l && _ && _ !==
|
|
7870
|
+
R.current && v(p);
|
|
7871
|
+
})), l && _ && _ !== m && R.current && v(p);
|
|
7866
7872
|
const x = () => {
|
|
7867
|
-
|
|
7873
|
+
R.current && v(p);
|
|
7868
7874
|
};
|
|
7869
7875
|
return f && a && a.on(f, x), k && a && a.store.on(k, x), () => {
|
|
7870
|
-
|
|
7876
|
+
R.current = !1, f && a && f.split(" ").forEach((L) => a.off(L, x)), k && a && k.split(" ").forEach((L) => a.store.off(L, x));
|
|
7871
7877
|
};
|
|
7872
|
-
}, [a,
|
|
7873
|
-
|
|
7874
|
-
}, [a,
|
|
7875
|
-
const H = [
|
|
7876
|
-
if (H.t =
|
|
7878
|
+
}, [a, m]), T(() => {
|
|
7879
|
+
R.current && l && v(g);
|
|
7880
|
+
}, [a, u, l]);
|
|
7881
|
+
const H = [w, a, l];
|
|
7882
|
+
if (H.t = w, H.i18n = a, H.ready = l, l || !l && !o) return H;
|
|
7877
7883
|
throw new Promise((f) => {
|
|
7878
7884
|
e.lng ? se(a, e.lng, d, () => f()) : ne(a, d, () => f());
|
|
7879
7885
|
});
|
|
@@ -7902,17 +7908,17 @@ W.use(xi).init({
|
|
|
7902
7908
|
});
|
|
7903
7909
|
const ji = k1(
|
|
7904
7910
|
({ width: i, selectedCountry: e, onChange: t, value: n, id: s, disabled: a, clearable: c }, o) => {
|
|
7905
|
-
const [
|
|
7911
|
+
const [u, d] = V(
|
|
7906
7912
|
[]
|
|
7907
|
-
), [l, h] = V(!1), { locale:
|
|
7913
|
+
), [l, h] = V(!1), { locale: g, axiosPeople: p } = r1(Le), w = Y(!1), v = Y(null), m = Y(u), _ = Si(e);
|
|
7908
7914
|
if (!p)
|
|
7909
7915
|
throw new Error(
|
|
7910
7916
|
`CitySelect requires "axiosPeople" to fetch cities.
|
|
7911
7917
|
Please provide it via SNMTUiContext.`
|
|
7912
7918
|
);
|
|
7913
|
-
const { t:
|
|
7919
|
+
const { t: R } = Ei("common", { lng: g }), H = j(
|
|
7914
7920
|
async (k) => {
|
|
7915
|
-
const x =
|
|
7921
|
+
const x = m.current.find((L) => L.value === k);
|
|
7916
7922
|
if (x)
|
|
7917
7923
|
return [x];
|
|
7918
7924
|
try {
|
|
@@ -7928,7 +7934,7 @@ const ji = k1(
|
|
|
7928
7934
|
value: I[0].geoNameId,
|
|
7929
7935
|
label: I[0].name
|
|
7930
7936
|
};
|
|
7931
|
-
return
|
|
7937
|
+
return m.current = [...m.current, Z], [Z];
|
|
7932
7938
|
} catch (L) {
|
|
7933
7939
|
return console.error("CitySelect. fetchSelectedItems error", L), [];
|
|
7934
7940
|
}
|
|
@@ -7943,7 +7949,7 @@ const ji = k1(
|
|
|
7943
7949
|
})();
|
|
7944
7950
|
}, []), T(() => {
|
|
7945
7951
|
var k;
|
|
7946
|
-
_ !== e ?
|
|
7952
|
+
_ !== e ? w.current && (t(null), d([]), m.current = [], (k = v.current) == null || k.refetchOptions()) : w.current = !0;
|
|
7947
7953
|
}, [e, t, _]);
|
|
7948
7954
|
const f = j(
|
|
7949
7955
|
async ({
|
|
@@ -7959,9 +7965,9 @@ const ji = k1(
|
|
|
7959
7965
|
includeCount: !0
|
|
7960
7966
|
};
|
|
7961
7967
|
I.filters = {}, e && e.length > 0 && (I.filters.countryId = [e]), L && (I.search = L);
|
|
7962
|
-
const Z = await p.post("v1/cities/search", I),
|
|
7968
|
+
const Z = await p.post("v1/cities/search", I), D = (Z == null ? void 0 : Z.data.data) || [], G = Z == null ? void 0 : Z.data.metadata.count;
|
|
7963
7969
|
return {
|
|
7964
|
-
options:
|
|
7970
|
+
options: D.map((O) => ({
|
|
7965
7971
|
value: O.geoNameId,
|
|
7966
7972
|
label: O.name
|
|
7967
7973
|
})),
|
|
@@ -7989,12 +7995,12 @@ const ji = k1(
|
|
|
7989
7995
|
onChange: t,
|
|
7990
7996
|
ref: v,
|
|
7991
7997
|
search: !0,
|
|
7992
|
-
placeholder:
|
|
7998
|
+
placeholder: R("placeholder"),
|
|
7993
7999
|
disabled: a,
|
|
7994
8000
|
clearable: c,
|
|
7995
8001
|
loadOptions: f,
|
|
7996
8002
|
preloadOptions: !0,
|
|
7997
|
-
extraOptions:
|
|
8003
|
+
extraOptions: u,
|
|
7998
8004
|
isLoading: l
|
|
7999
8005
|
}
|
|
8000
8006
|
) });
|