livecode-static/livecodes/i18n.40c1bef1752c2532cfe405b0dec2f169.js
2025-06-11 22:23:49 +08:00

3 lines
72 KiB
JavaScript

var it=Object.create;var Te=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var Ce=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ft=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of at(e))!ut.call(r,s)&&s!==t&&Te(r,s,{get:()=>e[s],enumerable:!(n=ot(e,s))||n.enumerable});return r};var ct=(r,e,t)=>(t=r!=null?it(lt(r)):{},ft(e||!r||!r.__esModule?Te(t,"default",{value:r,enumerable:!0}):t,r));var _e=Re((D,Ke)=>{var se=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,ie=function(){function r(){this.fetch=!1,this.DOMException=se.DOMException}return r.prototype=se,new r}();(function(r){var e=function(t){var n=typeof r<"u"&&r||typeof self<"u"&&self||typeof n<"u"&&n,s={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function i(u){return u&&DataView.prototype.isPrototypeOf(u)}if(s.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(u){return u&&o.indexOf(Object.prototype.toString.call(u))>-1};function l(u){if(typeof u!="string"&&(u=String(u)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(u)||u==="")throw new TypeError('Invalid character in header field name: "'+u+'"');return u.toLowerCase()}function c(u){return typeof u!="string"&&(u=String(u)),u}function f(u){var p={next:function(){var y=u.shift();return{done:y===void 0,value:y}}};return s.iterable&&(p[Symbol.iterator]=function(){return p}),p}function h(u){this.map={},u instanceof h?u.forEach(function(p,y){this.append(y,p)},this):Array.isArray(u)?u.forEach(function(p){this.append(p[0],p[1])},this):u&&Object.getOwnPropertyNames(u).forEach(function(p){this.append(p,u[p])},this)}h.prototype.append=function(u,p){u=l(u),p=c(p);var y=this.map[u];this.map[u]=y?y+", "+p:p},h.prototype.delete=function(u){delete this.map[l(u)]},h.prototype.get=function(u){return u=l(u),this.has(u)?this.map[u]:null},h.prototype.has=function(u){return this.map.hasOwnProperty(l(u))},h.prototype.set=function(u,p){this.map[l(u)]=c(p)},h.prototype.forEach=function(u,p){for(var y in this.map)this.map.hasOwnProperty(y)&&u.call(p,this.map[y],y,this)},h.prototype.keys=function(){var u=[];return this.forEach(function(p,y){u.push(y)}),f(u)},h.prototype.values=function(){var u=[];return this.forEach(function(p){u.push(p)}),f(u)},h.prototype.entries=function(){var u=[];return this.forEach(function(p,y){u.push([y,p])}),f(u)},s.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function d(u){if(u.bodyUsed)return Promise.reject(new TypeError("Already read"));u.bodyUsed=!0}function g(u){return new Promise(function(p,y){u.onload=function(){p(u.result)},u.onerror=function(){y(u.error)}})}function m(u){var p=new FileReader,y=g(p);return p.readAsArrayBuffer(u),y}function w(u){var p=new FileReader,y=g(p);return p.readAsText(u),y}function O(u){for(var p=new Uint8Array(u),y=new Array(p.length),v=0;v<p.length;v++)y[v]=String.fromCharCode(p[v]);return y.join("")}function R(u){if(u.slice)return u.slice(0);var p=new Uint8Array(u.byteLength);return p.set(new Uint8Array(u)),p.buffer}function T(){return this.bodyUsed=!1,this._initBody=function(u){this.bodyUsed=this.bodyUsed,this._bodyInit=u,u?typeof u=="string"?this._bodyText=u:s.blob&&Blob.prototype.isPrototypeOf(u)?this._bodyBlob=u:s.formData&&FormData.prototype.isPrototypeOf(u)?this._bodyFormData=u:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(u)?this._bodyText=u.toString():s.arrayBuffer&&s.blob&&i(u)?(this._bodyArrayBuffer=R(u.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(u)||a(u))?this._bodyArrayBuffer=R(u):this._bodyText=u=Object.prototype.toString.call(u):this._bodyText="",this.headers.get("content-type")||(typeof u=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(u)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var u=d(this);if(u)return u;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var u=d(this);return u||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(m)}),this.text=function(){var u=d(this);if(u)return u;if(this._bodyBlob)return w(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(O(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(N)}),this.json=function(){return this.text().then(JSON.parse)},this}var H=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function L(u){var p=u.toUpperCase();return H.indexOf(p)>-1?p:u}function P(u,p){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');p=p||{};var y=p.body;if(u instanceof P){if(u.bodyUsed)throw new TypeError("Already read");this.url=u.url,this.credentials=u.credentials,p.headers||(this.headers=new h(u.headers)),this.method=u.method,this.mode=u.mode,this.signal=u.signal,!y&&u._bodyInit!=null&&(y=u._bodyInit,u.bodyUsed=!0)}else this.url=String(u);if(this.credentials=p.credentials||this.credentials||"same-origin",(p.headers||!this.headers)&&(this.headers=new h(p.headers)),this.method=L(p.method||this.method||"GET"),this.mode=p.mode||this.mode||null,this.signal=p.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&y)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(y),(this.method==="GET"||this.method==="HEAD")&&(p.cache==="no-store"||p.cache==="no-cache")){var v=/([?&])_=[^&]*/;if(v.test(this.url))this.url=this.url.replace(v,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function N(u){var p=new FormData;return u.trim().split("&").forEach(function(y){if(y){var v=y.split("="),S=v.shift().replace(/\+/g," "),b=v.join("=").replace(/\+/g," ");p.append(decodeURIComponent(S),decodeURIComponent(b))}}),p}function C(u){var p=new h,y=u.replace(/\r?\n[\t ]+/g," ");return y.split("\r").map(function(v){return v.indexOf(`
`)===0?v.substr(1,v.length):v}).forEach(function(v){var S=v.split(":"),b=S.shift().trim();if(b){var M=S.join(":").trim();p.append(b,M)}}),p}T.call(P.prototype);function j(u,p){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');p||(p={}),this.type="default",this.status=p.status===void 0?200:p.status,this.ok=this.status>=200&&this.status<300,this.statusText=p.statusText===void 0?"":""+p.statusText,this.headers=new h(p.headers),this.url=p.url||"",this._initBody(u)}T.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},j.error=function(){var u=new j(null,{status:0,statusText:""});return u.type="error",u};var ue=[301,302,303,307,308];j.redirect=function(u,p){if(ue.indexOf(p)===-1)throw new RangeError("Invalid status code");return new j(null,{status:p,headers:{location:u}})},t.DOMException=n.DOMException;try{new t.DOMException}catch{t.DOMException=function(p,y){this.message=p,this.name=y;var v=Error(p);this.stack=v.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function U(u,p){return new Promise(function(y,v){var S=new P(u,p);if(S.signal&&S.signal.aborted)return v(new t.DOMException("Aborted","AbortError"));var b=new XMLHttpRequest;function M(){b.abort()}b.onload=function(){var E={status:b.status,statusText:b.statusText,headers:C(b.getAllResponseHeaders()||"")};E.url="responseURL"in b?b.responseURL:E.headers.get("X-Request-URL");var k="response"in b?b.response:b.responseText;setTimeout(function(){y(new j(k,E))},0)},b.onerror=function(){setTimeout(function(){v(new TypeError("Network request failed"))},0)},b.ontimeout=function(){setTimeout(function(){v(new TypeError("Network request failed"))},0)},b.onabort=function(){setTimeout(function(){v(new t.DOMException("Aborted","AbortError"))},0)};function A(E){try{return E===""&&n.location.href?n.location.href:E}catch{return E}}b.open(S.method,A(S.url),!0),S.credentials==="include"?b.withCredentials=!0:S.credentials==="omit"&&(b.withCredentials=!1),"responseType"in b&&(s.blob?b.responseType="blob":s.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(b.responseType="arraybuffer")),p&&typeof p.headers=="object"&&!(p.headers instanceof h)?Object.getOwnPropertyNames(p.headers).forEach(function(E){b.setRequestHeader(E,c(p.headers[E]))}):S.headers.forEach(function(E,k){b.setRequestHeader(k,E)}),S.signal&&(S.signal.addEventListener("abort",M),b.onreadystatechange=function(){b.readyState===4&&S.signal.removeEventListener("abort",M)}),b.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return U.polyfill=!0,n.fetch||(n.fetch=U,n.Headers=h,n.Request=P,n.Response=j),t.Headers=h,t.Request=P,t.Response=j,t.fetch=U,t}({})})(ie);ie.fetch.ponyfill=!0;delete ie.fetch.polyfill;var _=se.fetch?se:ie;D=_.fetch;D.default=_.fetch;D.fetch=_.fetch;D.Headers=_.Headers;D.Request=_.Request;D.Response=_.Response;Ke.exports=D});var ze=Re((we,qe)=>{var oe;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?oe=global.fetch:typeof window<"u"&&window.fetch?oe=window.fetch:oe=fetch);typeof Ce<"u"&&typeof window>"u"&&(W=oe||_e(),W.default&&(W=W.default),we.default=W,qe.exports=we.default);var W});var dt={type:"logger",log(r){this.output("log",r)},warn(r){this.output("warn",r)},error(r){this.output("error",r)},output(r,e){console&&console[r]&&console[r].apply(console,e)}},de=class r{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||dt,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,s){return s&&!this.debug?null:(typeof e[0]=="string"&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new r(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new r(this.logger,e)}},$=new de,K=class{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);let s=this.observers[n].get(t)||0;this.observers[n].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(o=>{let[a,l]=o;for(let c=0;c<l;c++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[a,l]=o;for(let c=0;c<l;c++)a.apply(a,[e,...n])})}},z=()=>{let r,e,t=new Promise((n,s)=>{r=n,e=s});return t.resolve=r,t.reject=e,t},je=r=>r==null?"":""+r,ht=(r,e,t)=>{r.forEach(n=>{e[n]&&(t[n]=e[n])})},pt=/###/g,Ae=r=>r&&r.indexOf("###")>-1?r.replace(pt,"."):r,Ne=r=>!r||typeof r=="string",J=(r,e,t)=>{let n=typeof e!="string"?e:e.split("."),s=0;for(;s<n.length-1;){if(Ne(r))return{};let i=Ae(n[s]);!r[i]&&t&&(r[i]=new t),Object.prototype.hasOwnProperty.call(r,i)?r=r[i]:r={},++s}return Ne(r)?{}:{obj:r,k:Ae(n[s])}},ke=(r,e,t)=>{let{obj:n,k:s}=J(r,e,Object);if(n!==void 0||e.length===1){n[s]=t;return}let i=e[e.length-1],o=e.slice(0,e.length-1),a=J(r,o,Object);for(;a.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),a=J(r,o,Object),a&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=t},gt=(r,e,t,n)=>{let{obj:s,k:i}=J(r,e,Object);s[i]=s[i]||[],s[i].push(t)},Y=(r,e)=>{let{obj:t,k:n}=J(r,e);if(t)return t[n]},mt=(r,e,t)=>{let n=Y(r,t);return n!==void 0?n:Y(e,t)},He=(r,e,t)=>{for(let n in e)n!=="__proto__"&&n!=="constructor"&&(n in r?typeof r[n]=="string"||r[n]instanceof String||typeof e[n]=="string"||e[n]instanceof String?t&&(r[n]=e[n]):He(r[n],e[n],t):r[n]=e[n]);return r},B=r=>r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),yt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},bt=r=>typeof r=="string"?r.replace(/[&<>"'\/]/g,e=>yt[e]):r,he=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},vt=[" ",",","?","!",";"],xt=new he(20),wt=(r,e,t)=>{e=e||"",t=t||"";let n=vt.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(n.length===0)return!0;let s=xt.getRegExp(`(${n.map(o=>o==="?"?"\\?":o).join("|")})`),i=!s.test(r);if(!i){let o=r.indexOf(t);o>0&&!s.test(r.substring(0,o))&&(i=!0)}return i},pe=function(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!r)return;if(r[e])return r[e];let n=e.split(t),s=r;for(let i=0;i<n.length;){if(!s||typeof s!="object")return;let o,a="";for(let l=i;l<n.length;++l)if(l!==i&&(a+=t),a+=n[l],o=s[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<n.length-1)continue;i+=l-i+1;break}s=o}return s},Z=r=>r&&r.indexOf("_")>0?r.replace("_","-"):r,ee=class extends K{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure,a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],n&&(Array.isArray(n)?a.push(...n):typeof n=="string"&&i?a.push(...n.split(i)):a.push(n)));let l=Y(this.data,a);return!l&&!t&&!n&&e.indexOf(".")>-1&&(e=a[0],t=a[1],n=a.slice(2).join(".")),l||!o||typeof n!="string"?l:pe(this.data&&this.data[e]&&this.data[e][t],n,i)}addResource(e,t,n,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."),s=t,t=a[1]),this.addNamespaces(t),ke(this.data,a,s),i.silent||this.emit("added",e,t,n,s)}addResources(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(let i in n)(typeof n[i]=="string"||Array.isArray(n[i]))&&this.addResource(e,t,i,n[i],{silent:!0});s.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),s=n,n=t,t=a[1]),this.addNamespaces(t);let l=Y(this.data,a)||{};o.skipCopy||(n=JSON.parse(JSON.stringify(n))),s?He(l,n,i):l={...l,...n},ke(this.data,a,l),o.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}},Ue={processors:{},addPostProcessor(r){this.processors[r.name]=r},handle(r,e,t,n,s){return r.forEach(i=>{this.processors[i]&&(e=this.processors[i].process(e,t,n,s))}),e}},$e={},te=class r extends K{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ht(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=$.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;let n=this.resolve(e,t);return n&&n.res!==void 0}extractFromKey(e,t){let n=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");let s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!wt(e,n,s);if(o&&!a){let l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:i};let c=e.split(n);(n!==s||n===s&&this.options.ns.indexOf(c[0])>-1)&&(i=c.shift()),e=c.join(s)}return typeof i=="string"&&(i=[i]),{key:e,namespaces:i}}translate(e,t,n){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);let s=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],t),l=a[a.length-1],c=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(f){let L=t.nsSeparator||this.options.nsSeparator;return s?{res:`${l}${L}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${L}${o}`}return s?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}let h=this.resolve(e,t),d=h&&h.res,g=h&&h.usedKey||o,m=h&&h.exactUsedKey||o,w=Object.prototype.toString.apply(d),O=["[object Number]","[object Function]","[object RegExp]"],R=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject;if(T&&d&&(typeof d!="string"&&typeof d!="boolean"&&typeof d!="number")&&O.indexOf(w)<0&&!(typeof R=="string"&&Array.isArray(d))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,d,{...t,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(h.res=L,h.usedParams=this.getUsedParamsDetails(t),h):L}if(i){let L=Array.isArray(d),P=L?[]:{},N=L?m:g;for(let C in d)if(Object.prototype.hasOwnProperty.call(d,C)){let j=`${N}${i}${C}`;P[C]=this.translate(j,{...t,joinArrays:!1,ns:a}),P[C]===j&&(P[C]=d[C])}d=P}}else if(T&&typeof R=="string"&&Array.isArray(d))d=d.join(R),d&&(d=this.extendTranslation(d,e,t,n));else{let L=!1,P=!1,N=t.count!==void 0&&typeof t.count!="string",C=r.hasDefaultValue(t),j=N?this.pluralResolver.getSuffix(c,t.count,t):"",ue=t.ordinal&&N?this.pluralResolver.getSuffix(c,t.count,{ordinal:!1}):"",U=N&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),u=U&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${j}`]||t[`defaultValue${ue}`]||t.defaultValue;!this.isValidLookup(d)&&C&&(L=!0,d=u),this.isValidLookup(d)||(P=!0,d=o);let y=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&P?void 0:d,v=C&&u!==d&&this.options.updateMissing;if(P||L||v){if(this.logger.log(v?"updateKey":"missingKey",c,l,o,v?u:d),i){let A=this.resolve(o,{...t,keySeparator:!1});A&&A.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let S=[],b=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&b&&b[0])for(let A=0;A<b.length;A++)S.push(b[A]);else this.options.saveMissingTo==="all"?S=this.languageUtils.toResolveHierarchy(t.lng||this.language):S.push(t.lng||this.language);let M=(A,E,k)=>{let Ee=C&&k!==d?k:y;this.options.missingKeyHandler?this.options.missingKeyHandler(A,l,E,Ee,v,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(A,l,E,Ee,v,t),this.emit("missingKey",A,l,E,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?S.forEach(A=>{let E=this.pluralResolver.getSuffixes(A,t);U&&t[`defaultValue${this.options.pluralSeparator}zero`]&&E.indexOf(`${this.options.pluralSeparator}zero`)<0&&E.push(`${this.options.pluralSeparator}zero`),E.forEach(k=>{M([A],o+k,t[`defaultValue${k}`]||u)})}):M(S,o,u))}d=this.extendTranslation(d,e,t,h,n),P&&d===o&&this.options.appendNamespaceToMissingKey&&(d=`${l}:${o}`),(P||L)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,L?d:void 0):d=this.options.parseMissingKeyHandler(d))}return s?(h.res=d,h.usedParams=this.getUsedParamsDetails(t),h):d}extendTranslation(e,t,n,s,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let c=typeof e=="string"&&(n&&n.interpolation&&n.interpolation.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),f;if(c){let d=e.match(this.interpolator.nestingRegexp);f=d&&d.length}let h=n.replace&&typeof n.replace!="string"?n.replace:n;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),e=this.interpolator.interpolate(e,h,n.lng||this.language||s.usedLng,n),c){let d=e.match(this.interpolator.nestingRegexp),g=d&&d.length;f<g&&(n.nest=!1)}!n.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(n.lng=this.language||s.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var d=arguments.length,g=new Array(d),m=0;m<d;m++)g[m]=arguments[m];return i&&i[0]===g[0]&&!n.context?(o.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${t[0]}`),null):o.translate(...g,t)},n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,l=typeof a=="string"?[a]:a;return e!=null&&l&&l.length&&n.applyPostProcessor!==!1&&(e=Ue.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n,s,i,o,a;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;let c=this.extractFromKey(l,t),f=c.key;s=f;let h=c.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));let d=t.count!==void 0&&typeof t.count!="string",g=d&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),m=t.context!==void 0&&(typeof t.context=="string"||typeof t.context=="number")&&t.context!=="",w=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);h.forEach(O=>{this.isValidLookup(n)||(a=O,!$e[`${w[0]}-${O}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&($e[`${w[0]}-${O}`]=!0,this.logger.warn(`key "${s}" for languages "${w.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(R=>{if(this.isValidLookup(n))return;o=R;let T=[f];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(T,f,R,O,t);else{let L;d&&(L=this.pluralResolver.getSuffix(R,t.count,t));let P=`${this.options.pluralSeparator}zero`,N=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(T.push(f+L),t.ordinal&&L.indexOf(N)===0&&T.push(f+L.replace(N,this.options.pluralSeparator)),g&&T.push(f+P)),m){let C=`${f}${this.options.contextSeparator}${t.context}`;T.push(C),d&&(T.push(C+L),t.ordinal&&L.indexOf(N)===0&&T.push(C+L.replace(N,this.options.pluralSeparator)),g&&T.push(C+P))}}let H;for(;H=T.pop();)this.isValidLookup(n)||(i=H,n=this.getResource(R,O,H,t))}))})}),{res:n,usedKey:s,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,s):this.resourceStore.getResource(e,t,n,s)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&typeof e.replace!="string",s=n?e.replace:e;if(n&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!n){s={...s};for(let i of t)delete s[i]}return s}static hasDefaultValue(e){let t="defaultValue";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&e[n]!==void 0)return!0;return!1}},fe=r=>r.charAt(0).toUpperCase()+r.slice(1),ne=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$.create("languageUtils")}getScriptPartFromCode(e){if(e=Z(e),!e||e.indexOf("-")<0)return null;let t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Z(e),!e||e.indexOf("-")<0)return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){let t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map(s=>s.toLowerCase()):n.length===2?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=fe(n[1].toLowerCase()))):n.length===3&&(n[0]=n[0].toLowerCase(),n[1].length===2&&(n[1]=n[1].toUpperCase()),n[0]!=="sgn"&&n[2].length===2&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=fe(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=fe(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(n=>{if(t)return;let s=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(n=>{if(t)return;let s=this.getLanguagePartFromCode(n);if(this.isSupportedCode(s))return t=s;t=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),typeof e=="string"&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),s=[],i=o=>{o&&(this.isSupportedCode(o)?s.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(e))):typeof e=="string"&&i(this.formatLanguageCode(e)),n.forEach(o=>{s.indexOf(o)<0&&i(this.formatLanguageCode(o))}),s}},Ot=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],St={1:r=>+(r>1),2:r=>+(r!=1),3:r=>0,4:r=>r%10==1&&r%100!=11?0:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?1:2,5:r=>r==0?0:r==1?1:r==2?2:r%100>=3&&r%100<=10?3:r%100>=11?4:5,6:r=>r==1?0:r>=2&&r<=4?1:2,7:r=>r==1?0:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?1:2,8:r=>r==1?0:r==2?1:r!=8&&r!=11?2:3,9:r=>+(r>=2),10:r=>r==1?0:r==2?1:r<7?2:r<11?3:4,11:r=>r==1||r==11?0:r==2||r==12?1:r>2&&r<20?2:3,12:r=>+(r%10!=1||r%100==11),13:r=>+(r!==0),14:r=>r==1?0:r==2?1:r==3?2:3,15:r=>r%10==1&&r%100!=11?0:r%10>=2&&(r%100<10||r%100>=20)?1:2,16:r=>r%10==1&&r%100!=11?0:r!==0?1:2,17:r=>r==1||r%10==1&&r%100!=11?0:1,18:r=>r==0?0:r==1?1:2,19:r=>r==1?0:r==0||r%100>1&&r%100<11?1:r%100>10&&r%100<20?2:3,20:r=>r==1?0:r==0||r%100>0&&r%100<20?1:2,21:r=>r%100==1?1:r%100==2?2:r%100==3||r%100==4?3:0,22:r=>r==1?0:r==2?1:(r<0||r>10)&&r%10==0?2:3},Lt=["v1","v2","v3"],Pt=["v4"],Ie={zero:0,one:1,two:2,few:3,many:4,other:5},Et=()=>{let r={};return Ot.forEach(e=>{e.lngs.forEach(t=>{r[t]={numbers:e.nr,plurals:St[e.fc]}})}),r},ge=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=$.create("pluralResolver"),(!this.options.compatibilityJSON||Pt.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Et(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{let n=Z(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:n,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o=new Intl.PluralRules(n,{type:s});return this.pluralRulesCache[i]=o,o}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}getPluralFormsOfKey(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,n).map(s=>`${t}${s}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((s,i)=>Ie[s]-Ie[i]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):n.numbers.map(s=>this.getSuffix(e,s,t)):[]}getSuffix(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(e,n);return s?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:this.getSuffixRetroCompatible(s,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){let n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),s=e.numbers[n];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));let i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?i():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Lt.includes(this.options.compatibilityJSON)}},De=function(r,e,t){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=mt(r,e,t);return!i&&s&&typeof t=="string"&&(i=pe(r,t,n),i===void 0&&(i=pe(e,t,n))),i},ce=r=>r.replace(/\$/g,"$$$$"),me=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:s,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:f,unescapePrefix:h,nestingPrefix:d,nestingPrefixEscaped:g,nestingSuffix:m,nestingSuffixEscaped:w,nestingOptionsSeparator:O,maxReplaces:R,alwaysFormat:T}=e.interpolation;this.escape=t!==void 0?t:bt,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?B(i):o||"{{",this.suffix=a?B(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=f?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=d?B(d):g||B("$t("),this.nestingSuffix=m?B(m):w||B(")"),this.nestingOptionsSeparator=O||",",this.maxReplaces=R||1e3,this.alwaysFormat=T!==void 0?T:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(t,n)=>t&&t.source===n?(t.lastIndex=0,t):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,n,s){let i,o,a,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=g=>{if(g.indexOf(this.formatSeparator)<0){let R=De(t,l,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(R,void 0,n,{...s,...t,interpolationkey:g}):R}let m=g.split(this.formatSeparator),w=m.shift().trim(),O=m.join(this.formatSeparator).trim();return this.format(De(t,l,w,this.options.keySeparator,this.options.ignoreJSONStructure),O,n,{...s,...t,interpolationkey:w})};this.resetRegExp();let f=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,h=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>ce(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?ce(this.escape(g)):ce(g)}].forEach(g=>{for(a=0;i=g.regex.exec(e);){let m=i[1].trim();if(o=c(m),o===void 0)if(typeof f=="function"){let O=f(e,i,s);o=typeof O=="string"?O:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))o="";else if(h){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),o="";else typeof o!="string"&&!this.useRawValueToEscape&&(o=je(o));let w=g.safeValue(o);if(e=e.replace(i[0],w),h?(g.regex.lastIndex+=o.length,g.regex.lastIndex-=i[0].length):g.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,o,a=(l,c)=>{let f=this.nestingOptionsSeparator;if(l.indexOf(f)<0)return l;let h=l.split(new RegExp(`${f}[ ]*{`)),d=`{${h[1]}`;l=h[0],d=this.interpolate(d,o);let g=d.match(/'/g),m=d.match(/"/g);(g&&g.length%2===0&&!m||m.length%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),c&&(o={...c,...o})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,w),`${l}${f}${d}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];o={...n},o=o.replace&&typeof o.replace!="string"?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){let f=s[1].split(this.formatSeparator).map(h=>h.trim());s[1]=f.shift(),l=f,c=!0}if(i=t(a.call(this,s[1].trim(),o),o),i&&s[0]===e&&typeof i!="string")return i;typeof i!="string"&&(i=je(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),i=""),c&&(i=l.reduce((f,h)=>this.format(f,h,n.lng,{...n,interpolationkey:s[1].trim()}),i.trim())),e=e.replace(s[0],i),this.regexp.lastIndex=0}return e}},Tt=r=>{let e=r.toLowerCase().trim(),t={};if(r.indexOf("(")>-1){let n=r.split("(");e=n[0].toLowerCase().trim();let s=n[1].substring(0,n[1].length-1);e==="currency"&&s.indexOf(":")<0?t.currency||(t.currency=s.trim()):e==="relativetime"&&s.indexOf(":")<0?t.range||(t.range=s.trim()):s.split(";").forEach(o=>{if(o){let[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),f=a.trim();t[f]||(t[f]=c),c==="false"&&(t[f]=!1),c==="true"&&(t[f]=!0),isNaN(c)||(t[f]=parseInt(c,10))}})}return{formatName:e,formatOptions:t}},V=r=>{let e={};return(t,n,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});let o=n+JSON.stringify(i),a=e[o];return a||(a=r(Z(n),s),e[o]=a),a(t)}},ye=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=$.create("formatter"),this.options=e,this.formats={number:V((t,n)=>{let s=new Intl.NumberFormat(t,{...n});return i=>s.format(i)}),currency:V((t,n)=>{let s=new Intl.NumberFormat(t,{...n,style:"currency"});return i=>s.format(i)}),datetime:V((t,n)=>{let s=new Intl.DateTimeFormat(t,{...n});return i=>s.format(i)}),relativetime:V((t,n)=>{let s=new Intl.RelativeTimeFormat(t,{...n});return i=>s.format(i,n.range||"day")}),list:V((t,n)=>{let s=new Intl.ListFormat(t,{...n});return i=>s.format(i)})},this.init(e)}init(e){let n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=V(t)}format(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(a=>a.indexOf(")")>-1)){let a=i.findIndex(l=>l.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,a)].join(this.formatSeparator)}return i.reduce((a,l)=>{let{formatName:c,formatOptions:f}=Tt(l);if(this.formats[c]){let h=a;try{let d=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},g=d.locale||d.lng||s.locale||s.lng||n;h=this.formats[c](a,g,{...f,...s,...d})}catch(d){this.logger.warn(d)}return h}else this.logger.warn(`there was no format function for ${c}`);return a},e)}},Ct=(r,e)=>{r.pending[e]!==void 0&&(delete r.pending[e],r.pendingCount--)},be=class extends K{constructor(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=s,this.logger=$.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,s.backend,s)}queueLoad(e,t,n,s){let i={},o={},a={},l={};return e.forEach(c=>{let f=!0;t.forEach(h=>{let d=`${c}|${h}`;!n.reload&&this.store.hasResourceBundle(c,h)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,f=!1,o[d]===void 0&&(o[d]=!0),i[d]===void 0&&(i[d]=!0),l[h]===void 0&&(l[h]=!0)))}),f||(a[c]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,n){let s=e.split("|"),i=s[0],o=s[1];t&&this.emit("failedLoading",i,o,t),!t&&n&&this.store.addResourceBundle(i,o,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let a={};this.queue.forEach(l=>{gt(l.loaded,[i],o),Ct(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});let f=l.loaded[c];f.length&&f.forEach(h=>{a[c][h]===void 0&&(a[c][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:s,wait:i,callback:o});return}this.readingCalls++;let a=(c,f)=>{if(this.readingCalls--,this.waitingReads.length>0){let h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(c&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,s+1,i*2,o)},i);return}o(c,f)},l=this.backend[n].bind(this.backend);if(l.length===2){try{let c=l(e,t);c&&typeof c.then=="function"?c.then(f=>a(null,f)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,t,a)}prepareLoading(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof t=="string"&&(t=[t]);let i=this.queueLoad(e,t,n,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.split("|"),s=n[0],i=n[1];this.read(s,i,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${i} for language ${s} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${s}`,a),this.loaded(e,o,a)})}saveMissing(e,t,n,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend&&this.backend.create){let l={...o,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let f;c.length===5?f=c(e,t,n,s,l):f=c(e,t,n,s),f&&typeof f.then=="function"?f.then(h=>a(null,h)).catch(a):a(null,f)}catch(f){a(f)}else c(e,t,n,s,a,l)}!e||!e[0]||this.store.addResource(e[0],t,n,s)}}},Me=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:r=>{let e={};if(typeof r[1]=="object"&&(e=r[1]),typeof r[1]=="string"&&(e.defaultValue=r[1]),typeof r[2]=="string"&&(e.tDescription=r[2]),typeof r[2]=="object"||typeof r[3]=="object"){let t=r[3]||r[2];Object.keys(t).forEach(n=>{e[n]=t[n]})}return e},interpolation:{escapeValue:!0,format:r=>r,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Fe=r=>(typeof r.ns=="string"&&(r.ns=[r.ns]),typeof r.fallbackLng=="string"&&(r.fallbackLng=[r.fallbackLng]),typeof r.fallbackNS=="string"&&(r.fallbackNS=[r.fallbackNS]),r.supportedLngs&&r.supportedLngs.indexOf("cimode")<0&&(r.supportedLngs=r.supportedLngs.concat(["cimode"])),r),Q=()=>{},Rt=r=>{Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(t=>{typeof r[t]=="function"&&(r[t]=r[t].bind(r))})},re=class r extends K{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Fe(e),this.services={},this.logger=$,this.modules={external:[]},Rt(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(typeof t.ns=="string"?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));let s=Me();this.options={...s,...this.options,...Fe(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);let i=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?$.init(i(this.modules.logger),this.options):$.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=ye);let h=new ne(this.options);this.store=new ee(this.options.resources,this.options);let d=this.services;d.logger=$,d.resourceStore=this.store,d.languageUtils=h,d.pluralResolver=new ge(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(d.formatter=i(f),d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new me(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new be(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",function(g){for(var m=arguments.length,w=new Array(m>1?m-1:0),O=1;O<m;O++)w[O-1]=arguments[O];e.emit(g,...w)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new te(this.services,this.options),this.translator.on("*",function(g){for(var m=arguments.length,w=new Array(m>1?m-1:0),O=1;O<m;O++)w[O-1]=arguments[O];e.emit(g,...w)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Q),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=function(){return e.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return e.store[f](...arguments),e}});let l=z(),c=()=>{let f=(h,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(d),n(h,d)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),l}loadResources(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Q,s=typeof e=="string"?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();let i=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&i.indexOf(c)<0&&i.push(c)})};s?o(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(i,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(a)})}else n(null)}reloadResources(e,t,n){let s=z();return typeof e=="function"&&(n=e,e=void 0),typeof t=="function"&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Q),this.services.backendConnector.reload(e,t,i=>{s.resolve(),n(i)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Ue.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t<this.languages.length;t++){let n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;let s=z();this.emit("languageChanging",e);let i=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,s.resolve(function(){return n.t(...arguments)}),t&&t(l,function(){return n.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);let c=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,f=>{o(f,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),s}getFixedT(e,t,n){var s=this;let i=function(o,a){let l;if(typeof a!="object"){for(var c=arguments.length,f=new Array(c>2?c-2:0),h=2;h<c;h++)f[h-2]=arguments[h];l=s.options.overloadTranslationOptionHandler([o,a].concat(f))}else l={...a};l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||i.keyPrefix);let d=s.options.keySeparator||".",g;return l.keyPrefix&&Array.isArray(o)?g=o.map(m=>`${l.keyPrefix}${d}${m}`):g=l.keyPrefix?`${l.keyPrefix}${d}${o}`:o,s.t(g,l)};return typeof e=="string"?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;let o=(a,l)=>{let c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(t.precheck){let a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(n,e)&&(!s||o(i,e)))}loadNamespaces(e,t){let n=z();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{n.resolve(),t&&t(s)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=z();typeof e=="string"&&(e=[e]);let s=this.options.preload||[],i=e.filter(o=>s.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=s.concat(i),this.loadResources(o=>{n.resolve(),t&&t(o)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";let t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services&&this.services.languageUtils||new ne(Me());return t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new r(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Q,n=e.forkResourceStore;n&&delete e.forkResourceStore;let s={...this.options,...e,isClone:!0},i=new r(s);return(e.debug!==void 0||e.prefix!==void 0)&&(i.logger=i.logger.clone(e)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},n&&(i.store=new ee(this.store.data,s),i.services.resourceStore=i.store),i.translator=new te(i.services,s),i.translator.on("*",function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),f=1;f<l;f++)c[f-1]=arguments[f];i.emit(a,...c)}),i.init(s,t),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},x=re.createInstance();x.createInstance=re.createInstance;var _t=x.createInstance,qt=x.dir,zt=x.init,Jt=x.loadResources,Wt=x.reloadResources,Xt=x.use,Gt=x.changeLanguage,Qt=x.getFixedT,Yt=x.t,Zt=x.exists,en=x.setDefaultNamespace,tn=x.hasLoadedNamespace,nn=x.loadNamespaces,rn=x.loadLanguages;function ve(r){"@babel/helpers - typeof";return ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(r)}var Be=[],on=Be.forEach,an=Be.slice;function xe(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":ve(XMLHttpRequest))==="object"}function jt(r){return!!r&&typeof r.then=="function"}function Ve(r){return jt(r)?r:Promise.resolve(r)}var ae=ct(ze(),1);function Je(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function We(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Je(Object(t),!0).forEach(function(n){At(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Je(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function At(r,e,t){return(e=Nt(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nt(r){var e=kt(r,"string");return F(e)=="symbol"?e:e+""}function kt(r,e){if(F(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(F(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function F(r){"@babel/helpers - typeof";return F=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(r)}var I;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?I=global.fetch:typeof window<"u"&&window.fetch?I=window.fetch:I=fetch);var X;xe()&&(typeof global<"u"&&global.XMLHttpRequest?X=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(X=window.XMLHttpRequest));var le;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?le=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(le=window.ActiveXObject));!I&&ae&&!X&&!le&&(I=ae.default||ae);typeof I!="function"&&(I=void 0);var Oe=function(e,t){if(t&&F(t)==="object"){var n="";for(var s in t)n+="&"+encodeURIComponent(s)+"="+encodeURIComponent(t[s]);if(!n)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+n.slice(1)}return e},Xe=function(e,t,n,s){var i=function(l){if(!l.ok)return n(l.statusText||"Error",{status:l.status});l.text().then(function(c){n(null,{status:l.status,data:c})}).catch(n)};if(s){var o=s(e,t);if(o instanceof Promise){o.then(i).catch(n);return}}typeof fetch=="function"?fetch(e,t).then(i).catch(n):I(e,t).then(i).catch(n)},Ge=!1,$t=function(e,t,n,s){e.queryStringParams&&(t=Oe(t,e.queryStringParams));var i=We({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),n&&(i["Content-Type"]="application/json");var o=typeof e.requestOptions=="function"?e.requestOptions(n):e.requestOptions,a=We({method:n?"POST":"GET",body:n?e.stringify(n):void 0,headers:i},Ge?{}:o),l=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Xe(t,a,s,l)}catch(c){if(!o||Object.keys(o).length===0||!c.message||c.message.indexOf("not implemented")<0)return s(c);try{Object.keys(o).forEach(function(f){delete a[f]}),Xe(t,a,s,l),Ge=!0}catch(f){s(f)}}},It=function(e,t,n,s){n&&F(n)==="object"&&(n=Oe("",n).slice(1)),e.queryStringParams&&(t=Oe(t,e.queryStringParams));try{var i;X?i=new X:i=new le("MSXML2.XMLHTTP.3.0"),i.open(n?"POST":"GET",t,1),e.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!e.withCredentials,n&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var o=e.customHeaders;if(o=typeof o=="function"?o():o,o)for(var a in o)i.setRequestHeader(a,o[a]);i.onreadystatechange=function(){i.readyState>3&&s(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(n)}catch(l){console&&console.log(l)}},Dt=function(e,t,n,s){if(typeof n=="function"&&(s=n,n=void 0),s=s||function(){},I&&t.indexOf("file:")!==0)return $t(e,t,n,s);if(xe()||typeof ActiveXObject=="function")return It(e,t,n,s);s(new Error("No fetch and no xhr implementation found!"))},Qe=Dt;function q(r){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(r)}function Ye(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function Se(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ye(Object(t),!0).forEach(function(n){et(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ye(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ze(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,tt(n.key),n)}}function Ft(r,e,t){return e&&Ze(r.prototype,e),t&&Ze(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function et(r,e,t){return(e=tt(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tt(r){var e=Ht(r,"string");return q(e)=="symbol"?e:e+""}function Ht(r,e){if(q(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(q(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ut=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(t){return JSON.parse(t)},stringify:JSON.stringify,parsePayload:function(t,n,s){return et({},n,s||"")},parseLoadPayload:function(t,n){},request:Qe,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},nt=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Mt(this,r),this.services=e,this.options=t,this.allOptions=n,this.type="backend",this.init(e,t,n)}return Ft(r,[{key:"init",value:function(t){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=t,this.options=Se(Se(Se({},Ut()),this.options||{}),s),this.allOptions=i,this.services&&this.options.reloadInterval){var o=setInterval(function(){return n.reload()},this.options.reloadInterval);q(o)==="object"&&typeof o.unref=="function"&&o.unref()}}},{key:"readMulti",value:function(t,n,s){this._readAny(t,t,n,n,s)}},{key:"read",value:function(t,n,s){this._readAny([t],t,[n],n,s)}},{key:"_readAny",value:function(t,n,s,i,o){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(t,s)),l=Ve(l),l.then(function(c){if(!c)return o(null,{});var f=a.services.interpolator.interpolate(c,{lng:t.join("+"),ns:s.join("+")});a.loadUrl(f,o,n,i)})}},{key:"loadUrl",value:function(t,n,s,i){var o=this,a=typeof s=="string"?[s]:s,l=typeof i=="string"?[i]:i,c=this.options.parseLoadPayload(a,l);this.options.request(this.options,t,c,function(f,h){if(h&&(h.status>=500&&h.status<600||!h.status))return n("failed loading "+t+"; status code: "+h.status,!0);if(h&&h.status>=400&&h.status<500)return n("failed loading "+t+"; status code: "+h.status,!1);if(!h&&f&&f.message&&f.message.toLowerCase().indexOf("failed")>-1&&(f.message.indexOf("fetch")>-1||f.message.toLowerCase().indexOf("network")>-1))return n("failed loading "+t+": "+f.message,!0);if(f)return n(f,!1);var d,g;try{typeof h.data=="string"?d=o.options.parse(h.data,s,i):d=h.data}catch{g="failed parsing "+t+" to json"}if(g)return n(g,!1);n(null,d)})}},{key:"create",value:function(t,n,s,i,o){var a=this;if(this.options.addPath){typeof t=="string"&&(t=[t]);var l=this.options.parsePayload(n,s,i),c=0,f=[],h=[];t.forEach(function(d){var g=a.options.addPath;typeof a.options.addPath=="function"&&(g=a.options.addPath(d,n));var m=a.services.interpolator.interpolate(g,{lng:d,ns:n});a.options.request(a.options,m,l,function(w,O){c+=1,f.push(w),h.push(O),c===t.length&&typeof o=="function"&&o(f,h)})})}}},{key:"reload",value:function(){var t=this,n=this.services,s=n.backendConnector,i=n.languageUtils,o=n.logger,a=s.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],c=function(h){var d=i.toResolveHierarchy(h);d.forEach(function(g){l.indexOf(g)<0&&l.push(g)})};c(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(f){return c(f)}),l.forEach(function(f){t.allOptions.ns.forEach(function(h){s.read(f,h,"read",null,null,function(d,g){d&&o.warn("loading namespace ".concat(h," for language ").concat(f," failed"),d),!d&&g&&o.log("loaded namespace ".concat(h," for language ").concat(f),g),s.loaded("".concat(f,"|").concat(h),d,g)})})})}}}])}();nt.type="backend";var rt=nt;var G={APP_VERSION:"46",SDK_VERSION:"0.11.0",COMMIT_SHA:"7617d5c",REPO_URL:"https://github.com/live-codes/livecodes",DOCS_BASE_URL:"/docs/"};var st=r=>(e,t)=>{let n=e[0],s=t[0];return n==="ar"&&s==="language-info"?r+"i18n-ar-language-info.0dbeb24d43abede08c4d86eb415bd5d9.json":n==="ar"&&s==="translation"?r+"i18n-ar-translation.1317e033df71eed974d625185264d0af.json":n==="de"&&s==="language-info"?r+"i18n-de-language-info.aa23e88182c0180d790f754a227963f4.json":n==="de"&&s==="translation"?r+"i18n-de-translation.4ae65381a62c22640cb927b5e1fad720.json":n==="en"&&s==="language-info"?r+"i18n-en-language-info.b0da11e1be29831d0e9a38ac6d1ef18f.json":n==="en"&&s==="translation"?r+"i18n-en-translation.d990b77073ac51d6c12de253deb88388.json":n==="es"&&s==="language-info"?r+"i18n-es-language-info.8c1acb6637de0b23e6b5c76666b8662e.json":n==="es"&&s==="translation"?r+"i18n-es-translation.e7eb17315314259f2ff4bf7571272353.json":n==="fr"&&s==="language-info"?r+"i18n-fr-language-info.fc2cf824dd5c009a0fabcaa0406e20a7.json":n==="fr"&&s==="translation"?r+"i18n-fr-translation.07daef1b20e17341a8c19603975e91fc.json":n==="hi"&&s==="language-info"?r+"i18n-hi-language-info.b7a39731fde7db491823c641897626d0.json":n==="hi"&&s==="translation"?r+"i18n-hi-translation.12875ac26d856842ca9db4032bd3ce80.json":n==="it"&&s==="language-info"?r+"i18n-it-language-info.78c82755f03bd9039c864399642b0f68.json":n==="it"&&s==="translation"?r+"i18n-it-translation.f91d57d81ee2b2238eb2d3aa935a42a3.json":n==="ja"&&s==="language-info"?r+"i18n-ja-language-info.96a25597023395c55474f24b8b6a534a.json":n==="ja"&&s==="translation"?r+"i18n-ja-translation.e06547af81601b0e2488b7e0b9765358.json":n==="pt"&&s==="language-info"?r+"i18n-pt-language-info.866ee7c2bddd98c1ad04debace77314f.json":n==="pt"&&s==="translation"?r+"i18n-pt-translation.f6755d229a622afc3ef659367a38af2e.json":n==="ru"&&s==="language-info"?r+"i18n-ru-language-info.6cd7c6678bcd036f7cfcb5bbb2159ca3.json":n==="ru"&&s==="translation"?r+"i18n-ru-translation.31e6f0b335e60514a652037947440de0.json":n==="ur"&&s==="language-info"?r+"i18n-ur-language-info.b316110fd5b7ed1c25669dd773954d6d.json":n==="ur"&&s==="translation"?r+"i18n-ur-translation.186c536187ce5397dd84380d787f12ca.json":n==="zh-CN"&&s==="language-info"?r+"i18n-zh-CN-language-info.bf80b59b93281897b8b38ffeeeefc72b.json":n==="zh-CN"&&s==="translation"?r+"i18n-zh-CN-translation.a7f8b9604d812a2dffe4c37d1800bf1d.json":!1};var Le=r=>{let t=new DOMParser().parseFromString(r,"text/html"),n=[],s=0,i=f=>{if(f.nodeType!==Node.ELEMENT_NODE)return;f.childNodes.forEach(m=>{i(m)});let h=f.tagName.toLowerCase();if(h==="body")return;let d=f.attributes.length===0?void 0:Array.from(f.attributes).reduce((m,w)=>(m[w.name]=w.value,m),{});n.push({name:h,attributes:d});let g=t.createElement(`tag-${s}`);for(;f.firstChild;)g.appendChild(f.firstChild);f.parentNode.replaceChild(g,f),s++};i(t.body);let o=1,a=[],l=t.body.innerHTML.replace(/tag-/g,""),c=[];return l=l.replace(/<(\d+)>/g,(f,h)=>(c.push(n[h]),a.push({from:new RegExp(`</${h}>`,"g"),to:`<*/${o}>`}),`<${o++}>`)),a.forEach(({from:f,to:h})=>{l=l.replace(f,h)}),l=l.replace(/<\*\//g,"</"),{html:l,elements:c}},Pe=(r,e,t={})=>{let s=new DOMParser().parseFromString(r.replace(/<(\/?)(\d+)([^>]*)>/g,"<$1tag-$2$3>"),"text/html");e.forEach((o,a)=>{let l=s.body.querySelector(`tag-${a+1}`),c=s.createElement(o.name);for(o.attributes&&Object.entries(o.attributes).forEach(([f,h])=>{c.setAttribute(f,h)}),l?.attributes&&Array.from(l.attributes).forEach(f=>{c.setAttribute(f.name,f.value)});l?.firstChild;)c.appendChild(l.firstChild);l?.replaceWith(c)});let i=s.body.innerHTML;for(let[o,a]of Object.entries({...t,...G}))i=i.replaceAll(`{{${o}}}`,a);return i};var Ln=async(r,e)=>(await x.use(rt).init({lng:r,returnEmptyString:!1,fallbackLng:"en",interpolation:{escapeValue:!1},backend:{loadPath:st(e)}}),{translate:Bt,translateString:Vt,translateKey:x.t.bind(x),getLanguage:()=>x.language,getLanguageDirection:x.dir.bind(x),changeLanguage:x.changeLanguage.bind(x),loadNamespaces:x.loadNamespaces.bind(x)}),Bt=r=>{r&&r.querySelectorAll("[data-i18n]").forEach(e=>{let t=e.dataset.i18n;if(!t)return;let n=JSON.parse(e.dataset.i18nInterpolation||"{}"),s={PROP:"",...G,...n},i=(a,l)=>{if(s.PROP=a,a.startsWith("data-"))a=a.slice(5),e.dataset[a]=x.t(l,{defaultValue:e.dataset[a],...s});else{let c=x.t(l,{defaultValue:e[a],...s});if(a==="innerHTML"&&e.innerHTML!==c){let{elements:f}=Le(e.innerHTML);e.innerHTML=Pe(c,f,n)}else e[a]=c}},o=(e.dataset.i18nProp||"textContent").split(" ");o.length===1?i(o[0],t):o.forEach(a=>{i(a,`${t}.${a}`)})})},Vt=(r,e,...t)=>{if(!x)return e;let n=t[0],{isHTML:s,...i}=n??{},o=x.t(r,{...i,...G,defaultValue:e});if(!i||!s)return o;{let{elements:a}=Le(e);return Pe(o,a,i)}};export{Ln as init};