@intlify/core 12.0.0-alpha.4 → 12.0.0-alpha.5
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/core.esm-browser.js +323 -260
- package/dist/core.esm-browser.prod.js +590 -556
- package/dist/core.global.js +323 -261
- package/dist/core.global.prod.js +606 -564
- package/dist/core.js +1 -1
- package/dist/core.node.js +1 -1
- package/dist/core.runtime.esm-browser.js +296 -239
- package/dist/core.runtime.esm-browser.prod.js +451 -417
- package/dist/core.runtime.global.js +296 -240
- package/dist/core.runtime.global.prod.js +452 -416
- package/dist/core.runtime.js +1 -1
- package/dist/core.runtime.node.js +1 -1
- package/package.json +3 -3
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @intlify/core v12.0.0-alpha.
|
|
2
|
+
* @intlify/core v12.0.0-alpha.5
|
|
3
3
|
* (c) 2016-present kazuya kawaguchi and contributors
|
|
4
4
|
* @license MIT
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
const RE_ARGS = /\{([0-9a-z]+)\}/gi;
|
|
9
|
-
function format$1(e, ...n) {
|
|
10
|
-
return n.length === 1 && isObject(n[0]) && (n = n[0]), (!n || !n.hasOwnProperty) && (n = {}), e.replace(RE_ARGS, (e, t) => n.hasOwnProperty(t) ? n[t] : ``);
|
|
5
|
+
**/ const e = /\{([0-9a-z]+)\}/gi;
|
|
6
|
+
function t(t, ...n) {
|
|
7
|
+
return n.length === 1 && y(n[0]) && (n = n[0]), (!n || !n.hasOwnProperty) && (n = {}), t.replace(e, (e, t) => n.hasOwnProperty(t) ? n[t] : ``);
|
|
11
8
|
}
|
|
12
|
-
const
|
|
9
|
+
const n = (e, t, n) => r({
|
|
13
10
|
l: e,
|
|
14
11
|
k: t,
|
|
15
12
|
s: n
|
|
16
|
-
}),
|
|
17
|
-
function
|
|
13
|
+
}), r = (e) => JSON.stringify(e).replace(/\u2028/g, `\\u2028`).replace(/\u2029/g, `\\u2029`).replace(/\u0027/g, `\\u0027`), i = (e) => typeof e == `number` && isFinite(e), a = (e) => S(e) === `[object Date]`, o = (e) => S(e) === `[object RegExp]`, s = (e) => Object.keys(e).length === 0, c = Object.assign, l = Object.create, u = (e = null) => l(e), d = Object.prototype.hasOwnProperty;
|
|
14
|
+
function f(e, t) {
|
|
15
|
+
return d.call(e, t);
|
|
16
|
+
}
|
|
17
|
+
function p(e, t) {
|
|
18
|
+
let n = e[t];
|
|
19
|
+
return f(e, t) ? n : void 0;
|
|
20
|
+
}
|
|
21
|
+
function m(e) {
|
|
22
|
+
return f(Object.prototype, e);
|
|
23
|
+
}
|
|
24
|
+
const h = Array.isArray, g = (e) => typeof e == `function`, _ = (e) => typeof e == `string`, v = (e) => typeof e == `boolean`, y = (e) => typeof e == `object` && !!e, b = (e) => y(e) && g(e.then) && g(e.catch), x = Object.prototype.toString, S = (e) => x.call(e), C = (e) => S(e) === `[object Object]`, ee = (e) => e == null ? `` : h(e) || C(e) && e.toString === x ? JSON.stringify(e, null, 2) : String(e);
|
|
25
|
+
function te(e, t = ``) {
|
|
26
|
+
return e.reduce((e, n, r) => r === 0 ? e + n : e + t + n, ``);
|
|
27
|
+
}
|
|
28
|
+
function ne(e, t) {
|
|
29
|
+
typeof console < `u` && (console.warn(`[intlify] ` + e), t && console.warn(t.stack));
|
|
30
|
+
}
|
|
31
|
+
function w(e) {
|
|
18
32
|
return e.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/"/g, `"`).replace(/'/g, `'`).replace(/\//g, `/`).replace(/=/g, `=`);
|
|
19
33
|
}
|
|
20
|
-
function
|
|
34
|
+
function re(e) {
|
|
21
35
|
return e.replace(/&(?![a-z0-9#]{2,6};)/gi, `&`).replace(/"/g, `"`).replace(/'/g, `'`).replace(/</g, `<`).replace(/>/g, `>`);
|
|
22
36
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
|
|
37
|
+
const ie = /^javascript:/i, ae = /^(?:href|src|action|formaction)$/i, oe = /&#(?:x([0-9a-f]+)|(\d+));?/gi, se = /&(?:Tab|NewLine);/g, ce = /:?/gi, T = /[\u0000-\u0020\u007f-\u009f]/g, le = /(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i, ue = /(^|[\s"'<>/])on(\w+\s*=)/gi, E = /(?:^|[\s"'<>/])srcdoc\s*=/i, de = /(^|[\s"'<>/])s(rcdoc\s*=)/gi, fe = /(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;
|
|
38
|
+
function pe(e, t, n) {
|
|
39
|
+
let r = t || n;
|
|
40
|
+
if (!r) return e;
|
|
41
|
+
let i = Number.parseInt(r, t ? 16 : 10);
|
|
42
|
+
return i <= 127 ? String.fromCharCode(i) : e;
|
|
26
43
|
}
|
|
27
|
-
function
|
|
44
|
+
function D(e) {
|
|
45
|
+
let t = e.replace(oe, pe).replace(se, ``).replace(ce, `:`).replace(T, ``);
|
|
46
|
+
return ie.test(t);
|
|
47
|
+
}
|
|
48
|
+
function me(e) {
|
|
28
49
|
let t = /url\s*\(/gi, n = ``, r = 0, i;
|
|
29
50
|
for (; (i = t.exec(e)) !== null;) {
|
|
30
51
|
let a = i.index, o = t.lastIndex - 1, s = o + 1, c = 1, l = null;
|
|
@@ -40,42 +61,41 @@ function sanitizeStyleValue(e) {
|
|
|
40
61
|
}
|
|
41
62
|
if (c !== 0) break;
|
|
42
63
|
let u = e.slice(o + 1, s).trim(), d = u.startsWith(`"`) && u.endsWith(`"`) || u.startsWith(`'`) && u.endsWith(`'`) ? u.slice(1, -1).trim() : u;
|
|
43
|
-
n += e.slice(r, a), n +=
|
|
64
|
+
n += e.slice(r, a), n += D(d) ? `url(about:blank)` : e.slice(a, s + 1), r = s + 1;
|
|
44
65
|
}
|
|
45
66
|
return n + e.slice(r);
|
|
46
67
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
function sanitizeTranslatedHtml(e) {
|
|
51
|
-
return e = e.replace(/([\w:-]+)\s*=\s*"([^"]*)"/g, (e, t, n) => `${t}="${sanitizeAttributeValue(t, n)}"`), e = e.replace(/([\w:-]+)\s*=\s*'([^']*)'/g, (e, t, n) => `${t}='${sanitizeAttributeValue(t, n)}'`), /\s*on\w+\s*=\s*["']?[^"'>]+["']?/i.test(e) && (e = e.replace(/(\s+)on(\w+\s*=)/gi, `$1on$2`)), e = e.replace(/(\s+(?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi, (e, t, n) => hasJavascriptScheme(n) ? `${t}about:blank` : e), e;
|
|
68
|
+
function he(e, t) {
|
|
69
|
+
return ae.test(e) && D(t) ? `about:blank` : re(e.toLowerCase() === `style` ? me(t) : t);
|
|
52
70
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return hasOwnProperty.call(e, t);
|
|
71
|
+
function ge(e) {
|
|
72
|
+
return e = e.replace(/([\w:-]+)\s*=\s*"([^"]*)"/g, (e, t, n) => `${t}="${he(t, n)}"`), e = e.replace(/([\w:-]+)\s*=\s*'([^']*)'/g, (e, t, n) => `${t}='${he(t, n)}'`), le.test(e) && (e = e.replace(ue, `$1on$2`)), E.test(e) && (e = e.replace(de, `$1s$2`)), e = e.replace(fe, (e, t, n, r) => D(r) ? `${t}${n}about:blank` : e), e;
|
|
56
73
|
}
|
|
57
|
-
const
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const isNotObjectOrIsArray = (e) => !isObject(e) || isArray(e);
|
|
62
|
-
function deepCopy(e, t) {
|
|
63
|
-
if (isNotObjectOrIsArray(e) || isNotObjectOrIsArray(t)) throw Error(`Invalid value`);
|
|
64
|
-
let n = [{
|
|
65
|
-
src: e,
|
|
66
|
-
des: t
|
|
67
|
-
}];
|
|
74
|
+
const _e = (e) => !y(e) || h(e);
|
|
75
|
+
function ve(e, t) {
|
|
76
|
+
if (_e(e) || _e(t) || t === Object.prototype) throw Error(`Invalid value`);
|
|
77
|
+
let n = [e, t];
|
|
68
78
|
for (; n.length;) {
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
let e = n.pop(), t = n.pop(), r = Object.keys(t);
|
|
80
|
+
for (let i = 0; i < r.length; i++) {
|
|
81
|
+
let a = r[i];
|
|
82
|
+
if (a === `__proto__`) continue;
|
|
83
|
+
let o = t[a];
|
|
84
|
+
if (!y(o)) {
|
|
85
|
+
e[a] = o;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (h(o)) {
|
|
89
|
+
let t = [];
|
|
90
|
+
t.length = o.length, e[a] = t, n.push(o, t);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
let s = e[a];
|
|
94
|
+
(!y(s) || h(s)) && (s = e[a] = u()), n.push(o, s);
|
|
95
|
+
}
|
|
76
96
|
}
|
|
77
97
|
}
|
|
78
|
-
const
|
|
98
|
+
const O = {
|
|
79
99
|
EXPECTED_TOKEN: 1,
|
|
80
100
|
INVALID_TOKEN_IN_PLACEHOLDER: 2,
|
|
81
101
|
UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3,
|
|
@@ -93,240 +113,239 @@ const CompileErrorCodes = {
|
|
|
93
113
|
UNHANDLED_CODEGEN_NODE_TYPE: 15,
|
|
94
114
|
UNHANDLED_MINIFIER_NODE_TYPE: 16
|
|
95
115
|
};
|
|
96
|
-
|
|
97
|
-
function
|
|
116
|
+
O.EXPECTED_TOKEN, O.INVALID_TOKEN_IN_PLACEHOLDER, O.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, O.UNKNOWN_ESCAPE_SEQUENCE, O.INVALID_UNICODE_ESCAPE_SEQUENCE, O.UNBALANCED_CLOSING_BRACE, O.UNTERMINATED_CLOSING_BRACE, O.EMPTY_PLACEHOLDER, O.NOT_ALLOW_NEST_PLACEHOLDER, O.INVALID_LINKED_FORMAT, O.MUST_HAVE_MESSAGES_IN_PLURAL, O.UNEXPECTED_EMPTY_LINKED_MODIFIER, O.UNEXPECTED_EMPTY_LINKED_KEY, O.UNEXPECTED_LEXICAL_ANALYSIS, O.UNHANDLED_CODEGEN_NODE_TYPE, O.UNHANDLED_MINIFIER_NODE_TYPE;
|
|
117
|
+
function ye(e, t, n = {}) {
|
|
98
118
|
let { domain: r, messages: i, args: a } = n, o = SyntaxError(String(e));
|
|
99
119
|
return o.code = e, t && (o.location = t), o.domain = r, o;
|
|
100
120
|
}
|
|
101
|
-
function
|
|
102
|
-
return
|
|
121
|
+
function k(e) {
|
|
122
|
+
return y(e) && F(e) === 0 && (f(e, `b`) || f(e, `body`));
|
|
103
123
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
106
|
-
return
|
|
124
|
+
const A = [`b`, `body`];
|
|
125
|
+
function be(e) {
|
|
126
|
+
return L(e, A);
|
|
107
127
|
}
|
|
108
|
-
const
|
|
109
|
-
function
|
|
110
|
-
return
|
|
128
|
+
const j = [`c`, `cases`];
|
|
129
|
+
function xe(e) {
|
|
130
|
+
return L(e, j, []);
|
|
111
131
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
114
|
-
return
|
|
132
|
+
const M = [`s`, `static`];
|
|
133
|
+
function Se(e) {
|
|
134
|
+
return L(e, M);
|
|
115
135
|
}
|
|
116
|
-
const
|
|
117
|
-
function
|
|
118
|
-
return
|
|
136
|
+
const N = [`i`, `items`];
|
|
137
|
+
function Ce(e) {
|
|
138
|
+
return L(e, N, []);
|
|
119
139
|
}
|
|
120
|
-
const
|
|
121
|
-
function
|
|
122
|
-
return
|
|
140
|
+
const P = [`t`, `type`];
|
|
141
|
+
function F(e) {
|
|
142
|
+
return L(e, P);
|
|
123
143
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
126
|
-
let n =
|
|
144
|
+
const we = [`v`, `value`];
|
|
145
|
+
function I(e, t) {
|
|
146
|
+
let n = L(e, we);
|
|
127
147
|
if (n != null) return n;
|
|
128
|
-
throw
|
|
148
|
+
throw R(t);
|
|
129
149
|
}
|
|
130
|
-
const
|
|
131
|
-
function
|
|
132
|
-
return
|
|
150
|
+
const Te = [`m`, `modifier`];
|
|
151
|
+
function Ee(e) {
|
|
152
|
+
return L(e, Te);
|
|
133
153
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
136
|
-
let t =
|
|
154
|
+
const De = [`k`, `key`];
|
|
155
|
+
function Oe(e) {
|
|
156
|
+
let t = L(e, De);
|
|
137
157
|
if (t) return t;
|
|
138
|
-
throw
|
|
158
|
+
throw R(6);
|
|
139
159
|
}
|
|
140
|
-
function
|
|
160
|
+
function L(e, t, n) {
|
|
141
161
|
for (let n = 0; n < t.length; n++) {
|
|
142
162
|
let r = t[n];
|
|
143
|
-
if (
|
|
163
|
+
if (f(e, r) && e[r] != null) return e[r];
|
|
144
164
|
}
|
|
145
165
|
return n;
|
|
146
166
|
}
|
|
147
|
-
const
|
|
148
|
-
...
|
|
149
|
-
...
|
|
150
|
-
...
|
|
151
|
-
...
|
|
152
|
-
...
|
|
153
|
-
...
|
|
154
|
-
...
|
|
155
|
-
...
|
|
167
|
+
const ke = [
|
|
168
|
+
...A,
|
|
169
|
+
...j,
|
|
170
|
+
...M,
|
|
171
|
+
...N,
|
|
172
|
+
...De,
|
|
173
|
+
...Te,
|
|
174
|
+
...we,
|
|
175
|
+
...P
|
|
156
176
|
];
|
|
157
|
-
function
|
|
177
|
+
function R(e) {
|
|
158
178
|
return Error(`unhandled node type: ${e}`);
|
|
159
179
|
}
|
|
160
|
-
function
|
|
161
|
-
return (t) =>
|
|
180
|
+
function Ae(e) {
|
|
181
|
+
return (t) => je(t, e);
|
|
162
182
|
}
|
|
163
|
-
function
|
|
164
|
-
let n =
|
|
165
|
-
if (n == null) throw
|
|
166
|
-
if (
|
|
167
|
-
let t =
|
|
168
|
-
return e.plural(t.reduce((t, n) => [...
|
|
169
|
-
}
|
|
183
|
+
function je(e, t) {
|
|
184
|
+
let n = be(t);
|
|
185
|
+
if (n == null) throw R(0);
|
|
186
|
+
if (F(n) === 1) {
|
|
187
|
+
let t = xe(n);
|
|
188
|
+
return e.plural(t.reduce((t, n) => [...h(t) ? t : [t], Me(e, n)], []));
|
|
189
|
+
}
|
|
190
|
+
return Me(e, n);
|
|
170
191
|
}
|
|
171
|
-
function
|
|
172
|
-
let n =
|
|
192
|
+
function Me(e, t) {
|
|
193
|
+
let n = Se(t);
|
|
173
194
|
if (n != null) return e.type === `text` ? n : e.normalize([n]);
|
|
174
195
|
{
|
|
175
|
-
let n =
|
|
196
|
+
let n = Ce(t).reduce((t, n) => [...t, z(e, n)], []);
|
|
176
197
|
return e.normalize(n);
|
|
177
198
|
}
|
|
178
199
|
}
|
|
179
|
-
function
|
|
180
|
-
let n =
|
|
200
|
+
function z(e, t) {
|
|
201
|
+
let n = F(t);
|
|
181
202
|
switch (n) {
|
|
182
|
-
case 3: return
|
|
183
|
-
case 9: return
|
|
203
|
+
case 3: return I(t, n);
|
|
204
|
+
case 9: return I(t, n);
|
|
184
205
|
case 4: {
|
|
185
206
|
let r = t;
|
|
186
|
-
if (
|
|
187
|
-
if (
|
|
188
|
-
throw
|
|
207
|
+
if (f(r, `k`) && r.k) return e.interpolate(e.named(r.k));
|
|
208
|
+
if (f(r, `key`) && r.key) return e.interpolate(e.named(r.key));
|
|
209
|
+
throw R(n);
|
|
189
210
|
}
|
|
190
211
|
case 5: {
|
|
191
212
|
let r = t;
|
|
192
|
-
if (
|
|
193
|
-
if (
|
|
194
|
-
throw
|
|
213
|
+
if (f(r, `i`) && i(r.i)) return e.interpolate(e.list(r.i));
|
|
214
|
+
if (f(r, `index`) && i(r.index)) return e.interpolate(e.list(r.index));
|
|
215
|
+
throw R(n);
|
|
195
216
|
}
|
|
196
217
|
case 6: {
|
|
197
|
-
let n = t, r =
|
|
198
|
-
return e.linked(
|
|
218
|
+
let n = t, r = Ee(n), i = Oe(n);
|
|
219
|
+
return e.linked(z(e, i), r ? z(e, r) : void 0, e.type);
|
|
199
220
|
}
|
|
200
|
-
case 7: return
|
|
201
|
-
case 8: return
|
|
221
|
+
case 7: return I(t, n);
|
|
222
|
+
case 8: return I(t, n);
|
|
202
223
|
default: throw Error(`unhandled node on format message part: ${n}`);
|
|
203
224
|
}
|
|
204
225
|
}
|
|
205
|
-
let
|
|
206
|
-
function
|
|
207
|
-
|
|
226
|
+
let B = u();
|
|
227
|
+
function Ne() {
|
|
228
|
+
B = u();
|
|
208
229
|
}
|
|
209
|
-
function
|
|
230
|
+
function Pe(e, t) {
|
|
210
231
|
{
|
|
211
232
|
let t = e.cacheKey;
|
|
212
|
-
return t ?
|
|
233
|
+
return t ? B[t] || (B[t] = Ae(e)) : Ae(e);
|
|
213
234
|
}
|
|
214
235
|
}
|
|
215
|
-
const
|
|
236
|
+
const V = {
|
|
216
237
|
INVALID_ARGUMENT: 17,
|
|
217
238
|
INVALID_DATE_ARGUMENT: 18,
|
|
218
239
|
INVALID_ISO_DATE_ARGUMENT: 19,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
-
if (e.resolvedOnce && _resolveLocale != null) return _resolveLocale;
|
|
240
|
+
NOT_SUPPORT_LOCALE_PROMISE_VALUE: 20,
|
|
241
|
+
NOT_SUPPORT_LOCALE_ASYNC_FUNCTION: 21,
|
|
242
|
+
NOT_SUPPORT_LOCALE_TYPE: 22
|
|
243
|
+
}, Fe = 23;
|
|
244
|
+
function Ie(e) {
|
|
245
|
+
return ye(e, null, void 0);
|
|
246
|
+
}
|
|
247
|
+
V.INVALID_ARGUMENT, V.INVALID_DATE_ARGUMENT, V.INVALID_ISO_DATE_ARGUMENT, V.NOT_SUPPORT_LOCALE_PROMISE_VALUE, V.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION, V.NOT_SUPPORT_LOCALE_TYPE;
|
|
248
|
+
function H(e, t) {
|
|
249
|
+
return t.locale == null ? W(e.locale) : W(t.locale);
|
|
250
|
+
}
|
|
251
|
+
let U;
|
|
252
|
+
function W(e) {
|
|
253
|
+
if (_(e)) return e;
|
|
254
|
+
if (g(e)) {
|
|
255
|
+
if (e.resolvedOnce && U != null) return U;
|
|
236
256
|
if (e.constructor.name === `Function`) {
|
|
237
257
|
let t = e();
|
|
238
|
-
if (
|
|
239
|
-
return
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
function fallbackWithSimple(e, t, n) {
|
|
244
|
-
return [...new Set([n, ...isArray(t) ? t : isObject(t) ? Object.keys(t) : isString(t) ? [t] : [n]])];
|
|
245
|
-
}
|
|
246
|
-
function fallbackWithLocaleChain(e, t, n) {
|
|
247
|
-
let r = isString(n) ? n : DEFAULT_LOCALE, i = e;
|
|
248
|
-
i.__localeChainCache || (i.__localeChainCache = /* @__PURE__ */ new Map());
|
|
249
|
-
let a = i.__localeChainCache.get(r);
|
|
250
|
-
if (!a) {
|
|
251
|
-
a = [];
|
|
252
|
-
let e = [n];
|
|
253
|
-
for (; isArray(e);) e = appendBlockToChain(a, e, t);
|
|
254
|
-
let o = isArray(t) || !isPlainObject(t) ? t : t.default ? t.default : null;
|
|
255
|
-
e = isString(o) ? [o] : o, isArray(e) && appendBlockToChain(a, e, !1), i.__localeChainCache.set(r, a);
|
|
258
|
+
if (b(t)) throw Error(V.NOT_SUPPORT_LOCALE_PROMISE_VALUE);
|
|
259
|
+
return U = t;
|
|
260
|
+
}
|
|
261
|
+
throw Error(V.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION);
|
|
256
262
|
}
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
function
|
|
263
|
+
throw Error(V.NOT_SUPPORT_LOCALE_TYPE);
|
|
264
|
+
}
|
|
265
|
+
function Le(e, t, n) {
|
|
266
|
+
return [.../* @__PURE__ */ new Set([n, ...h(t) ? t : y(t) ? Object.keys(t).filter((e) => e !== "default") : _(t) ? [t] : [n]])];
|
|
267
|
+
}
|
|
268
|
+
function Re(e, t, n) {
|
|
269
|
+
let r = _(n) ? n : J, i = e, a;
|
|
270
|
+
y(t) ? (i.__localeChainObjectCache || (i.__localeChainObjectCache = /* @__PURE__ */ new WeakMap()), a = i.__localeChainObjectCache.get(t), a || (a = /* @__PURE__ */ new Map(), i.__localeChainObjectCache.set(t, a))) : (i.__localeChainCache || (i.__localeChainCache = /* @__PURE__ */ new Map()), a = i.__localeChainCache.get(t), a || (a = /* @__PURE__ */ new Map(), i.__localeChainCache.set(t, a)));
|
|
271
|
+
let o = a.get(r);
|
|
272
|
+
if (o) return o;
|
|
273
|
+
let s = [], c = [n];
|
|
274
|
+
for (; h(c);) c = G(s, c, t);
|
|
275
|
+
let l = h(t) || !C(t) ? t : t.default ? t.default : null;
|
|
276
|
+
return c = _(l) ? [l] : l, h(c) && G(s, c, !1), a.set(r, s), s;
|
|
277
|
+
}
|
|
278
|
+
function G(e, t, n) {
|
|
260
279
|
let r = !0;
|
|
261
|
-
for (let i = 0; i < t.length &&
|
|
280
|
+
for (let i = 0; i < t.length && v(r); i++) {
|
|
262
281
|
let a = t[i];
|
|
263
|
-
|
|
282
|
+
_(a) && (r = ze(e, t[i], n));
|
|
264
283
|
}
|
|
265
284
|
return r;
|
|
266
285
|
}
|
|
267
|
-
function
|
|
286
|
+
function ze(e, t, n) {
|
|
268
287
|
let r, i = t.split(`-`);
|
|
269
288
|
do
|
|
270
|
-
r =
|
|
289
|
+
r = Be(e, i.join(`-`), n), i.splice(-1, 1);
|
|
271
290
|
while (i.length && r === !0);
|
|
272
291
|
return r;
|
|
273
292
|
}
|
|
274
|
-
function
|
|
293
|
+
function Be(e, t, n) {
|
|
275
294
|
let r = !1;
|
|
276
295
|
if (!e.includes(t) && (r = !0, t)) {
|
|
277
296
|
r = t[t.length - 1] !== `!`;
|
|
278
297
|
let i = t.replace(/!/g, ``);
|
|
279
|
-
e.push(i), (
|
|
298
|
+
e.push(i), (h(n) || C(n)) && n[i] && (r = n[i]);
|
|
280
299
|
}
|
|
281
300
|
return r;
|
|
282
301
|
}
|
|
283
|
-
const
|
|
284
|
-
|
|
302
|
+
const K = [];
|
|
303
|
+
K[0] = {
|
|
285
304
|
w: [0],
|
|
286
305
|
i: [3, 0],
|
|
287
306
|
"[": [4],
|
|
288
307
|
o: [7]
|
|
289
|
-
},
|
|
308
|
+
}, K[1] = {
|
|
290
309
|
w: [1],
|
|
291
310
|
".": [2],
|
|
292
311
|
"[": [4],
|
|
293
312
|
o: [7]
|
|
294
|
-
},
|
|
313
|
+
}, K[2] = {
|
|
295
314
|
w: [2],
|
|
296
315
|
i: [3, 0],
|
|
297
316
|
0: [3, 0]
|
|
298
|
-
},
|
|
317
|
+
}, K[3] = {
|
|
299
318
|
i: [3, 0],
|
|
300
319
|
0: [3, 0],
|
|
301
320
|
w: [1, 1],
|
|
302
321
|
".": [2, 1],
|
|
303
322
|
"[": [4, 1],
|
|
304
323
|
o: [7, 1]
|
|
305
|
-
},
|
|
324
|
+
}, K[4] = {
|
|
306
325
|
"'": [5, 0],
|
|
307
326
|
"\"": [6, 0],
|
|
308
327
|
"[": [4, 2],
|
|
309
328
|
"]": [1, 3],
|
|
310
329
|
o: 8,
|
|
311
330
|
l: [4, 0]
|
|
312
|
-
},
|
|
331
|
+
}, K[5] = {
|
|
313
332
|
"'": [4, 0],
|
|
314
333
|
o: 8,
|
|
315
334
|
l: [5, 0]
|
|
316
|
-
},
|
|
335
|
+
}, K[6] = {
|
|
317
336
|
"\"": [4, 0],
|
|
318
337
|
o: 8,
|
|
319
338
|
l: [6, 0]
|
|
320
339
|
};
|
|
321
|
-
const
|
|
322
|
-
function
|
|
323
|
-
return
|
|
340
|
+
const Ve = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
|
|
341
|
+
function He(e) {
|
|
342
|
+
return Ve.test(e);
|
|
324
343
|
}
|
|
325
|
-
function
|
|
344
|
+
function Ue(e) {
|
|
326
345
|
let t = e.charCodeAt(0);
|
|
327
346
|
return t === e.charCodeAt(e.length - 1) && (t === 34 || t === 39) ? e.slice(1, -1) : e;
|
|
328
347
|
}
|
|
329
|
-
function
|
|
348
|
+
function We(e) {
|
|
330
349
|
if (e == null) return `o`;
|
|
331
350
|
switch (e.charCodeAt(0)) {
|
|
332
351
|
case 91:
|
|
@@ -347,11 +366,11 @@ function getPathCharType(e) {
|
|
|
347
366
|
}
|
|
348
367
|
return `i`;
|
|
349
368
|
}
|
|
350
|
-
function
|
|
369
|
+
function Ge(e) {
|
|
351
370
|
let t = e.trim();
|
|
352
|
-
return e.charAt(0) === `0` && isNaN(parseInt(e)) ? !1 :
|
|
371
|
+
return e.charAt(0) === `0` && isNaN(parseInt(e)) ? !1 : He(t) ? Ue(t) : `*` + t;
|
|
353
372
|
}
|
|
354
|
-
function
|
|
373
|
+
function Ke(e) {
|
|
355
374
|
let t = [], n = -1, r = 0, i = 0, a, o, s, c, l, u, d, f = [];
|
|
356
375
|
f[0] = () => {
|
|
357
376
|
o === void 0 ? o = s : o += s;
|
|
@@ -362,7 +381,7 @@ function parse(e) {
|
|
|
362
381
|
}, f[3] = () => {
|
|
363
382
|
if (i > 0) i--, r = 4, f[0]();
|
|
364
383
|
else {
|
|
365
|
-
if (i = 0, o === void 0 || (o =
|
|
384
|
+
if (i = 0, o === void 0 || (o = Ge(o), o === !1)) return !1;
|
|
366
385
|
f[1]();
|
|
367
386
|
}
|
|
368
387
|
};
|
|
@@ -371,29 +390,29 @@ function parse(e) {
|
|
|
371
390
|
if (r === 5 && t === `'` || r === 6 && t === `"`) return n++, s = `\\` + t, f[0](), !0;
|
|
372
391
|
}
|
|
373
392
|
for (; r !== null;) if (n++, a = e[n], !(a === `\\` && p())) {
|
|
374
|
-
if (c =
|
|
393
|
+
if (c = We(a), d = K[r], l = d[c] || d.l || 8, l === 8 || (r = l[0], l[1] !== void 0 && (u = f[l[1]], u && (s = a, u() === !1)))) return;
|
|
375
394
|
if (r === 7) return t;
|
|
376
395
|
}
|
|
377
396
|
}
|
|
378
|
-
const
|
|
379
|
-
function
|
|
380
|
-
return
|
|
397
|
+
const qe = /* @__PURE__ */ new Map();
|
|
398
|
+
function Je(e, t) {
|
|
399
|
+
return y(e) ? e[t] : null;
|
|
381
400
|
}
|
|
382
|
-
function
|
|
383
|
-
if (!
|
|
384
|
-
let n =
|
|
385
|
-
if (n || (n =
|
|
401
|
+
function Ye(e, t) {
|
|
402
|
+
if (!y(e)) return null;
|
|
403
|
+
let n = qe.get(t);
|
|
404
|
+
if (n || (n = Ke(t), n && qe.set(t, n)), !n) return null;
|
|
386
405
|
let r = n.length, i = e, a = 0;
|
|
387
406
|
for (; a < r;) {
|
|
388
407
|
let e = n[a];
|
|
389
|
-
if (
|
|
408
|
+
if (ke.includes(e) && k(i) || !y(i) || !f(i, e)) return null;
|
|
390
409
|
let t = i[e];
|
|
391
|
-
if (t === void 0 ||
|
|
410
|
+
if (t === void 0 || g(i)) return null;
|
|
392
411
|
i = t, a++;
|
|
393
412
|
}
|
|
394
413
|
return i;
|
|
395
414
|
}
|
|
396
|
-
const
|
|
415
|
+
const q = {
|
|
397
416
|
NOT_FOUND_KEY: 1,
|
|
398
417
|
FALLBACK_TO_TRANSLATE: 2,
|
|
399
418
|
CANNOT_FORMAT_NUMBER: 3,
|
|
@@ -403,125 +422,148 @@ const CoreWarnCodes = {
|
|
|
403
422
|
EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7,
|
|
404
423
|
INVALID_NUMBER_ARGUMENT: 8,
|
|
405
424
|
INVALID_DATE_ARGUMENT: 9
|
|
406
|
-
},
|
|
407
|
-
[
|
|
408
|
-
[
|
|
409
|
-
[
|
|
410
|
-
[
|
|
411
|
-
[
|
|
412
|
-
[
|
|
413
|
-
[
|
|
414
|
-
[
|
|
415
|
-
[
|
|
425
|
+
}, Xe = 10, Ze = {
|
|
426
|
+
[q.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale messages.`,
|
|
427
|
+
[q.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,
|
|
428
|
+
[q.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
|
|
429
|
+
[q.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,
|
|
430
|
+
[q.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
|
|
431
|
+
[q.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,
|
|
432
|
+
[q.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`,
|
|
433
|
+
[q.INVALID_NUMBER_ARGUMENT]: `Invalid argument for number formatting: expected a number but received '{value}'.`,
|
|
434
|
+
[q.INVALID_DATE_ARGUMENT]: `Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'.`
|
|
416
435
|
};
|
|
417
|
-
function
|
|
418
|
-
return
|
|
436
|
+
function Qe(e, ...n) {
|
|
437
|
+
return t(Ze[e], ...n);
|
|
419
438
|
}
|
|
420
|
-
const
|
|
421
|
-
function
|
|
439
|
+
const $e = `12.0.0-alpha.5`, et = -1, J = `en-US`, tt = ``, nt = (e) => `${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;
|
|
440
|
+
function rt() {
|
|
422
441
|
return {
|
|
423
|
-
upper: (e, t) => t === `text` &&
|
|
424
|
-
lower: (e, t) => t === `text` &&
|
|
425
|
-
capitalize: (e, t) => t === `text` &&
|
|
442
|
+
upper: (e, t) => t === `text` && _(e) ? e.toUpperCase() : t === `vnode` && y(e) && `__v_isVNode` in e ? e.children.toUpperCase() : e,
|
|
443
|
+
lower: (e, t) => t === `text` && _(e) ? e.toLowerCase() : t === `vnode` && y(e) && `__v_isVNode` in e ? e.children.toLowerCase() : e,
|
|
444
|
+
capitalize: (e, t) => t === `text` && _(e) ? nt(e) : t === `vnode` && y(e) && `__v_isVNode` in e ? nt(e.children) : e
|
|
426
445
|
};
|
|
427
446
|
}
|
|
428
|
-
let
|
|
429
|
-
function
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
let
|
|
433
|
-
function
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
let
|
|
437
|
-
function
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
let
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
let
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
messageResolver: O,
|
|
467
|
-
localeFallbacker: k,
|
|
468
|
-
fallbackContext: A,
|
|
469
|
-
onWarn: n
|
|
447
|
+
let it;
|
|
448
|
+
function at(e) {
|
|
449
|
+
it = e;
|
|
450
|
+
}
|
|
451
|
+
let ot;
|
|
452
|
+
function st(e) {
|
|
453
|
+
ot = e;
|
|
454
|
+
}
|
|
455
|
+
let ct;
|
|
456
|
+
function lt(e) {
|
|
457
|
+
ct = e;
|
|
458
|
+
}
|
|
459
|
+
let ut = 0;
|
|
460
|
+
function dt(e = {}) {
|
|
461
|
+
let t = g(e.onWarn) ? e.onWarn : ne, n = _(e.version) ? e.version : $e, r = _(e.locale) || g(e.locale) ? e.locale : J, i = g(r) ? J : r, a = h(e.fallbackLocale) || C(e.fallbackLocale) || _(e.fallbackLocale) || e.fallbackLocale === !1 ? e.fallbackLocale : i, s = C(e.messages) ? e.messages : Y(i), l = C(e.datetimeFormats) ? e.datetimeFormats : Y(i), d = C(e.numberFormats) ? e.numberFormats : Y(i), f = c(u(), e.modifiers, rt()), p = e.pluralRules || u(), m = g(e.missing) ? e.missing : null, b = v(e.missingWarn) || o(e.missingWarn) ? e.missingWarn : !0, x = v(e.fallbackWarn) || o(e.fallbackWarn) ? e.fallbackWarn : !0, S = !!e.fallbackFormat, ee = !!e.unresolving, te = g(e.postTranslation) ? e.postTranslation : null, w = C(e.processor) ? e.processor : null, re = !v(e.warnHtmlMessage) || e.warnHtmlMessage, ie = !!e.escapeParameter, ae = g(e.messageCompiler) ? e.messageCompiler : it || null, oe = g(e.messageResolver) ? e.messageResolver : ot || Je, se = g(e.localeFallbacker) ? e.localeFallbacker : ct || Le, ce = y(e.fallbackContext) ? e.fallbackContext : void 0, T = e, le = y(T.__datetimeFormatters) ? T.__datetimeFormatters : /* @__PURE__ */ new Map(), ue = y(T.__numberFormatters) ? T.__numberFormatters : /* @__PURE__ */ new Map();
|
|
462
|
+
ut++;
|
|
463
|
+
let E = {
|
|
464
|
+
version: n,
|
|
465
|
+
cid: ut,
|
|
466
|
+
locale: r,
|
|
467
|
+
fallbackLocale: a,
|
|
468
|
+
messages: s,
|
|
469
|
+
modifiers: f,
|
|
470
|
+
pluralRules: p,
|
|
471
|
+
missing: m,
|
|
472
|
+
missingWarn: b,
|
|
473
|
+
fallbackWarn: x,
|
|
474
|
+
fallbackFormat: S,
|
|
475
|
+
unresolving: ee,
|
|
476
|
+
postTranslation: te,
|
|
477
|
+
processor: w,
|
|
478
|
+
warnHtmlMessage: re,
|
|
479
|
+
escapeParameter: ie,
|
|
480
|
+
messageCompiler: ae,
|
|
481
|
+
messageResolver: oe,
|
|
482
|
+
localeFallbacker: se,
|
|
483
|
+
fallbackContext: ce,
|
|
484
|
+
onWarn: t
|
|
470
485
|
};
|
|
471
|
-
return
|
|
486
|
+
return E.datetimeFormats = l, E.numberFormats = d, E.__datetimeFormatters = le, E.__numberFormatters = ue, E;
|
|
472
487
|
}
|
|
473
|
-
const
|
|
474
|
-
function
|
|
475
|
-
let n = e.messages
|
|
488
|
+
const Y = (e) => ({ [e]: u() });
|
|
489
|
+
function ft(e, t) {
|
|
490
|
+
let n = p(e.messages, t);
|
|
476
491
|
if (n == null) return;
|
|
477
|
-
let r =
|
|
478
|
-
return
|
|
492
|
+
let r = u();
|
|
493
|
+
return ve(n, r), r;
|
|
479
494
|
}
|
|
480
|
-
function
|
|
481
|
-
e.messages[t] = n;
|
|
495
|
+
function pt(e, t, n) {
|
|
496
|
+
m(t) || (e.messages[t] = n);
|
|
482
497
|
}
|
|
483
|
-
function
|
|
484
|
-
return
|
|
498
|
+
function mt(e, t) {
|
|
499
|
+
return o(e) ? e.test(t) : e;
|
|
485
500
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
501
|
+
function ht(e, t) {
|
|
502
|
+
return o(e) ? e.test(t) : e;
|
|
488
503
|
}
|
|
489
|
-
function
|
|
504
|
+
function X(e, t, n, r, i) {
|
|
490
505
|
let { missing: a, onWarn: o } = e;
|
|
491
506
|
if (a !== null) {
|
|
492
507
|
let r = a(e, n, t, i);
|
|
493
|
-
return
|
|
494
|
-
}
|
|
508
|
+
return _(r) ? r : t;
|
|
509
|
+
}
|
|
510
|
+
return t;
|
|
495
511
|
}
|
|
496
|
-
function
|
|
497
|
-
let
|
|
498
|
-
|
|
512
|
+
function gt(e, t) {
|
|
513
|
+
let n = e;
|
|
514
|
+
y(t) ? n.__localeChainObjectCache?.delete(t) : n.__localeChainCache?.delete(t);
|
|
499
515
|
}
|
|
500
|
-
function
|
|
501
|
-
|
|
516
|
+
function _t(e, t, n) {
|
|
517
|
+
gt(e, n), e.fallbackContext && gt(e.fallbackContext, n), e.localeFallbacker(e, n, t);
|
|
502
518
|
}
|
|
503
|
-
function
|
|
519
|
+
function vt(e, t) {
|
|
520
|
+
return e !== t && e.split(`-`)[0] === t.split(`-`)[0];
|
|
521
|
+
}
|
|
522
|
+
function yt(e, t) {
|
|
504
523
|
let n = t.indexOf(e);
|
|
505
524
|
if (n === -1) return !1;
|
|
506
|
-
for (let r = n + 1; r < t.length; r++) if (
|
|
525
|
+
for (let r = n + 1; r < t.length; r++) if (vt(e, t[r])) return !0;
|
|
507
526
|
return !1;
|
|
508
527
|
}
|
|
509
|
-
function
|
|
510
|
-
let {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
let
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
528
|
+
function bt(e, t, n, r, i, a, o) {
|
|
529
|
+
let { fallbackLocale: s, localeFallbacker: c, onWarn: l } = e, u = c(e, s, n);
|
|
530
|
+
for (let n = 0; n < u.length; n++) {
|
|
531
|
+
let a = u[n], s = (r[a] || {})[t];
|
|
532
|
+
if (C(s) && _(a)) return a;
|
|
533
|
+
X(e, t, a, i, o);
|
|
534
|
+
}
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
function xt(e, t, n) {
|
|
538
|
+
let r = `${e}__${t}`;
|
|
539
|
+
return C(n) && !s(n) && (r = `${r}__${JSON.stringify(n)}`), r;
|
|
540
|
+
}
|
|
541
|
+
function St(e, t, n) {
|
|
542
|
+
for (let r in n) {
|
|
543
|
+
let n = `${t}__${r}`;
|
|
544
|
+
for (let t of e.keys()) (t === n || t.startsWith(`${n}__`)) && e.delete(t);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function Ct(e, t, n, r) {
|
|
548
|
+
let [, i, a, o] = e, s = n;
|
|
549
|
+
return _(i) ? t.key = i : C(i) && Object.keys(i).forEach((e) => {
|
|
550
|
+
r.includes(e) ? s[e] = i[e] : t[e] = i[e];
|
|
551
|
+
}), _(a) ? t.locale = a : C(a) && (s = a), C(o) && (s = o), s;
|
|
552
|
+
}
|
|
553
|
+
function wt(e, ...t) {
|
|
554
|
+
let { datetimeFormats: n, unresolving: r, onWarn: o } = e, { __datetimeFormatters: s } = e;
|
|
555
|
+
if (!_(t[0]) && !a(t[0]) && !i(t[0])) return ``;
|
|
556
|
+
let [l, u, d, f] = Et(...t), p = v(d.missingWarn) ? d.missingWarn : e.missingWarn, m = v(d.fallbackWarn) ? d.fallbackWarn : e.fallbackWarn, h = !!d.part, g = H(e, d);
|
|
557
|
+
if (!_(l) || l === ``) {
|
|
558
|
+
let e = new Intl.DateTimeFormat(g.replace(/!/g, ``), f);
|
|
559
|
+
return h ? e.formatToParts(u) : e.format(u);
|
|
560
|
+
}
|
|
561
|
+
let y = bt(e, l, g, n, p, m, `datetime format`);
|
|
562
|
+
if (!_(y)) return r ? -1 : l;
|
|
563
|
+
let b = n[y][l], x = xt(y, l, f), S = s.get(x);
|
|
564
|
+
return S || (S = new Intl.DateTimeFormat(y, c({}, b, f)), s.set(x, S)), h ? S.formatToParts(u) : S.format(u);
|
|
565
|
+
}
|
|
566
|
+
const Tt = [
|
|
525
567
|
`localeMatcher`,
|
|
526
568
|
`weekday`,
|
|
527
569
|
`era`,
|
|
@@ -543,55 +585,48 @@ const DATETIME_FORMAT_OPTIONS_KEYS = [
|
|
|
543
585
|
`hourCycle`,
|
|
544
586
|
`fractionalSecondDigits`
|
|
545
587
|
];
|
|
546
|
-
function
|
|
547
|
-
let [t
|
|
548
|
-
if (
|
|
549
|
-
let e = t.match(
|
|
550
|
-
if (!e) throw Error(
|
|
588
|
+
function Et(...e) {
|
|
589
|
+
let [t] = e, n = u(), r = u(), o;
|
|
590
|
+
if (_(t)) {
|
|
591
|
+
let e = t.match(/^(\d{4}-\d{2}-\d{2})(?:(T|\s)(.+))?$/);
|
|
592
|
+
if (!e) throw Error(V.INVALID_ISO_DATE_ARGUMENT);
|
|
551
593
|
let n = e[3] ? e[3].trim().startsWith(`T`) ? `${e[1].trim()}${e[3].trim()}` : `${e[1].trim()}T${e[3].trim()}` : e[1].trim();
|
|
552
|
-
|
|
594
|
+
o = new Date(n);
|
|
553
595
|
try {
|
|
554
|
-
|
|
596
|
+
o.toISOString();
|
|
555
597
|
} catch {
|
|
556
|
-
throw Error(
|
|
598
|
+
throw Error(V.INVALID_ISO_DATE_ARGUMENT);
|
|
557
599
|
}
|
|
558
|
-
} else if (
|
|
559
|
-
if (isNaN(t.getTime())) throw Error(
|
|
560
|
-
|
|
561
|
-
} else if (
|
|
562
|
-
else throw Error(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
s
|
|
569
|
-
c
|
|
600
|
+
} else if (a(t)) {
|
|
601
|
+
if (isNaN(t.getTime())) throw Error(V.INVALID_DATE_ARGUMENT);
|
|
602
|
+
o = t;
|
|
603
|
+
} else if (i(t)) o = t;
|
|
604
|
+
else throw Error(V.INVALID_ARGUMENT);
|
|
605
|
+
let s = Ct(e, n, r, Tt);
|
|
606
|
+
return [
|
|
607
|
+
n.key || ``,
|
|
608
|
+
o,
|
|
609
|
+
n,
|
|
610
|
+
s
|
|
570
611
|
];
|
|
571
612
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
613
|
+
function Dt(e, t, n) {
|
|
614
|
+
St(e.__datetimeFormatters, t, n);
|
|
615
|
+
}
|
|
616
|
+
function Ot(e, ...t) {
|
|
617
|
+
let { numberFormats: n, unresolving: r, onWarn: a } = e, { __numberFormatters: o } = e;
|
|
618
|
+
if (!i(t[0])) return ``;
|
|
619
|
+
let [s, l, u, d] = At(...t), f = v(u.missingWarn) ? u.missingWarn : e.missingWarn, p = v(u.fallbackWarn) ? u.fallbackWarn : e.fallbackWarn, m = !!u.part, h = H(e, u);
|
|
620
|
+
if (!_(s) || s === ``) {
|
|
621
|
+
let e = new Intl.NumberFormat(h.replace(/!/g, ``), d);
|
|
622
|
+
return m ? e.formatToParts(l) : e.format(l);
|
|
577
623
|
}
|
|
624
|
+
let g = bt(e, s, h, n, f, p, `number format`);
|
|
625
|
+
if (!_(g)) return r ? -1 : s;
|
|
626
|
+
let y = n[g][s], b = xt(g, s, d), x = o.get(b);
|
|
627
|
+
return x || (x = new Intl.NumberFormat(g, c({}, y, d)), o.set(b, x)), m ? x.formatToParts(l) : x.format(l);
|
|
578
628
|
}
|
|
579
|
-
|
|
580
|
-
let { numberFormats: n, unresolving: r, fallbackLocale: i, onWarn: o, localeFallbacker: s } = e, { __numberFormatters: u } = e;
|
|
581
|
-
if (!isNumber(t[0])) return ``;
|
|
582
|
-
let [d, f, p, m] = parseNumberArgs(...t), h = isBoolean(p.missingWarn) ? p.missingWarn : e.missingWarn;
|
|
583
|
-
isBoolean(p.fallbackWarn) ? p.fallbackWarn : e.fallbackWarn;
|
|
584
|
-
let g = !!p.part, _ = getLocale(e, p), v = s(e, i, _);
|
|
585
|
-
if (!isString(d) || d === ``) return new Intl.NumberFormat(_.replace(/!/g, ``), m).format(f);
|
|
586
|
-
let y = {}, b, x = null;
|
|
587
|
-
for (let t = 0; t < v.length && (b = v[t], y = n[b] || {}, x = y[d], !isPlainObject(x)); t++) handleMissing(e, d, b, h, `number format`);
|
|
588
|
-
if (!isPlainObject(x) || !isString(b)) return r ? -1 : d;
|
|
589
|
-
let S = `${b}__${d}`;
|
|
590
|
-
isPlainObject(m) && !isKeylessObject(m) && (S = `${S}__${JSON.stringify(m)}`);
|
|
591
|
-
let C = u.get(S);
|
|
592
|
-
return C || (C = new Intl.NumberFormat(b, assign({}, x, m)), u.set(S, C)), g ? C.formatToParts(f) : C.format(f);
|
|
593
|
-
}
|
|
594
|
-
const NUMBER_FORMAT_OPTIONS_KEYS = [
|
|
629
|
+
const kt = [
|
|
595
630
|
`localeMatcher`,
|
|
596
631
|
`style`,
|
|
597
632
|
`currency`,
|
|
@@ -613,114 +648,113 @@ const NUMBER_FORMAT_OPTIONS_KEYS = [
|
|
|
613
648
|
`roundingIncrement`,
|
|
614
649
|
`trailingZeroDisplay`
|
|
615
650
|
];
|
|
616
|
-
function
|
|
617
|
-
let [t
|
|
618
|
-
if (!
|
|
619
|
-
let
|
|
620
|
-
return
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
o,
|
|
626
|
-
s
|
|
651
|
+
function At(...e) {
|
|
652
|
+
let [t] = e, n = u(), r = u();
|
|
653
|
+
if (!i(t)) throw Error(V.INVALID_ARGUMENT);
|
|
654
|
+
let a = t, o = Ct(e, n, r, kt);
|
|
655
|
+
return [
|
|
656
|
+
n.key || ``,
|
|
657
|
+
a,
|
|
658
|
+
n,
|
|
659
|
+
o
|
|
627
660
|
];
|
|
628
661
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
631
|
-
for (let e in n) {
|
|
632
|
-
let n = `${t}__${e}`;
|
|
633
|
-
r.__numberFormatters.has(n) && r.__numberFormatters.delete(n);
|
|
634
|
-
}
|
|
662
|
+
function jt(e, t, n) {
|
|
663
|
+
St(e.__numberFormatters, t, n);
|
|
635
664
|
}
|
|
636
|
-
const
|
|
637
|
-
function
|
|
665
|
+
const Mt = (e) => e, Nt = (e) => ``, Pt = `text`, Ft = (e) => e.length === 0 ? `` : te(e), It = ee;
|
|
666
|
+
function Z(e, t) {
|
|
638
667
|
return e = Math.abs(e), t === 2 ? e === 1 ? 0 : 1 : Math.min(e, 2);
|
|
639
668
|
}
|
|
640
|
-
const
|
|
669
|
+
const Lt = [
|
|
641
670
|
`zero`,
|
|
642
671
|
`one`,
|
|
643
672
|
`two`,
|
|
644
673
|
`few`,
|
|
645
674
|
`many`,
|
|
646
675
|
`other`
|
|
647
|
-
],
|
|
648
|
-
function
|
|
649
|
-
let t =
|
|
676
|
+
], Rt = /* @__PURE__ */ new Map();
|
|
677
|
+
function zt(e) {
|
|
678
|
+
let t = Rt.get(e);
|
|
650
679
|
if (!t) {
|
|
651
680
|
let n = new Intl.PluralRules(e);
|
|
652
681
|
t = {
|
|
653
682
|
rules: n,
|
|
654
|
-
categories: n.resolvedOptions().pluralCategories.slice().sort((e, t) =>
|
|
655
|
-
},
|
|
683
|
+
categories: n.resolvedOptions().pluralCategories.slice().sort((e, t) => Lt.indexOf(e) - Lt.indexOf(t))
|
|
684
|
+
}, Rt.set(e, t);
|
|
656
685
|
}
|
|
657
686
|
return t;
|
|
658
687
|
}
|
|
659
|
-
function
|
|
660
|
-
return
|
|
688
|
+
function Bt(e) {
|
|
689
|
+
return i(e.pluralIndex) ? e.pluralIndex : i(e.named?.count) ? e.named.count : i(e.named?.n) ? e.named.n : -1;
|
|
661
690
|
}
|
|
662
|
-
function
|
|
663
|
-
let t = e.locale, n =
|
|
664
|
-
r =
|
|
665
|
-
let { rules: r, categories: i } =
|
|
666
|
-
if (n > i.length) return
|
|
691
|
+
function Vt(e = {}) {
|
|
692
|
+
let t = e.locale, n = Bt(e), r;
|
|
693
|
+
r = _(t) && g(e.pluralRules?.[t]) ? e.pluralRules[t] : _(t) && typeof Intl < `u` && Intl.PluralRules !== void 0 ? (e, n) => {
|
|
694
|
+
let { rules: r, categories: i } = zt(t);
|
|
695
|
+
if (n > i.length) return Z(e, n);
|
|
667
696
|
let a = r.select(Math.abs(e)), o = i.indexOf(a);
|
|
668
697
|
return Math.min(o === -1 ? n - 1 : o, n - 1);
|
|
669
|
-
} :
|
|
670
|
-
let
|
|
671
|
-
|
|
672
|
-
let f = (e) =>
|
|
698
|
+
} : Z;
|
|
699
|
+
let a = r === Z ? void 0 : Z, o = (e) => e[r(n, e.length, a)], s = e.list || [], l = (e) => s[e], d = e.named || u();
|
|
700
|
+
i(e.pluralIndex) && (d.count ??= e.pluralIndex, d.n ??= e.pluralIndex);
|
|
701
|
+
let f = (e) => d[e];
|
|
673
702
|
function p(t, n) {
|
|
674
|
-
return (
|
|
703
|
+
return (g(e.messages) ? e.messages(t, !!n) : y(e.messages) ? e.messages[t] : !1) || (e.parent ? e.parent.message(t) : Nt);
|
|
675
704
|
}
|
|
676
|
-
let m = (t) => e.modifiers ? e.modifiers[t] :
|
|
677
|
-
list:
|
|
705
|
+
let m = (t) => e.modifiers ? e.modifiers[t] : Mt, v = g(e.processor?.normalize) ? e.processor.normalize : Ft, b = g(e.processor?.interpolate) ? e.processor.interpolate : It, x = {
|
|
706
|
+
list: l,
|
|
678
707
|
named: f,
|
|
679
708
|
plural: o,
|
|
680
709
|
linked: (e, ...t) => {
|
|
681
710
|
let [n, r] = t, i = `text`, a = ``;
|
|
682
|
-
t.length === 1 ?
|
|
683
|
-
let o = p(e, !0)(
|
|
711
|
+
t.length === 1 ? y(n) ? (a = n.modifier || a, i = n.type || i) : _(n) && (a = n || a) : t.length === 2 && (_(n) && (a = n || a), _(r) && (i = r || i));
|
|
712
|
+
let o = p(e, !0)(x), s = o === `` || o === void 0 ? e : o, c = i === `vnode` && h(s) && a ? s[0] : s;
|
|
684
713
|
return a ? m(a)(c, i) : c;
|
|
685
714
|
},
|
|
686
715
|
message: p,
|
|
687
|
-
type:
|
|
688
|
-
interpolate:
|
|
689
|
-
normalize:
|
|
690
|
-
values:
|
|
716
|
+
type: _(e.processor?.type) ? e.processor.type : Pt,
|
|
717
|
+
interpolate: b,
|
|
718
|
+
normalize: v,
|
|
719
|
+
values: c(u(), s, d)
|
|
691
720
|
};
|
|
692
|
-
return
|
|
721
|
+
return x;
|
|
693
722
|
}
|
|
694
|
-
const
|
|
695
|
-
function
|
|
696
|
-
let [n, r] =
|
|
697
|
-
a &&
|
|
723
|
+
const Ht = () => ``, Q = (e) => g(e), $ = (e) => _(e) || k(e) || Q(e);
|
|
724
|
+
function Ut(e, ...t) {
|
|
725
|
+
let [n, r] = qt(...t), i = H(e, r), a = v(r.escapeParameter) ? r.escapeParameter : e.escapeParameter;
|
|
726
|
+
a && Wt(r);
|
|
698
727
|
let o = !!r.resolvedMessage, [s, c, l] = o ? [
|
|
699
728
|
n,
|
|
700
729
|
i,
|
|
701
|
-
e.messages[i] ||
|
|
702
|
-
] :
|
|
703
|
-
if (!o &&
|
|
704
|
-
let t =
|
|
705
|
-
(e.fallbackFormat || t != null && (
|
|
730
|
+
e.messages[i] || u()
|
|
731
|
+
] : Gt(e, n, i, e.fallbackLocale, v(r.fallbackWarn) ? r.fallbackWarn : e.fallbackWarn, v(r.missingWarn) ? r.missingWarn : e.missingWarn), d = n;
|
|
732
|
+
if (!o && !$(s)) {
|
|
733
|
+
let t = _(r.default) ? r.default : v(r.default) || e.fallbackFormat ? e.messageCompiler ? n : () => n : null;
|
|
734
|
+
(e.fallbackFormat || t != null && (_(t) || g(t))) && (s = t, d = s);
|
|
706
735
|
}
|
|
707
|
-
if (!o && (
|
|
708
|
-
let f = !1, p =
|
|
736
|
+
if (!o && (!$(s) || !_(c))) return e.unresolving ? -1 : n;
|
|
737
|
+
let f = !1, p = Q(s) ? s : Kt(e, n, c, s, d, () => {
|
|
709
738
|
f = !0;
|
|
710
739
|
});
|
|
711
740
|
if (f) return s;
|
|
712
|
-
let m = p(
|
|
713
|
-
return a &&
|
|
714
|
-
}
|
|
715
|
-
function
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
741
|
+
let m = p(Vt(Yt(e, c, l, r))), h = e.postTranslation ? e.postTranslation(m, n) : m;
|
|
742
|
+
return a && _(h) && (h = ge(h)), h;
|
|
743
|
+
}
|
|
744
|
+
function Wt(e) {
|
|
745
|
+
if (h(e.list) && (e.list = e.list.map((e) => _(e) ? w(e) : e)), y(e.named)) {
|
|
746
|
+
let t = e.named, n = u();
|
|
747
|
+
for (let e of Object.keys(t)) {
|
|
748
|
+
let r = t[e];
|
|
749
|
+
n[e] = _(r) ? w(r) : r;
|
|
750
|
+
}
|
|
751
|
+
e.named = n;
|
|
752
|
+
}
|
|
719
753
|
}
|
|
720
|
-
function
|
|
721
|
-
let { messages: o, onWarn: s, messageResolver: c, localeFallbacker: l } = e,
|
|
722
|
-
for (let n = 0; n <
|
|
723
|
-
let n =
|
|
754
|
+
function Gt(e, t, n, r, i, a) {
|
|
755
|
+
let { messages: o, onWarn: s, messageResolver: c, localeFallbacker: l } = e, d = l(e, r, n), f = u(), p, m = null;
|
|
756
|
+
for (let n = 0; n < d.length && (p = d[n], f = o[p] || u(), (m = c(f, t)) === null && (m = f[t]), !$(m)); n++) if (!yt(p, d)) {
|
|
757
|
+
let n = X(e, t, p, a, `translate`);
|
|
724
758
|
n !== t && (m = n);
|
|
725
759
|
}
|
|
726
760
|
return [
|
|
@@ -729,8 +763,8 @@ function resolveMessageFormat(e, t, n, r, i, a) {
|
|
|
729
763
|
f
|
|
730
764
|
];
|
|
731
765
|
}
|
|
732
|
-
function
|
|
733
|
-
if (
|
|
766
|
+
function Kt(e, t, n, r, i, a) {
|
|
767
|
+
if (Q(r)) {
|
|
734
768
|
let e = r;
|
|
735
769
|
return e.locale = e.locale || n, e.key = e.key || t, e;
|
|
736
770
|
}
|
|
@@ -738,51 +772,51 @@ function compileMessageFormat(e, t, n, r, i, a) {
|
|
|
738
772
|
let e = (() => r);
|
|
739
773
|
return e.locale = n, e.key = t, e;
|
|
740
774
|
}
|
|
741
|
-
let o = e.messageCompiler(r,
|
|
775
|
+
let o = e.messageCompiler(r, Jt(e, n, i, r, e.warnHtmlMessage, a));
|
|
742
776
|
return o.locale = n, o.key = t, o.source = r, o;
|
|
743
777
|
}
|
|
744
|
-
function
|
|
778
|
+
function qt(...e) {
|
|
745
779
|
let [t, n, r] = e;
|
|
746
|
-
if (!
|
|
747
|
-
let
|
|
748
|
-
return
|
|
780
|
+
if (!_(t) && !i(t) && !Q(t) && !k(t)) throw Error(V.INVALID_ARGUMENT);
|
|
781
|
+
let a = i(t) ? String(t) : (Q(t), t), o = u();
|
|
782
|
+
return i(n) ? o.plural = n : _(n) ? o.default = n : C(n) && !s(n) ? o.named = n : h(n) && (o.list = n), i(r) ? o.plural = r : _(r) ? o.default = r : C(r) && c(o, r), [a, o];
|
|
749
783
|
}
|
|
750
|
-
function
|
|
784
|
+
function Jt(e, t, r, i, a, o) {
|
|
751
785
|
return {
|
|
752
786
|
locale: t,
|
|
753
|
-
key:
|
|
787
|
+
key: r,
|
|
754
788
|
warnHtmlMessage: a,
|
|
755
789
|
onError: (e) => {
|
|
756
790
|
throw o?.(e), e;
|
|
757
791
|
},
|
|
758
|
-
onCacheKey: (e) =>
|
|
792
|
+
onCacheKey: (e) => n(t, r, e)
|
|
759
793
|
};
|
|
760
794
|
}
|
|
761
|
-
function
|
|
762
|
-
let { modifiers:
|
|
795
|
+
function Yt(e, t, n, r) {
|
|
796
|
+
let { modifiers: a, pluralRules: o, messageResolver: s, fallbackLocale: c, fallbackWarn: l, missingWarn: u, fallbackContext: d } = e;
|
|
763
797
|
return {
|
|
764
798
|
locale: t,
|
|
765
|
-
modifiers:
|
|
799
|
+
modifiers: a,
|
|
766
800
|
pluralRules: o,
|
|
767
801
|
messages: (r, i) => {
|
|
768
802
|
let a = s(n, r);
|
|
769
803
|
if (a == null && (d || i)) {
|
|
770
|
-
let [n, , i] =
|
|
804
|
+
let [n, , i] = Gt(d || e, r, t, c, l, u);
|
|
771
805
|
a = n ?? s(i, r);
|
|
772
806
|
}
|
|
773
|
-
if (
|
|
774
|
-
let n = !1, i =
|
|
807
|
+
if (_(a) || k(a)) {
|
|
808
|
+
let n = !1, i = Kt(e, r, t, a, r, () => {
|
|
775
809
|
n = !0;
|
|
776
810
|
});
|
|
777
|
-
return n ?
|
|
778
|
-
}
|
|
779
|
-
|
|
811
|
+
return n ? Ht : i;
|
|
812
|
+
}
|
|
813
|
+
return Q(a) ? a : Ht;
|
|
780
814
|
},
|
|
781
815
|
processor: e.processor ?? void 0,
|
|
782
816
|
list: r.list ?? void 0,
|
|
783
817
|
named: r.named ?? void 0,
|
|
784
|
-
pluralIndex:
|
|
818
|
+
pluralIndex: i(r.plural) ? r.plural : void 0
|
|
785
819
|
};
|
|
786
820
|
}
|
|
787
|
-
|
|
788
|
-
export { AST_NODE_PROPS_KEYS, CORE_ERROR_CODES_EXTEND_POINT, CORE_WARN_CODES_EXTEND_POINT, CoreWarnCodes, DATETIME_FORMAT_OPTIONS_KEYS, DEFAULT_LOCALE, DEFAULT_MESSAGE_DATA_TYPE, MISSING_RESOLVE_VALUE, NOT_RESOLVED, NUMBER_FORMAT_OPTIONS_KEYS, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compile, createCompileError, createCoreContext, createCoreError, createMessageContext, datetime, fallbackWithLocaleChain, fallbackWithSimple,
|
|
821
|
+
at(Pe), st(Ye), lt(Re);
|
|
822
|
+
export { ke as AST_NODE_PROPS_KEYS, Fe as CORE_ERROR_CODES_EXTEND_POINT, Xe as CORE_WARN_CODES_EXTEND_POINT, q as CoreWarnCodes, Tt as DATETIME_FORMAT_OPTIONS_KEYS, J as DEFAULT_LOCALE, Pt as DEFAULT_MESSAGE_DATA_TYPE, tt as MISSING_RESOLVE_VALUE, et as NOT_RESOLVED, kt as NUMBER_FORMAT_OPTIONS_KEYS, $e as VERSION, Ne as clearCompileCache, Dt as clearDateTimeFormat, jt as clearNumberFormat, Pe as compile, ye as createCompileError, dt as createCoreContext, Ie as createCoreError, Vt as createMessageContext, wt as datetime, Re as fallbackWithLocaleChain, Le as fallbackWithSimple, H as getLocale, ft as getLocaleMessage, Qe as getWarnMessage, X as handleMissing, vt as isAlmostSameLocale, yt as isImplicitFallback, k as isMessageAST, $ as isMessageFormat, Q as isMessageFunction, mt as isTranslateFallbackWarn, ht as isTranslateMissingWarn, Ot as number, Ke as parse, Et as parseDateTimeArgs, At as parseNumberArgs, qt as parseTranslateArgs, lt as registerLocaleFallbacker, at as registerMessageCompiler, st as registerMessageResolver, W as resolveLocale, Ye as resolveValue, Je as resolveWithKeyValue, pt as setLocaleMessage, Ut as translate, _t as updateFallbackLocale };
|