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