@intlify/core 11.4.9 → 11.4.12
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 +1 -1
- package/dist/core.esm-browser.js +55 -20
- package/dist/core.esm-browser.prod.js +2 -2
- package/dist/core.global.js +55 -20
- 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 +1 -1
- package/dist/core.runtime.esm-browser.js +55 -20
- package/dist/core.runtime.esm-browser.prod.js +2 -2
- package/dist/core.runtime.global.js +55 -20
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v11.4.
|
|
2
|
+
* core v11.4.12
|
|
3
3
|
* (c) 2026 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -50,6 +50,9 @@ var IntlifyCore = (function (exports) {
|
|
|
50
50
|
.replace(/\u2029/g, '\\u2029')
|
|
51
51
|
.replace(/\u0027/g, '\\u0027');
|
|
52
52
|
const isNumber = (val) => typeof val === 'number' && isFinite(val);
|
|
53
|
+
function toDevtoolsGroupId(type, key) {
|
|
54
|
+
return isString(key) || isNumber(key) ? `${type}:${key}` : type;
|
|
55
|
+
}
|
|
53
56
|
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
54
57
|
const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
|
|
55
58
|
const isEmptyObject = (val) => isPlainObject(val) && Object.keys(val).length === 0;
|
|
@@ -615,6 +618,9 @@ var IntlifyCore = (function (exports) {
|
|
|
615
618
|
* @remarks
|
|
616
619
|
* A fallback locale function implemented with a fallback chain algorithm. It's used in VueI18n as default.
|
|
617
620
|
*
|
|
621
|
+
* Chains are cached per fallback identity. If you mutate an object or array fallback in place,
|
|
622
|
+
* pass a new object or array instead so that the chain is recomputed.
|
|
623
|
+
*
|
|
618
624
|
* @param ctx - A {@link CoreContext | context}
|
|
619
625
|
* @param fallback - A {@link FallbackLocale | fallback locale}
|
|
620
626
|
* @param start - A starting {@link Locale | locale}
|
|
@@ -628,16 +634,31 @@ var IntlifyCore = (function (exports) {
|
|
|
628
634
|
function fallbackWithLocaleChain(ctx, fallback, start) {
|
|
629
635
|
const startLocale = isString(start) ? start : DEFAULT_LOCALE;
|
|
630
636
|
const context = ctx;
|
|
631
|
-
|
|
632
|
-
|
|
637
|
+
// NOTE: chains are cached per fallback value, not per serialized content.
|
|
638
|
+
// object / array fallbacks are keyed by identity in a WeakMap so that their
|
|
639
|
+
// entries are released together with the fallback itself.
|
|
640
|
+
let chains;
|
|
641
|
+
if (isObject(fallback)) {
|
|
642
|
+
if (!context.__localeChainObjectCache) {
|
|
643
|
+
context.__localeChainObjectCache = new WeakMap();
|
|
644
|
+
}
|
|
645
|
+
chains = context.__localeChainObjectCache.get(fallback);
|
|
646
|
+
if (!chains) {
|
|
647
|
+
chains = new Map();
|
|
648
|
+
context.__localeChainObjectCache.set(fallback, chains);
|
|
649
|
+
}
|
|
633
650
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
context.__localeChainCache.
|
|
651
|
+
else {
|
|
652
|
+
if (!context.__localeChainCache) {
|
|
653
|
+
context.__localeChainCache = new Map();
|
|
654
|
+
}
|
|
655
|
+
chains = context.__localeChainCache.get(fallback);
|
|
656
|
+
if (!chains) {
|
|
657
|
+
chains = new Map();
|
|
658
|
+
context.__localeChainCache.set(fallback, chains);
|
|
659
|
+
}
|
|
639
660
|
}
|
|
640
|
-
const cached = chains.get(
|
|
661
|
+
const cached = chains.get(startLocale);
|
|
641
662
|
if (cached) {
|
|
642
663
|
return cached;
|
|
643
664
|
}
|
|
@@ -660,7 +681,7 @@ var IntlifyCore = (function (exports) {
|
|
|
660
681
|
if (isArray(block)) {
|
|
661
682
|
appendBlockToChain(chain, block, false);
|
|
662
683
|
}
|
|
663
|
-
chains.set(
|
|
684
|
+
chains.set(startLocale, chain);
|
|
664
685
|
return chain;
|
|
665
686
|
}
|
|
666
687
|
function appendBlockToChain(chain, block, blocks) {
|
|
@@ -1019,7 +1040,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1019
1040
|
* Intlify core-base version
|
|
1020
1041
|
* @internal
|
|
1021
1042
|
*/
|
|
1022
|
-
const VERSION = '11.4.
|
|
1043
|
+
const VERSION = '11.4.12';
|
|
1023
1044
|
const NOT_REOSLVED = -1;
|
|
1024
1045
|
const DEFAULT_LOCALE = 'en-US';
|
|
1025
1046
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -1224,7 +1245,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1224
1245
|
locale,
|
|
1225
1246
|
key,
|
|
1226
1247
|
type,
|
|
1227
|
-
groupId:
|
|
1248
|
+
groupId: toDevtoolsGroupId(type, key)
|
|
1228
1249
|
});
|
|
1229
1250
|
}
|
|
1230
1251
|
}
|
|
@@ -1239,10 +1260,24 @@ var IntlifyCore = (function (exports) {
|
|
|
1239
1260
|
return key;
|
|
1240
1261
|
}
|
|
1241
1262
|
}
|
|
1263
|
+
function invalidateLocaleChainCache(ctx, fallback) {
|
|
1264
|
+
const context = ctx;
|
|
1265
|
+
if (isObject(fallback)) {
|
|
1266
|
+
context.__localeChainObjectCache?.delete(fallback);
|
|
1267
|
+
}
|
|
1268
|
+
else {
|
|
1269
|
+
context.__localeChainCache?.delete(fallback);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1242
1272
|
/** @internal */
|
|
1243
1273
|
function updateFallbackLocale(ctx, locale, fallback) {
|
|
1244
|
-
|
|
1245
|
-
|
|
1274
|
+
invalidateLocaleChainCache(ctx, fallback);
|
|
1275
|
+
// NOTE: getMessageContextOptions() queries the root context with *this*
|
|
1276
|
+
// (local) fallback, so the root holds an entry under the same identity key.
|
|
1277
|
+
// Clearing only the local context leaves a stale chain behind.
|
|
1278
|
+
if (ctx.fallbackContext) {
|
|
1279
|
+
invalidateLocaleChainCache(ctx.fallbackContext, fallback);
|
|
1280
|
+
}
|
|
1246
1281
|
ctx.localeFallbacker(ctx, fallback, locale);
|
|
1247
1282
|
}
|
|
1248
1283
|
/** @internal */
|
|
@@ -1290,7 +1325,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1290
1325
|
key,
|
|
1291
1326
|
from,
|
|
1292
1327
|
to: targetLocale,
|
|
1293
|
-
groupId:
|
|
1328
|
+
groupId: toDevtoolsGroupId(type, key)
|
|
1294
1329
|
});
|
|
1295
1330
|
}
|
|
1296
1331
|
}
|
|
@@ -1830,7 +1865,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1830
1865
|
key,
|
|
1831
1866
|
from,
|
|
1832
1867
|
to,
|
|
1833
|
-
groupId:
|
|
1868
|
+
groupId: toDevtoolsGroupId(type, key)
|
|
1834
1869
|
});
|
|
1835
1870
|
}
|
|
1836
1871
|
}
|
|
@@ -1859,7 +1894,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1859
1894
|
key,
|
|
1860
1895
|
message: format,
|
|
1861
1896
|
time: end - start,
|
|
1862
|
-
groupId:
|
|
1897
|
+
groupId: toDevtoolsGroupId(type, key)
|
|
1863
1898
|
});
|
|
1864
1899
|
}
|
|
1865
1900
|
if (startTag && endTag && mark && measure) {
|
|
@@ -1916,7 +1951,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1916
1951
|
type: 'message-compilation',
|
|
1917
1952
|
message: format,
|
|
1918
1953
|
time: end - start,
|
|
1919
|
-
groupId:
|
|
1954
|
+
groupId: toDevtoolsGroupId('translate', key)
|
|
1920
1955
|
});
|
|
1921
1956
|
}
|
|
1922
1957
|
if (startTag && endTag && mark && measure) {
|
|
@@ -1951,7 +1986,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1951
1986
|
type: 'message-evaluation',
|
|
1952
1987
|
value: messaged,
|
|
1953
1988
|
time: end - start,
|
|
1954
|
-
groupId:
|
|
1989
|
+
groupId: toDevtoolsGroupId('translate', msg.key)
|
|
1955
1990
|
});
|
|
1956
1991
|
}
|
|
1957
1992
|
if (startTag && endTag && mark && measure) {
|
|
@@ -2019,7 +2054,7 @@ var IntlifyCore = (function (exports) {
|
|
|
2019
2054
|
error: err.message,
|
|
2020
2055
|
start: err.location && err.location.start.offset,
|
|
2021
2056
|
end: err.location && err.location.end.offset,
|
|
2022
|
-
groupId:
|
|
2057
|
+
groupId: toDevtoolsGroupId('translate', key)
|
|
2023
2058
|
});
|
|
2024
2059
|
}
|
|
2025
2060
|
const message = `Message compilation error: ${err.message}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v11.4.
|
|
2
|
+
* core v11.4.12
|
|
3
3
|
* (c) 2026 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]"===A(e),l=e=>"[object RegExp]"===A(e),s=e=>O(e)&&0===Object.keys(e).length,i=Object.assign,c=Object.create,u=(e=null)=>c(e),f=Object.prototype.hasOwnProperty;function m(e,t){return f.call(e,t)}const _=Array.isArray,E=e=>"function"==typeof e,g=e=>"string"==typeof e,p=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,N=e=>d(e)&&E(e.then)&&E(e.catch),T=Object.prototype.toString,A=e=>T.call(e),O=e=>"[object Object]"===A(e);function L(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function C(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}const I=/^javascript:/i,b=/^(?:href|src|action|formaction)$/i,h=/&#(?:x([0-9a-f]+)|(\d+));?/gi,D=/&(?:Tab|NewLine);/g,R=/:?/gi,S=/[\u0000-\u0020\u007f-\u009f]/g,k=/(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i,M=/(^|[\s"'<>/])on(\w+\s*=)/gi,y=/(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;function F(e,t,n){const r=t||n;if(!r)return e;const a=Number.parseInt(r,t?16:10);return a<=127?String.fromCharCode(a):e}function P(e){const t=e.replace(h,F).replace(D,"").replace(R,":").replace(S,"");return I.test(t)}function U(e,t){if(b.test(e)&&P(t))return"about:blank";const n="style"===e.toLowerCase()?function(e){const t=/url\s*\(/gi;let n,r="",a=0;for(;null!==(n=t.exec(e));){const o=n.index,l=t.lastIndex-1;let s=l+1,i=1,c=null;for(;s<e.length;s++){const t=e[s];if(c)t===c&&(c=null);else if('"'===t||"'"===t)c=t;else if("("===t)i++;else if(")"===t&&(i--,0===i))break}if(0!==i)break;const u=e.slice(l+1,s).trim(),f=u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")?u.slice(1,-1).trim():u;r+=e.slice(a,o),r+=P(f)?"url(about:blank)":e.slice(o,s+1),a=s+1}return r+e.slice(a)}(t):t;return function(e){return e.replace(/&(?![a-z0-9#]{2,6};)/gi,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}(n)}const w={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 v(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 W(e){return d(e)&&0===Y(e)&&(m(e,"b")||m(e,"body"))}const x=["b","body"];const V=["c","cases"];const G=["s","static"];const $=["i","items"];const K=["t","type"];function Y(e){return z(e,K)}const j=["v","value"];function B(e,t){const n=z(e,j);if(null!=n)return n;throw J(t)}const H=["m","modifier"];const X=["k","key"];function z(e,t,n){for(let r=0;r<t.length;r++){const n=t[r];if(m(e,n)&&null!=e[n])return e[n]}return n}const Z=[...x,...V,...G,...$,...X,...H,...j,...K];function J(e){return new Error(`unhandled node type: ${e}`)}function Q(e){return t=>function(e,t){const n=(r=t,z(r,x));var r;if(null==n)throw J(0);if(1===Y(n)){const t=function(e){return z(e,V,[])}(n);return e.plural(t.reduce(((t,n)=>[...t,q(e,n)]),[]))}return q(e,n)}(t,e)}function q(e,t){const n=function(e){return z(e,G)}(t);if(null!=n)return"text"===e.type?n:e.normalize([n]);{const n=function(e){return z(e,$,[])}(t).reduce(((t,n)=>[...t,ee(e,n)]),[]);return e.normalize(n)}}function ee(e,t){const n=Y(t);switch(n){case 3:case 9:case 7:case 8:return B(t,n);case 4:{const r=t;if(m(r,"k")&&r.k)return e.interpolate(e.named(r.k));if(m(r,"key")&&r.key)return e.interpolate(e.named(r.key));throw J(n)}case 5:{const r=t;if(m(r,"i")&&a(r.i))return e.interpolate(e.list(r.i));if(m(r,"index")&&a(r.index))return e.interpolate(e.list(r.index));throw J(n)}case 6:{const n=t,r=function(e){return z(e,H)}(n),a=function(e){const t=z(e,X);if(t)return t;throw J(6)}(n);return e.linked(ee(e,a),r?ee(e,r):void 0,e.type)}default:throw new Error(`unhandled node on format message part: ${n}`)}}let te=u();function ne(e,t){{const t=e.cacheKey;if(t){const n=te[t];return n||(te[t]=Q(e))}return Q(e)}}let re=null;const ae=oe("function:translate");function oe(e){return t=>re&&re.emit(e,t)}const le={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 se(e,t){return null!=t.locale?ce(t.locale):ce(e.locale)}let ie;function ce(e){if(g(e))return e;if(E(e)){if(e.resolvedOnce&&null!=ie)return ie;if("Function"===e.constructor.name){const t=e();if(N(t))throw Error(le.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return ie=t}throw Error(le.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(le.NOT_SUPPORT_LOCALE_TYPE)}function ue(e,t,n){return[...new Set([n,..._(t)?t:d(t)?Object.keys(t).filter((e=>"default"!==e)):g(t)?[t]:[n]])]}function fe(e,t,n){const a=g(n)?n:he,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);const l=r(t);let s=o.__localeChainCache.get(a);s||(s=new Map,o.__localeChainCache.set(a,s));const i=s.get(l);if(i)return i;const c=[];let u=[n];for(;_(u);)u=me(c,u,t);const f=_(t)||!O(t)?t:t.default?t.default:null;return u=g(f)?[f]:f,_(u)&&me(c,u,!1),s.set(l,c),c}function me(e,t,n){let r=!0;for(let a=0;a<t.length&&p(r);a++){const o=t[a];g(o)&&(r=_e(e,t[a],n))}return r}function _e(e,t,n){let r;const a=t.split("-");do{r=Ee(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function Ee(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),(_(n)||O(n))&&n[a]&&(r=n[a])}return r}le.INVALID_ARGUMENT,le.INVALID_DATE_ARGUMENT,le.INVALID_ISO_DATE_ARGUMENT,le.NOT_SUPPORT_NON_STRING_MESSAGE,le.NOT_SUPPORT_LOCALE_PROMISE_VALUE,le.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,le.NOT_SUPPORT_LOCALE_TYPE;const ge=[];ge[0]={w:[0],i:[3,0],"[":[4],o:[7]},ge[1]={w:[1],".":[2],"[":[4],o:[7]},ge[2]={w:[2],i:[3,0],0:[3,0]},ge[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},ge[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},ge[5]={"'":[4,0],o:8,l:[5,0]},ge[6]={'"':[4,0],o:8,l:[6,0]};const pe=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function de(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 Ne(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,pe.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 Te(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,f=0;const m=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,m[0](),!0}for(m[0]=()=>{void 0===r?r=a:r+=a},m[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},m[2]=()=>{m[0](),f++},m[3]=()=>{if(f>0)f--,u=4,m[0]();else{if(f=0,void 0===r)return!1;if(r=Ne(r),!1===r)return!1;m[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!_()){if(o=de(n),i=ge[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=m[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const Ae=new Map;function Oe(e,t){return d(e)?e[t]:null}function Le(e,t){if(!d(e))return null;let n=Ae.get(t);if(n||(n=Te(t),n&&Ae.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=n[o];if(Z.includes(e)&&W(a))return null;if(!d(a))return null;if(!m(a,e))return null;const t=a[e];if(void 0===t)return null;if(E(a))return null;a=t,o++}return a}const Ce={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,INVALID_NUMBER_ARGUMENT:8,INVALID_DATE_ARGUMENT:9},Ie={[Ce.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Ce.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Ce.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Ce.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Ce.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Ce.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Ce.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.",[Ce.INVALID_NUMBER_ARGUMENT]:"Invalid argument for number formatting: expected a number but received '{value}'.",[Ce.INVALID_DATE_ARGUMENT]:"Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'."};const be="11.4.9",he="en-US",De=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let Re,Se,ke;function Me(e){Re=e}function ye(e){Se=e}function Fe(e){ke=e}let Pe=null;let Ue=null;let we=0;const ve=e=>({[e]:u()});function We(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return g(r)?r:t}return t}function xe(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(xe(e,t[r]))return!0;return!1}function Ge(e,t,n,r,a,o,l){const{fallbackLocale:s,localeFallbacker:i,onWarn:c}=e,u=i(e,s,n);for(let f=0;f<u.length;f++){const n=u[f],a=(r[n]||{})[t];if(O(a)&&g(n))return n;We(e,t,n,0,l)}return null}function $e(e,t,n){let r=`${e}__${t}`;return O(n)&&!s(n)&&(r=`${r}__${JSON.stringify(n)}`),r}function Ke(e,t,n){for(const r in n){const n=`${t}__${r}`;for(const t of e.keys())(t===n||t.startsWith(`${n}__`))&&e.delete(t)}}function Ye(e,t,n,r){const[,a,o,l]=e;let s=n;return g(a)?t.key=a:O(a)&&Object.keys(a).forEach((e=>{r.includes(e)?s[e]=a[e]:t[e]=a[e]})),g(o)?t.locale=o:O(o)&&(s=o),O(l)&&(s=l),s}const je=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Be(...e){const[t]=e,n=u(),r=u();let l;if(g(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(le.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(le.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(le.INVALID_DATE_ARGUMENT);l=t}else{if(!a(t))throw Error(le.INVALID_ARGUMENT);l=t}const s=Ye(e,n,r,je);return[n.key||"",l,n,s]}const He=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Xe(...e){const[t]=e,n=u(),r=u();if(!a(t))throw Error(le.INVALID_ARGUMENT);const o=t,l=Ye(e,n,r,He);return[n.key||"",o,n,l]}const ze=e=>e,Ze=e=>"",Je="text",Qe=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),qe=e=>null==e?"":_(e)||O(e)&&e.toString===T?JSON.stringify(e,null,2):String(e);function et(e,t){return e=Math.abs(e),2===t?1===e?0:1:Math.min(e,2)}function tt(e={}){const t=e.locale,n=function(e){const t=a(e.pluralIndex)?e.pluralIndex:-1;return a(e.named?.count)?e.named.count:a(e.named?.n)?e.named.n:t}(e),r=g(t)&&E(e.pluralRules?.[t])?e.pluralRules[t]:et,o=r===et?void 0:et,l=e.list||[],s=e.named||u();a(e.pluralIndex)&&(s.count||=e.pluralIndex,s.n||=e.pluralIndex);function c(t,n){const r=E(e.messages)?e.messages(t,!!n):!!d(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):Ze)}const f=E(e.processor?.normalize)?e.processor.normalize:Qe,m=E(e.processor?.interpolate)?e.processor.interpolate:qe,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?d(r)?(l=r.modifier||l,o=r.type||o):g(r)&&(l=r||l):2===n.length&&(g(r)&&(l=r||l),g(a)&&(o=a||o));const s=c(t,!0)(p),i=""===s||void 0===s?t:s,u="vnode"===o&&_(i)&&l?i[0]:i;return l?(f=l,e.modifiers?e.modifiers[f]:ze)(u,o):u;var f},message:c,type:g(e.processor?.type)?e.processor.type:Je,interpolate:m,normalize:f,values:i(u(),l,s)};return p}const nt=()=>"",rt=e=>E(e);function at(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,f=c(e,r,n);let m,_=u(),E=null;for(let p=0;p<f.length&&(m=f[p],_=l[m]||u(),null===(E=i(_,t))&&(E=_[t]),!(g(E)||W(E)||rt(E)));p++)if(!Ve(m,f)){const n=We(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,_]}function ot(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(rt(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 lt(...e){const[t,n,r]=e,o=u();if(!(g(t)||a(t)||rt(t)||W(t)))throw Error(le.INVALID_ARGUMENT);const l=a(t)?String(t):(rt(t),t);return a(n)?o.plural=n:g(n)?o.default=n:O(n)&&!s(n)?o.named=n:_(n)&&(o.list=n),a(r)?o.plural=r:g(r)?o.default=r:O(r)&&i(o,r),[l,o]}return Me(ne),ye(Le),Fe(fe),e.AST_NODE_PROPS_KEYS=Z,e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=10,e.CompileErrorCodes=w,e.CoreErrorCodes=le,e.CoreWarnCodes=Ce,e.DATETIME_FORMAT_OPTIONS_KEYS=je,e.DEFAULT_LOCALE=he,e.DEFAULT_MESSAGE_DATA_TYPE=Je,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=He,e.VERSION=be,e.clearCompileCache=function(){te=u()},e.clearDateTimeFormat=function(e,t,n){Ke(e.__datetimeFormatters,t,n)},e.clearNumberFormat=function(e,t,n){Ke(e.__numberFormatters,t,n)},e.compile=ne,e.createCompileError=v,e.createCoreContext=function(e={}){const t=E(e.onWarn)?e.onWarn:L,n=g(e.version)?e.version:be,r=g(e.locale)||E(e.locale)?e.locale:he,a=E(r)?he:r,o=_(e.fallbackLocale)||O(e.fallbackLocale)||g(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,s=O(e.messages)?e.messages:ve(a),c=O(e.datetimeFormats)?e.datetimeFormats:ve(a),f=O(e.numberFormats)?e.numberFormats:ve(a),m=i(u(),e.modifiers,{upper:(e,t)=>"text"===t&&g(e)?e.toUpperCase():"vnode"===t&&d(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&g(e)?e.toLowerCase():"vnode"===t&&d(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&g(e)?De(e):"vnode"===t&&d(e)&&"__v_isVNode"in e?De(e.children):e}),N=e.pluralRules||u(),T=E(e.missing)?e.missing:null,A=!p(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,C=!p(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,I=!!e.fallbackFormat,b=!!e.unresolving,h=E(e.postTranslation)?e.postTranslation:null,D=O(e.processor)?e.processor:null,R=!p(e.warnHtmlMessage)||e.warnHtmlMessage,S=!!e.escapeParameter,k=E(e.messageCompiler)?e.messageCompiler:Re,M=E(e.messageResolver)?e.messageResolver:Se||Oe,y=E(e.localeFallbacker)?e.localeFallbacker:ke||ue,F=d(e.fallbackContext)?e.fallbackContext:void 0,P=e,U=d(P.__datetimeFormatters)?P.__datetimeFormatters:new Map,w=d(P.__numberFormatters)?P.__numberFormatters:new Map,v=d(P.__meta)?P.__meta:{};we++;const W={version:n,cid:we,locale:r,fallbackLocale:o,messages:s,modifiers:m,pluralRules:N,missing:T,missingWarn:A,fallbackWarn:C,fallbackFormat:I,unresolving:b,postTranslation:h,processor:D,warnHtmlMessage:R,escapeParameter:S,messageCompiler:k,messageResolver:M,localeFallbacker:y,fallbackContext:F,onWarn:t,__meta:v};return W.datetimeFormats=c,W.numberFormats=f,W.__datetimeFormatters=U,W.__numberFormatters=w,W},e.createCoreError=function(e){return v(e,null,void 0)},e.createMessageContext=tt,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,onWarn:l}=e,{__datetimeFormatters:s}=e;if(!g(t[0])&&!o(t[0])&&!a(t[0]))return"";const[c,u,f,m]=Be(...t),_=(p(f.missingWarn)?f.missingWarn:e.missingWarn,p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,!!f.part),E=se(e,f);if(!g(c)||""===c){const e=new Intl.DateTimeFormat(E.replace(/!/g,""),m);return _?e.formatToParts(u):e.format(u)}const d=Ge(e,c,E,n,0,0,"datetime format");if(!g(d))return r?-1:c;const N=n[d][c],T=$e(d,c,m);let A=s.get(T);return A||(A=new Intl.DateTimeFormat(d,i({},N,m)),s.set(T,A)),_?A.formatToParts(u):A.format(u)},e.fallbackWithLocaleChain=fe,e.fallbackWithSimple=ue,e.getAdditionalMeta=()=>Pe,e.getDevToolsHook=function(){return re},e.getFallbackContext=()=>Ue,e.getLocale=se,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(Ie[e],...n)},e.handleMissing=We,e.initI18nDevTools=function(e,t,n){re&&re.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=xe,e.isImplicitFallback=Ve,e.isMessageAST=W,e.isMessageFunction=rt,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,onWarn:o}=e,{__numberFormatters:l}=e;if(!a(t[0]))return"";const[s,c,u,f]=Xe(...t),m=(p(u.missingWarn)?u.missingWarn:e.missingWarn,p(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn,!!u.part),_=se(e,u);if(!g(s)||""===s){const e=new Intl.NumberFormat(_.replace(/!/g,""),f);return m?e.formatToParts(c):e.format(c)}const E=Ge(e,s,_,n,0,0,"number format");if(!g(E))return r?-1:s;const d=n[E][s],N=$e(E,s,f);let T=l.get(N);return T||(T=new Intl.NumberFormat(E,i({},d,f)),l.set(N,T)),m?T.formatToParts(c):T.format(c)},e.parse=Te,e.parseDateTimeArgs=Be,e.parseNumberArgs=Xe,e.parseTranslateArgs=lt,e.registerLocaleFallbacker=Fe,e.registerMessageCompiler=Me,e.registerMessageResolver=ye,e.resolveLocale=ce,e.resolveValue=Le,e.resolveWithKeyValue=Oe,e.setAdditionalMeta=e=>{Pe=e},e.setDevToolsHook=function(e){re=e},e.setFallbackContext=e=>{Ue=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[c,f]=lt(...t),m=p(f.missingWarn)?f.missingWarn:e.missingWarn,N=p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,T=p(f.escapeParameter)?f.escapeParameter:e.escapeParameter,A=!!f.resolvedMessage,O=g(f.default)||p(f.default)?p(f.default)?l?c:()=>c:f.default:n?l?c:()=>c:null,L=n||null!=O&&(g(O)||E(O)),I=se(e,f);T&&function(e){_(e.list)?e.list=e.list.map((e=>g(e)?C(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{g(e.named[t])&&(e.named[t]=C(e.named[t]))}))}(f);let[b,h,D]=A?[c,I,i[I]||u()]:at(e,c,I,s,N,m),R=b,S=c;if(A||g(R)||W(R)||rt(R)||L&&(R=O,S=R),!(A||(g(R)||W(R)||rt(R))&&g(h)))return o?-1:c;let F=!1;const w=rt(R)?R:ot(e,c,h,R,S,(()=>{F=!0}));if(F)return R;const v=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:f}=e,m=(r,a)=>{let o=s(n,r);if(null==o&&(f||a)){const[n,,a]=at(f||e,r,t,i,c,u);o=n??s(a,r)}if(g(o)||W(o)){let n=!1;const a=ot(e,r,t,o,r,(()=>{n=!0}));return n?nt:a}return rt(o)?o:nt},_={locale:t,modifiers:o,pluralRules:l,messages:m};e.processor&&(_.processor=e.processor);r.list&&(_.list=r.list);r.named&&(_.named=r.named);a(r.plural)&&(_.pluralIndex=r.plural);return _}(e,h,D,f),x=function(e,t,n){const r=t(n);return r}(0,w,tt(v));let V=r?r(x,c):x;var G;return T&&g(V)&&(G=(G=(G=V).replace(/([\w:-]+)\s*=\s*"([^"]*)"/g,((e,t,n)=>`${t}="${U(t,n)}"`))).replace(/([\w:-]+)\s*=\s*'([^']*)'/g,((e,t,n)=>`${t}='${U(t,n)}'`)),k.test(G)&&(G=G.replace(M,"$1on$2")),V=G.replace(y,((e,t,n,r)=>P(r)?`${t}${n}about:blank`:e))),V},e.translateDevTools=ae,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]"===A(e),l=e=>"[object RegExp]"===A(e),s=e=>O(e)&&0===Object.keys(e).length,i=Object.assign,c=Object.create,u=(e=null)=>c(e),f=Object.prototype.hasOwnProperty;function m(e,t){return f.call(e,t)}const _=Array.isArray,E=e=>"function"==typeof e,g=e=>"string"==typeof e,p=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,N=e=>d(e)&&E(e.then)&&E(e.catch),T=Object.prototype.toString,A=e=>T.call(e),O=e=>"[object Object]"===A(e);function C(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}function b(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}const h=/^javascript:/i,L=/^(?:href|src|action|formaction)$/i,I=/&#(?:x([0-9a-f]+)|(\d+));?/gi,k=/&(?:Tab|NewLine);/g,D=/:?/gi,R=/[\u0000-\u0020\u007f-\u009f]/g,S=/(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i,M=/(^|[\s"'<>/])on(\w+\s*=)/gi,y=/(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;function F(e,t,n){const r=t||n;if(!r)return e;const a=Number.parseInt(r,t?16:10);return a<=127?String.fromCharCode(a):e}function P(e){const t=e.replace(I,F).replace(k,"").replace(D,":").replace(R,"");return h.test(t)}function U(e,t){if(L.test(e)&&P(t))return"about:blank";const n="style"===e.toLowerCase()?function(e){const t=/url\s*\(/gi;let n,r="",a=0;for(;null!==(n=t.exec(e));){const o=n.index,l=t.lastIndex-1;let s=l+1,i=1,c=null;for(;s<e.length;s++){const t=e[s];if(c)t===c&&(c=null);else if('"'===t||"'"===t)c=t;else if("("===t)i++;else if(")"===t&&(i--,0===i))break}if(0!==i)break;const u=e.slice(l+1,s).trim(),f=u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'")?u.slice(1,-1).trim():u;r+=e.slice(a,o),r+=P(f)?"url(about:blank)":e.slice(o,s+1),a=s+1}return r+e.slice(a)}(t):t;return function(e){return e.replace(/&(?![a-z0-9#]{2,6};)/gi,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}(n)}const w={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 v(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 W(e){return d(e)&&0===K(e)&&(m(e,"b")||m(e,"body"))}const x=["b","body"];const V=["c","cases"];const G=["s","static"];const $=["i","items"];const j=["t","type"];function K(e){return z(e,j)}const Y=["v","value"];function B(e,t){const n=z(e,Y);if(null!=n)return n;throw J(t)}const H=["m","modifier"];const X=["k","key"];function z(e,t,n){for(let r=0;r<t.length;r++){const n=t[r];if(m(e,n)&&null!=e[n])return e[n]}return n}const Z=[...x,...V,...G,...$,...X,...H,...Y,...j];function J(e){return new Error(`unhandled node type: ${e}`)}function Q(e){return t=>function(e,t){const n=(r=t,z(r,x));var r;if(null==n)throw J(0);if(1===K(n)){const t=function(e){return z(e,V,[])}(n);return e.plural(t.reduce(((t,n)=>[...t,q(e,n)]),[]))}return q(e,n)}(t,e)}function q(e,t){const n=function(e){return z(e,G)}(t);if(null!=n)return"text"===e.type?n:e.normalize([n]);{const n=function(e){return z(e,$,[])}(t).reduce(((t,n)=>[...t,ee(e,n)]),[]);return e.normalize(n)}}function ee(e,t){const n=K(t);switch(n){case 3:case 9:case 7:case 8:return B(t,n);case 4:{const r=t;if(m(r,"k")&&r.k)return e.interpolate(e.named(r.k));if(m(r,"key")&&r.key)return e.interpolate(e.named(r.key));throw J(n)}case 5:{const r=t;if(m(r,"i")&&a(r.i))return e.interpolate(e.list(r.i));if(m(r,"index")&&a(r.index))return e.interpolate(e.list(r.index));throw J(n)}case 6:{const n=t,r=function(e){return z(e,H)}(n),a=function(e){const t=z(e,X);if(t)return t;throw J(6)}(n);return e.linked(ee(e,a),r?ee(e,r):void 0,e.type)}default:throw new Error(`unhandled node on format message part: ${n}`)}}let te=u();function ne(e,t){{const t=e.cacheKey;if(t){const n=te[t];return n||(te[t]=Q(e))}return Q(e)}}let re=null;const ae=oe("function:translate");function oe(e){return t=>re&&re.emit(e,t)}const le={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 se(e,t){return null!=t.locale?ce(t.locale):ce(e.locale)}let ie;function ce(e){if(g(e))return e;if(E(e)){if(e.resolvedOnce&&null!=ie)return ie;if("Function"===e.constructor.name){const t=e();if(N(t))throw Error(le.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return ie=t}throw Error(le.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(le.NOT_SUPPORT_LOCALE_TYPE)}function ue(e,t,n){return[...new Set([n,..._(t)?t:d(t)?Object.keys(t).filter((e=>"default"!==e)):g(t)?[t]:[n]])]}function fe(e,t,n){const r=g(n)?n:Ie,a=e;let o;d(t)?(a.__localeChainObjectCache||(a.__localeChainObjectCache=new WeakMap),o=a.__localeChainObjectCache.get(t),o||(o=new Map,a.__localeChainObjectCache.set(t,o))):(a.__localeChainCache||(a.__localeChainCache=new Map),o=a.__localeChainCache.get(t),o||(o=new Map,a.__localeChainCache.set(t,o)));const l=o.get(r);if(l)return l;const s=[];let i=[n];for(;_(i);)i=me(s,i,t);const c=_(t)||!O(t)?t:t.default?t.default:null;return i=g(c)?[c]:c,_(i)&&me(s,i,!1),o.set(r,s),s}function me(e,t,n){let r=!0;for(let a=0;a<t.length&&p(r);a++){const o=t[a];g(o)&&(r=_e(e,t[a],n))}return r}function _e(e,t,n){let r;const a=t.split("-");do{r=Ee(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function Ee(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),(_(n)||O(n))&&n[a]&&(r=n[a])}return r}le.INVALID_ARGUMENT,le.INVALID_DATE_ARGUMENT,le.INVALID_ISO_DATE_ARGUMENT,le.NOT_SUPPORT_NON_STRING_MESSAGE,le.NOT_SUPPORT_LOCALE_PROMISE_VALUE,le.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,le.NOT_SUPPORT_LOCALE_TYPE;const ge=[];ge[0]={w:[0],i:[3,0],"[":[4],o:[7]},ge[1]={w:[1],".":[2],"[":[4],o:[7]},ge[2]={w:[2],i:[3,0],0:[3,0]},ge[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},ge[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},ge[5]={"'":[4,0],o:8,l:[5,0]},ge[6]={'"':[4,0],o:8,l:[6,0]};const pe=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function de(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 Ne(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,pe.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 Te(e){const t=[];let n,r,a,o,l,s,i,c=-1,u=0,f=0;const m=[];function _(){const t=e[c+1];if(5===u&&"'"===t||6===u&&'"'===t)return c++,a="\\"+t,m[0](),!0}for(m[0]=()=>{void 0===r?r=a:r+=a},m[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},m[2]=()=>{m[0](),f++},m[3]=()=>{if(f>0)f--,u=4,m[0]();else{if(f=0,void 0===r)return!1;if(r=Ne(r),!1===r)return!1;m[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!_()){if(o=de(n),i=ge[u],l=i[o]||i.l||8,8===l)return;if(u=l[0],void 0!==l[1]&&(s=m[l[1]],s&&(a=n,!1===s())))return;if(7===u)return t}}const Ae=new Map;function Oe(e,t){return d(e)?e[t]:null}function Ce(e,t){if(!d(e))return null;let n=Ae.get(t);if(n||(n=Te(t),n&&Ae.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=n[o];if(Z.includes(e)&&W(a))return null;if(!d(a))return null;if(!m(a,e))return null;const t=a[e];if(void 0===t)return null;if(E(a))return null;a=t,o++}return a}const be={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,INVALID_NUMBER_ARGUMENT:8,INVALID_DATE_ARGUMENT:9},he={[be.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[be.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[be.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[be.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[be.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[be.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[be.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.",[be.INVALID_NUMBER_ARGUMENT]:"Invalid argument for number formatting: expected a number but received '{value}'.",[be.INVALID_DATE_ARGUMENT]:"Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'."};const Le="11.4.12",Ie="en-US",ke=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let De,Re,Se;function Me(e){De=e}function ye(e){Re=e}function Fe(e){Se=e}let Pe=null;let Ue=null;let we=0;const ve=e=>({[e]:u()});function We(e,t,n,r,a){const{missing:o,onWarn:l}=e;if(null!==o){const r=o(e,n,t,a);return g(r)?r:t}return t}function xe(e,t){const n=e;d(t)?n.__localeChainObjectCache?.delete(t):n.__localeChainCache?.delete(t)}function Ve(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function Ge(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if(Ve(e,t[r]))return!0;return!1}function $e(e,t,n,r,a,o,l){const{fallbackLocale:s,localeFallbacker:i,onWarn:c}=e,u=i(e,s,n);for(let f=0;f<u.length;f++){const n=u[f],a=(r[n]||{})[t];if(O(a)&&g(n))return n;We(e,t,n,0,l)}return null}function je(e,t,n){let r=`${e}__${t}`;return O(n)&&!s(n)&&(r=`${r}__${JSON.stringify(n)}`),r}function Ke(e,t,n){for(const r in n){const n=`${t}__${r}`;for(const t of e.keys())(t===n||t.startsWith(`${n}__`))&&e.delete(t)}}function Ye(e,t,n,r){const[,a,o,l]=e;let s=n;return g(a)?t.key=a:O(a)&&Object.keys(a).forEach((e=>{r.includes(e)?s[e]=a[e]:t[e]=a[e]})),g(o)?t.locale=o:O(o)&&(s=o),O(l)&&(s=l),s}const Be=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function He(...e){const[t]=e,n=u(),r=u();let l;if(g(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(le.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(le.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(le.INVALID_DATE_ARGUMENT);l=t}else{if(!a(t))throw Error(le.INVALID_ARGUMENT);l=t}const s=Ye(e,n,r,Be);return[n.key||"",l,n,s]}const Xe=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function ze(...e){const[t]=e,n=u(),r=u();if(!a(t))throw Error(le.INVALID_ARGUMENT);const o=t,l=Ye(e,n,r,Xe);return[n.key||"",o,n,l]}const Ze=e=>e,Je=e=>"",Qe="text",qe=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),et=e=>null==e?"":_(e)||O(e)&&e.toString===T?JSON.stringify(e,null,2):String(e);function tt(e,t){return e=Math.abs(e),2===t?1===e?0:1:Math.min(e,2)}function nt(e={}){const t=e.locale,n=function(e){const t=a(e.pluralIndex)?e.pluralIndex:-1;return a(e.named?.count)?e.named.count:a(e.named?.n)?e.named.n:t}(e),r=g(t)&&E(e.pluralRules?.[t])?e.pluralRules[t]:tt,o=r===tt?void 0:tt,l=e.list||[],s=e.named||u();a(e.pluralIndex)&&(s.count||=e.pluralIndex,s.n||=e.pluralIndex);function c(t,n){const r=E(e.messages)?e.messages(t,!!n):!!d(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):Je)}const f=E(e.processor?.normalize)?e.processor.normalize:qe,m=E(e.processor?.interpolate)?e.processor.interpolate:et,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?d(r)?(l=r.modifier||l,o=r.type||o):g(r)&&(l=r||l):2===n.length&&(g(r)&&(l=r||l),g(a)&&(o=a||o));const s=c(t,!0)(p),i=""===s||void 0===s?t:s,u="vnode"===o&&_(i)&&l?i[0]:i;return l?(f=l,e.modifiers?e.modifiers[f]:Ze)(u,o):u;var f},message:c,type:g(e.processor?.type)?e.processor.type:Qe,interpolate:m,normalize:f,values:i(u(),l,s)};return p}const rt=()=>"",at=e=>E(e);function ot(e,t,n,r,a,o){const{messages:l,onWarn:s,messageResolver:i,localeFallbacker:c}=e,f=c(e,r,n);let m,_=u(),E=null;for(let p=0;p<f.length&&(m=f[p],_=l[m]||u(),null===(E=i(_,t))&&(E=_[t]),!(g(E)||W(E)||at(E)));p++)if(!Ge(m,f)){const n=We(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,_]}function lt(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(at(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 st(...e){const[t,n,r]=e,o=u();if(!(g(t)||a(t)||at(t)||W(t)))throw Error(le.INVALID_ARGUMENT);const l=a(t)?String(t):(at(t),t);return a(n)?o.plural=n:g(n)?o.default=n:O(n)&&!s(n)?o.named=n:_(n)&&(o.list=n),a(r)?o.plural=r:g(r)?o.default=r:O(r)&&i(o,r),[l,o]}return Me(ne),ye(Ce),Fe(fe),e.AST_NODE_PROPS_KEYS=Z,e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=10,e.CompileErrorCodes=w,e.CoreErrorCodes=le,e.CoreWarnCodes=be,e.DATETIME_FORMAT_OPTIONS_KEYS=Be,e.DEFAULT_LOCALE=Ie,e.DEFAULT_MESSAGE_DATA_TYPE=Qe,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=Xe,e.VERSION=Le,e.clearCompileCache=function(){te=u()},e.clearDateTimeFormat=function(e,t,n){Ke(e.__datetimeFormatters,t,n)},e.clearNumberFormat=function(e,t,n){Ke(e.__numberFormatters,t,n)},e.compile=ne,e.createCompileError=v,e.createCoreContext=function(e={}){const t=E(e.onWarn)?e.onWarn:C,n=g(e.version)?e.version:Le,r=g(e.locale)||E(e.locale)?e.locale:Ie,a=E(r)?Ie:r,o=_(e.fallbackLocale)||O(e.fallbackLocale)||g(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,s=O(e.messages)?e.messages:ve(a),c=O(e.datetimeFormats)?e.datetimeFormats:ve(a),f=O(e.numberFormats)?e.numberFormats:ve(a),m=i(u(),e.modifiers,{upper:(e,t)=>"text"===t&&g(e)?e.toUpperCase():"vnode"===t&&d(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>"text"===t&&g(e)?e.toLowerCase():"vnode"===t&&d(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>"text"===t&&g(e)?ke(e):"vnode"===t&&d(e)&&"__v_isVNode"in e?ke(e.children):e}),N=e.pluralRules||u(),T=E(e.missing)?e.missing:null,A=!p(e.missingWarn)&&!l(e.missingWarn)||e.missingWarn,b=!p(e.fallbackWarn)&&!l(e.fallbackWarn)||e.fallbackWarn,h=!!e.fallbackFormat,L=!!e.unresolving,I=E(e.postTranslation)?e.postTranslation:null,k=O(e.processor)?e.processor:null,D=!p(e.warnHtmlMessage)||e.warnHtmlMessage,R=!!e.escapeParameter,S=E(e.messageCompiler)?e.messageCompiler:De,M=E(e.messageResolver)?e.messageResolver:Re||Oe,y=E(e.localeFallbacker)?e.localeFallbacker:Se||ue,F=d(e.fallbackContext)?e.fallbackContext:void 0,P=e,U=d(P.__datetimeFormatters)?P.__datetimeFormatters:new Map,w=d(P.__numberFormatters)?P.__numberFormatters:new Map,v=d(P.__meta)?P.__meta:{};we++;const W={version:n,cid:we,locale:r,fallbackLocale:o,messages:s,modifiers:m,pluralRules:N,missing:T,missingWarn:A,fallbackWarn:b,fallbackFormat:h,unresolving:L,postTranslation:I,processor:k,warnHtmlMessage:D,escapeParameter:R,messageCompiler:S,messageResolver:M,localeFallbacker:y,fallbackContext:F,onWarn:t,__meta:v};return W.datetimeFormats=c,W.numberFormats=f,W.__datetimeFormatters=U,W.__numberFormatters=w,W},e.createCoreError=function(e){return v(e,null,void 0)},e.createMessageContext=nt,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,onWarn:l}=e,{__datetimeFormatters:s}=e;if(!g(t[0])&&!o(t[0])&&!a(t[0]))return"";const[c,u,f,m]=He(...t),_=(p(f.missingWarn)?f.missingWarn:e.missingWarn,p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,!!f.part),E=se(e,f);if(!g(c)||""===c){const e=new Intl.DateTimeFormat(E.replace(/!/g,""),m);return _?e.formatToParts(u):e.format(u)}const d=$e(e,c,E,n,0,0,"datetime format");if(!g(d))return r?-1:c;const N=n[d][c],T=je(d,c,m);let A=s.get(T);return A||(A=new Intl.DateTimeFormat(d,i({},N,m)),s.set(T,A)),_?A.formatToParts(u):A.format(u)},e.fallbackWithLocaleChain=fe,e.fallbackWithSimple=ue,e.getAdditionalMeta=()=>Pe,e.getDevToolsHook=function(){return re},e.getFallbackContext=()=>Ue,e.getLocale=se,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(he[e],...n)},e.handleMissing=We,e.initI18nDevTools=function(e,t,n){re&&re.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=Ve,e.isImplicitFallback=Ge,e.isMessageAST=W,e.isMessageFunction=at,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,onWarn:o}=e,{__numberFormatters:l}=e;if(!a(t[0]))return"";const[s,c,u,f]=ze(...t),m=(p(u.missingWarn)?u.missingWarn:e.missingWarn,p(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn,!!u.part),_=se(e,u);if(!g(s)||""===s){const e=new Intl.NumberFormat(_.replace(/!/g,""),f);return m?e.formatToParts(c):e.format(c)}const E=$e(e,s,_,n,0,0,"number format");if(!g(E))return r?-1:s;const d=n[E][s],N=je(E,s,f);let T=l.get(N);return T||(T=new Intl.NumberFormat(E,i({},d,f)),l.set(N,T)),m?T.formatToParts(c):T.format(c)},e.parse=Te,e.parseDateTimeArgs=He,e.parseNumberArgs=ze,e.parseTranslateArgs=st,e.registerLocaleFallbacker=Fe,e.registerMessageCompiler=Me,e.registerMessageResolver=ye,e.resolveLocale=ce,e.resolveValue=Ce,e.resolveWithKeyValue=Oe,e.setAdditionalMeta=e=>{Pe=e},e.setDevToolsHook=function(e){re=e},e.setFallbackContext=e=>{Ue=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[c,f]=st(...t),m=p(f.missingWarn)?f.missingWarn:e.missingWarn,N=p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,T=p(f.escapeParameter)?f.escapeParameter:e.escapeParameter,A=!!f.resolvedMessage,O=g(f.default)||p(f.default)?p(f.default)?l?c:()=>c:f.default:n?l?c:()=>c:null,C=n||null!=O&&(g(O)||E(O)),h=se(e,f);T&&function(e){_(e.list)?e.list=e.list.map((e=>g(e)?b(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{g(e.named[t])&&(e.named[t]=b(e.named[t]))}))}(f);let[L,I,k]=A?[c,h,i[h]||u()]:ot(e,c,h,s,N,m),D=L,R=c;if(A||g(D)||W(D)||at(D)||C&&(D=O,R=D),!(A||(g(D)||W(D)||at(D))&&g(I)))return o?-1:c;let F=!1;const w=at(D)?D:lt(e,c,I,D,R,(()=>{F=!0}));if(F)return D;const v=function(e,t,n,r){const{modifiers:o,pluralRules:l,messageResolver:s,fallbackLocale:i,fallbackWarn:c,missingWarn:u,fallbackContext:f}=e,m=(r,a)=>{let o=s(n,r);if(null==o&&(f||a)){const[n,,a]=ot(f||e,r,t,i,c,u);o=n??s(a,r)}if(g(o)||W(o)){let n=!1;const a=lt(e,r,t,o,r,(()=>{n=!0}));return n?rt:a}return at(o)?o:rt},_={locale:t,modifiers:o,pluralRules:l,messages:m};e.processor&&(_.processor=e.processor);r.list&&(_.list=r.list);r.named&&(_.named=r.named);a(r.plural)&&(_.pluralIndex=r.plural);return _}(e,I,k,f),x=function(e,t,n){const r=t(n);return r}(0,w,nt(v));let V=r?r(x,c):x;var G;return T&&g(V)&&(G=(G=(G=V).replace(/([\w:-]+)\s*=\s*"([^"]*)"/g,((e,t,n)=>`${t}="${U(t,n)}"`))).replace(/([\w:-]+)\s*=\s*'([^']*)'/g,((e,t,n)=>`${t}='${U(t,n)}'`)),S.test(G)&&(G=G.replace(M,"$1on$2")),V=G.replace(y,((e,t,n,r)=>P(r)?`${t}${n}about:blank`:e))),V},e.translateDevTools=ae,e.updateFallbackLocale=function(e,t,n){xe(e,n),e.fallbackContext&&xe(e.fallbackContext,n),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": "11.4.
|
|
3
|
+
"version": "11.4.12",
|
|
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": "11.4.
|
|
37
|
-
"@intlify/shared": "11.4.
|
|
36
|
+
"@intlify/core-base": "11.4.12",
|
|
37
|
+
"@intlify/shared": "11.4.12"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 22"
|