@intlify/core 10.0.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +8 -1
- package/dist/core.esm-browser.js +5 -16
- package/dist/core.esm-browser.prod.js +2 -2
- package/dist/core.global.js +5 -16
- package/dist/core.global.prod.js +2 -2
- package/dist/core.mjs +1 -1
- package/dist/core.node.mjs +1 -1
- package/dist/core.prod.cjs +8 -1
- package/dist/core.runtime.esm-browser.js +5 -10
- package/dist/core.runtime.esm-browser.prod.js +2 -2
- package/dist/core.runtime.global.js +5 -10
- package/dist/core.runtime.global.prod.js +2 -2
- package/dist/core.runtime.mjs +1 -1
- package/dist/core.runtime.node.mjs +1 -1
- package/package.json +3 -3
package/dist/core.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -14,6 +14,13 @@ coreBase.registerMessageResolver(coreBase.resolveValue);
|
|
|
14
14
|
// register fallback locale at @intlify/core
|
|
15
15
|
coreBase.registerLocaleFallbacker(coreBase.fallbackWithLocaleChain);
|
|
16
16
|
|
|
17
|
+
Object.prototype.hasOwnProperty.call(coreBase, '__proto__') &&
|
|
18
|
+
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
19
|
+
Object.defineProperty(exports, '__proto__', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
value: coreBase['__proto__']
|
|
22
|
+
});
|
|
23
|
+
|
|
17
24
|
Object.keys(coreBase).forEach(function (k) {
|
|
18
25
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = coreBase[k];
|
|
19
26
|
});
|
package/dist/core.esm-browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -78,12 +78,7 @@ const isPromise = (val) => {
|
|
|
78
78
|
};
|
|
79
79
|
const objectToString = Object.prototype.toString;
|
|
80
80
|
const toTypeString = (value) => objectToString.call(value);
|
|
81
|
-
const isPlainObject = (val) =>
|
|
82
|
-
if (!isObject(val))
|
|
83
|
-
return false;
|
|
84
|
-
const proto = Object.getPrototypeOf(val);
|
|
85
|
-
return proto === null || proto.constructor === Object;
|
|
86
|
-
};
|
|
81
|
+
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
87
82
|
// for converting list and named values to displayed strings.
|
|
88
83
|
const toDisplayString = (val) => {
|
|
89
84
|
return val == null
|
|
@@ -151,9 +146,6 @@ function createPosition(line, column, offset) {
|
|
|
151
146
|
}
|
|
152
147
|
function createLocation(start, end, source) {
|
|
153
148
|
const loc = { start, end };
|
|
154
|
-
if (source != null) {
|
|
155
|
-
loc.source = source;
|
|
156
|
-
}
|
|
157
149
|
return loc;
|
|
158
150
|
}
|
|
159
151
|
|
|
@@ -1004,9 +996,6 @@ function createParser(options = {}) {
|
|
|
1004
996
|
return node;
|
|
1005
997
|
}
|
|
1006
998
|
function endNode(node, offset, pos, type) {
|
|
1007
|
-
if (type) {
|
|
1008
|
-
node.type = type;
|
|
1009
|
-
}
|
|
1010
999
|
if (location) {
|
|
1011
1000
|
node.end = offset;
|
|
1012
1001
|
if (node.loc) {
|
|
@@ -1992,7 +1981,7 @@ function appendItemToChain(chain, target, blocks) {
|
|
|
1992
1981
|
return follow;
|
|
1993
1982
|
}
|
|
1994
1983
|
|
|
1995
|
-
const pathStateMachine =
|
|
1984
|
+
const pathStateMachine = [];
|
|
1996
1985
|
pathStateMachine[0 /* States.BEFORE_PATH */] = {
|
|
1997
1986
|
["w" /* PathCharTypes.WORKSPACE */]: [0 /* States.BEFORE_PATH */],
|
|
1998
1987
|
["i" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],
|
|
@@ -2289,7 +2278,7 @@ function getWarnMessage(code, ...args) {
|
|
|
2289
2278
|
* Intlify core-base version
|
|
2290
2279
|
* @internal
|
|
2291
2280
|
*/
|
|
2292
|
-
const VERSION = '10.0.
|
|
2281
|
+
const VERSION = '10.0.2';
|
|
2293
2282
|
const NOT_REOSLVED = -1;
|
|
2294
2283
|
const DEFAULT_LOCALE = 'en-US';
|
|
2295
2284
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -2349,7 +2338,7 @@ function registerLocaleFallbacker(fallbacker) {
|
|
|
2349
2338
|
_fallbacker = fallbacker;
|
|
2350
2339
|
}
|
|
2351
2340
|
// Additional Meta for Intlify DevTools
|
|
2352
|
-
let _additionalMeta =
|
|
2341
|
+
let _additionalMeta = null;
|
|
2353
2342
|
/* #__NO_SIDE_EFFECTS__ */
|
|
2354
2343
|
const setAdditionalMeta = (meta) => {
|
|
2355
2344
|
_additionalMeta = meta;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format$1(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,r)=>t.hasOwnProperty(r)?t[r]:""))}const generateFormatCacheKey=(e,t,r)=>friendlyJSONstringify({l:e,k:t,s:r}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length,assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,isPromise=e=>isObject(e)&&isFunction(e.then)&&isFunction(e.catch),objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>{if(!isObject(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object},toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e);function join(e,t=""){return e.reduce(((e,r,n)=>0===n?e+r:e+t+r),"")}function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function createPosition(e,t,r){return{line:e,column:t,offset:r}}function createLocation(e,t,r){const n={start:e,end:t};return null!=r&&(n.source=r),n}const CompileErrorCodes={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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},COMPILE_ERROR_CODES_EXTEND_POINT=17;function createCompileError(e,t,r={}){const{domain:n,messages:o,args:s}=r,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=n,a}function defaultOnError(e){throw e}CompileErrorCodes.EXPECTED_TOKEN,CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,CompileErrorCodes.UNBALANCED_CLOSING_BRACE,CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,CompileErrorCodes.EMPTY_PLACEHOLDER,CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,CompileErrorCodes.INVALID_LINKED_FORMAT,CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE,CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE;const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF="\n",CHAR_LS=String.fromCharCode(8232),CHAR_PS=String.fromCharCode(8233);function createScanner(e){const t=e;let r=0,n=1,o=1,s=0;const a=e=>t[e]===CHAR_CR&&t[e+1]===CHAR_LF,i=e=>t[e]===CHAR_PS,c=e=>t[e]===CHAR_LS,l=e=>a(e)||(e=>t[e]===CHAR_LF)(e)||i(e)||c(e),u=e=>a(e)||i(e)||c(e)?CHAR_LF:t[e];function E(){return s=0,l(r)&&(n++,o=0),a(r)&&r++,r++,o++,t[r]}return{index:()=>r,line:()=>n,column:()=>o,peekOffset:()=>s,charAt:u,currentChar:()=>u(r),currentPeek:()=>u(r+s),next:E,peek:function(){return a(r+s)&&s++,s++,t[r+s]},reset:function(){r=0,n=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=r+s;for(;e!==r;)E();s=0}}}const EOF=void 0,DOT=".",LITERAL_DELIMITER="'",ERROR_DOMAIN$1="tokenizer";function createTokenizer(e,t={}){const r=!1!==t.location,n=createScanner(e),o=()=>n.index(),s=()=>createPosition(n.line(),n.column(),n.index()),a=s(),i=o(),c={currentType:13,offset:i,startLoc:a,endLoc:a,lastType:13,lastOffset:i,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},l=()=>c,{onError:u}=t;function E(e,t,n){e.endLoc=s(),e.currentType=t;const o={type:t};return r&&(o.loc=createLocation(e.startLoc,e.endLoc)),null!=n&&(o.value=n),o}const f=e=>E(e,13);function m(e,t){return e.currentChar()===t?(e.next(),t):(CompileErrorCodes.EXPECTED_TOKEN,s(),"")}function C(e){let t="";for(;e.currentPeek()===CHAR_SP||e.currentPeek()===CHAR_LF;)t+=e.currentPeek(),e.peek();return t}function _(e){const t=C(e);return e.skipToPeek(),t}function p(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function d(e,t){const{currentType:r}=t;if(2!==r)return!1;C(e);const n=function(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),n}function g(e){C(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function N(e,t=!0){const r=(t=!1,n="")=>{const o=e.currentPeek();return"{"===o?t:"@"!==o&&o?"|"===o?!(n===CHAR_SP||n===CHAR_LF):o===CHAR_SP?(e.peek(),r(!0,CHAR_SP)):o!==CHAR_LF||(e.peek(),r(!0,CHAR_LF)):t},n=r();return t&&e.resetPeek(),n}function A(e,t){const r=e.currentChar();return r===EOF?EOF:t(r)?(e.next(),r):null}function T(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}function L(e){return A(e,T)}function O(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t||45===t}function S(e){return A(e,O)}function b(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function h(e){return A(e,b)}function k(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function I(e){return A(e,k)}function P(e){let t="",r="";for(;t=h(e);)r+=t;return r}function M(e){return e!==LITERAL_DELIMITER&&e!==CHAR_LF}function R(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return y(e,t,4);case"U":return y(e,t,6);default:return CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,s(),""}}function y(e,t,r){m(e,t);let n="";for(let o=0;o<r;o++){const t=I(e);if(!t){CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),e.currentChar();break}n+=t}return`\\${t}${n}`}function D(e){return"{"!==e&&"}"!==e&&e!==CHAR_SP&&e!==CHAR_LF}function F(e){_(e);const t=m(e,"|");return _(e),t}function v(e,t){let r=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,s()),e.next(),r=E(t,2,"{"),_(e),t.braceNest++,r;case"}":return t.braceNest>0&&2===t.currentType&&(CompileErrorCodes.EMPTY_PLACEHOLDER,s()),e.next(),r=E(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),r;case"@":return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=U(e,t)||f(t),t.braceNest=0,r;default:{let n=!0,o=!0,a=!0;if(g(e))return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=E(t,1,F(e)),t.braceNest=0,t.inLinked=!1,r;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),t.braceNest=0,x(e,t);if(n=function(e,t){const{currentType:r}=t;if(2!==r)return!1;C(e);const n=p(e.currentPeek());return e.resetPeek(),n}(e,t))return r=E(t,4,function(e){_(e);let t="",r="";for(;t=S(e);)r+=t;return e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r}(e)),_(e),r;if(o=d(e,t))return r=E(t,5,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${P(e)}`):t+=P(e),e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),t}(e)),_(e),r;if(a=function(e,t){const{currentType:r}=t;if(2!==r)return!1;C(e);const n=e.currentPeek()===LITERAL_DELIMITER;return e.resetPeek(),n}(e,t))return r=E(t,6,function(e){_(e),m(e,"'");let t="",r="";for(;t=A(e,M);)r+="\\"===t?R(e):t;const n=e.currentChar();return n===CHAR_LF||n===EOF?(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),n===CHAR_LF&&(e.next(),m(e,"'")),r):(m(e,"'"),r)}(e)),_(e),r;if(!n&&!o&&!a)return r=E(t,12,function(e){_(e);let t="",r="";for(;t=A(e,D);)r+=t;return r}(e)),CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,s(),r.value,_(e),r;break}}return r}function U(e,t){const{currentType:r}=t;let n=null;const o=e.currentChar();switch(7!==r&&8!==r&&11!==r&&9!==r||o!==CHAR_LF&&o!==CHAR_SP||(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),o){case"@":return e.next(),n=E(t,7,"@"),t.inLinked=!0,n;case".":return _(e),e.next(),E(t,8,".");case":":return _(e),e.next(),E(t,9,":");default:return g(e)?(n=E(t,1,F(e)),t.braceNest=0,t.inLinked=!1,n):function(e,t){const{currentType:r}=t;if(7!==r)return!1;C(e);const n="."===e.currentPeek();return e.resetPeek(),n}(e,t)||function(e,t){const{currentType:r}=t;if(7!==r&&11!==r)return!1;C(e);const n=":"===e.currentPeek();return e.resetPeek(),n}(e,t)?(_(e),U(e,t)):function(e,t){const{currentType:r}=t;if(8!==r)return!1;C(e);const n=p(e.currentPeek());return e.resetPeek(),n}(e,t)?(_(e),E(t,11,function(e){let t="",r="";for(;t=L(e);)r+=t;return r}(e))):function(e,t){const{currentType:r}=t;if(9!==r)return!1;const n=()=>{const t=e.currentPeek();return"{"===t?p(e.peek()):!("@"===t||"|"===t||":"===t||"."===t||t===CHAR_SP||!t)&&(t===CHAR_LF?(e.peek(),n()):N(e,!1))},o=n();return e.resetPeek(),o}(e,t)?(_(e),"{"===o?v(e,t)||n:E(t,10,function(e){const t=r=>{const n=e.currentChar();return"{"!==n&&"@"!==n&&"|"!==n&&"("!==n&&")"!==n&&n?n===CHAR_SP?r:(r+=n,e.next(),t(r)):r};return t("")}(e))):(7===r&&(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),t.braceNest=0,t.inLinked=!1,x(e,t))}}function x(e,t){let r={type:13};if(t.braceNest>0)return v(e,t)||f(t);if(t.inLinked)return U(e,t)||f(t);switch(e.currentChar()){case"{":return v(e,t)||f(t);case"}":return CompileErrorCodes.UNBALANCED_CLOSING_BRACE,s(),e.next(),E(t,3,"}");case"@":return U(e,t)||f(t);default:if(g(e))return r=E(t,1,F(e)),t.braceNest=0,t.inLinked=!1,r;if(N(e))return E(t,0,function(e){let t="";for(;;){const r=e.currentChar();if("{"===r||"}"===r||"@"===r||"|"===r||!r)break;if(r===CHAR_SP||r===CHAR_LF)if(N(e))t+=r,e.next();else{if(g(e))break;t+=r,e.next()}else t+=r,e.next()}return t}(e))}return r}return{nextToken:function(){const{currentType:e,offset:t,startLoc:r,endLoc:a}=c;return c.lastType=e,c.lastOffset=t,c.lastStartLoc=r,c.lastEndLoc=a,c.offset=o(),c.startLoc=s(),n.currentChar()===EOF?E(c,13):x(n,c)},currentOffset:o,currentPosition:s,context:l}}const ERROR_DOMAIN="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(e,t,r){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||r,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function createParser(e={}){const t=!1!==e.location,{onError:r}=e;function n(e,r,n){const o={type:e};return t&&(o.start=r,o.end=r,o.loc={start:n,end:n}),o}function o(e,r,n,o){o&&(e.type=o),t&&(e.end=r,e.loc&&(e.loc.end=n))}function s(e,t){const r=e.context(),s=n(3,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function a(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(5,s,a);return i.index=parseInt(t,10),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function i(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(4,s,a);return i.key=t,e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function c(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(9,s,a);return i.value=t.replace(KNOWN_ESCAPES,fromEscapeSequence),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function l(e){const t=e.context(),r=n(6,t.offset,t.startLoc);let s=e.nextToken();if(8===s.type){const t=function(e){const t=e.nextToken(),r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(8,s,a);return 11!==t.type?(CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,r.lastStartLoc,i.value="",o(i,s,a),{nextConsumeToken:t,node:i}):(null==t.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,r.lastStartLoc,getTokenCaption(t)),i.value=t.value||"",o(i,e.currentOffset(),e.currentPosition()),{node:i})}(e);r.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(9!==s.type&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 10:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=function(e,t){const r=e.context(),s=n(7,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 4:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=i(e,s.value||"");break;case 5:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=a(e,s.value||"");break;case 6:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=c(e,s.value||"");break;default:{CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const a=e.context(),i=n(7,a.offset,a.startLoc);return i.value="",o(i,a.offset,a.startLoc),r.key=i,o(r,a.offset,a.startLoc),{nextConsumeToken:s,node:r}}}return o(r,e.currentOffset(),e.currentPosition()),{node:r}}function u(e){const t=e.context(),r=n(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);r.items=[];let u=null;do{const n=u||e.nextToken();switch(u=null,n.type){case 0:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(s(e,n.value||""));break;case 5:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(a(e,n.value||""));break;case 4:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(i(e,n.value||""));break;case 6:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(c(e,n.value||""));break;case 7:{const t=l(e);r.items.push(t.node),u=t.nextConsumeToken||null;break}}}while(13!==t.currentType&&1!==t.currentType);return o(r,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),r}function E(e){const t=e.context(),{offset:r,startLoc:s}=t,a=u(e);return 13===t.currentType?a:function(e,t,r,s){const a=e.context();let i=0===s.items.length;const c=n(1,t,r);c.cases=[],c.cases.push(s);do{const t=u(e);i||(i=0===t.items.length),c.cases.push(t)}while(13!==a.currentType);return i&&CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,o(c,e.currentOffset(),e.currentPosition()),c}(e,r,s,a)}return{parse:function(r){const s=createTokenizer(r,assign({},e)),a=s.context(),i=n(0,a.offset,a.startLoc);return t&&i.loc&&(i.loc.source=r),i.body=E(s),e.onCacheKey&&(i.cacheKey=e.onCacheKey(r)),13!==a.currentType&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,r[a.offset]),o(i,s.currentOffset(),s.currentPosition()),i}}}function getTokenCaption(e){if(13===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function createTransformer(e,t={}){const r={ast:e,helpers:new Set};return{context:()=>r,helper:e=>(r.helpers.add(e),e)}}function traverseNodes(e,t){for(let r=0;r<e.length;r++)traverseNode(e[r],t)}function traverseNode(e,t){switch(e.type){case 1:traverseNodes(e.cases,t),t.helper("plural");break;case 2:traverseNodes(e.items,t);break;case 6:traverseNode(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function transform(e,t={}){const r=createTransformer(e);r.helper("normalize"),e.body&&traverseNode(e.body,r);const n=r.context();e.helpers=Array.from(n.helpers)}function optimize(e){const t=e.body;return 2===t.type?optimizeMessageNode(t):t.cases.forEach((e=>optimizeMessageNode(e))),e}function optimizeMessageNode(e){if(1===e.items.length){const t=e.items[0];3!==t.type&&9!==t.type||(e.static=t.value,delete t.value)}else{const t=[];for(let r=0;r<e.items.length;r++){const n=e.items[r];if(3!==n.type&&9!==n.type)break;if(null==n.value)break;t.push(n.value)}if(t.length===e.items.length){e.static=join(t);for(let t=0;t<e.items.length;t++){const r=e.items[t];3!==r.type&&9!==r.type||delete r.value}}}}function minify(e){switch(e.t=e.type,e.type){case 0:{const t=e;minify(t.body),t.b=t.body,delete t.body;break}case 1:{const t=e,r=t.cases;for(let e=0;e<r.length;e++)minify(r[e]);t.c=r,delete t.cases;break}case 2:{const t=e,r=t.items;for(let e=0;e<r.length;e++)minify(r[e]);t.i=r,delete t.items,t.static&&(t.s=t.static,delete t.static);break}case 3:case 9:case 8:case 7:{const t=e;t.value&&(t.v=t.value,delete t.value);break}case 6:{const t=e;minify(t.key),t.k=t.key,delete t.key,t.modifier&&(minify(t.modifier),t.m=t.modifier,delete t.modifier);break}case 5:{const t=e;t.i=t.index,delete t.index;break}case 4:{const t=e;t.k=t.key,delete t.key;break}}delete e.type}function createCodeGenerator(e,t){const{sourceMap:r,filename:n,breakLineCode:o,needIndent:s}=t,a=!1!==t.location,i={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:s,indentLevel:0};a&&e.loc&&(i.source=e.loc.source);function c(e,t){i.code+=e}function l(e,t=!0){const r=t?o:"";c(s?r+" ".repeat(e):r)}return{context:()=>i,push:c,indent:function(e=!0){const t=++i.indentLevel;e&&l(t)},deindent:function(e=!0){const t=--i.indentLevel;e&&l(t)},newline:function(){l(i.indentLevel)},helper:e=>`_${e}`,needIndent:()=>i.needIndent}}function generateLinkedNode(e,t){const{helper:r}=e;e.push(`${r("linked")}(`),generateNode(e,t.key),t.modifier?(e.push(", "),generateNode(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}function generateMessageNode(e,t){const{helper:r,needIndent:n}=e;e.push(`${r("normalize")}([`),e.indent(n());const o=t.items.length;for(let s=0;s<o&&(generateNode(e,t.items[s]),s!==o-1);s++)e.push(", ");e.deindent(n()),e.push("])")}function generatePluralNode(e,t){const{helper:r,needIndent:n}=e;if(t.cases.length>1){e.push(`${r("plural")}([`),e.indent(n());const o=t.cases.length;for(let r=0;r<o&&(generateNode(e,t.cases[r]),r!==o-1);r++)e.push(", ");e.deindent(n()),e.push("])")}}function generateResource(e,t){t.body?generateNode(e,t.body):e.push("null")}function generateNode(e,t){const{helper:r}=e;switch(t.type){case 0:generateResource(e,t);break;case 1:generatePluralNode(e,t);break;case 2:generateMessageNode(e,t);break;case 6:generateLinkedNode(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${r("interpolate")}(${r("list")}(${t.index}))`,t);break;case 4:e.push(`${r("interpolate")}(${r("named")}(${JSON.stringify(t.key)}))`,t)}}const generate=(e,t={})=>{const r=isString(t.mode)?t.mode:"normal",n=isString(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,s=null!=t.breakLineCode?t.breakLineCode:"arrow"===r?";":"\n",a=t.needIndent?t.needIndent:"arrow"!==r,i=e.helpers||[],c=createCodeGenerator(e,{mode:r,filename:n,sourceMap:o,breakLineCode:s,needIndent:a});c.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(a),i.length>0&&(c.push(`const { ${join(i.map((e=>`${e}: _${e}`)),", ")} } = ctx`),c.newline()),c.push("return "),generateNode(c,e),c.deindent(a),c.push("}"),delete e.helpers;const{code:l,map:u}=c.context();return{ast:e,code:l,map:u?u.toJSON():void 0}};function baseCompile$1(e,t={}){const r=assign({},t),n=!!r.jit,o=!!r.minify,s=null==r.optimize||r.optimize,a=createParser(r).parse(e);return n?(s&&optimize(a),o&&minify(a),{ast:a,code:""}):(transform(a,r),generate(a,r))}function format(e){return t=>formatParts(t,e)}function formatParts(e,t){const r=t.b||t.body;if(1===(r.t||r.type)){const t=r,n=t.c||t.cases;return e.plural(n.reduce(((t,r)=>[...t,formatMessageParts(e,r)]),[]))}return formatMessageParts(e,r)}function formatMessageParts(e,t){const r=t.s||t.static;if(r)return"text"===e.type?r:e.normalize([r]);{const r=(t.i||t.items).reduce(((t,r)=>[...t,formatMessagePart(e,r)]),[]);return e.normalize(r)}}function formatMessagePart(e,t){const r=t.t||t.type;switch(r){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const r=t;return e.interpolate(e.named(r.k||r.key))}case 5:{const r=t;return e.interpolate(e.list(null!=r.i?r.i:r.index))}case 6:{const r=t,n=r.m||r.modifier;return e.linked(formatMessagePart(e,r.k||r.key),n?formatMessagePart(e,n):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${r}`)}}const defaultOnCacheKey=e=>e;let compileCache=Object.create(null);function clearCompileCache(){compileCache=Object.create(null)}const isMessageAST=e=>isObject(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function baseCompile(e,t={}){let r=!1;const n=t.onError||defaultOnError;return t.onError=e=>{r=!0,n(e)},{...baseCompile$1(e,t),detectError:r}}function compile(e,t){if(isString(e)){!isBoolean(t.warnHtmlMessage)||t.warnHtmlMessage;const r=(t.onCacheKey||defaultOnCacheKey)(e),n=compileCache[r];if(n)return n;const{ast:o,detectError:s}=baseCompile(e,{...t,location:!1,jit:!0}),a=format(o);return s?a:compileCache[r]=a}{const t=e.cacheKey;if(t){const r=compileCache[t];return r||(compileCache[t]=format(e))}return format(e)}}let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,r){devtools&&devtools.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:r})}const translateDevTools=createDevToolsHook("function:translate");function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreErrorCodes={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},CORE_ERROR_CODES_EXTEND_POINT=24;function createCoreError(e){return createCompileError(e,null,void 0)}function getLocale(e,t){return null!=t.locale?resolveLocale(t.locale):resolveLocale(e.locale)}let _resolveLocale;function resolveLocale(e){if(isString(e))return e;if(isFunction(e)){if(e.resolvedOnce&&null!=_resolveLocale)return _resolveLocale;if("Function"===e.constructor.name){const t=e();if(isPromise(t))throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return _resolveLocale=t}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE)}function fallbackWithSimple(e,t,r){return[...new Set([r,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[r]])]}function fallbackWithLocaleChain(e,t,r){const n=isString(r)?r:DEFAULT_LOCALE,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(n);if(!s){s=[];let e=[r];for(;isArray(e);)e=appendBlockToChain(s,e,t);const a=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(a)?[a]:a,isArray(e)&&appendBlockToChain(s,e,!1),o.__localeChainCache.set(n,s)}return s}function appendBlockToChain(e,t,r){let n=!0;for(let o=0;o<t.length&&isBoolean(n);o++){const s=t[o];isString(s)&&(n=appendLocaleToChain(e,t[o],r))}return n}function appendLocaleToChain(e,t,r){let n;const o=t.split("-");do{n=appendItemToChain(e,o.join("-"),r),o.splice(-1,1)}while(o.length&&!0===n);return n}function appendItemToChain(e,t,r){let n=!1;if(!e.includes(t)&&(n=!0,t)){n="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(isArray(r)||isPlainObject(r))&&r[o]&&(n=r[o])}return n}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT,CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE,CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE,CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE;const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let r,n,o,s,a,i,c,l=-1,u=0,E=0;const f=[];function m(){const t=e[l+1];if(5===u&&"'"===t||6===u&&'"'===t)return l++,o="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===n?n=o:n+=o},f[1]=()=>{void 0!==n&&(t.push(n),n=void 0)},f[2]=()=>{f[0](),E++},f[3]=()=>{if(E>0)E--,u=4,f[0]();else{if(E=0,void 0===n)return!1;if(n=formatSubPath(n),!1===n)return!1;f[1]()}};null!==u;)if(l++,r=e[l],"\\"!==r||!m()){if(s=getPathCharType(r),c=pathStateMachine[u],a=c[s]||c.l||8,8===a)return;if(u=a[0],void 0!==a[1]&&(i=f[a[1]],i&&(o=r,!1===i())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let r=cache.get(t);if(r||(r=parse(t),r&&cache.set(t,r)),!r)return null;const n=r.length;let o=e,s=0;for(;s<n;){const e=o[r[s]];if(void 0===e)return null;if(isFunction(o))return null;o=e,s++}return o}const CoreWarnCodes={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},CORE_WARN_CODES_EXTEND_POINT=8,warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[CoreWarnCodes.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."};function getWarnMessage(e,...t){return format$1(warnMessages[e],...t)}const VERSION="10.0.0",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isFunction(e.onWarn)?e.onWarn:warn,r=isString(e.version)?e.version:VERSION,n=isString(e.locale)||isFunction(e.locale)?e.locale:DEFAULT_LOCALE,o=isFunction(n)?DEFAULT_LOCALE:n,s=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:o,a=isPlainObject(e.messages)?e.messages:{[o]:{}},i=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[o]:{}},c=isPlainObject(e.numberFormats)?e.numberFormats:{[o]:{}},l=assign({},e.modifiers||{},getDefaultLinkedModifiers()),u=e.pluralRules||{},E=isFunction(e.missing)?e.missing:null,f=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,m=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,C=!!e.fallbackFormat,_=!!e.unresolving,p=isFunction(e.postTranslation)?e.postTranslation:null,d=isPlainObject(e.processor)?e.processor:null,g=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,N=!!e.escapeParameter,A=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,T=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,L=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,O=isObject(e.fallbackContext)?e.fallbackContext:void 0,S=e,b=isObject(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,h=isObject(S.__numberFormatters)?S.__numberFormatters:new Map,k=isObject(S.__meta)?S.__meta:{};_cid++;const I={version:r,cid:_cid,locale:n,fallbackLocale:s,messages:a,modifiers:l,pluralRules:u,missing:E,missingWarn:f,fallbackWarn:m,fallbackFormat:C,unresolving:_,postTranslation:p,processor:d,warnHtmlMessage:g,escapeParameter:N,messageCompiler:A,messageResolver:T,localeFallbacker:L,fallbackContext:O,onWarn:t,__meta:k};return I.datetimeFormats=i,I.numberFormats=c,I.__datetimeFormatters=b,I.__numberFormatters=h,I}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,r,n,o){const{missing:s,onWarn:a}=e;if(null!==s){const n=s(e,r,t,o);return isString(n)?n:t}return t}function updateFallbackLocale(e,t,r){e.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}function isAlmostSameLocale(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function isImplicitFallback(e,t){const r=t.indexOf(e);if(-1===r)return!1;for(let n=r+1;n<t.length;n++)if(isAlmostSameLocale(e,t[n]))return!0;return!1}function datetime(e,...t){const{datetimeFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__datetimeFormatters:i}=e,[c,l,u,E]=parseDateTimeArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const m=!!u.part,C=getLocale(e,u),_=a(e,o,C);if(!isString(c)||""===c)return new Intl.DateTimeFormat(C,E).format(l);let p,d={},g=null;for(let T=0;T<_.length&&(p=_[T],d=r[p]||{},g=d[c],!isPlainObject(g));T++)handleMissing(e,c,p,f,"datetime format");if(!isPlainObject(g)||!isString(p))return n?-1:c;let N=`${p}__${c}`;isEmptyObject(E)||(N=`${N}__${JSON.stringify(E)}`);let A=i.get(N);return A||(A=new Intl.DateTimeFormat(p,assign({},g,E)),i.set(N,A)),m?A.formatToParts(l):A.format(l)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,r,n,o]=e,s={};let a,i={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const r=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();a=new Date(r);try{a.toISOString()}catch{throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);a=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);a=t}return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(i=n),isPlainObject(o)&&(i=o),[s.key||"",a,s,i]}function clearDateTimeFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__datetimeFormatters.has(e)&&n.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__numberFormatters:i}=e,[c,l,u,E]=parseNumberArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const m=!!u.part,C=getLocale(e,u),_=a(e,o,C);if(!isString(c)||""===c)return new Intl.NumberFormat(C,E).format(l);let p,d={},g=null;for(let T=0;T<_.length&&(p=_[T],d=r[p]||{},g=d[c],!isPlainObject(g));T++)handleMissing(e,c,p,f,"number format");if(!isPlainObject(g)||!isString(p))return n?-1:c;let N=`${p}__${c}`;isEmptyObject(E)||(N=`${N}__${JSON.stringify(E)}`);let A=i.get(N);return A||(A=new Intl.NumberFormat(p,assign({},g,E)),i.set(N,A)),m?A.formatToParts(l):A.format(l)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,r,n,o]=e,s={};let a={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const i=t;return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?a[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(a=n),isPlainObject(o)&&(a=o),[s.key||"",i,s,a]}function clearNumberFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__numberFormatters.has(e)&&n.__numberFormatters.delete(e)}}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":join(e),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,r=getPluralIndex(e),n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,o=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],a=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(r,a);function i(t,r){const n=isFunction(e.messages)?e.messages(t,!!r):!!isObject(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const c=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,l=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>a[e],plural:e=>e[n(r,e.length,o)],linked:(t,...r)=>{const[n,o]=r;let s="text",a="";1===r.length?isObject(n)?(a=n.modifier||a,s=n.type||s):isString(n)&&(a=n||a):2===r.length&&(isString(n)&&(a=n||a),isString(o)&&(s=o||s));const c=i(t,!0)(u),l="vnode"===s&&isArray(c)&&a?c[0]:c;return a?(E=a,e.modifiers?e.modifiers[E]:DEFAULT_MODIFIER)(l,s):l;var E},message:i,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:l,normalize:c,values:assign({},s,a)};return u}const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:r,postTranslation:n,unresolving:o,messageCompiler:s,fallbackLocale:a,messages:i}=e,[c,l]=parseTranslateArgs(...t),u=isBoolean(l.missingWarn)?l.missingWarn:e.missingWarn,E=isBoolean(l.fallbackWarn)?l.fallbackWarn:e.fallbackWarn,f=isBoolean(l.escapeParameter)?l.escapeParameter:e.escapeParameter,m=!!l.resolvedMessage,C=isString(l.default)||isBoolean(l.default)?isBoolean(l.default)?s?c:()=>c:l.default:r?s?c:()=>c:null,_=r||null!=C&&(isString(C)||isFunction(C)),p=getLocale(e,l);f&&escapeParams(l);let[d,g,N]=m?[c,p,i[p]||{}]:resolveMessageFormat(e,c,p,a,E,u),A=d,T=c;if(m||isString(A)||isMessageAST(A)||isMessageFunction(A)||_&&(A=C,T=A),!(m||(isString(A)||isMessageAST(A)||isMessageFunction(A))&&isString(g)))return o?-1:c;let L=!1;const O=isMessageFunction(A)?A:compileMessageFormat(e,c,g,A,T,(()=>{L=!0}));if(L)return A;const S=evaluateMessage(e,O,createMessageContext(getMessageContextOptions(e,g,N,l)));return n?n(S,c):S}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,r,n,o,s){const{messages:a,onWarn:i,messageResolver:c,localeFallbacker:l}=e,u=l(e,n,r);let E,f={},m=null;for(let C=0;C<u.length&&(E=u[C],f=a[E]||{},null===(m=c(f,t))&&(m=f[t]),!(isString(m)||isMessageAST(m)||isMessageFunction(m)));C++)if(!isImplicitFallback(E,u)){const r=handleMissing(e,t,E,s,"translate");r!==t&&(m=r)}return[m,E,f]}function compileMessageFormat(e,t,r,n,o,s){const{messageCompiler:a,warnHtmlMessage:i}=e;if(isMessageFunction(n)){const e=n;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==a){const e=()=>n;return e.locale=r,e.key=t,e}const c=a(n,getCompileContext(e,r,o,n,i,s));return c.locale=r,c.key=t,c.source=n,c}function evaluateMessage(e,t,r){return t(r)}function parseTranslateArgs(...e){const[t,r,n]=e,o={};if(!(isString(t)||isNumber(t)||isMessageFunction(t)||isMessageAST(t)))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(r)?o.plural=r:isString(r)?o.default=r:isPlainObject(r)&&!isEmptyObject(r)?o.named=r:isArray(r)&&(o.list=r),isNumber(n)?o.plural=n:isString(n)?o.default=n:isPlainObject(n)&&assign(o,n),[s,o]}function getCompileContext(e,t,r,n,o,s){return{locale:t,key:r,warnHtmlMessage:o,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,r,e)}}function getMessageContextOptions(e,t,r,n){const{modifiers:o,pluralRules:s,messageResolver:a,fallbackLocale:i,fallbackWarn:c,missingWarn:l,fallbackContext:u}=e,E={locale:t,modifiers:o,pluralRules:s,messages:(n,o)=>{let s=a(r,n);if(null==s&&(u||o)){const[,,r]=resolveMessageFormat(u||e,n,t,i,c,l);s=a(r,n)}if(isString(s)||isMessageAST(s)){let r=!1;const o=compileMessageFormat(e,n,t,s,n,(()=>{r=!0}));return r?NOOP_MESSAGE_FUNCTION:o}return isMessageFunction(s)?s:NOOP_MESSAGE_FUNCTION}};return e.processor&&(E.processor=e.processor),n.list&&(E.list=n.list),n.named&&(E.named=n.named),isNumber(n.plural)&&(E.pluralIndex=n.plural),E}registerMessageCompiler(compile),registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CORE_ERROR_CODES_EXTEND_POINT,CORE_WARN_CODES_EXTEND_POINT,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,compile,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getLocale,getWarnMessage,handleMissing,initI18nDevTools,isAlmostSameLocale,isImplicitFallback,isMessageAST,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveLocale,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale};
|
|
6
|
+
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format$1(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,r)=>t.hasOwnProperty(r)?t[r]:""))}const generateFormatCacheKey=(e,t,r)=>friendlyJSONstringify({l:e,k:t,s:r}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length,assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,isPromise=e=>isObject(e)&&isFunction(e.then)&&isFunction(e.catch),objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>"[object Object]"===toTypeString(e),toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e);function join(e,t=""){return e.reduce(((e,r,n)=>0===n?e+r:e+t+r),"")}function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function createPosition(e,t,r){return{line:e,column:t,offset:r}}function createLocation(e,t,r){return{start:e,end:t}}const CompileErrorCodes={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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},COMPILE_ERROR_CODES_EXTEND_POINT=17;function createCompileError(e,t,r={}){const{domain:n,messages:o,args:s}=r,a=new SyntaxError(String(e));return a.code=e,t&&(a.location=t),a.domain=n,a}function defaultOnError(e){throw e}CompileErrorCodes.EXPECTED_TOKEN,CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,CompileErrorCodes.UNBALANCED_CLOSING_BRACE,CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,CompileErrorCodes.EMPTY_PLACEHOLDER,CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,CompileErrorCodes.INVALID_LINKED_FORMAT,CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE,CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE;const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF="\n",CHAR_LS=String.fromCharCode(8232),CHAR_PS=String.fromCharCode(8233);function createScanner(e){const t=e;let r=0,n=1,o=1,s=0;const a=e=>t[e]===CHAR_CR&&t[e+1]===CHAR_LF,i=e=>t[e]===CHAR_PS,c=e=>t[e]===CHAR_LS,l=e=>a(e)||(e=>t[e]===CHAR_LF)(e)||i(e)||c(e),u=e=>a(e)||i(e)||c(e)?CHAR_LF:t[e];function E(){return s=0,l(r)&&(n++,o=0),a(r)&&r++,r++,o++,t[r]}return{index:()=>r,line:()=>n,column:()=>o,peekOffset:()=>s,charAt:u,currentChar:()=>u(r),currentPeek:()=>u(r+s),next:E,peek:function(){return a(r+s)&&s++,s++,t[r+s]},reset:function(){r=0,n=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=r+s;for(;e!==r;)E();s=0}}}const EOF=void 0,DOT=".",LITERAL_DELIMITER="'",ERROR_DOMAIN$1="tokenizer";function createTokenizer(e,t={}){const r=!1!==t.location,n=createScanner(e),o=()=>n.index(),s=()=>createPosition(n.line(),n.column(),n.index()),a=s(),i=o(),c={currentType:13,offset:i,startLoc:a,endLoc:a,lastType:13,lastOffset:i,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},l=()=>c,{onError:u}=t;function E(e,t,n){e.endLoc=s(),e.currentType=t;const o={type:t};return r&&(o.loc=createLocation(e.startLoc,e.endLoc)),null!=n&&(o.value=n),o}const f=e=>E(e,13);function m(e,t){return e.currentChar()===t?(e.next(),t):(CompileErrorCodes.EXPECTED_TOKEN,s(),"")}function C(e){let t="";for(;e.currentPeek()===CHAR_SP||e.currentPeek()===CHAR_LF;)t+=e.currentPeek(),e.peek();return t}function _(e){const t=C(e);return e.skipToPeek(),t}function p(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function d(e,t){const{currentType:r}=t;if(2!==r)return!1;C(e);const n=function(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),n}function g(e){C(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function N(e,t=!0){const r=(t=!1,n="")=>{const o=e.currentPeek();return"{"===o?t:"@"!==o&&o?"|"===o?!(n===CHAR_SP||n===CHAR_LF):o===CHAR_SP?(e.peek(),r(!0,CHAR_SP)):o!==CHAR_LF||(e.peek(),r(!0,CHAR_LF)):t},n=r();return t&&e.resetPeek(),n}function A(e,t){const r=e.currentChar();return r===EOF?EOF:t(r)?(e.next(),r):null}function T(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}function L(e){return A(e,T)}function O(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t||45===t}function S(e){return A(e,O)}function b(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function h(e){return A(e,b)}function k(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function I(e){return A(e,k)}function P(e){let t="",r="";for(;t=h(e);)r+=t;return r}function M(e){return e!==LITERAL_DELIMITER&&e!==CHAR_LF}function R(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return y(e,t,4);case"U":return y(e,t,6);default:return CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,s(),""}}function y(e,t,r){m(e,t);let n="";for(let o=0;o<r;o++){const t=I(e);if(!t){CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),e.currentChar();break}n+=t}return`\\${t}${n}`}function D(e){return"{"!==e&&"}"!==e&&e!==CHAR_SP&&e!==CHAR_LF}function F(e){_(e);const t=m(e,"|");return _(e),t}function v(e,t){let r=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,s()),e.next(),r=E(t,2,"{"),_(e),t.braceNest++,r;case"}":return t.braceNest>0&&2===t.currentType&&(CompileErrorCodes.EMPTY_PLACEHOLDER,s()),e.next(),r=E(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),r;case"@":return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=U(e,t)||f(t),t.braceNest=0,r;default:{let n=!0,o=!0,a=!0;if(g(e))return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r=E(t,1,F(e)),t.braceNest=0,t.inLinked=!1,r;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s(),t.braceNest=0,x(e,t);if(n=function(e,t){const{currentType:r}=t;if(2!==r)return!1;C(e);const n=p(e.currentPeek());return e.resetPeek(),n}(e,t))return r=E(t,4,function(e){_(e);let t="",r="";for(;t=S(e);)r+=t;return e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),r}(e)),_(e),r;if(o=d(e,t))return r=E(t,5,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${P(e)}`):t+=P(e),e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,s()),t}(e)),_(e),r;if(a=function(e,t){const{currentType:r}=t;if(2!==r)return!1;C(e);const n=e.currentPeek()===LITERAL_DELIMITER;return e.resetPeek(),n}(e,t))return r=E(t,6,function(e){_(e),m(e,"'");let t="",r="";for(;t=A(e,M);)r+="\\"===t?R(e):t;const n=e.currentChar();return n===CHAR_LF||n===EOF?(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),n===CHAR_LF&&(e.next(),m(e,"'")),r):(m(e,"'"),r)}(e)),_(e),r;if(!n&&!o&&!a)return r=E(t,12,function(e){_(e);let t="",r="";for(;t=A(e,D);)r+=t;return r}(e)),CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,s(),r.value,_(e),r;break}}return r}function U(e,t){const{currentType:r}=t;let n=null;const o=e.currentChar();switch(7!==r&&8!==r&&11!==r&&9!==r||o!==CHAR_LF&&o!==CHAR_SP||(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),o){case"@":return e.next(),n=E(t,7,"@"),t.inLinked=!0,n;case".":return _(e),e.next(),E(t,8,".");case":":return _(e),e.next(),E(t,9,":");default:return g(e)?(n=E(t,1,F(e)),t.braceNest=0,t.inLinked=!1,n):function(e,t){const{currentType:r}=t;if(7!==r)return!1;C(e);const n="."===e.currentPeek();return e.resetPeek(),n}(e,t)||function(e,t){const{currentType:r}=t;if(7!==r&&11!==r)return!1;C(e);const n=":"===e.currentPeek();return e.resetPeek(),n}(e,t)?(_(e),U(e,t)):function(e,t){const{currentType:r}=t;if(8!==r)return!1;C(e);const n=p(e.currentPeek());return e.resetPeek(),n}(e,t)?(_(e),E(t,11,function(e){let t="",r="";for(;t=L(e);)r+=t;return r}(e))):function(e,t){const{currentType:r}=t;if(9!==r)return!1;const n=()=>{const t=e.currentPeek();return"{"===t?p(e.peek()):!("@"===t||"|"===t||":"===t||"."===t||t===CHAR_SP||!t)&&(t===CHAR_LF?(e.peek(),n()):N(e,!1))},o=n();return e.resetPeek(),o}(e,t)?(_(e),"{"===o?v(e,t)||n:E(t,10,function(e){const t=r=>{const n=e.currentChar();return"{"!==n&&"@"!==n&&"|"!==n&&"("!==n&&")"!==n&&n?n===CHAR_SP?r:(r+=n,e.next(),t(r)):r};return t("")}(e))):(7===r&&(CompileErrorCodes.INVALID_LINKED_FORMAT,s()),t.braceNest=0,t.inLinked=!1,x(e,t))}}function x(e,t){let r={type:13};if(t.braceNest>0)return v(e,t)||f(t);if(t.inLinked)return U(e,t)||f(t);switch(e.currentChar()){case"{":return v(e,t)||f(t);case"}":return CompileErrorCodes.UNBALANCED_CLOSING_BRACE,s(),e.next(),E(t,3,"}");case"@":return U(e,t)||f(t);default:if(g(e))return r=E(t,1,F(e)),t.braceNest=0,t.inLinked=!1,r;if(N(e))return E(t,0,function(e){let t="";for(;;){const r=e.currentChar();if("{"===r||"}"===r||"@"===r||"|"===r||!r)break;if(r===CHAR_SP||r===CHAR_LF)if(N(e))t+=r,e.next();else{if(g(e))break;t+=r,e.next()}else t+=r,e.next()}return t}(e))}return r}return{nextToken:function(){const{currentType:e,offset:t,startLoc:r,endLoc:a}=c;return c.lastType=e,c.lastOffset=t,c.lastStartLoc=r,c.lastEndLoc=a,c.offset=o(),c.startLoc=s(),n.currentChar()===EOF?E(c,13):x(n,c)},currentOffset:o,currentPosition:s,context:l}}const ERROR_DOMAIN="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(e,t,r){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||r,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function createParser(e={}){const t=!1!==e.location,{onError:r}=e;function n(e,r,n){const o={type:e};return t&&(o.start=r,o.end=r,o.loc={start:n,end:n}),o}function o(e,r,n,o){t&&(e.end=r,e.loc&&(e.loc.end=n))}function s(e,t){const r=e.context(),s=n(3,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function a(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(5,s,a);return i.index=parseInt(t,10),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function i(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(4,s,a);return i.key=t,e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function c(e,t){const r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(9,s,a);return i.value=t.replace(KNOWN_ESCAPES,fromEscapeSequence),e.nextToken(),o(i,e.currentOffset(),e.currentPosition()),i}function l(e){const t=e.context(),r=n(6,t.offset,t.startLoc);let s=e.nextToken();if(8===s.type){const t=function(e){const t=e.nextToken(),r=e.context(),{lastOffset:s,lastStartLoc:a}=r,i=n(8,s,a);return 11!==t.type?(CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,r.lastStartLoc,i.value="",o(i,s,a),{nextConsumeToken:t,node:i}):(null==t.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,r.lastStartLoc,getTokenCaption(t)),i.value=t.value||"",o(i,e.currentOffset(),e.currentPosition()),{node:i})}(e);r.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(9!==s.type&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 10:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=function(e,t){const r=e.context(),s=n(7,r.offset,r.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 4:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=i(e,s.value||"");break;case 5:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=a(e,s.value||"");break;case 6:null==s.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(s)),r.key=c(e,s.value||"");break;default:{CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const a=e.context(),i=n(7,a.offset,a.startLoc);return i.value="",o(i,a.offset,a.startLoc),r.key=i,o(r,a.offset,a.startLoc),{nextConsumeToken:s,node:r}}}return o(r,e.currentOffset(),e.currentPosition()),{node:r}}function u(e){const t=e.context(),r=n(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);r.items=[];let u=null;do{const n=u||e.nextToken();switch(u=null,n.type){case 0:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(s(e,n.value||""));break;case 5:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(a(e,n.value||""));break;case 4:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(i(e,n.value||""));break;case 6:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(c(e,n.value||""));break;case 7:{const t=l(e);r.items.push(t.node),u=t.nextConsumeToken||null;break}}}while(13!==t.currentType&&1!==t.currentType);return o(r,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),r}function E(e){const t=e.context(),{offset:r,startLoc:s}=t,a=u(e);return 13===t.currentType?a:function(e,t,r,s){const a=e.context();let i=0===s.items.length;const c=n(1,t,r);c.cases=[],c.cases.push(s);do{const t=u(e);i||(i=0===t.items.length),c.cases.push(t)}while(13!==a.currentType);return i&&CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,o(c,e.currentOffset(),e.currentPosition()),c}(e,r,s,a)}return{parse:function(r){const s=createTokenizer(r,assign({},e)),a=s.context(),i=n(0,a.offset,a.startLoc);return t&&i.loc&&(i.loc.source=r),i.body=E(s),e.onCacheKey&&(i.cacheKey=e.onCacheKey(r)),13!==a.currentType&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,a.lastStartLoc,r[a.offset]),o(i,s.currentOffset(),s.currentPosition()),i}}}function getTokenCaption(e){if(13===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function createTransformer(e,t={}){const r={ast:e,helpers:new Set};return{context:()=>r,helper:e=>(r.helpers.add(e),e)}}function traverseNodes(e,t){for(let r=0;r<e.length;r++)traverseNode(e[r],t)}function traverseNode(e,t){switch(e.type){case 1:traverseNodes(e.cases,t),t.helper("plural");break;case 2:traverseNodes(e.items,t);break;case 6:traverseNode(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function transform(e,t={}){const r=createTransformer(e);r.helper("normalize"),e.body&&traverseNode(e.body,r);const n=r.context();e.helpers=Array.from(n.helpers)}function optimize(e){const t=e.body;return 2===t.type?optimizeMessageNode(t):t.cases.forEach((e=>optimizeMessageNode(e))),e}function optimizeMessageNode(e){if(1===e.items.length){const t=e.items[0];3!==t.type&&9!==t.type||(e.static=t.value,delete t.value)}else{const t=[];for(let r=0;r<e.items.length;r++){const n=e.items[r];if(3!==n.type&&9!==n.type)break;if(null==n.value)break;t.push(n.value)}if(t.length===e.items.length){e.static=join(t);for(let t=0;t<e.items.length;t++){const r=e.items[t];3!==r.type&&9!==r.type||delete r.value}}}}function minify(e){switch(e.t=e.type,e.type){case 0:{const t=e;minify(t.body),t.b=t.body,delete t.body;break}case 1:{const t=e,r=t.cases;for(let e=0;e<r.length;e++)minify(r[e]);t.c=r,delete t.cases;break}case 2:{const t=e,r=t.items;for(let e=0;e<r.length;e++)minify(r[e]);t.i=r,delete t.items,t.static&&(t.s=t.static,delete t.static);break}case 3:case 9:case 8:case 7:{const t=e;t.value&&(t.v=t.value,delete t.value);break}case 6:{const t=e;minify(t.key),t.k=t.key,delete t.key,t.modifier&&(minify(t.modifier),t.m=t.modifier,delete t.modifier);break}case 5:{const t=e;t.i=t.index,delete t.index;break}case 4:{const t=e;t.k=t.key,delete t.key;break}}delete e.type}function createCodeGenerator(e,t){const{sourceMap:r,filename:n,breakLineCode:o,needIndent:s}=t,a=!1!==t.location,i={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:s,indentLevel:0};a&&e.loc&&(i.source=e.loc.source);function c(e,t){i.code+=e}function l(e,t=!0){const r=t?o:"";c(s?r+" ".repeat(e):r)}return{context:()=>i,push:c,indent:function(e=!0){const t=++i.indentLevel;e&&l(t)},deindent:function(e=!0){const t=--i.indentLevel;e&&l(t)},newline:function(){l(i.indentLevel)},helper:e=>`_${e}`,needIndent:()=>i.needIndent}}function generateLinkedNode(e,t){const{helper:r}=e;e.push(`${r("linked")}(`),generateNode(e,t.key),t.modifier?(e.push(", "),generateNode(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}function generateMessageNode(e,t){const{helper:r,needIndent:n}=e;e.push(`${r("normalize")}([`),e.indent(n());const o=t.items.length;for(let s=0;s<o&&(generateNode(e,t.items[s]),s!==o-1);s++)e.push(", ");e.deindent(n()),e.push("])")}function generatePluralNode(e,t){const{helper:r,needIndent:n}=e;if(t.cases.length>1){e.push(`${r("plural")}([`),e.indent(n());const o=t.cases.length;for(let r=0;r<o&&(generateNode(e,t.cases[r]),r!==o-1);r++)e.push(", ");e.deindent(n()),e.push("])")}}function generateResource(e,t){t.body?generateNode(e,t.body):e.push("null")}function generateNode(e,t){const{helper:r}=e;switch(t.type){case 0:generateResource(e,t);break;case 1:generatePluralNode(e,t);break;case 2:generateMessageNode(e,t);break;case 6:generateLinkedNode(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${r("interpolate")}(${r("list")}(${t.index}))`,t);break;case 4:e.push(`${r("interpolate")}(${r("named")}(${JSON.stringify(t.key)}))`,t)}}const generate=(e,t={})=>{const r=isString(t.mode)?t.mode:"normal",n=isString(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,s=null!=t.breakLineCode?t.breakLineCode:"arrow"===r?";":"\n",a=t.needIndent?t.needIndent:"arrow"!==r,i=e.helpers||[],c=createCodeGenerator(e,{mode:r,filename:n,sourceMap:o,breakLineCode:s,needIndent:a});c.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(a),i.length>0&&(c.push(`const { ${join(i.map((e=>`${e}: _${e}`)),", ")} } = ctx`),c.newline()),c.push("return "),generateNode(c,e),c.deindent(a),c.push("}"),delete e.helpers;const{code:l,map:u}=c.context();return{ast:e,code:l,map:u?u.toJSON():void 0}};function baseCompile$1(e,t={}){const r=assign({},t),n=!!r.jit,o=!!r.minify,s=null==r.optimize||r.optimize,a=createParser(r).parse(e);return n?(s&&optimize(a),o&&minify(a),{ast:a,code:""}):(transform(a,r),generate(a,r))}function format(e){return t=>formatParts(t,e)}function formatParts(e,t){const r=t.b||t.body;if(1===(r.t||r.type)){const t=r,n=t.c||t.cases;return e.plural(n.reduce(((t,r)=>[...t,formatMessageParts(e,r)]),[]))}return formatMessageParts(e,r)}function formatMessageParts(e,t){const r=t.s||t.static;if(r)return"text"===e.type?r:e.normalize([r]);{const r=(t.i||t.items).reduce(((t,r)=>[...t,formatMessagePart(e,r)]),[]);return e.normalize(r)}}function formatMessagePart(e,t){const r=t.t||t.type;switch(r){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const r=t;return e.interpolate(e.named(r.k||r.key))}case 5:{const r=t;return e.interpolate(e.list(null!=r.i?r.i:r.index))}case 6:{const r=t,n=r.m||r.modifier;return e.linked(formatMessagePart(e,r.k||r.key),n?formatMessagePart(e,n):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${r}`)}}const defaultOnCacheKey=e=>e;let compileCache=Object.create(null);function clearCompileCache(){compileCache=Object.create(null)}const isMessageAST=e=>isObject(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function baseCompile(e,t={}){let r=!1;const n=t.onError||defaultOnError;return t.onError=e=>{r=!0,n(e)},{...baseCompile$1(e,t),detectError:r}}function compile(e,t){if(isString(e)){!isBoolean(t.warnHtmlMessage)||t.warnHtmlMessage;const r=(t.onCacheKey||defaultOnCacheKey)(e),n=compileCache[r];if(n)return n;const{ast:o,detectError:s}=baseCompile(e,{...t,location:!1,jit:!0}),a=format(o);return s?a:compileCache[r]=a}{const t=e.cacheKey;if(t){const r=compileCache[t];return r||(compileCache[t]=format(e))}return format(e)}}let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,r){devtools&&devtools.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:r})}const translateDevTools=createDevToolsHook("function:translate");function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreErrorCodes={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},CORE_ERROR_CODES_EXTEND_POINT=24;function createCoreError(e){return createCompileError(e,null,void 0)}function getLocale(e,t){return null!=t.locale?resolveLocale(t.locale):resolveLocale(e.locale)}let _resolveLocale;function resolveLocale(e){if(isString(e))return e;if(isFunction(e)){if(e.resolvedOnce&&null!=_resolveLocale)return _resolveLocale;if("Function"===e.constructor.name){const t=e();if(isPromise(t))throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return _resolveLocale=t}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE)}function fallbackWithSimple(e,t,r){return[...new Set([r,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[r]])]}function fallbackWithLocaleChain(e,t,r){const n=isString(r)?r:DEFAULT_LOCALE,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(n);if(!s){s=[];let e=[r];for(;isArray(e);)e=appendBlockToChain(s,e,t);const a=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(a)?[a]:a,isArray(e)&&appendBlockToChain(s,e,!1),o.__localeChainCache.set(n,s)}return s}function appendBlockToChain(e,t,r){let n=!0;for(let o=0;o<t.length&&isBoolean(n);o++){const s=t[o];isString(s)&&(n=appendLocaleToChain(e,t[o],r))}return n}function appendLocaleToChain(e,t,r){let n;const o=t.split("-");do{n=appendItemToChain(e,o.join("-"),r),o.splice(-1,1)}while(o.length&&!0===n);return n}function appendItemToChain(e,t,r){let n=!1;if(!e.includes(t)&&(n=!0,t)){n="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(isArray(r)||isPlainObject(r))&&r[o]&&(n=r[o])}return n}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT,CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE,CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE,CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE;const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let r,n,o,s,a,i,c,l=-1,u=0,E=0;const f=[];function m(){const t=e[l+1];if(5===u&&"'"===t||6===u&&'"'===t)return l++,o="\\"+t,f[0](),!0}for(f[0]=()=>{void 0===n?n=o:n+=o},f[1]=()=>{void 0!==n&&(t.push(n),n=void 0)},f[2]=()=>{f[0](),E++},f[3]=()=>{if(E>0)E--,u=4,f[0]();else{if(E=0,void 0===n)return!1;if(n=formatSubPath(n),!1===n)return!1;f[1]()}};null!==u;)if(l++,r=e[l],"\\"!==r||!m()){if(s=getPathCharType(r),c=pathStateMachine[u],a=c[s]||c.l||8,8===a)return;if(u=a[0],void 0!==a[1]&&(i=f[a[1]],i&&(o=r,!1===i())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let r=cache.get(t);if(r||(r=parse(t),r&&cache.set(t,r)),!r)return null;const n=r.length;let o=e,s=0;for(;s<n;){const e=o[r[s]];if(void 0===e)return null;if(isFunction(o))return null;o=e,s++}return o}const CoreWarnCodes={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},CORE_WARN_CODES_EXTEND_POINT=8,warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[CoreWarnCodes.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."};function getWarnMessage(e,...t){return format$1(warnMessages[e],...t)}const VERSION="10.0.2",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isFunction(e.onWarn)?e.onWarn:warn,r=isString(e.version)?e.version:VERSION,n=isString(e.locale)||isFunction(e.locale)?e.locale:DEFAULT_LOCALE,o=isFunction(n)?DEFAULT_LOCALE:n,s=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:o,a=isPlainObject(e.messages)?e.messages:{[o]:{}},i=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[o]:{}},c=isPlainObject(e.numberFormats)?e.numberFormats:{[o]:{}},l=assign({},e.modifiers||{},getDefaultLinkedModifiers()),u=e.pluralRules||{},E=isFunction(e.missing)?e.missing:null,f=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,m=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,C=!!e.fallbackFormat,_=!!e.unresolving,p=isFunction(e.postTranslation)?e.postTranslation:null,d=isPlainObject(e.processor)?e.processor:null,g=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,N=!!e.escapeParameter,A=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,T=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,L=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,O=isObject(e.fallbackContext)?e.fallbackContext:void 0,S=e,b=isObject(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,h=isObject(S.__numberFormatters)?S.__numberFormatters:new Map,k=isObject(S.__meta)?S.__meta:{};_cid++;const I={version:r,cid:_cid,locale:n,fallbackLocale:s,messages:a,modifiers:l,pluralRules:u,missing:E,missingWarn:f,fallbackWarn:m,fallbackFormat:C,unresolving:_,postTranslation:p,processor:d,warnHtmlMessage:g,escapeParameter:N,messageCompiler:A,messageResolver:T,localeFallbacker:L,fallbackContext:O,onWarn:t,__meta:k};return I.datetimeFormats=i,I.numberFormats=c,I.__datetimeFormatters=b,I.__numberFormatters=h,I}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,r,n,o){const{missing:s,onWarn:a}=e;if(null!==s){const n=s(e,r,t,o);return isString(n)?n:t}return t}function updateFallbackLocale(e,t,r){e.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}function isAlmostSameLocale(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function isImplicitFallback(e,t){const r=t.indexOf(e);if(-1===r)return!1;for(let n=r+1;n<t.length;n++)if(isAlmostSameLocale(e,t[n]))return!0;return!1}function datetime(e,...t){const{datetimeFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__datetimeFormatters:i}=e,[c,l,u,E]=parseDateTimeArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const m=!!u.part,C=getLocale(e,u),_=a(e,o,C);if(!isString(c)||""===c)return new Intl.DateTimeFormat(C,E).format(l);let p,d={},g=null;for(let T=0;T<_.length&&(p=_[T],d=r[p]||{},g=d[c],!isPlainObject(g));T++)handleMissing(e,c,p,f,"datetime format");if(!isPlainObject(g)||!isString(p))return n?-1:c;let N=`${p}__${c}`;isEmptyObject(E)||(N=`${N}__${JSON.stringify(E)}`);let A=i.get(N);return A||(A=new Intl.DateTimeFormat(p,assign({},g,E)),i.set(N,A)),m?A.formatToParts(l):A.format(l)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,r,n,o]=e,s={};let a,i={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const r=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();a=new Date(r);try{a.toISOString()}catch{throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);a=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);a=t}return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(i=n),isPlainObject(o)&&(i=o),[s.key||"",a,s,i]}function clearDateTimeFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__datetimeFormatters.has(e)&&n.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:r,unresolving:n,fallbackLocale:o,onWarn:s,localeFallbacker:a}=e,{__numberFormatters:i}=e,[c,l,u,E]=parseNumberArgs(...t),f=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const m=!!u.part,C=getLocale(e,u),_=a(e,o,C);if(!isString(c)||""===c)return new Intl.NumberFormat(C,E).format(l);let p,d={},g=null;for(let T=0;T<_.length&&(p=_[T],d=r[p]||{},g=d[c],!isPlainObject(g));T++)handleMissing(e,c,p,f,"number format");if(!isPlainObject(g)||!isString(p))return n?-1:c;let N=`${p}__${c}`;isEmptyObject(E)||(N=`${N}__${JSON.stringify(E)}`);let A=i.get(N);return A||(A=new Intl.NumberFormat(p,assign({},g,E)),i.set(N,A)),m?A.formatToParts(l):A.format(l)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,r,n,o]=e,s={};let a={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const i=t;return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?a[e]=r[e]:s[e]=r[e]})),isString(n)?s.locale=n:isPlainObject(n)&&(a=n),isPlainObject(o)&&(a=o),[s.key||"",i,s,a]}function clearNumberFormat(e,t,r){const n=e;for(const o in r){const e=`${t}__${o}`;n.__numberFormatters.has(e)&&n.__numberFormatters.delete(e)}}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":join(e),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,r=getPluralIndex(e),n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,o=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],a=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(r,a);function i(t,r){const n=isFunction(e.messages)?e.messages(t,!!r):!!isObject(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const c=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,l=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>a[e],plural:e=>e[n(r,e.length,o)],linked:(t,...r)=>{const[n,o]=r;let s="text",a="";1===r.length?isObject(n)?(a=n.modifier||a,s=n.type||s):isString(n)&&(a=n||a):2===r.length&&(isString(n)&&(a=n||a),isString(o)&&(s=o||s));const c=i(t,!0)(u),l="vnode"===s&&isArray(c)&&a?c[0]:c;return a?(E=a,e.modifiers?e.modifiers[E]:DEFAULT_MODIFIER)(l,s):l;var E},message:i,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:l,normalize:c,values:assign({},s,a)};return u}const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:r,postTranslation:n,unresolving:o,messageCompiler:s,fallbackLocale:a,messages:i}=e,[c,l]=parseTranslateArgs(...t),u=isBoolean(l.missingWarn)?l.missingWarn:e.missingWarn,E=isBoolean(l.fallbackWarn)?l.fallbackWarn:e.fallbackWarn,f=isBoolean(l.escapeParameter)?l.escapeParameter:e.escapeParameter,m=!!l.resolvedMessage,C=isString(l.default)||isBoolean(l.default)?isBoolean(l.default)?s?c:()=>c:l.default:r?s?c:()=>c:null,_=r||null!=C&&(isString(C)||isFunction(C)),p=getLocale(e,l);f&&escapeParams(l);let[d,g,N]=m?[c,p,i[p]||{}]:resolveMessageFormat(e,c,p,a,E,u),A=d,T=c;if(m||isString(A)||isMessageAST(A)||isMessageFunction(A)||_&&(A=C,T=A),!(m||(isString(A)||isMessageAST(A)||isMessageFunction(A))&&isString(g)))return o?-1:c;let L=!1;const O=isMessageFunction(A)?A:compileMessageFormat(e,c,g,A,T,(()=>{L=!0}));if(L)return A;const S=evaluateMessage(e,O,createMessageContext(getMessageContextOptions(e,g,N,l)));return n?n(S,c):S}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,r,n,o,s){const{messages:a,onWarn:i,messageResolver:c,localeFallbacker:l}=e,u=l(e,n,r);let E,f={},m=null;for(let C=0;C<u.length&&(E=u[C],f=a[E]||{},null===(m=c(f,t))&&(m=f[t]),!(isString(m)||isMessageAST(m)||isMessageFunction(m)));C++)if(!isImplicitFallback(E,u)){const r=handleMissing(e,t,E,s,"translate");r!==t&&(m=r)}return[m,E,f]}function compileMessageFormat(e,t,r,n,o,s){const{messageCompiler:a,warnHtmlMessage:i}=e;if(isMessageFunction(n)){const e=n;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==a){const e=()=>n;return e.locale=r,e.key=t,e}const c=a(n,getCompileContext(e,r,o,n,i,s));return c.locale=r,c.key=t,c.source=n,c}function evaluateMessage(e,t,r){return t(r)}function parseTranslateArgs(...e){const[t,r,n]=e,o={};if(!(isString(t)||isNumber(t)||isMessageFunction(t)||isMessageAST(t)))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(r)?o.plural=r:isString(r)?o.default=r:isPlainObject(r)&&!isEmptyObject(r)?o.named=r:isArray(r)&&(o.list=r),isNumber(n)?o.plural=n:isString(n)?o.default=n:isPlainObject(n)&&assign(o,n),[s,o]}function getCompileContext(e,t,r,n,o,s){return{locale:t,key:r,warnHtmlMessage:o,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,r,e)}}function getMessageContextOptions(e,t,r,n){const{modifiers:o,pluralRules:s,messageResolver:a,fallbackLocale:i,fallbackWarn:c,missingWarn:l,fallbackContext:u}=e,E={locale:t,modifiers:o,pluralRules:s,messages:(n,o)=>{let s=a(r,n);if(null==s&&(u||o)){const[,,r]=resolveMessageFormat(u||e,n,t,i,c,l);s=a(r,n)}if(isString(s)||isMessageAST(s)){let r=!1;const o=compileMessageFormat(e,n,t,s,n,(()=>{r=!0}));return r?NOOP_MESSAGE_FUNCTION:o}return isMessageFunction(s)?s:NOOP_MESSAGE_FUNCTION}};return e.processor&&(E.processor=e.processor),n.list&&(E.list=n.list),n.named&&(E.named=n.named),isNumber(n.plural)&&(E.pluralIndex=n.plural),E}registerMessageCompiler(compile),registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CORE_ERROR_CODES_EXTEND_POINT,CORE_WARN_CODES_EXTEND_POINT,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,compile,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getLocale,getWarnMessage,handleMissing,initI18nDevTools,isAlmostSameLocale,isImplicitFallback,isMessageAST,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveLocale,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale};
|
package/dist/core.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -81,12 +81,7 @@ var IntlifyCore = (function (exports) {
|
|
|
81
81
|
};
|
|
82
82
|
const objectToString = Object.prototype.toString;
|
|
83
83
|
const toTypeString = (value) => objectToString.call(value);
|
|
84
|
-
const isPlainObject = (val) =>
|
|
85
|
-
if (!isObject(val))
|
|
86
|
-
return false;
|
|
87
|
-
const proto = Object.getPrototypeOf(val);
|
|
88
|
-
return proto === null || proto.constructor === Object;
|
|
89
|
-
};
|
|
84
|
+
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
90
85
|
// for converting list and named values to displayed strings.
|
|
91
86
|
const toDisplayString = (val) => {
|
|
92
87
|
return val == null
|
|
@@ -147,9 +142,6 @@ var IntlifyCore = (function (exports) {
|
|
|
147
142
|
}
|
|
148
143
|
function createLocation(start, end, source) {
|
|
149
144
|
const loc = { start, end };
|
|
150
|
-
if (source != null) {
|
|
151
|
-
loc.source = source;
|
|
152
|
-
}
|
|
153
145
|
return loc;
|
|
154
146
|
}
|
|
155
147
|
|
|
@@ -1000,9 +992,6 @@ var IntlifyCore = (function (exports) {
|
|
|
1000
992
|
return node;
|
|
1001
993
|
}
|
|
1002
994
|
function endNode(node, offset, pos, type) {
|
|
1003
|
-
if (type) {
|
|
1004
|
-
node.type = type;
|
|
1005
|
-
}
|
|
1006
995
|
if (location) {
|
|
1007
996
|
node.end = offset;
|
|
1008
997
|
if (node.loc) {
|
|
@@ -1988,7 +1977,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1988
1977
|
return follow;
|
|
1989
1978
|
}
|
|
1990
1979
|
|
|
1991
|
-
const pathStateMachine =
|
|
1980
|
+
const pathStateMachine = [];
|
|
1992
1981
|
pathStateMachine[0 /* States.BEFORE_PATH */] = {
|
|
1993
1982
|
["w" /* PathCharTypes.WORKSPACE */]: [0 /* States.BEFORE_PATH */],
|
|
1994
1983
|
["i" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],
|
|
@@ -2285,7 +2274,7 @@ var IntlifyCore = (function (exports) {
|
|
|
2285
2274
|
* Intlify core-base version
|
|
2286
2275
|
* @internal
|
|
2287
2276
|
*/
|
|
2288
|
-
const VERSION = '10.0.
|
|
2277
|
+
const VERSION = '10.0.2';
|
|
2289
2278
|
const NOT_REOSLVED = -1;
|
|
2290
2279
|
const DEFAULT_LOCALE = 'en-US';
|
|
2291
2280
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -2345,7 +2334,7 @@ var IntlifyCore = (function (exports) {
|
|
|
2345
2334
|
_fallbacker = fallbacker;
|
|
2346
2335
|
}
|
|
2347
2336
|
// Additional Meta for Intlify DevTools
|
|
2348
|
-
let _additionalMeta =
|
|
2337
|
+
let _additionalMeta = null;
|
|
2349
2338
|
/* #__NO_SIDE_EFFECTS__ */
|
|
2350
2339
|
const setAdditionalMeta = (meta) => {
|
|
2351
2340
|
_additionalMeta = meta;
|
package/dist/core.global.prod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 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,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),o=e=>"number"==typeof e&&isFinite(e),a=e=>"[object Date]"===N(e),s=e=>"[object RegExp]"===N(e),c=e=>L(e)&&0===Object.keys(e).length,l=Object.assign;function i(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const u=Array.isArray,f=e=>"function"==typeof e,E=e=>"string"==typeof e,_=e=>"boolean"==typeof e,m=e=>null!==e&&"object"==typeof e,d=e=>m(e)&&f(e.then)&&f(e.catch),p=Object.prototype.toString,N=e=>p.call(e),L=e=>{if(!m(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object};function T(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}function A(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function C(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const k={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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function h(e,t,n={}){const{domain:r,messages:o,args:a}=n,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=r,s}function O(e){throw e}k.EXPECTED_TOKEN,k.INVALID_TOKEN_IN_PLACEHOLDER,k.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,k.UNKNOWN_ESCAPE_SEQUENCE,k.INVALID_UNICODE_ESCAPE_SEQUENCE,k.UNBALANCED_CLOSING_BRACE,k.UNTERMINATED_CLOSING_BRACE,k.EMPTY_PLACEHOLDER,k.NOT_ALLOW_NEST_PLACEHOLDER,k.INVALID_LINKED_FORMAT,k.MUST_HAVE_MESSAGES_IN_PLURAL,k.UNEXPECTED_EMPTY_LINKED_MODIFIER,k.UNEXPECTED_EMPTY_LINKED_KEY,k.UNEXPECTED_LEXICAL_ANALYSIS,k.UNHANDLED_CODEGEN_NODE_TYPE,k.UNHANDLED_MINIFIER_NODE_TYPE;const I=" ",g="\r",S="\n",y=String.fromCharCode(8232),b=String.fromCharCode(8233);function D(e){const t=e;let n=0,r=1,o=1,a=0;const s=e=>t[e]===g&&t[e+1]===S,c=e=>t[e]===b,l=e=>t[e]===y,i=e=>s(e)||(e=>t[e]===S)(e)||c(e)||l(e),u=e=>s(e)||c(e)||l(e)?S:t[e];function f(){return a=0,i(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>a,charAt:u,currentChar:()=>u(n),currentPeek:()=>u(n+a),next:f,peek:function(){return s(n+a)&&a++,a++,t[n+a]},reset:function(){n=0,r=1,o=1,a=0},resetPeek:function(e=0){a=e},skipToPeek:function(){const e=n+a;for(;e!==n;)f();a=0}}}const P=void 0,R="'";function M(e,t={}){const n=!1!==t.location,r=D(e),o=()=>r.index(),a=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=a(),c=o(),l={currentType:13,offset:c,startLoc:s,endLoc:s,lastType:13,lastOffset:c,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},i=()=>l,{onError:u}=t;function f(e,t,r){e.endLoc=a(),e.currentType=t;const o={type:t};return n&&(o.loc=C(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const E=e=>f(e,13);function _(e,t){return e.currentChar()===t?(e.next(),t):(k.EXPECTED_TOKEN,a(),"")}function m(e){let t="";for(;e.currentPeek()===I||e.currentPeek()===S;)t+=e.currentPeek(),e.peek();return t}function d(e){const t=m(e);return e.skipToPeek(),t}function p(e){if(e===P)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function N(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=function(e){if(e===P)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function L(e){m(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function T(e,t=!0){const n=(t=!1,r="")=>{const o=e.currentPeek();return"{"===o?t:"@"!==o&&o?"|"===o?!(r===I||r===S):o===I?(e.peek(),n(!0,I)):o!==S||(e.peek(),n(!0,S)):t},r=n();return t&&e.resetPeek(),r}function A(e,t){const n=e.currentChar();return n===P?P:t(n)?(e.next(),n):null}function h(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}function O(e){return A(e,h)}function g(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t||45===t}function y(e){return A(e,g)}function b(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function M(e){return A(e,b)}function U(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function v(e){return A(e,U)}function F(e){let t="",n="";for(;t=M(e);)n+=t;return n}function x(e){return e!==R&&e!==S}function w(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return W(e,t,4);case"U":return W(e,t,6);default:return k.UNKNOWN_ESCAPE_SEQUENCE,a(),""}}function W(e,t,n){_(e,t);let r="";for(let o=0;o<n;o++){const t=v(e);if(!t){k.INVALID_UNICODE_ESCAPE_SEQUENCE,a(),e.currentChar();break}r+=t}return`\\${t}${r}`}function Y(e){return"{"!==e&&"}"!==e&&e!==I&&e!==S}function G(e){d(e);const t=_(e,"|");return d(e),t}function K(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(k.NOT_ALLOW_NEST_PLACEHOLDER,a()),e.next(),n=f(t,2,"{"),d(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&(k.EMPTY_PLACEHOLDER,a()),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&d(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&(k.UNTERMINATED_CLOSING_BRACE,a()),n=X(e,t)||E(t),t.braceNest=0,n;default:{let r=!0,o=!0,s=!0;if(L(e))return t.braceNest>0&&(k.UNTERMINATED_CLOSING_BRACE,a()),n=f(t,1,G(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return k.UNTERMINATED_CLOSING_BRACE,a(),t.braceNest=0,V(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=p(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,4,function(e){d(e);let t="",n="";for(;t=y(e);)n+=t;return e.currentChar()===P&&(k.UNTERMINATED_CLOSING_BRACE,a()),n}(e)),d(e),n;if(o=N(e,t))return n=f(t,5,function(e){d(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${F(e)}`):t+=F(e),e.currentChar()===P&&(k.UNTERMINATED_CLOSING_BRACE,a()),t}(e)),d(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=e.currentPeek()===R;return e.resetPeek(),r}(e,t))return n=f(t,6,function(e){d(e),_(e,"'");let t="",n="";for(;t=A(e,x);)n+="\\"===t?w(e):t;const r=e.currentChar();return r===S||r===P?(k.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),r===S&&(e.next(),_(e,"'")),n):(_(e,"'"),n)}(e)),d(e),n;if(!r&&!o&&!s)return n=f(t,12,function(e){d(e);let t="",n="";for(;t=A(e,Y);)n+=t;return n}(e)),k.INVALID_TOKEN_IN_PLACEHOLDER,a(),n.value,d(e),n;break}}return n}function X(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(7!==n&&8!==n&&11!==n&&9!==n||o!==S&&o!==I||(k.INVALID_LINKED_FORMAT,a()),o){case"@":return e.next(),r=f(t,7,"@"),t.inLinked=!0,r;case".":return d(e),e.next(),f(t,8,".");case":":return d(e),e.next(),f(t,9,":");default:return L(e)?(r=f(t,1,G(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(7!==n)return!1;m(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(7!==n&&11!==n)return!1;m(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(d(e),X(e,t)):function(e,t){const{currentType:n}=t;if(8!==n)return!1;m(e);const r=p(e.currentPeek());return e.resetPeek(),r}(e,t)?(d(e),f(t,11,function(e){let t="",n="";for(;t=O(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(9!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?p(e.peek()):!("@"===t||"|"===t||":"===t||"."===t||t===I||!t)&&(t===S?(e.peek(),r()):T(e,!1))},o=r();return e.resetPeek(),o}(e,t)?(d(e),"{"===o?K(e,t)||r:f(t,10,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"@"!==r&&"|"!==r&&"("!==r&&")"!==r&&r?r===I?n:(n+=r,e.next(),t(n)):n};return t("")}(e))):(7===n&&(k.INVALID_LINKED_FORMAT,a()),t.braceNest=0,t.inLinked=!1,V(e,t))}}function V(e,t){let n={type:13};if(t.braceNest>0)return K(e,t)||E(t);if(t.inLinked)return X(e,t)||E(t);switch(e.currentChar()){case"{":return K(e,t)||E(t);case"}":return k.UNBALANCED_CLOSING_BRACE,a(),e.next(),f(t,3,"}");case"@":return X(e,t)||E(t);default:if(L(e))return n=f(t,1,G(e)),t.braceNest=0,t.inLinked=!1,n;if(T(e))return f(t,0,function(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if(n===I||n===S)if(T(e))t+=n,e.next();else{if(L(e))break;t+=n,e.next()}else t+=n,e.next()}return t}(e))}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=s,l.offset=o(),l.startLoc=a(),r.currentChar()===P?f(l,13):V(r,l)},currentOffset:o,currentPosition:a,context:i}}const U=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function v(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function F(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e};return t&&(o.start=n,o.end=n,o.loc={start:r,end:r}),o}function o(e,n,r,o){o&&(e.type=o),t&&(e.end=n,e.loc&&(e.loc.end=r))}function a(e,t){const n=e.context(),a=r(3,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}function s(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(5,a,s);return c.index=parseInt(t,10),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function c(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(4,a,s);return c.key=t,e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function i(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(9,a,s);return c.value=t.replace(U,v),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function u(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let a=e.nextToken();if(8===a.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(8,a,s);return 11!==t.type?(k.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,c.value="",o(c,a,s),{nextConsumeToken:t,node:c}):(null==t.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,x(t)),c.value=t.value||"",o(c,e.currentOffset(),e.currentPosition()),{node:c})}(e);n.modifier=t.node,a=t.nextConsumeToken||e.nextToken()}switch(9!==a.type&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),a=e.nextToken(),2===a.type&&(a=e.nextToken()),a.type){case 10:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=function(e,t){const n=e.context(),a=r(7,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}(e,a.value||"");break;case 4:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=c(e,a.value||"");break;case 5:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=s(e,a.value||"");break;case 6:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=i(e,a.value||"");break;default:{k.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const s=e.context(),c=r(7,s.offset,s.startLoc);return c.value="",o(c,s.offset,s.startLoc),n.key=c,o(n,s.offset,s.startLoc),{nextConsumeToken:a,node:n}}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let l=null;do{const r=l||e.nextToken();switch(l=null,r.type){case 0:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(a(e,r.value||""));break;case 5:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(s(e,r.value||""));break;case 4:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(c(e,r.value||""));break;case 6:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(i(e,r.value||""));break;case 7:{const t=u(e);n.items.push(t.node),l=t.nextConsumeToken||null;break}}}while(13!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function E(e){const t=e.context(),{offset:n,startLoc:a}=t,s=f(e);return 13===t.currentType?s:function(e,t,n,a){const s=e.context();let c=0===a.items.length;const l=r(1,t,n);l.cases=[],l.cases.push(a);do{const t=f(e);c||(c=0===t.items.length),l.cases.push(t)}while(13!==s.currentType);return c&&k.MUST_HAVE_MESSAGES_IN_PLURAL,o(l,e.currentOffset(),e.currentPosition()),l}(e,n,a,s)}return{parse:function(n){const a=M(n,l({},e)),s=a.context(),c=r(0,s.offset,s.startLoc);return t&&c.loc&&(c.loc.source=n),c.body=E(a),e.onCacheKey&&(c.cacheKey=e.onCacheKey(n)),13!==s.currentType&&(k.UNEXPECTED_LEXICAL_ANALYSIS,s.lastStartLoc,n[s.offset]),o(c,a.currentOffset(),a.currentPosition()),c}}}function x(e){if(13===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function w(e,t){for(let n=0;n<e.length;n++)W(e[n],t)}function W(e,t){switch(e.type){case 1:w(e.cases,t),t.helper("plural");break;case 2:w(e.items,t);break;case 6:W(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function Y(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&W(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function G(e){if(1===e.items.length){const t=e.items[0];3!==t.type&&9!==t.type||(e.static=t.value,delete t.value)}else{const t=[];for(let n=0;n<e.items.length;n++){const r=e.items[n];if(3!==r.type&&9!==r.type)break;if(null==r.value)break;t.push(r.value)}if(t.length===e.items.length){e.static=T(t);for(let t=0;t<e.items.length;t++){const n=e.items[t];3!==n.type&&9!==n.type||delete n.value}}}}function K(e){switch(e.t=e.type,e.type){case 0:{const t=e;K(t.body),t.b=t.body,delete t.body;break}case 1:{const t=e,n=t.cases;for(let e=0;e<n.length;e++)K(n[e]);t.c=n,delete t.cases;break}case 2:{const t=e,n=t.items;for(let e=0;e<n.length;e++)K(n[e]);t.i=n,delete t.items,t.static&&(t.s=t.static,delete t.static);break}case 3:case 9:case 8:case 7:{const t=e;t.value&&(t.v=t.value,delete t.value);break}case 6:{const t=e;K(t.key),t.k=t.key,delete t.key,t.modifier&&(K(t.modifier),t.m=t.modifier,delete t.modifier);break}case 5:{const t=e;t.i=t.index,delete t.index;break}case 4:{const t=e;t.k=t.key,delete t.key;break}}delete e.type}function X(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?X(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(X(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let a=0;a<o&&(X(e,t.items[a]),a!==o-1);a++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),X(e,t.key),t.modifier?(e.push(", "),X(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t)}}const V=(e,t={})=>{const n=E(t.mode)?t.mode:"normal",r=E(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,a=null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",s=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],l=function(e,t){const{sourceMap:n,filename:r,breakLineCode:o,needIndent:a}=t,s=!1!==t.location,c={filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:a,indentLevel:0};function l(e,t){c.code+=e}function i(e,t=!0){const n=t?o:"";l(a?n+" ".repeat(e):n)}return s&&e.loc&&(c.source=e.loc.source),{context:()=>c,push:l,indent:function(e=!0){const t=++c.indentLevel;e&&i(t)},deindent:function(e=!0){const t=--c.indentLevel;e&&i(t)},newline:function(){i(c.indentLevel)},helper:e=>`_${e}`,needIndent:()=>c.needIndent}}(e,{mode:n,filename:r,sourceMap:o,breakLineCode:a,needIndent:s});l.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(s),c.length>0&&(l.push(`const { ${T(c.map((e=>`${e}: _${e}`)),", ")} } = ctx`),l.newline()),l.push("return "),X(l,e),l.deindent(s),l.push("}"),delete e.helpers;const{code:i,map:u}=l.context();return{ast:e,code:i,map:u?u.toJSON():void 0}};function $(e,t={}){const n=l({},t),r=!!n.jit,o=!!n.minify,a=null==n.optimize||n.optimize,s=F(n).parse(e);return r?(a&&function(e){const t=e.body;2===t.type?G(t):t.cases.forEach((e=>G(e)))}(s),o&&K(s),{ast:s,code:""}):(Y(s,n),V(s,n))}function H(e){return t=>function(e,t){const n=t.b||t.body;if(1===(n.t||n.type)){const t=n,r=t.c||t.cases;return e.plural(r.reduce(((t,n)=>[...t,B(e,n)]),[]))}return B(e,n)}(t,e)}function B(e,t){const n=t.s||t.static;if(n)return"text"===e.type?n:e.normalize([n]);{const n=(t.i||t.items).reduce(((t,n)=>[...t,j(e,n)]),[]);return e.normalize(n)}}function j(e,t){const n=t.t||t.type;switch(n){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const n=t;return e.interpolate(e.named(n.k||n.key))}case 5:{const n=t;return e.interpolate(e.list(null!=n.i?n.i:n.index))}case 6:{const n=t,r=n.m||n.modifier;return e.linked(j(e,n.k||n.key),r?j(e,r):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${n}`)}}const z=e=>e;let Q=Object.create(null);const J=e=>m(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function Z(e,t){if(E(e)){!_(t.warnHtmlMessage)||t.warnHtmlMessage;const n=(t.onCacheKey||z)(e),r=Q[n];if(r)return r;const{ast:o,detectError:a}=function(e,t={}){let n=!1;const r=t.onError||O;return t.onError=e=>{n=!0,r(e)},{...$(e,t),detectError:n}}(e,{...t,location:!1,jit:!0}),s=H(o);return a?s:Q[n]=s}{const t=e.cacheKey;if(t){const n=Q[t];return n||(Q[t]=H(e))}return H(e)}}let q=null;const ee=te("function:translate");function te(e){return t=>q&&q.emit(e,t)}const ne={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function re(e,t){return null!=t.locale?ae(t.locale):ae(e.locale)}let oe;function ae(e){if(E(e))return e;if(f(e)){if(e.resolvedOnce&&null!=oe)return oe;if("Function"===e.constructor.name){const t=e();if(d(t))throw Error(ne.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return oe=t}throw Error(ne.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(ne.NOT_SUPPORT_LOCALE_TYPE)}function se(e,t,n){return[...new Set([n,...u(t)?t:m(t)?Object.keys(t):E(t)?[t]:[n]])]}function ce(e,t,n){const r=E(n)?n:ke,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let a=o.__localeChainCache.get(r);if(!a){a=[];let e=[n];for(;u(e);)e=le(a,e,t);const s=u(t)||!L(t)?t:t.default?t.default:null;e=E(s)?[s]:s,u(e)&&le(a,e,!1),o.__localeChainCache.set(r,a)}return a}function le(e,t,n){let r=!0;for(let o=0;o<t.length&&_(r);o++){const a=t[o];E(a)&&(r=ie(e,t[o],n))}return r}function ie(e,t,n){let r;const o=t.split("-");do{r=ue(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function ue(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(u(n)||L(n))&&n[o]&&(r=n[o])}return r}ne.INVALID_ARGUMENT,ne.INVALID_DATE_ARGUMENT,ne.INVALID_ISO_DATE_ARGUMENT,ne.NOT_SUPPORT_NON_STRING_MESSAGE,ne.NOT_SUPPORT_LOCALE_PROMISE_VALUE,ne.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,ne.NOT_SUPPORT_LOCALE_TYPE;const fe=[];fe[0]={w:[0],i:[3,0],"[":[4],o:[7]},fe[1]={w:[1],".":[2],"[":[4],o:[7]},fe[2]={w:[2],i:[3,0],0:[3,0]},fe[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},fe[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},fe[5]={"'":[4,0],o:8,l:[5,0]},fe[6]={'"':[4,0],o:8,l:[6,0]};const Ee=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function _e(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 me(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,Ee.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 de(e){const t=[];let n,r,o,a,s,c,l,i=-1,u=0,f=0;const E=[];function _(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,o="\\"+t,E[0](),!0}for(E[0]=()=>{void 0===r?r=o:r+=o},E[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},E[2]=()=>{E[0](),f++},E[3]=()=>{if(f>0)f--,u=4,E[0]();else{if(f=0,void 0===r)return!1;if(r=me(r),!1===r)return!1;E[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!_()){if(a=_e(n),l=fe[u],s=l[a]||l.l||8,8===s)return;if(u=s[0],void 0!==s[1]&&(c=E[s[1]],c&&(o=n,!1===c())))return;if(7===u)return t}}const pe=new Map;function Ne(e,t){return m(e)?e[t]:null}function Le(e,t){if(!m(e))return null;let n=pe.get(t);if(n||(n=de(t),n&&pe.set(t,n)),!n)return null;const r=n.length;let o=e,a=0;for(;a<r;){const e=o[n[a]];if(void 0===e)return null;if(f(o))return null;o=e,a++}return o}const Te={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},Ae={[Te.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Te.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Te.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Te.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Te.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Te.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Te.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."};const Ce="10.0.0",ke="en-US",he=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let Oe,Ie,ge;function Se(e){Oe=e}function ye(e){Ie=e}function be(e){ge=e}let De=null;let Pe=null;let Re=0;function Me(e,t,n,r,o){const{missing:a,onWarn:s}=e;if(null!==a){const r=a(e,n,t,o);return E(r)?r:t}return t}function Ue(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function ve(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(Ue(e,t[r]))return!0;return!1}const Fe=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function xe(...e){const[t,n,r,s]=e,c={};let l,i={};if(E(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(ne.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{throw Error(ne.INVALID_ISO_DATE_ARGUMENT)}}else if(a(t)){if(isNaN(t.getTime()))throw Error(ne.INVALID_DATE_ARGUMENT);l=t}else{if(!o(t))throw Error(ne.INVALID_ARGUMENT);l=t}return E(n)?c.key=n:L(n)&&Object.keys(n).forEach((e=>{Fe.includes(e)?i[e]=n[e]:c[e]=n[e]})),E(r)?c.locale=r:L(r)&&(i=r),L(s)&&(i=s),[c.key||"",l,c,i]}const we=["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,n,r,a]=e,s={};let c={};if(!o(t))throw Error(ne.INVALID_ARGUMENT);const l=t;return E(n)?s.key=n:L(n)&&Object.keys(n).forEach((e=>{we.includes(e)?c[e]=n[e]:s[e]=n[e]})),E(r)?s.locale=r:L(r)&&(c=r),L(a)&&(c=a),[s.key||"",l,s,c]}const Ye=e=>e,Ge=e=>"",Ke="text",Xe=e=>0===e.length?"":T(e),Ve=e=>null==e?"":u(e)||L(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function $e(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function He(e={}){const t=e.locale,n=function(e){const t=o(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(o(e.named.count)||o(e.named.n))?o(e.named.count)?e.named.count:o(e.named.n)?e.named.n:t:t}(e),r=m(e.pluralRules)&&E(t)&&f(e.pluralRules[t])?e.pluralRules[t]:$e,a=m(e.pluralRules)&&E(t)&&f(e.pluralRules[t])?$e:void 0,s=e.list||[],c=e.named||{};o(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,c);function i(t,n){const r=f(e.messages)?e.messages(t,!!n):!!m(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):Ge)}const _=L(e.processor)&&f(e.processor.normalize)?e.processor.normalize:Xe,d=L(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:Ve,p={list:e=>s[e],named:e=>c[e],plural:e=>e[r(n,e.length,a)],linked:(t,...n)=>{const[r,o]=n;let a="text",s="";1===n.length?m(r)?(s=r.modifier||s,a=r.type||a):E(r)&&(s=r||s):2===n.length&&(E(r)&&(s=r||s),E(o)&&(a=o||a));const c=i(t,!0)(p),l="vnode"===a&&u(c)&&s?c[0]:c;return s?(f=s,e.modifiers?e.modifiers[f]:Ye)(l,a):l;var f},message:i,type:L(e.processor)&&E(e.processor.type)?e.processor.type:Ke,interpolate:d,normalize:_,values:l({},s,c)};return p}const Be=()=>"",je=e=>f(e);function ze(e,t,n,r,o,a){const{messages:s,onWarn:c,messageResolver:l,localeFallbacker:i}=e,u=i(e,r,n);let f,_={},m=null;for(let d=0;d<u.length&&(f=u[d],_=s[f]||{},null===(m=l(_,t))&&(m=_[t]),!(E(m)||J(m)||je(m)));d++)if(!ve(f,u)){const n=Me(e,t,f,0,"translate");n!==t&&(m=n)}return[m,f,_]}function Qe(e,t,r,o,a,s){const{messageCompiler:c,warnHtmlMessage:l}=e;if(je(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==c){const e=()=>o;return e.locale=r,e.key=t,e}const i=c(o,function(e,t,r,o,a,s){return{locale:t,key:r,warnHtmlMessage:a,onError:e=>{throw s&&s(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,a,0,l,s));return i.locale=r,i.key=t,i.source=o,i}function Je(...e){const[t,n,r]=e,a={};if(!(E(t)||o(t)||je(t)||J(t)))throw Error(ne.INVALID_ARGUMENT);const s=o(t)?String(t):(je(t),t);return o(n)?a.plural=n:E(n)?a.default=n:L(n)&&!c(n)?a.named=n:u(n)&&(a.list=n),o(r)?a.plural=r:E(r)?a.default=r:L(r)&&l(a,r),[s,a]}return Se(Z),ye(Le),be(ce),e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=8,e.CompileErrorCodes=k,e.CoreErrorCodes=ne,e.CoreWarnCodes=Te,e.DATETIME_FORMAT_OPTIONS_KEYS=Fe,e.DEFAULT_LOCALE=ke,e.DEFAULT_MESSAGE_DATA_TYPE=Ke,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=we,e.VERSION=Ce,e.clearCompileCache=function(){Q=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compile=Z,e.createCompileError=h,e.createCoreContext=function(e={}){const t=f(e.onWarn)?e.onWarn:A,n=E(e.version)?e.version:Ce,r=E(e.locale)||f(e.locale)?e.locale:ke,o=f(r)?ke:r,a=u(e.fallbackLocale)||L(e.fallbackLocale)||E(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:o,c=L(e.messages)?e.messages:{[o]:{}},i=L(e.datetimeFormats)?e.datetimeFormats:{[o]:{}},d=L(e.numberFormats)?e.numberFormats:{[o]:{}},p=l({},e.modifiers||{},{upper:(e,t)=>"text"===t&&E(e)?e.toUpperCase():"vnode"===t&&m(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&E(e)?e.toLowerCase():"vnode"===t&&m(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&E(e)?he(e):"vnode"===t&&m(e)&&"__v_isVNode"in e?he(e.children):e}),N=e.pluralRules||{},T=f(e.missing)?e.missing:null,C=!_(e.missingWarn)&&!s(e.missingWarn)||e.missingWarn,k=!_(e.fallbackWarn)&&!s(e.fallbackWarn)||e.fallbackWarn,h=!!e.fallbackFormat,O=!!e.unresolving,I=f(e.postTranslation)?e.postTranslation:null,g=L(e.processor)?e.processor:null,S=!_(e.warnHtmlMessage)||e.warnHtmlMessage,y=!!e.escapeParameter,b=f(e.messageCompiler)?e.messageCompiler:Oe,D=f(e.messageResolver)?e.messageResolver:Ie||Ne,P=f(e.localeFallbacker)?e.localeFallbacker:ge||se,R=m(e.fallbackContext)?e.fallbackContext:void 0,M=e,U=m(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,v=m(M.__numberFormatters)?M.__numberFormatters:new Map,F=m(M.__meta)?M.__meta:{};Re++;const x={version:n,cid:Re,locale:r,fallbackLocale:a,messages:c,modifiers:p,pluralRules:N,missing:T,missingWarn:C,fallbackWarn:k,fallbackFormat:h,unresolving:O,postTranslation:I,processor:g,warnHtmlMessage:S,escapeParameter:y,messageCompiler:b,messageResolver:D,localeFallbacker:P,fallbackContext:R,onWarn:t,__meta:F};return x.datetimeFormats=i,x.numberFormats=d,x.__datetimeFormatters=U,x.__numberFormatters=v,x},e.createCoreError=function(e){return h(e,null,void 0)},e.createMessageContext=He,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:a,localeFallbacker:s}=e,{__datetimeFormatters:i}=e,[u,f,m,d]=xe(...t);_(m.missingWarn)?m.missingWarn:e.missingWarn,_(m.fallbackWarn)?m.fallbackWarn:e.fallbackWarn;const p=!!m.part,N=re(e,m),T=s(e,o,N);if(!E(u)||""===u)return new Intl.DateTimeFormat(N,d).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[u],!L(k));c++)Me(e,u,A,0,"datetime format");if(!L(k)||!E(A))return r?-1:u;let h=`${A}__${u}`;c(d)||(h=`${h}__${JSON.stringify(d)}`);let O=i.get(h);return O||(O=new Intl.DateTimeFormat(A,l({},k,d)),i.set(h,O)),p?O.formatToParts(f):O.format(f)},e.fallbackWithLocaleChain=ce,e.fallbackWithSimple=se,e.getAdditionalMeta=()=>De,e.getDevToolsHook=function(){return q},e.getFallbackContext=()=>Pe,e.getLocale=re,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&m(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(Ae[e],...n)},e.handleMissing=Me,e.initI18nDevTools=function(e,t,n){q&&q.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=Ue,e.isImplicitFallback=ve,e.isMessageAST=J,e.isMessageFunction=je,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:o,onWarn:a,localeFallbacker:s}=e,{__numberFormatters:i}=e,[u,f,m,d]=We(...t);_(m.missingWarn)?m.missingWarn:e.missingWarn,_(m.fallbackWarn)?m.fallbackWarn:e.fallbackWarn;const p=!!m.part,N=re(e,m),T=s(e,o,N);if(!E(u)||""===u)return new Intl.NumberFormat(N,d).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[u],!L(k));c++)Me(e,u,A,0,"number format");if(!L(k)||!E(A))return r?-1:u;let h=`${A}__${u}`;c(d)||(h=`${h}__${JSON.stringify(d)}`);let O=i.get(h);return O||(O=new Intl.NumberFormat(A,l({},k,d)),i.set(h,O)),p?O.formatToParts(f):O.format(f)},e.parse=de,e.parseDateTimeArgs=xe,e.parseNumberArgs=We,e.parseTranslateArgs=Je,e.registerLocaleFallbacker=be,e.registerMessageCompiler=Se,e.registerMessageResolver=ye,e.resolveLocale=ae,e.resolveValue=Le,e.resolveWithKeyValue=Ne,e.setAdditionalMeta=e=>{De=e},e.setDevToolsHook=function(e){q=e},e.setFallbackContext=e=>{Pe=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:a,messageCompiler:s,fallbackLocale:c,messages:l}=e,[d,p]=Je(...t),N=_(p.missingWarn)?p.missingWarn:e.missingWarn,L=_(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn,T=_(p.escapeParameter)?p.escapeParameter:e.escapeParameter,A=!!p.resolvedMessage,C=E(p.default)||_(p.default)?_(p.default)?s?d:()=>d:p.default:n?s?d:()=>d:null,k=n||null!=C&&(E(C)||f(C)),h=re(e,p);T&&function(e){u(e.list)?e.list=e.list.map((e=>E(e)?i(e):e)):m(e.named)&&Object.keys(e.named).forEach((t=>{E(e.named[t])&&(e.named[t]=i(e.named[t]))}))}(p);let[O,I,g]=A?[d,h,l[h]||{}]:ze(e,d,h,c,L,N),S=O,y=d;if(A||E(S)||J(S)||je(S)||k&&(S=C,y=S),!(A||(E(S)||J(S)||je(S))&&E(I)))return a?-1:d;let b=!1;const D=je(S)?S:Qe(e,d,I,S,y,(()=>{b=!0}));if(b)return S;const P=function(e,t,n,r){const{modifiers:a,pluralRules:s,messageResolver:c,fallbackLocale:l,fallbackWarn:i,missingWarn:u,fallbackContext:f}=e,_=(r,o)=>{let a=c(n,r);if(null==a&&(f||o)){const[,,n]=ze(f||e,r,t,l,i,u);a=c(n,r)}if(E(a)||J(a)){let n=!1;const o=Qe(e,r,t,a,r,(()=>{n=!0}));return n?Be:o}return je(a)?a:Be},m={locale:t,modifiers:a,pluralRules:s,messages:_};e.processor&&(m.processor=e.processor);r.list&&(m.list=r.list);r.named&&(m.named=r.named);o(r.plural)&&(m.pluralIndex=r.plural);return m}(e,I,g,p),R=function(e,t,n){const r=t(n);return r}(0,D,He(P));return r?r(R,d):R},e.translateDevTools=ee,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({});
|
|
6
|
+
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),o=e=>"number"==typeof e&&isFinite(e),a=e=>"[object Date]"===N(e),s=e=>"[object RegExp]"===N(e),c=e=>L(e)&&0===Object.keys(e).length,l=Object.assign;function i(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const u=Array.isArray,f=e=>"function"==typeof e,E=e=>"string"==typeof e,_=e=>"boolean"==typeof e,m=e=>null!==e&&"object"==typeof e,d=e=>m(e)&&f(e.then)&&f(e.catch),p=Object.prototype.toString,N=e=>p.call(e),L=e=>"[object Object]"===N(e);function T(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}function A(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function C(e,t,n){return{start:e,end:t}}const k={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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function h(e,t,n={}){const{domain:r,messages:o,args:a}=n,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=r,s}function O(e){throw e}k.EXPECTED_TOKEN,k.INVALID_TOKEN_IN_PLACEHOLDER,k.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,k.UNKNOWN_ESCAPE_SEQUENCE,k.INVALID_UNICODE_ESCAPE_SEQUENCE,k.UNBALANCED_CLOSING_BRACE,k.UNTERMINATED_CLOSING_BRACE,k.EMPTY_PLACEHOLDER,k.NOT_ALLOW_NEST_PLACEHOLDER,k.INVALID_LINKED_FORMAT,k.MUST_HAVE_MESSAGES_IN_PLURAL,k.UNEXPECTED_EMPTY_LINKED_MODIFIER,k.UNEXPECTED_EMPTY_LINKED_KEY,k.UNEXPECTED_LEXICAL_ANALYSIS,k.UNHANDLED_CODEGEN_NODE_TYPE,k.UNHANDLED_MINIFIER_NODE_TYPE;const I=" ",g="\r",S="\n",y=String.fromCharCode(8232),b=String.fromCharCode(8233);function D(e){const t=e;let n=0,r=1,o=1,a=0;const s=e=>t[e]===g&&t[e+1]===S,c=e=>t[e]===b,l=e=>t[e]===y,i=e=>s(e)||(e=>t[e]===S)(e)||c(e)||l(e),u=e=>s(e)||c(e)||l(e)?S:t[e];function f(){return a=0,i(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>a,charAt:u,currentChar:()=>u(n),currentPeek:()=>u(n+a),next:f,peek:function(){return s(n+a)&&a++,a++,t[n+a]},reset:function(){n=0,r=1,o=1,a=0},resetPeek:function(e=0){a=e},skipToPeek:function(){const e=n+a;for(;e!==n;)f();a=0}}}const P=void 0,R="'";function M(e,t={}){const n=!1!==t.location,r=D(e),o=()=>r.index(),a=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=a(),c=o(),l={currentType:13,offset:c,startLoc:s,endLoc:s,lastType:13,lastOffset:c,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},i=()=>l,{onError:u}=t;function f(e,t,r){e.endLoc=a(),e.currentType=t;const o={type:t};return n&&(o.loc=C(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const E=e=>f(e,13);function _(e,t){return e.currentChar()===t?(e.next(),t):(k.EXPECTED_TOKEN,a(),"")}function m(e){let t="";for(;e.currentPeek()===I||e.currentPeek()===S;)t+=e.currentPeek(),e.peek();return t}function d(e){const t=m(e);return e.skipToPeek(),t}function p(e){if(e===P)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function N(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=function(e){if(e===P)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function L(e){m(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function T(e,t=!0){const n=(t=!1,r="")=>{const o=e.currentPeek();return"{"===o?t:"@"!==o&&o?"|"===o?!(r===I||r===S):o===I?(e.peek(),n(!0,I)):o!==S||(e.peek(),n(!0,S)):t},r=n();return t&&e.resetPeek(),r}function A(e,t){const n=e.currentChar();return n===P?P:t(n)?(e.next(),n):null}function h(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}function O(e){return A(e,h)}function g(e){const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t||45===t}function y(e){return A(e,g)}function b(e){const t=e.charCodeAt(0);return t>=48&&t<=57}function M(e){return A(e,b)}function U(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function v(e){return A(e,U)}function F(e){let t="",n="";for(;t=M(e);)n+=t;return n}function x(e){return e!==R&&e!==S}function w(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return W(e,t,4);case"U":return W(e,t,6);default:return k.UNKNOWN_ESCAPE_SEQUENCE,a(),""}}function W(e,t,n){_(e,t);let r="";for(let o=0;o<n;o++){const t=v(e);if(!t){k.INVALID_UNICODE_ESCAPE_SEQUENCE,a(),e.currentChar();break}r+=t}return`\\${t}${r}`}function Y(e){return"{"!==e&&"}"!==e&&e!==I&&e!==S}function G(e){d(e);const t=_(e,"|");return d(e),t}function K(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(k.NOT_ALLOW_NEST_PLACEHOLDER,a()),e.next(),n=f(t,2,"{"),d(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&(k.EMPTY_PLACEHOLDER,a()),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&d(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&(k.UNTERMINATED_CLOSING_BRACE,a()),n=X(e,t)||E(t),t.braceNest=0,n;default:{let r=!0,o=!0,s=!0;if(L(e))return t.braceNest>0&&(k.UNTERMINATED_CLOSING_BRACE,a()),n=f(t,1,G(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return k.UNTERMINATED_CLOSING_BRACE,a(),t.braceNest=0,V(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=p(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,4,function(e){d(e);let t="",n="";for(;t=y(e);)n+=t;return e.currentChar()===P&&(k.UNTERMINATED_CLOSING_BRACE,a()),n}(e)),d(e),n;if(o=N(e,t))return n=f(t,5,function(e){d(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${F(e)}`):t+=F(e),e.currentChar()===P&&(k.UNTERMINATED_CLOSING_BRACE,a()),t}(e)),d(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;m(e);const r=e.currentPeek()===R;return e.resetPeek(),r}(e,t))return n=f(t,6,function(e){d(e),_(e,"'");let t="",n="";for(;t=A(e,x);)n+="\\"===t?w(e):t;const r=e.currentChar();return r===S||r===P?(k.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,a(),r===S&&(e.next(),_(e,"'")),n):(_(e,"'"),n)}(e)),d(e),n;if(!r&&!o&&!s)return n=f(t,12,function(e){d(e);let t="",n="";for(;t=A(e,Y);)n+=t;return n}(e)),k.INVALID_TOKEN_IN_PLACEHOLDER,a(),n.value,d(e),n;break}}return n}function X(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(7!==n&&8!==n&&11!==n&&9!==n||o!==S&&o!==I||(k.INVALID_LINKED_FORMAT,a()),o){case"@":return e.next(),r=f(t,7,"@"),t.inLinked=!0,r;case".":return d(e),e.next(),f(t,8,".");case":":return d(e),e.next(),f(t,9,":");default:return L(e)?(r=f(t,1,G(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(7!==n)return!1;m(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(7!==n&&11!==n)return!1;m(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(d(e),X(e,t)):function(e,t){const{currentType:n}=t;if(8!==n)return!1;m(e);const r=p(e.currentPeek());return e.resetPeek(),r}(e,t)?(d(e),f(t,11,function(e){let t="",n="";for(;t=O(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(9!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?p(e.peek()):!("@"===t||"|"===t||":"===t||"."===t||t===I||!t)&&(t===S?(e.peek(),r()):T(e,!1))},o=r();return e.resetPeek(),o}(e,t)?(d(e),"{"===o?K(e,t)||r:f(t,10,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"@"!==r&&"|"!==r&&"("!==r&&")"!==r&&r?r===I?n:(n+=r,e.next(),t(n)):n};return t("")}(e))):(7===n&&(k.INVALID_LINKED_FORMAT,a()),t.braceNest=0,t.inLinked=!1,V(e,t))}}function V(e,t){let n={type:13};if(t.braceNest>0)return K(e,t)||E(t);if(t.inLinked)return X(e,t)||E(t);switch(e.currentChar()){case"{":return K(e,t)||E(t);case"}":return k.UNBALANCED_CLOSING_BRACE,a(),e.next(),f(t,3,"}");case"@":return X(e,t)||E(t);default:if(L(e))return n=f(t,1,G(e)),t.braceNest=0,t.inLinked=!1,n;if(T(e))return f(t,0,function(e){let t="";for(;;){const n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if(n===I||n===S)if(T(e))t+=n,e.next();else{if(L(e))break;t+=n,e.next()}else t+=n,e.next()}return t}(e))}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=s,l.offset=o(),l.startLoc=a(),r.currentChar()===P?f(l,13):V(r,l)},currentOffset:o,currentPosition:a,context:i}}const U=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function v(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function F(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e};return t&&(o.start=n,o.end=n,o.loc={start:r,end:r}),o}function o(e,n,r,o){t&&(e.end=n,e.loc&&(e.loc.end=r))}function a(e,t){const n=e.context(),a=r(3,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}function s(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(5,a,s);return c.index=parseInt(t,10),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function c(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(4,a,s);return c.key=t,e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function i(e,t){const n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(9,a,s);return c.value=t.replace(U,v),e.nextToken(),o(c,e.currentOffset(),e.currentPosition()),c}function u(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let a=e.nextToken();if(8===a.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:a,lastStartLoc:s}=n,c=r(8,a,s);return 11!==t.type?(k.UNEXPECTED_EMPTY_LINKED_MODIFIER,n.lastStartLoc,c.value="",o(c,a,s),{nextConsumeToken:t,node:c}):(null==t.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,n.lastStartLoc,x(t)),c.value=t.value||"",o(c,e.currentOffset(),e.currentPosition()),{node:c})}(e);n.modifier=t.node,a=t.nextConsumeToken||e.nextToken()}switch(9!==a.type&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),a=e.nextToken(),2===a.type&&(a=e.nextToken()),a.type){case 10:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=function(e,t){const n=e.context(),a=r(7,n.offset,n.startLoc);return a.value=t,o(a,e.currentOffset(),e.currentPosition()),a}(e,a.value||"");break;case 4:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=c(e,a.value||"");break;case 5:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=s(e,a.value||"");break;case 6:null==a.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(a)),n.key=i(e,a.value||"");break;default:{k.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const s=e.context(),c=r(7,s.offset,s.startLoc);return c.value="",o(c,s.offset,s.startLoc),n.key=c,o(n,s.offset,s.startLoc),{nextConsumeToken:a,node:n}}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let l=null;do{const r=l||e.nextToken();switch(l=null,r.type){case 0:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(a(e,r.value||""));break;case 5:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(s(e,r.value||""));break;case 4:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(c(e,r.value||""));break;case 6:null==r.value&&(k.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,x(r)),n.items.push(i(e,r.value||""));break;case 7:{const t=u(e);n.items.push(t.node),l=t.nextConsumeToken||null;break}}}while(13!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function E(e){const t=e.context(),{offset:n,startLoc:a}=t,s=f(e);return 13===t.currentType?s:function(e,t,n,a){const s=e.context();let c=0===a.items.length;const l=r(1,t,n);l.cases=[],l.cases.push(a);do{const t=f(e);c||(c=0===t.items.length),l.cases.push(t)}while(13!==s.currentType);return c&&k.MUST_HAVE_MESSAGES_IN_PLURAL,o(l,e.currentOffset(),e.currentPosition()),l}(e,n,a,s)}return{parse:function(n){const a=M(n,l({},e)),s=a.context(),c=r(0,s.offset,s.startLoc);return t&&c.loc&&(c.loc.source=n),c.body=E(a),e.onCacheKey&&(c.cacheKey=e.onCacheKey(n)),13!==s.currentType&&(k.UNEXPECTED_LEXICAL_ANALYSIS,s.lastStartLoc,n[s.offset]),o(c,a.currentOffset(),a.currentPosition()),c}}}function x(e){if(13===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function w(e,t){for(let n=0;n<e.length;n++)W(e[n],t)}function W(e,t){switch(e.type){case 1:w(e.cases,t),t.helper("plural");break;case 2:w(e.items,t);break;case 6:W(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function Y(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&W(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function G(e){if(1===e.items.length){const t=e.items[0];3!==t.type&&9!==t.type||(e.static=t.value,delete t.value)}else{const t=[];for(let n=0;n<e.items.length;n++){const r=e.items[n];if(3!==r.type&&9!==r.type)break;if(null==r.value)break;t.push(r.value)}if(t.length===e.items.length){e.static=T(t);for(let t=0;t<e.items.length;t++){const n=e.items[t];3!==n.type&&9!==n.type||delete n.value}}}}function K(e){switch(e.t=e.type,e.type){case 0:{const t=e;K(t.body),t.b=t.body,delete t.body;break}case 1:{const t=e,n=t.cases;for(let e=0;e<n.length;e++)K(n[e]);t.c=n,delete t.cases;break}case 2:{const t=e,n=t.items;for(let e=0;e<n.length;e++)K(n[e]);t.i=n,delete t.items,t.static&&(t.s=t.static,delete t.static);break}case 3:case 9:case 8:case 7:{const t=e;t.value&&(t.v=t.value,delete t.value);break}case 6:{const t=e;K(t.key),t.k=t.key,delete t.key,t.modifier&&(K(t.modifier),t.m=t.modifier,delete t.modifier);break}case 5:{const t=e;t.i=t.index,delete t.index;break}case 4:{const t=e;t.k=t.key,delete t.key;break}}delete e.type}function X(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?X(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(X(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let a=0;a<o&&(X(e,t.items[a]),a!==o-1);a++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),X(e,t.key),t.modifier?(e.push(", "),X(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t)}}const V=(e,t={})=>{const n=E(t.mode)?t.mode:"normal",r=E(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,a=null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",s=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],l=function(e,t){const{sourceMap:n,filename:r,breakLineCode:o,needIndent:a}=t,s=!1!==t.location,c={filename:r,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:a,indentLevel:0};function l(e,t){c.code+=e}function i(e,t=!0){const n=t?o:"";l(a?n+" ".repeat(e):n)}return s&&e.loc&&(c.source=e.loc.source),{context:()=>c,push:l,indent:function(e=!0){const t=++c.indentLevel;e&&i(t)},deindent:function(e=!0){const t=--c.indentLevel;e&&i(t)},newline:function(){i(c.indentLevel)},helper:e=>`_${e}`,needIndent:()=>c.needIndent}}(e,{mode:n,filename:r,sourceMap:o,breakLineCode:a,needIndent:s});l.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(s),c.length>0&&(l.push(`const { ${T(c.map((e=>`${e}: _${e}`)),", ")} } = ctx`),l.newline()),l.push("return "),X(l,e),l.deindent(s),l.push("}"),delete e.helpers;const{code:i,map:u}=l.context();return{ast:e,code:i,map:u?u.toJSON():void 0}};function $(e,t={}){const n=l({},t),r=!!n.jit,o=!!n.minify,a=null==n.optimize||n.optimize,s=F(n).parse(e);return r?(a&&function(e){const t=e.body;2===t.type?G(t):t.cases.forEach((e=>G(e)))}(s),o&&K(s),{ast:s,code:""}):(Y(s,n),V(s,n))}function H(e){return t=>function(e,t){const n=t.b||t.body;if(1===(n.t||n.type)){const t=n,r=t.c||t.cases;return e.plural(r.reduce(((t,n)=>[...t,B(e,n)]),[]))}return B(e,n)}(t,e)}function B(e,t){const n=t.s||t.static;if(n)return"text"===e.type?n:e.normalize([n]);{const n=(t.i||t.items).reduce(((t,n)=>[...t,j(e,n)]),[]);return e.normalize(n)}}function j(e,t){const n=t.t||t.type;switch(n){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const n=t;return e.interpolate(e.named(n.k||n.key))}case 5:{const n=t;return e.interpolate(e.list(null!=n.i?n.i:n.index))}case 6:{const n=t,r=n.m||n.modifier;return e.linked(j(e,n.k||n.key),r?j(e,r):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${n}`)}}const z=e=>e;let Q=Object.create(null);const J=e=>m(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function Z(e,t){if(E(e)){!_(t.warnHtmlMessage)||t.warnHtmlMessage;const n=(t.onCacheKey||z)(e),r=Q[n];if(r)return r;const{ast:o,detectError:a}=function(e,t={}){let n=!1;const r=t.onError||O;return t.onError=e=>{n=!0,r(e)},{...$(e,t),detectError:n}}(e,{...t,location:!1,jit:!0}),s=H(o);return a?s:Q[n]=s}{const t=e.cacheKey;if(t){const n=Q[t];return n||(Q[t]=H(e))}return H(e)}}let q=null;const ee=te("function:translate");function te(e){return t=>q&&q.emit(e,t)}const ne={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function re(e,t){return null!=t.locale?ae(t.locale):ae(e.locale)}let oe;function ae(e){if(E(e))return e;if(f(e)){if(e.resolvedOnce&&null!=oe)return oe;if("Function"===e.constructor.name){const t=e();if(d(t))throw Error(ne.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return oe=t}throw Error(ne.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(ne.NOT_SUPPORT_LOCALE_TYPE)}function se(e,t,n){return[...new Set([n,...u(t)?t:m(t)?Object.keys(t):E(t)?[t]:[n]])]}function ce(e,t,n){const r=E(n)?n:ke,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let a=o.__localeChainCache.get(r);if(!a){a=[];let e=[n];for(;u(e);)e=le(a,e,t);const s=u(t)||!L(t)?t:t.default?t.default:null;e=E(s)?[s]:s,u(e)&&le(a,e,!1),o.__localeChainCache.set(r,a)}return a}function le(e,t,n){let r=!0;for(let o=0;o<t.length&&_(r);o++){const a=t[o];E(a)&&(r=ie(e,t[o],n))}return r}function ie(e,t,n){let r;const o=t.split("-");do{r=ue(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function ue(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(u(n)||L(n))&&n[o]&&(r=n[o])}return r}ne.INVALID_ARGUMENT,ne.INVALID_DATE_ARGUMENT,ne.INVALID_ISO_DATE_ARGUMENT,ne.NOT_SUPPORT_NON_STRING_MESSAGE,ne.NOT_SUPPORT_LOCALE_PROMISE_VALUE,ne.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,ne.NOT_SUPPORT_LOCALE_TYPE;const fe=[];fe[0]={w:[0],i:[3,0],"[":[4],o:[7]},fe[1]={w:[1],".":[2],"[":[4],o:[7]},fe[2]={w:[2],i:[3,0],0:[3,0]},fe[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},fe[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},fe[5]={"'":[4,0],o:8,l:[5,0]},fe[6]={'"':[4,0],o:8,l:[6,0]};const Ee=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function _e(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 me(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,Ee.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 de(e){const t=[];let n,r,o,a,s,c,l,i=-1,u=0,f=0;const E=[];function _(){const t=e[i+1];if(5===u&&"'"===t||6===u&&'"'===t)return i++,o="\\"+t,E[0](),!0}for(E[0]=()=>{void 0===r?r=o:r+=o},E[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},E[2]=()=>{E[0](),f++},E[3]=()=>{if(f>0)f--,u=4,E[0]();else{if(f=0,void 0===r)return!1;if(r=me(r),!1===r)return!1;E[1]()}};null!==u;)if(i++,n=e[i],"\\"!==n||!_()){if(a=_e(n),l=fe[u],s=l[a]||l.l||8,8===s)return;if(u=s[0],void 0!==s[1]&&(c=E[s[1]],c&&(o=n,!1===c())))return;if(7===u)return t}}const pe=new Map;function Ne(e,t){return m(e)?e[t]:null}function Le(e,t){if(!m(e))return null;let n=pe.get(t);if(n||(n=de(t),n&&pe.set(t,n)),!n)return null;const r=n.length;let o=e,a=0;for(;a<r;){const e=o[n[a]];if(void 0===e)return null;if(f(o))return null;o=e,a++}return o}const Te={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},Ae={[Te.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Te.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Te.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Te.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Te.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Te.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Te.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."};const Ce="10.0.2",ke="en-US",he=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let Oe,Ie,ge;function Se(e){Oe=e}function ye(e){Ie=e}function be(e){ge=e}let De=null;let Pe=null;let Re=0;function Me(e,t,n,r,o){const{missing:a,onWarn:s}=e;if(null!==a){const r=a(e,n,t,o);return E(r)?r:t}return t}function Ue(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function ve(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(Ue(e,t[r]))return!0;return!1}const Fe=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function xe(...e){const[t,n,r,s]=e,c={};let l,i={};if(E(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(ne.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{throw Error(ne.INVALID_ISO_DATE_ARGUMENT)}}else if(a(t)){if(isNaN(t.getTime()))throw Error(ne.INVALID_DATE_ARGUMENT);l=t}else{if(!o(t))throw Error(ne.INVALID_ARGUMENT);l=t}return E(n)?c.key=n:L(n)&&Object.keys(n).forEach((e=>{Fe.includes(e)?i[e]=n[e]:c[e]=n[e]})),E(r)?c.locale=r:L(r)&&(i=r),L(s)&&(i=s),[c.key||"",l,c,i]}const we=["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,n,r,a]=e,s={};let c={};if(!o(t))throw Error(ne.INVALID_ARGUMENT);const l=t;return E(n)?s.key=n:L(n)&&Object.keys(n).forEach((e=>{we.includes(e)?c[e]=n[e]:s[e]=n[e]})),E(r)?s.locale=r:L(r)&&(c=r),L(a)&&(c=a),[s.key||"",l,s,c]}const Ye=e=>e,Ge=e=>"",Ke="text",Xe=e=>0===e.length?"":T(e),Ve=e=>null==e?"":u(e)||L(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function $e(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function He(e={}){const t=e.locale,n=function(e){const t=o(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(o(e.named.count)||o(e.named.n))?o(e.named.count)?e.named.count:o(e.named.n)?e.named.n:t:t}(e),r=m(e.pluralRules)&&E(t)&&f(e.pluralRules[t])?e.pluralRules[t]:$e,a=m(e.pluralRules)&&E(t)&&f(e.pluralRules[t])?$e:void 0,s=e.list||[],c=e.named||{};o(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,c);function i(t,n){const r=f(e.messages)?e.messages(t,!!n):!!m(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):Ge)}const _=L(e.processor)&&f(e.processor.normalize)?e.processor.normalize:Xe,d=L(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:Ve,p={list:e=>s[e],named:e=>c[e],plural:e=>e[r(n,e.length,a)],linked:(t,...n)=>{const[r,o]=n;let a="text",s="";1===n.length?m(r)?(s=r.modifier||s,a=r.type||a):E(r)&&(s=r||s):2===n.length&&(E(r)&&(s=r||s),E(o)&&(a=o||a));const c=i(t,!0)(p),l="vnode"===a&&u(c)&&s?c[0]:c;return s?(f=s,e.modifiers?e.modifiers[f]:Ye)(l,a):l;var f},message:i,type:L(e.processor)&&E(e.processor.type)?e.processor.type:Ke,interpolate:d,normalize:_,values:l({},s,c)};return p}const Be=()=>"",je=e=>f(e);function ze(e,t,n,r,o,a){const{messages:s,onWarn:c,messageResolver:l,localeFallbacker:i}=e,u=i(e,r,n);let f,_={},m=null;for(let d=0;d<u.length&&(f=u[d],_=s[f]||{},null===(m=l(_,t))&&(m=_[t]),!(E(m)||J(m)||je(m)));d++)if(!ve(f,u)){const n=Me(e,t,f,0,"translate");n!==t&&(m=n)}return[m,f,_]}function Qe(e,t,r,o,a,s){const{messageCompiler:c,warnHtmlMessage:l}=e;if(je(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==c){const e=()=>o;return e.locale=r,e.key=t,e}const i=c(o,function(e,t,r,o,a,s){return{locale:t,key:r,warnHtmlMessage:a,onError:e=>{throw s&&s(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,a,0,l,s));return i.locale=r,i.key=t,i.source=o,i}function Je(...e){const[t,n,r]=e,a={};if(!(E(t)||o(t)||je(t)||J(t)))throw Error(ne.INVALID_ARGUMENT);const s=o(t)?String(t):(je(t),t);return o(n)?a.plural=n:E(n)?a.default=n:L(n)&&!c(n)?a.named=n:u(n)&&(a.list=n),o(r)?a.plural=r:E(r)?a.default=r:L(r)&&l(a,r),[s,a]}return Se(Z),ye(Le),be(ce),e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=8,e.CompileErrorCodes=k,e.CoreErrorCodes=ne,e.CoreWarnCodes=Te,e.DATETIME_FORMAT_OPTIONS_KEYS=Fe,e.DEFAULT_LOCALE=ke,e.DEFAULT_MESSAGE_DATA_TYPE=Ke,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=we,e.VERSION=Ce,e.clearCompileCache=function(){Q=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const o in n){const e=`${t}__${o}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compile=Z,e.createCompileError=h,e.createCoreContext=function(e={}){const t=f(e.onWarn)?e.onWarn:A,n=E(e.version)?e.version:Ce,r=E(e.locale)||f(e.locale)?e.locale:ke,o=f(r)?ke:r,a=u(e.fallbackLocale)||L(e.fallbackLocale)||E(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:o,c=L(e.messages)?e.messages:{[o]:{}},i=L(e.datetimeFormats)?e.datetimeFormats:{[o]:{}},d=L(e.numberFormats)?e.numberFormats:{[o]:{}},p=l({},e.modifiers||{},{upper:(e,t)=>"text"===t&&E(e)?e.toUpperCase():"vnode"===t&&m(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&E(e)?e.toLowerCase():"vnode"===t&&m(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&E(e)?he(e):"vnode"===t&&m(e)&&"__v_isVNode"in e?he(e.children):e}),N=e.pluralRules||{},T=f(e.missing)?e.missing:null,C=!_(e.missingWarn)&&!s(e.missingWarn)||e.missingWarn,k=!_(e.fallbackWarn)&&!s(e.fallbackWarn)||e.fallbackWarn,h=!!e.fallbackFormat,O=!!e.unresolving,I=f(e.postTranslation)?e.postTranslation:null,g=L(e.processor)?e.processor:null,S=!_(e.warnHtmlMessage)||e.warnHtmlMessage,y=!!e.escapeParameter,b=f(e.messageCompiler)?e.messageCompiler:Oe,D=f(e.messageResolver)?e.messageResolver:Ie||Ne,P=f(e.localeFallbacker)?e.localeFallbacker:ge||se,R=m(e.fallbackContext)?e.fallbackContext:void 0,M=e,U=m(M.__datetimeFormatters)?M.__datetimeFormatters:new Map,v=m(M.__numberFormatters)?M.__numberFormatters:new Map,F=m(M.__meta)?M.__meta:{};Re++;const x={version:n,cid:Re,locale:r,fallbackLocale:a,messages:c,modifiers:p,pluralRules:N,missing:T,missingWarn:C,fallbackWarn:k,fallbackFormat:h,unresolving:O,postTranslation:I,processor:g,warnHtmlMessage:S,escapeParameter:y,messageCompiler:b,messageResolver:D,localeFallbacker:P,fallbackContext:R,onWarn:t,__meta:F};return x.datetimeFormats=i,x.numberFormats=d,x.__datetimeFormatters=U,x.__numberFormatters=v,x},e.createCoreError=function(e){return h(e,null,void 0)},e.createMessageContext=He,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:a,localeFallbacker:s}=e,{__datetimeFormatters:i}=e,[u,f,m,d]=xe(...t);_(m.missingWarn)?m.missingWarn:e.missingWarn,_(m.fallbackWarn)?m.fallbackWarn:e.fallbackWarn;const p=!!m.part,N=re(e,m),T=s(e,o,N);if(!E(u)||""===u)return new Intl.DateTimeFormat(N,d).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[u],!L(k));c++)Me(e,u,A,0,"datetime format");if(!L(k)||!E(A))return r?-1:u;let h=`${A}__${u}`;c(d)||(h=`${h}__${JSON.stringify(d)}`);let O=i.get(h);return O||(O=new Intl.DateTimeFormat(A,l({},k,d)),i.set(h,O)),p?O.formatToParts(f):O.format(f)},e.fallbackWithLocaleChain=ce,e.fallbackWithSimple=se,e.getAdditionalMeta=()=>De,e.getDevToolsHook=function(){return q},e.getFallbackContext=()=>Pe,e.getLocale=re,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&m(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(Ae[e],...n)},e.handleMissing=Me,e.initI18nDevTools=function(e,t,n){q&&q.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=Ue,e.isImplicitFallback=ve,e.isMessageAST=J,e.isMessageFunction=je,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:o,onWarn:a,localeFallbacker:s}=e,{__numberFormatters:i}=e,[u,f,m,d]=We(...t);_(m.missingWarn)?m.missingWarn:e.missingWarn,_(m.fallbackWarn)?m.fallbackWarn:e.fallbackWarn;const p=!!m.part,N=re(e,m),T=s(e,o,N);if(!E(u)||""===u)return new Intl.NumberFormat(N,d).format(f);let A,C={},k=null;for(let c=0;c<T.length&&(A=T[c],C=n[A]||{},k=C[u],!L(k));c++)Me(e,u,A,0,"number format");if(!L(k)||!E(A))return r?-1:u;let h=`${A}__${u}`;c(d)||(h=`${h}__${JSON.stringify(d)}`);let O=i.get(h);return O||(O=new Intl.NumberFormat(A,l({},k,d)),i.set(h,O)),p?O.formatToParts(f):O.format(f)},e.parse=de,e.parseDateTimeArgs=xe,e.parseNumberArgs=We,e.parseTranslateArgs=Je,e.registerLocaleFallbacker=be,e.registerMessageCompiler=Se,e.registerMessageResolver=ye,e.resolveLocale=ae,e.resolveValue=Le,e.resolveWithKeyValue=Ne,e.setAdditionalMeta=e=>{De=e},e.setDevToolsHook=function(e){q=e},e.setFallbackContext=e=>{Pe=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:a,messageCompiler:s,fallbackLocale:c,messages:l}=e,[d,p]=Je(...t),N=_(p.missingWarn)?p.missingWarn:e.missingWarn,L=_(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn,T=_(p.escapeParameter)?p.escapeParameter:e.escapeParameter,A=!!p.resolvedMessage,C=E(p.default)||_(p.default)?_(p.default)?s?d:()=>d:p.default:n?s?d:()=>d:null,k=n||null!=C&&(E(C)||f(C)),h=re(e,p);T&&function(e){u(e.list)?e.list=e.list.map((e=>E(e)?i(e):e)):m(e.named)&&Object.keys(e.named).forEach((t=>{E(e.named[t])&&(e.named[t]=i(e.named[t]))}))}(p);let[O,I,g]=A?[d,h,l[h]||{}]:ze(e,d,h,c,L,N),S=O,y=d;if(A||E(S)||J(S)||je(S)||k&&(S=C,y=S),!(A||(E(S)||J(S)||je(S))&&E(I)))return a?-1:d;let b=!1;const D=je(S)?S:Qe(e,d,I,S,y,(()=>{b=!0}));if(b)return S;const P=function(e,t,n,r){const{modifiers:a,pluralRules:s,messageResolver:c,fallbackLocale:l,fallbackWarn:i,missingWarn:u,fallbackContext:f}=e,_=(r,o)=>{let a=c(n,r);if(null==a&&(f||o)){const[,,n]=ze(f||e,r,t,l,i,u);a=c(n,r)}if(E(a)||J(a)){let n=!1;const o=Qe(e,r,t,a,r,(()=>{n=!0}));return n?Be:o}return je(a)?a:Be},m={locale:t,modifiers:a,pluralRules:s,messages:_};e.processor&&(m.processor=e.processor);r.list&&(m.list=r.list);r.named&&(m.named=r.named);o(r.plural)&&(m.pluralIndex=r.plural);return m}(e,I,g,p),R=function(e,t,n){const r=t(n);return r}(0,D,He(P));return r?r(R,d):R},e.translateDevTools=ee,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({});
|
package/dist/core.mjs
CHANGED
package/dist/core.node.mjs
CHANGED
package/dist/core.prod.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -14,6 +14,13 @@ coreBase.registerMessageResolver(coreBase.resolveValue);
|
|
|
14
14
|
// register fallback locale at @intlify/core
|
|
15
15
|
coreBase.registerLocaleFallbacker(coreBase.fallbackWithLocaleChain);
|
|
16
16
|
|
|
17
|
+
Object.prototype.hasOwnProperty.call(coreBase, '__proto__') &&
|
|
18
|
+
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
19
|
+
Object.defineProperty(exports, '__proto__', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
value: coreBase['__proto__']
|
|
22
|
+
});
|
|
23
|
+
|
|
17
24
|
Object.keys(coreBase).forEach(function (k) {
|
|
18
25
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = coreBase[k];
|
|
19
26
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -78,12 +78,7 @@ const isPromise = (val) => {
|
|
|
78
78
|
};
|
|
79
79
|
const objectToString = Object.prototype.toString;
|
|
80
80
|
const toTypeString = (value) => objectToString.call(value);
|
|
81
|
-
const isPlainObject = (val) =>
|
|
82
|
-
if (!isObject(val))
|
|
83
|
-
return false;
|
|
84
|
-
const proto = Object.getPrototypeOf(val);
|
|
85
|
-
return proto === null || proto.constructor === Object;
|
|
86
|
-
};
|
|
81
|
+
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
87
82
|
// for converting list and named values to displayed strings.
|
|
88
83
|
const toDisplayString = (val) => {
|
|
89
84
|
return val == null
|
|
@@ -502,7 +497,7 @@ function appendItemToChain(chain, target, blocks) {
|
|
|
502
497
|
return follow;
|
|
503
498
|
}
|
|
504
499
|
|
|
505
|
-
const pathStateMachine =
|
|
500
|
+
const pathStateMachine = [];
|
|
506
501
|
pathStateMachine[0 /* States.BEFORE_PATH */] = {
|
|
507
502
|
["w" /* PathCharTypes.WORKSPACE */]: [0 /* States.BEFORE_PATH */],
|
|
508
503
|
["i" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],
|
|
@@ -799,7 +794,7 @@ function getWarnMessage(code, ...args) {
|
|
|
799
794
|
* Intlify core-base version
|
|
800
795
|
* @internal
|
|
801
796
|
*/
|
|
802
|
-
const VERSION = '10.0.
|
|
797
|
+
const VERSION = '10.0.2';
|
|
803
798
|
const NOT_REOSLVED = -1;
|
|
804
799
|
const DEFAULT_LOCALE = 'en-US';
|
|
805
800
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -859,7 +854,7 @@ function registerLocaleFallbacker(fallbacker) {
|
|
|
859
854
|
_fallbacker = fallbacker;
|
|
860
855
|
}
|
|
861
856
|
// Additional Meta for Intlify DevTools
|
|
862
|
-
let _additionalMeta =
|
|
857
|
+
let _additionalMeta = null;
|
|
863
858
|
/* #__NO_SIDE_EFFECTS__ */
|
|
864
859
|
const setAdditionalMeta = (meta) => {
|
|
865
860
|
_additionalMeta = meta;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format$1(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,r)=>t.hasOwnProperty(r)?t[r]:""))}const generateFormatCacheKey=(e,t,r)=>friendlyJSONstringify({l:e,k:t,s:r}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length,assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,isPromise=e=>isObject(e)&&isFunction(e.then)&&isFunction(e.catch),objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>{if(!isObject(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object},toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e);function join(e,t=""){return e.reduce(((e,r,a)=>0===a?e+r:e+t+r),"")}function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const CompileErrorCodes={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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},COMPILE_ERROR_CODES_EXTEND_POINT=17;function createCompileError(e,t,r={}){const{domain:a,messages:n,args:s}=r,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=a,o}function format(e){return t=>formatParts(t,e)}function formatParts(e,t){const r=t.b||t.body;if(1===(r.t||r.type)){const t=r,a=t.c||t.cases;return e.plural(a.reduce(((t,r)=>[...t,formatMessageParts(e,r)]),[]))}return formatMessageParts(e,r)}function formatMessageParts(e,t){const r=t.s||t.static;if(r)return"text"===e.type?r:e.normalize([r]);{const r=(t.i||t.items).reduce(((t,r)=>[...t,formatMessagePart(e,r)]),[]);return e.normalize(r)}}function formatMessagePart(e,t){const r=t.t||t.type;switch(r){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const r=t;return e.interpolate(e.named(r.k||r.key))}case 5:{const r=t;return e.interpolate(e.list(null!=r.i?r.i:r.index))}case 6:{const r=t,a=r.m||r.modifier;return e.linked(formatMessagePart(e,r.k||r.key),a?formatMessagePart(e,a):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${r}`)}}let compileCache=Object.create(null);function clearCompileCache(){compileCache=Object.create(null)}const isMessageAST=e=>isObject(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function compile(e,t){{const t=e.cacheKey;if(t){const r=compileCache[t];return r||(compileCache[t]=format(e))}return format(e)}}let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,r){devtools&&devtools.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:r})}const translateDevTools=createDevToolsHook("function:translate");function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreErrorCodes={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},CORE_ERROR_CODES_EXTEND_POINT=24;function createCoreError(e){return createCompileError(e,null,void 0)}function getLocale(e,t){return null!=t.locale?resolveLocale(t.locale):resolveLocale(e.locale)}let _resolveLocale;function resolveLocale(e){if(isString(e))return e;if(isFunction(e)){if(e.resolvedOnce&&null!=_resolveLocale)return _resolveLocale;if("Function"===e.constructor.name){const t=e();if(isPromise(t))throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return _resolveLocale=t}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE)}function fallbackWithSimple(e,t,r){return[...new Set([r,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[r]])]}function fallbackWithLocaleChain(e,t,r){const a=isString(r)?r:DEFAULT_LOCALE,n=e;n.__localeChainCache||(n.__localeChainCache=new Map);let s=n.__localeChainCache.get(a);if(!s){s=[];let e=[r];for(;isArray(e);)e=appendBlockToChain(s,e,t);const o=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(o)?[o]:o,isArray(e)&&appendBlockToChain(s,e,!1),n.__localeChainCache.set(a,s)}return s}function appendBlockToChain(e,t,r){let a=!0;for(let n=0;n<t.length&&isBoolean(a);n++){const s=t[n];isString(s)&&(a=appendLocaleToChain(e,t[n],r))}return a}function appendLocaleToChain(e,t,r){let a;const n=t.split("-");do{a=appendItemToChain(e,n.join("-"),r),n.splice(-1,1)}while(n.length&&!0===a);return a}function appendItemToChain(e,t,r){let a=!1;if(!e.includes(t)&&(a=!0,t)){a="!"!==t[t.length-1];const n=t.replace(/!/g,"");e.push(n),(isArray(r)||isPlainObject(r))&&r[n]&&(a=r[n])}return a}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT,CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE,CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE,CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE;const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let r,a,n,s,o,i,l,c=-1,u=0,m=0;const _=[];function E(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,n="\\"+t,_[0](),!0}for(_[0]=()=>{void 0===a?a=n:a+=n},_[1]=()=>{void 0!==a&&(t.push(a),a=void 0)},_[2]=()=>{_[0](),m++},_[3]=()=>{if(m>0)m--,u=4,_[0]();else{if(m=0,void 0===a)return!1;if(a=formatSubPath(a),!1===a)return!1;_[1]()}};null!==u;)if(c++,r=e[c],"\\"!==r||!E()){if(s=getPathCharType(r),l=pathStateMachine[u],o=l[s]||l.l||8,8===o)return;if(u=o[0],void 0!==o[1]&&(i=_[o[1]],i&&(n=r,!1===i())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let r=cache.get(t);if(r||(r=parse(t),r&&cache.set(t,r)),!r)return null;const a=r.length;let n=e,s=0;for(;s<a;){const e=n[r[s]];if(void 0===e)return null;if(isFunction(n))return null;n=e,s++}return n}const CoreWarnCodes={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},CORE_WARN_CODES_EXTEND_POINT=8,warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[CoreWarnCodes.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."};function getWarnMessage(e,...t){return format$1(warnMessages[e],...t)}const VERSION="10.0.0",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isFunction(e.onWarn)?e.onWarn:warn,r=isString(e.version)?e.version:VERSION,a=isString(e.locale)||isFunction(e.locale)?e.locale:DEFAULT_LOCALE,n=isFunction(a)?DEFAULT_LOCALE:a,s=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=isPlainObject(e.messages)?e.messages:{[n]:{}},i=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=isPlainObject(e.numberFormats)?e.numberFormats:{[n]:{}},c=assign({},e.modifiers||{},getDefaultLinkedModifiers()),u=e.pluralRules||{},m=isFunction(e.missing)?e.missing:null,_=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,E=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,g=!!e.fallbackFormat,f=!!e.unresolving,p=isFunction(e.postTranslation)?e.postTranslation:null,O=isPlainObject(e.processor)?e.processor:null,T=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,C=!!e.escapeParameter,A=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,d=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,N=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,S=isObject(e.fallbackContext)?e.fallbackContext:void 0,b=e,M=isObject(b.__datetimeFormatters)?b.__datetimeFormatters:new Map,L=isObject(b.__numberFormatters)?b.__numberFormatters:new Map,F=isObject(b.__meta)?b.__meta:{};_cid++;const h={version:r,cid:_cid,locale:a,fallbackLocale:s,messages:o,modifiers:c,pluralRules:u,missing:m,missingWarn:_,fallbackWarn:E,fallbackFormat:g,unresolving:f,postTranslation:p,processor:O,warnHtmlMessage:T,escapeParameter:C,messageCompiler:A,messageResolver:d,localeFallbacker:N,fallbackContext:S,onWarn:t,__meta:F};return h.datetimeFormats=i,h.numberFormats=l,h.__datetimeFormatters=M,h.__numberFormatters=L,h}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,r,a,n){const{missing:s,onWarn:o}=e;if(null!==s){const a=s(e,r,t,n);return isString(a)?a:t}return t}function updateFallbackLocale(e,t,r){e.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}function isAlmostSameLocale(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function isImplicitFallback(e,t){const r=t.indexOf(e);if(-1===r)return!1;for(let a=r+1;a<t.length;a++)if(isAlmostSameLocale(e,t[a]))return!0;return!1}function datetime(e,...t){const{datetimeFormats:r,unresolving:a,fallbackLocale:n,onWarn:s,localeFallbacker:o}=e,{__datetimeFormatters:i}=e,[l,c,u,m]=parseDateTimeArgs(...t),_=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const E=!!u.part,g=getLocale(e,u),f=o(e,n,g);if(!isString(l)||""===l)return new Intl.DateTimeFormat(g,m).format(c);let p,O={},T=null;for(let d=0;d<f.length&&(p=f[d],O=r[p]||{},T=O[l],!isPlainObject(T));d++)handleMissing(e,l,p,_,"datetime format");if(!isPlainObject(T)||!isString(p))return a?-1:l;let C=`${p}__${l}`;isEmptyObject(m)||(C=`${C}__${JSON.stringify(m)}`);let A=i.get(C);return A||(A=new Intl.DateTimeFormat(p,assign({},T,m)),i.set(C,A)),E?A.formatToParts(c):A.format(c)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,r,a,n]=e,s={};let o,i={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const r=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();o=new Date(r);try{o.toISOString()}catch{throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);o=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);o=t}return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=r[e]:s[e]=r[e]})),isString(a)?s.locale=a:isPlainObject(a)&&(i=a),isPlainObject(n)&&(i=n),[s.key||"",o,s,i]}function clearDateTimeFormat(e,t,r){const a=e;for(const n in r){const e=`${t}__${n}`;a.__datetimeFormatters.has(e)&&a.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:r,unresolving:a,fallbackLocale:n,onWarn:s,localeFallbacker:o}=e,{__numberFormatters:i}=e,[l,c,u,m]=parseNumberArgs(...t),_=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const E=!!u.part,g=getLocale(e,u),f=o(e,n,g);if(!isString(l)||""===l)return new Intl.NumberFormat(g,m).format(c);let p,O={},T=null;for(let d=0;d<f.length&&(p=f[d],O=r[p]||{},T=O[l],!isPlainObject(T));d++)handleMissing(e,l,p,_,"number format");if(!isPlainObject(T)||!isString(p))return a?-1:l;let C=`${p}__${l}`;isEmptyObject(m)||(C=`${C}__${JSON.stringify(m)}`);let A=i.get(C);return A||(A=new Intl.NumberFormat(p,assign({},T,m)),i.set(C,A)),E?A.formatToParts(c):A.format(c)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,r,a,n]=e,s={};let o={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const i=t;return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?o[e]=r[e]:s[e]=r[e]})),isString(a)?s.locale=a:isPlainObject(a)&&(o=a),isPlainObject(n)&&(o=n),[s.key||"",i,s,o]}function clearNumberFormat(e,t,r){const a=e;for(const n in r){const e=`${t}__${n}`;a.__numberFormatters.has(e)&&a.__numberFormatters.delete(e)}}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":join(e),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,r=getPluralIndex(e),a=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],o=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(r,o);function i(t,r){const a=isFunction(e.messages)?e.messages(t,!!r):!!isObject(e.messages)&&e.messages[t];return a||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const l=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,c=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>o[e],plural:e=>e[a(r,e.length,n)],linked:(t,...r)=>{const[a,n]=r;let s="text",o="";1===r.length?isObject(a)?(o=a.modifier||o,s=a.type||s):isString(a)&&(o=a||o):2===r.length&&(isString(a)&&(o=a||o),isString(n)&&(s=n||s));const l=i(t,!0)(u),c="vnode"===s&&isArray(l)&&o?l[0]:l;return o?(m=o,e.modifiers?e.modifiers[m]:DEFAULT_MODIFIER)(c,s):c;var m},message:i,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:c,normalize:l,values:assign({},s,o)};return u}const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:r,postTranslation:a,unresolving:n,messageCompiler:s,fallbackLocale:o,messages:i}=e,[l,c]=parseTranslateArgs(...t),u=isBoolean(c.missingWarn)?c.missingWarn:e.missingWarn,m=isBoolean(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn,_=isBoolean(c.escapeParameter)?c.escapeParameter:e.escapeParameter,E=!!c.resolvedMessage,g=isString(c.default)||isBoolean(c.default)?isBoolean(c.default)?s?l:()=>l:c.default:r?s?l:()=>l:null,f=r||null!=g&&(isString(g)||isFunction(g)),p=getLocale(e,c);_&&escapeParams(c);let[O,T,C]=E?[l,p,i[p]||{}]:resolveMessageFormat(e,l,p,o,m,u),A=O,d=l;if(E||isString(A)||isMessageAST(A)||isMessageFunction(A)||f&&(A=g,d=A),!(E||(isString(A)||isMessageAST(A)||isMessageFunction(A))&&isString(T)))return n?-1:l;let N=!1;const S=isMessageFunction(A)?A:compileMessageFormat(e,l,T,A,d,(()=>{N=!0}));if(N)return A;const b=evaluateMessage(e,S,createMessageContext(getMessageContextOptions(e,T,C,c)));return a?a(b,l):b}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,r,a,n,s){const{messages:o,onWarn:i,messageResolver:l,localeFallbacker:c}=e,u=c(e,a,r);let m,_={},E=null;for(let g=0;g<u.length&&(m=u[g],_=o[m]||{},null===(E=l(_,t))&&(E=_[t]),!(isString(E)||isMessageAST(E)||isMessageFunction(E)));g++)if(!isImplicitFallback(m,u)){const r=handleMissing(e,t,m,s,"translate");r!==t&&(E=r)}return[E,m,_]}function compileMessageFormat(e,t,r,a,n,s){const{messageCompiler:o,warnHtmlMessage:i}=e;if(isMessageFunction(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==o){const e=()=>a;return e.locale=r,e.key=t,e}const l=o(a,getCompileContext(e,r,n,a,i,s));return l.locale=r,l.key=t,l.source=a,l}function evaluateMessage(e,t,r){return t(r)}function parseTranslateArgs(...e){const[t,r,a]=e,n={};if(!(isString(t)||isNumber(t)||isMessageFunction(t)||isMessageAST(t)))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(r)?n.plural=r:isString(r)?n.default=r:isPlainObject(r)&&!isEmptyObject(r)?n.named=r:isArray(r)&&(n.list=r),isNumber(a)?n.plural=a:isString(a)?n.default=a:isPlainObject(a)&&assign(n,a),[s,n]}function getCompileContext(e,t,r,a,n,s){return{locale:t,key:r,warnHtmlMessage:n,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,r,e)}}function getMessageContextOptions(e,t,r,a){const{modifiers:n,pluralRules:s,messageResolver:o,fallbackLocale:i,fallbackWarn:l,missingWarn:c,fallbackContext:u}=e,m={locale:t,modifiers:n,pluralRules:s,messages:(a,n)=>{let s=o(r,a);if(null==s&&(u||n)){const[,,r]=resolveMessageFormat(u||e,a,t,i,l,c);s=o(r,a)}if(isString(s)||isMessageAST(s)){let r=!1;const n=compileMessageFormat(e,a,t,s,a,(()=>{r=!0}));return r?NOOP_MESSAGE_FUNCTION:n}return isMessageFunction(s)?s:NOOP_MESSAGE_FUNCTION}};return e.processor&&(m.processor=e.processor),a.list&&(m.list=a.list),a.named&&(m.named=a.named),isNumber(a.plural)&&(m.pluralIndex=a.plural),m}registerMessageCompiler(compile),registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CORE_ERROR_CODES_EXTEND_POINT,CORE_WARN_CODES_EXTEND_POINT,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,compile,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getLocale,getWarnMessage,handleMissing,initI18nDevTools,isAlmostSameLocale,isImplicitFallback,isMessageAST,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveLocale,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale};
|
|
6
|
+
const RE_ARGS=/\{([0-9a-zA-Z]+)\}/g;function format$1(e,...t){return 1===t.length&&isObject(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),e.replace(RE_ARGS,((e,r)=>t.hasOwnProperty(r)?t[r]:""))}const generateFormatCacheKey=(e,t,r)=>friendlyJSONstringify({l:e,k:t,s:r}),friendlyJSONstringify=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),isNumber=e=>"number"==typeof e&&isFinite(e),isDate=e=>"[object Date]"===toTypeString(e),isRegExp=e=>"[object RegExp]"===toTypeString(e),isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length,assign=Object.assign;function escapeHtml(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const isArray=Array.isArray,isFunction=e=>"function"==typeof e,isString=e=>"string"==typeof e,isBoolean=e=>"boolean"==typeof e,isObject=e=>null!==e&&"object"==typeof e,isPromise=e=>isObject(e)&&isFunction(e.then)&&isFunction(e.catch),objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),isPlainObject=e=>"[object Object]"===toTypeString(e),toDisplayString=e=>null==e?"":isArray(e)||isPlainObject(e)&&e.toString===objectToString?JSON.stringify(e,null,2):String(e);function join(e,t=""){return e.reduce(((e,r,a)=>0===a?e+r:e+t+r),"")}function warn(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const CompileErrorCodes={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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},COMPILE_ERROR_CODES_EXTEND_POINT=17;function createCompileError(e,t,r={}){const{domain:a,messages:n,args:s}=r,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=a,o}function format(e){return t=>formatParts(t,e)}function formatParts(e,t){const r=t.b||t.body;if(1===(r.t||r.type)){const t=r,a=t.c||t.cases;return e.plural(a.reduce(((t,r)=>[...t,formatMessageParts(e,r)]),[]))}return formatMessageParts(e,r)}function formatMessageParts(e,t){const r=t.s||t.static;if(r)return"text"===e.type?r:e.normalize([r]);{const r=(t.i||t.items).reduce(((t,r)=>[...t,formatMessagePart(e,r)]),[]);return e.normalize(r)}}function formatMessagePart(e,t){const r=t.t||t.type;switch(r){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const r=t;return e.interpolate(e.named(r.k||r.key))}case 5:{const r=t;return e.interpolate(e.list(null!=r.i?r.i:r.index))}case 6:{const r=t,a=r.m||r.modifier;return e.linked(formatMessagePart(e,r.k||r.key),a?formatMessagePart(e,a):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${r}`)}}let compileCache=Object.create(null);function clearCompileCache(){compileCache=Object.create(null)}const isMessageAST=e=>isObject(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function compile(e,t){{const t=e.cacheKey;if(t){const r=compileCache[t];return r||(compileCache[t]=format(e))}return format(e)}}let devtools=null;function setDevToolsHook(e){devtools=e}function getDevToolsHook(){return devtools}function initI18nDevTools(e,t,r){devtools&&devtools.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:r})}const translateDevTools=createDevToolsHook("function:translate");function createDevToolsHook(e){return t=>devtools&&devtools.emit(e,t)}const CoreErrorCodes={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},CORE_ERROR_CODES_EXTEND_POINT=24;function createCoreError(e){return createCompileError(e,null,void 0)}function getLocale(e,t){return null!=t.locale?resolveLocale(t.locale):resolveLocale(e.locale)}let _resolveLocale;function resolveLocale(e){if(isString(e))return e;if(isFunction(e)){if(e.resolvedOnce&&null!=_resolveLocale)return _resolveLocale;if("Function"===e.constructor.name){const t=e();if(isPromise(t))throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return _resolveLocale=t}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE)}function fallbackWithSimple(e,t,r){return[...new Set([r,...isArray(t)?t:isObject(t)?Object.keys(t):isString(t)?[t]:[r]])]}function fallbackWithLocaleChain(e,t,r){const a=isString(r)?r:DEFAULT_LOCALE,n=e;n.__localeChainCache||(n.__localeChainCache=new Map);let s=n.__localeChainCache.get(a);if(!s){s=[];let e=[r];for(;isArray(e);)e=appendBlockToChain(s,e,t);const o=isArray(t)||!isPlainObject(t)?t:t.default?t.default:null;e=isString(o)?[o]:o,isArray(e)&&appendBlockToChain(s,e,!1),n.__localeChainCache.set(a,s)}return s}function appendBlockToChain(e,t,r){let a=!0;for(let n=0;n<t.length&&isBoolean(a);n++){const s=t[n];isString(s)&&(a=appendLocaleToChain(e,t[n],r))}return a}function appendLocaleToChain(e,t,r){let a;const n=t.split("-");do{a=appendItemToChain(e,n.join("-"),r),n.splice(-1,1)}while(n.length&&!0===a);return a}function appendItemToChain(e,t,r){let a=!1;if(!e.includes(t)&&(a=!0,t)){a="!"!==t[t.length-1];const n=t.replace(/!/g,"");e.push(n),(isArray(r)||isPlainObject(r))&&r[n]&&(a=r[n])}return a}CoreErrorCodes.INVALID_ARGUMENT,CoreErrorCodes.INVALID_DATE_ARGUMENT,CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT,CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE,CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE,CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE;const pathStateMachine=[];pathStateMachine[0]={w:[0],i:[3,0],"[":[4],o:[7]},pathStateMachine[1]={w:[1],".":[2],"[":[4],o:[7]},pathStateMachine[2]={w:[2],i:[3,0],0:[3,0]},pathStateMachine[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},pathStateMachine[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},pathStateMachine[5]={"'":[4,0],o:8,l:[5,0]},pathStateMachine[6]={'"':[4,0],o:8,l:[6,0]};const literalValueRE=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function isLiteral(e){return literalValueRE.test(e)}function stripQuotes(e){const t=e.charCodeAt(0);return t!==e.charCodeAt(e.length-1)||34!==t&&39!==t?e:e.slice(1,-1)}function getPathCharType(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 formatSubPath(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(isLiteral(t)?stripQuotes(t):"*"+t)}function parse(e){const t=[];let r,a,n,s,o,i,l,c=-1,u=0,m=0;const _=[];function E(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,n="\\"+t,_[0](),!0}for(_[0]=()=>{void 0===a?a=n:a+=n},_[1]=()=>{void 0!==a&&(t.push(a),a=void 0)},_[2]=()=>{_[0](),m++},_[3]=()=>{if(m>0)m--,u=4,_[0]();else{if(m=0,void 0===a)return!1;if(a=formatSubPath(a),!1===a)return!1;_[1]()}};null!==u;)if(c++,r=e[c],"\\"!==r||!E()){if(s=getPathCharType(r),l=pathStateMachine[u],o=l[s]||l.l||8,8===o)return;if(u=o[0],void 0!==o[1]&&(i=_[o[1]],i&&(n=r,!1===i())))return;if(7===u)return t}}const cache=new Map;function resolveWithKeyValue(e,t){return isObject(e)?e[t]:null}function resolveValue(e,t){if(!isObject(e))return null;let r=cache.get(t);if(r||(r=parse(t),r&&cache.set(t,r)),!r)return null;const a=r.length;let n=e,s=0;for(;s<a;){const e=n[r[s]];if(void 0===e)return null;if(isFunction(n))return null;n=e,s++}return n}const CoreWarnCodes={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},CORE_WARN_CODES_EXTEND_POINT=8,warnMessages={[CoreWarnCodes.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[CoreWarnCodes.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[CoreWarnCodes.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[CoreWarnCodes.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."};function getWarnMessage(e,...t){return format$1(warnMessages[e],...t)}const VERSION="10.0.2",NOT_REOSLVED=-1,DEFAULT_LOCALE="en-US",MISSING_RESOLVE_VALUE="",capitalize=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function getDefaultLinkedModifiers(){return{upper:(e,t)=>"text"===t&&isString(e)?e.toUpperCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&isString(e)?e.toLowerCase():"vnode"===t&&isObject(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&isString(e)?capitalize(e):"vnode"===t&&isObject(e)&&"__v_isVNode"in e?capitalize(e.children):e}}let _compiler,_resolver,_fallbacker;function registerMessageCompiler(e){_compiler=e}function registerMessageResolver(e){_resolver=e}function registerLocaleFallbacker(e){_fallbacker=e}let _additionalMeta=null;const setAdditionalMeta=e=>{_additionalMeta=e},getAdditionalMeta=()=>_additionalMeta;let _fallbackContext=null;const setFallbackContext=e=>{_fallbackContext=e},getFallbackContext=()=>_fallbackContext;let _cid=0;function createCoreContext(e={}){const t=isFunction(e.onWarn)?e.onWarn:warn,r=isString(e.version)?e.version:VERSION,a=isString(e.locale)||isFunction(e.locale)?e.locale:DEFAULT_LOCALE,n=isFunction(a)?DEFAULT_LOCALE:a,s=isArray(e.fallbackLocale)||isPlainObject(e.fallbackLocale)||isString(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,o=isPlainObject(e.messages)?e.messages:{[n]:{}},i=isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=isPlainObject(e.numberFormats)?e.numberFormats:{[n]:{}},c=assign({},e.modifiers||{},getDefaultLinkedModifiers()),u=e.pluralRules||{},m=isFunction(e.missing)?e.missing:null,_=!isBoolean(e.missingWarn)&&!isRegExp(e.missingWarn)||e.missingWarn,E=!isBoolean(e.fallbackWarn)&&!isRegExp(e.fallbackWarn)||e.fallbackWarn,g=!!e.fallbackFormat,f=!!e.unresolving,p=isFunction(e.postTranslation)?e.postTranslation:null,O=isPlainObject(e.processor)?e.processor:null,T=!isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,C=!!e.escapeParameter,A=isFunction(e.messageCompiler)?e.messageCompiler:_compiler,d=isFunction(e.messageResolver)?e.messageResolver:_resolver||resolveWithKeyValue,S=isFunction(e.localeFallbacker)?e.localeFallbacker:_fallbacker||fallbackWithSimple,N=isObject(e.fallbackContext)?e.fallbackContext:void 0,b=e,M=isObject(b.__datetimeFormatters)?b.__datetimeFormatters:new Map,L=isObject(b.__numberFormatters)?b.__numberFormatters:new Map,F=isObject(b.__meta)?b.__meta:{};_cid++;const h={version:r,cid:_cid,locale:a,fallbackLocale:s,messages:o,modifiers:c,pluralRules:u,missing:m,missingWarn:_,fallbackWarn:E,fallbackFormat:g,unresolving:f,postTranslation:p,processor:O,warnHtmlMessage:T,escapeParameter:C,messageCompiler:A,messageResolver:d,localeFallbacker:S,fallbackContext:N,onWarn:t,__meta:F};return h.datetimeFormats=i,h.numberFormats=l,h.__datetimeFormatters=M,h.__numberFormatters=L,h}function isTranslateFallbackWarn(e,t){return e instanceof RegExp?e.test(t):e}function isTranslateMissingWarn(e,t){return e instanceof RegExp?e.test(t):e}function handleMissing(e,t,r,a,n){const{missing:s,onWarn:o}=e;if(null!==s){const a=s(e,r,t,n);return isString(a)?a:t}return t}function updateFallbackLocale(e,t,r){e.__localeChainCache=new Map,e.localeFallbacker(e,r,t)}function isAlmostSameLocale(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function isImplicitFallback(e,t){const r=t.indexOf(e);if(-1===r)return!1;for(let a=r+1;a<t.length;a++)if(isAlmostSameLocale(e,t[a]))return!0;return!1}function datetime(e,...t){const{datetimeFormats:r,unresolving:a,fallbackLocale:n,onWarn:s,localeFallbacker:o}=e,{__datetimeFormatters:i}=e,[l,c,u,m]=parseDateTimeArgs(...t),_=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const E=!!u.part,g=getLocale(e,u),f=o(e,n,g);if(!isString(l)||""===l)return new Intl.DateTimeFormat(g,m).format(c);let p,O={},T=null;for(let d=0;d<f.length&&(p=f[d],O=r[p]||{},T=O[l],!isPlainObject(T));d++)handleMissing(e,l,p,_,"datetime format");if(!isPlainObject(T)||!isString(p))return a?-1:l;let C=`${p}__${l}`;isEmptyObject(m)||(C=`${C}__${JSON.stringify(m)}`);let A=i.get(C);return A||(A=new Intl.DateTimeFormat(p,assign({},T,m)),i.set(C,A)),E?A.formatToParts(c):A.format(c)}const DATETIME_FORMAT_OPTIONS_KEYS=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function parseDateTimeArgs(...e){const[t,r,a,n]=e,s={};let o,i={};if(isString(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);const r=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();o=new Date(r);try{o.toISOString()}catch{throw Error(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)}}else if(isDate(t)){if(isNaN(t.getTime()))throw Error(CoreErrorCodes.INVALID_DATE_ARGUMENT);o=t}else{if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);o=t}return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{DATETIME_FORMAT_OPTIONS_KEYS.includes(e)?i[e]=r[e]:s[e]=r[e]})),isString(a)?s.locale=a:isPlainObject(a)&&(i=a),isPlainObject(n)&&(i=n),[s.key||"",o,s,i]}function clearDateTimeFormat(e,t,r){const a=e;for(const n in r){const e=`${t}__${n}`;a.__datetimeFormatters.has(e)&&a.__datetimeFormatters.delete(e)}}function number(e,...t){const{numberFormats:r,unresolving:a,fallbackLocale:n,onWarn:s,localeFallbacker:o}=e,{__numberFormatters:i}=e,[l,c,u,m]=parseNumberArgs(...t),_=isBoolean(u.missingWarn)?u.missingWarn:e.missingWarn;isBoolean(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn;const E=!!u.part,g=getLocale(e,u),f=o(e,n,g);if(!isString(l)||""===l)return new Intl.NumberFormat(g,m).format(c);let p,O={},T=null;for(let d=0;d<f.length&&(p=f[d],O=r[p]||{},T=O[l],!isPlainObject(T));d++)handleMissing(e,l,p,_,"number format");if(!isPlainObject(T)||!isString(p))return a?-1:l;let C=`${p}__${l}`;isEmptyObject(m)||(C=`${C}__${JSON.stringify(m)}`);let A=i.get(C);return A||(A=new Intl.NumberFormat(p,assign({},T,m)),i.set(C,A)),E?A.formatToParts(c):A.format(c)}const NUMBER_FORMAT_OPTIONS_KEYS=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function parseNumberArgs(...e){const[t,r,a,n]=e,s={};let o={};if(!isNumber(t))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const i=t;return isString(r)?s.key=r:isPlainObject(r)&&Object.keys(r).forEach((e=>{NUMBER_FORMAT_OPTIONS_KEYS.includes(e)?o[e]=r[e]:s[e]=r[e]})),isString(a)?s.locale=a:isPlainObject(a)&&(o=a),isPlainObject(n)&&(o=n),[s.key||"",i,s,o]}function clearNumberFormat(e,t,r){const a=e;for(const n in r){const e=`${t}__${n}`;a.__numberFormatters.has(e)&&a.__numberFormatters.delete(e)}}const DEFAULT_MODIFIER=e=>e,DEFAULT_MESSAGE=e=>"",DEFAULT_MESSAGE_DATA_TYPE="text",DEFAULT_NORMALIZE=e=>0===e.length?"":join(e),DEFAULT_INTERPOLATE=toDisplayString;function pluralDefault(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function getPluralIndex(e){const t=isNumber(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(isNumber(e.named.count)||isNumber(e.named.n))?isNumber(e.named.count)?e.named.count:isNumber(e.named.n)?e.named.n:t:t}function normalizeNamed(e,t){t.count||(t.count=e),t.n||(t.n=e)}function createMessageContext(e={}){const t=e.locale,r=getPluralIndex(e),a=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?e.pluralRules[t]:pluralDefault,n=isObject(e.pluralRules)&&isString(t)&&isFunction(e.pluralRules[t])?pluralDefault:void 0,s=e.list||[],o=e.named||{};isNumber(e.pluralIndex)&&normalizeNamed(r,o);function i(t,r){const a=isFunction(e.messages)?e.messages(t,!!r):!!isObject(e.messages)&&e.messages[t];return a||(e.parent?e.parent.message(t):DEFAULT_MESSAGE)}const l=isPlainObject(e.processor)&&isFunction(e.processor.normalize)?e.processor.normalize:DEFAULT_NORMALIZE,c=isPlainObject(e.processor)&&isFunction(e.processor.interpolate)?e.processor.interpolate:DEFAULT_INTERPOLATE,u={list:e=>s[e],named:e=>o[e],plural:e=>e[a(r,e.length,n)],linked:(t,...r)=>{const[a,n]=r;let s="text",o="";1===r.length?isObject(a)?(o=a.modifier||o,s=a.type||s):isString(a)&&(o=a||o):2===r.length&&(isString(a)&&(o=a||o),isString(n)&&(s=n||s));const l=i(t,!0)(u),c="vnode"===s&&isArray(l)&&o?l[0]:l;return o?(m=o,e.modifiers?e.modifiers[m]:DEFAULT_MODIFIER)(c,s):c;var m},message:i,type:isPlainObject(e.processor)&&isString(e.processor.type)?e.processor.type:DEFAULT_MESSAGE_DATA_TYPE,interpolate:c,normalize:l,values:assign({},s,o)};return u}const NOOP_MESSAGE_FUNCTION=()=>"",isMessageFunction=e=>isFunction(e);function translate(e,...t){const{fallbackFormat:r,postTranslation:a,unresolving:n,messageCompiler:s,fallbackLocale:o,messages:i}=e,[l,c]=parseTranslateArgs(...t),u=isBoolean(c.missingWarn)?c.missingWarn:e.missingWarn,m=isBoolean(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn,_=isBoolean(c.escapeParameter)?c.escapeParameter:e.escapeParameter,E=!!c.resolvedMessage,g=isString(c.default)||isBoolean(c.default)?isBoolean(c.default)?s?l:()=>l:c.default:r?s?l:()=>l:null,f=r||null!=g&&(isString(g)||isFunction(g)),p=getLocale(e,c);_&&escapeParams(c);let[O,T,C]=E?[l,p,i[p]||{}]:resolveMessageFormat(e,l,p,o,m,u),A=O,d=l;if(E||isString(A)||isMessageAST(A)||isMessageFunction(A)||f&&(A=g,d=A),!(E||(isString(A)||isMessageAST(A)||isMessageFunction(A))&&isString(T)))return n?-1:l;let S=!1;const N=isMessageFunction(A)?A:compileMessageFormat(e,l,T,A,d,(()=>{S=!0}));if(S)return A;const b=evaluateMessage(e,N,createMessageContext(getMessageContextOptions(e,T,C,c)));return a?a(b,l):b}function escapeParams(e){isArray(e.list)?e.list=e.list.map((e=>isString(e)?escapeHtml(e):e)):isObject(e.named)&&Object.keys(e.named).forEach((t=>{isString(e.named[t])&&(e.named[t]=escapeHtml(e.named[t]))}))}function resolveMessageFormat(e,t,r,a,n,s){const{messages:o,onWarn:i,messageResolver:l,localeFallbacker:c}=e,u=c(e,a,r);let m,_={},E=null;for(let g=0;g<u.length&&(m=u[g],_=o[m]||{},null===(E=l(_,t))&&(E=_[t]),!(isString(E)||isMessageAST(E)||isMessageFunction(E)));g++)if(!isImplicitFallback(m,u)){const r=handleMissing(e,t,m,s,"translate");r!==t&&(E=r)}return[E,m,_]}function compileMessageFormat(e,t,r,a,n,s){const{messageCompiler:o,warnHtmlMessage:i}=e;if(isMessageFunction(a)){const e=a;return e.locale=e.locale||r,e.key=e.key||t,e}if(null==o){const e=()=>a;return e.locale=r,e.key=t,e}const l=o(a,getCompileContext(e,r,n,a,i,s));return l.locale=r,l.key=t,l.source=a,l}function evaluateMessage(e,t,r){return t(r)}function parseTranslateArgs(...e){const[t,r,a]=e,n={};if(!(isString(t)||isNumber(t)||isMessageFunction(t)||isMessageAST(t)))throw Error(CoreErrorCodes.INVALID_ARGUMENT);const s=isNumber(t)?String(t):(isMessageFunction(t),t);return isNumber(r)?n.plural=r:isString(r)?n.default=r:isPlainObject(r)&&!isEmptyObject(r)?n.named=r:isArray(r)&&(n.list=r),isNumber(a)?n.plural=a:isString(a)?n.default=a:isPlainObject(a)&&assign(n,a),[s,n]}function getCompileContext(e,t,r,a,n,s){return{locale:t,key:r,warnHtmlMessage:n,onError:e=>{throw s&&s(e),e},onCacheKey:e=>generateFormatCacheKey(t,r,e)}}function getMessageContextOptions(e,t,r,a){const{modifiers:n,pluralRules:s,messageResolver:o,fallbackLocale:i,fallbackWarn:l,missingWarn:c,fallbackContext:u}=e,m={locale:t,modifiers:n,pluralRules:s,messages:(a,n)=>{let s=o(r,a);if(null==s&&(u||n)){const[,,r]=resolveMessageFormat(u||e,a,t,i,l,c);s=o(r,a)}if(isString(s)||isMessageAST(s)){let r=!1;const n=compileMessageFormat(e,a,t,s,a,(()=>{r=!0}));return r?NOOP_MESSAGE_FUNCTION:n}return isMessageFunction(s)?s:NOOP_MESSAGE_FUNCTION}};return e.processor&&(m.processor=e.processor),a.list&&(m.list=a.list),a.named&&(m.named=a.named),isNumber(a.plural)&&(m.pluralIndex=a.plural),m}registerMessageCompiler(compile),registerMessageResolver(resolveValue),registerLocaleFallbacker(fallbackWithLocaleChain);export{CORE_ERROR_CODES_EXTEND_POINT,CORE_WARN_CODES_EXTEND_POINT,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,compile,createCompileError,createCoreContext,createCoreError,createMessageContext,datetime,fallbackWithLocaleChain,fallbackWithSimple,getAdditionalMeta,getDevToolsHook,getFallbackContext,getLocale,getWarnMessage,handleMissing,initI18nDevTools,isAlmostSameLocale,isImplicitFallback,isMessageAST,isMessageFunction,isTranslateFallbackWarn,isTranslateMissingWarn,number,parse,parseDateTimeArgs,parseNumberArgs,parseTranslateArgs,registerLocaleFallbacker,registerMessageCompiler,registerMessageResolver,resolveLocale,resolveValue,resolveWithKeyValue,setAdditionalMeta,setDevToolsHook,setFallbackContext,translate,translateDevTools,updateFallbackLocale};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -81,12 +81,7 @@ var IntlifyCore = (function (exports) {
|
|
|
81
81
|
};
|
|
82
82
|
const objectToString = Object.prototype.toString;
|
|
83
83
|
const toTypeString = (value) => objectToString.call(value);
|
|
84
|
-
const isPlainObject = (val) =>
|
|
85
|
-
if (!isObject(val))
|
|
86
|
-
return false;
|
|
87
|
-
const proto = Object.getPrototypeOf(val);
|
|
88
|
-
return proto === null || proto.constructor === Object;
|
|
89
|
-
};
|
|
84
|
+
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
90
85
|
// for converting list and named values to displayed strings.
|
|
91
86
|
const toDisplayString = (val) => {
|
|
92
87
|
return val == null
|
|
@@ -498,7 +493,7 @@ var IntlifyCore = (function (exports) {
|
|
|
498
493
|
return follow;
|
|
499
494
|
}
|
|
500
495
|
|
|
501
|
-
const pathStateMachine =
|
|
496
|
+
const pathStateMachine = [];
|
|
502
497
|
pathStateMachine[0 /* States.BEFORE_PATH */] = {
|
|
503
498
|
["w" /* PathCharTypes.WORKSPACE */]: [0 /* States.BEFORE_PATH */],
|
|
504
499
|
["i" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],
|
|
@@ -795,7 +790,7 @@ var IntlifyCore = (function (exports) {
|
|
|
795
790
|
* Intlify core-base version
|
|
796
791
|
* @internal
|
|
797
792
|
*/
|
|
798
|
-
const VERSION = '10.0.
|
|
793
|
+
const VERSION = '10.0.2';
|
|
799
794
|
const NOT_REOSLVED = -1;
|
|
800
795
|
const DEFAULT_LOCALE = 'en-US';
|
|
801
796
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -855,7 +850,7 @@ var IntlifyCore = (function (exports) {
|
|
|
855
850
|
_fallbacker = fallbacker;
|
|
856
851
|
}
|
|
857
852
|
// Additional Meta for Intlify DevTools
|
|
858
|
-
let _additionalMeta =
|
|
853
|
+
let _additionalMeta = null;
|
|
859
854
|
/* #__NO_SIDE_EFFECTS__ */
|
|
860
855
|
const setAdditionalMeta = (meta) => {
|
|
861
856
|
_additionalMeta = meta;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v10.0.
|
|
2
|
+
* core v10.0.2
|
|
3
3
|
* (c) 2024 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,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),a=e=>"number"==typeof e&&isFinite(e),o=e=>"[object Date]"===T(e),l=e=>"[object RegExp]"===T(e),s=e=>N(e)&&0===Object.keys(e).length,i=Object.assign;function c(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const u=Array.isArray,m=e=>"function"==typeof e,_=e=>"string"==typeof e,f=e=>"boolean"==typeof e,E=e=>null!==e&&"object"==typeof e,g=e=>E(e)&&m(e.then)&&m(e.catch),p=Object.prototype.toString,T=e=>p.call(e),N=e=>{if(!E(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t.constructor===Object};function A(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const 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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function O(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}function C(e){return t=>function(e,t){const n=t.b||t.body;if(1===(n.t||n.type)){const t=n,r=t.c||t.cases;return e.plural(r.reduce(((t,n)=>[...t,L(e,n)]),[]))}return L(e,n)}(t,e)}function L(e,t){const n=t.s||t.static;if(n)return"text"===e.type?n:e.normalize([n]);{const n=(t.i||t.items).reduce(((t,n)=>[...t,b(e,n)]),[]);return e.normalize(n)}}function b(e,t){const n=t.t||t.type;switch(n){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const n=t;return e.interpolate(e.named(n.k||n.key))}case 5:{const n=t;return e.interpolate(e.list(null!=n.i?n.i:n.index))}case 6:{const n=t,r=n.m||n.modifier;return e.linked(b(e,n.k||n.key),r?b(e,r):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${n}`)}}let I=Object.create(null);const R=e=>E(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function h(e,t){{const t=e.cacheKey;if(t){const n=I[t];return n||(I[t]=C(e))}return C(e)}}let S=null;const k=D("function:translate");function D(e){return t=>S&&S.emit(e,t)}const M={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function y(e,t){return null!=t.locale?P(t.locale):P(e.locale)}let F;function P(e){if(_(e))return e;if(m(e)){if(e.resolvedOnce&&null!=F)return F;if("Function"===e.constructor.name){const t=e();if(g(t))throw Error(M.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return F=t}throw Error(M.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(M.NOT_SUPPORT_LOCALE_TYPE)}function U(e,t,n){return[...new Set([n,...u(t)?t:E(t)?Object.keys(t):_(t)?[t]:[n]])]}function v(e,t,n){const r=_(n)?n:Z,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;u(e);)e=w(o,e,t);const l=u(t)||!N(t)?t:t.default?t.default:null;e=_(l)?[l]:l,u(e)&&w(o,e,!1),a.__localeChainCache.set(r,o)}return o}function w(e,t,n){let r=!0;for(let a=0;a<t.length&&f(r);a++){const o=t[a];_(o)&&(r=W(e,t[a],n))}return r}function W(e,t,n){let r;const a=t.split("-");do{r=V(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function V(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),(u(n)||N(n))&&n[a]&&(r=n[a])}return r}M.INVALID_ARGUMENT,M.INVALID_DATE_ARGUMENT,M.INVALID_ISO_DATE_ARGUMENT,M.NOT_SUPPORT_NON_STRING_MESSAGE,M.NOT_SUPPORT_LOCALE_PROMISE_VALUE,M.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,M.NOT_SUPPORT_LOCALE_TYPE;const x=[];x[0]={w:[0],i:[3,0],"[":[4],o:[7]},x[1]={w:[1],".":[2],"[":[4],o:[7]},x[2]={w:[2],i:[3,0],0:[3,0]},x[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},x[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},x[5]={"'":[4,0],o:8,l:[5,0]},x[6]={'"':[4,0],o:8,l:[6,0]};const G=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function K(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 $(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,G.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 Y(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const _=[];function f(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,_[0](),!0}for(_[0]=()=>{void 0===r?r=a:r+=a},_[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},_[2]=()=>{_[0](),m++},_[3]=()=>{if(m>0)m--,u=4,_[0]();else{if(m=0,void 0===r)return!1;if(r=$(r),!1===r)return!1;_[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!f()){if(o=K(n),i=x[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=_[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const j=new Map;function B(e,t){return E(e)?e[t]:null}function H(e,t){if(!E(e))return null;let n=j.get(t);if(n||(n=Y(t),n&&j.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;if(m(a))return null;a=e,o++}return a}const X={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},z={[X.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[X.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[X.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[X.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[X.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[X.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[X.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."};const J="10.0.0",Z="en-US",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;let le=null;let se=0;function ie(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return _(r)?r:t}return t}function ce(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function ue(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(ce(e,t[r]))return!0;return!1}const me=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function _e(...e){const[t,n,r,l]=e,s={};let i,c={};if(_(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(M.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();i=new Date(n);try{i.toISOString()}catch{throw Error(M.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(M.INVALID_DATE_ARGUMENT);i=t}else{if(!a(t))throw Error(M.INVALID_ARGUMENT);i=t}return _(n)?s.key=n:N(n)&&Object.keys(n).forEach((e=>{me.includes(e)?c[e]=n[e]:s[e]=n[e]})),_(r)?s.locale=r:N(r)&&(c=r),N(l)&&(c=l),[s.key||"",i,s,c]}const fe=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ee(...e){const[t,n,r,o]=e,l={};let s={};if(!a(t))throw Error(M.INVALID_ARGUMENT);const i=t;return _(n)?l.key=n:N(n)&&Object.keys(n).forEach((e=>{fe.includes(e)?s[e]=n[e]:l[e]=n[e]})),_(r)?l.locale=r:N(r)&&(s=r),N(o)&&(s=o),[l.key||"",i,l,s]}const ge=e=>e,pe=e=>"",Te="text",Ne=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),Ae=e=>null==e?"":u(e)||N(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function de(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function Oe(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(e.pluralRules)&&_(t)&&m(e.pluralRules[t])?e.pluralRules[t]:de,o=E(e.pluralRules)&&_(t)&&m(e.pluralRules[t])?de: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,n){const r=m(e.messages)?e.messages(t,!!n):!!E(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):pe)}const f=N(e.processor)&&m(e.processor.normalize)?e.processor.normalize:Ne,g=N(e.processor)&&m(e.processor.interpolate)?e.processor.interpolate:Ae,p={list:e=>l[e],named:e=>s[e],plural:e=>e[r(n,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",l="";1===n.length?E(r)?(l=r.modifier||l,o=r.type||o):_(r)&&(l=r||l):2===n.length&&(_(r)&&(l=r||l),_(a)&&(o=a||o));const s=c(t,!0)(p),i="vnode"===o&&u(s)&&l?s[0]:s;return l?(m=l,e.modifiers?e.modifiers[m]:ge)(i,o):i;var m},message:c,type:N(e.processor)&&_(e.processor.type)?e.processor.type:Te,interpolate:g,normalize:f,values:i({},l,s)};return p}const Ce=()=>"",Le=e=>m(e);function be(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,u=c(e,r,n);let m,f={},E=null;for(let g=0;g<u.length&&(m=u[g],f=l[m]||{},null===(E=i(f,t))&&(E=f[t]),!(_(E)||R(E)||Le(E)));g++)if(!ue(m,u)){const n=ie(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,f]}function Ie(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(Le(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{locale:t,key:r,warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=t,c.source=a,c}function Re(...e){const[t,n,r]=e,o={};if(!(_(t)||a(t)||Le(t)||R(t)))throw Error(M.INVALID_ARGUMENT);const l=a(t)?String(t):(Le(t),t);return a(n)?o.plural=n:_(n)?o.default=n:N(n)&&!s(n)?o.named=n:u(n)&&(o.list=n),a(r)?o.plural=r:_(r)?o.default=r:N(r)&&i(o,r),[l,o]}return ne(h),re(H),ae(v),e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=8,e.CompileErrorCodes=d,e.CoreErrorCodes=M,e.CoreWarnCodes=X,e.DATETIME_FORMAT_OPTIONS_KEYS=me,e.DEFAULT_LOCALE=Z,e.DEFAULT_MESSAGE_DATA_TYPE=Te,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=fe,e.VERSION=J,e.clearCompileCache=function(){I=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compile=h,e.createCompileError=O,e.createCoreContext=function(e={}){const t=m(e.onWarn)?e.onWarn:A,n=_(e.version)?e.version:J,r=_(e.locale)||m(e.locale)?e.locale:Z,a=m(r)?Z:r,o=u(e.fallbackLocale)||N(e.fallbackLocale)||_(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,s=N(e.messages)?e.messages:{[a]:{}},c=N(e.datetimeFormats)?e.datetimeFormats:{[a]:{}},g=N(e.numberFormats)?e.numberFormats:{[a]:{}},p=i({},e.modifiers||{},{upper:(e,t)=>"text"===t&&_(e)?e.toUpperCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&_(e)?e.toLowerCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&_(e)?Q(e):"vnode"===t&&E(e)&&"__v_isVNode"in e?Q(e.children):e}),T=e.pluralRules||{},d=m(e.missing)?e.missing:null,O=!f(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,C=!f(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,L=!!e.fallbackFormat,b=!!e.unresolving,I=m(e.postTranslation)?e.postTranslation:null,R=N(e.processor)?e.processor:null,h=!f(e.warnHtmlMessage)||e.warnHtmlMessage,S=!!e.escapeParameter,k=m(e.messageCompiler)?e.messageCompiler:q,D=m(e.messageResolver)?e.messageResolver:ee||B,M=m(e.localeFallbacker)?e.localeFallbacker:te||U,y=E(e.fallbackContext)?e.fallbackContext:void 0,F=e,P=E(F.__datetimeFormatters)?F.__datetimeFormatters:new Map,v=E(F.__numberFormatters)?F.__numberFormatters:new Map,w=E(F.__meta)?F.__meta:{};se++;const W={version:n,cid:se,locale:r,fallbackLocale:o,messages:s,modifiers:p,pluralRules:T,missing:d,missingWarn:O,fallbackWarn:C,fallbackFormat:L,unresolving:b,postTranslation:I,processor:R,warnHtmlMessage:h,escapeParameter:S,messageCompiler:k,messageResolver:D,localeFallbacker:M,fallbackContext:y,onWarn:t,__meta:w};return W.datetimeFormats=c,W.numberFormats=g,W.__datetimeFormatters=P,W.__numberFormatters=v,W},e.createCoreError=function(e){return O(e,null,void 0)},e.createMessageContext=Oe,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a,onWarn:o,localeFallbacker:l}=e,{__datetimeFormatters:c}=e,[u,m,E,g]=_e(...t);f(E.missingWarn)?E.missingWarn:e.missingWarn,f(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const p=!!E.part,T=y(e,E),A=l(e,a,T);if(!_(u)||""===u)return new Intl.DateTimeFormat(T,g).format(m);let d,O={},C=null;for(let s=0;s<A.length&&(d=A[s],O=n[d]||{},C=O[u],!N(C));s++)ie(e,u,d,0,"datetime format");if(!N(C)||!_(d))return r?-1:u;let L=`${d}__${u}`;s(g)||(L=`${L}__${JSON.stringify(g)}`);let b=c.get(L);return b||(b=new Intl.DateTimeFormat(d,i({},C,g)),c.set(L,b)),p?b.formatToParts(m):b.format(m)},e.fallbackWithLocaleChain=v,e.fallbackWithSimple=U,e.getAdditionalMeta=()=>oe,e.getDevToolsHook=function(){return S},e.getFallbackContext=()=>le,e.getLocale=y,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&E(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(z[e],...n)},e.handleMissing=ie,e.initI18nDevTools=function(e,t,n){S&&S.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=ce,e.isImplicitFallback=ue,e.isMessageAST=R,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:r,fallbackLocale:a,onWarn:o,localeFallbacker:l}=e,{__numberFormatters:c}=e,[u,m,E,g]=Ee(...t);f(E.missingWarn)?E.missingWarn:e.missingWarn,f(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const p=!!E.part,T=y(e,E),A=l(e,a,T);if(!_(u)||""===u)return new Intl.NumberFormat(T,g).format(m);let d,O={},C=null;for(let s=0;s<A.length&&(d=A[s],O=n[d]||{},C=O[u],!N(C));s++)ie(e,u,d,0,"number format");if(!N(C)||!_(d))return r?-1:u;let L=`${d}__${u}`;s(g)||(L=`${L}__${JSON.stringify(g)}`);let b=c.get(L);return b||(b=new Intl.NumberFormat(d,i({},C,g)),c.set(L,b)),p?b.formatToParts(m):b.format(m)},e.parse=Y,e.parseDateTimeArgs=_e,e.parseNumberArgs=Ee,e.parseTranslateArgs=Re,e.registerLocaleFallbacker=ae,e.registerMessageCompiler=ne,e.registerMessageResolver=re,e.resolveLocale=P,e.resolveValue=H,e.resolveWithKeyValue=B,e.setAdditionalMeta=e=>{oe=e},e.setDevToolsHook=function(e){S=e},e.setFallbackContext=e=>{le=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[g,p]=Re(...t),T=f(p.missingWarn)?p.missingWarn:e.missingWarn,N=f(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn,A=f(p.escapeParameter)?p.escapeParameter:e.escapeParameter,d=!!p.resolvedMessage,O=_(p.default)||f(p.default)?f(p.default)?l?g:()=>g:p.default:n?l?g:()=>g:null,C=n||null!=O&&(_(O)||m(O)),L=y(e,p);A&&function(e){u(e.list)?e.list=e.list.map((e=>_(e)?c(e):e)):E(e.named)&&Object.keys(e.named).forEach((t=>{_(e.named[t])&&(e.named[t]=c(e.named[t]))}))}(p);let[b,I,h]=d?[g,L,i[L]||{}]:be(e,g,L,s,N,T),S=b,k=g;if(d||_(S)||R(S)||Le(S)||C&&(S=O,k=S),!(d||(_(S)||R(S)||Le(S))&&_(I)))return o?-1:g;let D=!1;const M=Le(S)?S:Ie(e,g,I,S,k,(()=>{D=!0}));if(D)return S;const F=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:m}=e,f=(r,a)=>{let o=s(n,r);if(null==o&&(m||a)){const[,,n]=be(m||e,r,t,i,c,u);o=s(n,r)}if(_(o)||R(o)){let n=!1;const a=Ie(e,r,t,o,r,(()=>{n=!0}));return n?Ce:a}return Le(o)?o:Ce},E={locale:t,modifiers:o,pluralRules:l,messages:f};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,I,h,p),P=function(e,t,n){const r=t(n);return r}(0,M,Oe(F));return r?r(P,g):P},e.translateDevTools=k,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({});
|
|
6
|
+
var IntlifyCore=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=(e,t,n)=>r({l:e,k:t,s:n}),r=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),a=e=>"number"==typeof e&&isFinite(e),o=e=>"[object Date]"===T(e),l=e=>"[object RegExp]"===T(e),s=e=>N(e)&&0===Object.keys(e).length,i=Object.assign;function c(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const u=Array.isArray,m=e=>"function"==typeof e,_=e=>"string"==typeof e,f=e=>"boolean"==typeof e,E=e=>null!==e&&"object"==typeof e,g=e=>E(e)&&m(e.then)&&m(e.catch),p=Object.prototype.toString,T=e=>p.call(e),N=e=>"[object Object]"===T(e);function A(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const 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,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16};function O(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}function C(e){return t=>function(e,t){const n=t.b||t.body;if(1===(n.t||n.type)){const t=n,r=t.c||t.cases;return e.plural(r.reduce(((t,n)=>[...t,L(e,n)]),[]))}return L(e,n)}(t,e)}function L(e,t){const n=t.s||t.static;if(n)return"text"===e.type?n:e.normalize([n]);{const n=(t.i||t.items).reduce(((t,n)=>[...t,b(e,n)]),[]);return e.normalize(n)}}function b(e,t){const n=t.t||t.type;switch(n){case 3:{const e=t;return e.v||e.value}case 9:{const e=t;return e.v||e.value}case 4:{const n=t;return e.interpolate(e.named(n.k||n.key))}case 5:{const n=t;return e.interpolate(e.list(null!=n.i?n.i:n.index))}case 6:{const n=t,r=n.m||n.modifier;return e.linked(b(e,n.k||n.key),r?b(e,r):void 0,e.type)}case 7:{const e=t;return e.v||e.value}case 8:{const e=t;return e.v||e.value}default:throw new Error(`unhandled node type on format message part: ${n}`)}}let I=Object.create(null);const R=e=>E(e)&&(0===e.t||0===e.type)&&("b"in e||"body"in e);function h(e,t){{const t=e.cacheKey;if(t){const n=I[t];return n||(I[t]=C(e))}return C(e)}}let S=null;const k=D("function:translate");function D(e){return t=>S&&S.emit(e,t)}const M={INVALID_ARGUMENT:17,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23};function F(e,t){return null!=t.locale?P(t.locale):P(e.locale)}let y;function P(e){if(_(e))return e;if(m(e)){if(e.resolvedOnce&&null!=y)return y;if("Function"===e.constructor.name){const t=e();if(g(t))throw Error(M.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return y=t}throw Error(M.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(M.NOT_SUPPORT_LOCALE_TYPE)}function U(e,t,n){return[...new Set([n,...u(t)?t:E(t)?Object.keys(t):_(t)?[t]:[n]])]}function v(e,t,n){const r=_(n)?n:Z,a=e;a.__localeChainCache||(a.__localeChainCache=new Map);let o=a.__localeChainCache.get(r);if(!o){o=[];let e=[n];for(;u(e);)e=w(o,e,t);const l=u(t)||!N(t)?t:t.default?t.default:null;e=_(l)?[l]:l,u(e)&&w(o,e,!1),a.__localeChainCache.set(r,o)}return o}function w(e,t,n){let r=!0;for(let a=0;a<t.length&&f(r);a++){const o=t[a];_(o)&&(r=W(e,t[a],n))}return r}function W(e,t,n){let r;const a=t.split("-");do{r=V(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function V(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),(u(n)||N(n))&&n[a]&&(r=n[a])}return r}M.INVALID_ARGUMENT,M.INVALID_DATE_ARGUMENT,M.INVALID_ISO_DATE_ARGUMENT,M.NOT_SUPPORT_NON_STRING_MESSAGE,M.NOT_SUPPORT_LOCALE_PROMISE_VALUE,M.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,M.NOT_SUPPORT_LOCALE_TYPE;const x=[];x[0]={w:[0],i:[3,0],"[":[4],o:[7]},x[1]={w:[1],".":[2],"[":[4],o:[7]},x[2]={w:[2],i:[3,0],0:[3,0]},x[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},x[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},x[5]={"'":[4,0],o:8,l:[5,0]},x[6]={'"':[4,0],o:8,l:[6,0]};const G=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function K(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 $(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,G.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 Y(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,m=0;const _=[];function f(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,_[0](),!0}for(_[0]=()=>{void 0===r?r=a:r+=a},_[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},_[2]=()=>{_[0](),m++},_[3]=()=>{if(m>0)m--,u=4,_[0]();else{if(m=0,void 0===r)return!1;if(r=$(r),!1===r)return!1;_[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!f()){if(o=K(n),i=x[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=_[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const j=new Map;function B(e,t){return E(e)?e[t]:null}function H(e,t){if(!E(e))return null;let n=j.get(t);if(n||(n=Y(t),n&&j.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;if(m(a))return null;a=e,o++}return a}const X={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,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},z={[X.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[X.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[X.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[X.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[X.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[X.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[X.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."};const J="10.0.2",Z="en-US",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;let le=null;let se=0;function ie(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return _(r)?r:t}return t}function ce(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function ue(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(ce(e,t[r]))return!0;return!1}const me=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function _e(...e){const[t,n,r,l]=e,s={};let i,c={};if(_(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(M.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();i=new Date(n);try{i.toISOString()}catch{throw Error(M.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(M.INVALID_DATE_ARGUMENT);i=t}else{if(!a(t))throw Error(M.INVALID_ARGUMENT);i=t}return _(n)?s.key=n:N(n)&&Object.keys(n).forEach((e=>{me.includes(e)?c[e]=n[e]:s[e]=n[e]})),_(r)?s.locale=r:N(r)&&(c=r),N(l)&&(c=l),[s.key||"",i,s,c]}const fe=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ee(...e){const[t,n,r,o]=e,l={};let s={};if(!a(t))throw Error(M.INVALID_ARGUMENT);const i=t;return _(n)?l.key=n:N(n)&&Object.keys(n).forEach((e=>{fe.includes(e)?s[e]=n[e]:l[e]=n[e]})),_(r)?l.locale=r:N(r)&&(s=r),N(o)&&(s=o),[l.key||"",i,l,s]}const ge=e=>e,pe=e=>"",Te="text",Ne=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),Ae=e=>null==e?"":u(e)||N(e)&&e.toString===p?JSON.stringify(e,null,2):String(e);function de(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function Oe(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(e.pluralRules)&&_(t)&&m(e.pluralRules[t])?e.pluralRules[t]:de,o=E(e.pluralRules)&&_(t)&&m(e.pluralRules[t])?de: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,n){const r=m(e.messages)?e.messages(t,!!n):!!E(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):pe)}const f=N(e.processor)&&m(e.processor.normalize)?e.processor.normalize:Ne,g=N(e.processor)&&m(e.processor.interpolate)?e.processor.interpolate:Ae,p={list:e=>l[e],named:e=>s[e],plural:e=>e[r(n,e.length,o)],linked:(t,...n)=>{const[r,a]=n;let o="text",l="";1===n.length?E(r)?(l=r.modifier||l,o=r.type||o):_(r)&&(l=r||l):2===n.length&&(_(r)&&(l=r||l),_(a)&&(o=a||o));const s=c(t,!0)(p),i="vnode"===o&&u(s)&&l?s[0]:s;return l?(m=l,e.modifiers?e.modifiers[m]:ge)(i,o):i;var m},message:c,type:N(e.processor)&&_(e.processor.type)?e.processor.type:Te,interpolate:g,normalize:f,values:i({},l,s)};return p}const Ce=()=>"",Le=e=>m(e);function be(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,u=c(e,r,n);let m,f={},E=null;for(let g=0;g<u.length&&(m=u[g],f=l[m]||{},null===(E=i(f,t))&&(E=f[t]),!(_(E)||R(E)||Le(E)));g++)if(!ue(m,u)){const n=ie(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,f]}function Ie(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(Le(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{locale:t,key:r,warnHtmlMessage:o,onError:e=>{throw l&&l(e),e},onCacheKey:e=>n(t,r,e)}}(0,r,o,0,i,l));return c.locale=r,c.key=t,c.source=a,c}function Re(...e){const[t,n,r]=e,o={};if(!(_(t)||a(t)||Le(t)||R(t)))throw Error(M.INVALID_ARGUMENT);const l=a(t)?String(t):(Le(t),t);return a(n)?o.plural=n:_(n)?o.default=n:N(n)&&!s(n)?o.named=n:u(n)&&(o.list=n),a(r)?o.plural=r:_(r)?o.default=r:N(r)&&i(o,r),[l,o]}return ne(h),re(H),ae(v),e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=8,e.CompileErrorCodes=d,e.CoreErrorCodes=M,e.CoreWarnCodes=X,e.DATETIME_FORMAT_OPTIONS_KEYS=me,e.DEFAULT_LOCALE=Z,e.DEFAULT_MESSAGE_DATA_TYPE=Te,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=fe,e.VERSION=J,e.clearCompileCache=function(){I=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__datetimeFormatters.has(e)&&r.__datetimeFormatters.delete(e)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const a in n){const e=`${t}__${a}`;r.__numberFormatters.has(e)&&r.__numberFormatters.delete(e)}},e.compile=h,e.createCompileError=O,e.createCoreContext=function(e={}){const t=m(e.onWarn)?e.onWarn:A,n=_(e.version)?e.version:J,r=_(e.locale)||m(e.locale)?e.locale:Z,a=m(r)?Z:r,o=u(e.fallbackLocale)||N(e.fallbackLocale)||_(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,s=N(e.messages)?e.messages:{[a]:{}},c=N(e.datetimeFormats)?e.datetimeFormats:{[a]:{}},g=N(e.numberFormats)?e.numberFormats:{[a]:{}},p=i({},e.modifiers||{},{upper:(e,t)=>"text"===t&&_(e)?e.toUpperCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&_(e)?e.toLowerCase():"vnode"===t&&E(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&_(e)?Q(e):"vnode"===t&&E(e)&&"__v_isVNode"in e?Q(e.children):e}),T=e.pluralRules||{},d=m(e.missing)?e.missing:null,O=!f(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,C=!f(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,L=!!e.fallbackFormat,b=!!e.unresolving,I=m(e.postTranslation)?e.postTranslation:null,R=N(e.processor)?e.processor:null,h=!f(e.warnHtmlMessage)||e.warnHtmlMessage,S=!!e.escapeParameter,k=m(e.messageCompiler)?e.messageCompiler:q,D=m(e.messageResolver)?e.messageResolver:ee||B,M=m(e.localeFallbacker)?e.localeFallbacker:te||U,F=E(e.fallbackContext)?e.fallbackContext:void 0,y=e,P=E(y.__datetimeFormatters)?y.__datetimeFormatters:new Map,v=E(y.__numberFormatters)?y.__numberFormatters:new Map,w=E(y.__meta)?y.__meta:{};se++;const W={version:n,cid:se,locale:r,fallbackLocale:o,messages:s,modifiers:p,pluralRules:T,missing:d,missingWarn:O,fallbackWarn:C,fallbackFormat:L,unresolving:b,postTranslation:I,processor:R,warnHtmlMessage:h,escapeParameter:S,messageCompiler:k,messageResolver:D,localeFallbacker:M,fallbackContext:F,onWarn:t,__meta:w};return W.datetimeFormats=c,W.numberFormats=g,W.__datetimeFormatters=P,W.__numberFormatters=v,W},e.createCoreError=function(e){return O(e,null,void 0)},e.createMessageContext=Oe,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:a,onWarn:o,localeFallbacker:l}=e,{__datetimeFormatters:c}=e,[u,m,E,g]=_e(...t);f(E.missingWarn)?E.missingWarn:e.missingWarn,f(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const p=!!E.part,T=F(e,E),A=l(e,a,T);if(!_(u)||""===u)return new Intl.DateTimeFormat(T,g).format(m);let d,O={},C=null;for(let s=0;s<A.length&&(d=A[s],O=n[d]||{},C=O[u],!N(C));s++)ie(e,u,d,0,"datetime format");if(!N(C)||!_(d))return r?-1:u;let L=`${d}__${u}`;s(g)||(L=`${L}__${JSON.stringify(g)}`);let b=c.get(L);return b||(b=new Intl.DateTimeFormat(d,i({},C,g)),c.set(L,b)),p?b.formatToParts(m):b.format(m)},e.fallbackWithLocaleChain=v,e.fallbackWithSimple=U,e.getAdditionalMeta=()=>oe,e.getDevToolsHook=function(){return S},e.getFallbackContext=()=>le,e.getLocale=F,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&E(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(z[e],...n)},e.handleMissing=ie,e.initI18nDevTools=function(e,t,n){S&&S.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=ce,e.isImplicitFallback=ue,e.isMessageAST=R,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:r,fallbackLocale:a,onWarn:o,localeFallbacker:l}=e,{__numberFormatters:c}=e,[u,m,E,g]=Ee(...t);f(E.missingWarn)?E.missingWarn:e.missingWarn,f(E.fallbackWarn)?E.fallbackWarn:e.fallbackWarn;const p=!!E.part,T=F(e,E),A=l(e,a,T);if(!_(u)||""===u)return new Intl.NumberFormat(T,g).format(m);let d,O={},C=null;for(let s=0;s<A.length&&(d=A[s],O=n[d]||{},C=O[u],!N(C));s++)ie(e,u,d,0,"number format");if(!N(C)||!_(d))return r?-1:u;let L=`${d}__${u}`;s(g)||(L=`${L}__${JSON.stringify(g)}`);let b=c.get(L);return b||(b=new Intl.NumberFormat(d,i({},C,g)),c.set(L,b)),p?b.formatToParts(m):b.format(m)},e.parse=Y,e.parseDateTimeArgs=_e,e.parseNumberArgs=Ee,e.parseTranslateArgs=Re,e.registerLocaleFallbacker=ae,e.registerMessageCompiler=ne,e.registerMessageResolver=re,e.resolveLocale=P,e.resolveValue=H,e.resolveWithKeyValue=B,e.setAdditionalMeta=e=>{oe=e},e.setDevToolsHook=function(e){S=e},e.setFallbackContext=e=>{le=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[g,p]=Re(...t),T=f(p.missingWarn)?p.missingWarn:e.missingWarn,N=f(p.fallbackWarn)?p.fallbackWarn:e.fallbackWarn,A=f(p.escapeParameter)?p.escapeParameter:e.escapeParameter,d=!!p.resolvedMessage,O=_(p.default)||f(p.default)?f(p.default)?l?g:()=>g:p.default:n?l?g:()=>g:null,C=n||null!=O&&(_(O)||m(O)),L=F(e,p);A&&function(e){u(e.list)?e.list=e.list.map((e=>_(e)?c(e):e)):E(e.named)&&Object.keys(e.named).forEach((t=>{_(e.named[t])&&(e.named[t]=c(e.named[t]))}))}(p);let[b,I,h]=d?[g,L,i[L]||{}]:be(e,g,L,s,N,T),S=b,k=g;if(d||_(S)||R(S)||Le(S)||C&&(S=O,k=S),!(d||(_(S)||R(S)||Le(S))&&_(I)))return o?-1:g;let D=!1;const M=Le(S)?S:Ie(e,g,I,S,k,(()=>{D=!0}));if(D)return S;const y=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:m}=e,f=(r,a)=>{let o=s(n,r);if(null==o&&(m||a)){const[,,n]=be(m||e,r,t,i,c,u);o=s(n,r)}if(_(o)||R(o)){let n=!1;const a=Ie(e,r,t,o,r,(()=>{n=!0}));return n?Ce:a}return Le(o)?o:Ce},E={locale:t,modifiers:o,pluralRules:l,messages:f};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,I,h,p),P=function(e,t,n){const r=t(n);return r}(0,M,Oe(y));return r?r(P,g):P},e.translateDevTools=k,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},e}({});
|
package/dist/core.runtime.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.2",
|
|
4
4
|
"description": "@intlify/core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"core",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"jsdelivr": "dist/core.global.js",
|
|
34
34
|
"types": "dist/core.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@intlify/core-base": "10.0.
|
|
37
|
-
"@intlify/shared": "10.0.
|
|
36
|
+
"@intlify/core-base": "10.0.2",
|
|
37
|
+
"@intlify/shared": "10.0.2"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 16"
|