"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@dialpad/i18n"),u=require("vue"),i=require("./en-US.cjs"),d=require("./zh-CN.cjs"),f=require("./nl-NL.cjs"),g=require("./fr-FR.cjs"),N=require("./de-DE.cjs"),S=require("./it-IT.cjs"),L=require("./ja-JP.cjs"),p=require("./pt-BR.cjs"),R=require("./ru-RU.cjs"),I=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;const o=u.getCurrentInstance().appContext.app;this._locale=t||l.getPreferredLocale();const n=new a.RawBundleSource({resources:a.RawBundleSource.builtResources([["en-US",e,i.default],["zh-CN",e,d.default],["nl-NL",e,f.default],["fr-FR",e,g.default],["de-DE",e,N.default],["it-IT",e,S.default],["ja-JP",e,L.default],["pt-BR",e,p.default],["ru-RU",e,R.default],["es-LA",e,I.default]])});return new a.LocaleManager({bundleSource:n,allowedLocales:Object.values(r),fallbackLocale:s,preferredLocale:this._locale,namespaces:[e]}).install(o,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
