@sv-print/plugin-i18n 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(b,d){typeof exports=="object"&&typeof module!="undefined"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(b=typeof globalThis!="undefined"?globalThis:b||self,d(b.pluginI18n={}))})(this,function(b){"use strict";var qe=Object.defineProperty,et=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var Pe=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable;var Re=(b,d,L)=>d in b?qe(b,d,{enumerable:!0,configurable:!0,writable:!0,value:L}):b[d]=L,g=(b,d)=>{for(var L in d||(d={}))it.call(d,L)&&Re(b,L,d[L]);if(Pe)for(var L of Pe(d))st.call(d,L)&&Re(b,L,d[L]);return b},v=(b,d)=>et(b,tt(d));const d=a=>typeof a=="string",L=()=>{let a,e;const t=new Promise((i,s)=>{a=i,e=s});return t.resolve=a,t.reject=e,t},ie=a=>a==null?"":""+a,ke=(a,e,t)=>{a.forEach(i=>{e[i]&&(t[i]=e[i])})},Ne=/###/g,se=a=>a&&a.indexOf("###")>-1?a.replace(Ne,"."):a,ne=a=>!a||d(a),U=(a,e,t)=>{const i=d(e)?e.split("."):e;let s=0;for(;s<i.length-1;){if(ne(a))return{};const n=se(i[s]);!a[n]&&t&&(a[n]=new t),Object.prototype.hasOwnProperty.call(a,n)?a=a[n]:a={},++s}return ne(a)?{}:{obj:a,k:se(i[s])}},re=(a,e,t)=>{const{obj:i,k:s}=U(a,e,Object);if(i!==void 0||e.length===1){i[s]=t;return}let n=e[e.length-1],r=e.slice(0,e.length-1),o=U(a,r,Object);for(;o.obj===void 0&&r.length;)n=`${r[r.length-1]}.${n}`,r=r.slice(0,r.length-1),o=U(a,r,Object),o!=null&&o.obj&&typeof o.obj[`${o.k}.${n}`]!="undefined"&&(o.obj=void 0);o.obj[`${o.k}.${n}`]=t},Te=(a,e,t,i)=>{const{obj:s,k:n}=U(a,e,Object);s[n]=s[n]||[],s[n].push(t)},W=(a,e)=>{const{obj:t,k:i}=U(a,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},Fe=(a,e,t)=>{const i=W(a,t);return i!==void 0?i:W(e,t)},ae=(a,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in a?d(a[i])||a[i]instanceof String||d(e[i])||e[i]instanceof String?t&&(a[i]=e[i]):ae(a[i],e[i],t):a[i]=e[i]);return a},K=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ee={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const je=a=>d(a)?a.replace(/[&<>"'\/]/g,e=>Ee[e]):a;class Ie{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const De=[" ",",","?","!",";"],Ve=new Ie(20),Ae=(a,e,t)=>{e=e||"",t=t||"";const i=De.filter(r=>e.indexOf(r)<0&&t.indexOf(r)<0);if(i.length===0)return!0;const s=Ve.getRegExp(`(${i.map(r=>r==="?"?"\\?":r).join("|")})`);let n=!s.test(a);if(!n){const r=a.indexOf(t);r>0&&!s.test(a.substring(0,r))&&(n=!0)}return n},ee=(a,e,t=".")=>{if(!a)return;if(a[e])return Object.prototype.hasOwnProperty.call(a,e)?a[e]:void 0;const i=e.split(t);let s=a;for(let n=0;n<i.length;){if(!s||typeof s!="object")return;let r,o="";for(let l=n;l<i.length;++l)if(l!==n&&(o+=t),o+=i[l],r=s[o],r!==void 0){if(["string","number","boolean"].indexOf(typeof r)>-1&&l<i.length-1)continue;n+=l-n+1;break}s=r}return s},H=a=>a==null?void 0:a.replace("_","-"),Ke={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,e){var t,i;(i=(t=console==null?void 0:console[a])==null?void 0:t.apply)==null||i.call(t,console,e)}};class Y{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Ke,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,s){return s&&!this.debug?null:(d(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Y(this.logger,g({prefix:`${this.prefix}:${e}:`},this.options))}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Y(this.logger,e)}}var T=new Y;class Q{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const s=this.observers[i].get(t)||0;this.observers[i].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,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,n])=>{for(let r=0;r<n;r++)s(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,n])=>{for(let r=0;r<n;r++)s.apply(s,[e,...t])})}}class oe extends Q{constructor(e,t={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){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i,s={}){var u,f;const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,r=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],i&&(Array.isArray(i)?o.push(...i):d(i)&&n?o.push(...i.split(n)):o.push(i)));const l=W(this.data,o);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=o[0],t=o[1],i=o.slice(2).join(".")),l||!r||!d(i)?l:ee((f=(u=this.data)==null?void 0:u[e])==null?void 0:f[t],i,n)}addResource(e,t,i,s,n={silent:!1}){const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=[e,t];i&&(o=o.concat(r?i.split(r):i)),e.indexOf(".")>-1&&(o=e.split("."),s=t,t=o[1]),this.addNamespaces(t),re(this.data,o,s),n.silent||this.emit("added",e,t,i,s)}addResources(e,t,i,s={silent:!1}){for(const n in i)(d(i[n])||Array.isArray(i[n]))&&this.addResource(e,t,n,i[n],{silent:!0});s.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,s,n,r={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),s=i,i=t,t=o[1]),this.addNamespaces(t);let l=W(this.data,o)||{};r.skipCopy||(i=JSON.parse(JSON.stringify(i))),s?ae(l,i,n):l=g(g({},l),i),re(this.data,o,l),r.silent||this.emit("added",e,t,i)}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.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var le={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,e,t,i,s){return a.forEach(n=>{var r,o;e=(o=(r=this.processors[n])==null?void 0:r.process(e,t,i,s))!=null?o:e}),e}};const ue={},he=a=>!d(a)&&typeof a!="boolean"&&typeof a!="number";class G extends Q{constructor(e,t={}){super(),ke(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=T.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const i=g({},t);if(e==null)return!1;const s=this.resolve(e,i);return(s==null?void 0:s.res)!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const r=i&&e.indexOf(i)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ae(e,i,s);if(r&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:d(n)?[n]:n};const u=e.split(i);(i!==s||i===s&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(s)}return{key:e,namespaces:d(n)?[n]:n}}translate(e,t,i){let s=typeof t=="object"?g({},t):t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(s=g({},s)),s||(s={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const n=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],s),u=l[l.length-1];let f=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const h=s.lng||this.language,m=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((h==null?void 0:h.toLowerCase())==="cimode")return m?n?{res:`${u}${f}${o}`,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:`${u}${f}${o}`:n?{res:o,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:o;const p=this.resolve(e,s);let c=p==null?void 0:p.res;const x=(p==null?void 0:p.usedKey)||o,S=(p==null?void 0:p.exactUsedKey)||o,k=["[object Number]","[object Function]","[object RegExp]"],R=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,V=!this.i18nFormat||this.i18nFormat.handleAsObject,w=s.count!==void 0&&!d(s.count),j=G.hasDefaultValue(s),X=w?this.pluralResolver.getSuffix(h,s.count,s):"",I=s.ordinal&&w?this.pluralResolver.getSuffix(h,s.count,{ordinal:!1}):"",z=w&&!s.ordinal&&s.count===0,C=z&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${X}`]||s[`defaultValue${I}`]||s.defaultValue;let O=c;V&&!c&&j&&(O=C);const Ze=he(O),Xe=Object.prototype.toString.apply(O);if(V&&O&&Ze&&k.indexOf(Xe)<0&&!(d(R)&&Array.isArray(O))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const F=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,O,v(g({},s),{ns:l})):`key '${o} (${this.language})' returned an object instead of string.`;return n?(p.res=F,p.usedParams=this.getUsedParamsDetails(s),p):F}if(r){const F=Array.isArray(O),N=F?[]:{},we=F?S:x;for(const E in O)if(Object.prototype.hasOwnProperty.call(O,E)){const D=`${we}${r}${E}`;j&&!c?N[E]=this.translate(D,v(g({},s),{defaultValue:he(C)?C[E]:void 0,joinArrays:!1,ns:l})):N[E]=this.translate(D,v(g({},s),{joinArrays:!1,ns:l})),N[E]===D&&(N[E]=O[E])}c=N}}else if(V&&d(R)&&Array.isArray(c))c=c.join(R),c&&(c=this.extendTranslation(c,e,s,i));else{let F=!1,N=!1;!this.isValidLookup(c)&&j&&(F=!0,c=C),this.isValidLookup(c)||(N=!0,c=o);const E=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:c,D=j&&C!==c&&this.options.updateMissing;if(N||F||D){if(this.logger.log(D?"updateKey":"missingKey",h,u,o,D?C:c),r){const P=this.resolve(o,v(g({},s),{keySeparator:!1}));P&&P.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 J=[];const q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&q&&q[0])for(let P=0;P<q.length;P++)J.push(q[P]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(s.lng||this.language):J.push(s.lng||this.language);const ve=(P,A,_)=>{var $e;const Ce=j&&_!==c?_:E;this.options.missingKeyHandler?this.options.missingKeyHandler(P,u,A,Ce,D,s):($e=this.backendConnector)!=null&&$e.saveMissing&&this.backendConnector.saveMissing(P,u,A,Ce,D,s),this.emit("missingKey",P,u,A,c)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?J.forEach(P=>{const A=this.pluralResolver.getSuffixes(P,s);z&&s[`defaultValue${this.options.pluralSeparator}zero`]&&A.indexOf(`${this.options.pluralSeparator}zero`)<0&&A.push(`${this.options.pluralSeparator}zero`),A.forEach(_=>{ve([P],o+_,s[`defaultValue${_}`]||C)})}):ve(J,o,C))}c=this.extendTranslation(c,e,s,p,i),N&&c===o&&this.options.appendNamespaceToMissingKey&&(c=`${u}${f}${o}`),(N||F)&&this.options.parseMissingKeyHandler&&(c=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${f}${o}`:o,F?c:void 0,s))}return n?(p.res=c,p.usedParams=this.getUsedParamsDetails(s),p):c}extendTranslation(e,t,i,s,n){var l,u;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,g(g({},this.options.interpolation.defaultVariables),i),i.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(v(g({},i),{interpolation:g(g({},this.options.interpolation),i.interpolation)}));const f=d(e)&&(((u=i==null?void 0:i.interpolation)==null?void 0:u.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(f){const p=e.match(this.interpolator.nestingRegexp);h=p&&p.length}let m=i.replace&&!d(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(m=g(g({},this.options.interpolation.defaultVariables),m)),e=this.interpolator.interpolate(e,m,i.lng||this.language||s.usedLng,i),f){const p=e.match(this.interpolator.nestingRegexp),c=p&&p.length;h<c&&(i.nest=!1)}!i.lng&&s&&s.res&&(i.lng=this.language||s.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>(n==null?void 0:n[0])===p[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`),null):this.translate(...p,t),i)),i.interpolation&&this.interpolator.reset()}const r=i.postProcess||this.options.postProcess,o=d(r)?[r]:r;return e!=null&&(o!=null&&o.length)&&i.applyPostProcessor!==!1&&(e=le.handle(o,e,t,this.options&&this.options.postProcessPassResolved?g({i18nResolved:v(g({},s),{usedParams:this.getUsedParamsDetails(i)})},i):i,this)),e}resolve(e,t={}){let i,s,n,r,o;return d(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const u=this.extractFromKey(l,t),f=u.key;s=f;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const m=t.count!==void 0&&!d(t.count),p=m&&!t.ordinal&&t.count===0,c=t.context!==void 0&&(d(t.context)||typeof t.context=="number")&&t.context!=="",x=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);h.forEach(S=>{var k,R;this.isValidLookup(i)||(o=S,!ue[`${x[0]}-${S}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((R=this.utils)!=null&&R.hasLoadedNamespace(o))&&(ue[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${o}" 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!!!")),x.forEach(V=>{var X;if(this.isValidLookup(i))return;r=V;const w=[f];if((X=this.i18nFormat)!=null&&X.addLookupKeys)this.i18nFormat.addLookupKeys(w,f,V,S,t);else{let I;m&&(I=this.pluralResolver.getSuffix(V,t.count,t));const z=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(w.push(f+I),t.ordinal&&I.indexOf(C)===0&&w.push(f+I.replace(C,this.options.pluralSeparator)),p&&w.push(f+z)),c){const O=`${f}${this.options.contextSeparator}${t.context}`;w.push(O),m&&(w.push(O+I),t.ordinal&&I.indexOf(C)===0&&w.push(O+I.replace(C,this.options.pluralSeparator)),p&&w.push(O+z))}}let j;for(;j=w.pop();)this.isValidLookup(i)||(n=j,i=this.getResource(V,S,j,t))}))})}),{res:i,usedKey:s,exactUsedKey:n,usedLng:r,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i,s={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,i,s):this.resourceStore.getResource(e,t,i,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!d(e.replace);let s=i?e.replace:e;if(i&&typeof e.count!="undefined"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s=g(g({},this.options.interpolation.defaultVariables),s)),!i){s=g({},s);for(const n of t)delete s[n]}return s}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}}class fe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=T.create("languageUtils")}getScriptPartFromCode(e){if(e=H(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=H(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(d(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(i){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}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(i=>{if(t)return;const s=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const s=this.getScriptPartFromCode(i);if(this.isSupportedCode(s))return t=s;const n=this.getLanguagePartFromCode(i);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(r=>{if(r===n)return r;if(!(r.indexOf("-")<0&&n.indexOf("-")<0)&&(r.indexOf("-")>0&&n.indexOf("-")<0&&r.substring(0,r.indexOf("-"))===n||r.indexOf(n)===0&&n.length>1))return r})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),d(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],n=r=>{r&&(this.isSupportedCode(r)?s.push(r):this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`))};return d(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):d(e)&&n(this.formatLanguageCode(e)),i.forEach(r=>{s.indexOf(r)<0&&n(this.formatLanguageCode(r))}),s}}const ce={zero:0,one:1,two:2,few:3,many:4,other:5},de={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Me{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=T.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const i=H(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:i,type:s});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let r;try{r=new Intl.PluralRules(i,{type:s})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),de;if(!e.match(/-|_/))return de;const l=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(l,t)}return this.pluralRulesCache[n]=r,r}needsPlural(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,i={}){return this.getSuffixes(e,i).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((s,n)=>ce[s]-ce[n]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,i={}){const s=this.getRule(e,i);return s?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const pe=(a,e,t,i=".",s=!0)=>{let n=Fe(a,e,t);return!n&&s&&d(t)&&(n=ee(a,t,i),n===void 0&&(n=ee(e,t,i))),n},te=a=>a.replace(/\$/g,"$$$$");class Ue{constructor(e={}){var t;this.logger=T.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(i=>i),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:s,prefix:n,prefixEscaped:r,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:f,unescapePrefix:h,nestingPrefix:m,nestingPrefixEscaped:p,nestingSuffix:c,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:k,alwaysFormat:R}=e.interpolation;this.escape=t!==void 0?t:je,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=n?K(n):r||"{{",this.suffix=o?K(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=f?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=m?K(m):p||K("$t("),this.nestingSuffix=c?K(c):x||K(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=k||1e3,this.alwaysFormat=R!==void 0?R:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>(t==null?void 0:t.source)===i?(t.lastIndex=0,t):new RegExp(i,"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,i,s){var p;let n,r,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=c=>{if(c.indexOf(this.formatSeparator)<0){const R=pe(t,l,c,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(R,void 0,i,v(g(g({},s),t),{interpolationkey:c})):R}const x=c.split(this.formatSeparator),S=x.shift().trim(),k=x.join(this.formatSeparator).trim();return this.format(pe(t,l,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,i,v(g(g({},s),t),{interpolationkey:S}))};this.resetRegExp();const f=(s==null?void 0:s.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((p=s==null?void 0:s.interpolation)==null?void 0:p.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:c=>te(c)},{regex:this.regexp,safeValue:c=>this.escapeValue?te(this.escape(c)):te(c)}].forEach(c=>{for(o=0;n=c.regex.exec(e);){const x=n[1].trim();if(r=u(x),r===void 0)if(typeof f=="function"){const k=f(e,n,s);r=d(k)?k:""}else if(s&&Object.prototype.hasOwnProperty.call(s,x))r="";else if(h){r=n[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),r="";else!d(r)&&!this.useRawValueToEscape&&(r=ie(r));const S=c.safeValue(r);if(e=e.replace(n[0],S),h?(c.regex.lastIndex+=r.length,c.regex.lastIndex-=n[0].length):c.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,i={}){let s,n,r;const o=(l,u)=>{var x;const f=this.nestingOptionsSeparator;if(l.indexOf(f)<0)return l;const h=l.split(new RegExp(`${f}[ ]*{`));let m=`{${h[1]}`;l=h[0],m=this.interpolate(m,r);const p=m.match(/'/g),c=m.match(/"/g);(((x=p==null?void 0:p.length)!=null?x:0)%2===0&&!c||c.length%2!==0)&&(m=m.replace(/'/g,'"'));try{r=JSON.parse(m),u&&(r=g(g({},u),r))}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,S),`${l}${f}${m}`}return r.defaultValue&&r.defaultValue.indexOf(this.prefix)>-1&&delete r.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];r=g({},i),r=r.replace&&!d(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;const u=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(u!==-1&&(l=s[1].slice(u).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),n=t(o.call(this,s[1].trim(),r),r),n&&s[0]===e&&!d(n))return n;d(n)||(n=ie(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((f,h)=>this.format(f,h,i.lng,v(g({},i),{interpolationkey:s[1].trim()})),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}const He=a=>{let e=a.toLowerCase().trim();const t={};if(a.indexOf("(")>-1){const i=a.split("(");e=i[0].toLowerCase().trim();const s=i[1].substring(0,i[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(r=>{if(r){const[o,...l]=r.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),f=o.trim();t[f]||(t[f]=u),u==="false"&&(t[f]=!1),u==="true"&&(t[f]=!0),isNaN(u)||(t[f]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ge=a=>{const e={};return(t,i,s)=>{let n=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(n=v(g({},n),{[s.interpolationkey]:void 0}));const r=i+JSON.stringify(n);let o=e[r];return o||(o=a(H(i),s),e[r]=o),o(t)}},Be=a=>(e,t,i)=>a(H(t),i)(e);class ze{constructor(e={}){this.logger=T.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const i=t.cacheInBuiltFormats?ge:Be;this.formats={number:i((s,n)=>{const r=new Intl.NumberFormat(s,g({},n));return o=>r.format(o)}),currency:i((s,n)=>{const r=new Intl.NumberFormat(s,v(g({},n),{style:"currency"}));return o=>r.format(o)}),datetime:i((s,n)=>{const r=new Intl.DateTimeFormat(s,g({},n));return o=>r.format(o)}),relativetime:i((s,n)=>{const r=new Intl.RelativeTimeFormat(s,g({},n));return o=>r.format(o,n.range||"day")}),list:i((s,n)=>{const r=new Intl.ListFormat(s,g({},n));return o=>r.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ge(t)}format(e,t,i,s={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(o=>o.indexOf(")")>-1)){const o=n.findIndex(l=>l.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,o)].join(this.formatSeparator)}return n.reduce((o,l)=>{var h;const{formatName:u,formatOptions:f}=He(l);if(this.formats[u]){let m=o;try{const p=((h=s==null?void 0:s.formatParams)==null?void 0:h[s.interpolationkey])||{},c=p.locale||p.lng||s.locale||s.lng||i;m=this.formats[u](o,c,g(g(g({},f),s),p))}catch(p){this.logger.warn(p)}return m}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const Je=(a,e)=>{a.pending[e]!==void 0&&(delete a.pending[e],a.pendingCount--)};class _e extends Q{constructor(e,t,i,s={}){var n,r;super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=s,this.logger=T.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=[],(r=(n=this.backend)==null?void 0:n.init)==null||r.call(n,i,s.backend,s)}queueLoad(e,t,i,s){const n={},r={},o={},l={};return e.forEach(u=>{let f=!0;t.forEach(h=>{const m=`${u}|${h}`;!i.reload&&this.store.hasResourceBundle(u,h)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?r[m]===void 0&&(r[m]=!0):(this.state[m]=1,f=!1,r[m]===void 0&&(r[m]=!0),n[m]===void 0&&(n[m]=!0),l[h]===void 0&&(l[h]=!0)))}),f||(o[u]=!0)}),(Object.keys(n).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(r),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const s=e.split("|"),n=s[0],r=s[1];t&&this.emit("failedLoading",n,r,t),!t&&i&&this.store.addResourceBundle(n,r,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const o={};this.queue.forEach(l=>{Te(l.loaded,[n],r),Je(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const f=l.loaded[u];f.length&&f.forEach(h=>{o[u][h]===void 0&&(o[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i,s=0,n=this.retryTimeout,r){if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:s,wait:n,callback:r});return}this.readingCalls++;const o=(u,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,s+1,n*2,r)},n);return}r(u,f)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(f=>o(null,f)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t,i={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();d(e)&&(e=this.languageUtils.toResolveHierarchy(e)),d(t)&&(t=[t]);const n=this.queueLoad(e,t,i,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach(r=>{this.loadOne(r)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e,t=""){const i=e.split("|"),s=i[0],n=i[1];this.read(s,n,"read",void 0,void 0,(r,o)=>{r&&this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`,r),!r&&o&&this.logger.log(`${t}loaded namespace ${n} for language ${s}`,o),this.loaded(e,r,o)})}saveMissing(e,t,i,s,n,r={},o=()=>{}){var l,u,f,h,m;if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((h=(f=this.services)==null?void 0:f.utils)!=null&&h.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${i}" 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(!(i==null||i==="")){if((m=this.backend)!=null&&m.create){const p=v(g({},r),{isUpdate:n}),c=this.backend.create.bind(this.backend);if(c.length<6)try{let x;c.length===5?x=c(e,t,i,s,p):x=c(e,t,i,s),x&&typeof x.then=="function"?x.then(S=>o(null,S)).catch(o):o(null,x)}catch(x){o(x)}else c(e,t,i,s,o,p)}!e||!e[0]||this.store.addResource(e[0],t,i,s)}}}const me=()=>({debug:!1,initAsync:!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:a=>{let e={};if(typeof a[1]=="object"&&(e=a[1]),d(a[1])&&(e.defaultValue=a[1]),d(a[2])&&(e.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){const t=a[3]||a[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:a=>a,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),xe=a=>{var e,t;return d(a.ns)&&(a.ns=[a.ns]),d(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),d(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),((t=(e=a.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),typeof a.initImmediate=="boolean"&&(a.initAsync=a.initImmediate),a},Z=()=>{},We=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(t=>{typeof a[t]=="function"&&(a[t]=a[t].bind(a))})};class B extends Q{constructor(e={},t){if(super(),this.options=xe(e),this.services={},this.logger=T,this.modules={external:[]},We(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(d(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const i=me();this.options=g(g(g({},i),this.options),xe(e)),this.options.interpolation=g(g({},i.interpolation),this.options.interpolation),e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?T.init(s(this.modules.logger),this.options):T.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=ze;const f=new fe(this.options);this.store=new oe(this.options.resources,this.options);const h=this.services;h.logger=T,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new Me(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(h.formatter=s(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new Ue(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new _e(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(p,...c)=>{this.emit(p,...c)}),this.modules.languageDetector&&(h.languageDetector=s(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=s(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new G(this.services,this.options),this.translator.on("*",(p,...c)=>{this.emit(p,...c)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Z),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...f)=>this.store[u](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...f)=>(this.store[u](...f),this)});const o=L(),l=()=>{const u=(f,h)=>{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),o.resolve(h),t(f,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,t=Z){var n,r;let i=t;const s=d(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((s==null?void 0:s.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const o=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(h=>{h!=="cimode"&&o.indexOf(h)<0&&o.push(h)})};s?l(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>l(f)),(r=(n=this.options.preload)==null?void 0:n.forEach)==null||r.call(n,u=>l(u)),this.services.backendConnector.load(o,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(u)})}else i(null)}reloadResources(e,t,i){const s=L();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=Z),this.services.backendConnector.reload(e,t,n=>{s.resolve(),i(n)}),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"&&le.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++){const i=this.languages[t];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const i=L();this.emit("languageChanging",e);const s=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},n=(o,l)=>{l?this.isLanguageChangingTo===e&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,i.resolve((...u)=>this.t(...u)),t&&t(o,(...u)=>this.t(...u))},r=o=>{var f,h;!e&&!o&&this.services.languageDetector&&(o=[]);const l=d(o)?o:o&&o[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(d(o)?[o]:o);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(h=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||h.call(f,u)),this.loadResources(u,m=>{n(m,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?r(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e),i}getFixedT(e,t,i){const s=(n,r,...o)=>{let l;typeof r!="object"?l=this.options.overloadTranslationOptionHandler([n,r].concat(o)):l=g({},r),l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||i||s.keyPrefix);const u=this.options.keySeparator||".";let f;return l.keyPrefix&&Array.isArray(n)?f=n.map(h=>`${l.keyPrefix}${u}${h}`):f=l.keyPrefix?`${l.keyPrefix}${u}${n}`:n,this.t(f,l)};return d(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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;const i=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const r=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,r);if(o!==void 0)return o}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||r(i,e)&&(!s||r(n,e)))}loadNamespaces(e,t){const i=L();return this.options.ns?(d(e)&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{i.resolve(),t&&t(s)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=L();d(e)&&(e=[e]);const s=this.options.preload||[],n=e.filter(r=>s.indexOf(r)<0&&this.services.languageUtils.isSupportedCode(r));return n.length?(this.options.preload=s.concat(n),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}dir(e){var s,n;if(e||(e=this.resolvedLanguage||(((s=this.languages)==null?void 0:s.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const r=new Intl.Locale(e);if(r&&r.getTextInfo){const o=r.getTextInfo();if(o&&o.direction)return o.direction}}catch(r){}const 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"],i=((n=this.services)==null?void 0:n.languageUtils)||new fe(me());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new B(e,t)}cloneInstance(e={},t=Z){const i=e.forkResourceStore;i&&delete e.forkResourceStore;const s=v(g(g({},this.options),e),{isClone:!0}),n=new B(s);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(o=>{n[o]=this[o]}),n.services=g({},this.services),n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},i){const o=Object.keys(this.store.data).reduce((l,u)=>(l[u]=g({},this.store.data[u]),l[u]=Object.keys(l[u]).reduce((f,h)=>(f[h]=g({},l[u][h]),f),l[u]),l),{});n.store=new oe(o,s),n.services.resourceStore=n.store}return n.translator=new G(n.services,s),n.translator.on("*",(o,...l)=>{n.emit(o,...l)}),n.init(s,t),n.translator.options=s,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const y=B.createInstance();y.createInstance=B.createInstance,y.createInstance,y.dir,y.init,y.loadResources,y.reloadResources,y.use,y.changeLanguage,y.getFixedT,y.t,y.exists,y.setDefaultNamespace,y.hasLoadedNamespace,y.loadNamespaces,y.loadLanguages;const Ye=(a,e)=>{for(const t of e){const i=a.find(t);i&&i.each((s,n)=>{const r=$(n);if(r.attr("data-i18n"))return;const o=r.text().trim();o&&(r.attr({"data-i18n":o}),r.text(y.t(o)));const l=r.attr("placeholder");l&&(r.attr({"data-i18n":"[placeholder]"+l}),r.attr({placeholder:y.t(l)}))})}},M=a=>{for(const e of a){const t=$(e);t&&t.each((i,s)=>{const n=$(s);if(n.attr("data-i18n"))return;const r=n.text().trim();r&&(n.attr({"data-i18n":r}),n.text(y.t(r)));const o=n.attr("placeholder");o&&(n.attr({"data-i18n":"[placeholder]"+o}),n.attr({placeholder:y.t(o)}))})}},ye=[".hiprint-option-item-label","textarea","input","select option",".option","button","label",".hiprint-option-title",".hiprint-option-item-desc",".hiprint-multiselect-search",".hiprint-multiselect-custom-input",".hiprint-multiselect-trigger .hiprint-multiselect-text",".hiprint-multiselect-item span",".hiprint-multiselect-actions button"],Qe=(a,e,t=ye)=>{Ye(e,t)},Se=(a="[data-i18n]")=>{document.querySelectorAll(a).forEach(e=>{const t=e.getAttribute("data-i18n");if(!t.includes("[")){e.textContent=y.t(t);return}const i=t.match(/\[([^\]]+)\](.+)/);if(i&&i.length===3){const s=i[1],n=i[2];e.setAttribute(s,y.t(n))}})};let be=!1;const Le=a=>{if(be)return;be=!0,globalThis.hiprint.i18next=y,globalThis.hiprint.t=y.t;const e=Object.keys(a.resources||{});globalThis.hiprint.languages=["简体中文",...e],globalThis.hiprint.changeLanguage=(t,i)=>{y.changeLanguage(t,(s,n)=>{i&&i(s,n),Se()})}},Oe=a=>{setTimeout(()=>{Se(".printSetting .hiprint-multiselect [data-i18n]"),$(".printSetting .hiprint-multiselect").length&&$(".printSetting .hiprint-multiselect-trigger").off("click.multiselect-trigger").on("click.multiselect-trigger",()=>{console.log("click multiselect"),setTimeout(()=>{M((a==null?void 0:a.optionsSelectorList)||ye)},0)})},0)};function Ge(a,e){y.init(g({},a),(i,s)=>{e&&e(y,s,i)});let t=[];return{name:"i18n",description:"i18next",hooks:[{hook:"ready",name:"i18n set",description:"添加 i18n 方法",priority:1,run:()=>{Le(a)}},{hook:"getOptionItem",name:"i18n options",description:"渲染元素属性时做多语言处理",priority:1,run:i=>{if(i){if(!i._translationWrapped){i._translationWrapped=!0;const s=i.createTarget;i.createTarget=function(...n){const r=s.call(i,...n);return t.indexOf(i.name)!==-1&&r.attr("data-name")||(r.attr({"data-name":i.name}),Qe(i,r,a==null?void 0:a.optionsSelectorList)),r}}return t.indexOf(i.name)===-1&&t.push(i.name),i}}},{hook:"onDesigned",name:"i18n other selector",description:"其他UI选择器多语言处理",priority:1,run:({hiprint:i,designerUtils:s})=>{var o;Le(a);const n=(o=s.printTemplate)==null?void 0:o.id;n&&(a!=null&&a.onDesigned&&(a==null||a.onDesigned(s)),globalThis.hinnn.event.on("BuildCustomOptionSettingEventKey_"+n,l=>{a!=null&&a.onPanelSelected&&(a==null||a.onPanelSelected()),Oe(a)}),globalThis.hinnn.event.on("PrintElementSelectEventKey_"+n,l=>{setTimeout(()=>{M([".printSetting .prop-tab-items .tab-title"]),Oe(a),a!=null&&a.onElementSelected&&(a==null||a.onElementSelected(l))},0)}),$(".hiprint-printPaper.design").on("contextmenu",()=>{M([".hicontextmenu .hicontextmenuitem .title span",".hicontextmenu .hicontextmenuitem .nav"])})),M([".svp-header p",".svp-tools .tool-name",".svp-dragbox .header span",".preview-bar button span",".printer-list-txt"])}},{hook:"onPreview",name:"i18n preview selector",description:"组件内预览选择器多语言处理",priority:1,run:i=>{setTimeout(()=>{M([".preview-bar button span",".printer-list-txt"])},0)}}],leastHiprintVersion:"0.1.28"}}b.default=Ge,b.translateBySelector=M,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(b,d){typeof exports=="object"&&typeof module!="undefined"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(b=typeof globalThis!="undefined"?globalThis:b||self,d(b.pluginI18n={}))})(this,function(b){"use strict";var qe=Object.defineProperty,et=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var $e=Object.getOwnPropertySymbols;var st=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var Re=(b,d,L)=>d in b?qe(b,d,{enumerable:!0,configurable:!0,writable:!0,value:L}):b[d]=L,g=(b,d)=>{for(var L in d||(d={}))st.call(d,L)&&Re(b,L,d[L]);if($e)for(var L of $e(d))it.call(d,L)&&Re(b,L,d[L]);return b},v=(b,d)=>et(b,tt(d));const d=r=>typeof r=="string",L=()=>{let r,e;const t=new Promise((s,i)=>{r=s,e=i});return t.resolve=r,t.reject=e,t},se=r=>r==null?"":""+r,ke=(r,e,t)=>{r.forEach(s=>{e[s]&&(t[s]=e[s])})},Ne=/###/g,ie=r=>r&&r.indexOf("###")>-1?r.replace(Ne,"."):r,ne=r=>!r||d(r),U=(r,e,t)=>{const s=d(e)?e.split("."):e;let i=0;for(;i<s.length-1;){if(ne(r))return{};const n=ie(s[i]);!r[n]&&t&&(r[n]=new t),Object.prototype.hasOwnProperty.call(r,n)?r=r[n]:r={},++i}return ne(r)?{}:{obj:r,k:ie(s[i])}},re=(r,e,t)=>{const{obj:s,k:i}=U(r,e,Object);if(s!==void 0||e.length===1){s[i]=t;return}let n=e[e.length-1],a=e.slice(0,e.length-1),o=U(r,a,Object);for(;o.obj===void 0&&a.length;)n=`${a[a.length-1]}.${n}`,a=a.slice(0,a.length-1),o=U(r,a,Object),o!=null&&o.obj&&typeof o.obj[`${o.k}.${n}`]!="undefined"&&(o.obj=void 0);o.obj[`${o.k}.${n}`]=t},Te=(r,e,t,s)=>{const{obj:i,k:n}=U(r,e,Object);i[n]=i[n]||[],i[n].push(t)},W=(r,e)=>{const{obj:t,k:s}=U(r,e);if(t&&Object.prototype.hasOwnProperty.call(t,s))return t[s]},Fe=(r,e,t)=>{const s=W(r,t);return s!==void 0?s:W(e,t)},ae=(r,e,t)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in r?d(r[s])||r[s]instanceof String||d(e[s])||e[s]instanceof String?t&&(r[s]=e[s]):ae(r[s],e[s],t):r[s]=e[s]);return r},M=r=>r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ee={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const je=r=>d(r)?r.replace(/[&<>"'\/]/g,e=>Ee[e]):r;class Ie{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const De=[" ",",","?","!",";"],Ve=new Ie(20),Ae=(r,e,t)=>{e=e||"",t=t||"";const s=De.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(s.length===0)return!0;const i=Ve.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let n=!i.test(r);if(!n){const a=r.indexOf(t);a>0&&!i.test(r.substring(0,a))&&(n=!0)}return n},ee=(r,e,t=".")=>{if(!r)return;if(r[e])return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0;const s=e.split(t);let i=r;for(let n=0;n<s.length;){if(!i||typeof i!="object")return;let a,o="";for(let l=n;l<s.length;++l)if(l!==n&&(o+=t),o+=s[l],a=i[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;n+=l-n+1;break}i=a}return i},H=r=>r==null?void 0:r.replace("_","-"),Ke={type:"logger",log(r){this.output("log",r)},warn(r){this.output("warn",r)},error(r){this.output("error",r)},output(r,e){var t,s;(s=(t=console==null?void 0:console[r])==null?void 0:t.apply)==null||s.call(t,console,e)}};class Y{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Ke,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,i){return i&&!this.debug?null:(d(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Y(this.logger,g({prefix:`${this.prefix}:${e}:`},this.options))}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Y(this.logger,e)}}var T=new Y;class Q{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(t)||0;this.observers[s].set(t,i+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,n])=>{for(let a=0;a<n;a++)i(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,n])=>{for(let a=0;a<n;a++)i.apply(i,[e,...t])})}}class oe extends Q{constructor(e,t={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){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s,i={}){var u,f;const n=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],s&&(Array.isArray(s)?o.push(...s):d(s)&&n?o.push(...s.split(n)):o.push(s)));const l=W(this.data,o);return!l&&!t&&!s&&e.indexOf(".")>-1&&(e=o[0],t=o[1],s=o.slice(2).join(".")),l||!a||!d(s)?l:ee((f=(u=this.data)==null?void 0:u[e])==null?void 0:f[t],s,n)}addResource(e,t,s,i,n={silent:!1}){const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=[e,t];s&&(o=o.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(o=e.split("."),i=t,t=o[1]),this.addNamespaces(t),re(this.data,o,i),n.silent||this.emit("added",e,t,s,i)}addResources(e,t,s,i={silent:!1}){for(const n in s)(d(s[n])||Array.isArray(s[n]))&&this.addResource(e,t,n,s[n],{silent:!0});i.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,i,n,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),i=s,s=t,t=o[1]),this.addNamespaces(t);let l=W(this.data,o)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?ae(l,s,n):l=g(g({},l),s),re(this.data,o,l),a.silent||this.emit("added",e,t,s)}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.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(i=>t[i]&&Object.keys(t[i]).length>0)}toJSON(){return this.data}}var le={processors:{},addPostProcessor(r){this.processors[r.name]=r},handle(r,e,t,s,i){return r.forEach(n=>{var a,o;e=(o=(a=this.processors[n])==null?void 0:a.process(e,t,s,i))!=null?o:e}),e}};const ue={},he=r=>!d(r)&&typeof r!="boolean"&&typeof r!="number";class G extends Q{constructor(e,t={}){super(),ke(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=T.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const s=g({},t);if(e==null)return!1;const i=this.resolve(e,s);return(i==null?void 0:i.res)!==void 0}extractFromKey(e,t){let s=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ae(e,s,i);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:d(n)?[n]:n};const u=e.split(s);(s!==i||s===i&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(i)}return{key:e,namespaces:d(n)?[n]:n}}translate(e,t,s){let i=typeof t=="object"?g({},t):t;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(i=g({},i)),i||(i={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const n=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],i),u=l[l.length-1];let f=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const h=i.lng||this.language,m=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((h==null?void 0:h.toLowerCase())==="cimode")return m?n?{res:`${u}${f}${o}`,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${f}${o}`:n?{res:o,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:o;const p=this.resolve(e,i);let c=p==null?void 0:p.res;const x=(p==null?void 0:p.usedKey)||o,S=(p==null?void 0:p.exactUsedKey)||o,k=["[object Number]","[object Function]","[object RegExp]"],R=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,V=!this.i18nFormat||this.i18nFormat.handleAsObject,w=i.count!==void 0&&!d(i.count),j=G.hasDefaultValue(i),X=w?this.pluralResolver.getSuffix(h,i.count,i):"",I=i.ordinal&&w?this.pluralResolver.getSuffix(h,i.count,{ordinal:!1}):"",z=w&&!i.ordinal&&i.count===0,C=z&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${X}`]||i[`defaultValue${I}`]||i.defaultValue;let O=c;V&&!c&&j&&(O=C);const Ze=he(O),Xe=Object.prototype.toString.apply(O);if(V&&O&&Ze&&k.indexOf(Xe)<0&&!(d(R)&&Array.isArray(O))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const F=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,O,v(g({},i),{ns:l})):`key '${o} (${this.language})' returned an object instead of string.`;return n?(p.res=F,p.usedParams=this.getUsedParamsDetails(i),p):F}if(a){const F=Array.isArray(O),N=F?[]:{},we=F?S:x;for(const E in O)if(Object.prototype.hasOwnProperty.call(O,E)){const D=`${we}${a}${E}`;j&&!c?N[E]=this.translate(D,v(g({},i),{defaultValue:he(C)?C[E]:void 0,joinArrays:!1,ns:l})):N[E]=this.translate(D,v(g({},i),{joinArrays:!1,ns:l})),N[E]===D&&(N[E]=O[E])}c=N}}else if(V&&d(R)&&Array.isArray(c))c=c.join(R),c&&(c=this.extendTranslation(c,e,i,s));else{let F=!1,N=!1;!this.isValidLookup(c)&&j&&(F=!0,c=C),this.isValidLookup(c)||(N=!0,c=o);const E=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:c,D=j&&C!==c&&this.options.updateMissing;if(N||F||D){if(this.logger.log(D?"updateKey":"missingKey",h,u,o,D?C:c),a){const P=this.resolve(o,v(g({},i),{keySeparator:!1}));P&&P.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 J=[];const q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&q&&q[0])for(let P=0;P<q.length;P++)J.push(q[P]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(i.lng||this.language):J.push(i.lng||this.language);const ve=(P,K,_)=>{var Pe;const Ce=j&&_!==c?_:E;this.options.missingKeyHandler?this.options.missingKeyHandler(P,u,K,Ce,D,i):(Pe=this.backendConnector)!=null&&Pe.saveMissing&&this.backendConnector.saveMissing(P,u,K,Ce,D,i),this.emit("missingKey",P,u,K,c)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?J.forEach(P=>{const K=this.pluralResolver.getSuffixes(P,i);z&&i[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(_=>{ve([P],o+_,i[`defaultValue${_}`]||C)})}):ve(J,o,C))}c=this.extendTranslation(c,e,i,p,s),N&&c===o&&this.options.appendNamespaceToMissingKey&&(c=`${u}${f}${o}`),(N||F)&&this.options.parseMissingKeyHandler&&(c=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${f}${o}`:o,F?c:void 0,i))}return n?(p.res=c,p.usedParams=this.getUsedParamsDetails(i),p):c}extendTranslation(e,t,s,i,n){var l,u;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,g(g({},this.options.interpolation.defaultVariables),s),s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(v(g({},s),{interpolation:g(g({},this.options.interpolation),s.interpolation)}));const f=d(e)&&(((u=s==null?void 0:s.interpolation)==null?void 0:u.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(f){const p=e.match(this.interpolator.nestingRegexp);h=p&&p.length}let m=s.replace&&!d(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(m=g(g({},this.options.interpolation.defaultVariables),m)),e=this.interpolator.interpolate(e,m,s.lng||this.language||i.usedLng,s),f){const p=e.match(this.interpolator.nestingRegexp),c=p&&p.length;h<c&&(s.nest=!1)}!s.lng&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...p)=>(n==null?void 0:n[0])===p[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`),null):this.translate(...p,t),s)),s.interpolation&&this.interpolator.reset()}const a=s.postProcess||this.options.postProcess,o=d(a)?[a]:a;return e!=null&&(o!=null&&o.length)&&s.applyPostProcessor!==!1&&(e=le.handle(o,e,t,this.options&&this.options.postProcessPassResolved?g({i18nResolved:v(g({},i),{usedParams:this.getUsedParamsDetails(s)})},s):s,this)),e}resolve(e,t={}){let s,i,n,a,o;return d(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,t),f=u.key;i=f;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const m=t.count!==void 0&&!d(t.count),p=m&&!t.ordinal&&t.count===0,c=t.context!==void 0&&(d(t.context)||typeof t.context=="number")&&t.context!=="",x=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);h.forEach(S=>{var k,R;this.isValidLookup(s)||(o=S,!ue[`${x[0]}-${S}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((R=this.utils)!=null&&R.hasLoadedNamespace(o))&&(ue[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${x.join(", ")}" won't get resolved as namespace "${o}" 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!!!")),x.forEach(V=>{var X;if(this.isValidLookup(s))return;a=V;const w=[f];if((X=this.i18nFormat)!=null&&X.addLookupKeys)this.i18nFormat.addLookupKeys(w,f,V,S,t);else{let I;m&&(I=this.pluralResolver.getSuffix(V,t.count,t));const z=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(w.push(f+I),t.ordinal&&I.indexOf(C)===0&&w.push(f+I.replace(C,this.options.pluralSeparator)),p&&w.push(f+z)),c){const O=`${f}${this.options.contextSeparator}${t.context}`;w.push(O),m&&(w.push(O+I),t.ordinal&&I.indexOf(C)===0&&w.push(O+I.replace(C,this.options.pluralSeparator)),p&&w.push(O+z))}}let j;for(;j=w.pop();)this.isValidLookup(s)||(n=j,s=this.getResource(V,S,j,t))}))})}),{res:s,usedKey:i,exactUsedKey:n,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,s,i={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,s,i):this.resourceStore.getResource(e,t,s,i)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!d(e.replace);let i=s?e.replace:e;if(s&&typeof e.count!="undefined"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i=g(g({},this.options.interpolation.defaultVariables),i)),!s){i=g({},i);for(const n of t)delete i[n]}return i}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&e[s]!==void 0)return!0;return!1}}class fe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=T.create("languageUtils")}getScriptPartFromCode(e){if(e=H(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=H(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(d(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(s){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}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(s=>{if(t)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(t=i)}),!t&&this.options.supportedLngs&&e.forEach(s=>{if(t)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return t=i;const n=this.getLanguagePartFromCode(s);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(a=>{if(a===n)return a;if(!(a.indexOf("-")<0&&n.indexOf("-")<0)&&(a.indexOf("-")>0&&n.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===n||a.indexOf(n)===0&&n.length>1))return a})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),d(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),i=[],n=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return d(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):d(e)&&n(this.formatLanguageCode(e)),s.forEach(a=>{i.indexOf(a)<0&&n(this.formatLanguageCode(a))}),i}}const ce={zero:0,one:1,two:2,few:3,many:4,other:5},de={select:r=>r===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Me{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=T.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const s=H(e==="dev"?"en":e),i=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:s,type:i});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let a;try{a=new Intl.PluralRules(s,{type:i})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),de;if(!e.match(/-|_/))return de;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[n]=a,a}needsPlural(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,s={}){return this.getSuffixes(e,s).map(i=>`${t}${i}`)}getSuffixes(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?s.resolvedOptions().pluralCategories.sort((i,n)=>ce[i]-ce[n]).map(i=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,t,s={}){const i=this.getRule(e,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}const pe=(r,e,t,s=".",i=!0)=>{let n=Fe(r,e,t);return!n&&i&&d(t)&&(n=ee(r,t,s),n===void 0&&(n=ee(e,t,s))),n},te=r=>r.replace(/\$/g,"$$$$");class Ue{constructor(e={}){var t;this.logger=T.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:i,prefix:n,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:f,unescapePrefix:h,nestingPrefix:m,nestingPrefixEscaped:p,nestingSuffix:c,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:k,alwaysFormat:R}=e.interpolation;this.escape=t!==void 0?t:je,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=n?M(n):a||"{{",this.suffix=o?M(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=f?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=m?M(m):p||M("$t("),this.nestingSuffix=c?M(c):x||M(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=k||1e3,this.alwaysFormat=R!==void 0?R:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,s)=>(t==null?void 0:t.source)===s?(t.lastIndex=0,t):new RegExp(s,"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,s,i){var p;let n,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=c=>{if(c.indexOf(this.formatSeparator)<0){const R=pe(t,l,c,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(R,void 0,s,v(g(g({},i),t),{interpolationkey:c})):R}const x=c.split(this.formatSeparator),S=x.shift().trim(),k=x.join(this.formatSeparator).trim();return this.format(pe(t,l,S,this.options.keySeparator,this.options.ignoreJSONStructure),k,s,v(g(g({},i),t),{interpolationkey:S}))};this.resetRegExp();const f=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((p=i==null?void 0:i.interpolation)==null?void 0:p.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:c=>te(c)},{regex:this.regexp,safeValue:c=>this.escapeValue?te(this.escape(c)):te(c)}].forEach(c=>{for(o=0;n=c.regex.exec(e);){const x=n[1].trim();if(a=u(x),a===void 0)if(typeof f=="function"){const k=f(e,n,i);a=d(k)?k:""}else if(i&&Object.prototype.hasOwnProperty.call(i,x))a="";else if(h){a=n[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),a="";else!d(a)&&!this.useRawValueToEscape&&(a=se(a));const S=c.safeValue(a);if(e=e.replace(n[0],S),h?(c.regex.lastIndex+=a.length,c.regex.lastIndex-=n[0].length):c.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,s={}){let i,n,a;const o=(l,u)=>{var x;const f=this.nestingOptionsSeparator;if(l.indexOf(f)<0)return l;const h=l.split(new RegExp(`${f}[ ]*{`));let m=`{${h[1]}`;l=h[0],m=this.interpolate(m,a);const p=m.match(/'/g),c=m.match(/"/g);(((x=p==null?void 0:p.length)!=null?x:0)%2===0&&!c||c.length%2!==0)&&(m=m.replace(/'/g,'"'));try{a=JSON.parse(m),u&&(a=g(g({},u),a))}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,S),`${l}${f}${m}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];a=g({},s),a=a.replace&&!d(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(l=i[1].slice(u).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),n=t(o.call(this,i[1].trim(),a),a),n&&i[0]===e&&!d(n))return n;d(n)||(n=se(n)),n||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((f,h)=>this.format(f,h,s.lng,v(g({},s),{interpolationkey:i[1].trim()})),n.trim())),e=e.replace(i[0],n),this.regexp.lastIndex=0}return e}}const He=r=>{let e=r.toLowerCase().trim();const t={};if(r.indexOf("(")>-1){const s=r.split("(");e=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);e==="currency"&&i.indexOf(":")<0?t.currency||(t.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?t.range||(t.range=i.trim()):i.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),f=o.trim();t[f]||(t[f]=u),u==="false"&&(t[f]=!1),u==="true"&&(t[f]=!0),isNaN(u)||(t[f]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ge=r=>{const e={};return(t,s,i)=>{let n=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(n=v(g({},n),{[i.interpolationkey]:void 0}));const a=s+JSON.stringify(n);let o=e[a];return o||(o=r(H(s),i),e[a]=o),o(t)}},Be=r=>(e,t,s)=>r(H(t),s)(e);class ze{constructor(e={}){this.logger=T.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const s=t.cacheInBuiltFormats?ge:Be;this.formats={number:s((i,n)=>{const a=new Intl.NumberFormat(i,g({},n));return o=>a.format(o)}),currency:s((i,n)=>{const a=new Intl.NumberFormat(i,v(g({},n),{style:"currency"}));return o=>a.format(o)}),datetime:s((i,n)=>{const a=new Intl.DateTimeFormat(i,g({},n));return o=>a.format(o)}),relativetime:s((i,n)=>{const a=new Intl.RelativeTimeFormat(i,g({},n));return o=>a.format(o,n.range||"day")}),list:s((i,n)=>{const a=new Intl.ListFormat(i,g({},n));return o=>a.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ge(t)}format(e,t,s,i={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(o=>o.indexOf(")")>-1)){const o=n.findIndex(l=>l.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,o)].join(this.formatSeparator)}return n.reduce((o,l)=>{var h;const{formatName:u,formatOptions:f}=He(l);if(this.formats[u]){let m=o;try{const p=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},c=p.locale||p.lng||i.locale||i.lng||s;m=this.formats[u](o,c,g(g(g({},f),i),p))}catch(p){this.logger.warn(p)}return m}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const Je=(r,e)=>{r.pending[e]!==void 0&&(delete r.pending[e],r.pendingCount--)};class _e extends Q{constructor(e,t,s,i={}){var n,a;super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=T.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(a=(n=this.backend)==null?void 0:n.init)==null||a.call(n,s,i.backend,i)}queueLoad(e,t,s,i){const n={},a={},o={},l={};return e.forEach(u=>{let f=!0;t.forEach(h=>{const m=`${u}|${h}`;!s.reload&&this.store.hasResourceBundle(u,h)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?a[m]===void 0&&(a[m]=!0):(this.state[m]=1,f=!1,a[m]===void 0&&(a[m]=!0),n[m]===void 0&&(n[m]=!0),l[h]===void 0&&(l[h]=!0)))}),f||(o[u]=!0)}),(Object.keys(n).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(n),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,s){const i=e.split("|"),n=i[0],a=i[1];t&&this.emit("failedLoading",n,a,t),!t&&s&&this.store.addResourceBundle(n,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const o={};this.queue.forEach(l=>{Te(l.loaded,[n],a),Je(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const f=l.loaded[u];f.length&&f.forEach(h=>{o[u][h]===void 0&&(o[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,s,i=0,n=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:s,tried:i,wait:n,callback:a});return}this.readingCalls++;const o=(u,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&f&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,s,i+1,n*2,a)},n);return}a(u,f)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(f=>o(null,f)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();d(e)&&(e=this.languageUtils.toResolveHierarchy(e)),d(t)&&(t=[t]);const n=this.queueLoad(e,t,s,i);if(!n.toLoad.length)return n.pending.length||i(),null;n.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e,t=""){const s=e.split("|"),i=s[0],n=s[1];this.read(i,n,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${n} for language ${i} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${n} for language ${i}`,o),this.loaded(e,a,o)})}saveMissing(e,t,s,i,n,a={},o=()=>{}){var l,u,f,h,m;if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((h=(f=this.services)==null?void 0:f.utils)!=null&&h.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${s}" 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(!(s==null||s==="")){if((m=this.backend)!=null&&m.create){const p=v(g({},a),{isUpdate:n}),c=this.backend.create.bind(this.backend);if(c.length<6)try{let x;c.length===5?x=c(e,t,s,i,p):x=c(e,t,s,i),x&&typeof x.then=="function"?x.then(S=>o(null,S)).catch(o):o(null,x)}catch(x){o(x)}else c(e,t,s,i,o,p)}!e||!e[0]||this.store.addResource(e[0],t,s,i)}}}const me=()=>({debug:!1,initAsync:!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]),d(r[1])&&(e.defaultValue=r[1]),d(r[2])&&(e.tDescription=r[2]),typeof r[2]=="object"||typeof r[3]=="object"){const t=r[3]||r[2];Object.keys(t).forEach(s=>{e[s]=t[s]})}return e},interpolation:{escapeValue:!0,format:r=>r,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),xe=r=>{var e,t;return d(r.ns)&&(r.ns=[r.ns]),d(r.fallbackLng)&&(r.fallbackLng=[r.fallbackLng]),d(r.fallbackNS)&&(r.fallbackNS=[r.fallbackNS]),((t=(e=r.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(r.supportedLngs=r.supportedLngs.concat(["cimode"])),typeof r.initImmediate=="boolean"&&(r.initAsync=r.initImmediate),r},Z=()=>{},We=r=>{Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(t=>{typeof r[t]=="function"&&(r[t]=r[t].bind(r))})};class B extends Q{constructor(e={},t){if(super(),this.options=xe(e),this.services={},this.logger=T,this.modules={external:[]},We(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(d(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=me();this.options=g(g(g({},s),this.options),xe(e)),this.options.interpolation=g(g({},s.interpolation),this.options.interpolation),e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?T.init(i(this.modules.logger),this.options):T.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=ze;const f=new fe(this.options);this.store=new oe(this.options.resources,this.options);const h=this.services;h.logger=T,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new Me(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(h.formatter=i(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new Ue(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new _e(i(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(p,...c)=>{this.emit(p,...c)}),this.modules.languageDetector&&(h.languageDetector=i(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=i(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new G(this.services,this.options),this.translator.on("*",(p,...c)=>{this.emit(p,...c)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Z),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...f)=>this.store[u](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...f)=>(this.store[u](...f),this)});const o=L(),l=()=>{const u=(f,h)=>{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),o.resolve(h),t(f,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,t=Z){var n,a;let s=t;const i=d(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const o=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(h=>{h!=="cimode"&&o.indexOf(h)<0&&o.push(h)})};i?l(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>l(f)),(a=(n=this.options.preload)==null?void 0:n.forEach)==null||a.call(n,u=>l(u)),this.services.backendConnector.load(o,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(u)})}else s(null)}reloadResources(e,t,s){const i=L();return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=Z),this.services.backendConnector.reload(e,t,n=>{i.resolve(),s(n)}),i}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"&&le.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++){const s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const s=L();this.emit("languageChanging",e);const i=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},n=(o,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,s.resolve((...u)=>this.t(...u)),t&&t(o,(...u)=>this.t(...u))},a=o=>{var f,h;!e&&!o&&this.services.languageDetector&&(o=[]);const l=d(o)?o:o&&o[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(d(o)?[o]:o);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),(h=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||h.call(f,u)),this.loadResources(u,m=>{n(m,u)})};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,s){const i=(n,a,...o)=>{let l;typeof a!="object"?l=this.options.overloadTranslationOptionHandler([n,a].concat(o)):l=g({},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||s||i.keyPrefix);const u=this.options.keySeparator||".";let f;return l.keyPrefix&&Array.isArray(n)?f=n.map(h=>`${l.keyPrefix}${u}${h}`):f=l.keyPrefix?`${l.keyPrefix}${u}${n}`:n,this.t(f,l)};return d(e)?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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;const s=t.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!i||a(n,e)))}loadNamespaces(e,t){const s=L();return this.options.ns?(d(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),t&&t(i)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=L();d(e)&&(e=[e]);const i=this.options.preload||[],n=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return n.length?(this.options.preload=i.concat(n),this.loadResources(a=>{s.resolve(),t&&t(a)}),s):(t&&t(),Promise.resolve())}dir(e){var i,n;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const o=a.getTextInfo();if(o&&o.direction)return o.direction}}catch(a){}const 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"],s=((n=this.services)==null?void 0:n.languageUtils)||new fe(me());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new B(e,t)}cloneInstance(e={},t=Z){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const i=v(g(g({},this.options),e),{isClone:!0}),n=new B(i);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(o=>{n[o]=this[o]}),n.services=g({},this.services),n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s){const o=Object.keys(this.store.data).reduce((l,u)=>(l[u]=g({},this.store.data[u]),l[u]=Object.keys(l[u]).reduce((f,h)=>(f[h]=g({},l[u][h]),f),l[u]),l),{});n.store=new oe(o,i),n.services.resourceStore=n.store}return n.translator=new G(n.services,i),n.translator.on("*",(o,...l)=>{n.emit(o,...l)}),n.init(i,t),n.translator.options=i,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const y=B.createInstance();y.createInstance=B.createInstance,y.createInstance,y.dir,y.init,y.loadResources,y.reloadResources,y.use,y.changeLanguage,y.getFixedT,y.t,y.exists,y.setDefaultNamespace,y.hasLoadedNamespace,y.loadNamespaces,y.loadLanguages;const Ye=(r,e)=>{for(const t of e){const s=r.find(t);s&&s.each((i,n)=>{const a=$(n);if(a.attr("data-i18n"))return;const o=a.text().trim();o&&(a.attr({"data-i18n":o}),a.text(y.t(o)));const l=a.attr("placeholder");l&&(a.attr({"data-i18n":"[placeholder]"+l}),a.attr({placeholder:y.t(l)}))})}},A=r=>{for(const e of r){const t=$(e);t&&t.each((s,i)=>{const n=$(i);if(n.attr("data-i18n"))return;const a=n.text().trim();a&&(n.attr({"data-i18n":a}),n.text(y.t(a)));const o=n.attr("placeholder");o&&(n.attr({"data-i18n":"[placeholder]"+o}),n.attr({placeholder:y.t(o)}))})}},ye=[".hiprint-option-item-label","textarea","input","select option",".option","button","label",".hiprint-option-title",".hiprint-option-item-desc",".hiprint-multiselect-search",".hiprint-multiselect-custom-input",".hiprint-multiselect-trigger .hiprint-multiselect-text",".hiprint-multiselect-item span",".hiprint-multiselect-actions button"],Qe=(r,e,t=ye)=>{Ye(e,t)},Se=(r="[data-i18n]")=>{document.querySelectorAll(r).forEach(e=>{const t=e.getAttribute("data-i18n");if(!t.includes("[")){e.textContent=y.t(t);return}const s=t.match(/\[([^\]]+)\](.+)/);if(s&&s.length===3){const i=s[1],n=s[2];e.setAttribute(i,y.t(n))}})};let be=!1;const Le=r=>{if(be)return;be=!0,globalThis.hiprint.i18next=y,globalThis.hiprint.t=y.t;const e=Object.keys(r.resources||{});globalThis.hiprint.languages=["简体中文",...e],globalThis.hiprint.changeLanguage=(t,s)=>{y.changeLanguage(t,(i,n)=>{s&&s(i,n),Se()})}},Oe=r=>{setTimeout(()=>{Se(".printSetting .hiprint-multiselect [data-i18n]"),$(".printSetting .hiprint-multiselect").length&&$(".printSetting .hiprint-multiselect-trigger").off("click.multiselect-trigger").on("click.multiselect-trigger",()=>{console.log("click multiselect"),setTimeout(()=>{A((r==null?void 0:r.optionsSelectorList)||ye)},0)})},0)};function Ge(r,e){y.init(g({},r),(s,i)=>{e&&e(y,i,s)});let t=[];return{name:"i18n",description:"i18next",hooks:[{hook:"ready",name:"i18n set",description:"添加 i18n 方法",priority:1,run:()=>{Le(r)}},{hook:"getOptionItem",name:"i18n options",description:"渲染元素属性时做多语言处理",priority:1,run:s=>{if(s){if(!s._translationWrapped){s._translationWrapped=!0;const i=s.createTarget;s.createTarget=function(...n){const a=i.call(s,...n);return t.indexOf(s.name)!==-1&&a.attr("data-name")||(a.attr({"data-name":s.name}),Qe(s,a,r==null?void 0:r.optionsSelectorList)),a}}return t.indexOf(s.name)===-1&&t.push(s.name),s}}},{hook:"onDesigned",name:"i18n other selector",description:"其他UI选择器多语言处理",priority:9,run:({hiprint:s,designerUtils:i})=>{Le(r),setTimeout(()=>{var o;const n=(o=i.printTemplate)==null?void 0:o.id;n&&(r!=null&&r.onDesigned&&(r==null||r.onDesigned(i)),globalThis.hinnn.event.on("BuildCustomOptionSettingEventKey_"+n,l=>{r!=null&&r.onPanelSelected&&(r==null||r.onPanelSelected()),Oe(r)}),globalThis.hinnn.event.on("PrintElementSelectEventKey_"+n,l=>{setTimeout(()=>{A([".printSetting .prop-tab-items .tab-title"]),Oe(r),r!=null&&r.onElementSelected&&(r==null||r.onElementSelected(l))},0)}),$(".hiprint-printPaper.design").on("contextmenu",()=>{A([".hicontextmenu .hicontextmenuitem .title span",".hicontextmenu .hicontextmenuitem .nav"])})),A([".svp-header p",".svp-tools .tool-name",".svp-dragbox .header span",".preview-bar button span",".printer-list-txt"])},(r==null?void 0:r.onDesignedDelay)||600)}},{hook:"onSettings",name:"i18n settings",description:"设置选择器多语言处理",priority:1,run:s=>{s.type=="show"&&setTimeout(()=>{A([".settings-body .svp-tab"])},0),r!=null&&r.onSettings&&(r==null||r.onSettings(s))}},{hook:"onPreview",name:"i18n preview selector",description:"组件内预览选择器多语言处理",priority:1,run:s=>{setTimeout(()=>{A([".preview-bar button span",".printer-list-txt"])},(r==null?void 0:r.onPreviewDelay)||0),r!=null&&r.onPreview&&(r==null||r.onPreview(s))}}],leastHiprintVersion:"0.1.28"}}b.default=Ge,b.translateBySelector=A,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-i18n",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "sv-print 多语言插件",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "scripts": {
23
- "build": "vite build && tsc src/index.ts --declaration --emitDeclarationOnly --outDir dist",
23
+ "build": "vite build && tsc -p tsconfig.json",
24
24
  "build-browserify": "vite build --mode=browserify",
25
25
  "pub": "pnpm build && npm --registry https://registry.npmjs.org/ publish --access public",
26
26
  "pub-beta": "pnpm build && npm --registry https://registry.npmjs.org/ publish --access public --tag beta"