Socket
Socket
Sign inDemoInstall

@intlify/core-base

Package Overview
Dependencies
Maintainers
2
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intlify/core-base - npm Package Compare versions

Comparing version 9.2.0-alpha.6 to 9.2.0-alpha.7

715

dist/core-base.cjs.js
/*!
* @intlify/core-base v9.2.0-alpha.6
* core-base v9.2.0-alpha.7
* (c) 2021 kazuya kawaguchi

@@ -10,4 +10,2 @@ * Released under the MIT License.

var messageResolver = require('@intlify/message-resolver');
var runtime = require('@intlify/runtime');
var messageCompiler = require('@intlify/message-compiler');

@@ -17,2 +15,413 @@ var shared = require('@intlify/shared');

const pathStateMachine = [];
pathStateMachine[0 /* BEFORE_PATH */] = {
["w" /* WORKSPACE */]: [0 /* BEFORE_PATH */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[1 /* IN_PATH */] = {
["w" /* WORKSPACE */]: [1 /* IN_PATH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[2 /* BEFORE_IDENT */] = {
["w" /* WORKSPACE */]: [2 /* BEFORE_IDENT */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */]
};
pathStateMachine[3 /* IN_IDENT */] = {
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["w" /* WORKSPACE */]: [1 /* IN_PATH */, 1 /* PUSH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */, 1 /* PUSH */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */, 1 /* PUSH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */, 1 /* PUSH */]
};
pathStateMachine[4 /* IN_SUB_PATH */] = {
["'" /* SINGLE_QUOTE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */],
["\"" /* DOUBLE_QUOTE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [
4 /* IN_SUB_PATH */,
2 /* INC_SUB_PATH_DEPTH */
],
["]" /* RIGHT_BRACKET */]: [1 /* IN_PATH */, 3 /* PUSH_SUB_PATH */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */]
};
pathStateMachine[5 /* IN_SINGLE_QUOTE */] = {
["'" /* SINGLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */]
};
pathStateMachine[6 /* IN_DOUBLE_QUOTE */] = {
["\"" /* DOUBLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */]
};
/**
* Check if an expression is a literal value.
*/
const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
function isLiteral(exp) {
return literalValueRE.test(exp);
}
/**
* Strip quotes from a string
*/
function stripQuotes(str) {
const a = str.charCodeAt(0);
const b = str.charCodeAt(str.length - 1);
return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;
}
/**
* Determine the type of a character in a keypath.
*/
function getPathCharType(ch) {
if (ch === undefined || ch === null) {
return "o" /* END_OF_FAIL */;
}
const code = ch.charCodeAt(0);
switch (code) {
case 0x5b: // [
case 0x5d: // ]
case 0x2e: // .
case 0x22: // "
case 0x27: // '
return ch;
case 0x5f: // _
case 0x24: // $
case 0x2d: // -
return "i" /* IDENT */;
case 0x09: // Tab (HT)
case 0x0a: // Newline (LF)
case 0x0d: // Return (CR)
case 0xa0: // No-break space (NBSP)
case 0xfeff: // Byte Order Mark (BOM)
case 0x2028: // Line Separator (LS)
case 0x2029: // Paragraph Separator (PS)
return "w" /* WORKSPACE */;
}
return "i" /* IDENT */;
}
/**
* Format a subPath, return its plain form if it is
* a literal string or number. Otherwise prepend the
* dynamic indicator (*).
*/
function formatSubPath(path) {
const trimmed = path.trim();
// invalid leading 0
if (path.charAt(0) === '0' && isNaN(parseInt(path))) {
return false;
}
return isLiteral(trimmed)
? stripQuotes(trimmed)
: "*" /* ASTARISK */ + trimmed;
}
/**
* Parse a string path into an array of segments
*/
function parse(path) {
const keys = [];
let index = -1;
let mode = 0 /* BEFORE_PATH */;
let subPathDepth = 0;
let c;
let key; // eslint-disable-line
let newChar;
let type;
let transition;
let action;
let typeMap;
const actions = [];
actions[0 /* APPEND */] = () => {
if (key === undefined) {
key = newChar;
}
else {
key += newChar;
}
};
actions[1 /* PUSH */] = () => {
if (key !== undefined) {
keys.push(key);
key = undefined;
}
};
actions[2 /* INC_SUB_PATH_DEPTH */] = () => {
actions[0 /* APPEND */]();
subPathDepth++;
};
actions[3 /* PUSH_SUB_PATH */] = () => {
if (subPathDepth > 0) {
subPathDepth--;
mode = 4 /* IN_SUB_PATH */;
actions[0 /* APPEND */]();
}
else {
subPathDepth = 0;
if (key === undefined) {
return false;
}
key = formatSubPath(key);
if (key === false) {
return false;
}
else {
actions[1 /* PUSH */]();
}
}
};
function maybeUnescapeQuote() {
const nextChar = path[index + 1];
if ((mode === 5 /* IN_SINGLE_QUOTE */ &&
nextChar === "'" /* SINGLE_QUOTE */) ||
(mode === 6 /* IN_DOUBLE_QUOTE */ &&
nextChar === "\"" /* DOUBLE_QUOTE */)) {
index++;
newChar = '\\' + nextChar;
actions[0 /* APPEND */]();
return true;
}
}
while (mode !== null) {
index++;
c = path[index];
if (c === '\\' && maybeUnescapeQuote()) {
continue;
}
type = getPathCharType(c);
typeMap = pathStateMachine[mode];
transition = typeMap[type] || typeMap["l" /* ELSE */] || 8 /* ERROR */;
// check parse error
if (transition === 8 /* ERROR */) {
return;
}
mode = transition[0];
if (transition[1] !== undefined) {
action = actions[transition[1]];
if (action) {
newChar = c;
if (action() === false) {
return;
}
}
}
// check parse finish
if (mode === 7 /* AFTER_PATH */) {
return keys;
}
}
}
// path token cache
const cache = new Map();
/**
* key-value message resolver
*
* @remarks
* Resolves messages with the key-value structure. Note that messages with a hierarchical structure such as objects cannot be resolved
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
function resolveWithKeyValue(obj, path) {
return shared.isObject(obj) ? obj[path] : null;
}
/**
* message resolver
*
* @remarks
* Resolves messages. messages with a hierarchical structure such as objects can be resolved. This resolver is used in VueI18n as default.
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
function resolveValue(obj, path) {
// check object
if (!shared.isObject(obj)) {
return null;
}
// parse path
let hit = cache.get(path);
if (!hit) {
hit = parse(path);
if (hit) {
cache.set(path, hit);
}
}
// check hit
if (!hit) {
return null;
}
// resolve path value
const len = hit.length;
let last = obj;
let i = 0;
while (i < len) {
const val = last[hit[i]];
if (val === undefined) {
return null;
}
last = val;
i++;
}
return last;
}
/**
* Transform flat json in obj to normal json in obj
*/
function handleFlatJson(obj) {
// check obj
if (!shared.isObject(obj)) {
return obj;
}
for (const key in obj) {
// check key
if (!shared.hasOwn(obj, key)) {
continue;
}
// handle for normal json
if (!key.includes("." /* DOT */)) {
// recursive process value if value is also a object
if (shared.isObject(obj[key])) {
handleFlatJson(obj[key]);
}
}
// handle for flat json, transform to normal json
else {
// go to the last object
const subKeys = key.split("." /* DOT */);
const lastIndex = subKeys.length - 1;
let currentObj = obj;
for (let i = 0; i < lastIndex; i++) {
if (!(subKeys[i] in currentObj)) {
currentObj[subKeys[i]] = {};
}
currentObj = currentObj[subKeys[i]];
}
// update last object value, delete old property
currentObj[subKeys[lastIndex]] = obj[key];
delete obj[key];
// recursive process value if value is also a object
if (shared.isObject(currentObj[subKeys[lastIndex]])) {
handleFlatJson(currentObj[subKeys[lastIndex]]);
}
}
}
return obj;
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line
const DEFAULT_MESSAGE_DATA_TYPE = 'text';
const DEFAULT_NORMALIZE = (values) => values.length === 0 ? '' : values.join('');
const DEFAULT_INTERPOLATE = shared.toDisplayString;
function pluralDefault(choice, choicesLength) {
choice = Math.abs(choice);
if (choicesLength === 2) {
// prettier-ignore
return choice
? choice > 1
? 1
: 0
: 1;
}
return choice ? Math.min(choice, 2) : 0;
}
function getPluralIndex(options) {
// prettier-ignore
const index = shared.isNumber(options.pluralIndex)
? options.pluralIndex
: -1;
// prettier-ignore
return options.named && (shared.isNumber(options.named.count) || shared.isNumber(options.named.n))
? shared.isNumber(options.named.count)
? options.named.count
: shared.isNumber(options.named.n)
? options.named.n
: index
: index;
}
function normalizeNamed(pluralIndex, props) {
if (!props.count) {
props.count = pluralIndex;
}
if (!props.n) {
props.n = pluralIndex;
}
}
function createMessageContext(options = {}) {
const locale = options.locale;
const pluralIndex = getPluralIndex(options);
const pluralRule = shared.isObject(options.pluralRules) &&
shared.isString(locale) &&
shared.isFunction(options.pluralRules[locale])
? options.pluralRules[locale]
: pluralDefault;
const orgPluralRule = shared.isObject(options.pluralRules) &&
shared.isString(locale) &&
shared.isFunction(options.pluralRules[locale])
? pluralDefault
: undefined;
const plural = (messages) => messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
const _list = options.list || [];
const list = (index) => _list[index];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _named = options.named || {};
shared.isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named);
const named = (key) => _named[key];
// TODO: need to design resolve message function?
function message(key) {
// prettier-ignore
const msg = shared.isFunction(options.messages)
? options.messages(key)
: shared.isObject(options.messages)
? options.messages[key]
: false;
return !msg
? options.parent
? options.parent.message(key) // resolve from parent messages
: DEFAULT_MESSAGE
: msg;
}
const _modifier = (name) => options.modifiers
? options.modifiers[name]
: DEFAULT_MODIFIER;
const normalize = shared.isPlainObject(options.processor) && shared.isFunction(options.processor.normalize)
? options.processor.normalize
: DEFAULT_NORMALIZE;
const interpolate = shared.isPlainObject(options.processor) &&
shared.isFunction(options.processor.interpolate)
? options.processor.interpolate
: DEFAULT_INTERPOLATE;
const type = shared.isPlainObject(options.processor) && shared.isString(options.processor.type)
? options.processor.type
: DEFAULT_MESSAGE_DATA_TYPE;
const ctx = {
["list" /* LIST */]: list,
["named" /* NAMED */]: named,
["plural" /* PLURAL */]: plural,
["linked" /* LINKED */]: (key, modifier) => {
// TODO: should check `key`
const msg = message(key)(ctx);
return shared.isString(modifier) ? _modifier(modifier)(msg) : msg;
},
["message" /* MESSAGE */]: message,
["type" /* TYPE */]: type,
["interpolate" /* INTERPOLATE */]: interpolate,
["normalize" /* NORMALIZE */]: normalize
};
return ctx;
}
let devtools = null;

@@ -62,2 +471,118 @@ function setDevToolsHook(hook) {

/**
* Fallback with simple implemenation
*
* @remarks
* A fallback locale function implemented with a simple fallback algorithm.
*
* Basically, it returns the value as specified in the `fallbackLocale` props, and is processed with the fallback inside intlify.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nGeneral
*/
function fallbackWithSimple(ctx, fallback, start // eslint-disable-line @typescript-eslint/no-unused-vars
) {
// prettier-ignore
return [...new Set([
start,
...(shared.isArray(fallback)
? fallback
: shared.isObject(fallback)
? Object.keys(fallback)
: shared.isString(fallback)
? [fallback]
: [start])
])];
}
/**
* Fallback with locale chain
*
* @remarks
* A fallback locale function implemented with a fallback chain algorithm. It's used in VueI18n as default.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nSee [Fallbacking](../guide/essentials/fallback)
*
* @VueI18nGeneral
*/
function fallbackWithLocaleChain(ctx, fallback, start) {
const startLocale = shared.isString(start) ? start : DEFAULT_LOCALE;
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(startLocale);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (shared.isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = shared.isArray(fallback) || !shared.isPlainObject(fallback)
? fallback
: fallback['default']
? fallback['default']
: null;
// convert defaults to array
block = shared.isString(defaults) ? [defaults] : defaults;
if (shared.isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(startLocale, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
const locale = block[i];
if (shared.isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/* eslint-disable @typescript-eslint/no-explicit-any */

@@ -68,4 +593,5 @@ /**

*/
const VERSION = '9.2.0-alpha.6';
const VERSION = '9.2.0-alpha.7';
const NOT_REOSLVED = -1;
const DEFAULT_LOCALE = 'en-US';
const MISSING_RESOLVE_VALUE = '';

@@ -86,8 +612,30 @@ function getDefaultLinkedModifiers() {

}
let _resolver;
/**
* Register the message resolver
*
* @param resolver - A {@link MessageResolver} function
*
* @VueI18nGeneral
*/
function registerMessageResolver(resolver) {
_resolver = resolver;
}
let _fallbacker;
/**
* Register the locale fallbacker
*
* @param fallbacker - A {@link LocaleFallbacker} function
*
* @VueI18nGeneral
*/
function registerLocaleFallbacker(fallbacker) {
_fallbacker = fallbacker;
}
// Additional Meta for Intlify DevTools
let _additionalMeta = null;
const setAdditionalMeta = /* #__PURE__*/ (meta) => {
const setAdditionalMeta = (meta) => {
_additionalMeta = meta;
};
const getAdditionalMeta = /* #__PURE__*/ () => _additionalMeta;
const getAdditionalMeta = () => _additionalMeta;
// ID for CoreContext

@@ -98,3 +646,3 @@ let _cid = 0;

const version = shared.isString(options.version) ? options.version : VERSION;
const locale = shared.isString(options.locale) ? options.locale : 'en-US';
const locale = shared.isString(options.locale) ? options.locale : DEFAULT_LOCALE;
const fallbackLocale = shared.isArray(options.fallbackLocale) ||

@@ -110,7 +658,9 @@ shared.isPlainObject(options.fallbackLocale) ||

const datetimeFormats = shared.isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
? options.datetimeFormats
: { [locale]: {} }
;
const numberFormats = shared.isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
? options.numberFormats
: { [locale]: {} }
;
const modifiers = shared.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());

@@ -138,5 +688,8 @@ const pluralRules = options.pluralRules || {};

: _compiler;
const messageResolver$1 = shared.isFunction(options.messageResolver)
const messageResolver = shared.isFunction(options.messageResolver)
? options.messageResolver
: messageResolver.resolveValue;
: _resolver || resolveWithKeyValue;
const localeFallbacker = shared.isFunction(options.localeFallbacker)
? options.localeFallbacker
: _fallbacker || fallbackWithSimple;
const onWarn = shared.isFunction(options.onWarn) ? options.onWarn : shared.warn;

@@ -146,7 +699,9 @@ // setup internal options

const __datetimeFormatters = shared.isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
? internalOptions.__datetimeFormatters
: new Map()
;
const __numberFormatters = shared.isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
? internalOptions.__numberFormatters
: new Map()
;
const __meta = shared.isObject(internalOptions.__meta) ? internalOptions.__meta : {};

@@ -160,4 +715,2 @@ _cid++;

messages,
datetimeFormats,
numberFormats,
modifiers,

@@ -175,8 +728,13 @@ pluralRules,

messageCompiler,
messageResolver: messageResolver$1,
messageResolver,
localeFallbacker,
onWarn,
__datetimeFormatters,
__numberFormatters,
__meta
};
{
context.datetimeFormats = datetimeFormats;
context.numberFormats = numberFormats;
context.__datetimeFormatters = __datetimeFormatters;
context.__numberFormatters = __numberFormatters;
}
// for vue-devtools timeline event

@@ -230,75 +788,6 @@ {

/** @internal */
function getLocaleChain(ctx, fallback, start) {
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (shared.isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = shared.isArray(fallback) || !shared.isPlainObject(fallback)
? fallback
: fallback['default']
? fallback['default']
: null;
// convert defaults to array
block = shared.isString(defaults) ? [defaults] : defaults;
if (shared.isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
const locale = block[i];
if (shared.isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
ctx.localeFallbacker(ctx, fallback, locale);
}

@@ -349,7 +838,9 @@ /* eslint-enable @typescript-eslint/no-explicit-any */

let code = messageCompiler.CompileErrorCodes.__EXTEND_POINT__;
const inc = () => code++;
const CoreErrorCodes = {
INVALID_ARGUMENT: messageCompiler.CompileErrorCodes.__EXTEND_POINT__,
INVALID_DATE_ARGUMENT: messageCompiler.CompileErrorCodes.__EXTEND_POINT__ + 1,
INVALID_ISO_DATE_ARGUMENT: messageCompiler.CompileErrorCodes.__EXTEND_POINT__ + 2,
__EXTEND_POINT__: messageCompiler.CompileErrorCodes.__EXTEND_POINT__ + 3
INVALID_ARGUMENT: code,
INVALID_DATE_ARGUMENT: inc(),
INVALID_ISO_DATE_ARGUMENT: inc(),
__EXTEND_POINT__: inc() // 18
};

@@ -441,3 +932,3 @@ function createCoreError(code) {

const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = runtime.createMessageContext(ctxOptions);
const msgContext = createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);

@@ -484,4 +975,4 @@ // if use post translation option, proceed it with handler

function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn, messageResolver: resolveValue } = context;
const locales = getLocaleChain(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
const { messages, onWarn, messageResolver: resolveValue, localeFallbacker } = context;
const locales = localeFallbacker(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
let message = {};

@@ -744,3 +1235,3 @@ let targetLocale;

function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __datetimeFormatters } = context;

@@ -760,3 +1251,3 @@ if (!Availabilities.dateTimeFormat) {

const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, // eslint-disable-line @typescript-eslint/no-explicit-any
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale, locale);

@@ -890,3 +1381,3 @@ if (!shared.isString(key) || key === '') {

function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __numberFormatters } = context;

@@ -906,3 +1397,3 @@ if (!Availabilities.numberFormat) {

const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, // eslint-disable-line @typescript-eslint/no-explicit-any
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale, locale);

@@ -1006,2 +1497,4 @@ if (!shared.isString(key) || key === '') {

exports.CoreWarnCodes = CoreWarnCodes;
exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
exports.DEFAULT_MESSAGE_DATA_TYPE = DEFAULT_MESSAGE_DATA_TYPE;
exports.MISSING_RESOLVE_VALUE = MISSING_RESOLVE_VALUE;

@@ -1016,7 +1509,10 @@ exports.NOT_REOSLVED = NOT_REOSLVED;

exports.createCoreError = createCoreError;
exports.createMessageContext = createMessageContext;
exports.datetime = datetime;
exports.fallbackWithLocaleChain = fallbackWithLocaleChain;
exports.fallbackWithSimple = fallbackWithSimple;
exports.getAdditionalMeta = getAdditionalMeta;
exports.getDevToolsHook = getDevToolsHook;
exports.getLocaleChain = getLocaleChain;
exports.getWarnMessage = getWarnMessage;
exports.handleFlatJson = handleFlatJson;
exports.handleMissing = handleMissing;

@@ -1028,6 +1524,11 @@ exports.initI18nDevTools = initI18nDevTools;

exports.number = number;
exports.parse = parse;
exports.parseDateTimeArgs = parseDateTimeArgs;
exports.parseNumberArgs = parseNumberArgs;
exports.parseTranslateArgs = parseTranslateArgs;
exports.registerLocaleFallbacker = registerLocaleFallbacker;
exports.registerMessageCompiler = registerMessageCompiler;
exports.registerMessageResolver = registerMessageResolver;
exports.resolveValue = resolveValue;
exports.resolveWithKeyValue = resolveWithKeyValue;
exports.setAdditionalMeta = setAdditionalMeta;

@@ -1038,7 +1539,1 @@ exports.setDevToolsHook = setDevToolsHook;

exports.updateFallbackLocale = updateFallbackLocale;
Object.keys(messageResolver).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = messageResolver[k];
});
Object.keys(runtime).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = runtime[k];
});
/*!
* @intlify/core-base v9.2.0-alpha.6
* core-base v9.2.0-alpha.7
* (c) 2021 kazuya kawaguchi

@@ -10,4 +10,2 @@ * Released under the MIT License.

var messageResolver = require('@intlify/message-resolver');
var runtime = require('@intlify/runtime');
var messageCompiler = require('@intlify/message-compiler');

@@ -17,2 +15,413 @@ var shared = require('@intlify/shared');

const pathStateMachine = [];
pathStateMachine[0 /* BEFORE_PATH */] = {
["w" /* WORKSPACE */]: [0 /* BEFORE_PATH */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[1 /* IN_PATH */] = {
["w" /* WORKSPACE */]: [1 /* IN_PATH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[2 /* BEFORE_IDENT */] = {
["w" /* WORKSPACE */]: [2 /* BEFORE_IDENT */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */]
};
pathStateMachine[3 /* IN_IDENT */] = {
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["w" /* WORKSPACE */]: [1 /* IN_PATH */, 1 /* PUSH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */, 1 /* PUSH */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */, 1 /* PUSH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */, 1 /* PUSH */]
};
pathStateMachine[4 /* IN_SUB_PATH */] = {
["'" /* SINGLE_QUOTE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */],
["\"" /* DOUBLE_QUOTE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [
4 /* IN_SUB_PATH */,
2 /* INC_SUB_PATH_DEPTH */
],
["]" /* RIGHT_BRACKET */]: [1 /* IN_PATH */, 3 /* PUSH_SUB_PATH */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */]
};
pathStateMachine[5 /* IN_SINGLE_QUOTE */] = {
["'" /* SINGLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */]
};
pathStateMachine[6 /* IN_DOUBLE_QUOTE */] = {
["\"" /* DOUBLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */]
};
/**
* Check if an expression is a literal value.
*/
const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
function isLiteral(exp) {
return literalValueRE.test(exp);
}
/**
* Strip quotes from a string
*/
function stripQuotes(str) {
const a = str.charCodeAt(0);
const b = str.charCodeAt(str.length - 1);
return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;
}
/**
* Determine the type of a character in a keypath.
*/
function getPathCharType(ch) {
if (ch === undefined || ch === null) {
return "o" /* END_OF_FAIL */;
}
const code = ch.charCodeAt(0);
switch (code) {
case 0x5b: // [
case 0x5d: // ]
case 0x2e: // .
case 0x22: // "
case 0x27: // '
return ch;
case 0x5f: // _
case 0x24: // $
case 0x2d: // -
return "i" /* IDENT */;
case 0x09: // Tab (HT)
case 0x0a: // Newline (LF)
case 0x0d: // Return (CR)
case 0xa0: // No-break space (NBSP)
case 0xfeff: // Byte Order Mark (BOM)
case 0x2028: // Line Separator (LS)
case 0x2029: // Paragraph Separator (PS)
return "w" /* WORKSPACE */;
}
return "i" /* IDENT */;
}
/**
* Format a subPath, return its plain form if it is
* a literal string or number. Otherwise prepend the
* dynamic indicator (*).
*/
function formatSubPath(path) {
const trimmed = path.trim();
// invalid leading 0
if (path.charAt(0) === '0' && isNaN(parseInt(path))) {
return false;
}
return isLiteral(trimmed)
? stripQuotes(trimmed)
: "*" /* ASTARISK */ + trimmed;
}
/**
* Parse a string path into an array of segments
*/
function parse(path) {
const keys = [];
let index = -1;
let mode = 0 /* BEFORE_PATH */;
let subPathDepth = 0;
let c;
let key; // eslint-disable-line
let newChar;
let type;
let transition;
let action;
let typeMap;
const actions = [];
actions[0 /* APPEND */] = () => {
if (key === undefined) {
key = newChar;
}
else {
key += newChar;
}
};
actions[1 /* PUSH */] = () => {
if (key !== undefined) {
keys.push(key);
key = undefined;
}
};
actions[2 /* INC_SUB_PATH_DEPTH */] = () => {
actions[0 /* APPEND */]();
subPathDepth++;
};
actions[3 /* PUSH_SUB_PATH */] = () => {
if (subPathDepth > 0) {
subPathDepth--;
mode = 4 /* IN_SUB_PATH */;
actions[0 /* APPEND */]();
}
else {
subPathDepth = 0;
if (key === undefined) {
return false;
}
key = formatSubPath(key);
if (key === false) {
return false;
}
else {
actions[1 /* PUSH */]();
}
}
};
function maybeUnescapeQuote() {
const nextChar = path[index + 1];
if ((mode === 5 /* IN_SINGLE_QUOTE */ &&
nextChar === "'" /* SINGLE_QUOTE */) ||
(mode === 6 /* IN_DOUBLE_QUOTE */ &&
nextChar === "\"" /* DOUBLE_QUOTE */)) {
index++;
newChar = '\\' + nextChar;
actions[0 /* APPEND */]();
return true;
}
}
while (mode !== null) {
index++;
c = path[index];
if (c === '\\' && maybeUnescapeQuote()) {
continue;
}
type = getPathCharType(c);
typeMap = pathStateMachine[mode];
transition = typeMap[type] || typeMap["l" /* ELSE */] || 8 /* ERROR */;
// check parse error
if (transition === 8 /* ERROR */) {
return;
}
mode = transition[0];
if (transition[1] !== undefined) {
action = actions[transition[1]];
if (action) {
newChar = c;
if (action() === false) {
return;
}
}
}
// check parse finish
if (mode === 7 /* AFTER_PATH */) {
return keys;
}
}
}
// path token cache
const cache = new Map();
/**
* key-value message resolver
*
* @remarks
* Resolves messages with the key-value structure. Note that messages with a hierarchical structure such as objects cannot be resolved
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
function resolveWithKeyValue(obj, path) {
return shared.isObject(obj) ? obj[path] : null;
}
/**
* message resolver
*
* @remarks
* Resolves messages. messages with a hierarchical structure such as objects can be resolved. This resolver is used in VueI18n as default.
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
function resolveValue(obj, path) {
// check object
if (!shared.isObject(obj)) {
return null;
}
// parse path
let hit = cache.get(path);
if (!hit) {
hit = parse(path);
if (hit) {
cache.set(path, hit);
}
}
// check hit
if (!hit) {
return null;
}
// resolve path value
const len = hit.length;
let last = obj;
let i = 0;
while (i < len) {
const val = last[hit[i]];
if (val === undefined) {
return null;
}
last = val;
i++;
}
return last;
}
/**
* Transform flat json in obj to normal json in obj
*/
function handleFlatJson(obj) {
// check obj
if (!shared.isObject(obj)) {
return obj;
}
for (const key in obj) {
// check key
if (!shared.hasOwn(obj, key)) {
continue;
}
// handle for normal json
if (!key.includes("." /* DOT */)) {
// recursive process value if value is also a object
if (shared.isObject(obj[key])) {
handleFlatJson(obj[key]);
}
}
// handle for flat json, transform to normal json
else {
// go to the last object
const subKeys = key.split("." /* DOT */);
const lastIndex = subKeys.length - 1;
let currentObj = obj;
for (let i = 0; i < lastIndex; i++) {
if (!(subKeys[i] in currentObj)) {
currentObj[subKeys[i]] = {};
}
currentObj = currentObj[subKeys[i]];
}
// update last object value, delete old property
currentObj[subKeys[lastIndex]] = obj[key];
delete obj[key];
// recursive process value if value is also a object
if (shared.isObject(currentObj[subKeys[lastIndex]])) {
handleFlatJson(currentObj[subKeys[lastIndex]]);
}
}
}
return obj;
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line
const DEFAULT_MESSAGE_DATA_TYPE = 'text';
const DEFAULT_NORMALIZE = (values) => values.length === 0 ? '' : values.join('');
const DEFAULT_INTERPOLATE = shared.toDisplayString;
function pluralDefault(choice, choicesLength) {
choice = Math.abs(choice);
if (choicesLength === 2) {
// prettier-ignore
return choice
? choice > 1
? 1
: 0
: 1;
}
return choice ? Math.min(choice, 2) : 0;
}
function getPluralIndex(options) {
// prettier-ignore
const index = shared.isNumber(options.pluralIndex)
? options.pluralIndex
: -1;
// prettier-ignore
return options.named && (shared.isNumber(options.named.count) || shared.isNumber(options.named.n))
? shared.isNumber(options.named.count)
? options.named.count
: shared.isNumber(options.named.n)
? options.named.n
: index
: index;
}
function normalizeNamed(pluralIndex, props) {
if (!props.count) {
props.count = pluralIndex;
}
if (!props.n) {
props.n = pluralIndex;
}
}
function createMessageContext(options = {}) {
const locale = options.locale;
const pluralIndex = getPluralIndex(options);
const pluralRule = shared.isObject(options.pluralRules) &&
shared.isString(locale) &&
shared.isFunction(options.pluralRules[locale])
? options.pluralRules[locale]
: pluralDefault;
const orgPluralRule = shared.isObject(options.pluralRules) &&
shared.isString(locale) &&
shared.isFunction(options.pluralRules[locale])
? pluralDefault
: undefined;
const plural = (messages) => messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
const _list = options.list || [];
const list = (index) => _list[index];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _named = options.named || {};
shared.isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named);
const named = (key) => _named[key];
// TODO: need to design resolve message function?
function message(key) {
// prettier-ignore
const msg = shared.isFunction(options.messages)
? options.messages(key)
: shared.isObject(options.messages)
? options.messages[key]
: false;
return !msg
? options.parent
? options.parent.message(key) // resolve from parent messages
: DEFAULT_MESSAGE
: msg;
}
const _modifier = (name) => options.modifiers
? options.modifiers[name]
: DEFAULT_MODIFIER;
const normalize = shared.isPlainObject(options.processor) && shared.isFunction(options.processor.normalize)
? options.processor.normalize
: DEFAULT_NORMALIZE;
const interpolate = shared.isPlainObject(options.processor) &&
shared.isFunction(options.processor.interpolate)
? options.processor.interpolate
: DEFAULT_INTERPOLATE;
const type = shared.isPlainObject(options.processor) && shared.isString(options.processor.type)
? options.processor.type
: DEFAULT_MESSAGE_DATA_TYPE;
const ctx = {
["list" /* LIST */]: list,
["named" /* NAMED */]: named,
["plural" /* PLURAL */]: plural,
["linked" /* LINKED */]: (key, modifier) => {
// TODO: should check `key`
const msg = message(key)(ctx);
return shared.isString(modifier) ? _modifier(modifier)(msg) : msg;
},
["message" /* MESSAGE */]: message,
["type" /* TYPE */]: type,
["interpolate" /* INTERPOLATE */]: interpolate,
["normalize" /* NORMALIZE */]: normalize
};
return ctx;
}
let devtools = null;

@@ -62,2 +471,118 @@ function setDevToolsHook(hook) {

/**
* Fallback with simple implemenation
*
* @remarks
* A fallback locale function implemented with a simple fallback algorithm.
*
* Basically, it returns the value as specified in the `fallbackLocale` props, and is processed with the fallback inside intlify.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nGeneral
*/
function fallbackWithSimple(ctx, fallback, start // eslint-disable-line @typescript-eslint/no-unused-vars
) {
// prettier-ignore
return [...new Set([
start,
...(shared.isArray(fallback)
? fallback
: shared.isObject(fallback)
? Object.keys(fallback)
: shared.isString(fallback)
? [fallback]
: [start])
])];
}
/**
* Fallback with locale chain
*
* @remarks
* A fallback locale function implemented with a fallback chain algorithm. It's used in VueI18n as default.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nSee [Fallbacking](../guide/essentials/fallback)
*
* @VueI18nGeneral
*/
function fallbackWithLocaleChain(ctx, fallback, start) {
const startLocale = shared.isString(start) ? start : DEFAULT_LOCALE;
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(startLocale);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (shared.isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = shared.isArray(fallback) || !shared.isPlainObject(fallback)
? fallback
: fallback['default']
? fallback['default']
: null;
// convert defaults to array
block = shared.isString(defaults) ? [defaults] : defaults;
if (shared.isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(startLocale, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
const locale = block[i];
if (shared.isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/* eslint-disable @typescript-eslint/no-explicit-any */

@@ -68,4 +593,5 @@ /**

*/
const VERSION = '9.2.0-alpha.6';
const VERSION = '9.2.0-alpha.7';
const NOT_REOSLVED = -1;
const DEFAULT_LOCALE = 'en-US';
const MISSING_RESOLVE_VALUE = '';

@@ -86,8 +612,30 @@ function getDefaultLinkedModifiers() {

}
let _resolver;
/**
* Register the message resolver
*
* @param resolver - A {@link MessageResolver} function
*
* @VueI18nGeneral
*/
function registerMessageResolver(resolver) {
_resolver = resolver;
}
let _fallbacker;
/**
* Register the locale fallbacker
*
* @param fallbacker - A {@link LocaleFallbacker} function
*
* @VueI18nGeneral
*/
function registerLocaleFallbacker(fallbacker) {
_fallbacker = fallbacker;
}
// Additional Meta for Intlify DevTools
let _additionalMeta = null;
const setAdditionalMeta = /* #__PURE__*/ (meta) => {
const setAdditionalMeta = (meta) => {
_additionalMeta = meta;
};
const getAdditionalMeta = /* #__PURE__*/ () => _additionalMeta;
const getAdditionalMeta = () => _additionalMeta;
// ID for CoreContext

@@ -98,3 +646,3 @@ let _cid = 0;

const version = shared.isString(options.version) ? options.version : VERSION;
const locale = shared.isString(options.locale) ? options.locale : 'en-US';
const locale = shared.isString(options.locale) ? options.locale : DEFAULT_LOCALE;
const fallbackLocale = shared.isArray(options.fallbackLocale) ||

@@ -110,7 +658,9 @@ shared.isPlainObject(options.fallbackLocale) ||

const datetimeFormats = shared.isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
? options.datetimeFormats
: { [locale]: {} }
;
const numberFormats = shared.isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
? options.numberFormats
: { [locale]: {} }
;
const modifiers = shared.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());

@@ -138,5 +688,8 @@ const pluralRules = options.pluralRules || {};

: _compiler;
const messageResolver$1 = shared.isFunction(options.messageResolver)
const messageResolver = shared.isFunction(options.messageResolver)
? options.messageResolver
: messageResolver.resolveValue;
: _resolver || resolveWithKeyValue;
const localeFallbacker = shared.isFunction(options.localeFallbacker)
? options.localeFallbacker
: _fallbacker || fallbackWithSimple;
const onWarn = shared.isFunction(options.onWarn) ? options.onWarn : shared.warn;

@@ -146,7 +699,9 @@ // setup internal options

const __datetimeFormatters = shared.isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
? internalOptions.__datetimeFormatters
: new Map()
;
const __numberFormatters = shared.isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
? internalOptions.__numberFormatters
: new Map()
;
const __meta = shared.isObject(internalOptions.__meta) ? internalOptions.__meta : {};

@@ -160,4 +715,2 @@ _cid++;

messages,
datetimeFormats,
numberFormats,
modifiers,

@@ -175,8 +728,13 @@ pluralRules,

messageCompiler,
messageResolver: messageResolver$1,
messageResolver,
localeFallbacker,
onWarn,
__datetimeFormatters,
__numberFormatters,
__meta
};
{
context.datetimeFormats = datetimeFormats;
context.numberFormats = numberFormats;
context.__datetimeFormatters = __datetimeFormatters;
context.__numberFormatters = __numberFormatters;
}
return context;

@@ -204,75 +762,6 @@ }

/** @internal */
function getLocaleChain(ctx, fallback, start) {
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (shared.isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = shared.isArray(fallback) || !shared.isPlainObject(fallback)
? fallback
: fallback['default']
? fallback['default']
: null;
// convert defaults to array
block = shared.isString(defaults) ? [defaults] : defaults;
if (shared.isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
const locale = block[i];
if (shared.isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
ctx.localeFallbacker(ctx, fallback, locale);
}

@@ -311,7 +800,9 @@ /* eslint-enable @typescript-eslint/no-explicit-any */

let code = messageCompiler.CompileErrorCodes.__EXTEND_POINT__;
const inc = () => code++;
const CoreErrorCodes = {
INVALID_ARGUMENT: messageCompiler.CompileErrorCodes.__EXTEND_POINT__,
INVALID_DATE_ARGUMENT: messageCompiler.CompileErrorCodes.__EXTEND_POINT__ + 1,
INVALID_ISO_DATE_ARGUMENT: messageCompiler.CompileErrorCodes.__EXTEND_POINT__ + 2,
__EXTEND_POINT__: messageCompiler.CompileErrorCodes.__EXTEND_POINT__ + 3
INVALID_ARGUMENT: code,
INVALID_DATE_ARGUMENT: inc(),
INVALID_ISO_DATE_ARGUMENT: inc(),
__EXTEND_POINT__: inc() // 18
};

@@ -321,2 +812,9 @@ function createCoreError(code) {

}
/** @internal */
({
[CoreErrorCodes.INVALID_ARGUMENT]: 'Invalid arguments',
[CoreErrorCodes.INVALID_DATE_ARGUMENT]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT]: 'The argument provided is not a valid ISO date string'
});

@@ -390,3 +888,3 @@ const NOOP_MESSAGE_FUNCTION = () => '';

const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = runtime.createMessageContext(ctxOptions);
const msgContext = createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);

@@ -410,4 +908,4 @@ // if use post translation option, proceed it with handler

function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn, messageResolver: resolveValue } = context;
const locales = getLocaleChain(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
const { messages, onWarn, messageResolver: resolveValue, localeFallbacker } = context;
const locales = localeFallbacker(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
let message = {};

@@ -546,3 +1044,3 @@ let targetLocale;

function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __datetimeFormatters } = context;

@@ -558,3 +1056,3 @@ const [key, value, options, overrides] = parseDateTimeArgs(...args);

const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, // eslint-disable-line @typescript-eslint/no-explicit-any
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale, locale);

@@ -665,3 +1163,3 @@ if (!shared.isString(key) || key === '') {

function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __numberFormatters } = context;

@@ -677,3 +1175,3 @@ const [key, value, options, overrides] = parseNumberArgs(...args);

const locale = shared.isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, // eslint-disable-line @typescript-eslint/no-explicit-any
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale, locale);

@@ -754,2 +1252,4 @@ if (!shared.isString(key) || key === '') {

exports.CoreWarnCodes = CoreWarnCodes;
exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
exports.DEFAULT_MESSAGE_DATA_TYPE = DEFAULT_MESSAGE_DATA_TYPE;
exports.MISSING_RESOLVE_VALUE = MISSING_RESOLVE_VALUE;

@@ -764,7 +1264,10 @@ exports.NOT_REOSLVED = NOT_REOSLVED;

exports.createCoreError = createCoreError;
exports.createMessageContext = createMessageContext;
exports.datetime = datetime;
exports.fallbackWithLocaleChain = fallbackWithLocaleChain;
exports.fallbackWithSimple = fallbackWithSimple;
exports.getAdditionalMeta = getAdditionalMeta;
exports.getDevToolsHook = getDevToolsHook;
exports.getLocaleChain = getLocaleChain;
exports.getWarnMessage = getWarnMessage;
exports.handleFlatJson = handleFlatJson;
exports.handleMissing = handleMissing;

@@ -776,6 +1279,11 @@ exports.initI18nDevTools = initI18nDevTools;

exports.number = number;
exports.parse = parse;
exports.parseDateTimeArgs = parseDateTimeArgs;
exports.parseNumberArgs = parseNumberArgs;
exports.parseTranslateArgs = parseTranslateArgs;
exports.registerLocaleFallbacker = registerLocaleFallbacker;
exports.registerMessageCompiler = registerMessageCompiler;
exports.registerMessageResolver = registerMessageResolver;
exports.resolveValue = resolveValue;
exports.resolveWithKeyValue = resolveWithKeyValue;
exports.setAdditionalMeta = setAdditionalMeta;

@@ -786,7 +1294,1 @@ exports.setDevToolsHook = setDevToolsHook;

exports.updateFallbackLocale = updateFallbackLocale;
Object.keys(messageResolver).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = messageResolver[k];
});
Object.keys(runtime).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = runtime[k];
});
import { CompileError } from '@intlify/message-compiler';
import { CompileErrorCodes } from '@intlify/message-compiler';
import type { CompileOptions } from '@intlify/message-compiler';
import type { CoreMissingType } from '@intlify/runtime';
import { createCompileError } from '@intlify/message-compiler';
import type { FallbackLocale } from '@intlify/runtime';
import type { IntlifyDevToolsEmitter } from '@intlify/devtools-if';
import type { IntlifyDevToolsHookPayloads } from '@intlify/devtools-if';
import { IntlifyDevToolsHooks } from '@intlify/devtools-if';
import type { LinkedModifiers } from '@intlify/runtime';
import type { Locale } from '@intlify/runtime';
import type { MessageFunction } from '@intlify/runtime';
import type { MessageProcessor } from '@intlify/runtime';
import type { MessageResolver } from '@intlify/message-resolver';
import type { MessageType } from '@intlify/runtime';
import type { NamedValue } from '@intlify/runtime';
import type { Path } from '@intlify/message-resolver';
import type { PluralizationRules } from '@intlify/runtime';
import type { VueDevToolsEmitter } from '@intlify/vue-devtools';

@@ -45,2 +34,3 @@

unresolving: boolean;
localeFallbacker: LocaleFallbacker;
onWarn(msg: string, err?: Error): void;

@@ -87,2 +77,4 @@ }

export declare type CoreMissingType = 'translate' | 'datetime format' | 'number format';
export declare interface CoreNumberContext<NumberFormats = {}> {

@@ -144,2 +136,3 @@ numberFormats: {

messageResolver?: MessageResolver;
localeFallbacker?: LocaleFallbacker;
onWarn?: (msg: string, err?: Error) => void;

@@ -181,2 +174,4 @@ }

export declare function createMessageContext<T = string, N = {}>(options?: MessageContextOptions<T, N>): MessageContext<T>;
/**

@@ -298,2 +293,15 @@ * number

export declare const DEFAULT_LOCALE = "en-US";
export declare const DEFAULT_MESSAGE_DATA_TYPE = "text";
declare type ExtractToStringFunction<T> = T[ExtractToStringKey<T>];
declare type ExtractToStringKey<T> = Extract<keyof T, 'toString'>;
/** @VueI18nGeneral */
export declare type FallbackLocale = Locale | Locale[] | {
[locale in string]: Locale[];
} | false;
export declare type FallbackLocales<Locales = 'en-US'> = Locales | Array<Locales> | {

@@ -303,2 +311,38 @@ [locale in string]: Array<PickupFallbackLocales<UnionToTuple<Locales>>>;

/**
* Fallback with locale chain
*
* @remarks
* A fallback locale function implemented with a fallback chain algorithm. It's used in VueI18n as default.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nSee [Fallbacking](../guide/essentials/fallback)
*
* @VueI18nGeneral
*/
export declare function fallbackWithLocaleChain<Message = string>(ctx: CoreContext<Message>, fallback: FallbackLocale, start: Locale): Locale[];
/**
* Fallback with simple implemenation
*
* @remarks
* A fallback locale function implemented with a simple fallback algorithm.
*
* Basically, it returns the value as specified in the `fallbackLocale` props, and is processed with the fallback inside intlify.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nGeneral
*/
export declare function fallbackWithSimple<Message = string>(ctx: CoreContext<Message>, fallback: FallbackLocale, start: Locale): Locale[];
export declare type First<T extends readonly any[]> = T[0];

@@ -319,6 +363,9 @@

/* Excluded from this release type: getLocaleChain */
export declare function getWarnMessage(code: CoreWarnCodes, ...args: unknown[]): string;
/**
* Transform flat json in obj to normal json in obj
*/
export declare function handleFlatJson(obj: unknown): unknown;
/* Excluded from this release type: handleMissing */

@@ -342,2 +389,19 @@

/** @VueI18nGeneral */
export declare type LinkedModifiers<T = string> = {
[key: string]: LinkedModify<T>;
};
export declare type LinkedModify<T = string> = (value: T) => MessageType<T>;
/** @VueI18nGeneral */
export declare type Locale = string;
/**
* The locale fallbacker
*
* @VueI18nGeneral
*/
export declare type LocaleFallbacker = <Message = string>(ctx: CoreContext<Message>, fallback: FallbackLocale, start: Locale) => Locale[];
export declare type LocaleMatcher = 'lookup' | 'best fit';

@@ -394,2 +458,55 @@

export declare interface MessageContext<T = string> {
list(index: number): unknown;
named(key: string): unknown;
plural(messages: T[]): T;
linked(key: Path, modifier?: string): MessageType<T>;
message(key: Path): MessageFunction<T>;
type: string;
interpolate: MessageInterpolate<T>;
normalize: MessageNormalize<T>;
}
export declare interface MessageContextOptions<T = string, N = {}> {
parent?: MessageContext<T>;
locale?: string;
list?: unknown[];
named?: NamedValue<N>;
modifiers?: LinkedModifiers<T>;
pluralIndex?: number;
pluralRules?: PluralizationRules;
messages?: MessageFunctions<T> | MessageResolveFunction<T>;
processor?: MessageProcessor<T>;
}
export declare type MessageFunction<T = string> = MessageFunctionCallable | MessageFunctionInternal<T>;
export declare type MessageFunctionCallable = <T = string>(ctx: MessageContext<T>) => MessageType<T>;
export declare type MessageFunctionInternal<T = string> = {
(ctx: MessageContext<T>): MessageType<T>;
key?: string;
locale?: string;
source?: string;
};
export declare type MessageFunctions<T = string> = Record<string, MessageFunction<T>>;
export declare type MessageInterpolate<T = string> = (val: unknown) => MessageType<T>;
export declare type MessageNormalize<T = string> = (values: MessageType<string | T>[]) => MessageType<T | T[]>;
export declare interface MessageProcessor<T = string> {
type?: string;
interpolate?: MessageInterpolate<T>;
normalize?: MessageNormalize<T>;
}
export declare type MessageResolveFunction<T = string> = (key: string) => MessageFunction<T>;
/** @VueI18nGeneral */
export declare type MessageResolver = (obj: unknown, path: Path) => PathValue;
export declare type MessageType<T = string> = T extends string ? string : StringConvertable<T>;
export declare interface MetaInfo {

@@ -401,2 +518,5 @@ [field: string]: unknown;

/** @VueI18nGeneral */
export declare type NamedValue<T = {}> = T & Record<string, unknown>;
export declare const NOT_REOSLVED = -1;

@@ -503,2 +623,7 @@

/**
* Parse a string path into an array of segments
*/
export declare function parse(path: Path): string[] | undefined;
/* Excluded from this release type: parseDateTimeArgs */

@@ -510,2 +635,10 @@

/** @VueI18nGeneral */
export declare type Path = string;
/** @VueI18nGeneral */
export declare type PathValue = string | number | boolean | Function | null | {
[key: string]: PathValue;
} | PathValue[];
export declare type PickupFallbackLocales<T extends any[]> = T[number] | `${T[number]}!`;

@@ -523,7 +656,37 @@

export declare type PluralizationProps = {
n?: number;
count?: number;
};
export declare type PluralizationRule = (choice: number, choicesLength: number, orgRule?: PluralizationRule) => number;
/** @VueI18nGeneral */
export declare type PluralizationRules = {
[locale: string]: PluralizationRule;
};
/** @VueI18nGeneral */
export declare type PostTranslationHandler<Message = string> = (translated: MessageType<Message>) => MessageType<Message>;
/**
* Register the locale fallbacker
*
* @param fallbacker - A {@link LocaleFallbacker} function
*
* @VueI18nGeneral
*/
export declare function registerLocaleFallbacker(fallbacker: LocaleFallbacker): void;
export declare function registerMessageCompiler<Message>(compiler: MessageCompiler<Message>): void;
/**
* Register the message resolver
*
* @param resolver - A {@link MessageResolver} function
*
* @VueI18nGeneral
*/
export declare function registerMessageResolver(resolver: MessageResolver): void;
export declare type RemoveIndexSignature<T> = {

@@ -533,2 +696,32 @@ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];

/**
* message resolver
*
* @remarks
* Resolves messages. messages with a hierarchical structure such as objects can be resolved. This resolver is used in VueI18n as default.
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
export declare function resolveValue(obj: unknown, path: Path): PathValue;
/**
* key-value message resolver
*
* @remarks
* Resolves messages with the key-value structure. Note that messages with a hierarchical structure such as objects cannot be resolved
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
export declare function resolveWithKeyValue(obj: unknown, path: Path): PathValue;
export declare type ResourceFormatPath<T> = _ResourceFormatPath<T> extends string | keyof T ? _ResourceFormatPath<T> : keyof T;

@@ -588,2 +781,4 @@

declare type StringConvertable<T> = ExtractToStringKey<T> extends never ? unknown : ExtractToStringFunction<T> extends (...args: any) => string ? T : unknown;
/**

@@ -727,5 +922,2 @@ * `translate` function overloads

export * from "@intlify/message-resolver";
export * from "@intlify/runtime";
export { }

4

dist/core-base.esm-browser.prod.js
/*!
* @intlify/core-base v9.2.0-alpha.6
* core-base v9.2.0-alpha.7
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===h(e),o=e=>k(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function a(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const u=Object.prototype.hasOwnProperty;function l(e,t){return u.call(e,t)}const i=Array.isArray,f=e=>"function"==typeof e,p=e=>"string"==typeof e,m=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,_=Object.prototype.toString,h=e=>_.call(e),k=e=>"[object Object]"===h(e),T=[];T[0]={w:[0],i:[3,0],"[":[4],o:[7]},T[1]={w:[1],".":[2],"[":[4],o:[7]},T[2]={w:[2],i:[3,0],0:[3,0]},T[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},T[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},T[5]={"'":[4,0],o:8,l:[5,0]},T[6]={'"':[4,0],o:8,l:[6,0]};const E=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function N(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 g(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(E.test(t)?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)}function L(e){const t=[];let n,r,o,c,s,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=g(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(c=N(n),u=T[i],s=u[c]||u.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(a=p[s[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const b=new Map;function y(e,t){if(!d(e))return null;let n=b.get(t);if(n||(n=L(t),n&&b.set(t,n)),!n)return null;const r=n.length;let o=e,c=0;for(;c<r;){const e=o[n[c]];if(void 0===e)return null;o=e,c++}return o}function A(e){if(!d(e))return e;for(const t in e)if(l(e,t))if(t.includes(".")){const n=t.split("."),r=n.length-1;let o=e;for(let e=0;e<r;e++)n[e]in o||(o[n[e]]={}),o=o[n[e]];o[n[r]]=e[t],delete e[t],d(o[n[r]])&&A(o[n[r]])}else d(e[t])&&A(e[t]);return e}const O=e=>e,C=e=>"",I="text",x=e=>0===e.length?"":e.join(""),P=e=>null==e?"":i(e)||k(e)&&e.toString===_?JSON.stringify(e,null,2):String(e);function v(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function w(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?e.pluralRules[t]:v,c=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?v:void 0,s=e.list||[],a=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,a);function u(t){const n=f(e.messages)?e.messages(t):!!d(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):C)}const l=k(e.processor)&&f(e.processor.normalize)?e.processor.normalize:x,i=k(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:P,m={list:e=>s[e],named:e=>a[e],plural:e=>e[o(r,e.length,c)],linked:(t,n)=>{const r=u(t)(m);return p(n)?(o=n,e.modifiers?e.modifiers[o]:O)(r):r;var o},message:u,type:k(e.processor)&&p(e.processor.type)?e.processor.type:"text",interpolate:i,normalize:l};return m}const F={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function D(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function R(e){throw e}function S(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const M=String.fromCharCode(8232),$=String.fromCharCode(8233);function U(e){const t=e;let n=0,r=1,o=1,c=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],a=e=>t[e]===$,u=e=>t[e]===M,l=e=>s(e)||(e=>"\n"===t[e])(e)||a(e)||u(e),i=e=>s(e)||a(e)||u(e)?"\n":t[e];function f(){return c=0,l(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>c,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+c),next:f,peek:function(){return s(n+c)&&c++,c++,t[n+c]},reset:function(){n=0,r=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=n+c;for(;e!==n;)f();c=0}}}const W=void 0;function K(e,t={}){const n=!1!==t.location,r=U(e),o=()=>r.index(),c=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=c(),a=o(),u={currentType:14,offset:a,startLoc:s,endLoc:s,lastType:14,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=c(),e.currentType=t;const o={type:t};return n&&(o.loc=S(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(c(),"")}function d(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function _(e){const t=d(e);return e.skipToPeek(),t}function h(e){if(e===W)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function k(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===W)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function T(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function E(e,t=!0){const n=(t=!1,r="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==r&&t:"@"!==c&&c?"%"===c?(e.peek(),n(t,"%",!0)):"|"===c?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===c?(e.peek(),n(!0," ",o)):"\n"!==c||(e.peek(),n(!0,"\n",o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function N(e,t){const n=e.currentChar();return n===W?W:t(n)?(e.next(),n):null}function g(e){return N(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function L(e){return N(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function b(e){return N(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function y(e){let t="",n="";for(;t=L(e);)n+=t;return n}function A(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return O(e,t,4);case"U":return O(e,t,6);default:return c(),""}}function O(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=b(e);if(!t){c(),e.currentChar();break}r+=t}return`\\${t}${r}`}function C(e){_(e);const t=m(e,"|");return _(e),t}function I(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&c(),e.next(),n=f(t,2,"{"),_(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&c(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&c(),n=x(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(T(e))return t.braceNest>0&&c(),n=f(t,1,C(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return c(),t.braceNest=0,P(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=h(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){_(e);let t="",n="";for(;t=g(e);)n+=t;return e.currentChar()===W&&c(),n}(e)),_(e),n;if(o=k(e,t))return n=f(t,6,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${y(e)}`):t+=y(e),e.currentChar()===W&&c(),t}(e)),_(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){_(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=N(e,r);)n+="\\"===t?A(e):t;const o=e.currentChar();return"\n"===o||o===W?(c(),"\n"===o&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),_(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){_(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=N(e,r);)n+=t;return n}(e)),c(),_(e),n}return n}function x(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==o&&" "!==o||c(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return _(e),e.next(),f(t,9,".");case":":return _(e),e.next(),f(t,10,":");default:return T(e)?(r=f(t,1,C(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(_(e),x(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=h(e.currentPeek());return e.resetPeek(),r}(e,t)?(_(e),f(t,12,function(e){let t="",n="";for(;t=g(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?h(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):h(t))},o=r();return e.resetPeek(),o}(e,t)?(_(e),"{"===o?I(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&c(),t.braceNest=0,t.inLinked=!1,P(e,t))}}function P(e,t){let n={type:14};if(t.braceNest>0)return I(e,t)||p(t);if(t.inLinked)return x(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return I(e,t)||p(t);case"}":return c(),e.next(),f(t,3,"}");case"@":return x(e,t)||p(t);default:if(T(e))return n=f(t,1,C(e)),t.braceNest=0,t.inLinked=!1,n;if(E(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?E(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:" "===r||"\n"===r?E(e)?(n+=r,e.next(),t(n)):T(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=s,u.offset=o(),u.startLoc=c(),r.currentChar()===W?f(u,14):P(r,u)},currentOffset:o,currentPosition:c,context:l}}const j=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function B(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function G(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function c(e,t){const n=e.context(),c=r(3,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function a(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(5,c,s);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(4,c,s);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(9,c,s);return a.value=t.replace(j,B),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let c=e.nextToken();if(9===c.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(8,c,s);return 12!==t.type?(a.value="",o(a,c,s),{nextConsumeToken:t,node:a}):(null==t.value&&V(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,c=t.nextConsumeToken||e.nextToken()}switch(10!==c.type&&V(c),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:null==c.value&&V(c),n.key=function(e,t){const n=e.context(),c=r(7,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:null==c.value&&V(c),n.key=u(e,c.value||"");break;case 6:null==c.value&&V(c),n.key=a(e,c.value||"");break;case 7:null==c.value&&V(c),n.key=l(e,c.value||"");break;default:const t=e.context(),s=r(7,t.offset,t.startLoc);return s.value="",o(s,t.offset,t.startLoc),n.key=s,o(n,t.offset,t.startLoc),{nextConsumeToken:c,node:n}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let s=null;do{const t=s||e.nextToken();switch(s=null,t.type){case 0:null==t.value&&V(t),n.items.push(c(e,t.value||""));break;case 6:null==t.value&&V(t),n.items.push(a(e,t.value||""));break;case 5:null==t.value&&V(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&V(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),s=r.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function p(e){const t=e.context(),{offset:n,startLoc:c}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,c){const s=e.context();let a=0===c.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(c);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==s.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,c,s)}return{parse:function(n){const c=K(n,s({},e)),a=c.context(),u=r(0,a.offset,a.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(c),o(u,c.currentOffset(),c.currentPosition()),u}}}function V(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function X(e,t){for(let n=0;n<e.length;n++)H(e[n],t)}function H(e,t){switch(e.type){case 1:X(e.cases,t),t.helper("plural");break;case 2:X(e.items,t);break;case 6:H(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function J(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&H(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function z(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?z(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(z(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let n=0;n<o&&(z(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),z(e,t.key),t.modifier&&(e.push(", "),z(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function Y(e,t={}){const n=s({},t),r=G(n).parse(e);return J(r,n),((e,t={})=>{const n=p(t.mode)?t.mode:"normal",r=p(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],s=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,c={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function s(e,t){c.code+=e}function a(e,t=!0){const n=t?r:"";s(o?n+" ".repeat(e):n)}return{context:()=>c,push:s,indent:function(e=!0){const t=++c.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--c.indentLevel;e&&a(t)},newline:function(){a(c.indentLevel)},helper:e=>`_${e}`,needIndent:()=>c.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(o),c.length>0&&(s.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),s.newline()),s.push("return "),z(s,e),s.deindent(o),s.push("}");const{code:a,map:u}=s.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const Q="i18n:init";let q=null;function Z(e){q=e}function ee(){return q}function te(e,t,n){q&&q.emit(Q,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const ne=re("function:translate");function re(e){return t=>q&&q.emit(e,t)}const oe={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},ce={[oe.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[oe.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[oe.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[oe.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[oe.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[oe.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function se(t,...n){return function(t,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(ce[t],...n)}const ae="9.2.0-alpha.6",ue=-1,le="";let ie;function fe(e){ie=e}let pe=null;const me=e=>{pe=e},de=()=>pe;let _e=0;function he(e={}){const t=p(e.version)?e.version:"9.2.0-alpha.6",n=p(e.locale)?e.locale:"en-US",o=i(e.fallbackLocale)||k(e.fallbackLocale)||p(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,a=k(e.messages)?e.messages:{[n]:{}},u=k(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=k(e.numberFormats)?e.numberFormats:{[n]:{}},_=s({},e.modifiers||{},{upper:e=>p(e)?e.toUpperCase():e,lower:e=>p(e)?e.toLowerCase():e,capitalize:e=>p(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),h=e.pluralRules||{},T=f(e.missing)?e.missing:null,E=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,N=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,g=!!e.fallbackFormat,L=!!e.unresolving,b=f(e.postTranslation)?e.postTranslation:null,A=k(e.processor)?e.processor:null,O=!m(e.warnHtmlMessage)||e.warnHtmlMessage,C=!!e.escapeParameter,I=f(e.messageCompiler)?e.messageCompiler:ie,x=f(e.messageResolver)?e.messageResolver:y,P=f(e.onWarn)?e.onWarn:c,v=e,w=d(v.__datetimeFormatters)?v.__datetimeFormatters:new Map,F=d(v.__numberFormatters)?v.__numberFormatters:new Map,D=d(v.__meta)?v.__meta:{};_e++;return{version:t,cid:_e,locale:n,fallbackLocale:o,messages:a,datetimeFormats:u,numberFormats:l,modifiers:_,pluralRules:h,missing:T,missingWarn:E,fallbackWarn:N,fallbackFormat:g,unresolving:L,postTranslation:b,processor:A,warnHtmlMessage:O,escapeParameter:C,messageCompiler:I,messageResolver:x,onWarn:P,__datetimeFormatters:w,__numberFormatters:F,__meta:D}}function ke(e,t){return e instanceof RegExp?e.test(t):e}function Te(e,t){return e instanceof RegExp?e.test(t):e}function Ee(e,t,n,r,o){const{missing:c}=e;if(null!==c){const r=c(e,n,t,o);return p(r)?r:t}return t}function Ne(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;i(e);)e=ge(o,e,t);const c=i(t)||!k(t)?t:t.default?t.default:null;e=p(c)?[c]:c,i(e)&&ge(o,e,!1),r.__localeChainCache.set(n,o)}return o}function ge(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){p(t[o])&&(r=Le(e,t[o],n))}return r}function Le(e,t,n){let r;const o=t.split("-");do{r=be(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function be(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(i(n)||k(n))&&n[o]&&(r=n[o])}return r}function ye(e,t,n){e.__localeChainCache=new Map,Ne(e,n,t)}const Ae=e=>e;let Oe=Object.create(null);function Ce(){Oe=Object.create(null)}function Ie(e,t={}){{const n=(t.onCacheKey||Ae)(e),r=Oe[n];if(r)return r;let o=!1;const c=t.onError||R;t.onError=e=>{o=!0,c(e)};const{code:s}=Y(e,t),a=new Function(`return ${s}`)();return o?a:Oe[n]=a}}const xe={INVALID_ARGUMENT:F.__EXTEND_POINT__,INVALID_DATE_ARGUMENT:F.__EXTEND_POINT__+1,INVALID_ISO_DATE_ARGUMENT:F.__EXTEND_POINT__+2,__EXTEND_POINT__:F.__EXTEND_POINT__+3};function Pe(e){return D(e,null,void 0)}const ve=()=>"",we=e=>f(e);function Fe(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:c,fallbackLocale:s,messages:u}=e,[l,_]=Re(...t),h=(m(_.missingWarn),m(_.fallbackWarn),m(_.escapeParameter)?_.escapeParameter:e.escapeParameter),k=!!_.resolvedMessage,T=p(_.default)||m(_.default)?m(_.default)?l:_.default:r?l:"",E=r||""!==T,N=p(_.locale)?_.locale:e.locale;h&&function(e){i(e.list)?e.list=e.list.map((e=>p(e)?a(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{p(e.named[t])&&(e.named[t]=a(e.named[t]))}))}(_);let[g,L,b]=k?[l,N,u[N]||{}]:function(e,t,n,r,o,c){const{messages:s,messageResolver:a}=e,u=Ne(e,r,n);let l,i={},m=null;const d="translate";for(let n=0;n<u.length&&(l=u[n],i=s[l]||{},null===(m=a(i,t))&&(m=i[t]),!p(m)&&!f(m));n++){const n=Ee(e,t,l,0,d);n!==t&&(m=n)}return[m,l,i]}(e,l,N,s),y=l;if(k||p(g)||we(g)||E&&(g=T,y=g),!(k||(p(g)||we(g))&&p(L)))return c?-1:l;let A=!1;const O=we(g)?g:De(e,l,L,g,y,(()=>{A=!0}));if(A)return g;const C=function(e,t,n){return t(n)}(0,O,w(function(e,t,r,o){const{modifiers:c,pluralRules:s,messageResolver:a}=e,u={locale:t,modifiers:c,pluralRules:s,messages:n=>{const o=a(r,n);if(p(o)){let r=!1;const c=De(e,n,t,o,n,(()=>{r=!0}));return r?ve:c}return we(o)?o:ve}};e.processor&&(u.processor=e.processor);o.list&&(u.list=o.list);o.named&&(u.named=o.named);n(o.plural)&&(u.pluralIndex=o.plural);return u}(e,L,b,_)));return o?o(C):C}function De(e,n,r,o,c,s){const{messageCompiler:a,warnHtmlMessage:u}=e;if(we(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const l=a(o,function(e,n,r,o,c,s){return{warnHtmlMessage:c,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,c,0,u,s));return l.locale=r,l.key=n,l.source=o,l}function Re(...e){const[t,r,c]=e,a={};if(!p(t)&&!n(t)&&!we(t))throw Error(xe.INVALID_ARGUMENT);const u=n(t)?String(t):(we(t),t);return n(r)?a.plural=r:p(r)?a.default=r:k(r)&&!o(r)?a.named=r:i(r)&&(a.list=r),n(c)?a.plural=c:p(c)?a.default=c:k(c)&&s(a,c),[u,a]}function Se(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:c}=e,{__datetimeFormatters:a}=e,[u,l,i,f]=Me(...t);m(i.missingWarn);m(i.fallbackWarn);const d=!!i.part,_=p(i.locale)?i.locale:e.locale,h=Ne(e,c,_);if(!p(u)||""===u)return new Intl.DateTimeFormat(_).format(l);let T,E={},N=null;for(let t=0;t<h.length&&(T=h[t],E=n[T]||{},N=E[u],!k(N));t++)Ee(e,u,T,0,"datetime format");if(!k(N)||!p(T))return r?-1:u;let g=`${T}__${u}`;o(f)||(g=`${g}__${JSON.stringify(f)}`);let L=a.get(g);return L||(L=new Intl.DateTimeFormat(T,s({},N,f)),a.set(g,L)),d?L.formatToParts(l):L.format(l)}function Me(...e){const[t,r,o,c]=e;let s,a={},u={};if(p(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(xe.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();s=new Date(n);try{s.toISOString()}catch(e){throw Error(xe.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===h(t)){if(isNaN(t.getTime()))throw Error(xe.INVALID_DATE_ARGUMENT);s=t}else{if(!n(t))throw Error(xe.INVALID_ARGUMENT);s=t}return p(r)?a.key=r:k(r)&&(a=r),p(o)?a.locale=o:k(o)&&(u=o),k(c)&&(u=c),[a.key||"",s,a,u]}function $e(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function Ue(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:c}=e,{__numberFormatters:a}=e,[u,l,i,f]=We(...t);m(i.missingWarn);m(i.fallbackWarn);const d=!!i.part,_=p(i.locale)?i.locale:e.locale,h=Ne(e,c,_);if(!p(u)||""===u)return new Intl.NumberFormat(_).format(l);let T,E={},N=null;for(let t=0;t<h.length&&(T=h[t],E=n[T]||{},N=E[u],!k(N));t++)Ee(e,u,T,0,"number format");if(!k(N)||!p(T))return r?-1:u;let g=`${T}__${u}`;o(f)||(g=`${g}__${JSON.stringify(f)}`);let L=a.get(g);return L||(L=new Intl.NumberFormat(T,s({},N,f)),a.set(g,L)),d?L.formatToParts(l):L.format(l)}function We(...e){const[t,r,o,c]=e;let s={},a={};if(!n(t))throw Error(xe.INVALID_ARGUMENT);const u=t;return p(r)?s.key=r:k(r)&&(s=r),p(o)?s.locale=o:k(o)&&(a=o),k(c)&&(a=c),[s.key||"",u,s,a]}function Ke(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}export{F as CompileErrorCodes,xe as CoreErrorCodes,oe as CoreWarnCodes,I as DEFAULT_MESSAGE_DATA_TYPE,le as MISSING_RESOLVE_VALUE,ue as NOT_REOSLVED,ae as VERSION,Ce as clearCompileCache,$e as clearDateTimeFormat,Ke as clearNumberFormat,Ie as compileToFunction,D as createCompileError,he as createCoreContext,Pe as createCoreError,w as createMessageContext,Se as datetime,de as getAdditionalMeta,ee as getDevToolsHook,Ne as getLocaleChain,se as getWarnMessage,A as handleFlatJson,Ee as handleMissing,te as initI18nDevTools,we as isMessageFunction,ke as isTranslateFallbackWarn,Te as isTranslateMissingWarn,Ue as number,L as parse,Me as parseDateTimeArgs,We as parseNumberArgs,Re as parseTranslateArgs,fe as registerMessageCompiler,y as resolveValue,me as setAdditionalMeta,Z as setDevToolsHook,Fe as translate,ne as translateDevTools,ye as updateFallbackLocale};
const e=/\{([0-9a-zA-Z]+)\}/g;const t=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),n=e=>"number"==typeof e&&isFinite(e),r=e=>"[object RegExp]"===k(e),o=e=>h(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const s=Object.assign;function a(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const u=Object.prototype.hasOwnProperty;function l(e,t){return u.call(e,t)}const i=Array.isArray,f=e=>"function"==typeof e,p=e=>"string"==typeof e,m=e=>"boolean"==typeof e,d=e=>null!==e&&"object"==typeof e,_=Object.prototype.toString,k=e=>_.call(e),h=e=>"[object Object]"===k(e),T={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function b(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function E(e){throw e}function N(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const g=String.fromCharCode(8232),L=String.fromCharCode(8233);function y(e){const t=e;let n=0,r=1,o=1,c=0;const s=e=>"\r"===t[e]&&"\n"===t[e+1],a=e=>t[e]===L,u=e=>t[e]===g,l=e=>s(e)||(e=>"\n"===t[e])(e)||a(e)||u(e),i=e=>s(e)||a(e)||u(e)?"\n":t[e];function f(){return c=0,l(n)&&(r++,o=0),s(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>c,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+c),next:f,peek:function(){return s(n+c)&&c++,c++,t[n+c]},reset:function(){n=0,r=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=n+c;for(;e!==n;)f();c=0}}}const A=void 0;function C(e,t={}){const n=!1!==t.location,r=y(e),o=()=>r.index(),c=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},s=c(),a=o(),u={currentType:14,offset:a,startLoc:s,endLoc:s,lastType:14,lastOffset:a,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=c(),e.currentType=t;const o={type:t};return n&&(o.loc=N(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(c(),"")}function d(e){let t="";for(;" "===e.currentPeek()||"\n"===e.currentPeek();)t+=e.currentPeek(),e.peek();return t}function _(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===A)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function h(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===A)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function T(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function b(e,t=!0){const n=(t=!1,r="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==r&&t:"@"!==c&&c?"%"===c?(e.peek(),n(t,"%",!0)):"|"===c?!("%"!==r&&!o)||!(" "===r||"\n"===r):" "===c?(e.peek(),n(!0," ",o)):"\n"!==c||(e.peek(),n(!0,"\n",o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function E(e,t){const n=e.currentChar();return n===A?A:t(n)?(e.next(),n):null}function g(e){return E(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function L(e){return E(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function C(e){return E(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function O(e){let t="",n="";for(;t=L(e);)n+=t;return n}function x(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return I(e,t,4);case"U":return I(e,t,6);default:return c(),""}}function I(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=C(e);if(!t){c(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){_(e);const t=m(e,"|");return _(e),t}function v(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&c(),e.next(),n=f(t,2,"{"),_(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&c(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&c(),n=F(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,s=!0;if(T(e))return t.braceNest>0&&c(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return c(),t.braceNest=0,w(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){_(e);let t="",n="";for(;t=g(e);)n+=t;return e.currentChar()===A&&c(),n}(e)),_(e),n;if(o=h(e,t))return n=f(t,6,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${O(e)}`):t+=O(e),e.currentChar()===A&&c(),t}(e)),_(e),n;if(s=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){_(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&"\n"!==e;for(;t=E(e,r);)n+="\\"===t?x(e):t;const o=e.currentChar();return"\n"===o||o===A?(c(),"\n"===o&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),_(e),n;if(!r&&!o&&!s)return n=f(t,13,function(e){_(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&" "!==e&&"\n"!==e;for(;t=E(e,r);)n+=t;return n}(e)),c(),_(e),n}return n}function F(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||"\n"!==o&&" "!==o||c(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return _(e),e.next(),f(t,9,".");case":":return _(e),e.next(),f(t,10,":");default:return T(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(_(e),F(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(_(e),f(t,12,function(e){let t="",n="";for(;t=g(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||" "===t||!t)&&("\n"===t?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(_(e),"{"===o?v(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?" "===o?r:"\n"===o?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&c(),t.braceNest=0,t.inLinked=!1,w(e,t))}}function w(e,t){let n={type:14};if(t.braceNest>0)return v(e,t)||p(t);if(t.inLinked)return F(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return v(e,t)||p(t);case"}":return c(),e.next(),f(t,3,"}");case"@":return F(e,t)||p(t);default:if(T(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(b(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?b(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:" "===r||"\n"===r?b(e)?(n+=r,e.next(),t(n)):T(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:s}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=s,u.offset=o(),u.startLoc=c(),r.currentChar()===A?f(u,14):w(r,u)},currentOffset:o,currentPosition:c,context:l}}const O=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function x(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function I(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function c(e,t){const n=e.context(),c=r(3,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function a(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(5,c,s);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(4,c,s);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(9,c,s);return a.value=t.replace(O,x),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let c=e.nextToken();if(9===c.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:c,lastStartLoc:s}=n,a=r(8,c,s);return 12!==t.type?(a.value="",o(a,c,s),{nextConsumeToken:t,node:a}):(null==t.value&&P(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,c=t.nextConsumeToken||e.nextToken()}switch(10!==c.type&&P(c),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:null==c.value&&P(c),n.key=function(e,t){const n=e.context(),c=r(7,n.offset,n.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:null==c.value&&P(c),n.key=u(e,c.value||"");break;case 6:null==c.value&&P(c),n.key=a(e,c.value||"");break;case 7:null==c.value&&P(c),n.key=l(e,c.value||"");break;default:const t=e.context(),s=r(7,t.offset,t.startLoc);return s.value="",o(s,t.offset,t.startLoc),n.key=s,o(n,t.offset,t.startLoc),{nextConsumeToken:c,node:n}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let s=null;do{const t=s||e.nextToken();switch(s=null,t.type){case 0:null==t.value&&P(t),n.items.push(c(e,t.value||""));break;case 6:null==t.value&&P(t),n.items.push(a(e,t.value||""));break;case 5:null==t.value&&P(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&P(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),s=r.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function p(e){const t=e.context(),{offset:n,startLoc:c}=t,s=f(e);return 14===t.currentType?s:function(e,t,n,c){const s=e.context();let a=0===c.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(c);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==s.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,c,s)}return{parse:function(n){const c=C(n,s({},e)),a=c.context(),u=r(0,a.offset,a.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(c),o(u,c.currentOffset(),c.currentPosition()),u}}}function P(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function v(e,t){for(let n=0;n<e.length;n++)F(e[n],t)}function F(e,t){switch(e.type){case 1:v(e.cases,t),t.helper("plural");break;case 2:v(e.items,t);break;case 6:F(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function w(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&F(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function R(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?R(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(R(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let n=0;n<o&&(R(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),R(e,t.key),t.modifier&&(e.push(", "),R(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function D(e,t={}){const n=s({},t),r=I(n).parse(e);return w(r,n),((e,t={})=>{const n=p(t.mode)?t.mode:"normal",r=p(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,c=e.helpers||[],s=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,c={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function s(e,t){c.code+=e}function a(e,t=!0){const n=t?r:"";s(o?n+" ".repeat(e):n)}return{context:()=>c,push:s,indent:function(e=!0){const t=++c.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--c.indentLevel;e&&a(t)},newline:function(){a(c.indentLevel)},helper:e=>`_${e}`,needIndent:()=>c.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(o),c.length>0&&(s.push(`const { ${c.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),s.newline()),s.push("return "),R(s,e),s.deindent(o),s.push("}");const{code:a,map:u}=s.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const S=[];S[0]={w:[0],i:[3,0],"[":[4],o:[7]},S[1]={w:[1],".":[2],"[":[4],o:[7]},S[2]={w:[2],i:[3,0],0:[3,0]},S[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},S[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},S[5]={"'":[4,0],o:8,l:[5,0]},S[6]={'"':[4,0],o:8,l:[6,0]};const M=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function $(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 U(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(M.test(t)?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)}function W(e){const t=[];let n,r,o,c,s,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=U(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(c=$(n),u=S[i],s=u[c]||u.l||8,8===s)return;if(i=s[0],void 0!==s[1]&&(a=p[s[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const K=new Map;function j(e,t){return d(e)?e[t]:null}function B(e,t){if(!d(e))return null;let n=K.get(t);if(n||(n=W(t),n&&K.set(t,n)),!n)return null;const r=n.length;let o=e,c=0;for(;c<r;){const e=o[n[c]];if(void 0===e)return null;o=e,c++}return o}function G(e){if(!d(e))return e;for(const t in e)if(l(e,t))if(t.includes(".")){const n=t.split("."),r=n.length-1;let o=e;for(let e=0;e<r;e++)n[e]in o||(o[n[e]]={}),o=o[n[e]];o[n[r]]=e[t],delete e[t],d(o[n[r]])&&G(o[n[r]])}else d(e[t])&&G(e[t]);return e}const V=e=>e,H=e=>"",X="text",J=e=>0===e.length?"":e.join(""),z=e=>null==e?"":i(e)||h(e)&&e.toString===_?JSON.stringify(e,null,2):String(e);function Y(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function Q(e={}){const t=e.locale,r=function(e){const t=n(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(n(e.named.count)||n(e.named.n))?n(e.named.count)?e.named.count:n(e.named.n)?e.named.n:t:t}(e),o=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?e.pluralRules[t]:Y,c=d(e.pluralRules)&&p(t)&&f(e.pluralRules[t])?Y:void 0,s=e.list||[],a=e.named||{};n(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(r,a);function u(t){const n=f(e.messages)?e.messages(t):!!d(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):H)}const l=h(e.processor)&&f(e.processor.normalize)?e.processor.normalize:J,i=h(e.processor)&&f(e.processor.interpolate)?e.processor.interpolate:z,m={list:e=>s[e],named:e=>a[e],plural:e=>e[o(r,e.length,c)],linked:(t,n)=>{const r=u(t)(m);return p(n)?(o=n,e.modifiers?e.modifiers[o]:V)(r):r;var o},message:u,type:h(e.processor)&&p(e.processor.type)?e.processor.type:"text",interpolate:i,normalize:l};return m}const q="i18n:init";let Z=null;function ee(e){Z=e}function te(){return Z}function ne(e,t,n){Z&&Z.emit(q,{timestamp:Date.now(),i18n:e,version:t,meta:n})}const re=oe("function:translate");function oe(e){return t=>Z&&Z.emit(e,t)}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,__EXTEND_POINT__:7},se={[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."};function ae(t,...n){return function(t,...n){return 1===n.length&&d(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(e,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(se[t],...n)}function ue(e,t,n){return[...new Set([n,...i(t)?t:d(t)?Object.keys(t):p(t)?[t]:[n]])]}function le(e,t,n){const r=p(n)?n:_e,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let c=o.__localeChainCache.get(r);if(!c){c=[];let e=[n];for(;i(e);)e=ie(c,e,t);const s=i(t)||!h(t)?t:t.default?t.default:null;e=p(s)?[s]:s,i(e)&&ie(c,e,!1),o.__localeChainCache.set(r,c)}return c}function ie(e,t,n){let r=!0;for(let o=0;o<t.length&&m(r);o++){p(t[o])&&(r=fe(e,t[o],n))}return r}function fe(e,t,n){let r;const o=t.split("-");do{r=pe(e,o.join("-"),n),o.splice(-1,1)}while(o.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 o=t.replace(/!/g,"");e.push(o),(i(n)||h(n))&&n[o]&&(r=n[o])}return r}const me="9.2.0-alpha.7",de=-1,_e="en-US",ke="";let he,Te,be;function Ee(e){he=e}function Ne(e){Te=e}function ge(e){be=e}let Le=null;const ye=e=>{Le=e},Ae=()=>Le;let Ce=0;function Oe(e={}){const t=p(e.version)?e.version:"9.2.0-alpha.7",n=p(e.locale)?e.locale:_e,o=i(e.fallbackLocale)||h(e.fallbackLocale)||p(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,a=h(e.messages)?e.messages:{[n]:{}},u=h(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=h(e.numberFormats)?e.numberFormats:{[n]:{}},_=s({},e.modifiers||{},{upper:e=>p(e)?e.toUpperCase():e,lower:e=>p(e)?e.toLowerCase():e,capitalize:e=>p(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),k=e.pluralRules||{},T=f(e.missing)?e.missing:null,b=!m(e.missingWarn)&&!r(e.missingWarn)||e.missingWarn,E=!m(e.fallbackWarn)&&!r(e.fallbackWarn)||e.fallbackWarn,N=!!e.fallbackFormat,g=!!e.unresolving,L=f(e.postTranslation)?e.postTranslation:null,y=h(e.processor)?e.processor:null,A=!m(e.warnHtmlMessage)||e.warnHtmlMessage,C=!!e.escapeParameter,O=f(e.messageCompiler)?e.messageCompiler:he,x=f(e.messageResolver)?e.messageResolver:Te||j,I=f(e.localeFallbacker)?e.localeFallbacker:be||ue,P=f(e.onWarn)?e.onWarn:c,v=e,F=d(v.__datetimeFormatters)?v.__datetimeFormatters:new Map,w=d(v.__numberFormatters)?v.__numberFormatters:new Map,R=d(v.__meta)?v.__meta:{};Ce++;const D={version:t,cid:Ce,locale:n,fallbackLocale:o,messages:a,modifiers:_,pluralRules:k,missing:T,missingWarn:b,fallbackWarn:E,fallbackFormat:N,unresolving:g,postTranslation:L,processor:y,warnHtmlMessage:A,escapeParameter:C,messageCompiler:O,messageResolver:x,localeFallbacker:I,onWarn:P,__meta:R};return D.datetimeFormats=u,D.numberFormats=l,D.__datetimeFormatters=F,D.__numberFormatters=w,D}function xe(e,t){return e instanceof RegExp?e.test(t):e}function Ie(e,t){return e instanceof RegExp?e.test(t):e}function Pe(e,t,n,r,o){const{missing:c}=e;if(null!==c){const r=c(e,n,t,o);return p(r)?r:t}return t}function ve(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)}const Fe=e=>e;let we=Object.create(null);function Re(){we=Object.create(null)}function De(e,t={}){{const n=(t.onCacheKey||Fe)(e),r=we[n];if(r)return r;let o=!1;const c=t.onError||E;t.onError=e=>{o=!0,c(e)};const{code:s}=D(e,t),a=new Function(`return ${s}`)();return o?a:we[n]=a}}let Se=T.__EXTEND_POINT__;const Me=()=>Se++,$e={INVALID_ARGUMENT:Se,INVALID_DATE_ARGUMENT:Me(),INVALID_ISO_DATE_ARGUMENT:Me(),__EXTEND_POINT__:Me()};function Ue(e){return b(e,null,void 0)}const We=()=>"",Ke=e=>f(e);function je(e,...t){const{fallbackFormat:r,postTranslation:o,unresolving:c,fallbackLocale:s,messages:u}=e,[l,_]=Ge(...t),k=(m(_.missingWarn),m(_.fallbackWarn),m(_.escapeParameter)?_.escapeParameter:e.escapeParameter),h=!!_.resolvedMessage,T=p(_.default)||m(_.default)?m(_.default)?l:_.default:r?l:"",b=r||""!==T,E=p(_.locale)?_.locale:e.locale;k&&function(e){i(e.list)?e.list=e.list.map((e=>p(e)?a(e):e)):d(e.named)&&Object.keys(e.named).forEach((t=>{p(e.named[t])&&(e.named[t]=a(e.named[t]))}))}(_);let[N,g,L]=h?[l,E,u[E]||{}]:function(e,t,n,r,o,c){const{messages:s,messageResolver:a,localeFallbacker:u}=e,l=u(e,r,n);let i,m={},d=null;const _="translate";for(let n=0;n<l.length&&(i=l[n],m=s[i]||{},null===(d=a(m,t))&&(d=m[t]),!p(d)&&!f(d));n++){const n=Pe(e,t,i,0,_);n!==t&&(d=n)}return[d,i,m]}(e,l,E,s),y=l;if(h||p(N)||Ke(N)||b&&(N=T,y=N),!(h||(p(N)||Ke(N))&&p(g)))return c?-1:l;let A=!1;const C=Ke(N)?N:Be(e,l,g,N,y,(()=>{A=!0}));if(A)return N;const O=function(e,t,n){return t(n)}(0,C,Q(function(e,t,r,o){const{modifiers:c,pluralRules:s,messageResolver:a}=e,u={locale:t,modifiers:c,pluralRules:s,messages:n=>{const o=a(r,n);if(p(o)){let r=!1;const c=Be(e,n,t,o,n,(()=>{r=!0}));return r?We:c}return Ke(o)?o:We}};e.processor&&(u.processor=e.processor);o.list&&(u.list=o.list);o.named&&(u.named=o.named);n(o.plural)&&(u.pluralIndex=o.plural);return u}(e,g,L,_)));return o?o(O):O}function Be(e,n,r,o,c,s){const{messageCompiler:a,warnHtmlMessage:u}=e;if(Ke(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||n,e}const l=a(o,function(e,n,r,o,c,s){return{warnHtmlMessage:c,onError:e=>{throw s&&s(e),e},onCacheKey:e=>((e,n,r)=>t({l:e,k:n,s:r}))(n,r,e)}}(0,r,c,0,u,s));return l.locale=r,l.key=n,l.source=o,l}function Ge(...e){const[t,r,c]=e,a={};if(!p(t)&&!n(t)&&!Ke(t))throw Error($e.INVALID_ARGUMENT);const u=n(t)?String(t):(Ke(t),t);return n(r)?a.plural=r:p(r)?a.default=r:h(r)&&!o(r)?a.named=r:i(r)&&(a.list=r),n(c)?a.plural=c:p(c)?a.default=c:h(c)&&s(a,c),[u,a]}function Ve(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:c,localeFallbacker:a}=e,{__datetimeFormatters:u}=e,[l,i,f,d]=He(...t);m(f.missingWarn);m(f.fallbackWarn);const _=!!f.part,k=p(f.locale)?f.locale:e.locale,T=a(e,c,k);if(!p(l)||""===l)return new Intl.DateTimeFormat(k).format(i);let b,E={},N=null;for(let t=0;t<T.length&&(b=T[t],E=n[b]||{},N=E[l],!h(N));t++)Pe(e,l,b,0,"datetime format");if(!h(N)||!p(b))return r?-1:l;let g=`${b}__${l}`;o(d)||(g=`${g}__${JSON.stringify(d)}`);let L=u.get(g);return L||(L=new Intl.DateTimeFormat(b,s({},N,d)),u.set(g,L)),_?L.formatToParts(i):L.format(i)}function He(...e){const[t,r,o,c]=e;let s,a={},u={};if(p(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error($e.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();s=new Date(n);try{s.toISOString()}catch(e){throw Error($e.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===k(t)){if(isNaN(t.getTime()))throw Error($e.INVALID_DATE_ARGUMENT);s=t}else{if(!n(t))throw Error($e.INVALID_ARGUMENT);s=t}return p(r)?a.key=r:h(r)&&(a=r),p(o)?a.locale=o:h(o)&&(u=o),h(c)&&(u=c),[a.key||"",s,a,u]}function Xe(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}}function Je(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:c,localeFallbacker:a}=e,{__numberFormatters:u}=e,[l,i,f,d]=ze(...t);m(f.missingWarn);m(f.fallbackWarn);const _=!!f.part,k=p(f.locale)?f.locale:e.locale,T=a(e,c,k);if(!p(l)||""===l)return new Intl.NumberFormat(k).format(i);let b,E={},N=null;for(let t=0;t<T.length&&(b=T[t],E=n[b]||{},N=E[l],!h(N));t++)Pe(e,l,b,0,"number format");if(!h(N)||!p(b))return r?-1:l;let g=`${b}__${l}`;o(d)||(g=`${g}__${JSON.stringify(d)}`);let L=u.get(g);return L||(L=new Intl.NumberFormat(b,s({},N,d)),u.set(g,L)),_?L.formatToParts(i):L.format(i)}function ze(...e){const[t,r,o,c]=e;let s={},a={};if(!n(t))throw Error($e.INVALID_ARGUMENT);const u=t;return p(r)?s.key=r:h(r)&&(s=r),p(o)?s.locale=o:h(o)&&(a=o),h(c)&&(a=c),[s.key||"",u,s,a]}function Ye(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}}export{T as CompileErrorCodes,$e as CoreErrorCodes,ce as CoreWarnCodes,_e as DEFAULT_LOCALE,X as DEFAULT_MESSAGE_DATA_TYPE,ke as MISSING_RESOLVE_VALUE,de as NOT_REOSLVED,me as VERSION,Re as clearCompileCache,Xe as clearDateTimeFormat,Ye as clearNumberFormat,De as compileToFunction,b as createCompileError,Oe as createCoreContext,Ue as createCoreError,Q as createMessageContext,Ve as datetime,le as fallbackWithLocaleChain,ue as fallbackWithSimple,Ae as getAdditionalMeta,te as getDevToolsHook,ae as getWarnMessage,G as handleFlatJson,Pe as handleMissing,ne as initI18nDevTools,Ke as isMessageFunction,xe as isTranslateFallbackWarn,Ie as isTranslateMissingWarn,Je as number,W as parse,He as parseDateTimeArgs,ze as parseNumberArgs,Ge as parseTranslateArgs,ge as registerLocaleFallbacker,Ee as registerMessageCompiler,Ne as registerMessageResolver,B as resolveValue,j as resolveWithKeyValue,ye as setAdditionalMeta,ee as setDevToolsHook,je as translate,re as translateDevTools,ve as updateFallbackLocale};
/*!
* @intlify/core-base v9.2.0-alpha.6
* core-base v9.2.0-alpha.7
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
import { format, isString, isArray, isPlainObject, assign, isFunction, isBoolean, isRegExp, warn, isObject, escapeHtml, inBrowser, mark, measure, generateCodeFrame, generateFormatCacheKey, isNumber, isEmptyObject, isDate, getGlobalThis } from '@intlify/shared';
import { resolveValue } from '@intlify/message-resolver';
export * from '@intlify/message-resolver';
import { createMessageContext } from '@intlify/runtime';
export * from '@intlify/runtime';
import { isObject, hasOwn, isNumber, isString, isFunction, isPlainObject, toDisplayString, format, isArray, isBoolean, assign, isRegExp, warn, escapeHtml, inBrowser, mark, measure, generateCodeFrame, generateFormatCacheKey, isEmptyObject, isDate, getGlobalThis } from '@intlify/shared';
import { defaultOnError, baseCompile, CompileErrorCodes, createCompileError } from '@intlify/message-compiler';

@@ -15,2 +11,413 @@ export { CompileErrorCodes, createCompileError } from '@intlify/message-compiler';

const pathStateMachine = [];
pathStateMachine[0 /* BEFORE_PATH */] = {
["w" /* WORKSPACE */]: [0 /* BEFORE_PATH */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[1 /* IN_PATH */] = {
["w" /* WORKSPACE */]: [1 /* IN_PATH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[2 /* BEFORE_IDENT */] = {
["w" /* WORKSPACE */]: [2 /* BEFORE_IDENT */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */]
};
pathStateMachine[3 /* IN_IDENT */] = {
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["w" /* WORKSPACE */]: [1 /* IN_PATH */, 1 /* PUSH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */, 1 /* PUSH */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */, 1 /* PUSH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */, 1 /* PUSH */]
};
pathStateMachine[4 /* IN_SUB_PATH */] = {
["'" /* SINGLE_QUOTE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */],
["\"" /* DOUBLE_QUOTE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [
4 /* IN_SUB_PATH */,
2 /* INC_SUB_PATH_DEPTH */
],
["]" /* RIGHT_BRACKET */]: [1 /* IN_PATH */, 3 /* PUSH_SUB_PATH */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */]
};
pathStateMachine[5 /* IN_SINGLE_QUOTE */] = {
["'" /* SINGLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */]
};
pathStateMachine[6 /* IN_DOUBLE_QUOTE */] = {
["\"" /* DOUBLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */]
};
/**
* Check if an expression is a literal value.
*/
const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
function isLiteral(exp) {
return literalValueRE.test(exp);
}
/**
* Strip quotes from a string
*/
function stripQuotes(str) {
const a = str.charCodeAt(0);
const b = str.charCodeAt(str.length - 1);
return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;
}
/**
* Determine the type of a character in a keypath.
*/
function getPathCharType(ch) {
if (ch === undefined || ch === null) {
return "o" /* END_OF_FAIL */;
}
const code = ch.charCodeAt(0);
switch (code) {
case 0x5b: // [
case 0x5d: // ]
case 0x2e: // .
case 0x22: // "
case 0x27: // '
return ch;
case 0x5f: // _
case 0x24: // $
case 0x2d: // -
return "i" /* IDENT */;
case 0x09: // Tab (HT)
case 0x0a: // Newline (LF)
case 0x0d: // Return (CR)
case 0xa0: // No-break space (NBSP)
case 0xfeff: // Byte Order Mark (BOM)
case 0x2028: // Line Separator (LS)
case 0x2029: // Paragraph Separator (PS)
return "w" /* WORKSPACE */;
}
return "i" /* IDENT */;
}
/**
* Format a subPath, return its plain form if it is
* a literal string or number. Otherwise prepend the
* dynamic indicator (*).
*/
function formatSubPath(path) {
const trimmed = path.trim();
// invalid leading 0
if (path.charAt(0) === '0' && isNaN(parseInt(path))) {
return false;
}
return isLiteral(trimmed)
? stripQuotes(trimmed)
: "*" /* ASTARISK */ + trimmed;
}
/**
* Parse a string path into an array of segments
*/
function parse(path) {
const keys = [];
let index = -1;
let mode = 0 /* BEFORE_PATH */;
let subPathDepth = 0;
let c;
let key; // eslint-disable-line
let newChar;
let type;
let transition;
let action;
let typeMap;
const actions = [];
actions[0 /* APPEND */] = () => {
if (key === undefined) {
key = newChar;
}
else {
key += newChar;
}
};
actions[1 /* PUSH */] = () => {
if (key !== undefined) {
keys.push(key);
key = undefined;
}
};
actions[2 /* INC_SUB_PATH_DEPTH */] = () => {
actions[0 /* APPEND */]();
subPathDepth++;
};
actions[3 /* PUSH_SUB_PATH */] = () => {
if (subPathDepth > 0) {
subPathDepth--;
mode = 4 /* IN_SUB_PATH */;
actions[0 /* APPEND */]();
}
else {
subPathDepth = 0;
if (key === undefined) {
return false;
}
key = formatSubPath(key);
if (key === false) {
return false;
}
else {
actions[1 /* PUSH */]();
}
}
};
function maybeUnescapeQuote() {
const nextChar = path[index + 1];
if ((mode === 5 /* IN_SINGLE_QUOTE */ &&
nextChar === "'" /* SINGLE_QUOTE */) ||
(mode === 6 /* IN_DOUBLE_QUOTE */ &&
nextChar === "\"" /* DOUBLE_QUOTE */)) {
index++;
newChar = '\\' + nextChar;
actions[0 /* APPEND */]();
return true;
}
}
while (mode !== null) {
index++;
c = path[index];
if (c === '\\' && maybeUnescapeQuote()) {
continue;
}
type = getPathCharType(c);
typeMap = pathStateMachine[mode];
transition = typeMap[type] || typeMap["l" /* ELSE */] || 8 /* ERROR */;
// check parse error
if (transition === 8 /* ERROR */) {
return;
}
mode = transition[0];
if (transition[1] !== undefined) {
action = actions[transition[1]];
if (action) {
newChar = c;
if (action() === false) {
return;
}
}
}
// check parse finish
if (mode === 7 /* AFTER_PATH */) {
return keys;
}
}
}
// path token cache
const cache = new Map();
/**
* key-value message resolver
*
* @remarks
* Resolves messages with the key-value structure. Note that messages with a hierarchical structure such as objects cannot be resolved
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
function resolveWithKeyValue(obj, path) {
return isObject(obj) ? obj[path] : null;
}
/**
* message resolver
*
* @remarks
* Resolves messages. messages with a hierarchical structure such as objects can be resolved. This resolver is used in VueI18n as default.
*
* @param obj - A target object to be resolved with path
* @param path - A {@link Path | path} to resolve the value of message
*
* @returns A resolved {@link PathValue | path value}
*
* @VueI18nGeneral
*/
function resolveValue(obj, path) {
// check object
if (!isObject(obj)) {
return null;
}
// parse path
let hit = cache.get(path);
if (!hit) {
hit = parse(path);
if (hit) {
cache.set(path, hit);
}
}
// check hit
if (!hit) {
return null;
}
// resolve path value
const len = hit.length;
let last = obj;
let i = 0;
while (i < len) {
const val = last[hit[i]];
if (val === undefined) {
return null;
}
last = val;
i++;
}
return last;
}
/**
* Transform flat json in obj to normal json in obj
*/
function handleFlatJson(obj) {
// check obj
if (!isObject(obj)) {
return obj;
}
for (const key in obj) {
// check key
if (!hasOwn(obj, key)) {
continue;
}
// handle for normal json
if (!key.includes("." /* DOT */)) {
// recursive process value if value is also a object
if (isObject(obj[key])) {
handleFlatJson(obj[key]);
}
}
// handle for flat json, transform to normal json
else {
// go to the last object
const subKeys = key.split("." /* DOT */);
const lastIndex = subKeys.length - 1;
let currentObj = obj;
for (let i = 0; i < lastIndex; i++) {
if (!(subKeys[i] in currentObj)) {
currentObj[subKeys[i]] = {};
}
currentObj = currentObj[subKeys[i]];
}
// update last object value, delete old property
currentObj[subKeys[lastIndex]] = obj[key];
delete obj[key];
// recursive process value if value is also a object
if (isObject(currentObj[subKeys[lastIndex]])) {
handleFlatJson(currentObj[subKeys[lastIndex]]);
}
}
}
return obj;
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line
const DEFAULT_MESSAGE_DATA_TYPE = 'text';
const DEFAULT_NORMALIZE = (values) => values.length === 0 ? '' : values.join('');
const DEFAULT_INTERPOLATE = toDisplayString;
function pluralDefault(choice, choicesLength) {
choice = Math.abs(choice);
if (choicesLength === 2) {
// prettier-ignore
return choice
? choice > 1
? 1
: 0
: 1;
}
return choice ? Math.min(choice, 2) : 0;
}
function getPluralIndex(options) {
// prettier-ignore
const index = isNumber(options.pluralIndex)
? options.pluralIndex
: -1;
// prettier-ignore
return options.named && (isNumber(options.named.count) || isNumber(options.named.n))
? isNumber(options.named.count)
? options.named.count
: isNumber(options.named.n)
? options.named.n
: index
: index;
}
function normalizeNamed(pluralIndex, props) {
if (!props.count) {
props.count = pluralIndex;
}
if (!props.n) {
props.n = pluralIndex;
}
}
function createMessageContext(options = {}) {
const locale = options.locale;
const pluralIndex = getPluralIndex(options);
const pluralRule = isObject(options.pluralRules) &&
isString(locale) &&
isFunction(options.pluralRules[locale])
? options.pluralRules[locale]
: pluralDefault;
const orgPluralRule = isObject(options.pluralRules) &&
isString(locale) &&
isFunction(options.pluralRules[locale])
? pluralDefault
: undefined;
const plural = (messages) => messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
const _list = options.list || [];
const list = (index) => _list[index];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _named = options.named || {};
isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named);
const named = (key) => _named[key];
// TODO: need to design resolve message function?
function message(key) {
// prettier-ignore
const msg = isFunction(options.messages)
? options.messages(key)
: isObject(options.messages)
? options.messages[key]
: false;
return !msg
? options.parent
? options.parent.message(key) // resolve from parent messages
: DEFAULT_MESSAGE
: msg;
}
const _modifier = (name) => options.modifiers
? options.modifiers[name]
: DEFAULT_MODIFIER;
const normalize = isPlainObject(options.processor) && isFunction(options.processor.normalize)
? options.processor.normalize
: DEFAULT_NORMALIZE;
const interpolate = isPlainObject(options.processor) &&
isFunction(options.processor.interpolate)
? options.processor.interpolate
: DEFAULT_INTERPOLATE;
const type = isPlainObject(options.processor) && isString(options.processor.type)
? options.processor.type
: DEFAULT_MESSAGE_DATA_TYPE;
const ctx = {
["list" /* LIST */]: list,
["named" /* NAMED */]: named,
["plural" /* PLURAL */]: plural,
["linked" /* LINKED */]: (key, modifier) => {
// TODO: should check `key`
const msg = message(key)(ctx);
return isString(modifier) ? _modifier(modifier)(msg) : msg;
},
["message" /* MESSAGE */]: message,
["type" /* TYPE */]: type,
["interpolate" /* INTERPOLATE */]: interpolate,
["normalize" /* NORMALIZE */]: normalize
};
return ctx;
}
let devtools = null;

@@ -60,2 +467,118 @@ function setDevToolsHook(hook) {

/**
* Fallback with simple implemenation
*
* @remarks
* A fallback locale function implemented with a simple fallback algorithm.
*
* Basically, it returns the value as specified in the `fallbackLocale` props, and is processed with the fallback inside intlify.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nGeneral
*/
function fallbackWithSimple(ctx, fallback, start // eslint-disable-line @typescript-eslint/no-unused-vars
) {
// prettier-ignore
return [...new Set([
start,
...(isArray(fallback)
? fallback
: isObject(fallback)
? Object.keys(fallback)
: isString(fallback)
? [fallback]
: [start])
])];
}
/**
* Fallback with locale chain
*
* @remarks
* A fallback locale function implemented with a fallback chain algorithm. It's used in VueI18n as default.
*
* @param ctx - A {@link CoreContext | context}
* @param fallback - A {@link FallbackLocale | fallback locale}
* @param start - A starting {@link Locale | locale}
*
* @returns Fallback locales
*
* @VueI18nSee [Fallbacking](../guide/essentials/fallback)
*
* @VueI18nGeneral
*/
function fallbackWithLocaleChain(ctx, fallback, start) {
const startLocale = isString(start) ? start : DEFAULT_LOCALE;
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(startLocale);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback) || !isPlainObject(fallback)
? fallback
: fallback['default']
? fallback['default']
: null;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(startLocale, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/* eslint-disable @typescript-eslint/no-explicit-any */

@@ -66,4 +589,5 @@ /**

*/
const VERSION = '9.2.0-alpha.6';
const VERSION = '9.2.0-alpha.7';
const NOT_REOSLVED = -1;
const DEFAULT_LOCALE = 'en-US';
const MISSING_RESOLVE_VALUE = '';

@@ -84,8 +608,30 @@ function getDefaultLinkedModifiers() {

}
let _resolver;
/**
* Register the message resolver
*
* @param resolver - A {@link MessageResolver} function
*
* @VueI18nGeneral
*/
function registerMessageResolver(resolver) {
_resolver = resolver;
}
let _fallbacker;
/**
* Register the locale fallbacker
*
* @param fallbacker - A {@link LocaleFallbacker} function
*
* @VueI18nGeneral
*/
function registerLocaleFallbacker(fallbacker) {
_fallbacker = fallbacker;
}
// Additional Meta for Intlify DevTools
let _additionalMeta = null;
const setAdditionalMeta = /* #__PURE__*/ (meta) => {
const setAdditionalMeta = (meta) => {
_additionalMeta = meta;
};
const getAdditionalMeta = /* #__PURE__*/ () => _additionalMeta;
const getAdditionalMeta = () => _additionalMeta;
// ID for CoreContext

@@ -96,3 +642,3 @@ let _cid = 0;

const version = isString(options.version) ? options.version : VERSION;
const locale = isString(options.locale) ? options.locale : 'en-US';
const locale = isString(options.locale) ? options.locale : DEFAULT_LOCALE;
const fallbackLocale = isArray(options.fallbackLocale) ||

@@ -108,7 +654,9 @@ isPlainObject(options.fallbackLocale) ||

const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
? options.datetimeFormats
: { [locale]: {} }
;
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
? options.numberFormats
: { [locale]: {} }
;
const modifiers = assign({}, options.modifiers || {}, getDefaultLinkedModifiers());

@@ -138,3 +686,6 @@ const pluralRules = options.pluralRules || {};

? options.messageResolver
: resolveValue;
: _resolver || resolveWithKeyValue;
const localeFallbacker = isFunction(options.localeFallbacker)
? options.localeFallbacker
: _fallbacker || fallbackWithSimple;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;

@@ -144,7 +695,9 @@ // setup internal options

const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
? internalOptions.__datetimeFormatters
: new Map()
;
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
? internalOptions.__numberFormatters
: new Map()
;
const __meta = isObject(internalOptions.__meta) ? internalOptions.__meta : {};

@@ -158,4 +711,2 @@ _cid++;

messages,
datetimeFormats,
numberFormats,
modifiers,

@@ -174,7 +725,12 @@ pluralRules,

messageResolver,
localeFallbacker,
onWarn,
__datetimeFormatters,
__numberFormatters,
__meta
};
{
context.datetimeFormats = datetimeFormats;
context.numberFormats = numberFormats;
context.__datetimeFormatters = __datetimeFormatters;
context.__numberFormatters = __numberFormatters;
}
// for vue-devtools timeline event

@@ -228,75 +784,6 @@ if ((process.env.NODE_ENV !== 'production')) {

/** @internal */
function getLocaleChain(ctx, fallback, start) {
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback) || !isPlainObject(fallback)
? fallback
: fallback['default']
? fallback['default']
: null;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
ctx.localeFallbacker(ctx, fallback, locale);
}

@@ -347,7 +834,9 @@ /* eslint-enable @typescript-eslint/no-explicit-any */

let code = CompileErrorCodes.__EXTEND_POINT__;
const inc = () => code++;
const CoreErrorCodes = {
INVALID_ARGUMENT: CompileErrorCodes.__EXTEND_POINT__,
INVALID_DATE_ARGUMENT: CompileErrorCodes.__EXTEND_POINT__ + 1,
INVALID_ISO_DATE_ARGUMENT: CompileErrorCodes.__EXTEND_POINT__ + 2,
__EXTEND_POINT__: CompileErrorCodes.__EXTEND_POINT__ + 3
INVALID_ARGUMENT: code,
INVALID_DATE_ARGUMENT: inc(),
INVALID_ISO_DATE_ARGUMENT: inc(),
__EXTEND_POINT__: inc() // 18
};

@@ -481,4 +970,4 @@ function createCoreError(code) {

function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn, messageResolver: resolveValue } = context;
const locales = getLocaleChain(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
const { messages, onWarn, messageResolver: resolveValue, localeFallbacker } = context;
const locales = localeFallbacker(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any
let message = {};

@@ -745,3 +1234,3 @@ let targetLocale;

function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __datetimeFormatters } = context;

@@ -761,3 +1250,3 @@ if ((process.env.NODE_ENV !== 'production') && !Availabilities.dateTimeFormat) {

const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, // eslint-disable-line @typescript-eslint/no-explicit-any
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale, locale);

@@ -892,3 +1381,3 @@ if (!isString(key) || key === '') {

function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __numberFormatters } = context;

@@ -908,3 +1397,3 @@ if ((process.env.NODE_ENV !== 'production') && !Availabilities.numberFormat) {

const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, // eslint-disable-line @typescript-eslint/no-explicit-any
const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale, locale);

@@ -1011,2 +1500,2 @@ if (!isString(key) || key === '') {

export { CoreErrorCodes, CoreWarnCodes, MISSING_RESOLVE_VALUE, NOT_REOSLVED, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCoreContext, createCoreError, datetime, getAdditionalMeta, getDevToolsHook, getLocaleChain, getWarnMessage, handleMissing, initI18nDevTools, isMessageFunction, isTranslateFallbackWarn, isTranslateMissingWarn, number, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerMessageCompiler, setAdditionalMeta, setDevToolsHook, translate, translateDevTools, updateFallbackLocale };
export { CoreErrorCodes, CoreWarnCodes, DEFAULT_LOCALE, DEFAULT_MESSAGE_DATA_TYPE, MISSING_RESOLVE_VALUE, NOT_REOSLVED, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCoreContext, createCoreError, createMessageContext, datetime, fallbackWithLocaleChain, fallbackWithSimple, getAdditionalMeta, getDevToolsHook, getWarnMessage, handleFlatJson, handleMissing, initI18nDevTools, isMessageFunction, isTranslateFallbackWarn, isTranslateMissingWarn, number, parse, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerLocaleFallbacker, registerMessageCompiler, registerMessageResolver, resolveValue, resolveWithKeyValue, setAdditionalMeta, setDevToolsHook, translate, translateDevTools, updateFallbackLocale };
/*!
* @intlify/core-base v9.2.0-alpha.6
* core-base v9.2.0-alpha.7
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
var IntlifyCoreBase=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),o=e=>"[object RegExp]"===k(e),s=e=>T(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const a=Object.assign;function u(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const l=Object.prototype.hasOwnProperty;function i(e,t){return l.call(e,t)}const f=Array.isArray,p=e=>"function"==typeof e,m=e=>"string"==typeof e,d=e=>"boolean"==typeof e,_=e=>null!==e&&"object"==typeof e,h=Object.prototype.toString,k=e=>h.call(e),T=e=>"[object Object]"===k(e),E=[];E[0]={w:[0],i:[3,0],"[":[4],o:[7]},E[1]={w:[1],".":[2],"[":[4],o:[7]},E[2]={w:[2],i:[3,0],0:[3,0]},E[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},E[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},E[5]={"'":[4,0],o:8,l:[5,0]},E[6]={'"':[4,0],o:8,l:[6,0]};const g=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function N(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 L(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(g.test(t)?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)}function b(e){const t=[];let n,r,o,s,c,a,u,l=-1,i=0,f=0;const p=[];function m(){const t=e[l+1];if(5===i&&"'"===t||6===i&&'"'===t)return l++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=L(r),!1===r)return!1;p[1]()}};null!==i;)if(l++,n=e[l],"\\"!==n||!m()){if(s=N(n),u=E[i],c=u[s]||u.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(a=p[c[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const A=new Map;function C(e,t){if(!_(e))return null;let n=A.get(t);if(n||(n=b(t),n&&A.set(t,n)),!n)return null;const r=n.length;let o=e,s=0;for(;s<r;){const e=o[n[s]];if(void 0===e)return null;o=e,s++}return o}const y=e=>e,O=e=>"",I="text",P=e=>0===e.length?"":e.join(""),x=e=>null==e?"":f(e)||T(e)&&e.toString===h?JSON.stringify(e,null,2):String(e);function v(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function F(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),o=_(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?e.pluralRules[t]:v,s=_(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?v:void 0,c=e.list||[],a=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,a);function u(t){const n=p(e.messages)?e.messages(t):!!_(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):O)}const l=T(e.processor)&&p(e.processor.normalize)?e.processor.normalize:P,i=T(e.processor)&&p(e.processor.interpolate)?e.processor.interpolate:x,f={list:e=>c[e],named:e=>a[e],plural:e=>e[o(n,e.length,s)],linked:(t,n)=>{const r=u(t)(f);return m(n)?(o=n,e.modifiers?e.modifiers[o]:y)(r):r;var o},message:u,type:T(e.processor)&&m(e.processor.type)?e.processor.type:I,interpolate:i,normalize:l};return f}const D={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function w(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function M(e){throw e}function R(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const S=" ",$="\n",U=String.fromCharCode(8232),W=String.fromCharCode(8233);function V(e){const t=e;let n=0,r=1,o=1,s=0;const c=e=>"\r"===t[e]&&t[e+1]===$,a=e=>t[e]===W,u=e=>t[e]===U,l=e=>c(e)||(e=>t[e]===$)(e)||a(e)||u(e),i=e=>c(e)||a(e)||u(e)?$:t[e];function f(){return s=0,l(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>s,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+s),next:f,peek:function(){return c(n+s)&&s++,s++,t[n+s]},reset:function(){n=0,r=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=n+s;for(;e!==n;)f();s=0}}}const K=void 0;function j(e,t={}){const n=!1!==t.location,r=V(e),o=()=>r.index(),s=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=s(),a=o(),u={currentType:14,offset:a,startLoc:c,endLoc:c,lastType:14,lastOffset:a,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},l=()=>u,{onError:i}=t;function f(e,t,r){e.endLoc=s(),e.currentType=t;const o={type:t};return n&&(o.loc=R(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(s(),"")}function d(e){let t="";for(;e.currentPeek()===S||e.currentPeek()===$;)t+=e.currentPeek(),e.peek();return t}function _(e){const t=d(e);return e.skipToPeek(),t}function h(e){if(e===K)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function k(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===K)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function T(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function E(e,t=!0){const n=(t=!1,r="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==r&&t:"@"!==s&&s?"%"===s?(e.peek(),n(t,"%",!0)):"|"===s?!("%"!==r&&!o)||!(r===S||r===$):s===S?(e.peek(),n(!0,S,o)):s!==$||(e.peek(),n(!0,$,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function g(e,t){const n=e.currentChar();return n===K?K:t(n)?(e.next(),n):null}function N(e){return g(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function L(e){return g(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function b(e){return g(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function A(e){let t="",n="";for(;t=L(e);)n+=t;return n}function C(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return y(e,t,4);case"U":return y(e,t,6);default:return s(),""}}function y(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=b(e);if(!t){s(),e.currentChar();break}r+=t}return`\\${t}${r}`}function O(e){_(e);const t=m(e,"|");return _(e),t}function I(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&s(),e.next(),n=f(t,2,"{"),_(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&s(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&s(),n=P(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,c=!0;if(T(e))return t.braceNest>0&&s(),n=f(t,1,O(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return s(),t.braceNest=0,x(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=h(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){_(e);let t="",n="";for(;t=N(e);)n+=t;return e.currentChar()===K&&s(),n}(e)),_(e),n;if(o=k(e,t))return n=f(t,6,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${A(e)}`):t+=A(e),e.currentChar()===K&&s(),t}(e)),_(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){_(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&e!==$;for(;t=g(e,r);)n+="\\"===t?C(e):t;const o=e.currentChar();return o===$||o===K?(s(),o===$&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),_(e),n;if(!r&&!o&&!c)return n=f(t,13,function(e){_(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==S&&e!==$;for(;t=g(e,r);)n+=t;return n}(e)),s(),_(e),n}return n}function P(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==$&&o!==S||s(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return _(e),e.next(),f(t,9,".");case":":return _(e),e.next(),f(t,10,":");default:return T(e)?(r=f(t,1,O(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(_(e),P(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=h(e.currentPeek());return e.resetPeek(),r}(e,t)?(_(e),f(t,12,function(e){let t="",n="";for(;t=N(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?h(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===S||!t)&&(t===$?(e.peek(),r()):h(t))},o=r();return e.resetPeek(),o}(e,t)?(_(e),"{"===o?I(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===S?r:o===$?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&s(),t.braceNest=0,t.inLinked=!1,x(e,t))}}function x(e,t){let n={type:14};if(t.braceNest>0)return I(e,t)||p(t);if(t.inLinked)return P(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return I(e,t)||p(t);case"}":return s(),e.next(),f(t,3,"}");case"@":return P(e,t)||p(t);default:if(T(e))return n=f(t,1,O(e)),t.braceNest=0,t.inLinked=!1,n;if(E(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?E(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:r===S||r===$?E(e)?(n+=r,e.next(),t(n)):T(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=u;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=c,u.offset=o(),u.startLoc=s(),r.currentChar()===K?f(u,14):x(r,u)},currentOffset:o,currentPosition:s,context:l}}const G=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function B(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function H(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function s(e,t){const n=e.context(),s=r(3,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function c(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(5,s,c);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(4,s,c);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(9,s,c);return a.value=t.replace(G,B),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let s=e.nextToken();if(9===s.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(8,s,c);return 12!==t.type?(a.value="",o(a,s,c),{nextConsumeToken:t,node:a}):(null==t.value&&X(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(10!==s.type&&X(s),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:null==s.value&&X(s),n.key=function(e,t){const n=e.context(),s=r(7,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:null==s.value&&X(s),n.key=u(e,s.value||"");break;case 6:null==s.value&&X(s),n.key=c(e,s.value||"");break;case 7:null==s.value&&X(s),n.key=l(e,s.value||"");break;default:const t=e.context(),a=r(7,t.offset,t.startLoc);return a.value="",o(a,t.offset,t.startLoc),n.key=a,o(n,t.offset,t.startLoc),{nextConsumeToken:s,node:n}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let a=null;do{const t=a||e.nextToken();switch(a=null,t.type){case 0:null==t.value&&X(t),n.items.push(s(e,t.value||""));break;case 6:null==t.value&&X(t),n.items.push(c(e,t.value||""));break;case 5:null==t.value&&X(t),n.items.push(u(e,t.value||""));break;case 7:null==t.value&&X(t),n.items.push(l(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),a=r.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function p(e){const t=e.context(),{offset:n,startLoc:s}=t,c=f(e);return 14===t.currentType?c:function(e,t,n,s){const c=e.context();let a=0===s.items.length;const u=r(1,t,n);u.cases=[],u.cases.push(s);do{const t=f(e);a||(a=0===t.items.length),u.cases.push(t)}while(14!==c.currentType);return o(u,e.currentOffset(),e.currentPosition()),u}(e,n,s,c)}return{parse:function(n){const s=j(n,a({},e)),c=s.context(),u=r(0,c.offset,c.startLoc);return t&&u.loc&&(u.loc.source=n),u.body=p(s),o(u,s.currentOffset(),s.currentPosition()),u}}}function X(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function J(e,t){for(let n=0;n<e.length;n++)Y(e[n],t)}function Y(e,t){switch(e.type){case 1:J(e.cases,t),t.helper("plural");break;case 2:J(e.items,t);break;case 6:Y(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function z(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&Y(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function Q(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?Q(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(Q(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let n=0;n<o&&(Q(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),Q(e,t.key),t.modifier&&(e.push(", "),Q(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function q(e,t={}){const n=a({},t),r=H(n).parse(e);return z(r,n),((e,t={})=>{const n=m(t.mode)?t.mode:"normal",r=m(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,s=e.helpers||[],c=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,s={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function c(e,t){s.code+=e}function a(e,t=!0){const n=t?r:"";c(o?n+" ".repeat(e):n)}return{context:()=>s,push:c,indent:function(e=!0){const t=++s.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&a(t)},newline:function(){a(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});c.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(o),s.length>0&&(c.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),Q(c,e),c.deindent(o),c.push("}");const{code:a,map:u}=c.context();return{ast:e,code:a,map:u?u.toJSON():void 0}})(r,n)}const Z="i18n:init";let ee=null;const te=ne("function:translate");function ne(e){return t=>ee&&ee.emit(e,t)}const re={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},oe={[re.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[re.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[re.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[re.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[re.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[re.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};const se="9.2.0-alpha.6";let ce;let ae=null;let ue=0;function le(e,t,n,r,o){const{missing:s}=e;if(null!==s){const r=s(e,n,t,o);return m(r)?r:t}return t}function ie(e,t,n){const r=e;r.__localeChainCache||(r.__localeChainCache=new Map);let o=r.__localeChainCache.get(n);if(!o){o=[];let e=[n];for(;f(e);)e=fe(o,e,t);const s=f(t)||!T(t)?t:t.default?t.default:null;e=m(s)?[s]:s,f(e)&&fe(o,e,!1),r.__localeChainCache.set(n,o)}return o}function fe(e,t,n){let r=!0;for(let o=0;o<t.length&&d(r);o++){m(t[o])&&(r=pe(e,t[o],n))}return r}function pe(e,t,n){let r;const o=t.split("-");do{r=me(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function me(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(f(n)||T(n))&&n[o]&&(r=n[o])}return r}const de=e=>e;let _e=Object.create(null);const he={INVALID_ARGUMENT:D.__EXTEND_POINT__,INVALID_DATE_ARGUMENT:D.__EXTEND_POINT__+1,INVALID_ISO_DATE_ARGUMENT:D.__EXTEND_POINT__+2,__EXTEND_POINT__:D.__EXTEND_POINT__+3};const ke=()=>"",Te=e=>p(e);function Ee(e,t,r,o,s,c){const{messageCompiler:a,warnHtmlMessage:u}=e;if(Te(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}const l=a(o,function(e,t,r,o,s,c){return{warnHtmlMessage:s,onError:e=>{throw c&&c(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,s,0,u,c));return l.locale=r,l.key=t,l.source=o,l}function ge(...e){const[t,n,o]=e,c={};if(!m(t)&&!r(t)&&!Te(t))throw Error(he.INVALID_ARGUMENT);const u=r(t)?String(t):(Te(t),t);return r(n)?c.plural=n:m(n)?c.default=n:T(n)&&!s(n)?c.named=n:f(n)&&(c.list=n),r(o)?c.plural=o:m(o)?c.default=o:T(o)&&a(c,o),[u,c]}function Ne(...e){const[t,n,o,s]=e;let c,a={},u={};if(m(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(he.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();c=new Date(n);try{c.toISOString()}catch(e){throw Error(he.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===k(t)){if(isNaN(t.getTime()))throw Error(he.INVALID_DATE_ARGUMENT);c=t}else{if(!r(t))throw Error(he.INVALID_ARGUMENT);c=t}return m(n)?a.key=n:T(n)&&(a=n),m(o)?a.locale=o:T(o)&&(u=o),T(s)&&(u=s),[a.key||"",c,a,u]}function Le(...e){const[t,n,o,s]=e;let c={},a={};if(!r(t))throw Error(he.INVALID_ARGUMENT);const u=t;return m(n)?c.key=n:T(n)&&(c=n),m(o)?c.locale=o:T(o)&&(a=o),T(s)&&(a=s),[c.key||"",u,c,a]}return e.CompileErrorCodes=D,e.CoreErrorCodes=he,e.CoreWarnCodes=re,e.DEFAULT_MESSAGE_DATA_TYPE=I,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=se,e.clearCompileCache=function(){_e=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){{const n=(t.onCacheKey||de)(e),r=_e[n];if(r)return r;let o=!1;const s=t.onError||M;t.onError=e=>{o=!0,s(e)};const{code:c}=q(e,t),a=new Function(`return ${c}`)();return o?a:_e[n]=a}},e.createCompileError=w,e.createCoreContext=function(e={}){const t=m(e.version)?e.version:se,n=m(e.locale)?e.locale:"en-US",r=f(e.fallbackLocale)||T(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=T(e.messages)?e.messages:{[n]:{}},u=T(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},l=T(e.numberFormats)?e.numberFormats:{[n]:{}},i=a({},e.modifiers||{},{upper:e=>m(e)?e.toUpperCase():e,lower:e=>m(e)?e.toLowerCase():e,capitalize:e=>m(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),h=e.pluralRules||{},k=p(e.missing)?e.missing:null,E=!d(e.missingWarn)&&!o(e.missingWarn)||e.missingWarn,g=!d(e.fallbackWarn)&&!o(e.fallbackWarn)||e.fallbackWarn,N=!!e.fallbackFormat,L=!!e.unresolving,b=p(e.postTranslation)?e.postTranslation:null,A=T(e.processor)?e.processor:null,y=!d(e.warnHtmlMessage)||e.warnHtmlMessage,O=!!e.escapeParameter,I=p(e.messageCompiler)?e.messageCompiler:ce,P=p(e.messageResolver)?e.messageResolver:C,x=p(e.onWarn)?e.onWarn:c,v=e,F=_(v.__datetimeFormatters)?v.__datetimeFormatters:new Map,D=_(v.__numberFormatters)?v.__numberFormatters:new Map,w=_(v.__meta)?v.__meta:{};return ue++,{version:t,cid:ue,locale:n,fallbackLocale:r,messages:s,datetimeFormats:u,numberFormats:l,modifiers:i,pluralRules:h,missing:k,missingWarn:E,fallbackWarn:g,fallbackFormat:N,unresolving:L,postTranslation:b,processor:A,warnHtmlMessage:y,escapeParameter:O,messageCompiler:I,messageResolver:P,onWarn:x,__datetimeFormatters:F,__numberFormatters:D,__meta:w}},e.createCoreError=function(e){return w(e,null,void 0)},e.createMessageContext=F,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o}=e,{__datetimeFormatters:c}=e,[u,l,i,f]=Ne(...t);d(i.missingWarn),d(i.fallbackWarn);const p=!!i.part,_=m(i.locale)?i.locale:e.locale,h=ie(e,o,_);if(!m(u)||""===u)return new Intl.DateTimeFormat(_).format(l);let k,E={},g=null;for(let t=0;t<h.length&&(k=h[t],E=n[k]||{},g=E[u],!T(g));t++)le(e,u,k,0,"datetime format");if(!T(g)||!m(k))return r?-1:u;let N=`${k}__${u}`;s(f)||(N=`${N}__${JSON.stringify(f)}`);let L=c.get(N);return L||(L=new Intl.DateTimeFormat(k,a({},g,f)),c.set(N,L)),p?L.formatToParts(l):L.format(l)},e.getAdditionalMeta=()=>ae,e.getDevToolsHook=function(){return ee},e.getLocaleChain=ie,e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&_(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(oe[e],...n)},e.handleFlatJson=function e(t){if(!_(t))return t;for(const n in t)if(i(t,n))if(n.includes(".")){const r=n.split("."),o=r.length-1;let s=t;for(let e=0;e<o;e++)r[e]in s||(s[r[e]]={}),s=s[r[e]];s[r[o]]=t[n],delete t[n],_(s[r[o]])&&e(s[r[o]])}else _(t[n])&&e(t[n]);return t},e.handleMissing=le,e.initI18nDevTools=function(e,t,n){ee&&ee.emit(Z,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=Te,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o}=e,{__numberFormatters:c}=e,[u,l,i,f]=Le(...t);d(i.missingWarn),d(i.fallbackWarn);const p=!!i.part,_=m(i.locale)?i.locale:e.locale,h=ie(e,o,_);if(!m(u)||""===u)return new Intl.NumberFormat(_).format(l);let k,E={},g=null;for(let t=0;t<h.length&&(k=h[t],E=n[k]||{},g=E[u],!T(g));t++)le(e,u,k,0,"number format");if(!T(g)||!m(k))return r?-1:u;let N=`${k}__${u}`;s(f)||(N=`${N}__${JSON.stringify(f)}`);let L=c.get(N);return L||(L=new Intl.NumberFormat(k,a({},g,f)),c.set(N,L)),p?L.formatToParts(l):L.format(l)},e.parse=b,e.parseDateTimeArgs=Ne,e.parseNumberArgs=Le,e.parseTranslateArgs=ge,e.registerMessageCompiler=function(e){ce=e},e.resolveValue=C,e.setAdditionalMeta=e=>{ae=e},e.setDevToolsHook=function(e){ee=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,fallbackLocale:c,messages:a}=e,[l,i]=ge(...t),h=(d(i.missingWarn),d(i.fallbackWarn),d(i.escapeParameter)?i.escapeParameter:e.escapeParameter),k=!!i.resolvedMessage,T=m(i.default)||d(i.default)?d(i.default)?l:i.default:n?l:"",E=n||""!==T,g=m(i.locale)?i.locale:e.locale;h&&function(e){f(e.list)?e.list=e.list.map((e=>m(e)?u(e):e)):_(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=u(e.named[t]))}))}(i);let[N,L,b]=k?[l,g,a[g]||{}]:function(e,t,n,r,o,s){const{messages:c,messageResolver:a}=e,u=ie(e,r,n);let l,i={},f=null;const d="translate";for(let n=0;n<u.length&&(l=u[n],i=c[l]||{},null===(f=a(i,t))&&(f=i[t]),!m(f)&&!p(f));n++){const n=le(e,t,l,0,d);n!==t&&(f=n)}return[f,l,i]}(e,l,g,c),A=l;if(k||m(N)||Te(N)||E&&(N=T,A=N),!(k||(m(N)||Te(N))&&m(L)))return s?-1:l;let C=!1;const y=Te(N)?N:Ee(e,l,L,N,A,(()=>{C=!0}));if(C)return N;const O=function(e,t,n){return t(n)}(0,y,F(function(e,t,n,o){const{modifiers:s,pluralRules:c,messageResolver:a}=e,u={locale:t,modifiers:s,pluralRules:c,messages:r=>{const o=a(n,r);if(m(o)){let n=!1;const s=Ee(e,r,t,o,r,(()=>{n=!0}));return n?ke:s}return Te(o)?o:ke}};e.processor&&(u.processor=e.processor);o.list&&(u.list=o.list);o.named&&(u.named=o.named);r(o.plural)&&(u.pluralIndex=o.plural);return u}(e,L,b,i)));return o?o(O):O},e.translateDevTools=te,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,ie(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var IntlifyCoreBase=function(e){"use strict";const t=/\{([0-9a-zA-Z]+)\}/g;const n=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),r=e=>"number"==typeof e&&isFinite(e),o=e=>"[object RegExp]"===h(e),s=e=>T(e)&&0===Object.keys(e).length;function c(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const a=Object.assign;function l(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}const u=Object.prototype.hasOwnProperty;function i(e,t){return u.call(e,t)}const f=Array.isArray,p=e=>"function"==typeof e,m=e=>"string"==typeof e,d=e=>"boolean"==typeof e,_=e=>null!==e&&"object"==typeof e,k=Object.prototype.toString,h=e=>k.call(e),T=e=>"[object Object]"===h(e),E={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15};function g(e,t,n={}){const{domain:r}=n,o=new SyntaxError(String(e));return o.code=e,t&&(o.location=t),o.domain=r,o}function b(e){throw e}function L(e,t,n){const r={start:e,end:t};return null!=n&&(r.source=n),r}const N=" ",A="\n",C=String.fromCharCode(8232),y=String.fromCharCode(8233);function O(e){const t=e;let n=0,r=1,o=1,s=0;const c=e=>"\r"===t[e]&&t[e+1]===A,a=e=>t[e]===y,l=e=>t[e]===C,u=e=>c(e)||(e=>t[e]===A)(e)||a(e)||l(e),i=e=>c(e)||a(e)||l(e)?A:t[e];function f(){return s=0,u(n)&&(r++,o=0),c(n)&&n++,n++,o++,t[n]}return{index:()=>n,line:()=>r,column:()=>o,peekOffset:()=>s,charAt:i,currentChar:()=>i(n),currentPeek:()=>i(n+s),next:f,peek:function(){return c(n+s)&&s++,s++,t[n+s]},reset:function(){n=0,r=1,o=1,s=0},resetPeek:function(e=0){s=e},skipToPeek:function(){const e=n+s;for(;e!==n;)f();s=0}}}const I=void 0;function F(e,t={}){const n=!1!==t.location,r=O(e),o=()=>r.index(),s=()=>{return e=r.line(),t=r.column(),n=r.index(),{line:e,column:t,offset:n};var e,t,n},c=s(),a=o(),l={currentType:14,offset:a,startLoc:c,endLoc:c,lastType:14,lastOffset:a,lastStartLoc:c,lastEndLoc:c,braceNest:0,inLinked:!1,text:""},u=()=>l,{onError:i}=t;function f(e,t,r){e.endLoc=s(),e.currentType=t;const o={type:t};return n&&(o.loc=L(e.startLoc,e.endLoc)),null!=r&&(o.value=r),o}const p=e=>f(e,14);function m(e,t){return e.currentChar()===t?(e.next(),t):(s(),"")}function d(e){let t="";for(;e.currentPeek()===N||e.currentPeek()===A;)t+=e.currentPeek(),e.peek();return t}function _(e){const t=d(e);return e.skipToPeek(),t}function k(e){if(e===I)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function h(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=function(e){if(e===I)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),r}function T(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function E(e,t=!0){const n=(t=!1,r="",o=!1)=>{const s=e.currentPeek();return"{"===s?"%"!==r&&t:"@"!==s&&s?"%"===s?(e.peek(),n(t,"%",!0)):"|"===s?!("%"!==r&&!o)||!(r===N||r===A):s===N?(e.peek(),n(!0,N,o)):s!==A||(e.peek(),n(!0,A,o)):"%"===r||t},r=n();return t&&e.resetPeek(),r}function g(e,t){const n=e.currentChar();return n===I?I:t(n)?(e.next(),n):null}function b(e){return g(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function C(e){return g(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function y(e){return g(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function F(e){let t="",n="";for(;t=C(e);)n+=t;return n}function v(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return x(e,t,4);case"U":return x(e,t,6);default:return s(),""}}function x(e,t,n){m(e,t);let r="";for(let t=0;t<n;t++){const t=y(e);if(!t){s(),e.currentChar();break}r+=t}return`\\${t}${r}`}function P(e){_(e);const t=m(e,"|");return _(e),t}function w(e,t){let n=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&s(),e.next(),n=f(t,2,"{"),_(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&s(),e.next(),n=f(t,3,"}"),t.braceNest--,t.braceNest>0&&_(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&s(),n=D(e,t)||p(t),t.braceNest=0,n;default:let r=!0,o=!0,c=!0;if(T(e))return t.braceNest>0&&s(),n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return s(),t.braceNest=0,M(e,t);if(r=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t))return n=f(t,5,function(e){_(e);let t="",n="";for(;t=b(e);)n+=t;return e.currentChar()===I&&s(),n}(e)),_(e),n;if(o=h(e,t))return n=f(t,6,function(e){_(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${F(e)}`):t+=F(e),e.currentChar()===I&&s(),t}(e)),_(e),n;if(c=function(e,t){const{currentType:n}=t;if(2!==n)return!1;d(e);const r="'"===e.currentPeek();return e.resetPeek(),r}(e,t))return n=f(t,7,function(e){_(e),m(e,"'");let t="",n="";const r=e=>"'"!==e&&e!==A;for(;t=g(e,r);)n+="\\"===t?v(e):t;const o=e.currentChar();return o===A||o===I?(s(),o===A&&(e.next(),m(e,"'")),n):(m(e,"'"),n)}(e)),_(e),n;if(!r&&!o&&!c)return n=f(t,13,function(e){_(e);let t="",n="";const r=e=>"{"!==e&&"}"!==e&&e!==N&&e!==A;for(;t=g(e,r);)n+=t;return n}(e)),s(),_(e),n}return n}function D(e,t){const{currentType:n}=t;let r=null;const o=e.currentChar();switch(8!==n&&9!==n&&12!==n&&10!==n||o!==A&&o!==N||s(),o){case"@":return e.next(),r=f(t,8,"@"),t.inLinked=!0,r;case".":return _(e),e.next(),f(t,9,".");case":":return _(e),e.next(),f(t,10,":");default:return T(e)?(r=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){const{currentType:n}=t;if(8!==n)return!1;d(e);const r="."===e.currentPeek();return e.resetPeek(),r}(e,t)||function(e,t){const{currentType:n}=t;if(8!==n&&12!==n)return!1;d(e);const r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(_(e),D(e,t)):function(e,t){const{currentType:n}=t;if(9!==n)return!1;d(e);const r=k(e.currentPeek());return e.resetPeek(),r}(e,t)?(_(e),f(t,12,function(e){let t="",n="";for(;t=b(e);)n+=t;return n}(e))):function(e,t){const{currentType:n}=t;if(10!==n)return!1;const r=()=>{const t=e.currentPeek();return"{"===t?k(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===N||!t)&&(t===A?(e.peek(),r()):k(t))},o=r();return e.resetPeek(),o}(e,t)?(_(e),"{"===o?w(e,t)||r:f(t,11,function(e){const t=(n=!1,r)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===N?r:o===A?(r+=o,e.next(),t(n,r)):(r+=o,e.next(),t(!0,r)):r};return t(!1,"")}(e))):(8===n&&s(),t.braceNest=0,t.inLinked=!1,M(e,t))}}function M(e,t){let n={type:14};if(t.braceNest>0)return w(e,t)||p(t);if(t.inLinked)return D(e,t)||p(t);const r=e.currentChar();switch(r){case"{":return w(e,t)||p(t);case"}":return s(),e.next(),f(t,3,"}");case"@":return D(e,t)||p(t);default:if(T(e))return n=f(t,1,P(e)),t.braceNest=0,t.inLinked=!1,n;if(E(e))return f(t,0,function(e){const t=n=>{const r=e.currentChar();return"{"!==r&&"}"!==r&&"@"!==r&&r?"%"===r?E(e)?(n+=r,e.next(),t(n)):n:"|"===r?n:r===N||r===A?E(e)?(n+=r,e.next(),t(n)):T(e)?n:(n+=r,e.next(),t(n)):(n+=r,e.next(),t(n)):n};return t("")}(e));if("%"===r)return e.next(),f(t,4,"%")}return n}return{nextToken:function(){const{currentType:e,offset:t,startLoc:n,endLoc:c}=l;return l.lastType=e,l.lastOffset=t,l.lastStartLoc=n,l.lastEndLoc=c,l.offset=o(),l.startLoc=s(),r.currentChar()===I?f(l,14):M(r,l)},currentOffset:o,currentPosition:s,context:u}}const v=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function x(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||n,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function P(e={}){const t=!1!==e.location,{onError:n}=e;function r(e,n,r){const o={type:e,start:n,end:n};return t&&(o.loc={start:r,end:r}),o}function o(e,n,r,o){e.end=n,o&&(e.type=o),t&&e.loc&&(e.loc.end=r)}function s(e,t){const n=e.context(),s=r(3,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}function c(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(5,s,c);return a.index=parseInt(t,10),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function l(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(4,s,c);return a.key=t,e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function u(e,t){const n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(9,s,c);return a.value=t.replace(v,x),e.nextToken(),o(a,e.currentOffset(),e.currentPosition()),a}function i(e){const t=e.context(),n=r(6,t.offset,t.startLoc);let s=e.nextToken();if(9===s.type){const t=function(e){const t=e.nextToken(),n=e.context(),{lastOffset:s,lastStartLoc:c}=n,a=r(8,s,c);return 12!==t.type?(a.value="",o(a,s,c),{nextConsumeToken:t,node:a}):(null==t.value&&w(t),a.value=t.value||"",o(a,e.currentOffset(),e.currentPosition()),{node:a})}(e);n.modifier=t.node,s=t.nextConsumeToken||e.nextToken()}switch(10!==s.type&&w(s),s=e.nextToken(),2===s.type&&(s=e.nextToken()),s.type){case 11:null==s.value&&w(s),n.key=function(e,t){const n=e.context(),s=r(7,n.offset,n.startLoc);return s.value=t,o(s,e.currentOffset(),e.currentPosition()),s}(e,s.value||"");break;case 5:null==s.value&&w(s),n.key=l(e,s.value||"");break;case 6:null==s.value&&w(s),n.key=c(e,s.value||"");break;case 7:null==s.value&&w(s),n.key=u(e,s.value||"");break;default:const t=e.context(),a=r(7,t.offset,t.startLoc);return a.value="",o(a,t.offset,t.startLoc),n.key=a,o(n,t.offset,t.startLoc),{nextConsumeToken:s,node:n}}return o(n,e.currentOffset(),e.currentPosition()),{node:n}}function f(e){const t=e.context(),n=r(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);n.items=[];let a=null;do{const t=a||e.nextToken();switch(a=null,t.type){case 0:null==t.value&&w(t),n.items.push(s(e,t.value||""));break;case 6:null==t.value&&w(t),n.items.push(c(e,t.value||""));break;case 5:null==t.value&&w(t),n.items.push(l(e,t.value||""));break;case 7:null==t.value&&w(t),n.items.push(u(e,t.value||""));break;case 8:const r=i(e);n.items.push(r.node),a=r.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(n,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),n}function p(e){const t=e.context(),{offset:n,startLoc:s}=t,c=f(e);return 14===t.currentType?c:function(e,t,n,s){const c=e.context();let a=0===s.items.length;const l=r(1,t,n);l.cases=[],l.cases.push(s);do{const t=f(e);a||(a=0===t.items.length),l.cases.push(t)}while(14!==c.currentType);return o(l,e.currentOffset(),e.currentPosition()),l}(e,n,s,c)}return{parse:function(n){const s=F(n,a({},e)),c=s.context(),l=r(0,c.offset,c.startLoc);return t&&l.loc&&(l.loc.source=n),l.body=p(s),o(l,s.currentOffset(),s.currentPosition()),l}}}function w(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function D(e,t){for(let n=0;n<e.length;n++)M(e[n],t)}function M(e,t){switch(e.type){case 1:D(e.cases,t),t.helper("plural");break;case 2:D(e.items,t);break;case 6:M(e.key,t),t.helper("linked");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function R(e,t={}){const n=function(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:e=>(n.helpers.add(e),e)}}(e);n.helper("normalize"),e.body&&M(e.body,n);const r=n.context();e.helpers=Array.from(r.helpers)}function S(e,t){const{helper:n}=e;switch(t.type){case 0:!function(e,t){t.body?S(e,t.body):e.push("null")}(e,t);break;case 1:!function(e,t){const{helper:n,needIndent:r}=e;if(t.cases.length>1){e.push(`${n("plural")}([`),e.indent(r());const o=t.cases.length;for(let n=0;n<o&&(S(e,t.cases[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}}(e,t);break;case 2:!function(e,t){const{helper:n,needIndent:r}=e;e.push(`${n("normalize")}([`),e.indent(r());const o=t.items.length;for(let n=0;n<o&&(S(e,t.items[n]),n!==o-1);n++)e.push(", ");e.deindent(r()),e.push("])")}(e,t);break;case 6:!function(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),S(e,t.key),t.modifier&&(e.push(", "),S(e,t.modifier)),e.push(")")}(e,t);break;case 8:case 7:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${n("interpolate")}(${n("list")}(${t.index}))`,t);break;case 4:e.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(t.key)}))`,t);break;case 9:case 3:e.push(JSON.stringify(t.value),t)}}function $(e,t={}){const n=a({},t),r=P(n).parse(e);return R(r,n),((e,t={})=>{const n=m(t.mode)?t.mode:"normal",r=m(t.filename)?t.filename:"message.intl",o=t.needIndent?t.needIndent:"arrow"!==n,s=e.helpers||[],c=function(e,t){const{filename:n,breakLineCode:r,needIndent:o}=t,s={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};function c(e,t){s.code+=e}function a(e,t=!0){const n=t?r:"";c(o?n+" ".repeat(e):n)}return{context:()=>s,push:c,indent:function(e=!0){const t=++s.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&a(t)},newline:function(){a(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}(e,{mode:n,filename:r,sourceMap:!!t.sourceMap,breakLineCode:null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",needIndent:o});c.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),c.indent(o),s.length>0&&(c.push(`const { ${s.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),c.newline()),c.push("return "),S(c,e),c.deindent(o),c.push("}");const{code:a,map:l}=c.context();return{ast:e,code:a,map:l?l.toJSON():void 0}})(r,n)}const U=[];U[0]={w:[0],i:[3,0],"[":[4],o:[7]},U[1]={w:[1],".":[2],"[":[4],o:[7]},U[2]={w:[2],i:[3,0],0:[3,0]},U[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},U[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},U[5]={"'":[4,0],o:8,l:[5,0]},U[6]={'"':[4,0],o:8,l:[6,0]};const W=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function V(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 K(e){const t=e.trim();return("0"!==e.charAt(0)||!isNaN(parseInt(e)))&&(W.test(t)?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)}function j(e){const t=[];let n,r,o,s,c,a,l,u=-1,i=0,f=0;const p=[];function m(){const t=e[u+1];if(5===i&&"'"===t||6===i&&'"'===t)return u++,o="\\"+t,p[0](),!0}for(p[0]=()=>{void 0===r?r=o:r+=o},p[1]=()=>{void 0!==r&&(t.push(r),r=void 0)},p[2]=()=>{p[0](),f++},p[3]=()=>{if(f>0)f--,i=4,p[0]();else{if(f=0,void 0===r)return!1;if(r=K(r),!1===r)return!1;p[1]()}};null!==i;)if(u++,n=e[u],"\\"!==n||!m()){if(s=V(n),l=U[i],c=l[s]||l.l||8,8===c)return;if(i=c[0],void 0!==c[1]&&(a=p[c[1]],a&&(o=n,!1===a())))return;if(7===i)return t}}const G=new Map;function B(e,t){return _(e)?e[t]:null}const H=e=>e,J=e=>"",X="text",Y=e=>0===e.length?"":e.join(""),z=e=>null==e?"":f(e)||T(e)&&e.toString===k?JSON.stringify(e,null,2):String(e);function Q(e,t){return e=Math.abs(e),2===t?e?e>1?1:0:1:e?Math.min(e,2):0}function q(e={}){const t=e.locale,n=function(e){const t=r(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(r(e.named.count)||r(e.named.n))?r(e.named.count)?e.named.count:r(e.named.n)?e.named.n:t:t}(e),o=_(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?e.pluralRules[t]:Q,s=_(e.pluralRules)&&m(t)&&p(e.pluralRules[t])?Q:void 0,c=e.list||[],a=e.named||{};r(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,a);function l(t){const n=p(e.messages)?e.messages(t):!!_(e.messages)&&e.messages[t];return n||(e.parent?e.parent.message(t):J)}const u=T(e.processor)&&p(e.processor.normalize)?e.processor.normalize:Y,i=T(e.processor)&&p(e.processor.interpolate)?e.processor.interpolate:z,f={list:e=>c[e],named:e=>a[e],plural:e=>e[o(n,e.length,s)],linked:(t,n)=>{const r=l(t)(f);return m(n)?(o=n,e.modifiers?e.modifiers[o]:H)(r):r;var o},message:l,type:T(e.processor)&&m(e.processor.type)?e.processor.type:X,interpolate:i,normalize:u};return f}const Z="i18n:init";let ee=null;const te=ne("function:translate");function ne(e){return t=>ee&&ee.emit(e,t)}const re={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,__EXTEND_POINT__:7},oe={[re.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[re.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[re.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[re.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[re.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[re.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale."};function se(e,t,n){return[...new Set([n,...f(t)?t:_(t)?Object.keys(t):m(t)?[t]:[n]])]}function ce(e,t,n){let r=!0;for(let o=0;o<t.length&&d(r);o++){m(t[o])&&(r=ae(e,t[o],n))}return r}function ae(e,t,n){let r;const o=t.split("-");do{r=le(e,o.join("-"),n),o.splice(-1,1)}while(o.length&&!0===r);return r}function le(e,t,n){let r=!1;if(!e.includes(t)&&(r=!0,t)){r="!"!==t[t.length-1];const o=t.replace(/!/g,"");e.push(o),(f(n)||T(n))&&n[o]&&(r=n[o])}return r}const ue="9.2.0-alpha.7",ie="en-US";let fe,pe,me;let de=null;let _e=0;function ke(e,t,n,r,o){const{missing:s}=e;if(null!==s){const r=s(e,n,t,o);return m(r)?r:t}return t}const he=e=>e;let Te=Object.create(null);let Ee=E.__EXTEND_POINT__;const ge=()=>Ee++,be={INVALID_ARGUMENT:Ee,INVALID_DATE_ARGUMENT:ge(),INVALID_ISO_DATE_ARGUMENT:ge(),__EXTEND_POINT__:ge()};const Le=()=>"",Ne=e=>p(e);function Ae(e,t,r,o,s,c){const{messageCompiler:a,warnHtmlMessage:l}=e;if(Ne(o)){const e=o;return e.locale=e.locale||r,e.key=e.key||t,e}const u=a(o,function(e,t,r,o,s,c){return{warnHtmlMessage:s,onError:e=>{throw c&&c(e),e},onCacheKey:e=>((e,t,r)=>n({l:e,k:t,s:r}))(t,r,e)}}(0,r,s,0,l,c));return u.locale=r,u.key=t,u.source=o,u}function Ce(...e){const[t,n,o]=e,c={};if(!m(t)&&!r(t)&&!Ne(t))throw Error(be.INVALID_ARGUMENT);const l=r(t)?String(t):(Ne(t),t);return r(n)?c.plural=n:m(n)?c.default=n:T(n)&&!s(n)?c.named=n:f(n)&&(c.list=n),r(o)?c.plural=o:m(o)?c.default=o:T(o)&&a(c,o),[l,c]}function ye(...e){const[t,n,o,s]=e;let c,a={},l={};if(m(t)){const e=t.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!e)throw Error(be.INVALID_ISO_DATE_ARGUMENT);const n=e[3]?e[3].trim().startsWith("T")?`${e[1].trim()}${e[3].trim()}`:`${e[1].trim()}T${e[3].trim()}`:e[1].trim();c=new Date(n);try{c.toISOString()}catch(e){throw Error(be.INVALID_ISO_DATE_ARGUMENT)}}else if("[object Date]"===h(t)){if(isNaN(t.getTime()))throw Error(be.INVALID_DATE_ARGUMENT);c=t}else{if(!r(t))throw Error(be.INVALID_ARGUMENT);c=t}return m(n)?a.key=n:T(n)&&(a=n),m(o)?a.locale=o:T(o)&&(l=o),T(s)&&(l=s),[a.key||"",c,a,l]}function Oe(...e){const[t,n,o,s]=e;let c={},a={};if(!r(t))throw Error(be.INVALID_ARGUMENT);const l=t;return m(n)?c.key=n:T(n)&&(c=n),m(o)?c.locale=o:T(o)&&(a=o),T(s)&&(a=s),[c.key||"",l,c,a]}return e.CompileErrorCodes=E,e.CoreErrorCodes=be,e.CoreWarnCodes=re,e.DEFAULT_LOCALE=ie,e.DEFAULT_MESSAGE_DATA_TYPE=X,e.MISSING_RESOLVE_VALUE="",e.NOT_REOSLVED=-1,e.VERSION=ue,e.clearCompileCache=function(){Te=Object.create(null)},e.clearDateTimeFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__datetimeFormatters.has(n)&&r.__datetimeFormatters.delete(n)}},e.clearNumberFormat=function(e,t,n){const r=e;for(const e in n){const n=`${t}__${e}`;r.__numberFormatters.has(n)&&r.__numberFormatters.delete(n)}},e.compileToFunction=function(e,t={}){{const n=(t.onCacheKey||he)(e),r=Te[n];if(r)return r;let o=!1;const s=t.onError||b;t.onError=e=>{o=!0,s(e)};const{code:c}=$(e,t),a=new Function(`return ${c}`)();return o?a:Te[n]=a}},e.createCompileError=g,e.createCoreContext=function(e={}){const t=m(e.version)?e.version:ue,n=m(e.locale)?e.locale:ie,r=f(e.fallbackLocale)||T(e.fallbackLocale)||m(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:n,s=T(e.messages)?e.messages:{[n]:{}},l=T(e.datetimeFormats)?e.datetimeFormats:{[n]:{}},u=T(e.numberFormats)?e.numberFormats:{[n]:{}},i=a({},e.modifiers||{},{upper:e=>m(e)?e.toUpperCase():e,lower:e=>m(e)?e.toLowerCase():e,capitalize:e=>m(e)?`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`:e}),k=e.pluralRules||{},h=p(e.missing)?e.missing:null,E=!d(e.missingWarn)&&!o(e.missingWarn)||e.missingWarn,g=!d(e.fallbackWarn)&&!o(e.fallbackWarn)||e.fallbackWarn,b=!!e.fallbackFormat,L=!!e.unresolving,N=p(e.postTranslation)?e.postTranslation:null,A=T(e.processor)?e.processor:null,C=!d(e.warnHtmlMessage)||e.warnHtmlMessage,y=!!e.escapeParameter,O=p(e.messageCompiler)?e.messageCompiler:fe,I=p(e.messageResolver)?e.messageResolver:pe||B,F=p(e.localeFallbacker)?e.localeFallbacker:me||se,v=p(e.onWarn)?e.onWarn:c,x=e,P=_(x.__datetimeFormatters)?x.__datetimeFormatters:new Map,w=_(x.__numberFormatters)?x.__numberFormatters:new Map,D=_(x.__meta)?x.__meta:{};_e++;const M={version:t,cid:_e,locale:n,fallbackLocale:r,messages:s,modifiers:i,pluralRules:k,missing:h,missingWarn:E,fallbackWarn:g,fallbackFormat:b,unresolving:L,postTranslation:N,processor:A,warnHtmlMessage:C,escapeParameter:y,messageCompiler:O,messageResolver:I,localeFallbacker:F,onWarn:v,__meta:D};return M.datetimeFormats=l,M.numberFormats=u,M.__datetimeFormatters=P,M.__numberFormatters=w,M},e.createCoreError=function(e){return g(e,null,void 0)},e.createMessageContext=q,e.datetime=function(e,...t){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,localeFallbacker:c}=e,{__datetimeFormatters:l}=e,[u,i,f,p]=ye(...t);d(f.missingWarn),d(f.fallbackWarn);const _=!!f.part,k=m(f.locale)?f.locale:e.locale,h=c(e,o,k);if(!m(u)||""===u)return new Intl.DateTimeFormat(k).format(i);let E,g={},b=null;for(let t=0;t<h.length&&(E=h[t],g=n[E]||{},b=g[u],!T(b));t++)ke(e,u,E,0,"datetime format");if(!T(b)||!m(E))return r?-1:u;let L=`${E}__${u}`;s(p)||(L=`${L}__${JSON.stringify(p)}`);let N=l.get(L);return N||(N=new Intl.DateTimeFormat(E,a({},b,p)),l.set(L,N)),_?N.formatToParts(i):N.format(i)},e.fallbackWithLocaleChain=function(e,t,n){const r=m(n)?n:ie,o=e;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let e=[n];for(;f(e);)e=ce(s,e,t);const c=f(t)||!T(t)?t:t.default?t.default:null;e=m(c)?[c]:c,f(e)&&ce(s,e,!1),o.__localeChainCache.set(r,s)}return s},e.fallbackWithSimple=se,e.getAdditionalMeta=()=>de,e.getDevToolsHook=function(){return ee},e.getWarnMessage=function(e,...n){return function(e,...n){return 1===n.length&&_(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),e.replace(t,((e,t)=>n.hasOwnProperty(t)?n[t]:""))}(oe[e],...n)},e.handleFlatJson=function e(t){if(!_(t))return t;for(const n in t)if(i(t,n))if(n.includes(".")){const r=n.split("."),o=r.length-1;let s=t;for(let e=0;e<o;e++)r[e]in s||(s[r[e]]={}),s=s[r[e]];s[r[o]]=t[n],delete t[n],_(s[r[o]])&&e(s[r[o]])}else _(t[n])&&e(t[n]);return t},e.handleMissing=ke,e.initI18nDevTools=function(e,t,n){ee&&ee.emit(Z,{timestamp:Date.now(),i18n:e,version:t,meta:n})},e.isMessageFunction=Ne,e.isTranslateFallbackWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.isTranslateMissingWarn=function(e,t){return e instanceof RegExp?e.test(t):e},e.number=function(e,...t){const{numberFormats:n,unresolving:r,fallbackLocale:o,localeFallbacker:c}=e,{__numberFormatters:l}=e,[u,i,f,p]=Oe(...t);d(f.missingWarn),d(f.fallbackWarn);const _=!!f.part,k=m(f.locale)?f.locale:e.locale,h=c(e,o,k);if(!m(u)||""===u)return new Intl.NumberFormat(k).format(i);let E,g={},b=null;for(let t=0;t<h.length&&(E=h[t],g=n[E]||{},b=g[u],!T(b));t++)ke(e,u,E,0,"number format");if(!T(b)||!m(E))return r?-1:u;let L=`${E}__${u}`;s(p)||(L=`${L}__${JSON.stringify(p)}`);let N=l.get(L);return N||(N=new Intl.NumberFormat(E,a({},b,p)),l.set(L,N)),_?N.formatToParts(i):N.format(i)},e.parse=j,e.parseDateTimeArgs=ye,e.parseNumberArgs=Oe,e.parseTranslateArgs=Ce,e.registerLocaleFallbacker=function(e){me=e},e.registerMessageCompiler=function(e){fe=e},e.registerMessageResolver=function(e){pe=e},e.resolveValue=function(e,t){if(!_(e))return null;let n=G.get(t);if(n||(n=j(t),n&&G.set(t,n)),!n)return null;const r=n.length;let o=e,s=0;for(;s<r;){const e=o[n[s]];if(void 0===e)return null;o=e,s++}return o},e.resolveWithKeyValue=B,e.setAdditionalMeta=e=>{de=e},e.setDevToolsHook=function(e){ee=e},e.translate=function(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,fallbackLocale:c,messages:a}=e,[u,i]=Ce(...t),k=(d(i.missingWarn),d(i.fallbackWarn),d(i.escapeParameter)?i.escapeParameter:e.escapeParameter),h=!!i.resolvedMessage,T=m(i.default)||d(i.default)?d(i.default)?u:i.default:n?u:"",E=n||""!==T,g=m(i.locale)?i.locale:e.locale;k&&function(e){f(e.list)?e.list=e.list.map((e=>m(e)?l(e):e)):_(e.named)&&Object.keys(e.named).forEach((t=>{m(e.named[t])&&(e.named[t]=l(e.named[t]))}))}(i);let[b,L,N]=h?[u,g,a[g]||{}]:function(e,t,n,r,o,s){const{messages:c,messageResolver:a,localeFallbacker:l}=e,u=l(e,r,n);let i,f={},d=null;const _="translate";for(let n=0;n<u.length&&(i=u[n],f=c[i]||{},null===(d=a(f,t))&&(d=f[t]),!m(d)&&!p(d));n++){const n=ke(e,t,i,0,_);n!==t&&(d=n)}return[d,i,f]}(e,u,g,c),A=u;if(h||m(b)||Ne(b)||E&&(b=T,A=b),!(h||(m(b)||Ne(b))&&m(L)))return s?-1:u;let C=!1;const y=Ne(b)?b:Ae(e,u,L,b,A,(()=>{C=!0}));if(C)return b;const O=function(e,t,n){return t(n)}(0,y,q(function(e,t,n,o){const{modifiers:s,pluralRules:c,messageResolver:a}=e,l={locale:t,modifiers:s,pluralRules:c,messages:r=>{const o=a(n,r);if(m(o)){let n=!1;const s=Ae(e,r,t,o,r,(()=>{n=!0}));return n?Le:s}return Ne(o)?o:Le}};e.processor&&(l.processor=e.processor);o.list&&(l.list=o.list);o.named&&(l.named=o.named);r(o.plural)&&(l.pluralIndex=o.plural);return l}(e,L,N,i)));return o?o(O):O},e.translateDevTools=te,e.updateFallbackLocale=function(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
{
"name": "@intlify/core-base",
"version": "9.2.0-alpha.6",
"version": "9.2.0-alpha.7",
"description": "@intlify/core-base",

@@ -36,8 +36,6 @@ "keywords": [

"dependencies": {
"@intlify/devtools-if": "9.2.0-alpha.6",
"@intlify/message-compiler": "9.2.0-alpha.6",
"@intlify/message-resolver": "9.2.0-alpha.6",
"@intlify/runtime": "9.2.0-alpha.6",
"@intlify/shared": "9.2.0-alpha.6",
"@intlify/vue-devtools": "9.2.0-alpha.6"
"@intlify/devtools-if": "9.2.0-alpha.7",
"@intlify/message-compiler": "9.2.0-alpha.7",
"@intlify/shared": "9.2.0-alpha.7",
"@intlify/vue-devtools": "9.2.0-alpha.7"
},

@@ -44,0 +42,0 @@ "engines": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc