@intlify/core 9.2.0-beta.34 → 9.2.0-beta.37
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.cjs.js +1 -1
- package/dist/core.cjs.prod.js +1 -1
- package/dist/core.esm-browser.js +158 -25
- package/dist/core.esm-browser.prod.js +2 -2
- package/dist/core.esm-bundler.js +1 -1
- package/dist/core.global.js +159 -24
- package/dist/core.global.prod.js +2 -2
- package/dist/core.runtime.esm-browser.js +128 -21
- package/dist/core.runtime.esm-browser.prod.js +2 -2
- package/dist/core.runtime.esm-bundler.js +1 -1
- package/dist/core.runtime.global.js +129 -20
- package/dist/core.runtime.global.prod.js +2 -2
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v9.2.0-beta.
|
|
2
|
+
* core v9.2.0-beta.37
|
|
3
3
|
* (c) 2022 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -494,7 +494,9 @@ function createMessageContext(options = {}) {
|
|
|
494
494
|
isFunction(options.pluralRules[locale])
|
|
495
495
|
? pluralDefault
|
|
496
496
|
: undefined;
|
|
497
|
-
const plural = (messages) =>
|
|
497
|
+
const plural = (messages) => {
|
|
498
|
+
return messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
|
|
499
|
+
};
|
|
498
500
|
const _list = options.list || [];
|
|
499
501
|
const list = (index) => _list[index];
|
|
500
502
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -524,13 +526,37 @@ function createMessageContext(options = {}) {
|
|
|
524
526
|
isFunction(options.processor.interpolate)
|
|
525
527
|
? options.processor.interpolate
|
|
526
528
|
: DEFAULT_INTERPOLATE;
|
|
527
|
-
const linked = (key, modifier) => {
|
|
528
|
-
const msg = message(key)(ctx);
|
|
529
|
-
return isString(modifier) ? _modifier(modifier)(msg) : msg;
|
|
530
|
-
};
|
|
531
529
|
const type = isPlainObject(options.processor) && isString(options.processor.type)
|
|
532
530
|
? options.processor.type
|
|
533
531
|
: DEFAULT_MESSAGE_DATA_TYPE;
|
|
532
|
+
const linked = (key, ...args) => {
|
|
533
|
+
const [arg1, arg2] = args;
|
|
534
|
+
let type = 'text';
|
|
535
|
+
let modifier = '';
|
|
536
|
+
if (args.length === 1) {
|
|
537
|
+
if (isObject(arg1)) {
|
|
538
|
+
modifier = arg1.modifier || modifier;
|
|
539
|
+
type = arg1.type || type;
|
|
540
|
+
}
|
|
541
|
+
else if (isString(arg1)) {
|
|
542
|
+
modifier = arg1 || modifier;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
else if (args.length === 2) {
|
|
546
|
+
if (isString(arg1)) {
|
|
547
|
+
modifier = arg1 || modifier;
|
|
548
|
+
}
|
|
549
|
+
if (isString(arg2)) {
|
|
550
|
+
type = arg2 || type;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
let msg = message(key)(ctx);
|
|
554
|
+
// The message in vnode resolved with linked are returned as an array by processor.nomalize
|
|
555
|
+
if (type === 'vnode' && isArray(msg) && modifier) {
|
|
556
|
+
msg = msg[0];
|
|
557
|
+
}
|
|
558
|
+
return modifier ? _modifier(modifier)(msg, type) : msg;
|
|
559
|
+
};
|
|
534
560
|
const ctx = {
|
|
535
561
|
["list" /* LIST */]: list,
|
|
536
562
|
["named" /* NAMED */]: named,
|
|
@@ -714,18 +740,37 @@ function appendItemToChain(chain, target, blocks) {
|
|
|
714
740
|
* Intlify core-base version
|
|
715
741
|
* @internal
|
|
716
742
|
*/
|
|
717
|
-
const VERSION = '9.2.0-beta.
|
|
743
|
+
const VERSION = '9.2.0-beta.37';
|
|
718
744
|
const NOT_REOSLVED = -1;
|
|
719
745
|
const DEFAULT_LOCALE = 'en-US';
|
|
720
746
|
const MISSING_RESOLVE_VALUE = '';
|
|
747
|
+
const capitalize = (str) => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}`;
|
|
721
748
|
function getDefaultLinkedModifiers() {
|
|
722
749
|
return {
|
|
723
|
-
upper: (val) =>
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
750
|
+
upper: (val, type) => {
|
|
751
|
+
// prettier-ignore
|
|
752
|
+
return type === 'text' && isString(val)
|
|
753
|
+
? val.toUpperCase()
|
|
754
|
+
: type === 'vnode' && isObject(val) && '__v_isVNode' in val
|
|
755
|
+
? val.children.toUpperCase()
|
|
756
|
+
: val;
|
|
757
|
+
},
|
|
758
|
+
lower: (val, type) => {
|
|
759
|
+
// prettier-ignore
|
|
760
|
+
return type === 'text' && isString(val)
|
|
761
|
+
? val.toLowerCase()
|
|
762
|
+
: type === 'vnode' && isObject(val) && '__v_isVNode' in val
|
|
763
|
+
? val.children.toLowerCase()
|
|
764
|
+
: val;
|
|
765
|
+
},
|
|
766
|
+
capitalize: (val, type) => {
|
|
767
|
+
// prettier-ignore
|
|
768
|
+
return (type === 'text' && isString(val)
|
|
769
|
+
? capitalize(val)
|
|
770
|
+
: type === 'vnode' && isObject(val) && '__v_isVNode' in val
|
|
771
|
+
? capitalize(val.children)
|
|
772
|
+
: val);
|
|
773
|
+
}
|
|
729
774
|
};
|
|
730
775
|
}
|
|
731
776
|
let _compiler;
|
|
@@ -1028,7 +1073,9 @@ function translate(context, ...args) {
|
|
|
1028
1073
|
const msgContext = createMessageContext(ctxOptions);
|
|
1029
1074
|
const messaged = evaluateMessage(context, msg, msgContext);
|
|
1030
1075
|
// if use post translation option, proceed it with handler
|
|
1031
|
-
const ret = postTranslation
|
|
1076
|
+
const ret = postTranslation
|
|
1077
|
+
? postTranslation(messaged, key)
|
|
1078
|
+
: messaged;
|
|
1032
1079
|
// NOTE: experimental !!
|
|
1033
1080
|
{
|
|
1034
1081
|
// prettier-ignore
|
|
@@ -1355,7 +1402,7 @@ function datetime(context, ...args) {
|
|
|
1355
1402
|
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1356
1403
|
fallbackLocale, locale);
|
|
1357
1404
|
if (!isString(key) || key === '') {
|
|
1358
|
-
return new Intl.DateTimeFormat(locale).format(value);
|
|
1405
|
+
return new Intl.DateTimeFormat(locale, overrides).format(value);
|
|
1359
1406
|
}
|
|
1360
1407
|
// resolve format
|
|
1361
1408
|
let datetimeFormat = {};
|
|
@@ -1410,9 +1457,32 @@ function datetime(context, ...args) {
|
|
|
1410
1457
|
return !part ? formatter.format(value) : formatter.formatToParts(value);
|
|
1411
1458
|
}
|
|
1412
1459
|
/** @internal */
|
|
1460
|
+
const DATETIME_FORMAT_OPTIONS_KEYS = [
|
|
1461
|
+
'localeMatcher',
|
|
1462
|
+
'weekday',
|
|
1463
|
+
'era',
|
|
1464
|
+
'year',
|
|
1465
|
+
'month',
|
|
1466
|
+
'day',
|
|
1467
|
+
'hour',
|
|
1468
|
+
'minute',
|
|
1469
|
+
'second',
|
|
1470
|
+
'timeZoneName',
|
|
1471
|
+
'formatMatcher',
|
|
1472
|
+
'hour12',
|
|
1473
|
+
'timeZone',
|
|
1474
|
+
'dateStyle',
|
|
1475
|
+
'timeStyle',
|
|
1476
|
+
'calendar',
|
|
1477
|
+
'dayPeriod',
|
|
1478
|
+
'numberingSystem',
|
|
1479
|
+
'hourCycle',
|
|
1480
|
+
'fractionalSecondDigits'
|
|
1481
|
+
];
|
|
1482
|
+
/** @internal */
|
|
1413
1483
|
function parseDateTimeArgs(...args) {
|
|
1414
1484
|
const [arg1, arg2, arg3, arg4] = args;
|
|
1415
|
-
|
|
1485
|
+
const options = {};
|
|
1416
1486
|
let overrides = {};
|
|
1417
1487
|
let value;
|
|
1418
1488
|
if (isString(arg1)) {
|
|
@@ -1454,7 +1524,14 @@ function parseDateTimeArgs(...args) {
|
|
|
1454
1524
|
options.key = arg2;
|
|
1455
1525
|
}
|
|
1456
1526
|
else if (isPlainObject(arg2)) {
|
|
1457
|
-
|
|
1527
|
+
Object.keys(arg2).forEach(key => {
|
|
1528
|
+
if (DATETIME_FORMAT_OPTIONS_KEYS.includes(key)) {
|
|
1529
|
+
overrides[key] = arg2[key];
|
|
1530
|
+
}
|
|
1531
|
+
else {
|
|
1532
|
+
options[key] = arg2[key];
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1458
1535
|
}
|
|
1459
1536
|
if (isString(arg3)) {
|
|
1460
1537
|
options.locale = arg3;
|
|
@@ -1499,7 +1576,7 @@ function number(context, ...args) {
|
|
|
1499
1576
|
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1500
1577
|
fallbackLocale, locale);
|
|
1501
1578
|
if (!isString(key) || key === '') {
|
|
1502
|
-
return new Intl.NumberFormat(locale).format(value);
|
|
1579
|
+
return new Intl.NumberFormat(locale, overrides).format(value);
|
|
1503
1580
|
}
|
|
1504
1581
|
// resolve format
|
|
1505
1582
|
let numberFormat = {};
|
|
@@ -1554,9 +1631,32 @@ function number(context, ...args) {
|
|
|
1554
1631
|
return !part ? formatter.format(value) : formatter.formatToParts(value);
|
|
1555
1632
|
}
|
|
1556
1633
|
/** @internal */
|
|
1634
|
+
const NUMBER_FORMAT_OPTIONS_KEYS = [
|
|
1635
|
+
'localeMatcher',
|
|
1636
|
+
'style',
|
|
1637
|
+
'currency',
|
|
1638
|
+
'currencyDisplay',
|
|
1639
|
+
'currencySign',
|
|
1640
|
+
'useGrouping',
|
|
1641
|
+
'minimumIntegerDigits',
|
|
1642
|
+
'minimumFractionDigits',
|
|
1643
|
+
'maximumFractionDigits',
|
|
1644
|
+
'minimumSignificantDigits',
|
|
1645
|
+
'maximumSignificantDigits',
|
|
1646
|
+
'compactDisplay',
|
|
1647
|
+
'notation',
|
|
1648
|
+
'signDisplay',
|
|
1649
|
+
'unit',
|
|
1650
|
+
'unitDisplay',
|
|
1651
|
+
'roundingMode',
|
|
1652
|
+
'roundingPriority',
|
|
1653
|
+
'roundingIncrement',
|
|
1654
|
+
'trailingZeroDisplay'
|
|
1655
|
+
];
|
|
1656
|
+
/** @internal */
|
|
1557
1657
|
function parseNumberArgs(...args) {
|
|
1558
1658
|
const [arg1, arg2, arg3, arg4] = args;
|
|
1559
|
-
|
|
1659
|
+
const options = {};
|
|
1560
1660
|
let overrides = {};
|
|
1561
1661
|
if (!isNumber(arg1)) {
|
|
1562
1662
|
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
|
|
@@ -1566,7 +1666,14 @@ function parseNumberArgs(...args) {
|
|
|
1566
1666
|
options.key = arg2;
|
|
1567
1667
|
}
|
|
1568
1668
|
else if (isPlainObject(arg2)) {
|
|
1569
|
-
|
|
1669
|
+
Object.keys(arg2).forEach(key => {
|
|
1670
|
+
if (NUMBER_FORMAT_OPTIONS_KEYS.includes(key)) {
|
|
1671
|
+
overrides[key] = arg2[key];
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
options[key] = arg2[key];
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1570
1677
|
}
|
|
1571
1678
|
if (isString(arg3)) {
|
|
1572
1679
|
options.locale = arg3;
|
|
@@ -1596,4 +1703,4 @@ registerMessageResolver(resolveValue);
|
|
|
1596
1703
|
// register fallback locale at @intlify/core
|
|
1597
1704
|
registerLocaleFallbacker(fallbackWithLocaleChain);
|
|
1598
1705
|
|
|
1599
|
-
export { CompileErrorCodes, CoreErrorCodes, CoreWarnCodes, DEFAULT_LOCALE, DEFAULT_MESSAGE_DATA_TYPE, MISSING_RESOLVE_VALUE, NOT_REOSLVED, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCompileError, createCoreContext, createCoreError, createMessageContext, datetime, fallbackWithLocaleChain, fallbackWithSimple, getAdditionalMeta, getDevToolsHook, getFallbackContext, getWarnMessage, handleMissing, initI18nDevTools, isMessageFunction, isTranslateFallbackWarn, isTranslateMissingWarn, number, parse, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerLocaleFallbacker, registerMessageCompiler, registerMessageResolver, resolveValue, resolveWithKeyValue, setAdditionalMeta, setDevToolsHook, setFallbackContext, translate, translateDevTools, updateFallbackLocale };
|
|
1706
|
+
export { CompileErrorCodes, CoreErrorCodes, CoreWarnCodes, DATETIME_FORMAT_OPTIONS_KEYS, DEFAULT_LOCALE, DEFAULT_MESSAGE_DATA_TYPE, MISSING_RESOLVE_VALUE, NOT_REOSLVED, NUMBER_FORMAT_OPTIONS_KEYS, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCompileError, createCoreContext, createCoreError, createMessageContext, datetime, fallbackWithLocaleChain, fallbackWithSimple, getAdditionalMeta, getDevToolsHook, getFallbackContext, getWarnMessage, handleMissing, initI18nDevTools, isMessageFunction, isTranslateFallbackWarn, isTranslateMissingWarn, number, parse, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerLocaleFallbacker, registerMessageCompiler, registerMessageResolver, resolveValue, resolveWithKeyValue, setAdditionalMeta, setDevToolsHook, setFallbackContext, translate, translateDevTools, updateFallbackLocale };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v9.2.0-beta.
|
|
2
|
+
* core v9.2.0-beta.37
|
|
3
3
|
* (c) 2022 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===p(e),a=e=>E(e)&&0===Object.keys(e).length;function o(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const l=Object.assign;function s(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const c=Array.isArray,i=e=>"function"==typeof e,u=e=>"string"==typeof e,m=e=>"boolean"==typeof e,f=e=>null!==e&&"object"==typeof e,_=Object.prototype.toString,p=e=>_.call(e),E=e=>"[object Object]"===p(e),g={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function N(e,t,n={}){const{domain:r,messages:a,args:o}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=r,l}const A=[];A[0]={w:[0],i:[3,0],"[":[4],o:[7]},A[1]={w:[1],".":[2],"[":[4],o:[7]},A[2]={w:[2],i:[3,0],0:[3,0]},A[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},A[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},A[5]={"'":[4,0],o:8,l:[5,0]},A[6]={'"':[4,0],o:8,l:[6,0]};const d=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function T(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function b(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,d.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function k(e){const t=[];let n,r,a,o,l,s,c,i=-1,u=0,m=0;const f=[];function _(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,a="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=a:r+=a},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=b(r),!1===r)return!1;f[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!_()){if(o=T(n),c=A[u],l=c[o]||c.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const L=new Map;function I(e,t){return f(e)?e[t]:null}function F(e,t){if(!f(e))return null;let n=L.get(t);if(n||(n=k(t),n&&L.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=a[n[o]];if(void 0===e)return null;a=e,o++}return a}const C=e=>e,O=e=>"",h="text",R=e=>0===e.length?"":e.join(""),D=e=>null==e?"":c(e)||E(e)&&e.toString===_?JSON.stringify(e,null,2):String(e);function M(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function w(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),a=f(e.pluralRules)&&u(t)&&i(e.pluralRules[t])?e.pluralRules[t]:M,o=f(e.pluralRules)&&u(t)&&i(e.pluralRules[t])?M:void 0,l=e.list||[],s=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,s);function c(t){const n=i(e.messages)?e.messages(t):!!f(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):O)}const m=E(e.processor)&&i(e.processor.normalize)?e.processor.normalize:R,_=E(e.processor)&&i(e.processor.interpolate)?e.processor.interpolate:D,p={list:e=>l[e],named:e=>s[e],plural:e=>e[a(r,e.length,o)],linked:(t,n)=>{const r=c(t)(p);return u(n)?(a=n,e.modifiers?e.modifiers[a]:C)(r):r;var a},message:c,type:E(e.processor)&&u(e.processor.type)?e.processor.type:"text",interpolate:_,normalize:m};return p}const y="i18n:init";let W=null;function S(e){W=e}function U(){return W}function v(e,t,n){W&&W.emit(y,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const P=$("function:translate");function $(e){return t=>W&&W.emit(e,t)}const K={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},x={[K.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[K.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[K.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[K.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[K.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[K.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function B(t,...n){return function(t,...n){return 1===n.length&&f(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(x[t],...n)}function G(e,t,n){return[...new Set([n,...c(t)?t:f(t)?Object.keys(t):u(t)?[t]:[n]])]}function V(e,t,n){const r=u(n)?n:J,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;c(e);)e=j(o,e,t);const l=c(t)||!E(t)?t:t.default?t.default:null;e=u(l)?[l]:l,c(e)&&j(o,e,!1),a.__localeChainCache.set(r,o)}return o}function j(e,t,n){let r=!0;for(let a=0;a<t.length&&m(r);a++){const o=t[a];u(o)&&(r=H(e,t[a],n))}return r}function H(e,t,n){let r;const a=t.split("-");do{r=X(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function X(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const a=t.replace(/!/g,"");e.push(a),(c(n)||E(n))&&n[a]&&(r=n[a])}return r}const Y="9.2.0-beta.34",z=-1,J="en-US",Q="";let q,Z,ee;function te(e){q=e}function ne(e){Z=e}function re(e){ee=e}let ae=null;const oe=e=>{ae=e},le=()=>ae;let se=null;const ce=e=>{se=e},ie=()=>se;let ue=0;function me(e={}){const t=u(e.version)?e.version:"9.2.0-beta.34",n=u(e.locale)?e.locale:J,a=c(e.fallbackLocale)||E(e.fallbackLocale)||u(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=E(e.messages)?e.messages:{[n]:{}},_=E(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},p=E(e.numberFormats)?e.numberFormats:{[n]:{}},g=l({},e.modifiers||{},{upper:e=>u(e)?e.toUpperCase():e,lower:e=>u(e)?e.toLowerCase():e,capitalize:e=>u(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),N=e.pluralRules||{},A=i(e.missing)?e.missing:null,d=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,T=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,k=!!e.unresolving,L=i(e.postTranslation)?e.postTranslation:null,F=E(e.processor)?e.processor:null,C=!m(e.warnHtmlMessage)||e.warnHtmlMessage,O=!!e.escapeParameter,h=i(e.messageCompiler)?e.messageCompiler:q,R=i(e.messageResolver)?e.messageResolver:Z||I,D=i(e.localeFallbacker)?e.localeFallbacker:ee||G,M=f(e.fallbackContext)?e.fallbackContext:void 0,w=i(e.onWarn)?e.onWarn:o,y=e,W=f(y.__datetimeFormatters)?y.__datetimeFormatters:new Map,S=f(y.__numberFormatters)?y.__numberFormatters:new Map,U=f(y.__meta)?y.__meta:{};ue++;const v={version:t,cid:ue,locale:n,fallbackLocale:a,messages:s,modifiers:g,pluralRules:N,missing:A,missingWarn:d,fallbackWarn:T,fallbackFormat:b,unresolving:k,postTranslation:L,processor:F,warnHtmlMessage:C,escapeParameter:O,messageCompiler:h,messageResolver:R,localeFallbacker:D,fallbackContext:M,onWarn:w,__meta:U};return v.datetimeFormats=_,v.numberFormats=p,v.__datetimeFormatters=W,v.__numberFormatters=S,v}function fe(e,t){return e instanceof RegExp?e.test(t):e}function _e(e,t){return e instanceof RegExp?e.test(t):e}function pe(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return u(r)?r:t}return t}function Ee(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)}function ge(){}function Ne(e,t={}){return()=>e}let Ae=g.__EXTEND_POINT__;const de=()=>++Ae,Te={INVALID_ARGUMENT:Ae,INVALID_DATE_ARGUMENT:de(),INVALID_ISO_DATE_ARGUMENT:de(),__EXTEND_POINT__:de()};function be(e){return N(e,null,void 0)}const ke=()=>"",Le=e=>i(e);function Ie(e,...t){const{fallbackFormat:r,postTranslation:a,unresolving:o,messageCompiler:l,fallbackLocale:i,messages:_}=e,[p,E]=Oe(...t),g=m(E.missingWarn)?E.missingWarn:e.missingWarn,N=m(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn,A=m(E.escapeParameter)?E.escapeParameter:e.escapeParameter,d=!!E.resolvedMessage,T=u(E.default)||m(E.default)?m(E.default)?l?p:()=>p:E.default:r?l?p:()=>p:"",b=r||""!==T,k=u(E.locale)?E.locale:e.locale;A&&function(e){c(e.list)?e.list=e.list.map((e=>u(e)?s(e):e)):f(e.named)&&Object.keys(e.named).forEach((t=>{u(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(E);let[L,I,F]=d?[p,k,_[k]||{}]:Fe(e,p,k,i,N,g),C=L,O=p;if(d||u(C)||Le(C)||b&&(C=T,O=C),!(d||(u(C)||Le(C))&&u(I)))return o?-1:p;let h=!1;const R=Le(C)?C:Ce(e,p,I,C,O,(()=>{h=!0}));if(h)return C;const D=function(e,t,r,a){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:c,fallbackWarn:i,missingWarn:m,fallbackContext:f}=e,_=n=>{let a=s(r,n);if(null==a&&f){const[,,e]=Fe(f,n,t,c,i,m);a=s(e,n)}if(u(a)){let r=!1;const o=Ce(e,n,t,a,n,(()=>{r=!0}));return r?ke:o}return Le(a)?a:ke},p={locale:t,modifiers:o,pluralRules:l,messages:_};e.processor&&(p.processor=e.processor);a.list&&(p.list=a.list);a.named&&(p.named=a.named);n(a.plural)&&(p.pluralIndex=a.plural);return p}(e,I,F,E),M=function(e,t,n){return t(n)}(0,R,w(D));return a?a(M):M}function Fe(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:c,localeFallbacker:m}=e,f=m(e,r,n);let _,p={},E=null;for(let n=0;n<f.length&&(_=f[n],p=l[_]||{},null===(E=c(p,t))&&(E=p[t]),!u(E)&&!i(E));n++){const n=pe(e,t,_,0,"translate");n!==t&&(E=n)}return[E,_,p]}function Ce(e,n,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(Le(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||n,e}if(null==s){const e=()=>a;return e.locale=r,e.key=n,e}const i=s(a,function(e,n,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,o,0,c,l));return i.locale=r,i.key=n,i.source=a,i}function Oe(...e){const[t,r,o]=e,s={};if(!u(t)&&!n(t)&&!Le(t))throw Error(Te.INVALID_ARGUMENT);const i=n(t)?String(t):(Le(t),t);return n(r)?s.plural=r:u(r)?s.default=r:E(r)&&!a(r)?s.named=r:c(r)&&(s.list=r),n(o)?s.plural=o:u(o)?s.default=o:E(o)&&l(s,o),[i,s]}function he(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:c}=e,{__datetimeFormatters:i}=e,[f,_,p,g]=Re(...t);m(p.missingWarn)?p.missingWarn:e.missingWarn;m(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn;const N=!!p.part,A=u(p.locale)?p.locale:e.locale,d=c(e,o,A);if(!u(f)||""===f)return new Intl.DateTimeFormat(A).format(_);let T,b={},k=null;for(let t=0;t<d.length&&(T=d[t],b=n[T]||{},k=b[f],!E(k));t++)pe(e,f,T,0,"datetime format");if(!E(k)||!u(T))return r?-1:f;let L=`${T}__${f}`;a(g)||(L=`${L}__${JSON.stringify(g)}`);let I=i.get(L);return I||(I=new Intl.DateTimeFormat(T,l({},k,g)),i.set(L,I)),N?I.formatToParts(_):I.format(_)}function Re(...e){const[t,r,a,o]=e;let l,s={},c={};if(u(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(Te.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();l=new Date(n);try{l.toISOString()}catch(e){throw Error(Te.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===p(t)){if(isNaN(t.getTime()))throw Error(Te.INVALID_DATE_ARGUMENT);l=t}else{if(!n(t))throw Error(Te.INVALID_ARGUMENT);l=t}return u(r)?s.key=r:E(r)&&(s=r),u(a)?s.locale=a:E(a)&&(c=a),E(o)&&(c=o),[s.key||"",l,s,c]}function De(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function Me(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:c}=e,{__numberFormatters:i}=e,[f,_,p,g]=we(...t);m(p.missingWarn)?p.missingWarn:e.missingWarn;m(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn;const N=!!p.part,A=u(p.locale)?p.locale:e.locale,d=c(e,o,A);if(!u(f)||""===f)return new Intl.NumberFormat(A).format(_);let T,b={},k=null;for(let t=0;t<d.length&&(T=d[t],b=n[T]||{},k=b[f],!E(k));t++)pe(e,f,T,0,"number format");if(!E(k)||!u(T))return r?-1:f;let L=`${T}__${f}`;a(g)||(L=`${L}__${JSON.stringify(g)}`);let I=i.get(L);return I||(I=new Intl.NumberFormat(T,l({},k,g)),i.set(L,I)),N?I.formatToParts(_):I.format(_)}function we(...e){const[t,r,a,o]=e;let l={},s={};if(!n(t))throw Error(Te.INVALID_ARGUMENT);const c=t;return u(r)?l.key=r:E(r)&&(l=r),u(a)?l.locale=a:E(a)&&(s=a),E(o)&&(s=o),[l.key||"",c,l,s]}function ye(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}ne(F),re(V);export{g as CompileErrorCodes,Te as CoreErrorCodes,K as CoreWarnCodes,J as DEFAULT_LOCALE,h as DEFAULT_MESSAGE_DATA_TYPE,Q as MISSING_RESOLVE_VALUE,z as NOT_REOSLVED,Y as VERSION,ge as clearCompileCache,De as clearDateTimeFormat,ye as clearNumberFormat,Ne as compileToFunction,N as createCompileError,me as createCoreContext,be as createCoreError,w as createMessageContext,he as datetime,V as fallbackWithLocaleChain,G as fallbackWithSimple,le as getAdditionalMeta,U as getDevToolsHook,ie as getFallbackContext,B as getWarnMessage,pe as handleMissing,v as initI18nDevTools,Le as isMessageFunction,fe as isTranslateFallbackWarn,_e as isTranslateMissingWarn,Me as number,k as parse,Re as parseDateTimeArgs,we as parseNumberArgs,Oe as parseTranslateArgs,re as registerLocaleFallbacker,te as registerMessageCompiler,ne as registerMessageResolver,F as resolveValue,I as resolveWithKeyValue,oe as setAdditionalMeta,S as setDevToolsHook,ce as setFallbackContext,Ie as translate,P as translateDevTools,Ee as updateFallbackLocale};
|
|
6
|
+
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===g(e),a=e=>p(e)&&0===Object.keys(e).length;function o(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const l=Object.assign;function s(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const c=Array.isArray,i=e=>"function"==typeof e,u=e=>"string"==typeof e,m=e=>"boolean"==typeof e,f=e=>null!==e&&"object"==typeof e,_=Object.prototype.toString,g=e=>_.call(e),p=e=>"[object Object]"===g(e),d={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function E(e,t,n={}){const{domain:r,messages:a,args:o}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=r,l}const N=[];N[0]={w:[0],i:[3,0],"[":[4],o:[7]},N[1]={w:[1],".":[2],"[":[4],o:[7]},N[2]={w:[2],i:[3,0],0:[3,0]},N[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},N[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},N[5]={"'":[4,0],o:8,l:[5,0]},N[6]={'"':[4,0],o:8,l:[6,0]};const A=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function T(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function b(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,A.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function h(e){const t=[];let n,r,a,o,l,s,c,i=-1,u=0,m=0;const f=[];function _(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,a="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=a:r+=a},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=b(r),!1===r)return!1;f[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!_()){if(o=T(n),c=N[u],l=c[o]||c.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const k=new Map;function y(e,t){return f(e)?e[t]:null}function I(e,t){if(!f(e))return null;let n=k.get(t);if(n||(n=h(t),n&&k.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=a[n[o]];if(void 0===e)return null;a=e,o++}return a}const L=e=>e,C=e=>"",D="text",F=e=>0===e.length?"":e.join(""),O=e=>null==e?"":c(e)||p(e)&&e.toString===_?JSON.stringify(e,null,2):String(e);function R(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function M(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),a=f(e.pluralRules)&&u(t)&&i(e.pluralRules[t])?e.pluralRules[t]:R,o=f(e.pluralRules)&&u(t)&&i(e.pluralRules[t])?R:void 0,l=e.list||[],s=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,s);function m(t){const n=i(e.messages)?e.messages(t):!!f(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):C)}const _=p(e.processor)&&i(e.processor.normalize)?e.processor.normalize:F,g=p(e.processor)&&i(e.processor.interpolate)?e.processor.interpolate:O,d={list:e=>l[e],named:e=>s[e],plural:e=>e[a(r,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",l="";1===n.length?f(r)?(l=r.modifier||l,o=r.type||o):u(r)&&(l=r||l):2===n.length&&(u(r)&&(l=r||l),u(a)&&(o=a||o));let s=m(t)(d);return"vnode"===o&&c(s)&&l&&(s=s[0]),l?(i=l,e.modifiers?e.modifiers[i]:L)(s,o):s;var i},message:m,type:p(e.processor)&&u(e.processor.type)?e.processor.type:"text",interpolate:g,normalize:_};return d}const w="i18n:init";let S=null;function W(e){S=e}function v(){return S}function U(e,t,n){S&&S.emit(w,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const P=x("function:translate");function x(e){return t=>S&&S.emit(e,t)}const $={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},K={[$.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[$.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[$.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[$.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[$.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[$.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function V(t,...n){return function(t,...n){return 1===n.length&&f(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(K[t],...n)}function j(e,t,n){return[...new Set([n,...c(t)?t:f(t)?Object.keys(t):u(t)?[t]:[n]])]}function G(e,t,n){const r=u(n)?n:J,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;c(e);)e=B(o,e,t);const l=c(t)||!p(t)?t:t.default?t.default:null;e=u(l)?[l]:l,c(e)&&B(o,e,!1),a.__localeChainCache.set(r,o)}return o}function B(e,t,n){let r=!0;for(let a=0;a<t.length&&m(r);a++){const o=t[a];u(o)&&(r=H(e,t[a],n))}return r}function H(e,t,n){let r;const a=t.split("-");do{r=X(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function X(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const a=t.replace(/!/g,"");e.push(a),(c(n)||p(n))&&n[a]&&(r=n[a])}return r}const Y="9.2.0-beta.37",z=-1,J="en-US",Z="",Q=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let q,ee,te;function ne(e){q=e}function re(e){ee=e}function ae(e){te=e}let oe=null;const le=e=>{oe=e},se=()=>oe;let ce=null;const ie=e=>{ce=e},ue=()=>ce;let me=0;function fe(e={}){const t=u(e.version)?e.version:"9.2.0-beta.37",n=u(e.locale)?e.locale:J,a=c(e.fallbackLocale)||p(e.fallbackLocale)||u(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=p(e.messages)?e.messages:{[n]:{}},_=p(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},g=p(e.numberFormats)?e.numberFormats:{[n]:{}},d=l({},e.modifiers||{},{upper:(e,t)=>"text"===t&&u(e)?e.toUpperCase():"vnode"===t&&f(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&u(e)?e.toLowerCase():"vnode"===t&&f(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&u(e)?Q(e):"vnode"===t&&f(e)&&"__v_isVNode"in e?Q(e.children):e}),E=e.pluralRules||{},N=i(e.missing)?e.missing:null,A=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,T=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,h=!!e.unresolving,k=i(e.postTranslation)?e.postTranslation:null,I=p(e.processor)?e.processor:null,L=!m(e.warnHtmlMessage)||e.warnHtmlMessage,C=!!e.escapeParameter,D=i(e.messageCompiler)?e.messageCompiler:q,F=i(e.messageResolver)?e.messageResolver:ee||y,O=i(e.localeFallbacker)?e.localeFallbacker:te||j,R=f(e.fallbackContext)?e.fallbackContext:void 0,M=i(e.onWarn)?e.onWarn:o,w=e,S=f(w.__datetimeFormatters)?w.__datetimeFormatters:new Map,W=f(w.__numberFormatters)?w.__numberFormatters:new Map,v=f(w.__meta)?w.__meta:{};me++;const U={version:t,cid:me,locale:n,fallbackLocale:a,messages:s,modifiers:d,pluralRules:E,missing:N,missingWarn:A,fallbackWarn:T,fallbackFormat:b,unresolving:h,postTranslation:k,processor:I,warnHtmlMessage:L,escapeParameter:C,messageCompiler:D,messageResolver:F,localeFallbacker:O,fallbackContext:R,onWarn:M,__meta:v};return U.datetimeFormats=_,U.numberFormats=g,U.__datetimeFormatters=S,U.__numberFormatters=W,U}function _e(e,t){return e instanceof RegExp?e.test(t):e}function ge(e,t){return e instanceof RegExp?e.test(t):e}function pe(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return u(r)?r:t}return t}function de(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)}function Ee(){}function Ne(e,t={}){return()=>e}let Ae=d.__EXTEND_POINT__;const Te=()=>++Ae,be={INVALID_ARGUMENT:Ae,INVALID_DATE_ARGUMENT:Te(),INVALID_ISO_DATE_ARGUMENT:Te(),__EXTEND_POINT__:Te()};function he(e){return E(e,null,void 0)}const ke=()=>"",ye=e=>i(e);function Ie(e,...t){const{fallbackFormat:r,postTranslation:a,unresolving:o,messageCompiler:l,fallbackLocale:i,messages:_}=e,[g,p]=De(...t),d=m(p.missingWarn)?p.missingWarn:e.missingWarn,E=m(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn,N=m(p.escapeParameter)?p.escapeParameter:e.escapeParameter,A=!!p.resolvedMessage,T=u(p.default)||m(p.default)?m(p.default)?l?g:()=>g:p.default:r?l?g:()=>g:"",b=r||""!==T,h=u(p.locale)?p.locale:e.locale;N&&function(e){c(e.list)?e.list=e.list.map((e=>u(e)?s(e):e)):f(e.named)&&Object.keys(e.named).forEach((t=>{u(e.named[t])&&(e.named[t]=s(e.named[t]))}))}(p);let[k,y,I]=A?[g,h,_[h]||{}]:Le(e,g,h,i,E,d),L=k,C=g;if(A||u(L)||ye(L)||b&&(L=T,C=L),!(A||(u(L)||ye(L))&&u(y)))return o?-1:g;let D=!1;const F=ye(L)?L:Ce(e,g,y,L,C,(()=>{D=!0}));if(D)return L;const O=function(e,t,r,a){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:c,fallbackWarn:i,missingWarn:m,fallbackContext:f}=e,_=n=>{let a=s(r,n);if(null==a&&f){const[,,e]=Le(f,n,t,c,i,m);a=s(e,n)}if(u(a)){let r=!1;const o=Ce(e,n,t,a,n,(()=>{r=!0}));return r?ke:o}return ye(a)?a:ke},g={locale:t,modifiers:o,pluralRules:l,messages:_};e.processor&&(g.processor=e.processor);a.list&&(g.list=a.list);a.named&&(g.named=a.named);n(a.plural)&&(g.pluralIndex=a.plural);return g}(e,y,I,p),R=function(e,t,n){return t(n)}(0,F,M(O));return a?a(R,g):R}function Le(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:c,localeFallbacker:m}=e,f=m(e,r,n);let _,g={},p=null;for(let n=0;n<f.length&&(_=f[n],g=l[_]||{},null===(p=c(g,t))&&(p=g[t]),!u(p)&&!i(p));n++){const n=pe(e,t,_,0,"translate");n!==t&&(p=n)}return[p,_,g]}function Ce(e,n,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(ye(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||n,e}if(null==s){const e=()=>a;return e.locale=r,e.key=n,e}const i=s(a,function(e,n,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,o,0,c,l));return i.locale=r,i.key=n,i.source=a,i}function De(...e){const[t,r,o]=e,s={};if(!u(t)&&!n(t)&&!ye(t))throw Error(be.INVALID_ARGUMENT);const i=n(t)?String(t):(ye(t),t);return n(r)?s.plural=r:u(r)?s.default=r:p(r)&&!a(r)?s.named=r:c(r)&&(s.list=r),n(o)?s.plural=o:u(o)?s.default=o:p(o)&&l(s,o),[i,s]}function Fe(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:c}=e,{__datetimeFormatters:i}=e,[f,_,g,d]=Re(...t);m(g.missingWarn)?g.missingWarn:e.missingWarn;m(g.fallbackWarn)?g.fallbackWarn:e.fallbackWarn;const E=!!g.part,N=u(g.locale)?g.locale:e.locale,A=c(e,o,N);if(!u(f)||""===f)return new Intl.DateTimeFormat(N,d).format(_);let T,b={},h=null;for(let t=0;t<A.length&&(T=A[t],b=n[T]||{},h=b[f],!p(h));t++)pe(e,f,T,0,"datetime format");if(!p(h)||!u(T))return r?-1:f;let k=`${T}__${f}`;a(d)||(k=`${k}__${JSON.stringify(d)}`);let y=i.get(k);return y||(y=new Intl.DateTimeFormat(T,l({},h,d)),i.set(k,y)),E?y.formatToParts(_):y.format(_)}const Oe=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Re(...e){const[t,r,a,o]=e,l={};let s,c={};if(u(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(be.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();s=new Date(n);try{s.toISOString()}catch(e){throw Error(be.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===g(t)){if(isNaN(t.getTime()))throw Error(be.INVALID_DATE_ARGUMENT);s=t}else{if(!n(t))throw Error(be.INVALID_ARGUMENT);s=t}return u(r)?l.key=r:p(r)&&Object.keys(r).forEach((e=>{Oe.includes(e)?c[e]=r[e]:l[e]=r[e]})),u(a)?l.locale=a:p(a)&&(c=a),p(o)&&(c=o),[l.key||"",s,l,c]}function Me(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function we(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:c}=e,{__numberFormatters:i}=e,[f,_,g,d]=We(...t);m(g.missingWarn)?g.missingWarn:e.missingWarn;m(g.fallbackWarn)?g.fallbackWarn:e.fallbackWarn;const E=!!g.part,N=u(g.locale)?g.locale:e.locale,A=c(e,o,N);if(!u(f)||""===f)return new Intl.NumberFormat(N,d).format(_);let T,b={},h=null;for(let t=0;t<A.length&&(T=A[t],b=n[T]||{},h=b[f],!p(h));t++)pe(e,f,T,0,"number format");if(!p(h)||!u(T))return r?-1:f;let k=`${T}__${f}`;a(d)||(k=`${k}__${JSON.stringify(d)}`);let y=i.get(k);return y||(y=new Intl.NumberFormat(T,l({},h,d)),i.set(k,y)),E?y.formatToParts(_):y.format(_)}const Se=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function We(...e){const[t,r,a,o]=e,l={};let s={};if(!n(t))throw Error(be.INVALID_ARGUMENT);const c=t;return u(r)?l.key=r:p(r)&&Object.keys(r).forEach((e=>{Se.includes(e)?s[e]=r[e]:l[e]=r[e]})),u(a)?l.locale=a:p(a)&&(s=a),p(o)&&(s=o),[l.key||"",c,l,s]}function ve(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}re(I),ae(G);export{d as CompileErrorCodes,be as CoreErrorCodes,$ as CoreWarnCodes,Oe as DATETIME_FORMAT_OPTIONS_KEYS,J as DEFAULT_LOCALE,D as DEFAULT_MESSAGE_DATA_TYPE,Z as MISSING_RESOLVE_VALUE,z as NOT_REOSLVED,Se as NUMBER_FORMAT_OPTIONS_KEYS,Y as VERSION,Ee as clearCompileCache,Me as clearDateTimeFormat,ve as clearNumberFormat,Ne as compileToFunction,E as createCompileError,fe as createCoreContext,he as createCoreError,M as createMessageContext,Fe as datetime,G as fallbackWithLocaleChain,j as fallbackWithSimple,se as getAdditionalMeta,v as getDevToolsHook,ue as getFallbackContext,V as getWarnMessage,pe as handleMissing,U as initI18nDevTools,ye as isMessageFunction,_e as isTranslateFallbackWarn,ge as isTranslateMissingWarn,we as number,h as parse,Re as parseDateTimeArgs,We as parseNumberArgs,De as parseTranslateArgs,ae as registerLocaleFallbacker,ne as registerMessageCompiler,re as registerMessageResolver,I as resolveValue,y as resolveWithKeyValue,le as setAdditionalMeta,W as setDevToolsHook,ie as setFallbackContext,Ie as translate,P as translateDevTools,de as updateFallbackLocale};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v9.2.0-beta.
|
|
2
|
+
* core v9.2.0-beta.37
|
|
3
3
|
* (c) 2022 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -497,7 +497,9 @@ var IntlifyCore = (function (exports) {
|
|
|
497
497
|
isFunction(options.pluralRules[locale])
|
|
498
498
|
? pluralDefault
|
|
499
499
|
: undefined;
|
|
500
|
-
const plural = (messages) =>
|
|
500
|
+
const plural = (messages) => {
|
|
501
|
+
return messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
|
|
502
|
+
};
|
|
501
503
|
const _list = options.list || [];
|
|
502
504
|
const list = (index) => _list[index];
|
|
503
505
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -527,13 +529,37 @@ var IntlifyCore = (function (exports) {
|
|
|
527
529
|
isFunction(options.processor.interpolate)
|
|
528
530
|
? options.processor.interpolate
|
|
529
531
|
: DEFAULT_INTERPOLATE;
|
|
530
|
-
const linked = (key, modifier) => {
|
|
531
|
-
const msg = message(key)(ctx);
|
|
532
|
-
return isString(modifier) ? _modifier(modifier)(msg) : msg;
|
|
533
|
-
};
|
|
534
532
|
const type = isPlainObject(options.processor) && isString(options.processor.type)
|
|
535
533
|
? options.processor.type
|
|
536
534
|
: DEFAULT_MESSAGE_DATA_TYPE;
|
|
535
|
+
const linked = (key, ...args) => {
|
|
536
|
+
const [arg1, arg2] = args;
|
|
537
|
+
let type = 'text';
|
|
538
|
+
let modifier = '';
|
|
539
|
+
if (args.length === 1) {
|
|
540
|
+
if (isObject(arg1)) {
|
|
541
|
+
modifier = arg1.modifier || modifier;
|
|
542
|
+
type = arg1.type || type;
|
|
543
|
+
}
|
|
544
|
+
else if (isString(arg1)) {
|
|
545
|
+
modifier = arg1 || modifier;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
else if (args.length === 2) {
|
|
549
|
+
if (isString(arg1)) {
|
|
550
|
+
modifier = arg1 || modifier;
|
|
551
|
+
}
|
|
552
|
+
if (isString(arg2)) {
|
|
553
|
+
type = arg2 || type;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
let msg = message(key)(ctx);
|
|
557
|
+
// The message in vnode resolved with linked are returned as an array by processor.nomalize
|
|
558
|
+
if (type === 'vnode' && isArray(msg) && modifier) {
|
|
559
|
+
msg = msg[0];
|
|
560
|
+
}
|
|
561
|
+
return modifier ? _modifier(modifier)(msg, type) : msg;
|
|
562
|
+
};
|
|
537
563
|
const ctx = {
|
|
538
564
|
["list" /* LIST */]: list,
|
|
539
565
|
["named" /* NAMED */]: named,
|
|
@@ -717,18 +743,37 @@ var IntlifyCore = (function (exports) {
|
|
|
717
743
|
* Intlify core-base version
|
|
718
744
|
* @internal
|
|
719
745
|
*/
|
|
720
|
-
const VERSION = '9.2.0-beta.
|
|
746
|
+
const VERSION = '9.2.0-beta.37';
|
|
721
747
|
const NOT_REOSLVED = -1;
|
|
722
748
|
const DEFAULT_LOCALE = 'en-US';
|
|
723
749
|
const MISSING_RESOLVE_VALUE = '';
|
|
750
|
+
const capitalize = (str) => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}`;
|
|
724
751
|
function getDefaultLinkedModifiers() {
|
|
725
752
|
return {
|
|
726
|
-
upper: (val) =>
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
753
|
+
upper: (val, type) => {
|
|
754
|
+
// prettier-ignore
|
|
755
|
+
return type === 'text' && isString(val)
|
|
756
|
+
? val.toUpperCase()
|
|
757
|
+
: type === 'vnode' && isObject(val) && '__v_isVNode' in val
|
|
758
|
+
? val.children.toUpperCase()
|
|
759
|
+
: val;
|
|
760
|
+
},
|
|
761
|
+
lower: (val, type) => {
|
|
762
|
+
// prettier-ignore
|
|
763
|
+
return type === 'text' && isString(val)
|
|
764
|
+
? val.toLowerCase()
|
|
765
|
+
: type === 'vnode' && isObject(val) && '__v_isVNode' in val
|
|
766
|
+
? val.children.toLowerCase()
|
|
767
|
+
: val;
|
|
768
|
+
},
|
|
769
|
+
capitalize: (val, type) => {
|
|
770
|
+
// prettier-ignore
|
|
771
|
+
return (type === 'text' && isString(val)
|
|
772
|
+
? capitalize(val)
|
|
773
|
+
: type === 'vnode' && isObject(val) && '__v_isVNode' in val
|
|
774
|
+
? capitalize(val.children)
|
|
775
|
+
: val);
|
|
776
|
+
}
|
|
732
777
|
};
|
|
733
778
|
}
|
|
734
779
|
let _compiler;
|
|
@@ -1031,7 +1076,9 @@ var IntlifyCore = (function (exports) {
|
|
|
1031
1076
|
const msgContext = createMessageContext(ctxOptions);
|
|
1032
1077
|
const messaged = evaluateMessage(context, msg, msgContext);
|
|
1033
1078
|
// if use post translation option, proceed it with handler
|
|
1034
|
-
const ret = postTranslation
|
|
1079
|
+
const ret = postTranslation
|
|
1080
|
+
? postTranslation(messaged, key)
|
|
1081
|
+
: messaged;
|
|
1035
1082
|
// NOTE: experimental !!
|
|
1036
1083
|
{
|
|
1037
1084
|
// prettier-ignore
|
|
@@ -1358,7 +1405,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1358
1405
|
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1359
1406
|
fallbackLocale, locale);
|
|
1360
1407
|
if (!isString(key) || key === '') {
|
|
1361
|
-
return new Intl.DateTimeFormat(locale).format(value);
|
|
1408
|
+
return new Intl.DateTimeFormat(locale, overrides).format(value);
|
|
1362
1409
|
}
|
|
1363
1410
|
// resolve format
|
|
1364
1411
|
let datetimeFormat = {};
|
|
@@ -1413,9 +1460,32 @@ var IntlifyCore = (function (exports) {
|
|
|
1413
1460
|
return !part ? formatter.format(value) : formatter.formatToParts(value);
|
|
1414
1461
|
}
|
|
1415
1462
|
/** @internal */
|
|
1463
|
+
const DATETIME_FORMAT_OPTIONS_KEYS = [
|
|
1464
|
+
'localeMatcher',
|
|
1465
|
+
'weekday',
|
|
1466
|
+
'era',
|
|
1467
|
+
'year',
|
|
1468
|
+
'month',
|
|
1469
|
+
'day',
|
|
1470
|
+
'hour',
|
|
1471
|
+
'minute',
|
|
1472
|
+
'second',
|
|
1473
|
+
'timeZoneName',
|
|
1474
|
+
'formatMatcher',
|
|
1475
|
+
'hour12',
|
|
1476
|
+
'timeZone',
|
|
1477
|
+
'dateStyle',
|
|
1478
|
+
'timeStyle',
|
|
1479
|
+
'calendar',
|
|
1480
|
+
'dayPeriod',
|
|
1481
|
+
'numberingSystem',
|
|
1482
|
+
'hourCycle',
|
|
1483
|
+
'fractionalSecondDigits'
|
|
1484
|
+
];
|
|
1485
|
+
/** @internal */
|
|
1416
1486
|
function parseDateTimeArgs(...args) {
|
|
1417
1487
|
const [arg1, arg2, arg3, arg4] = args;
|
|
1418
|
-
|
|
1488
|
+
const options = {};
|
|
1419
1489
|
let overrides = {};
|
|
1420
1490
|
let value;
|
|
1421
1491
|
if (isString(arg1)) {
|
|
@@ -1457,7 +1527,14 @@ var IntlifyCore = (function (exports) {
|
|
|
1457
1527
|
options.key = arg2;
|
|
1458
1528
|
}
|
|
1459
1529
|
else if (isPlainObject(arg2)) {
|
|
1460
|
-
|
|
1530
|
+
Object.keys(arg2).forEach(key => {
|
|
1531
|
+
if (DATETIME_FORMAT_OPTIONS_KEYS.includes(key)) {
|
|
1532
|
+
overrides[key] = arg2[key];
|
|
1533
|
+
}
|
|
1534
|
+
else {
|
|
1535
|
+
options[key] = arg2[key];
|
|
1536
|
+
}
|
|
1537
|
+
});
|
|
1461
1538
|
}
|
|
1462
1539
|
if (isString(arg3)) {
|
|
1463
1540
|
options.locale = arg3;
|
|
@@ -1502,7 +1579,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1502
1579
|
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1503
1580
|
fallbackLocale, locale);
|
|
1504
1581
|
if (!isString(key) || key === '') {
|
|
1505
|
-
return new Intl.NumberFormat(locale).format(value);
|
|
1582
|
+
return new Intl.NumberFormat(locale, overrides).format(value);
|
|
1506
1583
|
}
|
|
1507
1584
|
// resolve format
|
|
1508
1585
|
let numberFormat = {};
|
|
@@ -1557,9 +1634,32 @@ var IntlifyCore = (function (exports) {
|
|
|
1557
1634
|
return !part ? formatter.format(value) : formatter.formatToParts(value);
|
|
1558
1635
|
}
|
|
1559
1636
|
/** @internal */
|
|
1637
|
+
const NUMBER_FORMAT_OPTIONS_KEYS = [
|
|
1638
|
+
'localeMatcher',
|
|
1639
|
+
'style',
|
|
1640
|
+
'currency',
|
|
1641
|
+
'currencyDisplay',
|
|
1642
|
+
'currencySign',
|
|
1643
|
+
'useGrouping',
|
|
1644
|
+
'minimumIntegerDigits',
|
|
1645
|
+
'minimumFractionDigits',
|
|
1646
|
+
'maximumFractionDigits',
|
|
1647
|
+
'minimumSignificantDigits',
|
|
1648
|
+
'maximumSignificantDigits',
|
|
1649
|
+
'compactDisplay',
|
|
1650
|
+
'notation',
|
|
1651
|
+
'signDisplay',
|
|
1652
|
+
'unit',
|
|
1653
|
+
'unitDisplay',
|
|
1654
|
+
'roundingMode',
|
|
1655
|
+
'roundingPriority',
|
|
1656
|
+
'roundingIncrement',
|
|
1657
|
+
'trailingZeroDisplay'
|
|
1658
|
+
];
|
|
1659
|
+
/** @internal */
|
|
1560
1660
|
function parseNumberArgs(...args) {
|
|
1561
1661
|
const [arg1, arg2, arg3, arg4] = args;
|
|
1562
|
-
|
|
1662
|
+
const options = {};
|
|
1563
1663
|
let overrides = {};
|
|
1564
1664
|
if (!isNumber(arg1)) {
|
|
1565
1665
|
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
|
|
@@ -1569,7 +1669,14 @@ var IntlifyCore = (function (exports) {
|
|
|
1569
1669
|
options.key = arg2;
|
|
1570
1670
|
}
|
|
1571
1671
|
else if (isPlainObject(arg2)) {
|
|
1572
|
-
|
|
1672
|
+
Object.keys(arg2).forEach(key => {
|
|
1673
|
+
if (NUMBER_FORMAT_OPTIONS_KEYS.includes(key)) {
|
|
1674
|
+
overrides[key] = arg2[key];
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
options[key] = arg2[key];
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1573
1680
|
}
|
|
1574
1681
|
if (isString(arg3)) {
|
|
1575
1682
|
options.locale = arg3;
|
|
@@ -1602,10 +1709,12 @@ var IntlifyCore = (function (exports) {
|
|
|
1602
1709
|
exports.CompileErrorCodes = CompileErrorCodes;
|
|
1603
1710
|
exports.CoreErrorCodes = CoreErrorCodes;
|
|
1604
1711
|
exports.CoreWarnCodes = CoreWarnCodes;
|
|
1712
|
+
exports.DATETIME_FORMAT_OPTIONS_KEYS = DATETIME_FORMAT_OPTIONS_KEYS;
|
|
1605
1713
|
exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
|
|
1606
1714
|
exports.DEFAULT_MESSAGE_DATA_TYPE = DEFAULT_MESSAGE_DATA_TYPE;
|
|
1607
1715
|
exports.MISSING_RESOLVE_VALUE = MISSING_RESOLVE_VALUE;
|
|
1608
1716
|
exports.NOT_REOSLVED = NOT_REOSLVED;
|
|
1717
|
+
exports.NUMBER_FORMAT_OPTIONS_KEYS = NUMBER_FORMAT_OPTIONS_KEYS;
|
|
1609
1718
|
exports.VERSION = VERSION;
|
|
1610
1719
|
exports.clearCompileCache = clearCompileCache;
|
|
1611
1720
|
exports.clearDateTimeFormat = clearDateTimeFormat;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v9.2.0-beta.
|
|
2
|
+
* core v9.2.0-beta.37
|
|
3
3
|
* (c) 2022 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),a=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===g(e),o=e=>p(e)&&0===Object.keys(e).length;function l(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function c(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const i=Array.isArray,u=e=>"function"==typeof e,m=e=>"string"==typeof e,f=e=>"boolean"==typeof e,_=e=>null!==e&&"object"==typeof e,E=Object.prototype.toString,g=e=>E.call(e),p=e=>"[object Object]"===g(e),A={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function T(e,t,n={}){const{domain:a,messages:r,args:o}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=a,l}const d=[];d[0]={w:[0],i:[3,0],"[":[4],o:[7]},d[1]={w:[1],".":[2],"[":[4],o:[7]},d[2]={w:[2],i:[3,0],0:[3,0]},d[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},d[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},d[5]={"'":[4,0],o:8,l:[5,0]},d[6]={'"':[4,0],o:8,l:[6,0]};const N=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function b(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function C(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,N.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function k(e){const t=[];let n,a,r,o,l,s,c,i=-1,u=0,m=0;const f=[];function _(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,r="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===a?a=r:a+=r},f[1]=()=>{void 0!==a&&(t.push(a),a=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===a)return!1;if(a=C(a),!1===a)return!1;f[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!_()){if(o=b(n),c=d[u],l=c[o]||c.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(r=n,!1===s())))return;if(7===u)return t}}const L=new Map;function F(e,t){return _(e)?e[t]:null}function I(e,t){if(!_(e))return null;let n=L.get(t);if(n||(n=k(t),n&&L.set(t,n)),!n)return null;const a=n.length;let r=e,o=0;for(;o<a;){const e=r[n[o]];if(void 0===e)return null;r=e,o++}return r}const O=e=>e,D=e=>"",h="text",M=e=>0===e.length?"":e.join(""),R=e=>null==e?"":i(e)||p(e)&&e.toString===E?JSON.stringify(e,null,2):String(e);function W(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function y(e={}){const t=e.locale,n=function(e){const t=a(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(a(e.named.count)||a(e.named.n))?a(e.named.count)?e.named.count:a(e.named.n)?e.named.n:t:t}(e),r=_(e.pluralRules)&&m(t)&&u(e.pluralRules[t])?e.pluralRules[t]:W,o=_(e.pluralRules)&&m(t)&&u(e.pluralRules[t])?W:void 0,l=e.list||[],s=e.named||{};a(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function c(t){const n=u(e.messages)?e.messages(t):!!_(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):D)}const i=p(e.processor)&&u(e.processor.normalize)?e.processor.normalize:M,f=p(e.processor)&&u(e.processor.interpolate)?e.processor.interpolate:R,E={list:e=>l[e],named:e=>s[e],plural:e=>e[r(n,e.length,o)],linked:(t,n)=>{const a=c(t)(E);return m(n)?(r=n,e.modifiers?e.modifiers[r]:O)(a):a;var r},message:c,type:p(e.processor)&&m(e.processor.type)?e.processor.type:h,interpolate:f,normalize:i};return E}const w="i18n:init";let S=null;const v=U("function:translate");function U(e){return t=>S&&S.emit(e,t)}const P={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},V={[P.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[P.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[P.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[P.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[P.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[P.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function $(e,t,n){return[...new Set([n,...i(t)?t:_(t)?Object.keys(t):m(t)?[t]:[n]])]}function x(e,t,n){const a=m(n)?n:H,r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(a);if(!o){o=[];let e=[n];for(;i(e);)e=K(o,e,t);const l=i(t)||!p(t)?t:t.default?t.default:null;e=m(l)?[l]:l,i(e)&&K(o,e,!1),r.__localeChainCache.set(a,o)}return o}function K(e,t,n){let a=!0;for(let r=0;r<t.length&&f(a);r++){const o=t[r];m(o)&&(a=G(e,t[r],n))}return a}function G(e,t,n){let a;const r=t.split("-");do{a=j(e,r.join("-"),n),r.splice(-1,1)}while(r.length&&!0===a);return a}function j(e,t,n){let a=!1;if(!e.includes(t)&&(a=!0,t)){a="!"!==t[t.length-1];const r=t.replace(/!/g,"");e.push(r),(i(n)||p(n))&&n[r]&&(a=n[r])}return a}const B="9.2.0-beta.34",H="en-US";let X,Y,z;function J(e){Y=e}function Q(e){z=e}let q=null;let Z=null;let ee=0;function te(e,t,n,a,r){const{missing:o,onWarn:l}=e;if(null!==o){const a=o(e,n,t,r);return m(a)?a:t}return t}let ne=A.__EXTEND_POINT__;const ae=()=>++ne,re={INVALID_ARGUMENT:ne,INVALID_DATE_ARGUMENT:ae(),INVALID_ISO_DATE_ARGUMENT:ae(),__EXTEND_POINT__:ae()};const oe=()=>"",le=e=>u(e);function se(e,t,n,a,r,o){const{messages:l,onWarn:s,messageResolver:c,localeFallbacker:i}=e,f=i(e,a,n);let _,E={},g=null;for(let n=0;n<f.length&&(_=f[n],E=l[_]||{},null===(g=c(E,t))&&(g=E[t]),!m(g)&&!u(g));n++){const n=te(e,t,_,0,"translate");n!==t&&(g=n)}return[g,_,E]}function ce(e,t,a,r,o,l){const{messageCompiler:s,warnHtmlMessage:c}=e;if(le(r)){const e=r;return e.locale=e.locale||a,e.key=e.key||t,e}if(null==s){const e=()=>r;return e.locale=a,e.key=t,e}const i=s(r,function(e,t,a,r,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,t,a)=>n({l:e,k:t,s:a}))(t,a,e)}}(0,a,o,0,c,l));return i.locale=a,i.key=t,i.source=r,i}function ie(...e){const[t,n,r]=e,l={};if(!m(t)&&!a(t)&&!le(t))throw Error(re.INVALID_ARGUMENT);const c=a(t)?String(t):(le(t),t);return a(n)?l.plural=n:m(n)?l.default=n:p(n)&&!o(n)?l.named=n:i(n)&&(l.list=n),a(r)?l.plural=r:m(r)?l.default=r:p(r)&&s(l,r),[c,l]}function ue(...e){const[t,n,r,o]=e;let l,s={},c={};if(m(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(re.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();l=new Date(n);try{l.toISOString()}catch(e){throw Error(re.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===g(t)){if(isNaN(t.getTime()))throw Error(re.INVALID_DATE_ARGUMENT);l=t}else{if(!a(t))throw Error(re.INVALID_ARGUMENT);l=t}return m(n)?s.key=n:p(n)&&(s=n),m(r)?s.locale=r:p(r)&&(c=r),p(o)&&(c=o),[s.key||"",l,s,c]}function me(...e){const[t,n,r,o]=e;let l={},s={};if(!a(t))throw Error(re.INVALID_ARGUMENT);const c=t;return m(n)?l.key=n:p(n)&&(l=n),m(r)?l.locale=r:p(r)&&(s=r),p(o)&&(s=o),[l.key||"",c,l,s]}return J(I),Q(x),e.CompileErrorCodes=A,e.CoreErrorCodes=re,e.CoreWarnCodes=P,e.DEFAULT_LOCALE=H,e.DEFAULT_MESSAGE_DATA_TYPE=h,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=B,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const a=e;for(const e in n){const n=`${t}__${e}`;a.__datetimeFormatters.has(n)&&a.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const a=e;for(const e in n){const n=`${t}__${e}`;a.__numberFormatters.has(n)&&a.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=T,e.createCoreContext=function(e={}){const t=m(e.version)?e.version:B,n=m(e.locale)?e.locale:H,a=i(e.fallbackLocale)||p(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=p(e.messages)?e.messages:{[n]:{}},c=p(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},E=p(e.numberFormats)?e.numberFormats:{[n]:{}},g=s({},e.modifiers||{},{upper:e=>m(e)?e.toUpperCase():e,lower:e=>m(e)?e.toLowerCase():e,capitalize:e=>m(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),A=e.pluralRules||{},T=u(e.missing)?e.missing:null,d=!f(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,N=!f(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,C=!!e.unresolving,k=u(e.postTranslation)?e.postTranslation:null,L=p(e.processor)?e.processor:null,I=!f(e.warnHtmlMessage)||e.warnHtmlMessage,O=!!e.escapeParameter,D=u(e.messageCompiler)?e.messageCompiler:X,h=u(e.messageResolver)?e.messageResolver:Y||F,M=u(e.localeFallbacker)?e.localeFallbacker:z||$,R=_(e.fallbackContext)?e.fallbackContext:void 0,W=u(e.onWarn)?e.onWarn:l,y=e,w=_(y.__datetimeFormatters)?y.__datetimeFormatters:new Map,S=_(y.__numberFormatters)?y.__numberFormatters:new Map,v=_(y.__meta)?y.__meta:{};ee++;const U={version:t,cid:ee,locale:n,fallbackLocale:a,messages:o,modifiers:g,pluralRules:A,missing:T,missingWarn:d,fallbackWarn:N,fallbackFormat:b,unresolving:C,postTranslation:k,processor:L,warnHtmlMessage:I,escapeParameter:O,messageCompiler:D,messageResolver:h,localeFallbacker:M,fallbackContext:R,onWarn:W,__meta:v};return U.datetimeFormats=c,U.numberFormats=E,U.__datetimeFormatters=w,U.__numberFormatters=S,U},e.createCoreError=function(e){return T(e,null,void 0)},e.createMessageContext=y,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:a,fallbackLocale:r,onWarn:l,localeFallbacker:c}=e,{__datetimeFormatters:i}=e,[u,_,E,g]=ue(...t);f(E.missingWarn)?E.missingWarn:e.missingWarn,f(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const A=!!E.part,T=m(E.locale)?E.locale:e.locale,d=c(e,r,T);if(!m(u)||""===u)return new Intl.DateTimeFormat(T).format(_);let N,b={},C=null;for(let t=0;t<d.length&&(N=d[t],b=n[N]||{},C=b[u],!p(C));t++)te(e,u,N,0,"datetime format");if(!p(C)||!m(N))return a?-1:u;let k=`${N}__${u}`;o(g)||(k=`${k}__${JSON.stringify(g)}`);let L=i.get(k);return L||(L=new Intl.DateTimeFormat(N,s({},C,g)),i.set(k,L)),A?L.formatToParts(_):L.format(_)},e.fallbackWithLocaleChain=x,e.fallbackWithSimple=$,e.getAdditionalMeta=()=>q,e.getDevToolsHook=function(){return S},e.getFallbackContext=()=>Z,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&_(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(V[e],...n)},e.handleMissing=te,e.initI18nDevTools=function(e,t,n){S&&S.emit(w,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=le,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:a,fallbackLocale:r,onWarn:l,localeFallbacker:c}=e,{__numberFormatters:i}=e,[u,_,E,g]=me(...t);f(E.missingWarn)?E.missingWarn:e.missingWarn,f(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const A=!!E.part,T=m(E.locale)?E.locale:e.locale,d=c(e,r,T);if(!m(u)||""===u)return new Intl.NumberFormat(T).format(_);let N,b={},C=null;for(let t=0;t<d.length&&(N=d[t],b=n[N]||{},C=b[u],!p(C));t++)te(e,u,N,0,"number format");if(!p(C)||!m(N))return a?-1:u;let k=`${N}__${u}`;o(g)||(k=`${k}__${JSON.stringify(g)}`);let L=i.get(k);return L||(L=new Intl.NumberFormat(N,s({},C,g)),i.set(k,L)),A?L.formatToParts(_):L.format(_)},e.parse=k,e.parseDateTimeArgs=ue,e.parseNumberArgs=me,e.parseTranslateArgs=ie,e.registerLocaleFallbacker=Q,e.registerMessageCompiler=function(e){X=e},e.registerMessageResolver=J,e.resolveValue=I,e.resolveWithKeyValue=F,e.setAdditionalMeta=e=>{q=e},e.setDevToolsHook=function(e){S=e},e.setFallbackContext=e=>{Z=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:u}=e,[E,g]=ie(...t),p=f(g.missingWarn)?g.missingWarn:e.missingWarn,A=f(g.fallbackWarn)?g.fallbackWarn:e.fallbackWarn,T=f(g.escapeParameter)?g.escapeParameter:e.escapeParameter,d=!!g.resolvedMessage,N=m(g.default)||f(g.default)?f(g.default)?l?E:()=>E:g.default:n?l?E:()=>E:"",b=n||""!==N,C=m(g.locale)?g.locale:e.locale;T&&function(e){i(e.list)?e.list=e.list.map((e=>m(e)?c(e):e)):_(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=c(e.named[t]))}))}(g);let[k,L,F]=d?[E,C,u[C]||{}]:se(e,E,C,s,A,p),I=k,O=E;if(d||m(I)||le(I)||b&&(I=N,O=I),!(d||(m(I)||le(I))&&m(L)))return o?-1:E;let D=!1;const h=le(I)?I:ce(e,E,L,I,O,(()=>{D=!0}));if(D)return I;const M=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:c,fallbackWarn:i,missingWarn:u,fallbackContext:f}=e,_=a=>{let r=s(n,a);if(null==r&&f){const[,,e]=se(f,a,t,c,i,u);r=s(e,a)}if(m(r)){let n=!1;const o=ce(e,a,t,r,a,(()=>{n=!0}));return n?oe:o}return le(r)?r:oe},E={locale:t,modifiers:o,pluralRules:l,messages:_};e.processor&&(E.processor=e.processor);r.list&&(E.list=r.list);r.named&&(E.named=r.named);a(r.plural)&&(E.pluralIndex=r.plural);return E}(e,L,F,g),R=function(e,t,n){return t(n)}(0,h,y(M));return r?r(R):R},e.translateDevTools=v,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
6
|
+
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),a=e=>"[object RegExp]"===p(e),o=e=>E(e)&&0===Object.keys(e).length;function l(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function i(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const c=Array.isArray,u=e=>"function"==typeof e,m=e=>"string"==typeof e,f=e=>"boolean"==typeof e,_=e=>null!==e&&"object"==typeof e,g=Object.prototype.toString,p=e=>g.call(e),E=e=>"[object Object]"===p(e),d={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function T(e,t,n={}){const{domain:r,messages:a,args:o}=n,l=new SyntaxError(String(e));return l.code=e,t&&(l.location=t),l.domain=r,l}const A=[];A[0]={w:[0],i:[3,0],"[":[4],o:[7]},A[1]={w:[1],".":[2],"[":[4],o:[7]},A[2]={w:[2],i:[3,0],0:[3,0]},A[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},A[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},A[5]={"'":[4,0],o:8,l:[5,0]},A[6]={'"':[4,0],o:8,l:[6,0]};const N=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function b(e){if(null==e)return"o";switch(e.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return e;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function C(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,N.test(n)?function(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}(t):"*"+t);var n}function k(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const f=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===r?r=a:r+=a},f[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),m++},f[3]=()=>{if(m>0)m--,u=4,f[0]();else{if(m=0,void 0===r)return!1;if(r=C(r),!1===r)return!1;f[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!_()){if(o=b(n),i=A[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=f[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const F=new Map;function h(e,t){return _(e)?e[t]:null}function D(e,t){if(!_(e))return null;let n=F.get(t);if(n||(n=k(t),n&&F.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=a[n[o]];if(void 0===e)return null;a=e,o++}return a}const L=e=>e,O=e=>"",I="text",y=e=>0===e.length?"":e.join(""),M=e=>null==e?"":c(e)||E(e)&&e.toString===g?JSON.stringify(e,null,2):String(e);function R(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function S(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),a=_(e.pluralRules)&&m(t)&&u(e.pluralRules[t])?e.pluralRules[t]:R,o=_(e.pluralRules)&&m(t)&&u(e.pluralRules[t])?R:void 0,l=e.list||[],s=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,s);function i(t){const n=u(e.messages)?e.messages(t):!!_(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):O)}const f=E(e.processor)&&u(e.processor.normalize)?e.processor.normalize:y,g=E(e.processor)&&u(e.processor.interpolate)?e.processor.interpolate:M,p={list:e=>l[e],named:e=>s[e],plural:e=>e[a(n,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",l="";1===n.length?_(r)?(l=r.modifier||l,o=r.type||o):m(r)&&(l=r||l):2===n.length&&(m(r)&&(l=r||l),m(a)&&(o=a||o));let s=i(t)(p);return"vnode"===o&&c(s)&&l&&(s=s[0]),l?(u=l,e.modifiers?e.modifiers[u]:L)(s,o):s;var u},message:i,type:E(e.processor)&&m(e.processor.type)?e.processor.type:I,interpolate:g,normalize:f};return p}const W="i18n:init";let v=null;const w=U("function:translate");function U(e){return t=>v&&v.emit(e,t)}const P={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},x={[P.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[P.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[P.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[P.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[P.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[P.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function V(e,t,n){return[...new Set([n,...c(t)?t:_(t)?Object.keys(t):m(t)?[t]:[n]])]}function K(e,t,n){const r=m(n)?n:H,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;c(e);)e=$(o,e,t);const l=c(t)||!E(t)?t:t.default?t.default:null;e=m(l)?[l]:l,c(e)&&$(o,e,!1),a.__localeChainCache.set(r,o)}return o}function $(e,t,n){let r=!0;for(let a=0;a<t.length&&f(r);a++){const o=t[a];m(o)&&(r=G(e,t[a],n))}return r}function G(e,t,n){let r;const a=t.split("-");do{r=j(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function j(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const a=t.replace(/!/g,"");e.push(a),(c(n)||E(n))&&n[a]&&(r=n[a])}return r}const B="9.2.0-beta.37",H="en-US",Y=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let X,z,J;function Z(e){z=e}function Q(e){J=e}let q=null;let ee=null;let te=0;function ne(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return m(r)?r:t}return t}let re=d.__EXTEND_POINT__;const ae=()=>++re,oe={INVALID_ARGUMENT:re,INVALID_DATE_ARGUMENT:ae(),INVALID_ISO_DATE_ARGUMENT:ae(),__EXTEND_POINT__:ae()};const le=()=>"",se=e=>u(e);function ie(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,f=c(e,r,n);let _,g={},p=null;for(let n=0;n<f.length&&(_=f[n],g=l[_]||{},null===(p=i(g,t))&&(p=g[t]),!m(p)&&!u(p));n++){const n=ne(e,t,_,0,"translate");n!==t&&(p=n)}return[p,_,g]}function ce(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(se(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==s){const e=()=>a;return e.locale=r,e.key=t,e}const c=s(a,function(e,t,r,a,o,l){return{warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=t,c.source=a,c}function ue(...e){const[t,n,a]=e,l={};if(!m(t)&&!r(t)&&!se(t))throw Error(oe.INVALID_ARGUMENT);const i=r(t)?String(t):(se(t),t);return r(n)?l.plural=n:m(n)?l.default=n:E(n)&&!o(n)?l.named=n:c(n)&&(l.list=n),r(a)?l.plural=a:m(a)?l.default=a:E(a)&&s(l,a),[i,l]}const me=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function fe(...e){const[t,n,a,o]=e,l={};let s,i={};if(m(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(oe.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();s=new Date(n);try{s.toISOString()}catch(e){throw Error(oe.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===p(t)){if(isNaN(t.getTime()))throw Error(oe.INVALID_DATE_ARGUMENT);s=t}else{if(!r(t))throw Error(oe.INVALID_ARGUMENT);s=t}return m(n)?l.key=n:E(n)&&Object.keys(n).forEach((e=>{me.includes(e)?i[e]=n[e]:l[e]=n[e]})),m(a)?l.locale=a:E(a)&&(i=a),E(o)&&(i=o),[l.key||"",s,l,i]}const _e=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function ge(...e){const[t,n,a,o]=e,l={};let s={};if(!r(t))throw Error(oe.INVALID_ARGUMENT);const i=t;return m(n)?l.key=n:E(n)&&Object.keys(n).forEach((e=>{_e.includes(e)?s[e]=n[e]:l[e]=n[e]})),m(a)?l.locale=a:E(a)&&(s=a),E(o)&&(s=o),[l.key||"",i,l,s]}return Z(D),Q(K),e.CompileErrorCodes=d,e.CoreErrorCodes=oe,e.CoreWarnCodes=P,e.DATETIME_FORMAT_OPTIONS_KEYS=me,e.DEFAULT_LOCALE=H,e.DEFAULT_MESSAGE_DATA_TYPE=I,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=_e,e.VERSION=B,e.clearCompileCache=function(){},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){return()=>e},e.createCompileError=T,e.createCoreContext=function(e={}){const t=m(e.version)?e.version:B,n=m(e.locale)?e.locale:H,r=c(e.fallbackLocale)||E(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=E(e.messages)?e.messages:{[n]:{}},i=E(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},g=E(e.numberFormats)?e.numberFormats:{[n]:{}},p=s({},e.modifiers||{},{upper:(e,t)=>"text"===t&&m(e)?e.toUpperCase():"vnode"===t&&_(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&m(e)?e.toLowerCase():"vnode"===t&&_(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&m(e)?Y(e):"vnode"===t&&_(e)&&"__v_isVNode"in e?Y(e.children):e}),d=e.pluralRules||{},T=u(e.missing)?e.missing:null,A=!f(e.missingWarn)&&!a(e.missingWarn)||e.missingWarn,N=!f(e.fallbackWarn)&&!a(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,C=!!e.unresolving,k=u(e.postTranslation)?e.postTranslation:null,F=E(e.processor)?e.processor:null,D=!f(e.warnHtmlMessage)||e.warnHtmlMessage,L=!!e.escapeParameter,O=u(e.messageCompiler)?e.messageCompiler:X,I=u(e.messageResolver)?e.messageResolver:z||h,y=u(e.localeFallbacker)?e.localeFallbacker:J||V,M=_(e.fallbackContext)?e.fallbackContext:void 0,R=u(e.onWarn)?e.onWarn:l,S=e,W=_(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,v=_(S.__numberFormatters)?S.__numberFormatters:new Map,w=_(S.__meta)?S.__meta:{};te++;const U={version:t,cid:te,locale:n,fallbackLocale:r,messages:o,modifiers:p,pluralRules:d,missing:T,missingWarn:A,fallbackWarn:N,fallbackFormat:b,unresolving:C,postTranslation:k,processor:F,warnHtmlMessage:D,escapeParameter:L,messageCompiler:O,messageResolver:I,localeFallbacker:y,fallbackContext:M,onWarn:R,__meta:w};return U.datetimeFormats=i,U.numberFormats=g,U.__datetimeFormatters=W,U.__numberFormatters=v,U},e.createCoreError=function(e){return T(e,null,void 0)},e.createMessageContext=S,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a,onWarn:l,localeFallbacker:i}=e,{__datetimeFormatters:c}=e,[u,_,g,p]=fe(...t);f(g.missingWarn)?g.missingWarn:e.missingWarn,f(g.fallbackWarn)?g.fallbackWarn:e.fallbackWarn;const d=!!g.part,T=m(g.locale)?g.locale:e.locale,A=i(e,a,T);if(!m(u)||""===u)return new Intl.DateTimeFormat(T,p).format(_);let N,b={},C=null;for(let t=0;t<A.length&&(N=A[t],b=n[N]||{},C=b[u],!E(C));t++)ne(e,u,N,0,"datetime format");if(!E(C)||!m(N))return r?-1:u;let k=`${N}__${u}`;o(p)||(k=`${k}__${JSON.stringify(p)}`);let F=c.get(k);return F||(F=new Intl.DateTimeFormat(N,s({},C,p)),c.set(k,F)),d?F.formatToParts(_):F.format(_)},e.fallbackWithLocaleChain=K,e.fallbackWithSimple=V,e.getAdditionalMeta=()=>q,e.getDevToolsHook=function(){return v},e.getFallbackContext=()=>ee,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&_(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(x[e],...n)},e.handleMissing=ne,e.initI18nDevTools=function(e,t,n){v&&v.emit(W,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=se,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:a,onWarn:l,localeFallbacker:i}=e,{__numberFormatters:c}=e,[u,_,g,p]=ge(...t);f(g.missingWarn)?g.missingWarn:e.missingWarn,f(g.fallbackWarn)?g.fallbackWarn:e.fallbackWarn;const d=!!g.part,T=m(g.locale)?g.locale:e.locale,A=i(e,a,T);if(!m(u)||""===u)return new Intl.NumberFormat(T,p).format(_);let N,b={},C=null;for(let t=0;t<A.length&&(N=A[t],b=n[N]||{},C=b[u],!E(C));t++)ne(e,u,N,0,"number format");if(!E(C)||!m(N))return r?-1:u;let k=`${N}__${u}`;o(p)||(k=`${k}__${JSON.stringify(p)}`);let F=c.get(k);return F||(F=new Intl.NumberFormat(N,s({},C,p)),c.set(k,F)),d?F.formatToParts(_):F.format(_)},e.parse=k,e.parseDateTimeArgs=fe,e.parseNumberArgs=ge,e.parseTranslateArgs=ue,e.registerLocaleFallbacker=Q,e.registerMessageCompiler=function(e){X=e},e.registerMessageResolver=Z,e.resolveValue=D,e.resolveWithKeyValue=h,e.setAdditionalMeta=e=>{q=e},e.setDevToolsHook=function(e){v=e},e.setFallbackContext=e=>{ee=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:a,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:u}=e,[g,p]=ue(...t),E=f(p.missingWarn)?p.missingWarn:e.missingWarn,d=f(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn,T=f(p.escapeParameter)?p.escapeParameter:e.escapeParameter,A=!!p.resolvedMessage,N=m(p.default)||f(p.default)?f(p.default)?l?g:()=>g:p.default:n?l?g:()=>g:"",b=n||""!==N,C=m(p.locale)?p.locale:e.locale;T&&function(e){c(e.list)?e.list=e.list.map((e=>m(e)?i(e):e)):_(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=i(e.named[t]))}))}(p);let[k,F,h]=A?[g,C,u[C]||{}]:ie(e,g,C,s,d,E),D=k,L=g;if(A||m(D)||se(D)||b&&(D=N,L=D),!(A||(m(D)||se(D))&&m(F)))return o?-1:g;let O=!1;const I=se(D)?D:ce(e,g,F,D,L,(()=>{O=!0}));if(O)return D;const y=function(e,t,n,a){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:f}=e,_=r=>{let a=s(n,r);if(null==a&&f){const[,,e]=ie(f,r,t,i,c,u);a=s(e,r)}if(m(a)){let n=!1;const o=ce(e,r,t,a,r,(()=>{n=!0}));return n?le:o}return se(a)?a:le},g={locale:t,modifiers:o,pluralRules:l,messages:_};e.processor&&(g.processor=e.processor);a.list&&(g.list=a.list);a.named&&(g.named=a.named);r(a.plural)&&(g.pluralIndex=a.plural);return g}(e,F,h,p),M=function(e,t,n){return t(n)}(0,I,S(y));return a?a(M,g):M},e.translateDevTools=w,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|