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

1 line
22 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var shared=require("@intlify/shared"),coreBase=require("@intlify/core-base"),vue=require("vue");const VERSION="9.1.6",warnMessages={6:"Fall back to {type} '{key}' with root locale.",7:"Not supported 'preserve'.",8:"Not supported 'formatter'.",9:"Not supported 'preserveDirectiveContent'.",10:"Not supported 'getChoiceIndex'.",11:"Component name legacy compatible: '{name}' -> 'i18n'",12:"Not found parent scope. use the global scope."};function getWarnMessage(e,...a){return shared.format(warnMessages[e],...a)}function createI18nError(e,...a){return coreBase.createCompileError(e,null,{messages:errorMessages,args:a})}const errorMessages={14:"Unexpected return type in composer",15:"Invalid argument",16:"Must be called at the top of a `setup` function",17:"Need to install with `app.use` function",22:"Unexpected error",18:"Not available in legacy mode",19:"Required in value: {0}",20:"Invalid value",21:"Cannot setup vue-devtools plugin"},DEVTOOLS_META="__INTLIFY_META__",TransrateVNodeSymbol=shared.makeSymbol("__transrateVNode"),DatetimePartsSymbol=shared.makeSymbol("__datetimeParts"),NumberPartsSymbol=shared.makeSymbol("__numberParts"),EnableEmitter=shared.makeSymbol("__enableEmitter"),DisableEmitter=shared.makeSymbol("__disableEmitter"),SetPluralRulesSymbol=shared.makeSymbol("__setPluralRules");shared.makeSymbol("__intlifyMeta");let composerID=0;function defineCoreMissingHandler(e){return(a,t,r,s)=>e(t,r,vue.getCurrentInstance()||void 0,s)}function getLocaleMessages(e,a){const{messages:t,__i18n:r}=a,s=shared.isPlainObject(t)?t:shared.isArray(r)?{}:{[e]:{}};if(shared.isArray(r)&&r.forEach(({locale:e,resource:a})=>{e?(s[e]=s[e]||{},deepCopy(a,s[e])):deepCopy(a,s)}),a.flatJson)for(const e in s)shared.hasOwn(s,e)&&coreBase.handleFlatJson(s[e]);return s}const isNotObjectOrIsArray=e=>!shared.isObject(e)||shared.isArray(e);function deepCopy(e,a){if(isNotObjectOrIsArray(e)||isNotObjectOrIsArray(a))throw createI18nError(20);for(const t in e)shared.hasOwn(e,t)&&(isNotObjectOrIsArray(e[t])||isNotObjectOrIsArray(a[t])?a[t]=e[t]:deepCopy(e[t],a[t]))}const getMetaInfo=()=>{const e=vue.getCurrentInstance();return e&&e.type[DEVTOOLS_META]?{[DEVTOOLS_META]:e.type[DEVTOOLS_META]}:null};function createComposer(e={}){const{__root:a}=e,t=void 0===a;let r=!shared.isBoolean(e.inheritLocale)||e.inheritLocale;const s=vue.ref(a&&r?a.locale.value:shared.isString(e.locale)?e.locale:"en-US"),n=vue.ref(a&&r?a.fallbackLocale.value:shared.isString(e.fallbackLocale)||shared.isArray(e.fallbackLocale)||shared.isPlainObject(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:s.value),o=vue.ref(getLocaleMessages(s.value,e)),l=vue.ref(shared.isPlainObject(e.datetimeFormats)?e.datetimeFormats:{[s.value]:{}}),i=vue.ref(shared.isPlainObject(e.numberFormats)?e.numberFormats:{[s.value]:{}});let c=a?a.missingWarn:!shared.isBoolean(e.missingWarn)&&!shared.isRegExp(e.missingWarn)||e.missingWarn,u=a?a.fallbackWarn:!shared.isBoolean(e.fallbackWarn)&&!shared.isRegExp(e.fallbackWarn)||e.fallbackWarn,m=a?a.fallbackRoot:!shared.isBoolean(e.fallbackRoot)||e.fallbackRoot,g=!!e.fallbackFormat,d=shared.isFunction(e.missing)?e.missing:null,b=shared.isFunction(e.missing)?defineCoreMissingHandler(e.missing):null,p=shared.isFunction(e.postTranslation)?e.postTranslation:null,h=!shared.isBoolean(e.warnHtmlMessage)||e.warnHtmlMessage,f=!!e.escapeParameter;const _=a?a.modifiers:shared.isPlainObject(e.modifiers)?e.modifiers:{};let v,y=e.pluralRules||a&&a.pluralRules;v=coreBase.createCoreContext({version:VERSION,locale:s.value,fallbackLocale:n.value,messages:o.value,datetimeFormats:l.value,numberFormats:i.value,modifiers:_,pluralRules:y,missing:null===b?void 0:b,missingWarn:c,fallbackWarn:u,fallbackFormat:g,unresolving:!0,postTranslation:null===p?void 0:p,warnHtmlMessage:h,escapeParameter:f,__datetimeFormatters:shared.isPlainObject(v)?v.__datetimeFormatters:void 0,__numberFormatters:shared.isPlainObject(v)?v.__numberFormatters:void 0,__v_emitter:shared.isPlainObject(v)?v.__v_emitter:void 0,__meta:{framework:"vue"}}),coreBase.updateFallbackLocale(v,s.value,n.value);const F=vue.computed({get:()=>s.value,set:e=>{s.value=e,v.locale=s.value}}),k=vue.computed({get:()=>n.value,set:e=>{n.value=e,v.fallbackLocale=n.value,coreBase.updateFallbackLocale(v,s.value,e)}}),M=vue.computed(()=>o.value),I=vue.computed(()=>l.value),S=vue.computed(()=>i.value);function O(e,t,r,g,d,b){let p;s.value,n.value,o.value,l.value,i.value;try{coreBase.setAdditionalMeta(getMetaInfo()),p=e(v)}finally{coreBase.setAdditionalMeta(null)}if(shared.isNumber(p)&&p===coreBase.NOT_REOSLVED){const[e,s]=t();if(a&&shared.isString(e)&&("translate"!==r||0==!!s.resolvedMessage)){m&&(coreBase.isTranslateFallbackWarn(u,e)||coreBase.isTranslateMissingWarn(c,e))&&shared.warn(getWarnMessage(6,{key:e,type:r}));{const{__v_emitter:a}=v;a&&m&&a.emit("fallback",{type:r,key:e,to:"global",groupId:`${r}:${e}`})}}return a&&m?g(a):d(e)}if(b(p))return p;throw createI18nError(14)}function E(...e){return O(a=>coreBase.translate(a,...e),()=>coreBase.parseTranslateArgs(...e),"translate",a=>a.t(...e),e=>e,e=>shared.isString(e))}const T={normalize:function(e){return e.map(e=>shared.isString(e)?vue.createVNode(vue.Text,null,e,0):e)},interpolate:e=>e,type:"vnode"};function L(e){return o.value[e]||{}}composerID++,a&&(vue.watch(a.locale,e=>{r&&(s.value=e,v.locale=e,coreBase.updateFallbackLocale(v,s.value,n.value))}),vue.watch(a.fallbackLocale,e=>{r&&(n.value=e,v.fallbackLocale=e,coreBase.updateFallbackLocale(v,s.value,n.value))}));const N={id:composerID,locale:F,fallbackLocale:k,get inheritLocale(){return r},set inheritLocale(e){r=e,e&&a&&(s.value=a.locale.value,n.value=a.fallbackLocale.value,coreBase.updateFallbackLocale(v,s.value,n.value))},get availableLocales(){return Object.keys(o.value).sort()},messages:M,datetimeFormats:I,numberFormats:S,get modifiers(){return _},get pluralRules(){return y||{}},get isGlobal(){return t},get missingWarn(){return c},set missingWarn(e){c=e,v.missingWarn=c},get fallbackWarn(){return u},set fallbackWarn(e){u=e,v.fallbackWarn=u},get fallbackRoot(){return m},set fallbackRoot(e){m=e},get fallbackFormat(){return g},set fallbackFormat(e){g=e,v.fallbackFormat=g},get warnHtmlMessage(){return h},set warnHtmlMessage(e){h=e,v.warnHtmlMessage=e},get escapeParameter(){return f},set escapeParameter(e){f=e,v.escapeParameter=e},t:E,rt:function(...e){const[a,t,r]=e;if(r&&!shared.isObject(r))throw createI18nError(15);return E(...[a,t,shared.assign({resolvedMessage:!0},r||{})])},d:function(...e){return O(a=>coreBase.datetime(a,...e),()=>coreBase.parseDateTimeArgs(...e),"datetime format",a=>a.d(...e),()=>coreBase.MISSING_RESOLVE_VALUE,e=>shared.isString(e))},n:function(...e){return O(a=>coreBase.number(a,...e),()=>coreBase.parseNumberArgs(...e),"number format",a=>a.n(...e),()=>coreBase.MISSING_RESOLVE_VALUE,e=>shared.isString(e))},te:function(e,a){const t=L(shared.isString(a)?a:s.value);return null!==coreBase.resolveValue(t,e)},tm:function(e){const t=function(e){let a=null;const t=coreBase.getLocaleChain(v,n.value,s.value);for(let r=0;r<t.length;r++){const s=o.value[t[r]]||{},n=coreBase.resolveValue(s,e);if(null!=n){a=n;break}}return a}(e);return null!=t?t:a&&a.tm(e)||{}},getLocaleMessage:L,setLocaleMessage:function(e,a){o.value[e]=a,v.messages=o.value},mergeLocaleMessage:function(e,a){o.value[e]=o.value[e]||{},deepCopy(a,o.value[e]),v.messages=o.value},getDateTimeFormat:function(e){return l.value[e]||{}},setDateTimeFormat:function(e,a){l.value[e]=a,v.datetimeFormats=l.value,coreBase.clearDateTimeFormat(v,e,a)},mergeDateTimeFormat:function(e,a){l.value[e]=shared.assign(l.value[e]||{},a),v.datetimeFormats=l.value,coreBase.clearDateTimeFormat(v,e,a)},getNumberFormat:function(e){return i.value[e]||{}},setNumberFormat:function(e,a){i.value[e]=a,v.numberFormats=i.value,coreBase.clearNumberFormat(v,e,a)},mergeNumberFormat:function(e,a){i.value[e]=shared.assign(i.value[e]||{},a),v.numberFormats=i.value,coreBase.clearNumberFormat(v,e,a)},getPostTranslationHandler:function(){return shared.isFunction(p)?p:null},setPostTranslationHandler:function(e){p=e,v.postTranslation=e},getMissingHandler:function(){return d},setMissingHandler:function(e){null!==e&&(b=defineCoreMissingHandler(e)),d=e,v.missing=b},[TransrateVNodeSymbol]:function(...e){return O(a=>{let t;const r=a;try{r.processor=T,t=coreBase.translate(r,...e)}finally{r.processor=null}return t},()=>coreBase.parseTranslateArgs(...e),"translate",a=>a[TransrateVNodeSymbol](...e),e=>[vue.createVNode(vue.Text,null,e,0)],e=>shared.isArray(e))},[NumberPartsSymbol]:function(...e){return O(a=>coreBase.number(a,...e),()=>coreBase.parseNumberArgs(...e),"number format",a=>a[NumberPartsSymbol](...e),()=>[],e=>shared.isString(e)||shared.isArray(e))},[DatetimePartsSymbol]:function(...e){return O(a=>coreBase.datetime(a,...e),()=>coreBase.parseDateTimeArgs(...e),"datetime format",a=>a[DatetimePartsSymbol](...e),()=>[],e=>shared.isString(e)||shared.isArray(e))},[SetPluralRulesSymbol]:function(e){y=e,v.pluralRules=y}};return N[EnableEmitter]=(e=>{v.__v_emitter=e}),N[DisableEmitter]=(()=>{v.__v_emitter=void 0}),N}function convertComposerOptions(e){const a=shared.isString(e.locale)?e.locale:"en-US",t=shared.isString(e.fallbackLocale)||shared.isArray(e.fallbackLocale)||shared.isPlainObject(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:a,r=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,o=!shared.isBoolean(e.fallbackRoot)||e.fallbackRoot,l=!!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,g=!!e.escapeParameterHtml,d=!shared.isBoolean(e.sync)||e.sync;e.formatter&&shared.warn(getWarnMessage(8)),e.preserveDirectiveContent&&shared.warn(getWarnMessage(9));let b=e.messages;if(shared.isPlainObject(e.sharedMessages)){const a=e.sharedMessages;b=Object.keys(a).reduce((e,t)=>{const r=e[t]||(e[t]={});return shared.assign(r,a[t]),e},b||{})}const{__i18n:p,__root:h}=e,f=e.datetimeFormats,_=e.numberFormats;return{locale:a,fallbackLocale:t,messages:b,flatJson:e.flatJson,datetimeFormats:f,numberFormats:_,missing:r,missingWarn:s,fallbackWarn:n,fallbackRoot:o,fallbackFormat:l,modifiers:i,pluralRules:c,postTranslation:u,warnHtmlMessage:m,escapeParameter:g,inheritLocale:d,__i18n:p,__root:h}}function createVueI18n(e={}){const a=createComposer(convertComposerOptions(e)),t={id:a.id,get locale(){return a.locale.value},set locale(e){a.locale.value=e},get fallbackLocale(){return a.fallbackLocale.value},set fallbackLocale(e){a.fallbackLocale.value=e},get messages(){return a.messages.value},get datetimeFormats(){return a.datetimeFormats.value},get numberFormats(){return a.numberFormats.value},get availableLocales(){return a.availableLocales},get formatter(){return shared.warn(getWarnMessage(8)),{interpolate:()=>[]}},set formatter(e){shared.warn(getWarnMessage(8))},get missing(){return a.getMissingHandler()},set missing(e){a.setMissingHandler(e)},get silentTranslationWarn(){return shared.isBoolean(a.missingWarn)?!a.missingWarn:a.missingWarn},set silentTranslationWarn(e){a.missingWarn=shared.isBoolean(e)?!e:e},get silentFallbackWarn(){return shared.isBoolean(a.fallbackWarn)?!a.fallbackWarn:a.fallbackWarn},set silentFallbackWarn(e){a.fallbackWarn=shared.isBoolean(e)?!e:e},get modifiers(){return a.modifiers},get formatFallbackMessages(){return a.fallbackFormat},set formatFallbackMessages(e){a.fallbackFormat=e},get postTranslation(){return a.getPostTranslationHandler()},set postTranslation(e){a.setPostTranslationHandler(e)},get sync(){return a.inheritLocale},set sync(e){a.inheritLocale=e},get warnHtmlInMessage(){return a.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(e){a.warnHtmlMessage="off"!==e},get escapeParameterHtml(){return a.escapeParameter},set escapeParameterHtml(e){a.escapeParameter=e},get preserveDirectiveContent(){return shared.warn(getWarnMessage(9)),!0},set preserveDirectiveContent(e){shared.warn(getWarnMessage(9))},get pluralizationRules(){return a.pluralRules||{}},__composer:a,t(...e){const[t,r,s]=e,n={};let o=null,l=null;if(!shared.isString(t))throw createI18nError(15);const i=t;return shared.isString(r)?n.locale=r:shared.isArray(r)?o=r:shared.isPlainObject(r)&&(l=r),shared.isArray(s)?o=s:shared.isPlainObject(s)&&(l=s),a.t(i,o||l||{},n)},rt:(...e)=>a.rt(...e),tc(...e){const[t,r,s]=e,n={plural:1};let o=null,l=null;if(!shared.isString(t))throw createI18nError(15);const i=t;return shared.isString(r)?n.locale=r:shared.isNumber(r)?n.plural=r:shared.isArray(r)?o=r:shared.isPlainObject(r)&&(l=r),shared.isString(s)?n.locale=s:shared.isArray(s)?o=s:shared.isPlainObject(s)&&(l=s),a.t(i,o||l||{},n)},te:(e,t)=>a.te(e,t),tm:e=>a.tm(e),getLocaleMessage:e=>a.getLocaleMessage(e),setLocaleMessage(e,t){a.setLocaleMessage(e,t)},mergeLocaleMessage(e,t){a.mergeLocaleMessage(e,t)},d:(...e)=>a.d(...e),getDateTimeFormat:e=>a.getDateTimeFormat(e),setDateTimeFormat(e,t){a.setDateTimeFormat(e,t)},mergeDateTimeFormat(e,t){a.mergeDateTimeFormat(e,t)},n:(...e)=>a.n(...e),getNumberFormat:e=>a.getNumberFormat(e),setNumberFormat(e,t){a.setNumberFormat(e,t)},mergeNumberFormat(e,t){a.mergeNumberFormat(e,t)},getChoiceIndex:(e,a)=>(shared.warn(getWarnMessage(10)),-1),__onComponentInstanceCreated(a){const{componentInstanceCreatedListener:r}=e;r&&r(a,t)},__enableEmitter:e=>{const t=a;t[EnableEmitter]&&t[EnableEmitter](e)},__disableEmitter:()=>{const e=a;e[DisableEmitter]&&e[DisableEmitter]()}};return t}const baseFormatProps={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>"parent"===e||"global"===e,default:"parent"},i18n:{type:Object}},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(e,a){const{slots:t,attrs:r}=a,s=e.i18n||useI18n({useScope:e.scope}),n=Object.keys(t).filter(e=>"_"!==e);return()=>{const t={};e.locale&&(t.locale=e.locale),void 0!==e.plural&&(t.plural=shared.isString(e.plural)?+e.plural:e.plural);const o=getInterpolateArg(a,n),l=s[TransrateVNodeSymbol](e.keypath,o,t),i=shared.assign({},r);return shared.isString(e.tag)?vue.h(e.tag,i,l):shared.isObject(e.tag)?vue.h(e.tag,i,l):vue.h(vue.Fragment,i,l)}}};function getInterpolateArg({slots:e},a){return 1===a.length&&"default"===a[0]?e.default?e.default():[]:a.reduce((a,t)=>{const r=e[t];return r&&(a[t]=r()),a},{})}function renderFormatter(e,a,t,r){const{slots:s,attrs:n}=a;return()=>{const a={part:!0};let o={};e.locale&&(a.locale=e.locale),shared.isString(e.format)?a.key=e.format:shared.isObject(e.format)&&(shared.isString(e.format.key)&&(a.key=e.format.key),o=Object.keys(e.format).reduce((a,r)=>t.includes(r)?shared.assign({},a,{[r]:e.format[r]}):a,{}));const l=r(...[e.value,a,o]);let i=[a.key];shared.isArray(l)?i=l.map((e,a)=>{const t=s[e.type];return t?t({[e.type]:e.value,index:a,parts:l}):[e.value]}):shared.isString(l)&&(i=[l]);const c=shared.assign({},n);return shared.isString(e.tag)?vue.h(e.tag,c,i):shared.isObject(e.tag)?vue.h(e.tag,c,i):vue.h(vue.Fragment,c,i)}}const NUMBER_FORMAT_KEYS=["localeMatcher","style","unit","unitDisplay","currency","currencyDisplay","useGrouping","numberingSystem","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","notation","formatMatcher"],NumberFormat={name:"i18n-n",props:shared.assign({value:{type:Number,required:!0},format:{type:[String,Object]}},baseFormatProps),setup(e,a){const t=e.i18n||useI18n({useScope:"parent"});return renderFormatter(e,a,NUMBER_FORMAT_KEYS,(...e)=>t[NumberPartsSymbol](...e))}},DATETIME_FORMAT_KEYS=["dateStyle","timeStyle","fractionalSecondDigits","calendar","dayPeriod","numberingSystem","localeMatcher","timeZone","hour12","hourCycle","formatMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName"],DatetimeFormat={name:"i18n-d",props:shared.assign({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},baseFormatProps),setup(e,a){const t=e.i18n||useI18n({useScope:"parent"});return renderFormatter(e,a,DATETIME_FORMAT_KEYS,(...e)=>t[DatetimePartsSymbol](...e))}};function getComposer$1(e,a){const t=e;if("composition"===e.mode)return t.__getInstance(a)||e.global;{const r=t.__getInstance(a);return null!=r?r.__composer:e.global.__composer}}function vTDirective(e){const a=(a,{instance:t,value:r,modifiers:s})=>{if(!t||!t.$)throw createI18nError(22);const n=getComposer$1(e,t.$);s.preserve&&shared.warn(getWarnMessage(7));const o=parseValue(r);a.textContent=n.t(...makeParams(o))};return{beforeMount:a,beforeUpdate:a}}function parseValue(e){if(shared.isString(e))return{path:e};if(shared.isPlainObject(e)){if(!("path"in e))throw createI18nError(19,"path");return e}throw createI18nError(20)}function makeParams(e){const{path:a,locale:t,args:r,choice:s,plural:n}=e,o={},l=r||{};return shared.isString(t)&&(o.locale=t),shared.isNumber(s)&&(o.plural=s),shared.isNumber(n)&&(o.plural=n),[a,l,o]}function apply(e,a,...t){const r=shared.isPlainObject(t[0])?t[0]:{},s=!!r.useI18nComponentName,n=!shared.isBoolean(r.globalInstall)||r.globalInstall;n&&s&&shared.warn(getWarnMessage(11,{name:Translation.name})),n&&(e.component(s?"i18n":Translation.name,Translation),e.component(NumberFormat.name,NumberFormat),e.component(DatetimeFormat.name,DatetimeFormat)),e.directive("t",vTDirective(a))}function defineMixin(e,a,t){return{beforeCreate(){const r=vue.getCurrentInstance();if(!r)throw createI18nError(22);const s=this.$options;if(s.i18n){const t=s.i18n;s.__i18n&&(t.__i18n=s.__i18n),t.__root=a,this===this.$root?this.$i18n=mergeToRoot(e,t):this.$i18n=createVueI18n(t)}else s.__i18n?this===this.$root?this.$i18n=mergeToRoot(e,s):this.$i18n=createVueI18n({__i18n:s.__i18n,__root:a}):this.$i18n=e;e.__onComponentInstanceCreated(this.$i18n),t.__setInstance(r,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(){},beforeUnmount(){const e=vue.getCurrentInstance();if(!e)throw createI18nError(22);delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,t.__deleteInstance(e),delete this.$i18n}}}function mergeToRoot(e,a){e.locale=a.locale||e.locale,e.fallbackLocale=a.fallbackLocale||e.fallbackLocale,e.missing=a.missing||e.missing,e.silentTranslationWarn=a.silentTranslationWarn||e.silentFallbackWarn,e.silentFallbackWarn=a.silentFallbackWarn||e.silentFallbackWarn,e.formatFallbackMessages=a.formatFallbackMessages||e.formatFallbackMessages,e.postTranslation=a.postTranslation||e.postTranslation,e.warnHtmlInMessage=a.warnHtmlInMessage||e.warnHtmlInMessage,e.escapeParameterHtml=a.escapeParameterHtml||e.escapeParameterHtml,e.sync=a.sync||e.sync,e.__composer[SetPluralRulesSymbol](a.pluralizationRules||e.pluralizationRules);const t=getLocaleMessages(e.locale,{messages:a.messages,__i18n:a.__i18n});return Object.keys(t).forEach(a=>e.mergeLocaleMessage(a,t[a])),a.datetimeFormats&&Object.keys(a.datetimeFormats).forEach(t=>e.mergeDateTimeFormat(t,a.datetimeFormats[t])),a.numberFormats&&Object.keys(a.numberFormats).forEach(t=>e.mergeNumberFormat(t,a.numberFormats[t])),e}function createI18n(e={}){const a=!shared.isBoolean(e.legacy)||e.legacy,t=!!e.globalInjection,r=new Map,s=a?createVueI18n(e):createComposer(e),n=shared.makeSymbol("vue-i18n"),o={get mode(){return a?"legacy":"composition"},async install(e,...r){e.__VUE_I18N_SYMBOL__=n,e.provide(e.__VUE_I18N_SYMBOL__,o),!a&&t&&injectGlobalFields(e,o.global),apply(e,o,...r),a&&e.mixin(defineMixin(s,s.__composer,o))},get global(){return s},__instances:r,__getInstance:e=>r.get(e)||null,__setInstance(e,a){r.set(e,a)},__deleteInstance(e){r.delete(e)}};return o}function useI18n(e={}){const a=vue.getCurrentInstance();if(null==a)throw createI18nError(16);if(!a.appContext.app.__VUE_I18N_SYMBOL__)throw createI18nError(17);const t=vue.inject(a.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw createI18nError(22);const r="composition"===t.mode?t.global:t.global.__composer,s=shared.isEmptyObject(e)?"__i18n"in a.type?"local":"global":e.useScope?e.useScope:"local";if("global"===s){let t=shared.isObject(e.messages)?e.messages:{};"__i18nGlobal"in a.type&&(t=getLocaleMessages(r.locale.value,{messages:t,__i18n:a.type.__i18nGlobal}));const s=Object.keys(t);if(s.length&&s.forEach(e=>{r.mergeLocaleMessage(e,t[e])}),shared.isObject(e.datetimeFormats)){const a=Object.keys(e.datetimeFormats);a.length&&a.forEach(a=>{r.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(shared.isObject(e.numberFormats)){const a=Object.keys(e.numberFormats);a.length&&a.forEach(a=>{r.mergeNumberFormat(a,e.numberFormats[a])})}return r}if("parent"===s){let e=getComposer(t,a);return null==e&&(shared.warn(getWarnMessage(12)),e=r),e}if("legacy"===t.mode)throw createI18nError(18);const n=t;let o=n.__getInstance(a);if(null==o){const t=a.type,s=shared.assign({},e);t.__i18n&&(s.__i18n=t.__i18n),r&&(s.__root=r),o=createComposer(s),setupLifeCycle(n,a),n.__setInstance(a,o)}return o}function getComposer(e,a){let t=null;const r=a.root;let s=a.parent;for(;null!=s;){const a=e;if("composition"===e.mode)t=a.__getInstance(s);else{const e=a.__getInstance(s);null!=e&&(t=e.__composer)}if(null!=t)break;if(r===s)break;s=s.parent}return t}function setupLifeCycle(e,a,t){vue.onMounted(()=>{},a),vue.onUnmounted(()=>{e.__deleteInstance(a)},a)}const globalExportProps=["locale","fallbackLocale","availableLocales"],globalExportMethods=["t","rt","d","n","tm"];function injectGlobalFields(e,a){const t=Object.create(null);globalExportProps.forEach(e=>{const r=Object.getOwnPropertyDescriptor(a,e);if(!r)throw createI18nError(22);const s=vue.isRef(r.value)?{get:()=>r.value.value,set(e){r.value.value=e}}:{get:()=>r.get&&r.get()};Object.defineProperty(t,e,s)}),e.config.globalProperties.$i18n=t,globalExportMethods.forEach(t=>{const r=Object.getOwnPropertyDescriptor(a,t);if(!r||!r.value)throw createI18nError(22);Object.defineProperty(e.config.globalProperties,`$${t}`,r)})}coreBase.registerMessageCompiler(coreBase.compileToFunction);{const e=shared.getGlobalThis();e.__INTLIFY__=!0,coreBase.setDevToolsHook(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}exports.DatetimeFormat=DatetimeFormat,exports.NumberFormat=NumberFormat,exports.Translation=Translation,exports.VERSION=VERSION,exports.createI18n=createI18n,exports.useI18n=useI18n,exports.vTDirective=vTDirective;