"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@dialpad/i18n-vue2"),u=require("./en-US.cjs"),i=require("./zh-CN.cjs"),d=require("./nl-NL.cjs"),f=require("./fr-FR.cjs"),g=require("./de-DE.cjs"),N=require("./it-IT.cjs"),S=require("./ja-JP.cjs"),L=require("./pt-BR.cjs"),R=require("./ru-RU.cjs"),h=require("./es-LA.cjs"),e="dialtone",r={ENGLISH:"en-US",CHINESE:"zh-CN",DUTCH:"nl-NL",FRENCH:"fr-FR",GERMAN:"de-DE",ITALIAN:"it-IT",JAPANESE:"ja-JP",PORTUGUESE:"pt-BR",RUSSIAN:"ru-RU",SPANISH:"es-LA"},s="en-US";class l{constructor(t=null){if(typeof l.instance=="object")return l.instance;this._locale=t||l.getPreferredLocale();const o=new a.RawBundleSource({resources:a.RawBundleSource.builtResources([["en-US",e,u.default],["zh-CN",e,i.default],["nl-NL",e,d.default],["fr-FR",e,f.default],["de-DE",e,g.default],["it-IT",e,N.default],["ja-JP",e,S.default],["pt-BR",e,L.default],["ru-RU",e,R.default],["es-LA",e,h.default]])});return new a.LocaleManager({bundleSource:o,allowedLocales:Object.values(r),fallbackLocale:s,preferredLocale:this._locale,namespaces:[e]}).install(e),window.onstorage=c=>{c.key==="user-locale"&&(this.currentLocale=c.newValue)},l.instance=this,this}static getPreferredLocale(){const t=localStorage.getItem("user-locale"),o=Object.values(r).find(n=>n.startsWith(navigator.language.slice(0,2)));return t||o||s}static getAllowedLocales(){return r}$t(...t){return a.useI18N(e).$t(...t)}$ta(...t){return a.useI18N(e).$ta(...t)}get currentLocale(){return this._locale}set currentLocale(t){if(t!==this._locale){if(!Object.values(r).includes(t))throw new Error(`Locale ${t} is not allowed, please use one of the following: ${Object.values(r).join(", ")}`);this._locale=t,a.useI18N(e).setI18N({preferredLocale:t},e)}}}exports.DialtoneLocalization=l;
//# sourceMappingURL=index.cjs.map
