var r=Object.defineProperty;var h=(e,s,t)=>s in e?r(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var l=(e,s,t)=>h(e,typeof s!="symbol"?s+"":s,t);class g{constructor(){l(this,"languages",{});l(this,"scripts",[]);l(this,"callbacks",[]);this.loadJson()}loadJson(){const s=[];s.push(this.fetchLang("NexoPOS",ns.langFiles));for(let t in ns.langFiles)t!=="NexoPOS"&&s.push(this.fetchLang(t,ns.langFiles));Promise.all(s).then(()=>{this.loadReadyScripts(),this.loadReadyCallbacks()})}fetchLang(s,t){return new Promise((a,d)=>{const n=new XMLHttpRequest;n.onreadystatechange=i=>{if(i.target.readyState==4&&i.target.status==200){const c=JSON.parse(n.responseText);for(let o in c)this.languages[s]===void 0&&(this.languages[s]=new Object),this.languages[s][o]=c[o];a(this.languages)}},n.open("GET",t[s],!0),n.send()})}loadReadyScripts(){const s=this.scripts;for(let t=0;t<s.length;t++){const a=document.createElement("script");a.type="text/javascript",a.src=s[t],document.body.appendChild(a)}}loadReadyCallbacks(){this.callbacks.forEach(s=>s())}onReadyCallback(s){this.callbacks.push(s)}onReadyScript(s){s.length!==void 0?this.scripts.push(...s):this.scripts.push(s)}getEntries(s){return this.languages[s]||!1}}window.nsLanguage=new g;
