@intlify/core 11.4.13 → 11.4.14
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 +33 -24
- package/dist/core.esm-browser.prod.js +2 -2
- package/dist/core.global.js +33 -23
- 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 +32 -21
- package/dist/core.runtime.esm-browser.prod.js +2 -2
- package/dist/core.runtime.global.js +32 -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.14
|
|
3
3
|
* (c) 2026 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -63,7 +63,6 @@ var IntlifyCore = (function (exports) {
|
|
|
63
63
|
function hasOwn(obj, key) {
|
|
64
64
|
return hasOwnProperty.call(obj, key);
|
|
65
65
|
}
|
|
66
|
-
/* eslint-enable */
|
|
67
66
|
/**
|
|
68
67
|
* Useful Utilities By Evan you
|
|
69
68
|
* Modified by kazuya kawaguchi
|
|
@@ -166,6 +165,10 @@ var IntlifyCore = (function (exports) {
|
|
|
166
165
|
const controlOrWhitespacePattern = /[\u0000-\u0020\u007f-\u009f]/g;
|
|
167
166
|
const eventHandlerPattern = /(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i;
|
|
168
167
|
const eventHandlerAttributePattern = /(^|[\s"'<>/])on(\w+\s*=)/gi;
|
|
168
|
+
// `srcdoc` holds a whole HTML document: its value is entity-decoded and then parsed again,
|
|
169
|
+
// so neither escaping the value nor neutralizing `on*` inside it makes it inert
|
|
170
|
+
const srcdocPattern = /(?:^|[\s"'<>/])srcdoc\s*=/i;
|
|
171
|
+
const srcdocAttributePattern = /(^|[\s"'<>/])s(rcdoc\s*=)/gi;
|
|
169
172
|
const unquotedUrlAttributePattern = /(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;
|
|
170
173
|
function decodeNumericCharacterReference(match, hex, decimal) {
|
|
171
174
|
const digits = hex || decimal;
|
|
@@ -253,6 +256,15 @@ var IntlifyCore = (function (exports) {
|
|
|
253
256
|
// Neutralize event handler attributes by escaping 'on'
|
|
254
257
|
html = html.replace(eventHandlerAttributePattern, '$1on$2');
|
|
255
258
|
}
|
|
259
|
+
// Detect and neutralize `srcdoc` attributes
|
|
260
|
+
if (srcdocPattern.test(html)) {
|
|
261
|
+
{
|
|
262
|
+
warn('Potentially dangerous srcdoc attribute detected in translation. ' +
|
|
263
|
+
'Consider removing srcdoc from your translation messages.');
|
|
264
|
+
}
|
|
265
|
+
// Neutralize `srcdoc` by escaping 's': character references are not decoded in attribute names
|
|
266
|
+
html = html.replace(srcdocAttributePattern, '$1s$2');
|
|
267
|
+
}
|
|
256
268
|
// Disable javascript: URLs in unquoted attributes
|
|
257
269
|
html = html.replace(unquotedUrlAttributePattern, (match, boundary, prefix, attrValue) => hasJavascriptScheme(attrValue) ? `${boundary}${prefix}about:blank` : match);
|
|
258
270
|
return html;
|
|
@@ -493,8 +505,7 @@ var IntlifyCore = (function (exports) {
|
|
|
493
505
|
return cached;
|
|
494
506
|
}
|
|
495
507
|
// compose message function from message (AST)
|
|
496
|
-
return (compileCache[cacheKey] =
|
|
497
|
-
format(message));
|
|
508
|
+
return (compileCache[cacheKey] = format(message));
|
|
498
509
|
}
|
|
499
510
|
else {
|
|
500
511
|
return format(message);
|
|
@@ -1040,7 +1051,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1040
1051
|
* Intlify core-base version
|
|
1041
1052
|
* @internal
|
|
1042
1053
|
*/
|
|
1043
|
-
const VERSION = '11.4.
|
|
1054
|
+
const VERSION = '11.4.14';
|
|
1044
1055
|
const NOT_REOSLVED = -1;
|
|
1045
1056
|
const DEFAULT_LOCALE = 'en-US';
|
|
1046
1057
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -1704,6 +1715,8 @@ var IntlifyCore = (function (exports) {
|
|
|
1704
1715
|
|
|
1705
1716
|
const NOOP_MESSAGE_FUNCTION = () => '';
|
|
1706
1717
|
const isMessageFunction = (val) => isFunction(val);
|
|
1718
|
+
/** @internal */
|
|
1719
|
+
const isMessageFormat = (val) => isString(val) || isMessageAST(val) || isMessageFunction(val);
|
|
1707
1720
|
// implementation of `translate` function
|
|
1708
1721
|
function translate(context, ...args) {
|
|
1709
1722
|
const { fallbackFormat, postTranslation, unresolving, messageCompiler, fallbackLocale, messages } = context;
|
|
@@ -1749,10 +1762,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1749
1762
|
let format = formatScope;
|
|
1750
1763
|
// if you use default message, set it as message format!
|
|
1751
1764
|
let cacheBaseKey = key;
|
|
1752
|
-
if (!resolvedMessage &&
|
|
1753
|
-
!(isString(format) ||
|
|
1754
|
-
isMessageAST(format) ||
|
|
1755
|
-
isMessageFunction(format))) {
|
|
1765
|
+
if (!resolvedMessage && !isMessageFormat(format)) {
|
|
1756
1766
|
if (enableDefaultMsg) {
|
|
1757
1767
|
format = defaultMsgOrKey;
|
|
1758
1768
|
cacheBaseKey = format;
|
|
@@ -1760,10 +1770,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1760
1770
|
}
|
|
1761
1771
|
// checking message format and target locale
|
|
1762
1772
|
if (!resolvedMessage &&
|
|
1763
|
-
(!(isString(
|
|
1764
|
-
isMessageAST(format) ||
|
|
1765
|
-
isMessageFunction(format)) ||
|
|
1766
|
-
!isString(targetLocale))) {
|
|
1773
|
+
(!isMessageFormat(format) || !isString(targetLocale))) {
|
|
1767
1774
|
return unresolving ? NOT_REOSLVED : key;
|
|
1768
1775
|
}
|
|
1769
1776
|
// TODO: refactor
|
|
@@ -1825,15 +1832,19 @@ var IntlifyCore = (function (exports) {
|
|
|
1825
1832
|
return ret;
|
|
1826
1833
|
}
|
|
1827
1834
|
function escapeParams(options) {
|
|
1835
|
+
// a call can pass both list and named values, so escape each of them
|
|
1828
1836
|
if (isArray(options.list)) {
|
|
1829
1837
|
options.list = options.list.map(item => isString(item) ? escapeHtml(item) : item);
|
|
1830
1838
|
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1839
|
+
if (isObject(options.named)) {
|
|
1840
|
+
// escape into a new object, so that the values of the caller are not rewritten
|
|
1841
|
+
const source = options.named;
|
|
1842
|
+
const named = create();
|
|
1843
|
+
for (const key of Object.keys(source)) {
|
|
1844
|
+
const value = source[key];
|
|
1845
|
+
named[key] = isString(value) ? escapeHtml(value) : value;
|
|
1846
|
+
}
|
|
1847
|
+
options.named = named;
|
|
1837
1848
|
}
|
|
1838
1849
|
}
|
|
1839
1850
|
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
|
|
@@ -1902,7 +1913,7 @@ var IntlifyCore = (function (exports) {
|
|
|
1902
1913
|
measure('intlify message resolve', startTag, endTag);
|
|
1903
1914
|
}
|
|
1904
1915
|
}
|
|
1905
|
-
if (
|
|
1916
|
+
if (isMessageFormat(format)) {
|
|
1906
1917
|
break;
|
|
1907
1918
|
}
|
|
1908
1919
|
if (!isImplicitFallback(targetLocale, locales)) {
|
|
@@ -2164,6 +2175,7 @@ var IntlifyCore = (function (exports) {
|
|
|
2164
2175
|
exports.isAlmostSameLocale = isAlmostSameLocale;
|
|
2165
2176
|
exports.isImplicitFallback = isImplicitFallback;
|
|
2166
2177
|
exports.isMessageAST = isMessageAST;
|
|
2178
|
+
exports.isMessageFormat = isMessageFormat;
|
|
2167
2179
|
exports.isMessageFunction = isMessageFunction;
|
|
2168
2180
|
exports.isTranslateFallbackWarn = isTranslateFallbackWarn;
|
|
2169
2181
|
exports.isTranslateMissingWarn = isTranslateMissingWarn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core v11.4.
|
|
2
|
+
* core v11.4.14
|
|
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 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.13",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}({});
|
|
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,M=/(?:^|[\s"'<>/])on\w+\s*=\s*["']?[^"'>]+["']?/i,S=/(^|[\s"'<>/])on(\w+\s*=)/gi,y=/(?:^|[\s"'<>/])srcdoc\s*=/i,F=/(^|[\s"'<>/])s(rcdoc\s*=)/gi,P=/(^|[\s"'<>/])((?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi;function U(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 w(e){const t=e.replace(I,U).replace(k,"").replace(D,":").replace(R,"");return h.test(t)}function v(e,t){if(L.test(e)&&w(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+=w(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 x(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 V(e){return d(e)&&0===B(e)&&(m(e,"b")||m(e,"body"))}const G=["b","body"];const $=["c","cases"];const j=["s","static"];const K=["i","items"];const Y=["t","type"];function B(e){return J(e,Y)}const H=["v","value"];function X(e,t){const n=J(e,H);if(null!=n)return n;throw q(t)}const z=["m","modifier"];const Z=["k","key"];function J(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 Q=[...G,...$,...j,...K,...Z,...z,...H,...Y];function q(e){return new Error(`unhandled node type: ${e}`)}function ee(e){return t=>function(e,t){const n=(r=t,J(r,G));var r;if(null==n)throw q(0);if(1===B(n)){const t=function(e){return J(e,$,[])}(n);return e.plural(t.reduce(((t,n)=>[...t,te(e,n)]),[]))}return te(e,n)}(t,e)}function te(e,t){const n=function(e){return J(e,j)}(t);if(null!=n)return"text"===e.type?n:e.normalize([n]);{const n=function(e){return J(e,K,[])}(t).reduce(((t,n)=>[...t,ne(e,n)]),[]);return e.normalize(n)}}function ne(e,t){const n=B(t);switch(n){case 3:case 9:case 7:case 8:return X(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 q(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 q(n)}case 6:{const n=t,r=function(e){return J(e,z)}(n),a=function(e){const t=J(e,Z);if(t)return t;throw q(6)}(n);return e.linked(ne(e,a),r?ne(e,r):void 0,e.type)}default:throw new Error(`unhandled node on format message part: ${n}`)}}let re=u();function ae(e,t){{const t=e.cacheKey;if(t){const n=re[t];return n||(re[t]=ee(e))}return ee(e)}}let oe=null;const le=se("function:translate");function se(e){return t=>oe&&oe.emit(e,t)}const ie={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 ce(e,t){return null!=t.locale?fe(t.locale):fe(e.locale)}let ue;function fe(e){if(g(e))return e;if(E(e)){if(e.resolvedOnce&&null!=ue)return ue;if("Function"===e.constructor.name){const t=e();if(N(t))throw Error(ie.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return ue=t}throw Error(ie.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}throw Error(ie.NOT_SUPPORT_LOCALE_TYPE)}function me(e,t,n){return[...new Set([n,..._(t)?t:d(t)?Object.keys(t).filter((e=>"default"!==e)):g(t)?[t]:[n]])]}function _e(e,t,n){const r=g(n)?n:De,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=Ee(s,i,t);const c=_(t)||!O(t)?t:t.default?t.default:null;return i=g(c)?[c]:c,_(i)&&Ee(s,i,!1),o.set(r,s),s}function Ee(e,t,n){let r=!0;for(let a=0;a<t.length&&p(r);a++){const o=t[a];g(o)&&(r=ge(e,t[a],n))}return r}function ge(e,t,n){let r;const a=t.split("-");do{r=pe(e,a.join("-"),n),a.splice(-1,1)}while(a.length&&!0===r);return r}function pe(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}ie.INVALID_ARGUMENT,ie.INVALID_DATE_ARGUMENT,ie.INVALID_ISO_DATE_ARGUMENT,ie.NOT_SUPPORT_NON_STRING_MESSAGE,ie.NOT_SUPPORT_LOCALE_PROMISE_VALUE,ie.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION,ie.NOT_SUPPORT_LOCALE_TYPE;const de=[];de[0]={w:[0],i:[3,0],"[":[4],o:[7]},de[1]={w:[1],".":[2],"[":[4],o:[7]},de[2]={w:[2],i:[3,0],0:[3,0]},de[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},de[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},de[5]={"'":[4,0],o:8,l:[5,0]},de[6]={'"':[4,0],o:8,l:[6,0]};const Ne=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Te(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 Ae(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(n=t,Ne.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 Oe(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=Ae(r),!1===r)return!1;m[1]()}};null!==u;)if(c++,n=e[c],"\\"!==n||!_()){if(o=Te(n),i=de[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 Ce=new Map;function be(e,t){return d(e)?e[t]:null}function he(e,t){if(!d(e))return null;let n=Ce.get(t);if(n||(n=Oe(t),n&&Ce.set(t,n)),!n)return null;const r=n.length;let a=e,o=0;for(;o<r;){const e=n[o];if(Q.includes(e)&&V(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 Le={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={[Le.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Le.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Le.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Le.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Le.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Le.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Le.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.",[Le.INVALID_NUMBER_ARGUMENT]:"Invalid argument for number formatting: expected a number but received '{value}'.",[Le.INVALID_DATE_ARGUMENT]:"Invalid argument for datetime formatting: expected a Date, number, or ISO string but received '{value}'."};const ke="11.4.14",De="en-US",Re=e=>`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;let Me,Se,ye;function Fe(e){Me=e}function Pe(e){Se=e}function Ue(e){ye=e}let we=null;let ve=null;let We=0;const xe=e=>({[e]:u()});function Ve(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 Ge(e,t){const n=e;d(t)?n.__localeChainObjectCache?.delete(t):n.__localeChainCache?.delete(t)}function $e(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function je(e,t){const n=t.indexOf(e);if(-1===n)return!1;for(let r=n+1;r<t.length;r++)if($e(e,t[r]))return!0;return!1}function Ke(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;Ve(e,t,n,0,l)}return null}function Ye(e,t,n){let r=`${e}__${t}`;return O(n)&&!s(n)&&(r=`${r}__${JSON.stringify(n)}`),r}function Be(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 He(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 Xe=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function ze(...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(ie.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(ie.INVALID_ISO_DATE_ARGUMENT)}}else if(o(t)){if(isNaN(t.getTime()))throw Error(ie.INVALID_DATE_ARGUMENT);l=t}else{if(!a(t))throw Error(ie.INVALID_ARGUMENT);l=t}const s=He(e,n,r,Xe);return[n.key||"",l,n,s]}const Ze=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Je(...e){const[t]=e,n=u(),r=u();if(!a(t))throw Error(ie.INVALID_ARGUMENT);const o=t,l=He(e,n,r,Ze);return[n.key||"",o,n,l]}const Qe=e=>e,qe=e=>"",et="text",tt=e=>0===e.length?"":function(e,t=""){return e.reduce(((e,n,r)=>0===r?e+n:e+t+n),"")}(e),nt=e=>null==e?"":_(e)||O(e)&&e.toString===T?JSON.stringify(e,null,2):String(e);function rt(e,t){return e=Math.abs(e),2===t?1===e?0:1:Math.min(e,2)}function at(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]:rt,o=r===rt?void 0:rt,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):qe)}const f=E(e.processor?.normalize)?e.processor.normalize:tt,m=E(e.processor?.interpolate)?e.processor.interpolate:nt,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]:Qe)(u,o):u;var f},message:c,type:g(e.processor?.type)?e.processor.type:et,interpolate:m,normalize:f,values:i(u(),l,s)};return p}const ot=()=>"",lt=e=>E(e),st=e=>g(e)||V(e)||lt(e);function it(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 g=0;g<f.length&&(m=f[g],_=l[m]||u(),null===(E=i(_,t))&&(E=_[t]),!st(E));g++)if(!je(m,f)){const n=Ve(e,t,m,0,"translate");n!==t&&(E=n)}return[E,m,_]}function ct(e,t,r,a,o,l){const{messageCompiler:s,warnHtmlMessage:i}=e;if(lt(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 ut(...e){const[t,n,r]=e,o=u();if(!(g(t)||a(t)||lt(t)||V(t)))throw Error(ie.INVALID_ARGUMENT);const l=a(t)?String(t):(lt(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 Fe(ae),Pe(he),Ue(_e),e.AST_NODE_PROPS_KEYS=Q,e.CORE_ERROR_CODES_EXTEND_POINT=24,e.CORE_WARN_CODES_EXTEND_POINT=10,e.CompileErrorCodes=W,e.CoreErrorCodes=ie,e.CoreWarnCodes=Le,e.DATETIME_FORMAT_OPTIONS_KEYS=Xe,e.DEFAULT_LOCALE=De,e.DEFAULT_MESSAGE_DATA_TYPE=et,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.NUMBER_FORMAT_OPTIONS_KEYS=Ze,e.VERSION=ke,e.clearCompileCache=function(){re=u()},e.clearDateTimeFormat=function(e,t,n){Be(e.__datetimeFormatters,t,n)},e.clearNumberFormat=function(e,t,n){Be(e.__numberFormatters,t,n)},e.compile=ae,e.createCompileError=x,e.createCoreContext=function(e={}){const t=E(e.onWarn)?e.onWarn:C,n=g(e.version)?e.version:ke,r=g(e.locale)||E(e.locale)?e.locale:De,a=E(r)?De:r,o=_(e.fallbackLocale)||O(e.fallbackLocale)||g(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,s=O(e.messages)?e.messages:xe(a),c=O(e.datetimeFormats)?e.datetimeFormats:xe(a),f=O(e.numberFormats)?e.numberFormats:xe(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)?Re(e):"vnode"===t&&d(e)&&"__v_isVNode"in e?Re(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,M=E(e.messageCompiler)?e.messageCompiler:Me,S=E(e.messageResolver)?e.messageResolver:Se||be,y=E(e.localeFallbacker)?e.localeFallbacker:ye||me,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:M,messageResolver:S,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 x(e,null,void 0)},e.createMessageContext=at,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]=ze(...t),_=(p(f.missingWarn)?f.missingWarn:e.missingWarn,p(f.fallbackWarn)?f.fallbackWarn:e.fallbackWarn,!!f.part),E=ce(e,f);if(!g(c)||""===c){const e=new Intl.DateTimeFormat(E.replace(/!/g,""),m);return _?e.formatToParts(u):e.format(u)}const d=Ke(e,c,E,n,0,0,"datetime format");if(!g(d))return r?-1:c;const N=n[d][c],T=Ye(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=_e,e.fallbackWithSimple=me,e.getAdditionalMeta=()=>we,e.getDevToolsHook=function(){return oe},e.getFallbackContext=()=>ve,e.getLocale=ce,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=Ve,e.initI18nDevTools=function(e,t,n){oe&&oe.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isAlmostSameLocale=$e,e.isImplicitFallback=je,e.isMessageAST=V,e.isMessageFormat=st,e.isMessageFunction=lt,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]=Je(...t),m=(p(u.missingWarn)?u.missingWarn:e.missingWarn,p(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn,!!u.part),_=ce(e,u);if(!g(s)||""===s){const e=new Intl.NumberFormat(_.replace(/!/g,""),f);return m?e.formatToParts(c):e.format(c)}const E=Ke(e,s,_,n,0,0,"number format");if(!g(E))return r?-1:s;const d=n[E][s],N=Ye(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=Oe,e.parseDateTimeArgs=ze,e.parseNumberArgs=Je,e.parseTranslateArgs=ut,e.registerLocaleFallbacker=Ue,e.registerMessageCompiler=Fe,e.registerMessageResolver=Pe,e.resolveLocale=fe,e.resolveValue=he,e.resolveWithKeyValue=be,e.setAdditionalMeta=e=>{we=e},e.setDevToolsHook=function(e){oe=e},e.setFallbackContext=e=>{ve=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:l,fallbackLocale:s,messages:i}=e,[c,f]=ut(...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=ce(e,f);T&&function(e){_(e.list)&&(e.list=e.list.map((e=>g(e)?b(e):e)));if(d(e.named)){const t=e.named,n=u();for(const e of Object.keys(t)){const r=t[e];n[e]=g(r)?b(r):r}e.named=n}}(f);let[L,I,k]=A?[c,h,i[h]||u()]:it(e,c,h,s,N,m),D=L,R=c;if(A||st(D)||C&&(D=O,R=D),!(A||st(D)&&g(I)))return o?-1:c;let U=!1;const W=lt(D)?D:ct(e,c,I,D,R,(()=>{U=!0}));if(U)return D;const x=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]=it(f||e,r,t,i,c,u);o=n??s(a,r)}if(g(o)||V(o)){let n=!1;const a=ct(e,r,t,o,r,(()=>{n=!0}));return n?ot:a}return lt(o)?o:ot},_={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),G=function(e,t,n){const r=t(n);return r}(0,W,at(x));let $=r?r(G,c):G;var j;return T&&g($)&&(j=(j=(j=$).replace(/([\w:-]+)\s*=\s*"([^"]*)"/g,((e,t,n)=>`${t}="${v(t,n)}"`))).replace(/([\w:-]+)\s*=\s*'([^']*)'/g,((e,t,n)=>`${t}='${v(t,n)}'`)),M.test(j)&&(j=j.replace(S,"$1on$2")),y.test(j)&&(j=j.replace(F,"$1s$2")),$=j.replace(P,((e,t,n,r)=>w(r)?`${t}${n}about:blank`:e))),$},e.translateDevTools=le,e.updateFallbackLocale=function(e,t,n){Ge(e,n),e.fallbackContext&&Ge(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.14",
|
|
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.14",
|
|
37
|
+
"@intlify/shared": "11.4.14"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 22"
|