LocalCDN-Firefox-Chrome-Brave/resources/vue-i18n/9.2.0/vue-i18n.min.jsm

1 line
33 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var shared=require("@intlify/shared"),coreBase=require("@intlify/core-base"),vue=require("vue");const VERSION="9.2.0";let code$1=coreBase.CoreWarnCodes.__EXTEND_POINT__;const inc$1=()=>++code$1,I18nWarnCodes={FALLBACK_TO_ROOT:code$1,NOT_SUPPORTED_PRESERVE:inc$1(),NOT_SUPPORTED_FORMATTER:inc$1(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:inc$1(),NOT_SUPPORTED_GET_CHOICE_INDEX:inc$1(),COMPONENT_NAME_LEGACY_COMPATIBLE:inc$1(),NOT_FOUND_PARENT_SCOPE:inc$1()},warnMessages={[I18nWarnCodes.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[I18nWarnCodes.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[I18nWarnCodes.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[I18nWarnCodes.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope."};function getWarnMessage(e,...a){return shared.format(warnMessages[e],...a)}let code=coreBase.CompileErrorCodes.__EXTEND_POINT__;const inc=()=>++code,I18nErrorCodes={UNEXPECTED_RETURN_TYPE:code,INVALID_ARGUMENT:inc(),MUST_BE_CALL_SETUP_TOP:inc(),NOT_INSLALLED:inc(),NOT_AVAILABLE_IN_LEGACY_MODE:inc(),REQUIRED_VALUE:inc(),INVALID_VALUE:inc(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:inc(),NOT_INSLALLED_WITH_PROVIDE:inc(),UNEXPECTED_ERROR:inc(),NOT_COMPATIBLE_LEGACY_VUE_I18N:inc(),BRIDGE_SUPPORT_VUE_2_ONLY:inc(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:inc(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:inc(),__EXTEND_POINT__:inc()};function createI18nError(e,...a){return coreBase.createCompileError(e,null,{messages:errorMessages,args:a})}const errorMessages={[I18nErrorCodes.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[I18nErrorCodes.INVALID_ARGUMENT]:"Invalid argument",[I18nErrorCodes.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[I18nErrorCodes.NOT_INSLALLED]:"Need to install with `app.use` function",[I18nErrorCodes.UNEXPECTED_ERROR]:"Unexpected error",[I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[I18nErrorCodes.REQUIRED_VALUE]:"Required in value: {0}",[I18nErrorCodes.INVALID_VALUE]:"Invalid value",[I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[I18nErrorCodes.NOT_INSLALLED_WITH_PROVIDE]:"Need to install with `provide` function",[I18nErrorCodes.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[I18nErrorCodes.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define i18n option or custom block in Composition API with using local scope in Legacy API mode",[I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},TransrateVNodeSymbol=shared.makeSymbol("__transrateVNode"),DatetimePartsSymbol=shared.makeSymbol("__datetimeParts"),NumberPartsSymbol=shared.makeSymbol("__numberParts"),EnableEmitter=shared.makeSymbol("__enableEmitter"),DisableEmitter=shared.makeSymbol("__disableEmitter"),SetPluralRulesSymbol=shared.makeSymbol("__setPluralRules"),InejctWithOption=(shared.makeSymbol("__intlifyMeta"),shared.makeSymbol("__injectWithOption")),__VUE_I18N_BRIDGE__="__VUE_I18N_BRIDGE__";function handleFlatJson(e){if(!shared.isObject(e))return e;for(const s in e)if(shared.hasOwn(e,s))if(s.includes(".")){var r=s.split("."),t=r.length-1;let a=e;for(let e=0;e<t;e++)r[e]in a||(a[r[e]]={}),a=a[r[e]];a[r[t]]=e[s],delete e[s],shared.isObject(a[r[t]])&&handleFlatJson(a[r[t]])}else shared.isObject(e[s])&&handleFlatJson(e[s]);return e}function getLocaleMessages(e,a){const{messages:r,__i18n:t,messageResolver:s,flatJson:n}=a,l=shared.isPlainObject(r)?r:shared.isArray(t)?{}:{[e]:{}};if(shared.isArray(t)&&t.forEach(e=>{var a,r;"locale"in e&&"resource"in e?({locale:a,resource:r}=e,a?(l[a]=l[a]||{},deepCopy(r,l[a])):deepCopy(r,l)):shared.isString(e)&&deepCopy(JSON.parse(e),l)}),null==s&&n)for(const o in l)shared.hasOwn(l,o)&&handleFlatJson(l[o]);return l}const isNotObjectOrIsArray=e=>!shared.isObject(e)||shared.isArray(e);function deepCopy(e,a){if(isNotObjectOrIsArray(e)||isNotObjectOrIsArray(a))throw createI18nError(I18nErrorCodes.INVALID_VALUE);for(const r in e)shared.hasOwn(e,r)&&(isNotObjectOrIsArray(e[r])||isNotObjectOrIsArray(a[r])?a[r]=e[r]:deepCopy(e[r],a[r]))}function getComponentOptions(e){return e.type}function adjustI18nResources(a,r,e){let t=shared.isObject(r.messages)?r.messages:{};"__i18nGlobal"in e&&(t=getLocaleMessages(a.locale.value,{messages:t,__i18n:e.__i18nGlobal}));const s=Object.keys(t);if(s.length&&s.forEach(e=>{a.mergeLocaleMessage(e,t[e])}),shared.isObject(r.datetimeFormats)){const s=Object.keys(r.datetimeFormats);s.length&&s.forEach(e=>{a.mergeDateTimeFormat(e,r.datetimeFormats[e])})}if(shared.isObject(r.numberFormats)){const s=Object.keys(r.numberFormats);s.length&&s.forEach(e=>{a.mergeNumberFormat(e,r.numberFormats[e])})}}function createTextNode(e){return vue.createVNode(vue.Text,null,e,0)}const DEVTOOLS_META="__INTLIFY_META__";let composerID=0;function defineCoreMissingHandler(s){return(e,a,r,t)=>s(a,r,vue.getCurrentInstance()||void 0,t)}const getMetaInfo=()=>{var e=vue.getCurrentInstance();let a=null;return e&&(a=getComponentOptions(e)[DEVTOOLS_META])?{[DEVTOOLS_META]:a}:null};function createComposer(r={},e){const i=r["__root"],c=void 0===i;let a=!shared.isBoolean(r.inheritLocale)||r.inheritLocale;const u=vue.ref(i&&a?i.locale.value:shared.isString(r.locale)?r.locale:coreBase.DEFAULT_LOCALE),m=vue.ref(i&&a?i.fallbackLocale.value:shared.isString(r.fallbackLocale)||shared.isArray(r.fallbackLocale)||shared.isPlainObject(r.fallbackLocale)||!1===r.fallbackLocale?r.fallbackLocale:u.value),_=vue.ref(getLocaleMessages(u.value,r)),d=vue.ref(shared.isPlainObject(r.datetimeFormats)?r.datetimeFormats:{[u.value]:{}}),g=vue.ref(shared.isPlainObject(r.numberFormats)?r.numberFormats:{[u.value]:{}});let p=i?i.missingWarn:!shared.isBoolean(r.missingWarn)&&!shared.isRegExp(r.missingWarn)||r.missingWarn,v=i?i.fallbackWarn:!shared.isBoolean(r.fallbackWarn)&&!shared.isRegExp(r.fallbackWarn)||r.fallbackWarn,E=i?i.fallbackRoot:!shared.isBoolean(r.fallbackRoot)||r.fallbackRoot,t=!!r.fallbackFormat,s=shared.isFunction(r.missing)?r.missing:null,n=shared.isFunction(r.missing)?defineCoreMissingHandler(r.missing):null,l=shared.isFunction(r.postTranslation)?r.postTranslation:null,o=i?i.warnHtmlMessage:!shared.isBoolean(r.warnHtmlMessage)||r.warnHtmlMessage,f=!!r.escapeParameter;const b=i?i.modifiers:shared.isPlainObject(r.modifiers)?r.modifiers:{};let h=r.pluralRules||i&&i.pluralRules,I;I=function(){c&&coreBase.setFallbackContext(null);const e={version:VERSION,locale:u.value,fallbackLocale:m.value,messages:_.value,modifiers:b,pluralRules:h,missing:null===n?void 0:n,missingWarn:p,fallbackWarn:v,fallbackFormat:t,unresolving:!0,postTranslation:null===l?void 0:l,warnHtmlMessage:o,escapeParameter:f,messageResolver:r.messageResolver,__meta:{framework:"vue"}};e.datetimeFormats=d.value,e.numberFormats=g.value,e.__datetimeFormatters=shared.isPlainObject(I)?I.__datetimeFormatters:void 0,e.__numberFormatters=shared.isPlainObject(I)?I.__numberFormatters:void 0,e.__v_emitter=shared.isPlainObject(I)?I.__v_emitter:void 0;var a=coreBase.createCoreContext(e);return c&&coreBase.setFallbackContext(a),a}(),coreBase.updateFallbackLocale(I,u.value,m.value);var O=vue.computed({get:()=>u.value,set:e=>{u.value=e,I.locale=u.value}}),T=vue.computed({get:()=>m.value,set:e=>{m.value=e,I.fallbackLocale=m.value,coreBase.updateFallbackLocale(I,u.value,e)}}),N=vue.computed(()=>_.value),L=vue.computed(()=>d.value),C=vue.computed(()=>g.value);function R(e,a,r,t,s,n){u.value,m.value,_.value,d.value,g.value;let l;try{coreBase.setAdditionalMeta(getMetaInfo()),c||(I.fallbackContext=i?coreBase.getFallbackContext():void 0),l=e(I)}finally{coreBase.setAdditionalMeta(null),c||(I.fallbackContext=void 0)}if(shared.isNumber(l)&&l===coreBase.NOT_REOSLVED){var[e,a]=a();if(i&&shared.isString(e)&&(a=a,"translate"!==r||!a.resolvedMessage)){E&&(coreBase.isTranslateFallbackWarn(v,e)||coreBase.isTranslateMissingWarn(p,e))&&shared.warn(getWarnMessage(I18nWarnCodes.FALLBACK_TO_ROOT,{key:e,type:r}));{const o=I["__v_emitter"];o&&E&&o.emit("fallback",{type:r,key:e,to:"global",groupId:r+":"+e})}}return i&&E?t(i):s(e)}if(n(l))return l;throw createI18nError(I18nErrorCodes.UNEXPECTED_RETURN_TYPE)}function P(...a){return R(e=>Reflect.apply(coreBase.translate,null,[e,...a]),()=>coreBase.parseTranslateArgs(...a),"translate",e=>Reflect.apply(e.t,e,[...a]),e=>e,e=>shared.isString(e))}const F={normalize:function(e){return e.map(e=>shared.isString(e)||shared.isNumber(e)||shared.isBoolean(e)?createTextNode(String(e)):e)},interpolate:e=>e,type:"vnode"};function k(e){var a=function(a){let r=null;var t=coreBase.fallbackWithLocaleChain(I,m.value,u.value);for(let e=0;e<t.length;e++){var s=_.value[t[e]]||{},s=I.messageResolver(s,a);if(null!=s){r=s;break}}return r}(e);return null!=a?a:i&&i.tm(e)||{}}function y(e){return _.value[e]||{}}composerID++,i&&shared.inBrowser&&(vue.watch(i.locale,e=>{a&&(u.value=e,I.locale=e,coreBase.updateFallbackLocale(I,u.value,m.value))}),vue.watch(i.fallbackLocale,e=>{a&&(m.value=e,I.fallbackLocale=e,coreBase.updateFallbackLocale(I,u.value,m.value))}));const M={id:composerID,locale:O,fallbackLocale:T,get inheritLocale(){return a},set inheritLocale(e){(a=e)&&i&&(u.value=i.locale.value,m.value=i.fallbackLocale.value,coreBase.updateFallbackLocale(I,u.value,m.value))},get availableLocales(){return Object.keys(_.value).sort()},messages:N,get modifiers(){return b},get pluralRules(){return h||{}},get isGlobal(){return c},get missingWarn(){return p},set missingWarn(e){p=e,I.missingWarn=p},get fallbackWarn(){return v},set fallbackWarn(e){v=e,I.fallbackWarn=v},get fallbackRoot(){return E},set fallbackRoot(e){E=e},get fallbackFormat(){return t},set fallbackFormat(e){t=e,I.fallbackFormat=t},get warnHtmlMessage(){return o},set warnHtmlMessage(e){o=e,I.warnHtmlMessage=e},get escapeParameter(){return f},set escapeParameter(e){f=e,I.escapeParameter=e},t:P,getLocaleMessage:y,setLocaleMessage:function(e,a){_.value[e]=a,I.messages=_.value},mergeLocaleMessage:function(e,a){_.value[e]=_.value[e]||{},deepCopy(a,_.value[e]),I.messages=_.value},getPostTranslationHandler:function(){return shared.isFunction(l)?l:null},setPostTranslationHandler:function(e){l=e,I.postTranslation=e},getMissingHandler:function(){return s},setMissingHandler:function(e){null!==e&&(n=defineCoreMissingHandler(e)),s=e,I.missing=n},[SetPluralRulesSymbol]:function(e){h=e,I.pluralRules=h}};return M.datetimeFormats=L,M.numberFormats=C,M.rt=function(...e){var[e,a,r]=e;if(r&&!shared.isObject(r))throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);return P(e,a,shared.assign({resolvedMessage:!0},r||{}))},M.te=function(e,a){return a=y(shared.isString(a)?a:u.value),null!==I.messageResolver(a,e)},M.tm=k,M.d=function(...a){return R(e=>Reflect.apply(coreBase.datetime,null,[e,...a]),()=>coreBase.parseDateTimeArgs(...a),"datetime format",e=>Reflect.apply(e.d,e,[...a]),()=>coreBase.MISSING_RESOLVE_VALUE,e=>shared.isString(e))},M.n=function(...a){return R(e=>Reflect.apply(coreBase.number,null,[e,...a]),()=>coreBase.parseNumberArgs(...a),"number format",e=>Reflect.apply(e.n,e,[...a]),()=>coreBase.MISSING_RESOLVE_VALUE,e=>shared.isString(e))},M.getDateTimeFormat=function(e){return d.value[e]||{}},M.setDateTimeFormat=function(e,a){d.value[e]=a,I.datetimeFormats=d.value,coreBase.clearDateTimeFormat(I,e,a)},M.mergeDateTimeFormat=function(e,a){d.value[e]=shared.assign(d.value[e]||{},a),I.datetimeFormats=d.value,coreBase.clearDateTimeFormat(I,e,a)},M.getNumberFormat=function(e){return g.value[e]||{}},M.setNumberFormat=function(e,a){g.value[e]=a,I.numberFormats=g.value,coreBase.clearNumberFormat(I,e,a)},M.mergeNumberFormat=function(e,a){g.value[e]=shared.assign(g.value[e]||{},a),I.numberFormats=g.value,coreBase.clearNumberFormat(I,e,a)},M[InejctWithOption]=r.__injectWithOption,M[TransrateVNodeSymbol]=function(...t){return R(e=>{let a;const r=e;try{r.processor=F,a=Reflect.apply(coreBase.translate,null,[r,...t])}finally{r.processor=null}return a},()=>coreBase.parseTranslateArgs(...t),"translate",e=>e[TransrateVNodeSymbol](...t),e=>[createTextNode(e)],e=>shared.isArray(e))},M[DatetimePartsSymbol]=function(...a){return R(e=>Reflect.apply(coreBase.datetime,null,[e,...a]),()=>coreBase.parseDateTimeArgs(...a),"datetime format",e=>e[DatetimePartsSymbol](...a),()=>[],e=>shared.isString(e)||shared.isArray(e))},M[NumberPartsSymbol]=function(...a){return R(e=>Reflect.apply(coreBase.number,null,[e,...a]),()=>coreBase.parseNumberArgs(...a),"number format",e=>e[NumberPartsSymbol](...a),()=>[],e=>shared.isString(e)||shared.isArray(e))},M[EnableEmitter]=e=>{I.__v_emitter=e},M[DisableEmitter]=()=>{I.__v_emitter=void 0},M}function convertComposerOptions(e){var a=shared.isString(e.locale)?e.locale:coreBase.DEFAULT_LOCALE,r=shared.isString(e.fallbackLocale)||shared.isArray(e.fallbackLocale)||shared.isPlainObject(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,t=shared.isFunction(e.missing)?e.missing:void 0,s=!shared.isBoolean(e.silentTranslationWarn)&&!shared.isRegExp(e.silentTranslationWarn)||!e.silentTranslationWarn,n=!shared.isBoolean(e.silentFallbackWarn)&&!shared.isRegExp(e.silentFallbackWarn)||!e.silentFallbackWarn,l=!shared.isBoolean(e.fallbackRoot)||e.fallbackRoot,o=!!e.formatFallbackMessages,i=shared.isPlainObject(e.modifiers)?e.modifiers:{},c=e.pluralizationRules,u=shared.isFunction(e.postTranslation)?e.postTranslation:void 0,m=!shared.isString(e.warnHtmlInMessage)||"off"!==e.warnHtmlInMessage,_=!!e.escapeParameterHtml,d=!shared.isBoolean(e.sync)||e.sync;e.formatter&&shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER)),e.preserveDirectiveContent&&shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));let g=e.messages;if(shared.isPlainObject(e.sharedMessages)){const I=e.sharedMessages,O=Object.keys(I);g=O.reduce((e,a)=>{var r=e[a]||(e[a]={});return shared.assign(r,I[a]),e},g||{})}var{__i18n:p,__root:v,__injectWithOption:E}=e,f=e.datetimeFormats,b=e.numberFormats,h=e.flatJson;return{locale:a,fallbackLocale:r,messages:g,flatJson:h,datetimeFormats:f,numberFormats:b,missing:t,missingWarn:s,fallbackWarn:n,fallbackRoot:l,fallbackFormat:o,modifiers:i,pluralRules:c,postTranslation:u,warnHtmlMessage:m,escapeParameter:_,messageResolver:e.messageResolver,inheritLocale:d,__i18n:p,__root:v,__injectWithOption:E}}function createVueI18n(r={},e){{const l=createComposer(convertComposerOptions(r)),t={id:l.id,get locale(){return l.locale.value},set locale(e){l.locale.value=e},get fallbackLocale(){return l.fallbackLocale.value},set fallbackLocale(e){l.fallbackLocale.value=e},get messages(){return l.messages.value},get datetimeFormats(){return l.datetimeFormats.value},get numberFormats(){return l.numberFormats.value},get availableLocales(){return l.availableLocales},get formatter(){return shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER)),{interpolate(){return[]}}},set formatter(e){shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER))},get missing(){return l.getMissingHandler()},set missing(e){l.setMissingHandler(e)},get silentTranslationWarn(){return shared.isBoolean(l.missingWarn)?!l.missingWarn:l.missingWarn},set silentTranslationWarn(e){l.missingWarn=shared.isBoolean(e)?!e:e},get silentFallbackWarn(){return shared.isBoolean(l.fallbackWarn)?!l.fallbackWarn:l.fallbackWarn},set silentFallbackWarn(e){l.fallbackWarn=shared.isBoolean(e)?!e:e},get modifiers(){return l.modifiers},get formatFallbackMessages(){return l.fallbackFormat},set formatFallbackMessages(e){l.fallbackFormat=e},get postTranslation(){return l.getPostTranslationHandler()},set postTranslation(e){l.setPostTranslationHandler(e)},get sync(){return l.inheritLocale},set sync(e){l.inheritLocale=e},get warnHtmlInMessage(){return l.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(e){l.warnHtmlMessage="off"!==e},get escapeParameterHtml(){return l.escapeParameter},set escapeParameterHtml(e){l.escapeParameter=e},get preserveDirectiveContent(){return shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE)),!0},set preserveDirectiveContent(e){shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE))},get pluralizationRules(){return l.pluralRules||{}},__composer:l,t(...e){var[e,a,r]=e;const t={};let s=null,n=null;if(!shared.isString(e))throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);return shared.isString(a)?t.locale=a:shared.isArray(a)?s=a:shared.isPlainObject(a)&&(n=a),shared.isArray(r)?s=r:shared.isPlainObject(r)&&(n=r),Reflect.apply(l.t,l,[e,s||n||{},t])},rt(...e){return Reflect.apply(l.rt,l,[...e])},tc(...e){var[e,a,r]=e;const t={plural:1};let s=null,n=null;if(!shared.isString(e))throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);return shared.isString(a)?t.locale=a:shared.isNumber(a)?t.plural=a:shared.isArray(a)?s=a:shared.isPlainObject(a)&&(n=a),shared.isString(r)?t.locale=r:shared.isArray(r)?s=r:shared.isPlainObject(r)&&(n=r),Reflect.apply(l.t,l,[e,s||n||{},t])},te(e,a){return l.te(e,a)},tm(e){return l.tm(e)},getLocaleMessage(e){return l.getLocaleMessage(e)},setLocaleMessage(e,a){l.setLocaleMessage(e,a)},mergeLocaleMessage(e,a){l.mergeLocaleMessage(e,a)},d(...e){return Reflect.apply(l.d,l,[...e])},getDateTimeFormat(e){return l.getDateTimeFormat(e)},setDateTimeFormat(e,a){l.setDateTimeFormat(e,a)},mergeDateTimeFormat(e,a){l.mergeDateTimeFormat(e,a)},n(...e){return Reflect.apply(l.n,l,[...e])},getNumberFormat(e){return l.getNumberFormat(e)},setNumberFormat(e,a){l.setNumberFormat(e,a)},mergeNumberFormat(e,a){l.mergeNumberFormat(e,a)},getChoiceIndex(e,a){return shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX)),-1},__onComponentInstanceCreated(e){const a=r["componentInstanceCreatedListener"];a&&a(e,t)}};return t.__enableEmitter=e=>{const a=l;a[EnableEmitter]&&a[EnableEmitter](e)},t.__disableEmitter=()=>{const e=l;e[DisableEmitter]&&e[DisableEmitter]()},t}}const baseFormatProps={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>"parent"===e||"global"===e,default:"parent"},i18n:{type:Object}};function getInterpolateArg({slots:t},e){if(1!==e.length||"default"!==e[0])return e.reduce((e,a)=>{const r=t[a];return r&&(e[a]=r()),e},{});{const a=t.default?t.default():[];return a.reduce((e,a)=>[...e,...shared.isArray(a.children)?a.children:[a]],[])}}function getFragmentableTag(e){return vue.Fragment}const Translation={name:"i18n-t",props:shared.assign({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>shared.isNumber(e)||!isNaN(e)}},baseFormatProps),setup(s,n){const{slots:l,attrs:o}=n,i=s.i18n||useI18n({useScope:s.scope,__useComponent:!0});return()=>{var e=Object.keys(l).filter(e=>"_"!==e);const a={};s.locale&&(a.locale=s.locale),void 0!==s.plural&&(a.plural=shared.isString(s.plural)?+s.plural:s.plural);var e=getInterpolateArg(n,e),e=i[TransrateVNodeSymbol](s.keypath,e,a),r=shared.assign({},o),t=shared.isString(s.tag)||shared.isObject(s.tag)?s.tag:getFragmentableTag();return vue.h(t,r,e)}}};function isVNode(e){return shared.isArray(e)&&!shared.isString(e[0])}function renderFormatter(l,e,o,i){const{slots:c,attrs:u}=e;return()=>{const e={part:!0};let a={};l.locale&&(e.locale=l.locale),shared.isString(l.format)?e.key=l.format:shared.isObject(l.format)&&(shared.isString(l.format.key)&&(e.key=l.format.key),a=Object.keys(l.format).reduce((e,a)=>o.includes(a)?shared.assign({},e,{[a]:l.format[a]}):e,{}));const s=i(l.value,e,a);let r=[e.key];shared.isArray(s)?r=s.map((e,a)=>{const r=c[e.type],t=r?r({[e.type]:e.value,index:a,parts:s}):[e.value];return isVNode(t)&&(t[0].key=e.type+"-"+a),t}):shared.isString(s)&&(r=[s]);var t=shared.assign({},u),n=shared.isString(l.tag)||shared.isObject(l.tag)?l.tag:getFragmentableTag();return vue.h(n,t,r)}}const NumberFormat={name:"i18n-n",props:shared.assign({value:{type:Number,required:!0},format:{type:[String,Object]}},baseFormatProps),setup(e,a){const r=e.i18n||useI18n({useScope:"parent",__useComponent:!0});return renderFormatter(e,a,coreBase.NUMBER_FORMAT_OPTIONS_KEYS,(...e)=>r[NumberPartsSymbol](...e))}},DatetimeFormat={name:"i18n-d",props:shared.assign({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},baseFormatProps),setup(e,a){const r=e.i18n||useI18n({useScope:"parent",__useComponent:!0});return renderFormatter(e,a,coreBase.DATETIME_FORMAT_OPTIONS_KEYS,(...e)=>r[DatetimePartsSymbol](...e))}};function getComposer$1(e,a){const r=e;return"composition"===e.mode?r.__getInstance(a)||e.global:(null!=(a=r.__getInstance(a))?a:e.global).__composer}function vTDirective(s){function n(e){var{instance:e,modifiers:a,value:r}=e;if(!e||!e.$)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);e=getComposer$1(s,e.$),a.preserve&&shared.warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE)),a=parseValue(r);return[Reflect.apply(e.t,e,[...makeParams(a)]),e]}return{created:(e,a)=>{var[r,t]=n(a);shared.inBrowser&&s.global===t&&(e.__i18nWatcher=vue.watch(t.locale,()=>{a.instance&&a.instance.$forceUpdate()})),e.__composer=t,e.textContent=r},unmounted:e=>{shared.inBrowser&&e.__i18nWatcher&&(e.__i18nWatcher(),e.__i18nWatcher=void 0,delete e.__i18nWatcher),e.__composer&&(e.__composer=void 0,delete e.__composer)},beforeUpdate:(e,{value:a})=>{var r;e.__composer&&(r=e.__composer,a=parseValue(a),e.textContent=Reflect.apply(r.t,r,[...makeParams(a)]))},getSSRProps:e=>{var[e]=n(e);return{textContent:e}}}}function parseValue(e){if(shared.isString(e))return{path:e};if(shared.isPlainObject(e)){if("path"in e)return e;throw createI18nError(I18nErrorCodes.REQUIRED_VALUE,"path")}throw createI18nError(I18nErrorCodes.INVALID_VALUE)}function makeParams(e){var{path:e,locale:a,args:r,choice:t,plural:s}=e;const n={};r=r||{};return shared.isString(a)&&(n.locale=a),shared.isNumber(t)&&(n.plural=t),shared.isNumber(s)&&(n.plural=s),[e,r,n]}function apply(e,a,...r){var r=shared.isPlainObject(r[0])?r[0]:{},t=!!r.useI18nComponentName,r=!shared.isBoolean(r.globalInstall)||r.globalInstall;r&&t&&shared.warn(getWarnMessage(I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE,{name:Translation.name})),r&&(e.component(t?"i18n":Translation.name,Translation),e.component(NumberFormat.name,NumberFormat),e.component(DatetimeFormat.name,DatetimeFormat)),e.directive("t",vTDirective(a))}function defineMixin(t,s,n){return{beforeCreate(){var e=vue.getCurrentInstance();if(!e)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);var a=this.$options;if(a.i18n){const r=a.i18n;a.__i18n&&(r.__i18n=a.__i18n),r.__root=s,this===this.$root?this.$i18n=mergeToRoot(t,r):(r.__injectWithOption=!0,this.$i18n=createVueI18n(r))}else a.__i18n?this===this.$root?this.$i18n=mergeToRoot(t,a):this.$i18n=createVueI18n({__i18n:a.__i18n,__injectWithOption:!0,__root:s}):this.$i18n=t;a.__i18nGlobal&&adjustI18nResources(s,a,a),t.__onComponentInstanceCreated(this.$i18n),n.__setInstance(e,this.$i18n),this.$t=(...e)=>this.$i18n.t(...e),this.$rt=(...e)=>this.$i18n.rt(...e),this.$tc=(...e)=>this.$i18n.tc(...e),this.$te=(e,a)=>this.$i18n.te(e,a),this.$d=(...e)=>this.$i18n.d(...e),this.$n=(...e)=>this.$i18n.n(...e),this.$tm=e=>this.$i18n.tm(e)},mounted(){},unmounted(){var e=vue.getCurrentInstance();if(!e)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,n.__deleteInstance(e),delete this.$i18n}}}function mergeToRoot(a,r){a.locale=r.locale||a.locale,a.fallbackLocale=r.fallbackLocale||a.fallbackLocale,a.missing=r.missing||a.missing,a.silentTranslationWarn=r.silentTranslationWarn||a.silentFallbackWarn,a.silentFallbackWarn=r.silentFallbackWarn||a.silentFallbackWarn,a.formatFallbackMessages=r.formatFallbackMessages||a.formatFallbackMessages,a.postTranslation=r.postTranslation||a.postTranslation,a.warnHtmlInMessage=r.warnHtmlInMessage||a.warnHtmlInMessage,a.escapeParameterHtml=r.escapeParameterHtml||a.escapeParameterHtml,a.sync=r.sync||a.sync,a.__composer[SetPluralRulesSymbol](r.pluralizationRules||a.pluralizationRules);const t=getLocaleMessages(a.locale,{messages:r.messages,__i18n:r.__i18n});return Object.keys(t).forEach(e=>a.mergeLocaleMessage(e,t[e])),r.datetimeFormats&&Object.keys(r.datetimeFormats).forEach(e=>a.mergeDateTimeFormat(e,r.datetimeFormats[e])),r.numberFormats&&Object.keys(r.numberFormats).forEach(e=>a.mergeNumberFormat(e,r.numberFormats[e])),a}const I18nInjectionKey=shared.makeSymbol("global-vue-i18n");function createI18n(e={},a){const t=!shared.isBoolean(e.legacy)||e.legacy,s=!shared.isBoolean(e.globalInjection)||e.globalInjection,r=!t||!!e.allowComposition,n=new Map,[l,o]=createGlobal(e,t),i=shared.makeSymbol("vue-i18n");{const c={get mode(){return t?"legacy":"composition"},get allowComposition(){return r},async install(e,...a){e.__VUE_I18N_SYMBOL__=i,e.provide(e.__VUE_I18N_SYMBOL__,c),!t&&s&&injectGlobalFields(e,c.global),apply(e,c,...a),t&&e.mixin(defineMixin(o,o.__composer,c));const r=e.unmount;e.unmount=()=>{c.dispose(),r()}},get global(){return o},dispose(){l.stop()},__instances:n,__getInstance:function(e){return n.get(e)||null},__setInstance:function(e,a){n.set(e,a)},__deleteInstance:function(e){n.delete(e)}};return c}}function useI18n(a={}){var r=vue.getCurrentInstance();if(null==r)throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP);if(!r.isCE&&null!=r.appContext.app&&!r.appContext.app.__VUE_I18N_SYMBOL__)throw createI18nError(I18nErrorCodes.NOT_INSLALLED);var t=getI18nInstance(r),s=getGlobalComposer(t),e=getComponentOptions(r),n=getScope(a,e);if("legacy"===t.mode&&!a.__useComponent){if(t.allowComposition)return useI18nForLegacy(r,n,s,a);throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE)}if("global"===n)return adjustI18nResources(s,a,e),s;if("parent"===n){let e=getComposer(t,r,a.__useComponent);return null==e&&(shared.warn(getWarnMessage(I18nWarnCodes.NOT_FOUND_PARENT_SCOPE)),e=s),e}const l=t;let o=l.__getInstance(r);if(null==o){const i=shared.assign({},a);"__i18n"in e&&(i.__i18n=e.__i18n),s&&(i.__root=s),o=createComposer(i),setupLifeCycle(l,r),l.__setInstance(r,o)}return o}const castToVueI18n=e=>{if(__VUE_I18N_BRIDGE__ in e)return e;throw createI18nError(I18nErrorCodes.NOT_COMPATIBLE_LEGACY_VUE_I18N)};function createGlobal(e,a,r){const t=vue.effectScope();a=a?t.run(()=>createVueI18n(e)):t.run(()=>createComposer(e));if(null==a)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);return[t,a]}function getI18nInstance(e){var a=vue.inject(e.isCE?I18nInjectionKey:e.appContext.app.__VUE_I18N_SYMBOL__);if(a)return a;throw createI18nError(e.isCE?I18nErrorCodes.NOT_INSLALLED_WITH_PROVIDE:I18nErrorCodes.UNEXPECTED_ERROR)}function getScope(e,a){return shared.isEmptyObject(e)?"__i18n"in a?"local":"global":e.useScope||"local"}function getGlobalComposer(e){return"composition"===e.mode?e.global:e.global.__composer}function getComposer(e,a,r=!1){let t=null;var s,n=a.root;let l=a.parent;for(;null!=l;){const o=e;if("composition"===e.mode?t=o.__getInstance(l):null!=(s=o.__getInstance(l))&&(t=s.__composer,r&&t&&!t[InejctWithOption]&&(t=null)),null!=t)break;if(n===l)break;l=l.parent}return t}function setupLifeCycle(e,a,r){vue.onMounted(()=>{},a),vue.onUnmounted(()=>{e.__deleteInstance(a)},a)}function useI18nForLegacy(r,t,e,a={}){const s="local"===t,n=vue.shallowRef(null);if(s&&r.proxy&&!r.proxy.$options.i18n&&!r.proxy.$options.__i18n)throw createI18nError(I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);const l=!shared.isBoolean(a.inheritLocale)||a.inheritLocale,o=vue.ref(s&&l?e.locale.value:shared.isString(a.locale)?a.locale:coreBase.DEFAULT_LOCALE),i=vue.ref(s&&l?e.fallbackLocale.value:shared.isString(a.fallbackLocale)||shared.isArray(a.fallbackLocale)||shared.isPlainObject(a.fallbackLocale)||!1===a.fallbackLocale?a.fallbackLocale:o.value),c=vue.ref(getLocaleMessages(o.value,a)),u=vue.ref(shared.isPlainObject(a.datetimeFormats)?a.datetimeFormats:{[o.value]:{}}),m=vue.ref(shared.isPlainObject(a.numberFormats)?a.numberFormats:{[o.value]:{}}),_=s?e.missingWarn:!shared.isBoolean(a.missingWarn)&&!shared.isRegExp(a.missingWarn)||a.missingWarn,d=s?e.fallbackWarn:!shared.isBoolean(a.fallbackWarn)&&!shared.isRegExp(a.fallbackWarn)||a.fallbackWarn,g=s?e.fallbackRoot:!shared.isBoolean(a.fallbackRoot)||a.fallbackRoot,p=!!a.fallbackFormat,v=shared.isFunction(a.missing)?a.missing:null,E=shared.isFunction(a.postTranslation)?a.postTranslation:null,f=s?e.warnHtmlMessage:!shared.isBoolean(a.warnHtmlMessage)||a.warnHtmlMessage,b=!!a.escapeParameter,h=s?e.modifiers:shared.isPlainObject(a.modifiers)?a.modifiers:{},I=a.pluralRules||s&&e.pluralRules;var a=vue.computed({get:()=>(n.value?n.value.locale:o).value,set:e=>{n.value&&(n.value.locale.value=e),o.value=e}}),e=vue.computed({get:()=>(n.value?n.value.fallbackLocale:i).value,set:e=>{n.value&&(n.value.fallbackLocale.value=e),i.value=e}}),O=vue.computed(()=>(n.value?n.value.messages:c).value),T=vue.computed(()=>u.value),N=vue.computed(()=>m.value);function L(e){return o.value,i.value,c.value,u.value,m.value,e()}a={get id(){return n.value?n.value.id:-1},locale:a,fallbackLocale:e,messages:O,datetimeFormats:T,numberFormats:N,get inheritLocale(){return n.value?n.value.inheritLocale:l},set inheritLocale(e){n.value&&(n.value.inheritLocale=e)},get availableLocales(){return n.value?n.value.availableLocales:Object.keys(c.value)},get modifiers(){return n.value?n.value.modifiers:h},get pluralRules(){return n.value?n.value.pluralRules:I},get isGlobal(){return!!n.value&&n.value.isGlobal},get missingWarn(){return n.value?n.value.missingWarn:_},set missingWarn(e){n.value&&(n.value.missingWarn=e)},get fallbackWarn(){return n.value?n.value.fallbackWarn:d},set fallbackWarn(e){n.value&&(n.value.missingWarn=e)},get fallbackRoot(){return n.value?n.value.fallbackRoot:g},set fallbackRoot(e){n.value&&(n.value.fallbackRoot=e)},get fallbackFormat(){return n.value?n.value.fallbackFormat:p},set fallbackFormat(e){n.value&&(n.value.fallbackFormat=e)},get warnHtmlMessage(){return n.value?n.value.warnHtmlMessage:f},set warnHtmlMessage(e){n.value&&(n.value.warnHtmlMessage=e)},get escapeParameter(){return n.value?n.value.escapeParameter:b},set escapeParameter(e){n.value&&(n.value.escapeParameter=e)},t:function(...e){return n.value?L(()=>Reflect.apply(n.value.t,null,[...e])):L(()=>"")},getPostTranslationHandler:function(){return n.value?n.value.getPostTranslationHandler():E},setPostTranslationHandler:function(e){n.value&&n.value.setPostTranslationHandler(e)},getMissingHandler:function(){return n.value?n.value.getMissingHandler():v},setMissingHandler:function(e){n.value&&n.value.setMissingHandler(e)},rt:function(...e){return n.value?Reflect.apply(n.value.rt,null,[...e]):""},d:function(...e){return n.value?L(()=>Reflect.apply(n.value.d,null,[...e])):L(()=>"")},n:function(...e){return n.value?L(()=>Reflect.apply(n.value.n,null,[...e])):L(()=>"")},tm:function(e){return n.value?n.value.tm(e):{}},te:function(e,a){return!!n.value&&n.value.te(e,a)},getLocaleMessage:function(e){return n.value?n.value.getLocaleMessage(e):{}},setLocaleMessage:function(e,a){n.value&&(n.value.setLocaleMessage(e,a),c.value[e]=a)},mergeLocaleMessage:function(e,a){n.value&&n.value.mergeLocaleMessage(e,a)},getDateTimeFormat:function(e){return n.value?n.value.getDateTimeFormat(e):{}},setDateTimeFormat:function(e,a){n.value&&(n.value.setDateTimeFormat(e,a),u.value[e]=a)},mergeDateTimeFormat:function(e,a){n.value&&n.value.mergeDateTimeFormat(e,a)},getNumberFormat:function(e){return n.value?n.value.getNumberFormat(e):{}},setNumberFormat:function(e,a){n.value&&(n.value.setNumberFormat(e,a),m.value[e]=a)},mergeNumberFormat:function(e,a){n.value&&n.value.mergeNumberFormat(e,a)}};return vue.onBeforeMount(()=>{if(null==r.proxy||null==r.proxy.$i18n)throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);var a,e=n.value=r.proxy.$i18n.__composer;"global"===t?(o.value=e.locale.value,i.value=e.fallbackLocale.value,c.value=e.messages.value,u.value=e.datetimeFormats.value,m.value=e.numberFormats.value):s&&((a=e).locale.value=o.value,a.fallbackLocale.value=i.value,Object.keys(c.value).forEach(e=>{a.mergeLocaleMessage(e,c.value[e])}),Object.keys(u.value).forEach(e=>{a.mergeDateTimeFormat(e,u.value[e])}),Object.keys(m.value).forEach(e=>{a.mergeNumberFormat(e,m.value[e])}),a.escapeParameter=b,a.fallbackFormat=p,a.fallbackRoot=g,a.fallbackWarn=d,a.missingWarn=_,a.warnHtmlMessage=f)}),a}const globalExportProps=["locale","fallbackLocale","availableLocales"],globalExportMethods=["t","rt","d","n","tm"];function injectGlobalFields(r,t){const s=Object.create(null);globalExportProps.forEach(e=>{const a=Object.getOwnPropertyDescriptor(t,e);if(!a)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);var r=vue.isRef(a.value)?{get(){return a.value.value},set(e){a.value.value=e}}:{get(){return a.get&&a.get()}};Object.defineProperty(s,e,r)}),r.config.globalProperties.$i18n=s,globalExportMethods.forEach(e=>{var a=Object.getOwnPropertyDescriptor(t,e);if(!a||!a.value)throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);Object.defineProperty(r.config.globalProperties,"$"+e,a)})}coreBase.registerMessageCompiler(coreBase.compileToFunction),coreBase.registerMessageResolver(coreBase.resolveValue),coreBase.registerLocaleFallbacker(coreBase.fallbackWithLocaleChain);{const a4=shared.getGlobalThis();a4.__INTLIFY__=!0,coreBase.setDevToolsHook(a4.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}exports.DatetimeFormat=DatetimeFormat,exports.I18nInjectionKey=I18nInjectionKey,exports.NumberFormat=NumberFormat,exports.Translation=Translation,exports.VERSION=VERSION,exports.castToVueI18n=castToVueI18n,exports.createI18n=createI18n,exports.useI18n=useI18n,exports.vTDirective=vTDirective;