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