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