var cx_libtranslate=(()=>{var a=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var f=a(y=>{var c=class{#e;translated;constructor(e,t=!0){if(typeof e!="string")throw new TypeError("Translated content must be string.");if(typeof t!="boolean")throw new TypeError("Result of translation must be boolean.");this.#e=e,this.translated=t}toString(){return this.#e}get text(){return this.#e}get valid(){return this.translated}};y.translation=c});var l=a(k=>{var h=f().translation,p=class o{#e;#t;constructor(e,t=null){if(!(e instanceof Map))throw new TypeError("Phrases must an map.");if(t!==null&&typeof t!="object")throw new TypeError("Objects must be null or object.");this.#e=e,this.#t=t}translate(e){return this.#r(e)?this.#s(e):this.#o(e)}get(e){return this.translate(e)}#r(e){return e.indexOf(".")!==-1}#s(e){if(this.#t===null)return this.#o(e);let t=e.trim().split("."),r=this.#t;for(let s in t)if(!(s in r))return new h(e,!1);return typeof r!="string"?new h(e,!1):new h(r,!0)}#o(e){let t=o.prepare(e),r=this.#e.has(t),s=r?this.#e.get(t):e;return new h(s,r)}static prepare(e){return e.trim().replaceAll(" ","_").replaceAll(".","_").toLowerCase()}};k.phrasebook=p});var u=a(q=>{var g=l().phrasebook,d=class{#e;#t;constructor(e,t=!1){if(typeof e!="string")throw new TypeError("Path of the file must be string.");if(typeof t!="boolean")throw new TypeError("Local must be bool variable.");this.#e=e,this.#t=t}async#r(){let t=await(await fetch(this.#e)).json();return this.#o(t)}async#s(){let e=null;if(e===null)throw new Error("Could not use ndoe:fs in browser.");let t=await e.readFile(this.#e,{encoding:"utf8"}),r=JSON.parse(t);return this.#o(r)}load(){return this.#t?this.#s():this.#r()}#o(e){let t=Object.keys(e);return"objects"in t&&typeof t.objects=="object"?this.#i(e):this.#a(e)}#i(e){let t=Object.keys(e),r={},s={};return"phrases"in t&&(r=e.phrases),"objects"in t&&(s=e.objects),new g(this.#n(r),Object.freeze(s))}#n(e){let t=new Map;return Object.keys(e).forEach(r=>{let s=g.prepare(r),i=e[r];t.set(s,i)}),t}#a(e){return new g(this.#n(e))}};q.loader=d});var b=a(E=>{var j=u().loader,N=l().phrasebook,w=class o{#e;#t;constructor(e){if(typeof e!="string")throw new TypeError("Path to the phrasebooks must be string.");this.#e=e,this.#t=new Map}add(e,t){if(typeof e!="string")throw new TypeError("Name of the language must be sting.");if(typeof t!="string")throw new TypeError("File on in the directory must be string.");return this.#t.has(e)?(console.error('Language "'+e+'" already loaded.'),console.error("It could not being loaded twice."),this):this.#s(e)?(this.#t.set(e,t),this):(console.error('Language name "'+e+'" invalid formated.'),console.error("It could not being loaded."),this)}async load(e){if(typeof e!="string")throw new TypeError("Name of index file is not string.");let r=await(await fetch(this.#r(e))).json(),s=new o(this.#e);return Object.keys(r).forEach(i=>{if(typeof i!="string"){console.error("Name of the language must be string."),console.error("Check languages index."),console.error("Skipping it.");return}typeof r[i]!="string"&&(console.error("Name of phrasebook file must be string."),console.error("Check languages index."),console.error("Skipping it.")),s.add(i,r[i])}),s}has(e){return this.#t.has(e)}get avairable(){let e=new Array;return this.#t.keys().forEach(t=>{e.push(t)}),e}select(e){if(typeof e!="string")throw new TypeError("Name of the language must be string.");if(!this.has(e))throw new RangeError('Not found language "'+e+'".');let t=this.#t.get(e),r=this.#r(t);return new j(r).load()}#r(e){let t="/";return this.#e[this.#e.length-1]===t&&(t=""),this.#e+t+e}#s(e){let t=e.split("_");if(t.length!==2)return!1;let r=t[0],s=t[1];return!(r.toLowerCase()!==r||r.length!==2||s.toUpperCase()!==s||s.length!==2)}};E.languages=w});var m=a((v,n)=>{typeof n<"u"&&n.exports?(n.exports.phrasebook=l().phrasebook,n.exports.loader=u().loader,n.exports.languages=b().languages,n.exports.loader=u().loader):(window.cx_libtranslate={phrasebook:l().phrasebook,loader:u().loader,languages:b().languages,translation:f().translation},window.languages=window.cx_libtranslate.languages)});return m();})(); //# sourceMappingURL=cx-libtranslate.min.js.map