@txgw/payout-components 0.2.0 → 0.2.2
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/{amis-CjYQbrSm.js → amis-CLFtZoO7.js} +26 -26
- package/dist/component-beneficiary-form-CvWbQOoI.js +359 -0
- package/dist/en-Cb5xUNU4.js +7 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +54 -31
- package/dist/{vendor-fKhExfo_.js → vendor-D9Vb1NW1.js} +1399 -1400
- package/package.json +9 -12
- package/dist/component-beneficiary-form-ZOQLPYQM.js +0 -344
|
@@ -1542,7 +1542,1355 @@ const mr = /* @__PURE__ */ ya(Fn), a_n = /* @__PURE__ */ s4({
|
|
|
1542
1542
|
__proto__: null,
|
|
1543
1543
|
default: mr
|
|
1544
1544
|
}, [Fn]);
|
|
1545
|
-
|
|
1545
|
+
function xft(r) {
|
|
1546
|
+
return !!(r && typeof r.then == "function");
|
|
1547
|
+
}
|
|
1548
|
+
function oIe(r, e) {
|
|
1549
|
+
return xft(r) ? Promise.resolve(r).then(e) : e(r);
|
|
1550
|
+
}
|
|
1551
|
+
function cxt(r) {
|
|
1552
|
+
const e = (Array.isArray(r) ? r : [r]).map((o) => `'${o}'`), t = e.slice(-2).join(" or ");
|
|
1553
|
+
return `Mi18n: You need to specify ${[...e.slice(0, -2), t].join(", ")} option`;
|
|
1554
|
+
}
|
|
1555
|
+
function s_n(r) {
|
|
1556
|
+
return typeof r == "object" && !Array.isArray(r) && r !== null;
|
|
1557
|
+
}
|
|
1558
|
+
function _Xt(r) {
|
|
1559
|
+
if (typeof r == "string")
|
|
1560
|
+
return [r];
|
|
1561
|
+
if (Array.isArray(r))
|
|
1562
|
+
return r;
|
|
1563
|
+
}
|
|
1564
|
+
function wN(r) {
|
|
1565
|
+
return _Xt(r) || [];
|
|
1566
|
+
}
|
|
1567
|
+
function l_n(r, e) {
|
|
1568
|
+
return s_n(e) ? wN(e?.[r]) : wN(e);
|
|
1569
|
+
}
|
|
1570
|
+
function rit(r) {
|
|
1571
|
+
return Array.from(new Set(r));
|
|
1572
|
+
}
|
|
1573
|
+
function xXt(r) {
|
|
1574
|
+
return r && r.replace(/\/+$/, "");
|
|
1575
|
+
}
|
|
1576
|
+
function c_n(r) {
|
|
1577
|
+
if (typeof r == "string")
|
|
1578
|
+
return r;
|
|
1579
|
+
if (typeof r?.message == "string")
|
|
1580
|
+
return r.message;
|
|
1581
|
+
}
|
|
1582
|
+
const u_n = (r, e) => fetch(r, e), wXt = (r = u_n) => (e, t) => r(e, Object.assign(Object.assign({}, t), { headers: Object.assign({ "X-Mi18n-SDK-Type": "JS", "X-Mi18n-SDK-Version": "5.16.2" }, t?.headers) }));
|
|
1583
|
+
function mZ(r) {
|
|
1584
|
+
let e = [];
|
|
1585
|
+
return Object.freeze({
|
|
1586
|
+
listen(t) {
|
|
1587
|
+
const n = (i) => {
|
|
1588
|
+
t(i);
|
|
1589
|
+
};
|
|
1590
|
+
return e.push(n), {
|
|
1591
|
+
unsubscribe() {
|
|
1592
|
+
e = e.filter((i) => n !== i);
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
},
|
|
1596
|
+
emit(t) {
|
|
1597
|
+
r() && e.forEach((n) => n({ value: t }));
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
function d_n(r, e, t) {
|
|
1602
|
+
const n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
1603
|
+
function o(l) {
|
|
1604
|
+
const c = new Set(e());
|
|
1605
|
+
i.forEach((u) => {
|
|
1606
|
+
(l === void 0 || l?.findIndex((f) => c.has(f) || u.namespaces.has(f)) !== -1) && u.fn({ value: void 0 });
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
let a = [];
|
|
1610
|
+
function s() {
|
|
1611
|
+
if (a.length === 0)
|
|
1612
|
+
return;
|
|
1613
|
+
const l = a;
|
|
1614
|
+
a = [], n.forEach((d) => {
|
|
1615
|
+
d({ value: void 0 });
|
|
1616
|
+
});
|
|
1617
|
+
let c = /* @__PURE__ */ new Set();
|
|
1618
|
+
l.forEach((d) => {
|
|
1619
|
+
d === void 0 ? c = void 0 : c !== void 0 && d.forEach((f) => c.add(f));
|
|
1620
|
+
});
|
|
1621
|
+
const u = c ? Array.from(c.keys()) : void 0;
|
|
1622
|
+
o(u);
|
|
1623
|
+
}
|
|
1624
|
+
return Object.freeze({
|
|
1625
|
+
emit(l, c) {
|
|
1626
|
+
r() && (a.push(l), c ? setTimeout(s, 0) : s());
|
|
1627
|
+
},
|
|
1628
|
+
listen(l) {
|
|
1629
|
+
return n.add(l), {
|
|
1630
|
+
unsubscribe: () => {
|
|
1631
|
+
n.delete(l);
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
},
|
|
1635
|
+
listenSome(l) {
|
|
1636
|
+
const c = {
|
|
1637
|
+
fn: (d) => {
|
|
1638
|
+
l(d);
|
|
1639
|
+
},
|
|
1640
|
+
namespaces: /* @__PURE__ */ new Set()
|
|
1641
|
+
};
|
|
1642
|
+
i.add(c);
|
|
1643
|
+
const u = {
|
|
1644
|
+
unsubscribe: () => {
|
|
1645
|
+
i.delete(c);
|
|
1646
|
+
},
|
|
1647
|
+
subscribeNs: (d) => (wN(d).forEach((f) => c.namespaces.add(f)), d === void 0 && c.namespaces.add(t()), u)
|
|
1648
|
+
};
|
|
1649
|
+
return u;
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function f_n(r, e) {
|
|
1654
|
+
let t = !0;
|
|
1655
|
+
function n() {
|
|
1656
|
+
return t;
|
|
1657
|
+
}
|
|
1658
|
+
const i = Object.freeze({
|
|
1659
|
+
onPendingLanguageChange: mZ(n),
|
|
1660
|
+
onLanguageChange: mZ(n),
|
|
1661
|
+
onLoadingChange: mZ(n),
|
|
1662
|
+
onFetchingChange: mZ(n),
|
|
1663
|
+
onInitialLoaded: mZ(n),
|
|
1664
|
+
onRunningChange: mZ(n),
|
|
1665
|
+
onCacheChange: mZ(n),
|
|
1666
|
+
onUpdate: d_n(n, r, e),
|
|
1667
|
+
onPermanentChange: mZ(n),
|
|
1668
|
+
setEmitterActive(o) {
|
|
1669
|
+
t = o;
|
|
1670
|
+
},
|
|
1671
|
+
on: ((o, a) => {
|
|
1672
|
+
switch (o) {
|
|
1673
|
+
case "pendingLanguage":
|
|
1674
|
+
return i.onPendingLanguageChange.listen(a);
|
|
1675
|
+
case "language":
|
|
1676
|
+
return i.onLanguageChange.listen(a);
|
|
1677
|
+
case "loading":
|
|
1678
|
+
return i.onLoadingChange.listen(a);
|
|
1679
|
+
case "fetching":
|
|
1680
|
+
return i.onFetchingChange.listen(a);
|
|
1681
|
+
case "initialLoad":
|
|
1682
|
+
return i.onInitialLoaded.listen(a);
|
|
1683
|
+
case "running":
|
|
1684
|
+
return i.onRunningChange.listen(a);
|
|
1685
|
+
case "cache":
|
|
1686
|
+
return i.onCacheChange.listen(a);
|
|
1687
|
+
case "update":
|
|
1688
|
+
return i.onUpdate.listen(a);
|
|
1689
|
+
case "permanentChange":
|
|
1690
|
+
return i.onPermanentChange.listen(a);
|
|
1691
|
+
}
|
|
1692
|
+
})
|
|
1693
|
+
});
|
|
1694
|
+
return i.onInitialLoaded.listen(() => i.onUpdate.emit()), i.onLanguageChange.listen(() => i.onUpdate.emit()), i.onCacheChange.listen(({ value: o }) => i.onUpdate.emit([o.namespace], !0)), i;
|
|
1695
|
+
}
|
|
1696
|
+
const AXt = (r) => {
|
|
1697
|
+
const e = /* @__PURE__ */ new Map();
|
|
1698
|
+
return Object.entries(r).forEach(([t, n]) => {
|
|
1699
|
+
if (n != null) {
|
|
1700
|
+
if (typeof n == "object") {
|
|
1701
|
+
AXt(n).forEach((i, o) => {
|
|
1702
|
+
e.set(t + "." + o, i);
|
|
1703
|
+
});
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
e.set(t, n);
|
|
1707
|
+
}
|
|
1708
|
+
}), e;
|
|
1709
|
+
}, FSe = (r) => {
|
|
1710
|
+
const [e, ...t] = r.split(":"), n = t.join(":");
|
|
1711
|
+
return { language: e, namespace: n || "" };
|
|
1712
|
+
}, S$ = ({ language: r, namespace: e }) => e ? `${r}:${e}` : r;
|
|
1713
|
+
function h_n(r, e, t, n, i, o, a) {
|
|
1714
|
+
const s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
1715
|
+
let c = {}, u = 0;
|
|
1716
|
+
function d(y, x, M) {
|
|
1717
|
+
const S = S$(y);
|
|
1718
|
+
l.set(S, {
|
|
1719
|
+
data: AXt(x),
|
|
1720
|
+
version: M
|
|
1721
|
+
}), r.emit(y);
|
|
1722
|
+
}
|
|
1723
|
+
function f(y) {
|
|
1724
|
+
let x;
|
|
1725
|
+
if (!x) {
|
|
1726
|
+
const M = c[S$(y)];
|
|
1727
|
+
typeof M == "function" && (x = M());
|
|
1728
|
+
}
|
|
1729
|
+
return x || (x = e(y)), x;
|
|
1730
|
+
}
|
|
1731
|
+
function g(y, x) {
|
|
1732
|
+
var M;
|
|
1733
|
+
let S;
|
|
1734
|
+
return x && (S = (M = t(y)) === null || M === void 0 ? void 0 : M.catch(() => (console.warn("Mi18n: Failed to fetch data from dev backend"), f(y)))), S || (S = f(y)), S;
|
|
1735
|
+
}
|
|
1736
|
+
const v = Object.freeze({
|
|
1737
|
+
addStaticData(y) {
|
|
1738
|
+
y && (c = Object.assign(Object.assign({}, c), y), Object.entries(y).forEach(([x, M]) => {
|
|
1739
|
+
if (typeof M != "function") {
|
|
1740
|
+
const S = FSe(x), C = l.get(x);
|
|
1741
|
+
(!C || C.version === 0) && (d(S, M, 0), v.addNamespaceRecord(S, M, 0));
|
|
1742
|
+
}
|
|
1743
|
+
}));
|
|
1744
|
+
},
|
|
1745
|
+
invalidate() {
|
|
1746
|
+
s.clear(), u += 1;
|
|
1747
|
+
},
|
|
1748
|
+
addNamespaceRecord(y, x, M) {
|
|
1749
|
+
!y.namespace && Object.values(x).some((S) => typeof S == "object" && S) && Object.entries(x).forEach(([S, C]) => {
|
|
1750
|
+
typeof C == "object" && C && d(Object.assign(Object.assign({}, y), { namespace: S }), C, M);
|
|
1751
|
+
});
|
|
1752
|
+
},
|
|
1753
|
+
addRecord(y, x) {
|
|
1754
|
+
d(y, x, u), v.addNamespaceRecord(y, x, u);
|
|
1755
|
+
},
|
|
1756
|
+
exists(y, x = !1) {
|
|
1757
|
+
const M = l.get(S$(y));
|
|
1758
|
+
return M && x ? M.version === u : !!M;
|
|
1759
|
+
},
|
|
1760
|
+
getRecord(y) {
|
|
1761
|
+
var x;
|
|
1762
|
+
return (x = l.get(S$(n(y)))) === null || x === void 0 ? void 0 : x.data;
|
|
1763
|
+
},
|
|
1764
|
+
getTranslation(y, x) {
|
|
1765
|
+
var M;
|
|
1766
|
+
return (M = l.get(S$(y))) === null || M === void 0 ? void 0 : M.data.get(x);
|
|
1767
|
+
},
|
|
1768
|
+
getTranslationNs(y, x, M) {
|
|
1769
|
+
var S;
|
|
1770
|
+
for (const C of y)
|
|
1771
|
+
for (const z of x) {
|
|
1772
|
+
const D = (S = l.get(S$({ language: z, namespace: C }))) === null || S === void 0 ? void 0 : S.data.get(M);
|
|
1773
|
+
if (D != null)
|
|
1774
|
+
return [C];
|
|
1775
|
+
}
|
|
1776
|
+
return rit(y);
|
|
1777
|
+
},
|
|
1778
|
+
getTranslationFallback(y, x, M) {
|
|
1779
|
+
var S;
|
|
1780
|
+
for (const C of y)
|
|
1781
|
+
for (const z of x) {
|
|
1782
|
+
const D = (S = l.get(S$({ language: z, namespace: C }))) === null || S === void 0 ? void 0 : S.data.get(M);
|
|
1783
|
+
if (D != null)
|
|
1784
|
+
return { translation: D, namespace: C };
|
|
1785
|
+
}
|
|
1786
|
+
return { translation: void 0, namespace: y[0] };
|
|
1787
|
+
},
|
|
1788
|
+
changeTranslation(y, x, M) {
|
|
1789
|
+
var S;
|
|
1790
|
+
const C = (S = l.get(S$(y))) === null || S === void 0 ? void 0 : S.data;
|
|
1791
|
+
C?.set(x, M), r.emit(Object.assign(Object.assign({}, y), { key: x }));
|
|
1792
|
+
},
|
|
1793
|
+
isFetching(y) {
|
|
1794
|
+
if (i())
|
|
1795
|
+
return !0;
|
|
1796
|
+
if (y === void 0)
|
|
1797
|
+
return s.size > 0;
|
|
1798
|
+
const x = wN(y);
|
|
1799
|
+
return !!Array.from(s.keys()).find((M) => x.includes(FSe(M).namespace));
|
|
1800
|
+
},
|
|
1801
|
+
isLoading(y, x) {
|
|
1802
|
+
const M = wN(x);
|
|
1803
|
+
return !!(i() || Array.from(s.keys()).find((S) => {
|
|
1804
|
+
const C = FSe(S);
|
|
1805
|
+
return (!M.length || M.includes(C.namespace)) && !v.exists({
|
|
1806
|
+
namespace: C.namespace,
|
|
1807
|
+
language: y
|
|
1808
|
+
});
|
|
1809
|
+
}));
|
|
1810
|
+
},
|
|
1811
|
+
async loadRecords(y, x) {
|
|
1812
|
+
const M = y.map((C) => {
|
|
1813
|
+
const z = n(C), D = S$(z), w = s.get(D);
|
|
1814
|
+
if (w)
|
|
1815
|
+
return {
|
|
1816
|
+
new: !1,
|
|
1817
|
+
promise: w,
|
|
1818
|
+
keyObject: z,
|
|
1819
|
+
cacheKey: D
|
|
1820
|
+
};
|
|
1821
|
+
const k = g(z, x) || Promise.resolve(void 0);
|
|
1822
|
+
return s.set(D, k), {
|
|
1823
|
+
new: !0,
|
|
1824
|
+
promise: k,
|
|
1825
|
+
keyObject: z,
|
|
1826
|
+
cacheKey: D
|
|
1827
|
+
};
|
|
1828
|
+
});
|
|
1829
|
+
o.notify(), a.notify();
|
|
1830
|
+
const S = await Promise.all(M.map((C) => C.promise));
|
|
1831
|
+
return M.forEach((C, z) => {
|
|
1832
|
+
const D = s.get(C.cacheKey) !== C.promise;
|
|
1833
|
+
if (C.new && !D) {
|
|
1834
|
+
s.delete(C.cacheKey);
|
|
1835
|
+
const w = S[z];
|
|
1836
|
+
w ? v.addRecord(C.keyObject, w) : v.getRecord(C.keyObject) || v.addRecord(C.keyObject, {});
|
|
1837
|
+
}
|
|
1838
|
+
}), o.notify(), a.notify(), M.map((C) => v.getRecord(C.keyObject));
|
|
1839
|
+
},
|
|
1840
|
+
getAllRecords() {
|
|
1841
|
+
return Array.from(l.entries()).map(([x, M]) => Object.assign(Object.assign({}, FSe(x)), { data: M.data }));
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
return v;
|
|
1845
|
+
}
|
|
1846
|
+
function MXt(r, e) {
|
|
1847
|
+
var t = {};
|
|
1848
|
+
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
|
|
1849
|
+
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1850
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(r); i < n.length; i++)
|
|
1851
|
+
e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[i]) && (t[n[i]] = r[n[i]]);
|
|
1852
|
+
return t;
|
|
1853
|
+
}
|
|
1854
|
+
const p_n = {
|
|
1855
|
+
tagAttributes: {
|
|
1856
|
+
textarea: ["placeholder"],
|
|
1857
|
+
input: ["value", "placeholder"],
|
|
1858
|
+
img: ["alt"],
|
|
1859
|
+
"*": ["aria-label", "title"]
|
|
1860
|
+
},
|
|
1861
|
+
restrictedElements: ["script", "style"],
|
|
1862
|
+
highlightKeys: ["Alt"],
|
|
1863
|
+
highlightColor: "rgb(255, 0, 0)",
|
|
1864
|
+
highlightWidth: 5,
|
|
1865
|
+
inputPrefix: "%-%mi18n:",
|
|
1866
|
+
inputSuffix: "%-%",
|
|
1867
|
+
passToParent: ["option", "optgroup"],
|
|
1868
|
+
fullKeyEncode: !1
|
|
1869
|
+
}, iit = "invalid", g_n = "https://admin.midasbuy.com/i18n/api", m_n = {
|
|
1870
|
+
defaultNs: "",
|
|
1871
|
+
observerOptions: p_n,
|
|
1872
|
+
observerType: "invisible",
|
|
1873
|
+
onFormatError: iit,
|
|
1874
|
+
apiUrl: g_n,
|
|
1875
|
+
fetch: wXt()
|
|
1876
|
+
}, oit = (...r) => {
|
|
1877
|
+
let e = {};
|
|
1878
|
+
return r.forEach((t) => {
|
|
1879
|
+
e = Object.assign(Object.assign(Object.assign({}, e), t), { observerOptions: Object.assign(Object.assign({}, e.observerOptions), t?.observerOptions) });
|
|
1880
|
+
}), e;
|
|
1881
|
+
};
|
|
1882
|
+
function uxt(r, e) {
|
|
1883
|
+
const t = oit(m_n, e?.initialOptions, r);
|
|
1884
|
+
return t.apiUrl = xXt(t.apiUrl), r?.fetch && (t.fetch = wXt(r.fetch)), {
|
|
1885
|
+
initialOptions: t,
|
|
1886
|
+
activeNamespaces: e?.activeNamespaces || /* @__PURE__ */ new Map(),
|
|
1887
|
+
language: e?.language,
|
|
1888
|
+
pendingLanguage: e?.language,
|
|
1889
|
+
isInitialLoading: !1,
|
|
1890
|
+
isRunning: !1
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
function v_n(r, e, t, n, i, o, a, s) {
|
|
1894
|
+
const l = {
|
|
1895
|
+
ui: void 0
|
|
1896
|
+
}, c = {
|
|
1897
|
+
formatters: [],
|
|
1898
|
+
finalFormatter: void 0,
|
|
1899
|
+
observer: void 0,
|
|
1900
|
+
devBackend: void 0,
|
|
1901
|
+
backends: [],
|
|
1902
|
+
ui: void 0,
|
|
1903
|
+
languageDetector: void 0,
|
|
1904
|
+
languageStorage: void 0
|
|
1905
|
+
}, u = async ({ keysAndDefaults: U, event: G }) => {
|
|
1906
|
+
var q;
|
|
1907
|
+
const K = U.map(({ key: W, ns: F, defaultValue: X }) => {
|
|
1908
|
+
const { translation: Z } = o({
|
|
1909
|
+
key: W,
|
|
1910
|
+
ns: F
|
|
1911
|
+
});
|
|
1912
|
+
return {
|
|
1913
|
+
key: W,
|
|
1914
|
+
defaultValue: X,
|
|
1915
|
+
fallbackNamespaces: n(F),
|
|
1916
|
+
namespace: i({ key: W, ns: F })[0],
|
|
1917
|
+
translation: Z
|
|
1918
|
+
};
|
|
1919
|
+
});
|
|
1920
|
+
(q = c.ui) === null || q === void 0 || q.handleElementClick(K, G);
|
|
1921
|
+
}, d = (U, G) => {
|
|
1922
|
+
var q;
|
|
1923
|
+
return ((q = c.observer) === null || q === void 0 ? void 0 : q.findPositions(U, G)) || [];
|
|
1924
|
+
};
|
|
1925
|
+
function f(U) {
|
|
1926
|
+
const { translation: G } = o({
|
|
1927
|
+
key: U.key,
|
|
1928
|
+
ns: U.ns
|
|
1929
|
+
});
|
|
1930
|
+
return H.formatTranslation(Object.assign(Object.assign({}, U), { translation: G, formatEnabled: !0 }));
|
|
1931
|
+
}
|
|
1932
|
+
function g() {
|
|
1933
|
+
return { fetch: e().fetch };
|
|
1934
|
+
}
|
|
1935
|
+
function v(U) {
|
|
1936
|
+
c.observer = U?.();
|
|
1937
|
+
}
|
|
1938
|
+
function y() {
|
|
1939
|
+
return !!c.observer;
|
|
1940
|
+
}
|
|
1941
|
+
function x(U) {
|
|
1942
|
+
U && c.formatters.push(U);
|
|
1943
|
+
}
|
|
1944
|
+
function M(U) {
|
|
1945
|
+
c.finalFormatter = U;
|
|
1946
|
+
}
|
|
1947
|
+
function S(U) {
|
|
1948
|
+
l.ui = U;
|
|
1949
|
+
}
|
|
1950
|
+
function C() {
|
|
1951
|
+
return !!l.ui;
|
|
1952
|
+
}
|
|
1953
|
+
function z(U) {
|
|
1954
|
+
c.languageStorage = U;
|
|
1955
|
+
}
|
|
1956
|
+
function D(U) {
|
|
1957
|
+
c.languageDetector = U;
|
|
1958
|
+
}
|
|
1959
|
+
function w() {
|
|
1960
|
+
if (!c.languageDetector)
|
|
1961
|
+
return;
|
|
1962
|
+
const U = t();
|
|
1963
|
+
return c.languageDetector.getLanguage(Object.assign({ availableLanguages: U }, g()));
|
|
1964
|
+
}
|
|
1965
|
+
function k(U) {
|
|
1966
|
+
U && c.backends.push(U);
|
|
1967
|
+
}
|
|
1968
|
+
function R(U) {
|
|
1969
|
+
c.devBackend = U;
|
|
1970
|
+
}
|
|
1971
|
+
function P(U, G) {
|
|
1972
|
+
const q = Object.freeze({
|
|
1973
|
+
setFinalFormatter: M,
|
|
1974
|
+
addFormatter: x,
|
|
1975
|
+
setObserver: v,
|
|
1976
|
+
hasObserver: y,
|
|
1977
|
+
setUi: S,
|
|
1978
|
+
hasUi: C,
|
|
1979
|
+
setDevBackend: R,
|
|
1980
|
+
addBackend: k,
|
|
1981
|
+
setLanguageDetector: D,
|
|
1982
|
+
setLanguageStorage: z
|
|
1983
|
+
});
|
|
1984
|
+
G(U, q);
|
|
1985
|
+
}
|
|
1986
|
+
const H = Object.freeze({
|
|
1987
|
+
addPlugin: P,
|
|
1988
|
+
run() {
|
|
1989
|
+
var U, G;
|
|
1990
|
+
const { apiKey: q, apiUrl: K, projectId: W, observerOptions: F } = e();
|
|
1991
|
+
c.ui = (U = l.ui) === null || U === void 0 ? void 0 : U.call(l, {
|
|
1992
|
+
apiKey: q,
|
|
1993
|
+
apiUrl: K,
|
|
1994
|
+
projectId: W,
|
|
1995
|
+
highlight: H.highlight,
|
|
1996
|
+
changeTranslation: a,
|
|
1997
|
+
findPositions: d,
|
|
1998
|
+
onPermanentChange: s
|
|
1999
|
+
}), (G = c.observer) === null || G === void 0 || G.run({
|
|
2000
|
+
mouseHighlight: !0,
|
|
2001
|
+
options: F,
|
|
2002
|
+
translate: f,
|
|
2003
|
+
onClick: u
|
|
2004
|
+
});
|
|
2005
|
+
},
|
|
2006
|
+
stop() {
|
|
2007
|
+
var U;
|
|
2008
|
+
c.ui = void 0, (U = c.observer) === null || U === void 0 || U.stop();
|
|
2009
|
+
},
|
|
2010
|
+
getLanguageStorage() {
|
|
2011
|
+
return c.languageStorage;
|
|
2012
|
+
},
|
|
2013
|
+
getInitialLanguage() {
|
|
2014
|
+
var U;
|
|
2015
|
+
const G = t(), q = (U = c.languageStorage) === null || U === void 0 ? void 0 : U.getLanguage(g());
|
|
2016
|
+
return oIe(q, (K) => (!G || G.includes(K)) && K ? K : w());
|
|
2017
|
+
},
|
|
2018
|
+
setStoredLanguage(U) {
|
|
2019
|
+
var G;
|
|
2020
|
+
(G = c.languageStorage) === null || G === void 0 || G.setLanguage(U, g());
|
|
2021
|
+
},
|
|
2022
|
+
getDevBackend() {
|
|
2023
|
+
return c.devBackend;
|
|
2024
|
+
},
|
|
2025
|
+
getBackendRecord: (({ language: U, namespace: G }) => {
|
|
2026
|
+
for (const q of c.backends) {
|
|
2027
|
+
const K = q.getRecord(Object.assign({
|
|
2028
|
+
language: U,
|
|
2029
|
+
namespace: G
|
|
2030
|
+
}, g()));
|
|
2031
|
+
if (xft(K))
|
|
2032
|
+
return K?.catch((W) => (console.error(W), {}));
|
|
2033
|
+
if (K !== void 0)
|
|
2034
|
+
return K;
|
|
2035
|
+
}
|
|
2036
|
+
}),
|
|
2037
|
+
getBackendDevRecord: (({ language: U, namespace: G }) => {
|
|
2038
|
+
var q;
|
|
2039
|
+
const { apiKey: K, apiUrl: W, projectId: F } = e();
|
|
2040
|
+
return (q = c.devBackend) === null || q === void 0 ? void 0 : q.getRecord(Object.assign({
|
|
2041
|
+
apiKey: K,
|
|
2042
|
+
apiUrl: W,
|
|
2043
|
+
projectId: F,
|
|
2044
|
+
language: U,
|
|
2045
|
+
namespace: G
|
|
2046
|
+
}, g()));
|
|
2047
|
+
}),
|
|
2048
|
+
getLanguageDetector() {
|
|
2049
|
+
return c.languageDetector;
|
|
2050
|
+
},
|
|
2051
|
+
retranslate() {
|
|
2052
|
+
var U;
|
|
2053
|
+
(U = c.observer) === null || U === void 0 || U.retranslate();
|
|
2054
|
+
},
|
|
2055
|
+
highlight: ((U, G) => {
|
|
2056
|
+
var q, K;
|
|
2057
|
+
return ((K = (q = c.observer) === null || q === void 0 ? void 0 : q.highlight) === null || K === void 0 ? void 0 : K.call(q, U, G)) || { unhighlight() {
|
|
2058
|
+
} };
|
|
2059
|
+
}),
|
|
2060
|
+
unwrap(U) {
|
|
2061
|
+
var G;
|
|
2062
|
+
return c.observer ? (G = c.observer) === null || G === void 0 ? void 0 : G.unwrap(U) : { text: U, keys: [] };
|
|
2063
|
+
},
|
|
2064
|
+
wrap(U) {
|
|
2065
|
+
var G;
|
|
2066
|
+
return c.observer ? (G = c.observer) === null || G === void 0 ? void 0 : G.wrap(U) : U.translation;
|
|
2067
|
+
},
|
|
2068
|
+
hasDevBackend() {
|
|
2069
|
+
return !!H.getDevBackend();
|
|
2070
|
+
},
|
|
2071
|
+
formatTranslation(U) {
|
|
2072
|
+
var G, { formatEnabled: q } = U, K = MXt(U, ["formatEnabled"]);
|
|
2073
|
+
const { key: W, translation: F, defaultValue: X, noWrap: Z, params: ee, orEmpty: ie, ns: le } = K, ue = F || X || (ie ? "" : W);
|
|
2074
|
+
let we = ue || (ie ? "" : W);
|
|
2075
|
+
const ye = r(), Se = q || !(!((G = c.observer) === null || G === void 0) && G.outputNotFormattable), pe = (me) => c.observer && !Z ? c.observer.wrap({
|
|
2076
|
+
key: W,
|
|
2077
|
+
translation: me,
|
|
2078
|
+
defaultValue: X,
|
|
2079
|
+
params: ee,
|
|
2080
|
+
ns: le
|
|
2081
|
+
}) : me;
|
|
2082
|
+
we = pe(we);
|
|
2083
|
+
try {
|
|
2084
|
+
if (ue && ye && Se)
|
|
2085
|
+
for (const me of c.formatters)
|
|
2086
|
+
we = me.format({
|
|
2087
|
+
translation: we,
|
|
2088
|
+
language: ye,
|
|
2089
|
+
params: ee
|
|
2090
|
+
});
|
|
2091
|
+
c.finalFormatter && ue && ye && Se && (we = c.finalFormatter.format({
|
|
2092
|
+
translation: we,
|
|
2093
|
+
language: ye,
|
|
2094
|
+
params: ee
|
|
2095
|
+
}));
|
|
2096
|
+
} catch (me) {
|
|
2097
|
+
console.error(me);
|
|
2098
|
+
const se = c_n(me) || iit, xe = e().onFormatError, Ie = typeof xe;
|
|
2099
|
+
Ie === "string" ? we = xe : Ie === "function" ? we = xe(se, K) : we = iit, we = pe(we);
|
|
2100
|
+
}
|
|
2101
|
+
return we;
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
2104
|
+
return H;
|
|
2105
|
+
}
|
|
2106
|
+
const dxt = (r, e, t) => {
|
|
2107
|
+
let n = r;
|
|
2108
|
+
return Object.freeze({
|
|
2109
|
+
init(i) {
|
|
2110
|
+
n = i;
|
|
2111
|
+
},
|
|
2112
|
+
notify() {
|
|
2113
|
+
const i = e();
|
|
2114
|
+
n !== i && t(i), n = i;
|
|
2115
|
+
}
|
|
2116
|
+
});
|
|
2117
|
+
};
|
|
2118
|
+
function b_n(r, e, t) {
|
|
2119
|
+
let n = uxt(), i;
|
|
2120
|
+
const o = Object.freeze({
|
|
2121
|
+
init(a) {
|
|
2122
|
+
n = uxt(a, n);
|
|
2123
|
+
},
|
|
2124
|
+
isRunning() {
|
|
2125
|
+
return n.isRunning;
|
|
2126
|
+
},
|
|
2127
|
+
setRunning(a) {
|
|
2128
|
+
n.isRunning !== a && (n.isRunning = a, t.emit(a));
|
|
2129
|
+
},
|
|
2130
|
+
isInitialLoading() {
|
|
2131
|
+
return n.isInitialLoading;
|
|
2132
|
+
},
|
|
2133
|
+
setInitialLoading(a) {
|
|
2134
|
+
n.isInitialLoading = a;
|
|
2135
|
+
},
|
|
2136
|
+
getLanguage() {
|
|
2137
|
+
return n.language || n.initialOptions.language;
|
|
2138
|
+
},
|
|
2139
|
+
setLanguage(a) {
|
|
2140
|
+
n.language !== a && (n.language = a, r.emit(a));
|
|
2141
|
+
},
|
|
2142
|
+
getPendingLanguage() {
|
|
2143
|
+
return n.pendingLanguage || o.getLanguage();
|
|
2144
|
+
},
|
|
2145
|
+
setPendingLanguage(a) {
|
|
2146
|
+
n.pendingLanguage !== a && (n.pendingLanguage = a, e.emit(a));
|
|
2147
|
+
},
|
|
2148
|
+
getInitialOptions() {
|
|
2149
|
+
return Object.assign(Object.assign({}, n.initialOptions), i);
|
|
2150
|
+
},
|
|
2151
|
+
addActiveNs(a) {
|
|
2152
|
+
wN(a).forEach((l) => {
|
|
2153
|
+
const c = n.activeNamespaces.get(l);
|
|
2154
|
+
c !== void 0 ? n.activeNamespaces.set(l, c + 1) : n.activeNamespaces.set(l, 1);
|
|
2155
|
+
});
|
|
2156
|
+
},
|
|
2157
|
+
removeActiveNs(a) {
|
|
2158
|
+
wN(a).forEach((l) => {
|
|
2159
|
+
const c = n.activeNamespaces.get(l);
|
|
2160
|
+
c !== void 0 && c > 1 ? n.activeNamespaces.set(l, c - 1) : n.activeNamespaces.delete(l);
|
|
2161
|
+
});
|
|
2162
|
+
},
|
|
2163
|
+
getRequiredNamespaces() {
|
|
2164
|
+
return rit([
|
|
2165
|
+
...n.initialOptions.ns || [n.initialOptions.defaultNs],
|
|
2166
|
+
...wN(n.initialOptions.fallbackNs),
|
|
2167
|
+
...n.activeNamespaces.keys()
|
|
2168
|
+
]);
|
|
2169
|
+
},
|
|
2170
|
+
getFallbackLangs(a) {
|
|
2171
|
+
const s = a || o.getLanguage();
|
|
2172
|
+
return s ? rit([
|
|
2173
|
+
s,
|
|
2174
|
+
...l_n(s, n.initialOptions.fallbackLanguage)
|
|
2175
|
+
]) : [];
|
|
2176
|
+
},
|
|
2177
|
+
getFallbackNs() {
|
|
2178
|
+
return wN(n.initialOptions.fallbackNs);
|
|
2179
|
+
},
|
|
2180
|
+
getDefaultNs(a) {
|
|
2181
|
+
return a === void 0 ? n.initialOptions.defaultNs : a;
|
|
2182
|
+
},
|
|
2183
|
+
getAvailableLanguages() {
|
|
2184
|
+
if (n.initialOptions.availableLanguages)
|
|
2185
|
+
return n.initialOptions.availableLanguages;
|
|
2186
|
+
if (n.initialOptions.staticData) {
|
|
2187
|
+
const a = Object.keys(n.initialOptions.staticData).map((s) => FSe(s).language);
|
|
2188
|
+
return Array.from(new Set(a));
|
|
2189
|
+
}
|
|
2190
|
+
},
|
|
2191
|
+
withDefaultNs(a) {
|
|
2192
|
+
return {
|
|
2193
|
+
namespace: a.namespace === void 0 ? o.getInitialOptions().defaultNs : a.namespace,
|
|
2194
|
+
language: a.language
|
|
2195
|
+
};
|
|
2196
|
+
},
|
|
2197
|
+
overrideCredentials(a) {
|
|
2198
|
+
a ? i = Object.assign(Object.assign({}, a), { apiUrl: xXt(a.apiUrl) }) : i = void 0;
|
|
2199
|
+
}
|
|
2200
|
+
});
|
|
2201
|
+
return o;
|
|
2202
|
+
}
|
|
2203
|
+
function y_n(r) {
|
|
2204
|
+
var { ns: e, noWrap: t, orEmpty: n, params: i, language: o } = r, a = MXt(r, ["ns", "noWrap", "orEmpty", "params", "language"]);
|
|
2205
|
+
return Object.assign(Object.assign({}, {
|
|
2206
|
+
ns: e,
|
|
2207
|
+
noWrap: t,
|
|
2208
|
+
orEmpty: n,
|
|
2209
|
+
language: o
|
|
2210
|
+
}), { params: Object.assign({}, a) });
|
|
2211
|
+
}
|
|
2212
|
+
const SXt = (r, ...e) => {
|
|
2213
|
+
let t = {}, n;
|
|
2214
|
+
return typeof r == "object" ? t = r : (t.key = r, typeof e[0] == "string" ? (t.defaultValue = e[0], n = e[1]) : typeof e[0] == "object" && (n = e[0])), n && (t = Object.assign(Object.assign({}, y_n(n)), t)), t;
|
|
2215
|
+
};
|
|
2216
|
+
function __n({ options: r }) {
|
|
2217
|
+
const e = f_n(l, c), t = dxt(!1, () => a.isFetching(), e.onFetchingChange.emit), n = dxt(!1, () => w.isLoading(), e.onLoadingChange.emit), i = b_n(e.onLanguageChange, e.onPendingLanguageChange, e.onRunningChange), o = v_n(i.getLanguage, i.getInitialOptions, i.getAvailableLanguages, u, M, S, f, g), a = h_n(e.onCacheChange, o.getBackendRecord, o.getBackendDevRecord, i.withDefaultNs, i.isInitialLoading, t, n);
|
|
2218
|
+
r && v(r);
|
|
2219
|
+
let s;
|
|
2220
|
+
e.onUpdate.listen(() => {
|
|
2221
|
+
i.isRunning() && o.retranslate();
|
|
2222
|
+
});
|
|
2223
|
+
function l() {
|
|
2224
|
+
return i.getFallbackNs();
|
|
2225
|
+
}
|
|
2226
|
+
function c(k) {
|
|
2227
|
+
return i.getDefaultNs(k);
|
|
2228
|
+
}
|
|
2229
|
+
function u(k) {
|
|
2230
|
+
return [...wN(c(k)), ...l()];
|
|
2231
|
+
}
|
|
2232
|
+
function d(k) {
|
|
2233
|
+
return [
|
|
2234
|
+
...wN(k ?? c()),
|
|
2235
|
+
...i.getRequiredNamespaces()
|
|
2236
|
+
];
|
|
2237
|
+
}
|
|
2238
|
+
function f(k, R, P) {
|
|
2239
|
+
const H = i.withDefaultNs(k), U = a.getTranslation(H, R);
|
|
2240
|
+
return a.changeTranslation(H, R, P), {
|
|
2241
|
+
revert() {
|
|
2242
|
+
a.changeTranslation(H, R, U);
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2245
|
+
}
|
|
2246
|
+
function g(k) {
|
|
2247
|
+
e.onPermanentChange.emit({
|
|
2248
|
+
key: k.key,
|
|
2249
|
+
namespace: k.namespace
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
function v(k) {
|
|
2253
|
+
i.init(k), a.addStaticData(i.getInitialOptions().staticData);
|
|
2254
|
+
}
|
|
2255
|
+
function y(k, R) {
|
|
2256
|
+
const P = i.getFallbackLangs(k), H = d(R), U = [];
|
|
2257
|
+
return P.forEach((G) => {
|
|
2258
|
+
H.forEach((q) => {
|
|
2259
|
+
a.exists({ language: G, namespace: q }, !0) || U.push({ language: G, namespace: q });
|
|
2260
|
+
});
|
|
2261
|
+
}), U;
|
|
2262
|
+
}
|
|
2263
|
+
function x(k, R) {
|
|
2264
|
+
const P = y(k, R);
|
|
2265
|
+
if (P.length)
|
|
2266
|
+
return oIe(w.loadRecords(P), () => {
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
2269
|
+
function M({ key: k, ns: R }) {
|
|
2270
|
+
const P = i.getFallbackLangs(), H = u(R ?? void 0);
|
|
2271
|
+
return a.getTranslationNs(H, P, k);
|
|
2272
|
+
}
|
|
2273
|
+
function S({ key: k, ns: R, language: P }) {
|
|
2274
|
+
const H = u(R ?? void 0), U = i.getFallbackLangs(P);
|
|
2275
|
+
return a.getTranslationFallback(H, U, k);
|
|
2276
|
+
}
|
|
2277
|
+
function C() {
|
|
2278
|
+
const k = oIe(z(), () => x());
|
|
2279
|
+
if (xft(k))
|
|
2280
|
+
return i.setInitialLoading(!0), t.notify(), n.notify(), Promise.resolve(k).then(() => {
|
|
2281
|
+
i.setInitialLoading(!1), t.notify(), n.notify(), e.onInitialLoaded.emit();
|
|
2282
|
+
});
|
|
2283
|
+
e.onInitialLoaded.emit();
|
|
2284
|
+
}
|
|
2285
|
+
function z() {
|
|
2286
|
+
if (i.getLanguage())
|
|
2287
|
+
return;
|
|
2288
|
+
const R = o.getInitialLanguage();
|
|
2289
|
+
return oIe(R, (P) => {
|
|
2290
|
+
const H = P || i.getInitialOptions().defaultLanguage;
|
|
2291
|
+
H && i.setLanguage(H);
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
function D() {
|
|
2295
|
+
if ((o.getLanguageDetector() || o.getLanguageStorage()) && !i.getAvailableLanguages())
|
|
2296
|
+
throw new Error(cxt("availableLanguages"));
|
|
2297
|
+
if (!i.getLanguage() && !i.getInitialOptions().defaultLanguage)
|
|
2298
|
+
throw new Error(cxt(["defaultLanguage", "language"]));
|
|
2299
|
+
}
|
|
2300
|
+
const w = Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, e), i), o), a), {
|
|
2301
|
+
init: v,
|
|
2302
|
+
getTranslation: S,
|
|
2303
|
+
changeTranslation: f,
|
|
2304
|
+
getTranslationNs: M,
|
|
2305
|
+
getDefaultAndFallbackNs: u,
|
|
2306
|
+
async changeLanguage(k) {
|
|
2307
|
+
i.getPendingLanguage() === k && i.getLanguage() === k || (i.setPendingLanguage(k), i.isRunning() && await x(k), k === i.getPendingLanguage() && (i.setLanguage(k), o.setStoredLanguage(k)));
|
|
2308
|
+
},
|
|
2309
|
+
async addActiveNs(k, R) {
|
|
2310
|
+
R || i.addActiveNs(k), i.isRunning() && await x(void 0, k);
|
|
2311
|
+
},
|
|
2312
|
+
loadRecords(k) {
|
|
2313
|
+
return a.loadRecords(k, w.isDev());
|
|
2314
|
+
},
|
|
2315
|
+
async loadRecord(k) {
|
|
2316
|
+
return (await w.loadRecords([k]))[0];
|
|
2317
|
+
},
|
|
2318
|
+
isLoading(k) {
|
|
2319
|
+
return a.isLoading(i.getLanguage(), k);
|
|
2320
|
+
},
|
|
2321
|
+
isLoaded(k) {
|
|
2322
|
+
const R = i.getLanguage();
|
|
2323
|
+
if (!R)
|
|
2324
|
+
return !1;
|
|
2325
|
+
const P = i.getFallbackLangs(R), H = d(k), U = [];
|
|
2326
|
+
return P.forEach((G) => {
|
|
2327
|
+
H.forEach((q) => {
|
|
2328
|
+
a.exists({ language: G, namespace: q }) || U.push({ language: G, namespace: q });
|
|
2329
|
+
});
|
|
2330
|
+
}), U.length === 0;
|
|
2331
|
+
},
|
|
2332
|
+
t: ((...k) => {
|
|
2333
|
+
const R = SXt(...k), { translation: P, namespace: H } = S(R);
|
|
2334
|
+
return o.formatTranslation(Object.assign(Object.assign({}, R), { translation: P, ns: H }));
|
|
2335
|
+
}),
|
|
2336
|
+
isDev() {
|
|
2337
|
+
return !!(i.getInitialOptions().apiKey && i.getInitialOptions().apiUrl);
|
|
2338
|
+
},
|
|
2339
|
+
run() {
|
|
2340
|
+
return D(), i.isRunning() || (i.setRunning(!0), o.run(), s = C()), Promise.resolve(s);
|
|
2341
|
+
},
|
|
2342
|
+
stop() {
|
|
2343
|
+
i.isRunning() && (o.stop(), i.setRunning(!1));
|
|
2344
|
+
}
|
|
2345
|
+
}));
|
|
2346
|
+
return w;
|
|
2347
|
+
}
|
|
2348
|
+
function x_n(r) {
|
|
2349
|
+
const e = __n({
|
|
2350
|
+
options: r
|
|
2351
|
+
});
|
|
2352
|
+
e.isDev() && e.invalidate();
|
|
2353
|
+
function t(i) {
|
|
2354
|
+
const o = e.isRunning();
|
|
2355
|
+
o && e.stop(), i(), e.isDev() && e.invalidate(), o && e.run();
|
|
2356
|
+
}
|
|
2357
|
+
const n = Object.freeze({
|
|
2358
|
+
/**
|
|
2359
|
+
* Listen to mi18n events.
|
|
2360
|
+
*/
|
|
2361
|
+
on: e.on,
|
|
2362
|
+
/**
|
|
2363
|
+
* Listen for specific namespaces changes.
|
|
2364
|
+
*
|
|
2365
|
+
* ```
|
|
2366
|
+
* const sub = mi18n.onUpdate(handler)
|
|
2367
|
+
*
|
|
2368
|
+
* // subscribe to selected namespace
|
|
2369
|
+
* sub.subscribeNs(['common'])
|
|
2370
|
+
*
|
|
2371
|
+
* // unsubscribe
|
|
2372
|
+
* sub.unsubscribe()
|
|
2373
|
+
* ```
|
|
2374
|
+
*/
|
|
2375
|
+
onNsUpdate: e.onUpdate.listenSome,
|
|
2376
|
+
/**
|
|
2377
|
+
* Turn off/on events emitting. Is on by default.
|
|
2378
|
+
*/
|
|
2379
|
+
setEmitterActive: e.setEmitterActive,
|
|
2380
|
+
/**
|
|
2381
|
+
* @return current language if set.
|
|
2382
|
+
*/
|
|
2383
|
+
getLanguage: e.getLanguage,
|
|
2384
|
+
/**
|
|
2385
|
+
* `pendingLanguage` represents language which is currently being loaded.
|
|
2386
|
+
* @return current `pendingLanguage` if set.
|
|
2387
|
+
*/
|
|
2388
|
+
getPendingLanguage: e.getPendingLanguage,
|
|
2389
|
+
/**
|
|
2390
|
+
* Change current language.
|
|
2391
|
+
* - if not running sets `pendingLanguage`, `language` to the new value
|
|
2392
|
+
* - if running sets `pendingLanguage` to the value, fetches necessary data and then changes `language`
|
|
2393
|
+
*
|
|
2394
|
+
* @return Promise which is resolved when `language` is changed.
|
|
2395
|
+
*/
|
|
2396
|
+
changeLanguage: e.changeLanguage,
|
|
2397
|
+
/**
|
|
2398
|
+
* Temporarily change translation in cache.
|
|
2399
|
+
* @return object with revert method.
|
|
2400
|
+
*/
|
|
2401
|
+
changeTranslation: e.changeTranslation,
|
|
2402
|
+
/**
|
|
2403
|
+
* Adds namespace(s) list of active namespaces. And if mi18n is running, loads required data.
|
|
2404
|
+
*/
|
|
2405
|
+
addActiveNs: e.addActiveNs,
|
|
2406
|
+
/**
|
|
2407
|
+
* Remove namespace(s) from active namespaces.
|
|
2408
|
+
*
|
|
2409
|
+
* Mi18n internally counts how many times was each active namespace added,
|
|
2410
|
+
* so this method will remove namespace only if the counter goes down to 0.
|
|
2411
|
+
*/
|
|
2412
|
+
removeActiveNs: e.removeActiveNs,
|
|
2413
|
+
/**
|
|
2414
|
+
* Manually load multiple records from `Backend` (or `DevBackend` when in dev mode)
|
|
2415
|
+
*
|
|
2416
|
+
* It loads data together and adds them to cache in one operation, to prevent partly loaded state.
|
|
2417
|
+
*/
|
|
2418
|
+
loadRecords: e.loadRecords,
|
|
2419
|
+
/**
|
|
2420
|
+
* Manually load record from `Backend` (or `DevBackend` when in dev mode)
|
|
2421
|
+
*/
|
|
2422
|
+
loadRecord: e.loadRecord,
|
|
2423
|
+
/**
|
|
2424
|
+
*
|
|
2425
|
+
*/
|
|
2426
|
+
addStaticData: e.addStaticData,
|
|
2427
|
+
/**
|
|
2428
|
+
* Get record from cache.
|
|
2429
|
+
*/
|
|
2430
|
+
getRecord: e.getRecord,
|
|
2431
|
+
/**
|
|
2432
|
+
* Get all records from cache.
|
|
2433
|
+
*/
|
|
2434
|
+
getAllRecords: e.getAllRecords,
|
|
2435
|
+
/**
|
|
2436
|
+
* @param ns optional list of namespaces that you are interested in
|
|
2437
|
+
* @return `true` if there are data that need to be fetched.
|
|
2438
|
+
*/
|
|
2439
|
+
isLoaded: e.isLoaded,
|
|
2440
|
+
/**
|
|
2441
|
+
* @return `true` if mi18n is loading initial data (triggered by `run`).
|
|
2442
|
+
*/
|
|
2443
|
+
isInitialLoading: e.isInitialLoading,
|
|
2444
|
+
/**
|
|
2445
|
+
* @param ns optional list of namespaces that you are interested in
|
|
2446
|
+
* @return `true` if mi18n is loading some translations for the first time.
|
|
2447
|
+
*/
|
|
2448
|
+
isLoading: e.isLoading,
|
|
2449
|
+
/**
|
|
2450
|
+
* @param ns optional list of namespaces that you are interested in
|
|
2451
|
+
* @return `true` if mi18n is fetching some translations.
|
|
2452
|
+
*/
|
|
2453
|
+
isFetching: e.isFetching,
|
|
2454
|
+
/**
|
|
2455
|
+
* @return `true` if mi18n is running.
|
|
2456
|
+
*/
|
|
2457
|
+
isRunning: e.isRunning,
|
|
2458
|
+
/**
|
|
2459
|
+
* Changes internal state to running: true and loads initial files.
|
|
2460
|
+
* Runs runnable plugins mainly Observer if present.
|
|
2461
|
+
*/
|
|
2462
|
+
run: e.run,
|
|
2463
|
+
/**
|
|
2464
|
+
* Changes internal state to running: false and stops runnable plugins.
|
|
2465
|
+
*/
|
|
2466
|
+
stop: e.stop,
|
|
2467
|
+
/**
|
|
2468
|
+
* Returns translated and formatted key.
|
|
2469
|
+
* If Observer is present and mi18n is running, wraps result to be identifiable in the DOM.
|
|
2470
|
+
*/
|
|
2471
|
+
t: e.t,
|
|
2472
|
+
/**
|
|
2473
|
+
* Highlight keys that match selection.
|
|
2474
|
+
*/
|
|
2475
|
+
highlight: e.highlight,
|
|
2476
|
+
/**
|
|
2477
|
+
* @return current Mi18n options.
|
|
2478
|
+
*/
|
|
2479
|
+
getInitialOptions: e.getInitialOptions,
|
|
2480
|
+
/**
|
|
2481
|
+
* Mi18n is in dev mode if `DevTools` plugin is used and `apiKey` + `apiUrl` are specified.
|
|
2482
|
+
* @return `true` if mi18n is in dev mode.
|
|
2483
|
+
*/
|
|
2484
|
+
isDev: e.isDev,
|
|
2485
|
+
/**
|
|
2486
|
+
* Wraps translation if there is `Observer` plugin
|
|
2487
|
+
*/
|
|
2488
|
+
wrap: e.wrap,
|
|
2489
|
+
/**
|
|
2490
|
+
* Unwrap translation
|
|
2491
|
+
*/
|
|
2492
|
+
unwrap: e.unwrap,
|
|
2493
|
+
/**
|
|
2494
|
+
* Override creadentials passed on initialization.
|
|
2495
|
+
*
|
|
2496
|
+
* When called in running state, mi18n stops and runs again.
|
|
2497
|
+
*/
|
|
2498
|
+
overrideCredentials(i) {
|
|
2499
|
+
t(() => e.overrideCredentials(i));
|
|
2500
|
+
},
|
|
2501
|
+
/**
|
|
2502
|
+
* Add mi18n plugin after initialization.
|
|
2503
|
+
*
|
|
2504
|
+
* When called in running state, mi18n stops and runs again.
|
|
2505
|
+
*/
|
|
2506
|
+
addPlugin(i) {
|
|
2507
|
+
i && t(() => e.addPlugin(n, i));
|
|
2508
|
+
},
|
|
2509
|
+
/**
|
|
2510
|
+
* Updates options after instance creation. Extends existing options,
|
|
2511
|
+
* so it only changes the fields, that are listed.
|
|
2512
|
+
*
|
|
2513
|
+
* When called in running state, mi18n stops and runs again.
|
|
2514
|
+
*/
|
|
2515
|
+
updateOptions(i) {
|
|
2516
|
+
i && t(() => e.init(i));
|
|
2517
|
+
}
|
|
2518
|
+
});
|
|
2519
|
+
return n;
|
|
2520
|
+
}
|
|
2521
|
+
const w_n = () => {
|
|
2522
|
+
const r = {
|
|
2523
|
+
plugins: [],
|
|
2524
|
+
options: {}
|
|
2525
|
+
}, e = Object.freeze({
|
|
2526
|
+
use(t) {
|
|
2527
|
+
return r.plugins.push(t), e;
|
|
2528
|
+
},
|
|
2529
|
+
updateDefaults(t) {
|
|
2530
|
+
return r.options = oit(r.options, t), e;
|
|
2531
|
+
},
|
|
2532
|
+
init(t) {
|
|
2533
|
+
const n = x_n(oit(r.options, t));
|
|
2534
|
+
return r.plugins.forEach(n.addPlugin), n;
|
|
2535
|
+
}
|
|
2536
|
+
});
|
|
2537
|
+
return e;
|
|
2538
|
+
}, CXt = 0, ait = 1, A_n = 2;
|
|
2539
|
+
let M_n = class extends Error {
|
|
2540
|
+
constructor(e, t, n) {
|
|
2541
|
+
let i;
|
|
2542
|
+
e === CXt ? i = "Empty parameter" : e === ait ? i = "Unexpected character" : i = "Unexpected end", super(`Mi18n parser: ${i} at ${t} in "${n}"`), this.code = e, this.index = t;
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
function fxt(r) {
|
|
2546
|
+
return /\s/.test(r);
|
|
2547
|
+
}
|
|
2548
|
+
const VZ = 0, sit = 1, aIe = 2, CHe = 3, OHe = 4, S_n = /* @__PURE__ */ new Set([
|
|
2549
|
+
aIe,
|
|
2550
|
+
sit,
|
|
2551
|
+
VZ
|
|
2552
|
+
]), lit = "'", C_n = /* @__PURE__ */ new Set(["{", "}", lit]), O_n = (r) => /[0-9a-zA-Z_]/.test(r);
|
|
2553
|
+
function T_n(r) {
|
|
2554
|
+
let e = VZ, t = "", n = "", i = "";
|
|
2555
|
+
const o = [], a = [];
|
|
2556
|
+
let s = 0;
|
|
2557
|
+
function l(f) {
|
|
2558
|
+
throw new M_n(f, s, r);
|
|
2559
|
+
}
|
|
2560
|
+
const c = () => {
|
|
2561
|
+
o.push(t), t = "";
|
|
2562
|
+
}, u = () => {
|
|
2563
|
+
O_n(i) || l(ait), n += i;
|
|
2564
|
+
}, d = () => {
|
|
2565
|
+
n === "" && l(CXt), a.push(n), n = "";
|
|
2566
|
+
};
|
|
2567
|
+
for (s = 0; s < r.length; s++)
|
|
2568
|
+
switch (i = r[s], e) {
|
|
2569
|
+
case VZ:
|
|
2570
|
+
i === lit ? (t += i, e = sit) : i === "{" ? (c(), e = CHe) : (t += i, e = VZ);
|
|
2571
|
+
break;
|
|
2572
|
+
case sit:
|
|
2573
|
+
C_n.has(i) ? (t = t.slice(0, -1) + i, e = aIe) : (t += i, e = VZ);
|
|
2574
|
+
break;
|
|
2575
|
+
case aIe:
|
|
2576
|
+
i === lit ? e = VZ : (t += i, e = aIe);
|
|
2577
|
+
break;
|
|
2578
|
+
case CHe:
|
|
2579
|
+
i === "}" ? (d(), e = VZ) : fxt(i) ? n !== "" && (d(), e = OHe) : (u(), e = CHe);
|
|
2580
|
+
break;
|
|
2581
|
+
case OHe:
|
|
2582
|
+
i == "}" ? e = VZ : fxt(i) ? e = OHe : l(ait);
|
|
2583
|
+
}
|
|
2584
|
+
return S_n.has(e) || l(A_n), c(), [o, a];
|
|
2585
|
+
}
|
|
2586
|
+
function E_n(r, e) {
|
|
2587
|
+
const [t, n] = T_n(r), i = [t[0]];
|
|
2588
|
+
for (let o = 1; o < t.length; o++) {
|
|
2589
|
+
const a = e?.[n[o - 1]];
|
|
2590
|
+
if (a === void 0)
|
|
2591
|
+
throw new Error(`Missing parameter "${n[o - 1]}" in "${r}"`);
|
|
2592
|
+
i.push(String(a)), i.push(t[o]);
|
|
2593
|
+
}
|
|
2594
|
+
return i.join("");
|
|
2595
|
+
}
|
|
2596
|
+
function z_n() {
|
|
2597
|
+
return {
|
|
2598
|
+
format: ({ translation: r, params: e }) => E_n(r, e)
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2601
|
+
const Y$i = () => (r, e) => (e.setFinalFormatter(z_n()), r);
|
|
2602
|
+
function k_n() {
|
|
2603
|
+
var r, e;
|
|
2604
|
+
return typeof ((e = (r = globalThis.window) === null || r === void 0 ? void 0 : r.document) === null || e === void 0 ? void 0 : e.createElement) > "u";
|
|
2605
|
+
}
|
|
2606
|
+
function cit(r) {
|
|
2607
|
+
if (k_n())
|
|
2608
|
+
throw new Error(`${r}: Can't run on the server`);
|
|
2609
|
+
}
|
|
2610
|
+
const L_n = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
2611
|
+
function R_n(r) {
|
|
2612
|
+
const e = L_n.indexOf(r);
|
|
2613
|
+
if (e === -1)
|
|
2614
|
+
throw new Error("Invalid character found: " + r);
|
|
2615
|
+
return e;
|
|
2616
|
+
}
|
|
2617
|
+
function D_n(r) {
|
|
2618
|
+
const e = new Uint8Array(r), t = e.length;
|
|
2619
|
+
let n = "", i = Math.pow(2, 16) - 1;
|
|
2620
|
+
for (let o = 0; o < t; o += i)
|
|
2621
|
+
o + i > t && (i = t - o), n += String.fromCharCode.apply(
|
|
2622
|
+
null,
|
|
2623
|
+
// @ts-ignore
|
|
2624
|
+
e.subarray(o, o + i)
|
|
2625
|
+
);
|
|
2626
|
+
return n;
|
|
2627
|
+
}
|
|
2628
|
+
function I_n(r) {
|
|
2629
|
+
r = r.toUpperCase();
|
|
2630
|
+
const e = r.length;
|
|
2631
|
+
let t = 0, n = 0, i = 0;
|
|
2632
|
+
const o = new Uint8Array(e * 5 / 8 | 0);
|
|
2633
|
+
for (let a = 0; a < e; a++)
|
|
2634
|
+
n = n << 5 | R_n(r[a]), t += 5, t >= 8 && (o[i++] = n >>> t - 8 & 255, t -= 8);
|
|
2635
|
+
return D_n(o.buffer);
|
|
2636
|
+
}
|
|
2637
|
+
function N_n(r) {
|
|
2638
|
+
if (r)
|
|
2639
|
+
try {
|
|
2640
|
+
const [e, t] = r.split("_");
|
|
2641
|
+
if (e === "tgpak") {
|
|
2642
|
+
const [n] = I_n(t).split("_");
|
|
2643
|
+
return Number(n);
|
|
2644
|
+
}
|
|
2645
|
+
} catch {
|
|
2646
|
+
console.warn("Mi18n: Api key can't be parsed");
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
function P_n() {
|
|
2650
|
+
return {
|
|
2651
|
+
getRecord({ apiUrl: r, apiKey: e, projectId: t, language: n, fetch: i, namespace: o }) {
|
|
2652
|
+
var a;
|
|
2653
|
+
const s = (a = N_n(e)) !== null && a !== void 0 ? a : t;
|
|
2654
|
+
let l = s !== void 0 ? `${r}/v2/projects/${s}/translations/${n}` : `${r}/v2/projects/translations/${n}`;
|
|
2655
|
+
return o && (l += `?ns=${o}`), i(l, {
|
|
2656
|
+
headers: {
|
|
2657
|
+
"X-API-Key": e || "",
|
|
2658
|
+
"Content-Type": "application/json"
|
|
2659
|
+
}
|
|
2660
|
+
}).then((c) => {
|
|
2661
|
+
if (c.ok)
|
|
2662
|
+
return c.json().then((u) => u[n]);
|
|
2663
|
+
throw new Error(c.statusText);
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
const Z$i = () => (r, e) => (e.setDevBackend(P_n()), r);
|
|
2669
|
+
function F_n(r, e) {
|
|
2670
|
+
const t = (n) => {
|
|
2671
|
+
var i, o;
|
|
2672
|
+
r.includes((i = n.data) === null || i === void 0 ? void 0 : i.type) && e((o = n.data) === null || o === void 0 ? void 0 : o.data);
|
|
2673
|
+
};
|
|
2674
|
+
return window.addEventListener("message", t, !1), {
|
|
2675
|
+
unsubscribe() {
|
|
2676
|
+
window.removeEventListener("message", t);
|
|
2677
|
+
}
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
function B_n({ message: r, recievingMessage: e, data: t, attempts: n = 1, timeout: i = 300 }) {
|
|
2681
|
+
let o = !1;
|
|
2682
|
+
const a = () => new Promise((l, c) => {
|
|
2683
|
+
const u = F_n(e, f);
|
|
2684
|
+
window.postMessage({ type: r, data: t }, window.origin);
|
|
2685
|
+
const d = setTimeout(v, i);
|
|
2686
|
+
function f(y) {
|
|
2687
|
+
clearTimeout(d), g(), l(y);
|
|
2688
|
+
}
|
|
2689
|
+
function g() {
|
|
2690
|
+
u.unsubscribe();
|
|
2691
|
+
}
|
|
2692
|
+
function v() {
|
|
2693
|
+
g(), c();
|
|
2694
|
+
}
|
|
2695
|
+
});
|
|
2696
|
+
return {
|
|
2697
|
+
cancel() {
|
|
2698
|
+
o = !0;
|
|
2699
|
+
},
|
|
2700
|
+
promise: (async () => {
|
|
2701
|
+
for (let l = 0; l < n; l++) {
|
|
2702
|
+
if (o)
|
|
2703
|
+
return new Promise(() => {
|
|
2704
|
+
});
|
|
2705
|
+
try {
|
|
2706
|
+
return await a();
|
|
2707
|
+
} catch {
|
|
2708
|
+
continue;
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
if (!o)
|
|
2712
|
+
throw `Didn't recieve ${e.join(" or ")} in time.`;
|
|
2713
|
+
return new Promise(() => {
|
|
2714
|
+
});
|
|
2715
|
+
})()
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
function W_n() {
|
|
2719
|
+
let r;
|
|
2720
|
+
async function e(t) {
|
|
2721
|
+
r?.();
|
|
2722
|
+
const { cancel: n, promise: i } = B_n({
|
|
2723
|
+
message: "MI18N_READY",
|
|
2724
|
+
recievingMessage: ["MI18N_PLUGIN_READY", "MI18N_PLUGIN_UPDATED"],
|
|
2725
|
+
data: t,
|
|
2726
|
+
attempts: 4
|
|
2727
|
+
});
|
|
2728
|
+
return r = n, i;
|
|
2729
|
+
}
|
|
2730
|
+
return {
|
|
2731
|
+
update: e
|
|
2732
|
+
};
|
|
2733
|
+
}
|
|
2734
|
+
const q_n = "mi18n-in-context-tools.umd.min.js", H_n = "@mi18n/in-context-tools", V_n = "InContextTools", U_n = "https://cdn.jsdelivr.net/npm";
|
|
2735
|
+
function $_n(r) {
|
|
2736
|
+
return new Promise((e, t) => {
|
|
2737
|
+
const n = document.createElement("script");
|
|
2738
|
+
n.src = r, n.addEventListener("load", () => e()), n.addEventListener("error", (i) => t(i.error)), document.body.appendChild(n);
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
let THe = null;
|
|
2742
|
+
function j_n(r) {
|
|
2743
|
+
return THe || (THe = $_n(
|
|
2744
|
+
`${U_n}/@mi18n/web/dist/${q_n}`
|
|
2745
|
+
// `${CDN_URL}/@mi18n/web@${version}/dist/${IN_CONTEXT_FILE}`
|
|
2746
|
+
).then(() => window[H_n][V_n])), THe;
|
|
2747
|
+
}
|
|
2748
|
+
const OXt = "__mi18n_apiKey", TXt = "__mi18n_apiUrl";
|
|
2749
|
+
function hxt() {
|
|
2750
|
+
const r = sessionStorage.getItem(OXt) || void 0, e = sessionStorage.getItem(TXt) || void 0;
|
|
2751
|
+
if (!(!r || !e))
|
|
2752
|
+
return {
|
|
2753
|
+
apiKey: r,
|
|
2754
|
+
apiUrl: e
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
function G_n() {
|
|
2758
|
+
sessionStorage.removeItem(OXt), sessionStorage.removeItem(TXt);
|
|
2759
|
+
}
|
|
2760
|
+
function X_n(r) {
|
|
2761
|
+
document.readyState !== "loading" ? Promise.resolve().then(() => {
|
|
2762
|
+
r();
|
|
2763
|
+
}) : document.addEventListener && document.addEventListener("DOMContentLoaded", r);
|
|
2764
|
+
}
|
|
2765
|
+
let EXt = () => (r) => r;
|
|
2766
|
+
const K_n = () => {
|
|
2767
|
+
if (typeof window > "u")
|
|
2768
|
+
return !1;
|
|
2769
|
+
try {
|
|
2770
|
+
return typeof sessionStorage < "u" && sessionStorage;
|
|
2771
|
+
} catch (r) {
|
|
2772
|
+
return console.error("sessionStorage not available", r), !1;
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
K_n() && (EXt = () => (r) => {
|
|
2776
|
+
const e = W_n(), t = () => ({
|
|
2777
|
+
// prevent extension downloading ui library
|
|
2778
|
+
uiPresent: !0,
|
|
2779
|
+
uiVersion: void 0,
|
|
2780
|
+
// mi18n mode
|
|
2781
|
+
mode: r.isDev() ? "development" : "production",
|
|
2782
|
+
// pass credentials
|
|
2783
|
+
config: {
|
|
2784
|
+
apiUrl: r.getInitialOptions().apiUrl || "",
|
|
2785
|
+
apiKey: r.getInitialOptions().apiKey || ""
|
|
2786
|
+
}
|
|
2787
|
+
}), n = async () => {
|
|
2788
|
+
const o = await j_n();
|
|
2789
|
+
return (a) => {
|
|
2790
|
+
const s = hxt();
|
|
2791
|
+
return a.addPlugin(o({ credentials: s })), a;
|
|
2792
|
+
};
|
|
2793
|
+
};
|
|
2794
|
+
return r.on("running", ({ value: o }) => {
|
|
2795
|
+
o && X_n(() => {
|
|
2796
|
+
e.update(t()).catch(G_n);
|
|
2797
|
+
});
|
|
2798
|
+
}), hxt() && n().then((o) => {
|
|
2799
|
+
r.addPlugin(o);
|
|
2800
|
+
}).catch((o) => {
|
|
2801
|
+
console.error("Mi18n: Failed to load in-context tools"), console.error(o);
|
|
2802
|
+
}), r;
|
|
2803
|
+
});
|
|
2804
|
+
const uit = "__mi18n_currentLanguage";
|
|
2805
|
+
function Y_n() {
|
|
2806
|
+
return {
|
|
2807
|
+
getLanguage() {
|
|
2808
|
+
return cit("LanguageStorage"), localStorage.getItem(uit) || void 0;
|
|
2809
|
+
},
|
|
2810
|
+
setLanguage(r) {
|
|
2811
|
+
cit("LanguageStorage"), localStorage.setItem(uit, r);
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2815
|
+
const Q$i = () => localStorage.getItem(uit), J$i = () => (r, e) => (e.setLanguageStorage(Y_n()), r);
|
|
2816
|
+
function Z_n() {
|
|
2817
|
+
return {
|
|
2818
|
+
getLanguage({ availableLanguages: r }) {
|
|
2819
|
+
cit("LanguageDetector");
|
|
2820
|
+
const e = window.navigator.language, t = r.find((a) => a === e);
|
|
2821
|
+
if (t)
|
|
2822
|
+
return t;
|
|
2823
|
+
const n = (a) => a.replace(/^(.+?)(-.*)?$/, "$1"), i = n(window.navigator.language), o = r.find((a) => n(a) === i);
|
|
2824
|
+
if (o)
|
|
2825
|
+
return o;
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
const eji = () => (r, e) => (e.setLanguageDetector(Z_n()), r);
|
|
2830
|
+
function tji() {
|
|
2831
|
+
return w_n().use(EXt());
|
|
2832
|
+
}
|
|
2833
|
+
const Q_n = {
|
|
2834
|
+
useSuspense: !0
|
|
2835
|
+
};
|
|
2836
|
+
let EHe;
|
|
2837
|
+
const zXt = () => (EHe || (EHe = mr.createContext(void 0)), EHe), nji = ({ mi18n: r, options: e, children: t, fallback: n }) => {
|
|
2838
|
+
const [i, o] = Fn.useState(!r.isLoaded());
|
|
2839
|
+
Fn.useEffect(() => {
|
|
2840
|
+
r.run().catch((l) => {
|
|
2841
|
+
console.error(l);
|
|
2842
|
+
}).finally(() => {
|
|
2843
|
+
o(!1);
|
|
2844
|
+
});
|
|
2845
|
+
}, [r]);
|
|
2846
|
+
const a = Object.assign(Object.assign({}, Q_n), e), s = zXt();
|
|
2847
|
+
return a.useSuspense ? mr.createElement(s.Provider, { value: { mi18n: r, options: a } }, i ? n : mr.createElement(Fn.Suspense, { fallback: n || null }, t)) : mr.createElement(s.Provider, { value: { mi18n: r, options: a } }, i ? n : t);
|
|
2848
|
+
};
|
|
2849
|
+
let J_n;
|
|
2850
|
+
function exn() {
|
|
2851
|
+
return J_n;
|
|
2852
|
+
}
|
|
2853
|
+
const txn = () => {
|
|
2854
|
+
const r = zXt(), e = Fn.useContext(r) || exn();
|
|
2855
|
+
if (!e)
|
|
2856
|
+
throw new Error("Couldn't find mi18n instance, did you forgot to use `Mi18nProvider`?");
|
|
2857
|
+
return e;
|
|
2858
|
+
}, nxn = () => {
|
|
2859
|
+
const [r, e] = Fn.useState(0), t = Fn.useCallback(() => {
|
|
2860
|
+
e((n) => n + 1);
|
|
2861
|
+
}, [e]);
|
|
2862
|
+
return { instance: r, rerender: t };
|
|
2863
|
+
}, rxn = (r, e) => {
|
|
2864
|
+
const { mi18n: t, options: n } = txn(), i = _Xt(r), o = wN(i).join(":"), a = Object.assign(Object.assign({}, n), e), { rerender: s, instance: l } = nxn(), c = Fn.useRef(), u = Fn.useRef([]);
|
|
2865
|
+
u.current = [];
|
|
2866
|
+
const d = (v) => {
|
|
2867
|
+
var y;
|
|
2868
|
+
u.current.push(v), (y = c.current) === null || y === void 0 || y.subscribeNs(v);
|
|
2869
|
+
}, f = t.isLoaded(i);
|
|
2870
|
+
Fn.useEffect(() => {
|
|
2871
|
+
const v = t.onNsUpdate(s);
|
|
2872
|
+
return c.current = v, v.subscribeNs(i), u.current.forEach((y) => {
|
|
2873
|
+
v.subscribeNs(y);
|
|
2874
|
+
}), () => {
|
|
2875
|
+
v.unsubscribe();
|
|
2876
|
+
};
|
|
2877
|
+
}, [o, t]), Fn.useEffect(() => (t.addActiveNs(i), () => t.removeActiveNs(i)), [o, t]);
|
|
2878
|
+
const g = Fn.useCallback((v) => {
|
|
2879
|
+
var y;
|
|
2880
|
+
const x = (y = v.ns) !== null && y !== void 0 ? y : i?.[0];
|
|
2881
|
+
return d(x), t.t(Object.assign(Object.assign({}, v), { ns: x }));
|
|
2882
|
+
}, [t, l]);
|
|
2883
|
+
if (a.useSuspense && !f)
|
|
2884
|
+
throw t.addActiveNs(i, !0);
|
|
2885
|
+
return { t: g, isLoading: !f };
|
|
2886
|
+
}, rji = (r, e) => {
|
|
2887
|
+
const { t, isLoading: n } = rxn(r, e);
|
|
2888
|
+
return { t: Fn.useCallback((...o) => {
|
|
2889
|
+
const a = SXt(...o);
|
|
2890
|
+
return t(a);
|
|
2891
|
+
}, [t]), isLoading: n };
|
|
2892
|
+
};
|
|
2893
|
+
var M1e = {}, eLe = { exports: {} }, Fz = {}, tLe = { exports: {} }, zHe = {};
|
|
1546
2894
|
/**
|
|
1547
2895
|
* @license React
|
|
1548
2896
|
* scheduler.production.min.js
|
|
@@ -1552,9 +2900,9 @@ var M1e = {}, eLe = { exports: {} }, Fz = {}, tLe = { exports: {} }, CHe = {};
|
|
|
1552
2900
|
* This source code is licensed under the MIT license found in the
|
|
1553
2901
|
* LICENSE file in the root directory of this source tree.
|
|
1554
2902
|
*/
|
|
1555
|
-
var
|
|
1556
|
-
function
|
|
1557
|
-
return
|
|
2903
|
+
var pxt;
|
|
2904
|
+
function ixn() {
|
|
2905
|
+
return pxt || (pxt = 1, (function(r) {
|
|
1558
2906
|
function e(Z, ee) {
|
|
1559
2907
|
var ie = Z.length;
|
|
1560
2908
|
Z.push(ee);
|
|
@@ -1750,9 +3098,9 @@ function s_n() {
|
|
|
1750
3098
|
}
|
|
1751
3099
|
};
|
|
1752
3100
|
};
|
|
1753
|
-
})(
|
|
3101
|
+
})(zHe)), zHe;
|
|
1754
3102
|
}
|
|
1755
|
-
var
|
|
3103
|
+
var kHe = {};
|
|
1756
3104
|
/**
|
|
1757
3105
|
* @license React
|
|
1758
3106
|
* scheduler.development.js
|
|
@@ -1762,9 +3110,9 @@ var OHe = {};
|
|
|
1762
3110
|
* This source code is licensed under the MIT license found in the
|
|
1763
3111
|
* LICENSE file in the root directory of this source tree.
|
|
1764
3112
|
*/
|
|
1765
|
-
var
|
|
1766
|
-
function
|
|
1767
|
-
return
|
|
3113
|
+
var gxt;
|
|
3114
|
+
function oxn() {
|
|
3115
|
+
return gxt || (gxt = 1, (function(r) {
|
|
1768
3116
|
process.env.NODE_ENV !== "production" && (function() {
|
|
1769
3117
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1770
3118
|
var e = !1, t = 5;
|
|
@@ -2024,11 +3372,11 @@ function l_n() {
|
|
|
2024
3372
|
var Gt = Ct, an = null;
|
|
2025
3373
|
r.unstable_IdlePriority = g, r.unstable_ImmediatePriority = c, r.unstable_LowPriority = f, r.unstable_NormalPriority = d, r.unstable_Profiling = an, r.unstable_UserBlockingPriority = u, r.unstable_cancelCallback = Ue, r.unstable_continueExecution = xe, r.unstable_forceFrameRate = _t, r.unstable_getCurrentPriorityLevel = Be, r.unstable_getFirstCallbackNode = Ie, r.unstable_next = Se, r.unstable_pauseExecution = se, r.unstable_requestPaint = Gt, r.unstable_runWithPriority = ye, r.unstable_scheduleCallback = me, r.unstable_shouldYield = pt, r.unstable_wrapCallback = pe, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2026
3374
|
})();
|
|
2027
|
-
})(
|
|
3375
|
+
})(kHe)), kHe;
|
|
2028
3376
|
}
|
|
2029
|
-
var
|
|
2030
|
-
function
|
|
2031
|
-
return
|
|
3377
|
+
var mxt;
|
|
3378
|
+
function kXt() {
|
|
3379
|
+
return mxt || (mxt = 1, process.env.NODE_ENV === "production" ? tLe.exports = ixn() : tLe.exports = oxn()), tLe.exports;
|
|
2032
3380
|
}
|
|
2033
3381
|
/**
|
|
2034
3382
|
* @license React
|
|
@@ -2039,11 +3387,11 @@ function _Xt() {
|
|
|
2039
3387
|
* This source code is licensed under the MIT license found in the
|
|
2040
3388
|
* LICENSE file in the root directory of this source tree.
|
|
2041
3389
|
*/
|
|
2042
|
-
var
|
|
2043
|
-
function
|
|
2044
|
-
if (
|
|
2045
|
-
|
|
2046
|
-
var r = s0(), e =
|
|
3390
|
+
var vxt;
|
|
3391
|
+
function axn() {
|
|
3392
|
+
if (vxt) return Fz;
|
|
3393
|
+
vxt = 1;
|
|
3394
|
+
var r = s0(), e = kXt();
|
|
2047
3395
|
function t(de) {
|
|
2048
3396
|
for (var _e = "https://reactjs.org/docs/error-decoder.html?invariant=" + de, Ye = 1; Ye < arguments.length; Ye++) _e += "&args[]=" + encodeURIComponent(arguments[Ye]);
|
|
2049
3397
|
return "Minified React error #" + de + "; visit " + _e + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
|
|
@@ -7210,11 +8558,11 @@ var Bz = {};
|
|
|
7210
8558
|
* This source code is licensed under the MIT license found in the
|
|
7211
8559
|
* LICENSE file in the root directory of this source tree.
|
|
7212
8560
|
*/
|
|
7213
|
-
var
|
|
7214
|
-
function
|
|
7215
|
-
return
|
|
8561
|
+
var bxt;
|
|
8562
|
+
function sxn() {
|
|
8563
|
+
return bxt || (bxt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
7216
8564
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
7217
|
-
var r = s0(), e =
|
|
8565
|
+
var r = s0(), e = kXt(), t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, n = !1;
|
|
7218
8566
|
function i(j) {
|
|
7219
8567
|
n = j;
|
|
7220
8568
|
}
|
|
@@ -20651,10 +21999,10 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
20651
21999
|
Bz.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = d_, Bz.createPortal = Zee, Bz.createRoot = aR, Bz.findDOMNode = T8, Bz.flushSync = _w, Bz.hydrate = KD, Bz.hydrateRoot = a3, Bz.render = mX, Bz.unmountComponentAtNode = wC, Bz.unstable_batchedUpdates = d8, Bz.unstable_renderSubtreeIntoContainer = pV, Bz.version = Tv, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
20652
22000
|
})()), Bz;
|
|
20653
22001
|
}
|
|
20654
|
-
var
|
|
22002
|
+
var yxt;
|
|
20655
22003
|
function C7e() {
|
|
20656
|
-
if (
|
|
20657
|
-
|
|
22004
|
+
if (yxt) return eLe.exports;
|
|
22005
|
+
yxt = 1;
|
|
20658
22006
|
function r() {
|
|
20659
22007
|
if (!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function")) {
|
|
20660
22008
|
if (process.env.NODE_ENV !== "production")
|
|
@@ -20666,12 +22014,12 @@ function C7e() {
|
|
|
20666
22014
|
}
|
|
20667
22015
|
}
|
|
20668
22016
|
}
|
|
20669
|
-
return process.env.NODE_ENV === "production" ? (r(), eLe.exports =
|
|
22017
|
+
return process.env.NODE_ENV === "production" ? (r(), eLe.exports = axn()) : eLe.exports = sxn(), eLe.exports;
|
|
20670
22018
|
}
|
|
20671
|
-
var
|
|
20672
|
-
function
|
|
20673
|
-
if (
|
|
20674
|
-
|
|
22019
|
+
var _xt;
|
|
22020
|
+
function lxn() {
|
|
22021
|
+
if (_xt) return M1e;
|
|
22022
|
+
_xt = 1;
|
|
20675
22023
|
var r = C7e();
|
|
20676
22024
|
if (process.env.NODE_ENV === "production")
|
|
20677
22025
|
M1e.createRoot = r.createRoot, M1e.hydrateRoot = r.hydrateRoot;
|
|
@@ -20695,10 +22043,10 @@ function d_n() {
|
|
|
20695
22043
|
}
|
|
20696
22044
|
return M1e;
|
|
20697
22045
|
}
|
|
20698
|
-
var
|
|
20699
|
-
const
|
|
22046
|
+
var cxn = lxn();
|
|
22047
|
+
const iji = /* @__PURE__ */ s4({
|
|
20700
22048
|
__proto__: null
|
|
20701
|
-
}, [
|
|
22049
|
+
}, [cxn]);
|
|
20702
22050
|
var nLe = { exports: {} }, tMe = {};
|
|
20703
22051
|
/**
|
|
20704
22052
|
* @license React
|
|
@@ -20709,10 +22057,10 @@ var nLe = { exports: {} }, tMe = {};
|
|
|
20709
22057
|
* This source code is licensed under the MIT license found in the
|
|
20710
22058
|
* LICENSE file in the root directory of this source tree.
|
|
20711
22059
|
*/
|
|
20712
|
-
var
|
|
20713
|
-
function
|
|
20714
|
-
if (
|
|
20715
|
-
|
|
22060
|
+
var xxt;
|
|
22061
|
+
function uxn() {
|
|
22062
|
+
if (xxt) return tMe;
|
|
22063
|
+
xxt = 1;
|
|
20716
22064
|
var r = s0(), e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20717
22065
|
function a(s, l, c) {
|
|
20718
22066
|
var u, d = {}, f = null, g = null;
|
|
@@ -20733,9 +22081,9 @@ var nMe = {};
|
|
|
20733
22081
|
* This source code is licensed under the MIT license found in the
|
|
20734
22082
|
* LICENSE file in the root directory of this source tree.
|
|
20735
22083
|
*/
|
|
20736
|
-
var
|
|
20737
|
-
function
|
|
20738
|
-
return
|
|
22084
|
+
var wxt;
|
|
22085
|
+
function dxn() {
|
|
22086
|
+
return wxt || (wxt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
20739
22087
|
var r = s0(), e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), s = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), v = Symbol.iterator, y = "@@iterator";
|
|
20740
22088
|
function x(He) {
|
|
20741
22089
|
if (He === null || typeof He != "object")
|
|
@@ -21323,1360 +22671,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
21323
22671
|
nMe.Fragment = n, nMe.jsx = pn, nMe.jsxs = Bt;
|
|
21324
22672
|
})()), nMe;
|
|
21325
22673
|
}
|
|
21326
|
-
var
|
|
21327
|
-
function
|
|
21328
|
-
return
|
|
21329
|
-
}
|
|
21330
|
-
var A_ = g_n();
|
|
21331
|
-
function xft(r) {
|
|
21332
|
-
return !!(r && typeof r.then == "function");
|
|
21333
|
-
}
|
|
21334
|
-
function oIe(r, e) {
|
|
21335
|
-
return xft(r) ? Promise.resolve(r).then(e) : e(r);
|
|
21336
|
-
}
|
|
21337
|
-
function yxt(r) {
|
|
21338
|
-
const e = (Array.isArray(r) ? r : [r]).map((o) => `'${o}'`), t = e.slice(-2).join(" or ");
|
|
21339
|
-
return `Mi18n: You need to specify ${[...e.slice(0, -2), t].join(", ")} option`;
|
|
21340
|
-
}
|
|
21341
|
-
function m_n(r) {
|
|
21342
|
-
return typeof r == "object" && !Array.isArray(r) && r !== null;
|
|
21343
|
-
}
|
|
21344
|
-
function xXt(r) {
|
|
21345
|
-
if (typeof r == "string")
|
|
21346
|
-
return [r];
|
|
21347
|
-
if (Array.isArray(r))
|
|
21348
|
-
return r;
|
|
21349
|
-
}
|
|
21350
|
-
function wN(r) {
|
|
21351
|
-
return xXt(r) || [];
|
|
21352
|
-
}
|
|
21353
|
-
function v_n(r, e) {
|
|
21354
|
-
return m_n(e) ? wN(e?.[r]) : wN(e);
|
|
21355
|
-
}
|
|
21356
|
-
function rit(r) {
|
|
21357
|
-
return Array.from(new Set(r));
|
|
21358
|
-
}
|
|
21359
|
-
function wXt(r) {
|
|
21360
|
-
return r && r.replace(/\/+$/, "");
|
|
21361
|
-
}
|
|
21362
|
-
function b_n(r) {
|
|
21363
|
-
if (typeof r == "string")
|
|
21364
|
-
return r;
|
|
21365
|
-
if (typeof r?.message == "string")
|
|
21366
|
-
return r.message;
|
|
21367
|
-
}
|
|
21368
|
-
const y_n = (r, e) => fetch(r, e), AXt = (r = y_n) => (e, t) => r(e, Object.assign(Object.assign({}, t), { headers: Object.assign({ "X-Mi18n-SDK-Type": "JS", "X-Mi18n-SDK-Version": "5.16.2" }, t?.headers) }));
|
|
21369
|
-
function mZ(r) {
|
|
21370
|
-
let e = [];
|
|
21371
|
-
return Object.freeze({
|
|
21372
|
-
listen(t) {
|
|
21373
|
-
const n = (i) => {
|
|
21374
|
-
t(i);
|
|
21375
|
-
};
|
|
21376
|
-
return e.push(n), {
|
|
21377
|
-
unsubscribe() {
|
|
21378
|
-
e = e.filter((i) => n !== i);
|
|
21379
|
-
}
|
|
21380
|
-
};
|
|
21381
|
-
},
|
|
21382
|
-
emit(t) {
|
|
21383
|
-
r() && e.forEach((n) => n({ value: t }));
|
|
21384
|
-
}
|
|
21385
|
-
});
|
|
21386
|
-
}
|
|
21387
|
-
function __n(r, e, t) {
|
|
21388
|
-
const n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
21389
|
-
function o(l) {
|
|
21390
|
-
const c = new Set(e());
|
|
21391
|
-
i.forEach((u) => {
|
|
21392
|
-
(l === void 0 || l?.findIndex((f) => c.has(f) || u.namespaces.has(f)) !== -1) && u.fn({ value: void 0 });
|
|
21393
|
-
});
|
|
21394
|
-
}
|
|
21395
|
-
let a = [];
|
|
21396
|
-
function s() {
|
|
21397
|
-
if (a.length === 0)
|
|
21398
|
-
return;
|
|
21399
|
-
const l = a;
|
|
21400
|
-
a = [], n.forEach((d) => {
|
|
21401
|
-
d({ value: void 0 });
|
|
21402
|
-
});
|
|
21403
|
-
let c = /* @__PURE__ */ new Set();
|
|
21404
|
-
l.forEach((d) => {
|
|
21405
|
-
d === void 0 ? c = void 0 : c !== void 0 && d.forEach((f) => c.add(f));
|
|
21406
|
-
});
|
|
21407
|
-
const u = c ? Array.from(c.keys()) : void 0;
|
|
21408
|
-
o(u);
|
|
21409
|
-
}
|
|
21410
|
-
return Object.freeze({
|
|
21411
|
-
emit(l, c) {
|
|
21412
|
-
r() && (a.push(l), c ? setTimeout(s, 0) : s());
|
|
21413
|
-
},
|
|
21414
|
-
listen(l) {
|
|
21415
|
-
return n.add(l), {
|
|
21416
|
-
unsubscribe: () => {
|
|
21417
|
-
n.delete(l);
|
|
21418
|
-
}
|
|
21419
|
-
};
|
|
21420
|
-
},
|
|
21421
|
-
listenSome(l) {
|
|
21422
|
-
const c = {
|
|
21423
|
-
fn: (d) => {
|
|
21424
|
-
l(d);
|
|
21425
|
-
},
|
|
21426
|
-
namespaces: /* @__PURE__ */ new Set()
|
|
21427
|
-
};
|
|
21428
|
-
i.add(c);
|
|
21429
|
-
const u = {
|
|
21430
|
-
unsubscribe: () => {
|
|
21431
|
-
i.delete(c);
|
|
21432
|
-
},
|
|
21433
|
-
subscribeNs: (d) => (wN(d).forEach((f) => c.namespaces.add(f)), d === void 0 && c.namespaces.add(t()), u)
|
|
21434
|
-
};
|
|
21435
|
-
return u;
|
|
21436
|
-
}
|
|
21437
|
-
});
|
|
21438
|
-
}
|
|
21439
|
-
function x_n(r, e) {
|
|
21440
|
-
let t = !0;
|
|
21441
|
-
function n() {
|
|
21442
|
-
return t;
|
|
21443
|
-
}
|
|
21444
|
-
const i = Object.freeze({
|
|
21445
|
-
onPendingLanguageChange: mZ(n),
|
|
21446
|
-
onLanguageChange: mZ(n),
|
|
21447
|
-
onLoadingChange: mZ(n),
|
|
21448
|
-
onFetchingChange: mZ(n),
|
|
21449
|
-
onInitialLoaded: mZ(n),
|
|
21450
|
-
onRunningChange: mZ(n),
|
|
21451
|
-
onCacheChange: mZ(n),
|
|
21452
|
-
onUpdate: __n(n, r, e),
|
|
21453
|
-
onPermanentChange: mZ(n),
|
|
21454
|
-
setEmitterActive(o) {
|
|
21455
|
-
t = o;
|
|
21456
|
-
},
|
|
21457
|
-
on: ((o, a) => {
|
|
21458
|
-
switch (o) {
|
|
21459
|
-
case "pendingLanguage":
|
|
21460
|
-
return i.onPendingLanguageChange.listen(a);
|
|
21461
|
-
case "language":
|
|
21462
|
-
return i.onLanguageChange.listen(a);
|
|
21463
|
-
case "loading":
|
|
21464
|
-
return i.onLoadingChange.listen(a);
|
|
21465
|
-
case "fetching":
|
|
21466
|
-
return i.onFetchingChange.listen(a);
|
|
21467
|
-
case "initialLoad":
|
|
21468
|
-
return i.onInitialLoaded.listen(a);
|
|
21469
|
-
case "running":
|
|
21470
|
-
return i.onRunningChange.listen(a);
|
|
21471
|
-
case "cache":
|
|
21472
|
-
return i.onCacheChange.listen(a);
|
|
21473
|
-
case "update":
|
|
21474
|
-
return i.onUpdate.listen(a);
|
|
21475
|
-
case "permanentChange":
|
|
21476
|
-
return i.onPermanentChange.listen(a);
|
|
21477
|
-
}
|
|
21478
|
-
})
|
|
21479
|
-
});
|
|
21480
|
-
return i.onInitialLoaded.listen(() => i.onUpdate.emit()), i.onLanguageChange.listen(() => i.onUpdate.emit()), i.onCacheChange.listen(({ value: o }) => i.onUpdate.emit([o.namespace], !0)), i;
|
|
21481
|
-
}
|
|
21482
|
-
const MXt = (r) => {
|
|
21483
|
-
const e = /* @__PURE__ */ new Map();
|
|
21484
|
-
return Object.entries(r).forEach(([t, n]) => {
|
|
21485
|
-
if (n != null) {
|
|
21486
|
-
if (typeof n == "object") {
|
|
21487
|
-
MXt(n).forEach((i, o) => {
|
|
21488
|
-
e.set(t + "." + o, i);
|
|
21489
|
-
});
|
|
21490
|
-
return;
|
|
21491
|
-
}
|
|
21492
|
-
e.set(t, n);
|
|
21493
|
-
}
|
|
21494
|
-
}), e;
|
|
21495
|
-
}, FSe = (r) => {
|
|
21496
|
-
const [e, ...t] = r.split(":"), n = t.join(":");
|
|
21497
|
-
return { language: e, namespace: n || "" };
|
|
21498
|
-
}, S$ = ({ language: r, namespace: e }) => e ? `${r}:${e}` : r;
|
|
21499
|
-
function w_n(r, e, t, n, i, o, a) {
|
|
21500
|
-
const s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
21501
|
-
let c = {}, u = 0;
|
|
21502
|
-
function d(y, x, M) {
|
|
21503
|
-
const S = S$(y);
|
|
21504
|
-
l.set(S, {
|
|
21505
|
-
data: MXt(x),
|
|
21506
|
-
version: M
|
|
21507
|
-
}), r.emit(y);
|
|
21508
|
-
}
|
|
21509
|
-
function f(y) {
|
|
21510
|
-
let x;
|
|
21511
|
-
if (!x) {
|
|
21512
|
-
const M = c[S$(y)];
|
|
21513
|
-
typeof M == "function" && (x = M());
|
|
21514
|
-
}
|
|
21515
|
-
return x || (x = e(y)), x;
|
|
21516
|
-
}
|
|
21517
|
-
function g(y, x) {
|
|
21518
|
-
var M;
|
|
21519
|
-
let S;
|
|
21520
|
-
return x && (S = (M = t(y)) === null || M === void 0 ? void 0 : M.catch(() => (console.warn("Mi18n: Failed to fetch data from dev backend"), f(y)))), S || (S = f(y)), S;
|
|
21521
|
-
}
|
|
21522
|
-
const v = Object.freeze({
|
|
21523
|
-
addStaticData(y) {
|
|
21524
|
-
y && (c = Object.assign(Object.assign({}, c), y), Object.entries(y).forEach(([x, M]) => {
|
|
21525
|
-
if (typeof M != "function") {
|
|
21526
|
-
const S = FSe(x), C = l.get(x);
|
|
21527
|
-
(!C || C.version === 0) && (d(S, M, 0), v.addNamespaceRecord(S, M, 0));
|
|
21528
|
-
}
|
|
21529
|
-
}));
|
|
21530
|
-
},
|
|
21531
|
-
invalidate() {
|
|
21532
|
-
s.clear(), u += 1;
|
|
21533
|
-
},
|
|
21534
|
-
addNamespaceRecord(y, x, M) {
|
|
21535
|
-
!y.namespace && Object.values(x).some((S) => typeof S == "object" && S) && Object.entries(x).forEach(([S, C]) => {
|
|
21536
|
-
typeof C == "object" && C && d(Object.assign(Object.assign({}, y), { namespace: S }), C, M);
|
|
21537
|
-
});
|
|
21538
|
-
},
|
|
21539
|
-
addRecord(y, x) {
|
|
21540
|
-
d(y, x, u), v.addNamespaceRecord(y, x, u);
|
|
21541
|
-
},
|
|
21542
|
-
exists(y, x = !1) {
|
|
21543
|
-
const M = l.get(S$(y));
|
|
21544
|
-
return M && x ? M.version === u : !!M;
|
|
21545
|
-
},
|
|
21546
|
-
getRecord(y) {
|
|
21547
|
-
var x;
|
|
21548
|
-
return (x = l.get(S$(n(y)))) === null || x === void 0 ? void 0 : x.data;
|
|
21549
|
-
},
|
|
21550
|
-
getTranslation(y, x) {
|
|
21551
|
-
var M;
|
|
21552
|
-
return (M = l.get(S$(y))) === null || M === void 0 ? void 0 : M.data.get(x);
|
|
21553
|
-
},
|
|
21554
|
-
getTranslationNs(y, x, M) {
|
|
21555
|
-
var S;
|
|
21556
|
-
for (const C of y)
|
|
21557
|
-
for (const z of x) {
|
|
21558
|
-
const D = (S = l.get(S$({ language: z, namespace: C }))) === null || S === void 0 ? void 0 : S.data.get(M);
|
|
21559
|
-
if (D != null)
|
|
21560
|
-
return [C];
|
|
21561
|
-
}
|
|
21562
|
-
return rit(y);
|
|
21563
|
-
},
|
|
21564
|
-
getTranslationFallback(y, x, M) {
|
|
21565
|
-
var S;
|
|
21566
|
-
for (const C of y)
|
|
21567
|
-
for (const z of x) {
|
|
21568
|
-
const D = (S = l.get(S$({ language: z, namespace: C }))) === null || S === void 0 ? void 0 : S.data.get(M);
|
|
21569
|
-
if (D != null)
|
|
21570
|
-
return { translation: D, namespace: C };
|
|
21571
|
-
}
|
|
21572
|
-
return { translation: void 0, namespace: y[0] };
|
|
21573
|
-
},
|
|
21574
|
-
changeTranslation(y, x, M) {
|
|
21575
|
-
var S;
|
|
21576
|
-
const C = (S = l.get(S$(y))) === null || S === void 0 ? void 0 : S.data;
|
|
21577
|
-
C?.set(x, M), r.emit(Object.assign(Object.assign({}, y), { key: x }));
|
|
21578
|
-
},
|
|
21579
|
-
isFetching(y) {
|
|
21580
|
-
if (i())
|
|
21581
|
-
return !0;
|
|
21582
|
-
if (y === void 0)
|
|
21583
|
-
return s.size > 0;
|
|
21584
|
-
const x = wN(y);
|
|
21585
|
-
return !!Array.from(s.keys()).find((M) => x.includes(FSe(M).namespace));
|
|
21586
|
-
},
|
|
21587
|
-
isLoading(y, x) {
|
|
21588
|
-
const M = wN(x);
|
|
21589
|
-
return !!(i() || Array.from(s.keys()).find((S) => {
|
|
21590
|
-
const C = FSe(S);
|
|
21591
|
-
return (!M.length || M.includes(C.namespace)) && !v.exists({
|
|
21592
|
-
namespace: C.namespace,
|
|
21593
|
-
language: y
|
|
21594
|
-
});
|
|
21595
|
-
}));
|
|
21596
|
-
},
|
|
21597
|
-
async loadRecords(y, x) {
|
|
21598
|
-
const M = y.map((C) => {
|
|
21599
|
-
const z = n(C), D = S$(z), w = s.get(D);
|
|
21600
|
-
if (w)
|
|
21601
|
-
return {
|
|
21602
|
-
new: !1,
|
|
21603
|
-
promise: w,
|
|
21604
|
-
keyObject: z,
|
|
21605
|
-
cacheKey: D
|
|
21606
|
-
};
|
|
21607
|
-
const k = g(z, x) || Promise.resolve(void 0);
|
|
21608
|
-
return s.set(D, k), {
|
|
21609
|
-
new: !0,
|
|
21610
|
-
promise: k,
|
|
21611
|
-
keyObject: z,
|
|
21612
|
-
cacheKey: D
|
|
21613
|
-
};
|
|
21614
|
-
});
|
|
21615
|
-
o.notify(), a.notify();
|
|
21616
|
-
const S = await Promise.all(M.map((C) => C.promise));
|
|
21617
|
-
return M.forEach((C, z) => {
|
|
21618
|
-
const D = s.get(C.cacheKey) !== C.promise;
|
|
21619
|
-
if (C.new && !D) {
|
|
21620
|
-
s.delete(C.cacheKey);
|
|
21621
|
-
const w = S[z];
|
|
21622
|
-
w ? v.addRecord(C.keyObject, w) : v.getRecord(C.keyObject) || v.addRecord(C.keyObject, {});
|
|
21623
|
-
}
|
|
21624
|
-
}), o.notify(), a.notify(), M.map((C) => v.getRecord(C.keyObject));
|
|
21625
|
-
},
|
|
21626
|
-
getAllRecords() {
|
|
21627
|
-
return Array.from(l.entries()).map(([x, M]) => Object.assign(Object.assign({}, FSe(x)), { data: M.data }));
|
|
21628
|
-
}
|
|
21629
|
-
});
|
|
21630
|
-
return v;
|
|
21631
|
-
}
|
|
21632
|
-
function SXt(r, e) {
|
|
21633
|
-
var t = {};
|
|
21634
|
-
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
|
|
21635
|
-
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
21636
|
-
for (var i = 0, n = Object.getOwnPropertySymbols(r); i < n.length; i++)
|
|
21637
|
-
e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[i]) && (t[n[i]] = r[n[i]]);
|
|
21638
|
-
return t;
|
|
21639
|
-
}
|
|
21640
|
-
const A_n = {
|
|
21641
|
-
tagAttributes: {
|
|
21642
|
-
textarea: ["placeholder"],
|
|
21643
|
-
input: ["value", "placeholder"],
|
|
21644
|
-
img: ["alt"],
|
|
21645
|
-
"*": ["aria-label", "title"]
|
|
21646
|
-
},
|
|
21647
|
-
restrictedElements: ["script", "style"],
|
|
21648
|
-
highlightKeys: ["Alt"],
|
|
21649
|
-
highlightColor: "rgb(255, 0, 0)",
|
|
21650
|
-
highlightWidth: 5,
|
|
21651
|
-
inputPrefix: "%-%mi18n:",
|
|
21652
|
-
inputSuffix: "%-%",
|
|
21653
|
-
passToParent: ["option", "optgroup"],
|
|
21654
|
-
fullKeyEncode: !1
|
|
21655
|
-
}, iit = "invalid", M_n = "https://admin.midasbuy.com/i18n/api", S_n = {
|
|
21656
|
-
defaultNs: "",
|
|
21657
|
-
observerOptions: A_n,
|
|
21658
|
-
observerType: "invisible",
|
|
21659
|
-
onFormatError: iit,
|
|
21660
|
-
apiUrl: M_n,
|
|
21661
|
-
fetch: AXt()
|
|
21662
|
-
}, oit = (...r) => {
|
|
21663
|
-
let e = {};
|
|
21664
|
-
return r.forEach((t) => {
|
|
21665
|
-
e = Object.assign(Object.assign(Object.assign({}, e), t), { observerOptions: Object.assign(Object.assign({}, e.observerOptions), t?.observerOptions) });
|
|
21666
|
-
}), e;
|
|
21667
|
-
};
|
|
21668
|
-
function _xt(r, e) {
|
|
21669
|
-
const t = oit(S_n, e?.initialOptions, r);
|
|
21670
|
-
return t.apiUrl = wXt(t.apiUrl), r?.fetch && (t.fetch = AXt(r.fetch)), {
|
|
21671
|
-
initialOptions: t,
|
|
21672
|
-
activeNamespaces: e?.activeNamespaces || /* @__PURE__ */ new Map(),
|
|
21673
|
-
language: e?.language,
|
|
21674
|
-
pendingLanguage: e?.language,
|
|
21675
|
-
isInitialLoading: !1,
|
|
21676
|
-
isRunning: !1
|
|
21677
|
-
};
|
|
21678
|
-
}
|
|
21679
|
-
function C_n(r, e, t, n, i, o, a, s) {
|
|
21680
|
-
const l = {
|
|
21681
|
-
ui: void 0
|
|
21682
|
-
}, c = {
|
|
21683
|
-
formatters: [],
|
|
21684
|
-
finalFormatter: void 0,
|
|
21685
|
-
observer: void 0,
|
|
21686
|
-
devBackend: void 0,
|
|
21687
|
-
backends: [],
|
|
21688
|
-
ui: void 0,
|
|
21689
|
-
languageDetector: void 0,
|
|
21690
|
-
languageStorage: void 0
|
|
21691
|
-
}, u = async ({ keysAndDefaults: U, event: G }) => {
|
|
21692
|
-
var q;
|
|
21693
|
-
const K = U.map(({ key: W, ns: F, defaultValue: X }) => {
|
|
21694
|
-
const { translation: Z } = o({
|
|
21695
|
-
key: W,
|
|
21696
|
-
ns: F
|
|
21697
|
-
});
|
|
21698
|
-
return {
|
|
21699
|
-
key: W,
|
|
21700
|
-
defaultValue: X,
|
|
21701
|
-
fallbackNamespaces: n(F),
|
|
21702
|
-
namespace: i({ key: W, ns: F })[0],
|
|
21703
|
-
translation: Z
|
|
21704
|
-
};
|
|
21705
|
-
});
|
|
21706
|
-
(q = c.ui) === null || q === void 0 || q.handleElementClick(K, G);
|
|
21707
|
-
}, d = (U, G) => {
|
|
21708
|
-
var q;
|
|
21709
|
-
return ((q = c.observer) === null || q === void 0 ? void 0 : q.findPositions(U, G)) || [];
|
|
21710
|
-
};
|
|
21711
|
-
function f(U) {
|
|
21712
|
-
const { translation: G } = o({
|
|
21713
|
-
key: U.key,
|
|
21714
|
-
ns: U.ns
|
|
21715
|
-
});
|
|
21716
|
-
return H.formatTranslation(Object.assign(Object.assign({}, U), { translation: G, formatEnabled: !0 }));
|
|
21717
|
-
}
|
|
21718
|
-
function g() {
|
|
21719
|
-
return { fetch: e().fetch };
|
|
21720
|
-
}
|
|
21721
|
-
function v(U) {
|
|
21722
|
-
c.observer = U?.();
|
|
21723
|
-
}
|
|
21724
|
-
function y() {
|
|
21725
|
-
return !!c.observer;
|
|
21726
|
-
}
|
|
21727
|
-
function x(U) {
|
|
21728
|
-
U && c.formatters.push(U);
|
|
21729
|
-
}
|
|
21730
|
-
function M(U) {
|
|
21731
|
-
c.finalFormatter = U;
|
|
21732
|
-
}
|
|
21733
|
-
function S(U) {
|
|
21734
|
-
l.ui = U;
|
|
21735
|
-
}
|
|
21736
|
-
function C() {
|
|
21737
|
-
return !!l.ui;
|
|
21738
|
-
}
|
|
21739
|
-
function z(U) {
|
|
21740
|
-
c.languageStorage = U;
|
|
21741
|
-
}
|
|
21742
|
-
function D(U) {
|
|
21743
|
-
c.languageDetector = U;
|
|
21744
|
-
}
|
|
21745
|
-
function w() {
|
|
21746
|
-
if (!c.languageDetector)
|
|
21747
|
-
return;
|
|
21748
|
-
const U = t();
|
|
21749
|
-
return c.languageDetector.getLanguage(Object.assign({ availableLanguages: U }, g()));
|
|
21750
|
-
}
|
|
21751
|
-
function k(U) {
|
|
21752
|
-
U && c.backends.push(U);
|
|
21753
|
-
}
|
|
21754
|
-
function R(U) {
|
|
21755
|
-
c.devBackend = U;
|
|
21756
|
-
}
|
|
21757
|
-
function P(U, G) {
|
|
21758
|
-
const q = Object.freeze({
|
|
21759
|
-
setFinalFormatter: M,
|
|
21760
|
-
addFormatter: x,
|
|
21761
|
-
setObserver: v,
|
|
21762
|
-
hasObserver: y,
|
|
21763
|
-
setUi: S,
|
|
21764
|
-
hasUi: C,
|
|
21765
|
-
setDevBackend: R,
|
|
21766
|
-
addBackend: k,
|
|
21767
|
-
setLanguageDetector: D,
|
|
21768
|
-
setLanguageStorage: z
|
|
21769
|
-
});
|
|
21770
|
-
G(U, q);
|
|
21771
|
-
}
|
|
21772
|
-
const H = Object.freeze({
|
|
21773
|
-
addPlugin: P,
|
|
21774
|
-
run() {
|
|
21775
|
-
var U, G;
|
|
21776
|
-
const { apiKey: q, apiUrl: K, projectId: W, observerOptions: F } = e();
|
|
21777
|
-
c.ui = (U = l.ui) === null || U === void 0 ? void 0 : U.call(l, {
|
|
21778
|
-
apiKey: q,
|
|
21779
|
-
apiUrl: K,
|
|
21780
|
-
projectId: W,
|
|
21781
|
-
highlight: H.highlight,
|
|
21782
|
-
changeTranslation: a,
|
|
21783
|
-
findPositions: d,
|
|
21784
|
-
onPermanentChange: s
|
|
21785
|
-
}), (G = c.observer) === null || G === void 0 || G.run({
|
|
21786
|
-
mouseHighlight: !0,
|
|
21787
|
-
options: F,
|
|
21788
|
-
translate: f,
|
|
21789
|
-
onClick: u
|
|
21790
|
-
});
|
|
21791
|
-
},
|
|
21792
|
-
stop() {
|
|
21793
|
-
var U;
|
|
21794
|
-
c.ui = void 0, (U = c.observer) === null || U === void 0 || U.stop();
|
|
21795
|
-
},
|
|
21796
|
-
getLanguageStorage() {
|
|
21797
|
-
return c.languageStorage;
|
|
21798
|
-
},
|
|
21799
|
-
getInitialLanguage() {
|
|
21800
|
-
var U;
|
|
21801
|
-
const G = t(), q = (U = c.languageStorage) === null || U === void 0 ? void 0 : U.getLanguage(g());
|
|
21802
|
-
return oIe(q, (K) => (!G || G.includes(K)) && K ? K : w());
|
|
21803
|
-
},
|
|
21804
|
-
setStoredLanguage(U) {
|
|
21805
|
-
var G;
|
|
21806
|
-
(G = c.languageStorage) === null || G === void 0 || G.setLanguage(U, g());
|
|
21807
|
-
},
|
|
21808
|
-
getDevBackend() {
|
|
21809
|
-
return c.devBackend;
|
|
21810
|
-
},
|
|
21811
|
-
getBackendRecord: (({ language: U, namespace: G }) => {
|
|
21812
|
-
for (const q of c.backends) {
|
|
21813
|
-
const K = q.getRecord(Object.assign({
|
|
21814
|
-
language: U,
|
|
21815
|
-
namespace: G
|
|
21816
|
-
}, g()));
|
|
21817
|
-
if (xft(K))
|
|
21818
|
-
return K?.catch((W) => (console.error(W), {}));
|
|
21819
|
-
if (K !== void 0)
|
|
21820
|
-
return K;
|
|
21821
|
-
}
|
|
21822
|
-
}),
|
|
21823
|
-
getBackendDevRecord: (({ language: U, namespace: G }) => {
|
|
21824
|
-
var q;
|
|
21825
|
-
const { apiKey: K, apiUrl: W, projectId: F } = e();
|
|
21826
|
-
return (q = c.devBackend) === null || q === void 0 ? void 0 : q.getRecord(Object.assign({
|
|
21827
|
-
apiKey: K,
|
|
21828
|
-
apiUrl: W,
|
|
21829
|
-
projectId: F,
|
|
21830
|
-
language: U,
|
|
21831
|
-
namespace: G
|
|
21832
|
-
}, g()));
|
|
21833
|
-
}),
|
|
21834
|
-
getLanguageDetector() {
|
|
21835
|
-
return c.languageDetector;
|
|
21836
|
-
},
|
|
21837
|
-
retranslate() {
|
|
21838
|
-
var U;
|
|
21839
|
-
(U = c.observer) === null || U === void 0 || U.retranslate();
|
|
21840
|
-
},
|
|
21841
|
-
highlight: ((U, G) => {
|
|
21842
|
-
var q, K;
|
|
21843
|
-
return ((K = (q = c.observer) === null || q === void 0 ? void 0 : q.highlight) === null || K === void 0 ? void 0 : K.call(q, U, G)) || { unhighlight() {
|
|
21844
|
-
} };
|
|
21845
|
-
}),
|
|
21846
|
-
unwrap(U) {
|
|
21847
|
-
var G;
|
|
21848
|
-
return c.observer ? (G = c.observer) === null || G === void 0 ? void 0 : G.unwrap(U) : { text: U, keys: [] };
|
|
21849
|
-
},
|
|
21850
|
-
wrap(U) {
|
|
21851
|
-
var G;
|
|
21852
|
-
return c.observer ? (G = c.observer) === null || G === void 0 ? void 0 : G.wrap(U) : U.translation;
|
|
21853
|
-
},
|
|
21854
|
-
hasDevBackend() {
|
|
21855
|
-
return !!H.getDevBackend();
|
|
21856
|
-
},
|
|
21857
|
-
formatTranslation(U) {
|
|
21858
|
-
var G, { formatEnabled: q } = U, K = SXt(U, ["formatEnabled"]);
|
|
21859
|
-
const { key: W, translation: F, defaultValue: X, noWrap: Z, params: ee, orEmpty: ie, ns: le } = K, ue = F || X || (ie ? "" : W);
|
|
21860
|
-
let we = ue || (ie ? "" : W);
|
|
21861
|
-
const ye = r(), Se = q || !(!((G = c.observer) === null || G === void 0) && G.outputNotFormattable), pe = (me) => c.observer && !Z ? c.observer.wrap({
|
|
21862
|
-
key: W,
|
|
21863
|
-
translation: me,
|
|
21864
|
-
defaultValue: X,
|
|
21865
|
-
params: ee,
|
|
21866
|
-
ns: le
|
|
21867
|
-
}) : me;
|
|
21868
|
-
we = pe(we);
|
|
21869
|
-
try {
|
|
21870
|
-
if (ue && ye && Se)
|
|
21871
|
-
for (const me of c.formatters)
|
|
21872
|
-
we = me.format({
|
|
21873
|
-
translation: we,
|
|
21874
|
-
language: ye,
|
|
21875
|
-
params: ee
|
|
21876
|
-
});
|
|
21877
|
-
c.finalFormatter && ue && ye && Se && (we = c.finalFormatter.format({
|
|
21878
|
-
translation: we,
|
|
21879
|
-
language: ye,
|
|
21880
|
-
params: ee
|
|
21881
|
-
}));
|
|
21882
|
-
} catch (me) {
|
|
21883
|
-
console.error(me);
|
|
21884
|
-
const se = b_n(me) || iit, xe = e().onFormatError, Ie = typeof xe;
|
|
21885
|
-
Ie === "string" ? we = xe : Ie === "function" ? we = xe(se, K) : we = iit, we = pe(we);
|
|
21886
|
-
}
|
|
21887
|
-
return we;
|
|
21888
|
-
}
|
|
21889
|
-
});
|
|
21890
|
-
return H;
|
|
21891
|
-
}
|
|
21892
|
-
const xxt = (r, e, t) => {
|
|
21893
|
-
let n = r;
|
|
21894
|
-
return Object.freeze({
|
|
21895
|
-
init(i) {
|
|
21896
|
-
n = i;
|
|
21897
|
-
},
|
|
21898
|
-
notify() {
|
|
21899
|
-
const i = e();
|
|
21900
|
-
n !== i && t(i), n = i;
|
|
21901
|
-
}
|
|
21902
|
-
});
|
|
21903
|
-
};
|
|
21904
|
-
function O_n(r, e, t) {
|
|
21905
|
-
let n = _xt(), i;
|
|
21906
|
-
const o = Object.freeze({
|
|
21907
|
-
init(a) {
|
|
21908
|
-
n = _xt(a, n);
|
|
21909
|
-
},
|
|
21910
|
-
isRunning() {
|
|
21911
|
-
return n.isRunning;
|
|
21912
|
-
},
|
|
21913
|
-
setRunning(a) {
|
|
21914
|
-
n.isRunning !== a && (n.isRunning = a, t.emit(a));
|
|
21915
|
-
},
|
|
21916
|
-
isInitialLoading() {
|
|
21917
|
-
return n.isInitialLoading;
|
|
21918
|
-
},
|
|
21919
|
-
setInitialLoading(a) {
|
|
21920
|
-
n.isInitialLoading = a;
|
|
21921
|
-
},
|
|
21922
|
-
getLanguage() {
|
|
21923
|
-
return n.language || n.initialOptions.language;
|
|
21924
|
-
},
|
|
21925
|
-
setLanguage(a) {
|
|
21926
|
-
n.language !== a && (n.language = a, r.emit(a));
|
|
21927
|
-
},
|
|
21928
|
-
getPendingLanguage() {
|
|
21929
|
-
return n.pendingLanguage || o.getLanguage();
|
|
21930
|
-
},
|
|
21931
|
-
setPendingLanguage(a) {
|
|
21932
|
-
n.pendingLanguage !== a && (n.pendingLanguage = a, e.emit(a));
|
|
21933
|
-
},
|
|
21934
|
-
getInitialOptions() {
|
|
21935
|
-
return Object.assign(Object.assign({}, n.initialOptions), i);
|
|
21936
|
-
},
|
|
21937
|
-
addActiveNs(a) {
|
|
21938
|
-
wN(a).forEach((l) => {
|
|
21939
|
-
const c = n.activeNamespaces.get(l);
|
|
21940
|
-
c !== void 0 ? n.activeNamespaces.set(l, c + 1) : n.activeNamespaces.set(l, 1);
|
|
21941
|
-
});
|
|
21942
|
-
},
|
|
21943
|
-
removeActiveNs(a) {
|
|
21944
|
-
wN(a).forEach((l) => {
|
|
21945
|
-
const c = n.activeNamespaces.get(l);
|
|
21946
|
-
c !== void 0 && c > 1 ? n.activeNamespaces.set(l, c - 1) : n.activeNamespaces.delete(l);
|
|
21947
|
-
});
|
|
21948
|
-
},
|
|
21949
|
-
getRequiredNamespaces() {
|
|
21950
|
-
return rit([
|
|
21951
|
-
...n.initialOptions.ns || [n.initialOptions.defaultNs],
|
|
21952
|
-
...wN(n.initialOptions.fallbackNs),
|
|
21953
|
-
...n.activeNamespaces.keys()
|
|
21954
|
-
]);
|
|
21955
|
-
},
|
|
21956
|
-
getFallbackLangs(a) {
|
|
21957
|
-
const s = a || o.getLanguage();
|
|
21958
|
-
return s ? rit([
|
|
21959
|
-
s,
|
|
21960
|
-
...v_n(s, n.initialOptions.fallbackLanguage)
|
|
21961
|
-
]) : [];
|
|
21962
|
-
},
|
|
21963
|
-
getFallbackNs() {
|
|
21964
|
-
return wN(n.initialOptions.fallbackNs);
|
|
21965
|
-
},
|
|
21966
|
-
getDefaultNs(a) {
|
|
21967
|
-
return a === void 0 ? n.initialOptions.defaultNs : a;
|
|
21968
|
-
},
|
|
21969
|
-
getAvailableLanguages() {
|
|
21970
|
-
if (n.initialOptions.availableLanguages)
|
|
21971
|
-
return n.initialOptions.availableLanguages;
|
|
21972
|
-
if (n.initialOptions.staticData) {
|
|
21973
|
-
const a = Object.keys(n.initialOptions.staticData).map((s) => FSe(s).language);
|
|
21974
|
-
return Array.from(new Set(a));
|
|
21975
|
-
}
|
|
21976
|
-
},
|
|
21977
|
-
withDefaultNs(a) {
|
|
21978
|
-
return {
|
|
21979
|
-
namespace: a.namespace === void 0 ? o.getInitialOptions().defaultNs : a.namespace,
|
|
21980
|
-
language: a.language
|
|
21981
|
-
};
|
|
21982
|
-
},
|
|
21983
|
-
overrideCredentials(a) {
|
|
21984
|
-
a ? i = Object.assign(Object.assign({}, a), { apiUrl: wXt(a.apiUrl) }) : i = void 0;
|
|
21985
|
-
}
|
|
21986
|
-
});
|
|
21987
|
-
return o;
|
|
21988
|
-
}
|
|
21989
|
-
function T_n(r) {
|
|
21990
|
-
var { ns: e, noWrap: t, orEmpty: n, params: i, language: o } = r, a = SXt(r, ["ns", "noWrap", "orEmpty", "params", "language"]);
|
|
21991
|
-
return Object.assign(Object.assign({}, {
|
|
21992
|
-
ns: e,
|
|
21993
|
-
noWrap: t,
|
|
21994
|
-
orEmpty: n,
|
|
21995
|
-
language: o
|
|
21996
|
-
}), { params: Object.assign({}, a) });
|
|
21997
|
-
}
|
|
21998
|
-
const CXt = (r, ...e) => {
|
|
21999
|
-
let t = {}, n;
|
|
22000
|
-
return typeof r == "object" ? t = r : (t.key = r, typeof e[0] == "string" ? (t.defaultValue = e[0], n = e[1]) : typeof e[0] == "object" && (n = e[0])), n && (t = Object.assign(Object.assign({}, T_n(n)), t)), t;
|
|
22001
|
-
};
|
|
22002
|
-
function E_n({ options: r }) {
|
|
22003
|
-
const e = x_n(l, c), t = xxt(!1, () => a.isFetching(), e.onFetchingChange.emit), n = xxt(!1, () => w.isLoading(), e.onLoadingChange.emit), i = O_n(e.onLanguageChange, e.onPendingLanguageChange, e.onRunningChange), o = C_n(i.getLanguage, i.getInitialOptions, i.getAvailableLanguages, u, M, S, f, g), a = w_n(e.onCacheChange, o.getBackendRecord, o.getBackendDevRecord, i.withDefaultNs, i.isInitialLoading, t, n);
|
|
22004
|
-
r && v(r);
|
|
22005
|
-
let s;
|
|
22006
|
-
e.onUpdate.listen(() => {
|
|
22007
|
-
i.isRunning() && o.retranslate();
|
|
22008
|
-
});
|
|
22009
|
-
function l() {
|
|
22010
|
-
return i.getFallbackNs();
|
|
22011
|
-
}
|
|
22012
|
-
function c(k) {
|
|
22013
|
-
return i.getDefaultNs(k);
|
|
22014
|
-
}
|
|
22015
|
-
function u(k) {
|
|
22016
|
-
return [...wN(c(k)), ...l()];
|
|
22017
|
-
}
|
|
22018
|
-
function d(k) {
|
|
22019
|
-
return [
|
|
22020
|
-
...wN(k ?? c()),
|
|
22021
|
-
...i.getRequiredNamespaces()
|
|
22022
|
-
];
|
|
22023
|
-
}
|
|
22024
|
-
function f(k, R, P) {
|
|
22025
|
-
const H = i.withDefaultNs(k), U = a.getTranslation(H, R);
|
|
22026
|
-
return a.changeTranslation(H, R, P), {
|
|
22027
|
-
revert() {
|
|
22028
|
-
a.changeTranslation(H, R, U);
|
|
22029
|
-
}
|
|
22030
|
-
};
|
|
22031
|
-
}
|
|
22032
|
-
function g(k) {
|
|
22033
|
-
e.onPermanentChange.emit({
|
|
22034
|
-
key: k.key,
|
|
22035
|
-
namespace: k.namespace
|
|
22036
|
-
});
|
|
22037
|
-
}
|
|
22038
|
-
function v(k) {
|
|
22039
|
-
i.init(k), a.addStaticData(i.getInitialOptions().staticData);
|
|
22040
|
-
}
|
|
22041
|
-
function y(k, R) {
|
|
22042
|
-
const P = i.getFallbackLangs(k), H = d(R), U = [];
|
|
22043
|
-
return P.forEach((G) => {
|
|
22044
|
-
H.forEach((q) => {
|
|
22045
|
-
a.exists({ language: G, namespace: q }, !0) || U.push({ language: G, namespace: q });
|
|
22046
|
-
});
|
|
22047
|
-
}), U;
|
|
22048
|
-
}
|
|
22049
|
-
function x(k, R) {
|
|
22050
|
-
const P = y(k, R);
|
|
22051
|
-
if (P.length)
|
|
22052
|
-
return oIe(w.loadRecords(P), () => {
|
|
22053
|
-
});
|
|
22054
|
-
}
|
|
22055
|
-
function M({ key: k, ns: R }) {
|
|
22056
|
-
const P = i.getFallbackLangs(), H = u(R ?? void 0);
|
|
22057
|
-
return a.getTranslationNs(H, P, k);
|
|
22058
|
-
}
|
|
22059
|
-
function S({ key: k, ns: R, language: P }) {
|
|
22060
|
-
const H = u(R ?? void 0), U = i.getFallbackLangs(P);
|
|
22061
|
-
return a.getTranslationFallback(H, U, k);
|
|
22062
|
-
}
|
|
22063
|
-
function C() {
|
|
22064
|
-
const k = oIe(z(), () => x());
|
|
22065
|
-
if (xft(k))
|
|
22066
|
-
return i.setInitialLoading(!0), t.notify(), n.notify(), Promise.resolve(k).then(() => {
|
|
22067
|
-
i.setInitialLoading(!1), t.notify(), n.notify(), e.onInitialLoaded.emit();
|
|
22068
|
-
});
|
|
22069
|
-
e.onInitialLoaded.emit();
|
|
22070
|
-
}
|
|
22071
|
-
function z() {
|
|
22072
|
-
if (i.getLanguage())
|
|
22073
|
-
return;
|
|
22074
|
-
const R = o.getInitialLanguage();
|
|
22075
|
-
return oIe(R, (P) => {
|
|
22076
|
-
const H = P || i.getInitialOptions().defaultLanguage;
|
|
22077
|
-
H && i.setLanguage(H);
|
|
22078
|
-
});
|
|
22079
|
-
}
|
|
22080
|
-
function D() {
|
|
22081
|
-
if ((o.getLanguageDetector() || o.getLanguageStorage()) && !i.getAvailableLanguages())
|
|
22082
|
-
throw new Error(yxt("availableLanguages"));
|
|
22083
|
-
if (!i.getLanguage() && !i.getInitialOptions().defaultLanguage)
|
|
22084
|
-
throw new Error(yxt(["defaultLanguage", "language"]));
|
|
22085
|
-
}
|
|
22086
|
-
const w = Object.freeze(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, e), i), o), a), {
|
|
22087
|
-
init: v,
|
|
22088
|
-
getTranslation: S,
|
|
22089
|
-
changeTranslation: f,
|
|
22090
|
-
getTranslationNs: M,
|
|
22091
|
-
getDefaultAndFallbackNs: u,
|
|
22092
|
-
async changeLanguage(k) {
|
|
22093
|
-
i.getPendingLanguage() === k && i.getLanguage() === k || (i.setPendingLanguage(k), i.isRunning() && await x(k), k === i.getPendingLanguage() && (i.setLanguage(k), o.setStoredLanguage(k)));
|
|
22094
|
-
},
|
|
22095
|
-
async addActiveNs(k, R) {
|
|
22096
|
-
R || i.addActiveNs(k), i.isRunning() && await x(void 0, k);
|
|
22097
|
-
},
|
|
22098
|
-
loadRecords(k) {
|
|
22099
|
-
return a.loadRecords(k, w.isDev());
|
|
22100
|
-
},
|
|
22101
|
-
async loadRecord(k) {
|
|
22102
|
-
return (await w.loadRecords([k]))[0];
|
|
22103
|
-
},
|
|
22104
|
-
isLoading(k) {
|
|
22105
|
-
return a.isLoading(i.getLanguage(), k);
|
|
22106
|
-
},
|
|
22107
|
-
isLoaded(k) {
|
|
22108
|
-
const R = i.getLanguage();
|
|
22109
|
-
if (!R)
|
|
22110
|
-
return !1;
|
|
22111
|
-
const P = i.getFallbackLangs(R), H = d(k), U = [];
|
|
22112
|
-
return P.forEach((G) => {
|
|
22113
|
-
H.forEach((q) => {
|
|
22114
|
-
a.exists({ language: G, namespace: q }) || U.push({ language: G, namespace: q });
|
|
22115
|
-
});
|
|
22116
|
-
}), U.length === 0;
|
|
22117
|
-
},
|
|
22118
|
-
t: ((...k) => {
|
|
22119
|
-
const R = CXt(...k), { translation: P, namespace: H } = S(R);
|
|
22120
|
-
return o.formatTranslation(Object.assign(Object.assign({}, R), { translation: P, ns: H }));
|
|
22121
|
-
}),
|
|
22122
|
-
isDev() {
|
|
22123
|
-
return !!(i.getInitialOptions().apiKey && i.getInitialOptions().apiUrl);
|
|
22124
|
-
},
|
|
22125
|
-
run() {
|
|
22126
|
-
return D(), i.isRunning() || (i.setRunning(!0), o.run(), s = C()), Promise.resolve(s);
|
|
22127
|
-
},
|
|
22128
|
-
stop() {
|
|
22129
|
-
i.isRunning() && (o.stop(), i.setRunning(!1));
|
|
22130
|
-
}
|
|
22131
|
-
}));
|
|
22132
|
-
return w;
|
|
22674
|
+
var Axt;
|
|
22675
|
+
function fxn() {
|
|
22676
|
+
return Axt || (Axt = 1, process.env.NODE_ENV === "production" ? nLe.exports = uxn() : nLe.exports = dxn()), nLe.exports;
|
|
22133
22677
|
}
|
|
22134
|
-
|
|
22135
|
-
const e = E_n({
|
|
22136
|
-
options: r
|
|
22137
|
-
});
|
|
22138
|
-
e.isDev() && e.invalidate();
|
|
22139
|
-
function t(i) {
|
|
22140
|
-
const o = e.isRunning();
|
|
22141
|
-
o && e.stop(), i(), e.isDev() && e.invalidate(), o && e.run();
|
|
22142
|
-
}
|
|
22143
|
-
const n = Object.freeze({
|
|
22144
|
-
/**
|
|
22145
|
-
* Listen to mi18n events.
|
|
22146
|
-
*/
|
|
22147
|
-
on: e.on,
|
|
22148
|
-
/**
|
|
22149
|
-
* Listen for specific namespaces changes.
|
|
22150
|
-
*
|
|
22151
|
-
* ```
|
|
22152
|
-
* const sub = mi18n.onUpdate(handler)
|
|
22153
|
-
*
|
|
22154
|
-
* // subscribe to selected namespace
|
|
22155
|
-
* sub.subscribeNs(['common'])
|
|
22156
|
-
*
|
|
22157
|
-
* // unsubscribe
|
|
22158
|
-
* sub.unsubscribe()
|
|
22159
|
-
* ```
|
|
22160
|
-
*/
|
|
22161
|
-
onNsUpdate: e.onUpdate.listenSome,
|
|
22162
|
-
/**
|
|
22163
|
-
* Turn off/on events emitting. Is on by default.
|
|
22164
|
-
*/
|
|
22165
|
-
setEmitterActive: e.setEmitterActive,
|
|
22166
|
-
/**
|
|
22167
|
-
* @return current language if set.
|
|
22168
|
-
*/
|
|
22169
|
-
getLanguage: e.getLanguage,
|
|
22170
|
-
/**
|
|
22171
|
-
* `pendingLanguage` represents language which is currently being loaded.
|
|
22172
|
-
* @return current `pendingLanguage` if set.
|
|
22173
|
-
*/
|
|
22174
|
-
getPendingLanguage: e.getPendingLanguage,
|
|
22175
|
-
/**
|
|
22176
|
-
* Change current language.
|
|
22177
|
-
* - if not running sets `pendingLanguage`, `language` to the new value
|
|
22178
|
-
* - if running sets `pendingLanguage` to the value, fetches necessary data and then changes `language`
|
|
22179
|
-
*
|
|
22180
|
-
* @return Promise which is resolved when `language` is changed.
|
|
22181
|
-
*/
|
|
22182
|
-
changeLanguage: e.changeLanguage,
|
|
22183
|
-
/**
|
|
22184
|
-
* Temporarily change translation in cache.
|
|
22185
|
-
* @return object with revert method.
|
|
22186
|
-
*/
|
|
22187
|
-
changeTranslation: e.changeTranslation,
|
|
22188
|
-
/**
|
|
22189
|
-
* Adds namespace(s) list of active namespaces. And if mi18n is running, loads required data.
|
|
22190
|
-
*/
|
|
22191
|
-
addActiveNs: e.addActiveNs,
|
|
22192
|
-
/**
|
|
22193
|
-
* Remove namespace(s) from active namespaces.
|
|
22194
|
-
*
|
|
22195
|
-
* Mi18n internally counts how many times was each active namespace added,
|
|
22196
|
-
* so this method will remove namespace only if the counter goes down to 0.
|
|
22197
|
-
*/
|
|
22198
|
-
removeActiveNs: e.removeActiveNs,
|
|
22199
|
-
/**
|
|
22200
|
-
* Manually load multiple records from `Backend` (or `DevBackend` when in dev mode)
|
|
22201
|
-
*
|
|
22202
|
-
* It loads data together and adds them to cache in one operation, to prevent partly loaded state.
|
|
22203
|
-
*/
|
|
22204
|
-
loadRecords: e.loadRecords,
|
|
22205
|
-
/**
|
|
22206
|
-
* Manually load record from `Backend` (or `DevBackend` when in dev mode)
|
|
22207
|
-
*/
|
|
22208
|
-
loadRecord: e.loadRecord,
|
|
22209
|
-
/**
|
|
22210
|
-
*
|
|
22211
|
-
*/
|
|
22212
|
-
addStaticData: e.addStaticData,
|
|
22213
|
-
/**
|
|
22214
|
-
* Get record from cache.
|
|
22215
|
-
*/
|
|
22216
|
-
getRecord: e.getRecord,
|
|
22217
|
-
/**
|
|
22218
|
-
* Get all records from cache.
|
|
22219
|
-
*/
|
|
22220
|
-
getAllRecords: e.getAllRecords,
|
|
22221
|
-
/**
|
|
22222
|
-
* @param ns optional list of namespaces that you are interested in
|
|
22223
|
-
* @return `true` if there are data that need to be fetched.
|
|
22224
|
-
*/
|
|
22225
|
-
isLoaded: e.isLoaded,
|
|
22226
|
-
/**
|
|
22227
|
-
* @return `true` if mi18n is loading initial data (triggered by `run`).
|
|
22228
|
-
*/
|
|
22229
|
-
isInitialLoading: e.isInitialLoading,
|
|
22230
|
-
/**
|
|
22231
|
-
* @param ns optional list of namespaces that you are interested in
|
|
22232
|
-
* @return `true` if mi18n is loading some translations for the first time.
|
|
22233
|
-
*/
|
|
22234
|
-
isLoading: e.isLoading,
|
|
22235
|
-
/**
|
|
22236
|
-
* @param ns optional list of namespaces that you are interested in
|
|
22237
|
-
* @return `true` if mi18n is fetching some translations.
|
|
22238
|
-
*/
|
|
22239
|
-
isFetching: e.isFetching,
|
|
22240
|
-
/**
|
|
22241
|
-
* @return `true` if mi18n is running.
|
|
22242
|
-
*/
|
|
22243
|
-
isRunning: e.isRunning,
|
|
22244
|
-
/**
|
|
22245
|
-
* Changes internal state to running: true and loads initial files.
|
|
22246
|
-
* Runs runnable plugins mainly Observer if present.
|
|
22247
|
-
*/
|
|
22248
|
-
run: e.run,
|
|
22249
|
-
/**
|
|
22250
|
-
* Changes internal state to running: false and stops runnable plugins.
|
|
22251
|
-
*/
|
|
22252
|
-
stop: e.stop,
|
|
22253
|
-
/**
|
|
22254
|
-
* Returns translated and formatted key.
|
|
22255
|
-
* If Observer is present and mi18n is running, wraps result to be identifiable in the DOM.
|
|
22256
|
-
*/
|
|
22257
|
-
t: e.t,
|
|
22258
|
-
/**
|
|
22259
|
-
* Highlight keys that match selection.
|
|
22260
|
-
*/
|
|
22261
|
-
highlight: e.highlight,
|
|
22262
|
-
/**
|
|
22263
|
-
* @return current Mi18n options.
|
|
22264
|
-
*/
|
|
22265
|
-
getInitialOptions: e.getInitialOptions,
|
|
22266
|
-
/**
|
|
22267
|
-
* Mi18n is in dev mode if `DevTools` plugin is used and `apiKey` + `apiUrl` are specified.
|
|
22268
|
-
* @return `true` if mi18n is in dev mode.
|
|
22269
|
-
*/
|
|
22270
|
-
isDev: e.isDev,
|
|
22271
|
-
/**
|
|
22272
|
-
* Wraps translation if there is `Observer` plugin
|
|
22273
|
-
*/
|
|
22274
|
-
wrap: e.wrap,
|
|
22275
|
-
/**
|
|
22276
|
-
* Unwrap translation
|
|
22277
|
-
*/
|
|
22278
|
-
unwrap: e.unwrap,
|
|
22279
|
-
/**
|
|
22280
|
-
* Override creadentials passed on initialization.
|
|
22281
|
-
*
|
|
22282
|
-
* When called in running state, mi18n stops and runs again.
|
|
22283
|
-
*/
|
|
22284
|
-
overrideCredentials(i) {
|
|
22285
|
-
t(() => e.overrideCredentials(i));
|
|
22286
|
-
},
|
|
22287
|
-
/**
|
|
22288
|
-
* Add mi18n plugin after initialization.
|
|
22289
|
-
*
|
|
22290
|
-
* When called in running state, mi18n stops and runs again.
|
|
22291
|
-
*/
|
|
22292
|
-
addPlugin(i) {
|
|
22293
|
-
i && t(() => e.addPlugin(n, i));
|
|
22294
|
-
},
|
|
22295
|
-
/**
|
|
22296
|
-
* Updates options after instance creation. Extends existing options,
|
|
22297
|
-
* so it only changes the fields, that are listed.
|
|
22298
|
-
*
|
|
22299
|
-
* When called in running state, mi18n stops and runs again.
|
|
22300
|
-
*/
|
|
22301
|
-
updateOptions(i) {
|
|
22302
|
-
i && t(() => e.init(i));
|
|
22303
|
-
}
|
|
22304
|
-
});
|
|
22305
|
-
return n;
|
|
22306
|
-
}
|
|
22307
|
-
const k_n = () => {
|
|
22308
|
-
const r = {
|
|
22309
|
-
plugins: [],
|
|
22310
|
-
options: {}
|
|
22311
|
-
}, e = Object.freeze({
|
|
22312
|
-
use(t) {
|
|
22313
|
-
return r.plugins.push(t), e;
|
|
22314
|
-
},
|
|
22315
|
-
updateDefaults(t) {
|
|
22316
|
-
return r.options = oit(r.options, t), e;
|
|
22317
|
-
},
|
|
22318
|
-
init(t) {
|
|
22319
|
-
const n = z_n(oit(r.options, t));
|
|
22320
|
-
return r.plugins.forEach(n.addPlugin), n;
|
|
22321
|
-
}
|
|
22322
|
-
});
|
|
22323
|
-
return e;
|
|
22324
|
-
}, OXt = 0, ait = 1, L_n = 2;
|
|
22325
|
-
let R_n = class extends Error {
|
|
22326
|
-
constructor(e, t, n) {
|
|
22327
|
-
let i;
|
|
22328
|
-
e === OXt ? i = "Empty parameter" : e === ait ? i = "Unexpected character" : i = "Unexpected end", super(`Mi18n parser: ${i} at ${t} in "${n}"`), this.code = e, this.index = t;
|
|
22329
|
-
}
|
|
22330
|
-
};
|
|
22331
|
-
function wxt(r) {
|
|
22332
|
-
return /\s/.test(r);
|
|
22333
|
-
}
|
|
22334
|
-
const VZ = 0, sit = 1, aIe = 2, THe = 3, EHe = 4, D_n = /* @__PURE__ */ new Set([
|
|
22335
|
-
aIe,
|
|
22336
|
-
sit,
|
|
22337
|
-
VZ
|
|
22338
|
-
]), lit = "'", I_n = /* @__PURE__ */ new Set(["{", "}", lit]), N_n = (r) => /[0-9a-zA-Z_]/.test(r);
|
|
22339
|
-
function P_n(r) {
|
|
22340
|
-
let e = VZ, t = "", n = "", i = "";
|
|
22341
|
-
const o = [], a = [];
|
|
22342
|
-
let s = 0;
|
|
22343
|
-
function l(f) {
|
|
22344
|
-
throw new R_n(f, s, r);
|
|
22345
|
-
}
|
|
22346
|
-
const c = () => {
|
|
22347
|
-
o.push(t), t = "";
|
|
22348
|
-
}, u = () => {
|
|
22349
|
-
N_n(i) || l(ait), n += i;
|
|
22350
|
-
}, d = () => {
|
|
22351
|
-
n === "" && l(OXt), a.push(n), n = "";
|
|
22352
|
-
};
|
|
22353
|
-
for (s = 0; s < r.length; s++)
|
|
22354
|
-
switch (i = r[s], e) {
|
|
22355
|
-
case VZ:
|
|
22356
|
-
i === lit ? (t += i, e = sit) : i === "{" ? (c(), e = THe) : (t += i, e = VZ);
|
|
22357
|
-
break;
|
|
22358
|
-
case sit:
|
|
22359
|
-
I_n.has(i) ? (t = t.slice(0, -1) + i, e = aIe) : (t += i, e = VZ);
|
|
22360
|
-
break;
|
|
22361
|
-
case aIe:
|
|
22362
|
-
i === lit ? e = VZ : (t += i, e = aIe);
|
|
22363
|
-
break;
|
|
22364
|
-
case THe:
|
|
22365
|
-
i === "}" ? (d(), e = VZ) : wxt(i) ? n !== "" && (d(), e = EHe) : (u(), e = THe);
|
|
22366
|
-
break;
|
|
22367
|
-
case EHe:
|
|
22368
|
-
i == "}" ? e = VZ : wxt(i) ? e = EHe : l(ait);
|
|
22369
|
-
}
|
|
22370
|
-
return D_n.has(e) || l(L_n), c(), [o, a];
|
|
22371
|
-
}
|
|
22372
|
-
function F_n(r, e) {
|
|
22373
|
-
const [t, n] = P_n(r), i = [t[0]];
|
|
22374
|
-
for (let o = 1; o < t.length; o++) {
|
|
22375
|
-
const a = e?.[n[o - 1]];
|
|
22376
|
-
if (a === void 0)
|
|
22377
|
-
throw new Error(`Missing parameter "${n[o - 1]}" in "${r}"`);
|
|
22378
|
-
i.push(String(a)), i.push(t[o]);
|
|
22379
|
-
}
|
|
22380
|
-
return i.join("");
|
|
22381
|
-
}
|
|
22382
|
-
function B_n() {
|
|
22383
|
-
return {
|
|
22384
|
-
format: ({ translation: r, params: e }) => F_n(r, e)
|
|
22385
|
-
};
|
|
22386
|
-
}
|
|
22387
|
-
const Z$i = () => (r, e) => (e.setFinalFormatter(B_n()), r);
|
|
22388
|
-
function W_n() {
|
|
22389
|
-
var r, e;
|
|
22390
|
-
return typeof ((e = (r = globalThis.window) === null || r === void 0 ? void 0 : r.document) === null || e === void 0 ? void 0 : e.createElement) > "u";
|
|
22391
|
-
}
|
|
22392
|
-
function cit(r) {
|
|
22393
|
-
if (W_n())
|
|
22394
|
-
throw new Error(`${r}: Can't run on the server`);
|
|
22395
|
-
}
|
|
22396
|
-
const q_n = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
22397
|
-
function H_n(r) {
|
|
22398
|
-
const e = q_n.indexOf(r);
|
|
22399
|
-
if (e === -1)
|
|
22400
|
-
throw new Error("Invalid character found: " + r);
|
|
22401
|
-
return e;
|
|
22402
|
-
}
|
|
22403
|
-
function V_n(r) {
|
|
22404
|
-
const e = new Uint8Array(r), t = e.length;
|
|
22405
|
-
let n = "", i = Math.pow(2, 16) - 1;
|
|
22406
|
-
for (let o = 0; o < t; o += i)
|
|
22407
|
-
o + i > t && (i = t - o), n += String.fromCharCode.apply(
|
|
22408
|
-
null,
|
|
22409
|
-
// @ts-ignore
|
|
22410
|
-
e.subarray(o, o + i)
|
|
22411
|
-
);
|
|
22412
|
-
return n;
|
|
22413
|
-
}
|
|
22414
|
-
function U_n(r) {
|
|
22415
|
-
r = r.toUpperCase();
|
|
22416
|
-
const e = r.length;
|
|
22417
|
-
let t = 0, n = 0, i = 0;
|
|
22418
|
-
const o = new Uint8Array(e * 5 / 8 | 0);
|
|
22419
|
-
for (let a = 0; a < e; a++)
|
|
22420
|
-
n = n << 5 | H_n(r[a]), t += 5, t >= 8 && (o[i++] = n >>> t - 8 & 255, t -= 8);
|
|
22421
|
-
return V_n(o.buffer);
|
|
22422
|
-
}
|
|
22423
|
-
function $_n(r) {
|
|
22424
|
-
if (r)
|
|
22425
|
-
try {
|
|
22426
|
-
const [e, t] = r.split("_");
|
|
22427
|
-
if (e === "tgpak") {
|
|
22428
|
-
const [n] = U_n(t).split("_");
|
|
22429
|
-
return Number(n);
|
|
22430
|
-
}
|
|
22431
|
-
} catch {
|
|
22432
|
-
console.warn("Mi18n: Api key can't be parsed");
|
|
22433
|
-
}
|
|
22434
|
-
}
|
|
22435
|
-
function j_n() {
|
|
22436
|
-
return {
|
|
22437
|
-
getRecord({ apiUrl: r, apiKey: e, projectId: t, language: n, fetch: i, namespace: o }) {
|
|
22438
|
-
var a;
|
|
22439
|
-
const s = (a = $_n(e)) !== null && a !== void 0 ? a : t;
|
|
22440
|
-
let l = s !== void 0 ? `${r}/v2/projects/${s}/translations/${n}` : `${r}/v2/projects/translations/${n}`;
|
|
22441
|
-
return o && (l += `?ns=${o}`), i(l, {
|
|
22442
|
-
headers: {
|
|
22443
|
-
"X-API-Key": e || "",
|
|
22444
|
-
"Content-Type": "application/json"
|
|
22445
|
-
}
|
|
22446
|
-
}).then((c) => {
|
|
22447
|
-
if (c.ok)
|
|
22448
|
-
return c.json().then((u) => u[n]);
|
|
22449
|
-
throw new Error(c.statusText);
|
|
22450
|
-
});
|
|
22451
|
-
}
|
|
22452
|
-
};
|
|
22453
|
-
}
|
|
22454
|
-
const Q$i = () => (r, e) => (e.setDevBackend(j_n()), r);
|
|
22455
|
-
function G_n(r, e) {
|
|
22456
|
-
const t = (n) => {
|
|
22457
|
-
var i, o;
|
|
22458
|
-
r.includes((i = n.data) === null || i === void 0 ? void 0 : i.type) && e((o = n.data) === null || o === void 0 ? void 0 : o.data);
|
|
22459
|
-
};
|
|
22460
|
-
return window.addEventListener("message", t, !1), {
|
|
22461
|
-
unsubscribe() {
|
|
22462
|
-
window.removeEventListener("message", t);
|
|
22463
|
-
}
|
|
22464
|
-
};
|
|
22465
|
-
}
|
|
22466
|
-
function X_n({ message: r, recievingMessage: e, data: t, attempts: n = 1, timeout: i = 300 }) {
|
|
22467
|
-
let o = !1;
|
|
22468
|
-
const a = () => new Promise((l, c) => {
|
|
22469
|
-
const u = G_n(e, f);
|
|
22470
|
-
window.postMessage({ type: r, data: t }, window.origin);
|
|
22471
|
-
const d = setTimeout(v, i);
|
|
22472
|
-
function f(y) {
|
|
22473
|
-
clearTimeout(d), g(), l(y);
|
|
22474
|
-
}
|
|
22475
|
-
function g() {
|
|
22476
|
-
u.unsubscribe();
|
|
22477
|
-
}
|
|
22478
|
-
function v() {
|
|
22479
|
-
g(), c();
|
|
22480
|
-
}
|
|
22481
|
-
});
|
|
22482
|
-
return {
|
|
22483
|
-
cancel() {
|
|
22484
|
-
o = !0;
|
|
22485
|
-
},
|
|
22486
|
-
promise: (async () => {
|
|
22487
|
-
for (let l = 0; l < n; l++) {
|
|
22488
|
-
if (o)
|
|
22489
|
-
return new Promise(() => {
|
|
22490
|
-
});
|
|
22491
|
-
try {
|
|
22492
|
-
return await a();
|
|
22493
|
-
} catch {
|
|
22494
|
-
continue;
|
|
22495
|
-
}
|
|
22496
|
-
}
|
|
22497
|
-
if (!o)
|
|
22498
|
-
throw `Didn't recieve ${e.join(" or ")} in time.`;
|
|
22499
|
-
return new Promise(() => {
|
|
22500
|
-
});
|
|
22501
|
-
})()
|
|
22502
|
-
};
|
|
22503
|
-
}
|
|
22504
|
-
function K_n() {
|
|
22505
|
-
let r;
|
|
22506
|
-
async function e(t) {
|
|
22507
|
-
r?.();
|
|
22508
|
-
const { cancel: n, promise: i } = X_n({
|
|
22509
|
-
message: "MI18N_READY",
|
|
22510
|
-
recievingMessage: ["MI18N_PLUGIN_READY", "MI18N_PLUGIN_UPDATED"],
|
|
22511
|
-
data: t,
|
|
22512
|
-
attempts: 4
|
|
22513
|
-
});
|
|
22514
|
-
return r = n, i;
|
|
22515
|
-
}
|
|
22516
|
-
return {
|
|
22517
|
-
update: e
|
|
22518
|
-
};
|
|
22519
|
-
}
|
|
22520
|
-
const Y_n = "mi18n-in-context-tools.umd.min.js", Z_n = "@mi18n/in-context-tools", Q_n = "InContextTools", J_n = "https://cdn.jsdelivr.net/npm";
|
|
22521
|
-
function exn(r) {
|
|
22522
|
-
return new Promise((e, t) => {
|
|
22523
|
-
const n = document.createElement("script");
|
|
22524
|
-
n.src = r, n.addEventListener("load", () => e()), n.addEventListener("error", (i) => t(i.error)), document.body.appendChild(n);
|
|
22525
|
-
});
|
|
22526
|
-
}
|
|
22527
|
-
let zHe = null;
|
|
22528
|
-
function txn(r) {
|
|
22529
|
-
return zHe || (zHe = exn(
|
|
22530
|
-
`${J_n}/@mi18n/web/dist/${Y_n}`
|
|
22531
|
-
// `${CDN_URL}/@mi18n/web@${version}/dist/${IN_CONTEXT_FILE}`
|
|
22532
|
-
).then(() => window[Z_n][Q_n])), zHe;
|
|
22533
|
-
}
|
|
22534
|
-
const TXt = "__mi18n_apiKey", EXt = "__mi18n_apiUrl";
|
|
22535
|
-
function Axt() {
|
|
22536
|
-
const r = sessionStorage.getItem(TXt) || void 0, e = sessionStorage.getItem(EXt) || void 0;
|
|
22537
|
-
if (!(!r || !e))
|
|
22538
|
-
return {
|
|
22539
|
-
apiKey: r,
|
|
22540
|
-
apiUrl: e
|
|
22541
|
-
};
|
|
22542
|
-
}
|
|
22543
|
-
function nxn() {
|
|
22544
|
-
sessionStorage.removeItem(TXt), sessionStorage.removeItem(EXt);
|
|
22545
|
-
}
|
|
22546
|
-
function rxn(r) {
|
|
22547
|
-
document.readyState !== "loading" ? Promise.resolve().then(() => {
|
|
22548
|
-
r();
|
|
22549
|
-
}) : document.addEventListener && document.addEventListener("DOMContentLoaded", r);
|
|
22550
|
-
}
|
|
22551
|
-
let zXt = () => (r) => r;
|
|
22552
|
-
const ixn = () => {
|
|
22553
|
-
if (typeof window > "u")
|
|
22554
|
-
return !1;
|
|
22555
|
-
try {
|
|
22556
|
-
return typeof sessionStorage < "u" && sessionStorage;
|
|
22557
|
-
} catch (r) {
|
|
22558
|
-
return console.error("sessionStorage not available", r), !1;
|
|
22559
|
-
}
|
|
22560
|
-
};
|
|
22561
|
-
ixn() && (zXt = () => (r) => {
|
|
22562
|
-
const e = K_n(), t = () => ({
|
|
22563
|
-
// prevent extension downloading ui library
|
|
22564
|
-
uiPresent: !0,
|
|
22565
|
-
uiVersion: void 0,
|
|
22566
|
-
// mi18n mode
|
|
22567
|
-
mode: r.isDev() ? "development" : "production",
|
|
22568
|
-
// pass credentials
|
|
22569
|
-
config: {
|
|
22570
|
-
apiUrl: r.getInitialOptions().apiUrl || "",
|
|
22571
|
-
apiKey: r.getInitialOptions().apiKey || ""
|
|
22572
|
-
}
|
|
22573
|
-
}), n = async () => {
|
|
22574
|
-
const o = await txn();
|
|
22575
|
-
return (a) => {
|
|
22576
|
-
const s = Axt();
|
|
22577
|
-
return a.addPlugin(o({ credentials: s })), a;
|
|
22578
|
-
};
|
|
22579
|
-
};
|
|
22580
|
-
return r.on("running", ({ value: o }) => {
|
|
22581
|
-
o && rxn(() => {
|
|
22582
|
-
e.update(t()).catch(nxn);
|
|
22583
|
-
});
|
|
22584
|
-
}), Axt() && n().then((o) => {
|
|
22585
|
-
r.addPlugin(o);
|
|
22586
|
-
}).catch((o) => {
|
|
22587
|
-
console.error("Mi18n: Failed to load in-context tools"), console.error(o);
|
|
22588
|
-
}), r;
|
|
22589
|
-
});
|
|
22590
|
-
const uit = "__mi18n_currentLanguage";
|
|
22591
|
-
function oxn() {
|
|
22592
|
-
return {
|
|
22593
|
-
getLanguage() {
|
|
22594
|
-
return cit("LanguageStorage"), localStorage.getItem(uit) || void 0;
|
|
22595
|
-
},
|
|
22596
|
-
setLanguage(r) {
|
|
22597
|
-
cit("LanguageStorage"), localStorage.setItem(uit, r);
|
|
22598
|
-
}
|
|
22599
|
-
};
|
|
22600
|
-
}
|
|
22601
|
-
const J$i = () => localStorage.getItem(uit), eji = () => (r, e) => (e.setLanguageStorage(oxn()), r);
|
|
22602
|
-
function axn() {
|
|
22603
|
-
return {
|
|
22604
|
-
getLanguage({ availableLanguages: r }) {
|
|
22605
|
-
cit("LanguageDetector");
|
|
22606
|
-
const e = window.navigator.language, t = r.find((a) => a === e);
|
|
22607
|
-
if (t)
|
|
22608
|
-
return t;
|
|
22609
|
-
const n = (a) => a.replace(/^(.+?)(-.*)?$/, "$1"), i = n(window.navigator.language), o = r.find((a) => n(a) === i);
|
|
22610
|
-
if (o)
|
|
22611
|
-
return o;
|
|
22612
|
-
}
|
|
22613
|
-
};
|
|
22614
|
-
}
|
|
22615
|
-
const tji = () => (r, e) => (e.setLanguageDetector(axn()), r);
|
|
22616
|
-
function nji() {
|
|
22617
|
-
return k_n().use(zXt());
|
|
22618
|
-
}
|
|
22619
|
-
const sxn = {
|
|
22620
|
-
useSuspense: !0
|
|
22621
|
-
};
|
|
22622
|
-
let kHe;
|
|
22623
|
-
const kXt = () => (kHe || (kHe = mr.createContext(void 0)), kHe), rji = ({ mi18n: r, options: e, children: t, fallback: n }) => {
|
|
22624
|
-
const [i, o] = Fn.useState(!r.isLoaded());
|
|
22625
|
-
Fn.useEffect(() => {
|
|
22626
|
-
r.run().catch((l) => {
|
|
22627
|
-
console.error(l);
|
|
22628
|
-
}).finally(() => {
|
|
22629
|
-
o(!1);
|
|
22630
|
-
});
|
|
22631
|
-
}, [r]);
|
|
22632
|
-
const a = Object.assign(Object.assign({}, sxn), e), s = kXt();
|
|
22633
|
-
return a.useSuspense ? mr.createElement(s.Provider, { value: { mi18n: r, options: a } }, i ? n : mr.createElement(Fn.Suspense, { fallback: n || null }, t)) : mr.createElement(s.Provider, { value: { mi18n: r, options: a } }, i ? n : t);
|
|
22634
|
-
};
|
|
22635
|
-
let lxn;
|
|
22636
|
-
function cxn() {
|
|
22637
|
-
return lxn;
|
|
22638
|
-
}
|
|
22639
|
-
const uxn = () => {
|
|
22640
|
-
const r = kXt(), e = Fn.useContext(r) || cxn();
|
|
22641
|
-
if (!e)
|
|
22642
|
-
throw new Error("Couldn't find mi18n instance, did you forgot to use `Mi18nProvider`?");
|
|
22643
|
-
return e;
|
|
22644
|
-
}, dxn = () => {
|
|
22645
|
-
const [r, e] = Fn.useState(0), t = Fn.useCallback(() => {
|
|
22646
|
-
e((n) => n + 1);
|
|
22647
|
-
}, [e]);
|
|
22648
|
-
return { instance: r, rerender: t };
|
|
22649
|
-
}, fxn = (r, e) => {
|
|
22650
|
-
const { mi18n: t, options: n } = uxn(), i = xXt(r), o = wN(i).join(":"), a = Object.assign(Object.assign({}, n), e), { rerender: s, instance: l } = dxn(), c = Fn.useRef(), u = Fn.useRef([]);
|
|
22651
|
-
u.current = [];
|
|
22652
|
-
const d = (v) => {
|
|
22653
|
-
var y;
|
|
22654
|
-
u.current.push(v), (y = c.current) === null || y === void 0 || y.subscribeNs(v);
|
|
22655
|
-
}, f = t.isLoaded(i);
|
|
22656
|
-
Fn.useEffect(() => {
|
|
22657
|
-
const v = t.onNsUpdate(s);
|
|
22658
|
-
return c.current = v, v.subscribeNs(i), u.current.forEach((y) => {
|
|
22659
|
-
v.subscribeNs(y);
|
|
22660
|
-
}), () => {
|
|
22661
|
-
v.unsubscribe();
|
|
22662
|
-
};
|
|
22663
|
-
}, [o, t]), Fn.useEffect(() => (t.addActiveNs(i), () => t.removeActiveNs(i)), [o, t]);
|
|
22664
|
-
const g = Fn.useCallback((v) => {
|
|
22665
|
-
var y;
|
|
22666
|
-
const x = (y = v.ns) !== null && y !== void 0 ? y : i?.[0];
|
|
22667
|
-
return d(x), t.t(Object.assign(Object.assign({}, v), { ns: x }));
|
|
22668
|
-
}, [t, l]);
|
|
22669
|
-
if (a.useSuspense && !f)
|
|
22670
|
-
throw t.addActiveNs(i, !0);
|
|
22671
|
-
return { t: g, isLoading: !f };
|
|
22672
|
-
}, iji = (r, e) => {
|
|
22673
|
-
const { t, isLoading: n } = fxn(r, e);
|
|
22674
|
-
return { t: Fn.useCallback((...o) => {
|
|
22675
|
-
const a = CXt(...o);
|
|
22676
|
-
return t(a);
|
|
22677
|
-
}, [t]), isLoading: n };
|
|
22678
|
-
};
|
|
22679
|
-
var dit = function(r, e) {
|
|
22678
|
+
var A_ = fxn(), dit = function(r, e) {
|
|
22680
22679
|
return dit = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
|
|
22681
22680
|
t.__proto__ = n;
|
|
22682
22681
|
} || function(t, n) {
|
|
@@ -543349,9 +543348,9 @@ export {
|
|
|
543349
543348
|
kYi as bV,
|
|
543350
543349
|
O2n as bW,
|
|
543351
543350
|
A_ as bX,
|
|
543352
|
-
|
|
543351
|
+
rji as bY,
|
|
543353
543352
|
nji as bZ,
|
|
543354
|
-
|
|
543353
|
+
X$i as b_,
|
|
543355
543354
|
kGi as ba,
|
|
543356
543355
|
LGi as bb,
|
|
543357
543356
|
NGi as bc,
|
|
@@ -543378,12 +543377,12 @@ export {
|
|
|
543378
543377
|
m1t as bx,
|
|
543379
543378
|
HGi as by,
|
|
543380
543379
|
JIn as bz,
|
|
543381
|
-
|
|
543382
|
-
|
|
543383
|
-
|
|
543380
|
+
iji as c,
|
|
543381
|
+
Y$i as c0,
|
|
543382
|
+
eji as c1,
|
|
543384
543383
|
J$i as c2,
|
|
543385
|
-
|
|
543386
|
-
|
|
543384
|
+
Z$i as c3,
|
|
543385
|
+
Q$i as c4,
|
|
543387
543386
|
jKi as c5,
|
|
543388
543387
|
eYi as c6,
|
|
543389
543388
|
gYi as c7,
|