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