authhero 0.53.0 → 0.55.0

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/authhero.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var Ih=Object.defineProperty;var Eh=(n,e,t)=>e in n?Ih(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var te=(n,e,t)=>Eh(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@hono/zod-openapi"),X=n=>typeof n=="string",ni=()=>{let n,e;const t=new Promise((i,r)=>{n=i,e=r});return t.resolve=n,t.reject=e,t},cl=n=>n==null?"":""+n,$h=(n,e,t)=>{n.forEach(i=>{e[i]&&(t[i]=e[i])})},Ch=/###/g,ll=n=>n&&n.indexOf("###")>-1?n.replace(Ch,"."):n,ul=n=>!n||X(n),ai=(n,e,t)=>{const i=X(e)?e.split("."):e;let r=0;for(;r<i.length-1;){if(ul(n))return{};const s=ll(i[r]);!n[s]&&t&&(n[s]=new t),Object.prototype.hasOwnProperty.call(n,s)?n=n[s]:n={},++r}return ul(n)?{}:{obj:n,k:ll(i[r])}},dl=(n,e,t)=>{const{obj:i,k:r}=ai(n,e,Object);if(i!==void 0||e.length===1){i[r]=t;return}let s=e[e.length-1],o=e.slice(0,e.length-1),c=ai(n,o,Object);for(;c.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),c=ai(n,o,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=t},zh=(n,e,t,i)=>{const{obj:r,k:s}=ai(n,e,Object);r[s]=r[s]||[],r[s].push(t)},lr=(n,e)=>{const{obj:t,k:i}=ai(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},jh=(n,e,t)=>{const i=lr(n,t);return i!==void 0?i:lr(e,t)},kd=(n,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in n?X(n[i])||n[i]instanceof String||X(e[i])||e[i]instanceof String?t&&(n[i]=e[i]):kd(n[i],e[i],t):n[i]=e[i]);return n},kn=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Oh=n=>X(n)?n.replace(/[&<>"'\/]/g,e=>Nh[e]):n;class Bh{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 Th=[" ",",","?","!",";"],Rh=new Bh(20),Ph=(n,e,t)=>{e=e||"",t=t||"";const i=Th.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(i.length===0)return!0;const r=Rh.getRegExp(`(${i.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!r.test(n);if(!s){const o=n.indexOf(t);o>0&&!r.test(n.substring(0,o))&&(s=!0)}return s},vo=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const i=e.split(t);let r=n;for(let s=0;s<i.length;){if(!r||typeof r!="object")return;let o,c="";for(let l=s;l<i.length;++l)if(l!==s&&(c+=t),c+=i[l],o=r[c],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<i.length-1)continue;s+=l-s+1;break}r=o}return r},ur=n=>n==null?void 0:n.replace("_","-"),Lh={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){var t,i;(i=(t=console==null?void 0:console[n])==null?void 0:t.apply)==null||i.call(t,console,e)}};class dr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Lh,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,r){return r&&!this.debug?null:(X(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new dr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new dr(this.logger,e)}}var ht=new dr;class is{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(t)||0;this.observers[i].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(o=>{let[c,l]=o;for(let u=0;u<l;u++)c(...i)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[c,l]=o;for(let u=0;u<l;u++)c.apply(c,[e,...i])})}}class pl extends is{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){var u,p;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,t],i&&(Array.isArray(i)?c.push(...i):X(i)&&s?c.push(...i.split(s)):c.push(i)));const l=lr(this.data,c);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=c[0],t=c[1],i=c.slice(2).join(".")),l||!o||!X(i)?l:vo((p=(u=this.data)==null?void 0:u[e])==null?void 0:p[t],i,s)}addResource(e,t,i,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=[e,t];i&&(c=c.concat(o?i.split(o):i)),e.indexOf(".")>-1&&(c=e.split("."),r=t,t=c[1]),this.addNamespaces(t),dl(this.data,c,r),s.silent||this.emit("added",e,t,i,r)}addResources(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in i)(X(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,r,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[e,t];e.indexOf(".")>-1&&(c=e.split("."),r=i,i=t,t=c[1]),this.addNamespaces(t);let l=lr(this.data,c)||{};o.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?kd(l,i,s):l={...l,...i},dl(this.data,c,l),o.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(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var xd={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,i,r){return n.forEach(s=>{var o;e=((o=this.processors[s])==null?void 0:o.process(e,t,i,r))??e}),e}};const fl={};class pr extends is{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),$h(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ht.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const i=this.resolve(e,t);return(i==null?void 0:i.res)!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const o=i&&e.indexOf(i)>-1,c=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ph(e,i,r);if(o&&!c){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:X(s)?[s]:s};const u=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(r)}return{key:e,namespaces:X(s)?[s]:s}}translate(e,t,i){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:c}=this.extractFromKey(e[e.length-1],t),l=c[c.length-1],u=t.lng||this.language,p=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode"){if(p){const q=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${q}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${q}${o}`}return r?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}const g=this.resolve(e,t);let _=g==null?void 0:g.res;const x=(g==null?void 0:g.usedKey)||o,h=(g==null?void 0:g.exactUsedKey)||o,m=Object.prototype.toString.apply(_),b=["[object Number]","[object Function]","[object RegExp]"],S=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,T=!X(_)&&typeof _!="boolean"&&typeof _!="number";if(O&&_&&T&&b.indexOf(m)<0&&!(X(S)&&Array.isArray(_))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const q=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,_,{...t,ns:c}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(g.res=q,g.usedParams=this.getUsedParamsDetails(t),g):q}if(s){const q=Array.isArray(_),oe=q?[]:{},pe=q?h:x;for(const ce in _)if(Object.prototype.hasOwnProperty.call(_,ce)){const Re=`${pe}${s}${ce}`;oe[ce]=this.translate(Re,{...t,joinArrays:!1,ns:c}),oe[ce]===Re&&(oe[ce]=_[ce])}_=oe}}else if(O&&X(S)&&Array.isArray(_))_=_.join(S),_&&(_=this.extendTranslation(_,e,t,i));else{let q=!1,oe=!1;const pe=t.count!==void 0&&!X(t.count),ce=pr.hasDefaultValue(t),Re=pe?this.pluralResolver.getSuffix(u,t.count,t):"",nt=t.ordinal&&pe?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",Fe=pe&&!t.ordinal&&t.count===0,$=Fe&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${Re}`]||t[`defaultValue${nt}`]||t.defaultValue;!this.isValidLookup(_)&&ce&&(q=!0,_=$),this.isValidLookup(_)||(oe=!0,_=o);const A=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&oe?void 0:_,w=ce&&$!==_&&this.options.updateMissing;if(oe||q||w){if(this.logger.log(w?"updateKey":"missingKey",u,l,o,w?$:_),s){const Z=this.resolve(o,{...t,keySeparator:!1});Z&&Z.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 v=[];const C=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&C&&C[0])for(let Z=0;Z<C.length;Z++)v.push(C[Z]);else this.options.saveMissingTo==="all"?v=this.languageUtils.toResolveHierarchy(t.lng||this.language):v.push(t.lng||this.language);const R=(Z,K,ee)=>{var M;const se=ce&&ee!==_?ee:A;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,l,K,se,w,t):(M=this.backendConnector)!=null&&M.saveMissing&&this.backendConnector.saveMissing(Z,l,K,se,w,t),this.emit("missingKey",Z,l,K,_)};this.options.saveMissing&&(this.options.saveMissingPlurals&&pe?v.forEach(Z=>{const K=this.pluralResolver.getSuffixes(Z,t);Fe&&t[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(ee=>{R([Z],o+ee,t[`defaultValue${ee}`]||$)})}):R(v,o,$))}_=this.extendTranslation(_,e,t,g,i),oe&&_===o&&this.options.appendNamespaceToMissingKey&&(_=`${l}:${o}`),(oe||q)&&this.options.parseMissingKeyHandler&&(_=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,q?_:void 0))}return r?(g.res=_,g.usedParams=this.getUsedParamsDetails(t),g):_}extendTranslation(e,t,i,r,s){var u,p;var o=this;if((u=this.i18nFormat)!=null&&u.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const g=X(e)&&(((p=i==null?void 0:i.interpolation)==null?void 0:p.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let _;if(g){const h=e.match(this.interpolator.nestingRegexp);_=h&&h.length}let x=i.replace&&!X(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),e=this.interpolator.interpolate(e,x,i.lng||this.language||r.usedLng,i),g){const h=e.match(this.interpolator.nestingRegexp),m=h&&h.length;_<m&&(i.nest=!1)}!i.lng&&r&&r.res&&(i.lng=this.language||r.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var h=arguments.length,m=new Array(h),b=0;b<h;b++)m[b]=arguments[b];return(s==null?void 0:s[0])===m[0]&&!i.context?(o.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${t[0]}`),null):o.translate(...m,t)},i)),i.interpolation&&this.interpolator.reset()}const c=i.postProcess||this.options.postProcess,l=X(c)?[c]:c;return e!=null&&(l!=null&&l.length)&&i.applyPostProcessor!==!1&&(e=xd.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i,r,s,o,c;return X(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const u=this.extractFromKey(l,t),p=u.key;r=p;let g=u.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const _=t.count!==void 0&&!X(t.count),x=_&&!t.ordinal&&t.count===0,h=t.context!==void 0&&(X(t.context)||typeof t.context=="number")&&t.context!=="",m=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);g.forEach(b=>{var S,O;this.isValidLookup(i)||(c=b,!fl[`${m[0]}-${b}`]&&((S=this.utils)!=null&&S.hasLoadedNamespace)&&!((O=this.utils)!=null&&O.hasLoadedNamespace(c))&&(fl[`${m[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${m.join(", ")}" won't get resolved as namespace "${c}" 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!!!")),m.forEach(T=>{var pe;if(this.isValidLookup(i))return;o=T;const q=[p];if((pe=this.i18nFormat)!=null&&pe.addLookupKeys)this.i18nFormat.addLookupKeys(q,p,T,b,t);else{let ce;_&&(ce=this.pluralResolver.getSuffix(T,t.count,t));const Re=`${this.options.pluralSeparator}zero`,nt=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(_&&(q.push(p+ce),t.ordinal&&ce.indexOf(nt)===0&&q.push(p+ce.replace(nt,this.options.pluralSeparator)),x&&q.push(p+Re)),h){const Fe=`${p}${this.options.contextSeparator}${t.context}`;q.push(Fe),_&&(q.push(Fe+ce),t.ordinal&&ce.indexOf(nt)===0&&q.push(Fe+ce.replace(nt,this.options.pluralSeparator)),x&&q.push(Fe+Re))}}let oe;for(;oe=q.pop();)this.isValidLookup(i)||(s=oe,i=this.getResource(T,b,oe,t))}))})}),{res:i,usedKey:r,exactUsedKey:s,usedLng:o,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i){var s;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!X(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const s of t)delete r[s]}return r}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 hl{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ht.create("languageUtils")}getScriptPartFromCode(e){if(e=ur(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=ur(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(X(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}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 r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),X(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||this.options.fallbackLng||[],e),r=[],s=o=>{o&&(this.isSupportedCode(o)?r.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return X(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):X(e)&&s(this.formatLanguageCode(e)),i.forEach(o=>{r.indexOf(o)<0&&s(this.formatLanguageCode(o))}),r}}const gl={zero:0,one:1,two:2,few:3,many:4,other:5},_l={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Uh{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=ht.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=ur(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),_l;if(!e.match(/-|_/))return _l;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[s]=o,o}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((r,s)=>gl[r]-gl[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const ml=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=jh(n,e,t);return!s&&r&&X(t)&&(s=vo(n,t,i),s===void 0&&(s=vo(e,t,i))),s},io=n=>n.replace(/\$/g,"$$$$");class Vh{constructor(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ht.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(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:r,prefix:s,prefixEscaped:o,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:p,unescapePrefix:g,nestingPrefix:_,nestingPrefixEscaped:x,nestingSuffix:h,nestingSuffixEscaped:m,nestingOptionsSeparator:b,maxReplaces:S,alwaysFormat:O}=e.interpolation;this.escape=t!==void 0?t:Oh,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?kn(s):o||"{{",this.suffix=c?kn(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=_?kn(_):x||kn("$t("),this.nestingSuffix=h?kn(h):m||kn(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=S||1e3,this.alwaysFormat=O!==void 0?O:!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,r){var x;let s,o,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const O=ml(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,i,{...r,...t,interpolationkey:h}):O}const m=h.split(this.formatSeparator),b=m.shift().trim(),S=m.join(this.formatSeparator).trim();return this.format(ml(t,l,b,this.options.keySeparator,this.options.ignoreJSONStructure),S,i,{...r,...t,interpolationkey:b})};this.resetRegExp();const p=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,g=((x=r==null?void 0:r.interpolation)==null?void 0:x.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>io(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?io(this.escape(h)):io(h)}].forEach(h=>{for(c=0;s=h.regex.exec(e);){const m=s[1].trim();if(o=u(m),o===void 0)if(typeof p=="function"){const S=p(e,s,r);o=X(S)?S:""}else if(r&&Object.prototype.hasOwnProperty.call(r,m))o="";else if(g){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),o="";else!X(o)&&!this.useRawValueToEscape&&(o=cl(o));const b=h.safeValue(o);if(e=e.replace(s[0],b),g?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,s,o;const c=(l,u)=>{const p=this.nestingOptionsSeparator;if(l.indexOf(p)<0)return l;const g=l.split(new RegExp(`${p}[ ]*{`));let _=`{${g[1]}`;l=g[0],_=this.interpolate(_,o);const x=_.match(/'/g),h=_.match(/"/g);(((x==null?void 0:x.length)??0)%2===0&&!h||h.length%2!==0)&&(_=_.replace(/'/g,'"'));try{o=JSON.parse(_),u&&(o={...u,...o})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${p}${_}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];o={...i},o=o.replace&&!X(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const p=r[1].split(this.formatSeparator).map(g=>g.trim());r[1]=p.shift(),l=p,u=!0}if(s=t(c.call(this,r[1].trim(),o),o),s&&r[0]===e&&!X(s))return s;X(s)||(s=cl(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),u&&(s=l.reduce((p,g)=>this.format(p,g,i.lng,{...i,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const Mh=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const i=n.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(o=>{if(o){const[c,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();t[p]||(t[p]=u),u==="false"&&(t[p]=!1),u==="true"&&(t[p]=!0),isNaN(u)||(t[p]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},xn=n=>{const e={};return(t,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const o=i+JSON.stringify(s);let c=e[o];return c||(c=n(ur(i),r),e[o]=c),c(t)}};class Hh{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ht.create("formatter"),this.options=e,this.formats={number:xn((t,i)=>{const r=new Intl.NumberFormat(t,{...i});return s=>r.format(s)}),currency:xn((t,i)=>{const r=new Intl.NumberFormat(t,{...i,style:"currency"});return s=>r.format(s)}),datetime:xn((t,i)=>{const r=new Intl.DateTimeFormat(t,{...i});return s=>r.format(s)}),relativetime:xn((t,i)=>{const r=new Intl.RelativeTimeFormat(t,{...i});return s=>r.format(s,i.range||"day")}),list:xn((t,i)=>{const r=new Intl.ListFormat(t,{...i});return s=>r.format(s)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=xn(t)}format(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(c=>c.indexOf(")")>-1)){const c=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,c)].join(this.formatSeparator)}return s.reduce((c,l)=>{var g;const{formatName:u,formatOptions:p}=Mh(l);if(this.formats[u]){let _=c;try{const x=((g=r==null?void 0:r.formatParams)==null?void 0:g[r.interpolationkey])||{},h=x.locale||x.lng||r.locale||r.lng||i;_=this.formats[u](c,h,{...p,...r,...x})}catch(x){this.logger.warn(x)}return _}else this.logger.warn(`there was no format function for ${u}`);return c},e)}}const Dh=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class Fh extends is{constructor(e,t,i){var s,o;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=ht.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(o=(s=this.backend)==null?void 0:s.init)==null||o.call(s,i,r.backend,r)}queueLoad(e,t,i,r){const s={},o={},c={},l={};return e.forEach(u=>{let p=!0;t.forEach(g=>{const _=`${u}|${g}`;!i.reload&&this.store.hasResourceBundle(u,g)?this.state[_]=2:this.state[_]<0||(this.state[_]===1?o[_]===void 0&&(o[_]=!0):(this.state[_]=1,p=!1,o[_]===void 0&&(o[_]=!0),s[_]===void 0&&(s[_]=!0),l[g]===void 0&&(l[g]=!0)))}),p||(c[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const r=e.split("|"),s=r[0],o=r[1];t&&this.emit("failedLoading",s,o,t),!t&&i&&this.store.addResourceBundle(s,o,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const c={};this.queue.forEach(l=>{zh(l.loaded,[s],o),Dh(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});const p=l.loaded[u];p.length&&p.forEach(g=>{c[u][g]===void 0&&(c[u][g]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:r,wait:s,callback:o});return}this.readingCalls++;const c=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(u&&p&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,r+1,s*2,o)},s);return}o(u,p)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(p=>c(null,p)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,t,c)}prepareLoading(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();X(e)&&(e=this.languageUtils.toResolveHierarchy(e)),X(t)&&(t=[t]);const s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(o,c)=>{o&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,o),!o&&c&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,c),this.loaded(e,o,c)})}saveMissing(e,t,i,r,s){var l,u,p,g,_;let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((g=(p=this.services)==null?void 0:p.utils)!=null&&g.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((_=this.backend)!=null&&_.create){const x={...o,isUpdate:s},h=this.backend.create.bind(this.backend);if(h.length<6)try{let m;h.length===5?m=h(e,t,i,r,x):m=h(e,t,i,r),m&&typeof m.then=="function"?m.then(b=>c(null,b)).catch(c):c(null,m)}catch(m){c(m)}else h(e,t,i,r,c,x)}!e||!e[0]||this.store.addResource(e[0],t,i,r)}}}const yl=()=>({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:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),X(n[1])&&(e.defaultValue=n[1]),X(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),vl=n=>{var e,t;return X(n.ns)&&(n.ns=[n.ns]),X(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),X(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((t=(e=n.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},Ji=()=>{},qh=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class gi extends is{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=vl(e),this.services={},this.logger=ht,this.modules={external:[]},qh(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(X(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=yl();this.options={...r,...this.options,...vl(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?ht.init(s(this.modules.logger),this.options):ht.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Hh;const g=new hl(this.options);this.store=new pl(this.options.resources,this.options);const _=this.services;_.logger=ht,_.resourceStore=this.store,_.languageUtils=g,_.pluralResolver=new Uh(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(_.formatter=s(p),_.formatter.init(_,this.options),this.options.interpolation.format=_.formatter.format.bind(_.formatter)),_.interpolator=new Vh(this.options),_.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},_.backendConnector=new Fh(s(this.modules.backend),_.resourceStore,_,this.options),_.backendConnector.on("*",function(x){for(var h=arguments.length,m=new Array(h>1?h-1:0),b=1;b<h;b++)m[b-1]=arguments[b];e.emit(x,...m)}),this.modules.languageDetector&&(_.languageDetector=s(this.modules.languageDetector),_.languageDetector.init&&_.languageDetector.init(_,this.options.detection,this.options)),this.modules.i18nFormat&&(_.i18nFormat=s(this.modules.i18nFormat),_.i18nFormat.init&&_.i18nFormat.init(this)),this.translator=new pr(this.services,this.options),this.translator.on("*",function(x){for(var h=arguments.length,m=new Array(h>1?h-1:0),b=1;b<h;b++)m[b-1]=arguments[b];e.emit(x,...m)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,i||(i=Ji),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const l=ni(),u=()=>{const p=(g,_)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(_),i(g,_)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),l}loadResources(e){var s,o;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ji;const r=X(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const c=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(g=>{g!=="cimode"&&c.indexOf(g)<0&&c.push(g)})};r?l(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>l(p)),(o=(s=this.options.preload)==null?void 0:s.forEach)==null||o.call(s,u=>l(u)),this.services.backendConnector.load(c,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(u)})}else i(null)}reloadResources(e,t,i){const r=ni();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=Ji),this.services.backendConnector.reload(e,t,s=>{r.resolve(),i(s)}),r}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"&&xd.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}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const r=ni();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve(function(){return i.t(...arguments)}),t&&t(l,function(){return i.t(...arguments)})},c=l=>{var p,g;!e&&!l&&this.services.languageDetector&&(l=[]);const u=X(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(g=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||g.call(p,u)),this.loadResources(u,_=>{o(_,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(e),r}getFixedT(e,t,i){var r=this;const s=function(o,c){let l;if(typeof c!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),g=2;g<u;g++)p[g-2]=arguments[g];l=r.options.overloadTranslationOptionHandler([o,c].concat(p))}else l={...c};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 _=r.options.keySeparator||".";let x;return l.keyPrefix&&Array.isArray(o)?x=o.map(h=>`${l.keyPrefix}${_}${h}`):x=l.keyPrefix?`${l.keyPrefix}${_}${o}`:o,r.t(x,l)};return X(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.translate(...t)}exists(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.exists(...t)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const o=(c,l)=>{const u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const c=t.precheck(this,o);if(c!==void 0)return c}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(i,e)&&(!r||o(s,e)))}loadNamespaces(e,t){const i=ni();return this.options.ns?(X(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=ni();X(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(o=>r.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=r.concat(s),this.loadResources(o=>{i.resolve(),t&&t(o)}),i):(t&&t(),Promise.resolve())}dir(e){var r,s;if(e||(e=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!e)return"rtl";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=((s=this.services)==null?void 0:s.languageUtils)||new hl(yl());return t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new gi(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ji;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new gi(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(c=>{s[c]=this[c]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},Object.keys(l[u]).reduce((p,g)=>(p[g]={...l[u][g]},p),{})),{});s.store=new pl(c,r),s.services.resourceStore=s.store}return s.translator=new pr(s.services,r),s.translator.on("*",function(c){for(var l=arguments.length,u=new Array(l>1?l-1:0),p=1;p<l;p++)u[p-1]=arguments[p];s.emit(c,...u)}),s.init(r,t),s.translator.options=r,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ne=gi.createInstance();Ne.createInstance=gi.createInstance;Ne.createInstance;Ne.dir;Ne.init;Ne.loadResources;Ne.reloadResources;Ne.use;Ne.changeLanguage;Ne.getFixedT;const ue=Ne.t;Ne.exists;Ne.setDefaultNamespace;Ne.hasLoadedNamespace;Ne.loadNamespaces;Ne.loadLanguages;const Ft=a.z.object({start:a.z.number(),limit:a.z.number(),length:a.z.number()}),Fa=a.z.object({created_at:a.z.string(),updated_at:a.z.string()}),Sd=a.z.object({email:a.z.string().optional(),email_verified:a.z.boolean().optional(),name:a.z.string().optional(),username:a.z.string().optional(),given_name:a.z.string().optional(),phone_number:a.z.string().optional(),phone_verified:a.z.boolean().optional(),family_name:a.z.string().optional()}).catchall(a.z.any()),Ad=a.z.object({connection:a.z.string(),user_id:a.z.string(),provider:a.z.string(),isSocial:a.z.boolean(),access_token:a.z.string().optional(),access_token_secret:a.z.string().optional(),refresh_token:a.z.string().optional(),profileData:Sd.optional()}),rs=a.z.object({email:a.z.string().optional(),username:a.z.string().optional(),given_name:a.z.string().optional(),family_name:a.z.string().optional(),nickname:a.z.string().optional(),name:a.z.string().optional(),picture:a.z.string().optional(),locale:a.z.string().optional(),linked_to:a.z.string().optional(),profileData:a.z.string().optional(),user_id:a.z.string().optional(),app_metadata:a.z.any().default({}).optional(),user_metadata:a.z.any().default({}).optional()}),fr=rs.extend({email_verified:a.z.boolean().default(!1),verify_email:a.z.boolean().optional(),last_ip:a.z.string().optional(),last_login:a.z.string().optional(),user_id:a.z.string().optional(),provider:a.z.string().default("email"),connection:a.z.string().default("email"),is_social:a.z.boolean().optional()}),qa=a.z.object({...fr.shape,...Fa.shape,user_id:a.z.string(),is_social:a.z.boolean(),email:a.z.string(),login_count:a.z.number(),identities:a.z.array(Ad).optional()}),ft=qa,Kh=rs.extend({email:a.z.string(),login_count:a.z.number(),multifactor:a.z.array(a.z.string()).optional(),last_ip:a.z.string().optional(),last_login:a.z.string().optional(),user_id:a.z.string()}).catchall(a.z.any()),Wh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Gh=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=Wh[t[n]&63];return e};const Id=a.z.object({audience:a.z.string().optional(),recipient:a.z.string().optional(),createUpnClaim:a.z.boolean().optional(),mapUnknownClaimsAsIs:a.z.boolean().optional(),passthroughClaimsWithNoMapping:a.z.boolean().optional(),mapIdentities:a.z.boolean().optional(),signatureAlgorithm:a.z.string().optional(),digestAlgorithm:a.z.string().optional(),issuer:a.z.string().optional(),destination:a.z.string().optional(),lifetimeInSeconds:a.z.number().optional(),signResponse:a.z.boolean().optional(),nameIdentifierFormat:a.z.string().optional(),nameIdentifierProbes:a.z.array(a.z.string()).optional(),authnContextClassRef:a.z.string().optional(),mappings:a.z.record(a.z.string()).optional()}),hr=a.z.object({id:a.z.string(),name:a.z.string(),callbacks:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:a.z.array(a.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:a.z.array(a.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:a.z.object({samlp:Id.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:a.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:a.z.string().default(()=>Gh()).optional(),disable_sign_ups:a.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),Xt=a.z.object({created_at:a.z.string().transform(n=>n===null?"":n),updated_at:a.z.string().transform(n=>n===null?"":n),...hr.shape});var Ut=(n=>(n.TOKEN="token",n.TOKEN_ID_TOKEN="token id_token",n.CODE="code",n))(Ut||{}),Vt=(n=>(n.QUERY="query",n.FRAGMENT="fragment",n.FORM_POST="form_post",n.WEB_MESSAGE="web_message",n.SAML_POST="saml_post",n))(Vt||{}),ss=(n=>(n.S256="S256",n.Plain="plain",n))(ss||{});const Ka=a.z.object({client_id:a.z.string(),vendor_id:a.z.string().optional(),act_as:a.z.string().optional(),response_type:a.z.nativeEnum(Ut).optional(),response_mode:a.z.nativeEnum(Vt).optional(),redirect_uri:a.z.string().optional(),audience:a.z.string().optional(),state:a.z.string().optional(),nonce:a.z.string().optional(),scope:a.z.string().optional(),prompt:a.z.string().optional(),code_challenge_method:a.z.nativeEnum(ss).optional(),code_challenge:a.z.string().optional(),username:a.z.string().optional(),ui_locales:a.z.string().optional()}),wo=a.z.object({colors:a.z.object({primary:a.z.string(),page_background:a.z.object({type:a.z.string().optional(),start:a.z.string().optional(),end:a.z.string().optional(),angle_deg:a.z.number().optional()}).optional()}).optional(),logo_url:a.z.string().optional(),favicon_url:a.z.string().optional(),font:a.z.object({url:a.z.string()}).optional()}),gr=a.z.object({id:a.z.string().optional(),name:a.z.string(),strategy:a.z.string(),options:a.z.object({kid:a.z.string().optional(),team_id:a.z.string().optional(),realms:a.z.string().optional(),client_id:a.z.string().optional(),client_secret:a.z.string().optional(),app_secret:a.z.string().optional(),scope:a.z.string().optional(),authorization_endpoint:a.z.string().default("").optional(),token_endpoint:a.z.string().default("").optional(),userinfo_endpoint:a.z.string().default("").optional(),jwks_uri:a.z.string().default("").optional(),discovery_url:a.z.string().default("").optional(),issuer:a.z.string().default("").optional()}).default({}).optional(),enabled_clients:a.z.array(a.z.string()).default([]).optional(),response_type:a.z.custom().optional(),response_mode:a.z.custom().optional()}),Bt=a.z.object({id:a.z.string(),created_at:a.z.string().transform(n=>n===null?"":n),updated_at:a.z.string().transform(n=>n===null?"":n)}).extend(gr.shape),_r=a.z.object({name:a.z.string(),audience:a.z.string(),sender_email:a.z.string().email(),sender_name:a.z.string(),support_url:a.z.string().url().optional(),logo:a.z.string().url().optional(),primary_color:a.z.string().optional(),secondary_color:a.z.string().optional(),language:a.z.string().optional()}),En=a.z.object({created_at:a.z.string().transform(n=>n===null?"":n),updated_at:a.z.string().transform(n=>n===null?"":n),id:a.z.string(),..._r.shape}),Jh=a.z.object({logoUrl:a.z.string(),loginBackgroundImage:a.z.string().nullish(),style:a.z.object({primaryColor:a.z.string(),buttonTextColor:a.z.string(),primaryHoverColor:a.z.string()}),supportEmail:a.z.string().nullable(),supportUrl:a.z.string().nullable(),name:a.z.string(),showGreyishBackground:a.z.boolean().optional(),termsAndConditionsUrl:a.z.string().nullable(),companyName:a.z.string().optional(),checkoutHideSocial:a.z.boolean().optional(),siteUrl:a.z.string().nullable(),manageSubscriptionsUrl:a.z.string().optional()}),Zh=a.z.object({domain:a.z.string(),dkim_private_key:a.z.string().optional(),dkim_public_key:a.z.string().optional(),email_api_key:a.z.string().optional(),email_service:a.z.string().optional()});a.z.object({...Xt.shape,domains:a.z.array(Zh),tenant:En,connections:a.z.array(Bt)});const Ed=a.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),$d=a.z.object({code_id:a.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:a.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:a.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Ed,code_verifier:a.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),expires_at:a.z.string(),used_at:a.z.string().optional(),user_id:a.z.string().optional()}),Yh=a.z.object({...$d.shape,created_at:a.z.string()}),Cd=a.z.object({domain:a.z.string(),dkim_private_key:a.z.string().optional(),dkim_public_key:a.z.string().optional(),email_api_key:a.z.string().optional(),email_service:a.z.string().optional()}),Xh=Fa.extend({...Cd.shape,id:a.z.string()}),mr=a.z.object({trigger_id:a.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),enabled:a.z.boolean().default(!1),url:a.z.string(),hook_id:a.z.string().optional(),synchronous:a.z.boolean().default(!1),priority:a.z.number().optional()}),An=mr.extend({...Fa.shape,hook_id:a.z.string()}),Wa=a.z.object({alg:a.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:a.z.string(),kid:a.z.string(),kty:a.z.enum(["RSA","EC","oct"]),n:a.z.string(),x5t:a.z.string().optional(),x5c:a.z.array(a.z.string()).optional(),use:a.z.enum(["sig","enc"]).optional()}),zd=a.z.object({keys:a.z.array(Wa)}),bo=a.z.object({issuer:a.z.string(),authorization_endpoint:a.z.string(),token_endpoint:a.z.string(),device_authorization_endpoint:a.z.string(),userinfo_endpoint:a.z.string(),mfa_challenge_endpoint:a.z.string(),jwks_uri:a.z.string(),registration_endpoint:a.z.string(),revocation_endpoint:a.z.string(),scopes_supported:a.z.array(a.z.string()),response_types_supported:a.z.array(a.z.string()),code_challenge_methods_supported:a.z.array(a.z.string()),response_modes_supported:a.z.array(a.z.string()),subject_types_supported:a.z.array(a.z.string()),id_token_signing_alg_values_supported:a.z.array(a.z.string()),token_endpoint_auth_methods_supported:a.z.array(a.z.string()),claims_supported:a.z.array(a.z.string()),request_uri_parameter_supported:a.z.boolean(),request_parameter_supported:a.z.boolean(),token_endpoint_auth_signing_alg_values_supported:a.z.array(a.z.string())}),jd=a.z.object({auth0Client:a.z.string().optional(),authParams:Ka,expires_at:a.z.string(),deleted_at:a.z.string().optional(),ip:a.z.string().optional(),useragent:a.z.string().optional()}).openapi({description:"This represents a login sesion"}),Qh=a.z.object({...jd.shape,login_id:a.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:a.z.string(),updated_at:a.z.string()});var _e=(n=>(n.FAILED_SILENT_AUTH="fsa",n.FAILED_SIGNUP="fs",n.FAILED_LOGIN="f",n.FAILED_LOGIN_INCORRECT_PASSWORD="fp",n.FAILED_CHANGE_PASSWORD="fcp",n.FAILED_BY_CONNECTOR="fc",n.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",n.FAILED_HOOK="fh",n.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",n.SUCCESS_API_OPERATION="sapi",n.SUCCESS_CHANGE_PASSWORD="scp",n.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",n.SUCCESS_CHANGE_USERNAME="scu",n.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",n.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",n.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",n.SUCCESS_LOGIN="s",n.SUCCESS_LOGOUT="slo",n.SUCCESS_SIGNUP="ss",n.SUCCESS_SILENT_AUTH="ssa",n.SUCCESS_VERIFICATION_EMAIL="sv",n.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",n.CODE_LINK_SENT="cls",n.BLOCKED_ACCOUNT_EMAIL="limit_wc",n.BLOCKED_ACCOUNT_IP="limit_sul",n.BLOCKED_IP_ADDRESS="limit_mu",n))(_e||{});const eg=a.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),Nd=a.z.object({name:a.z.string(),version:a.z.string(),env:a.z.object({node:a.z.string().optional()}).optional()}),yr=a.z.object({type:eg,date:a.z.string(),description:a.z.string().optional(),log_id:a.z.string().optional(),_id:a.z.string().optional(),ip:a.z.string(),user_agent:a.z.string(),details:a.z.any().optional(),isMobile:a.z.boolean(),user_id:a.z.string().optional(),user_name:a.z.string().optional(),connection:a.z.string().optional(),connection_id:a.z.string().optional(),client_id:a.z.string().optional(),client_name:a.z.string().optional(),audience:a.z.string().optional(),scope:a.z.array(a.z.string()).optional(),strategy:a.z.string().optional(),strategy_type:a.z.string().optional(),hostname:a.z.string().optional(),auth0_client:Nd.optional()}),Od=a.z.object({user_id:a.z.string(),password:a.z.string(),algorithm:a.z.enum(["bcrypt","argon2id"]).default("argon2id")}),tg=a.z.object({...Od.shape,created_at:a.z.string(),updated_at:a.z.string()}),Bd=a.z.object({session_id:a.z.string(),client_id:a.z.string(),expires_at:a.z.string(),used_at:a.z.string(),deleted_at:a.z.string().optional(),user_id:a.z.string()}),Ga=a.z.object({created_at:a.z.string(),...Bd.shape}),ko=a.z.object({kid:a.z.string().openapi({description:"The key id of the signing key"}),cert:a.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:a.z.string().openapi({description:"The cert fingerprint"}),thumbprint:a.z.string().openapi({description:"The cert thumbprint"}),pkcs7:a.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:a.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:a.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:a.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:a.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:a.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:a.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:a.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var ci=(n=>(n.RefreshToken="refresh_token",n.AuthorizationCode="authorization_code",n.ClientCredential="client_credentials",n.Passwordless="passwordless",n.Password="password",n))(ci||{});const Td=a.z.object({access_token:a.z.string(),id_token:a.z.string().optional(),scope:a.z.string().optional(),state:a.z.string().optional(),refresh_token:a.z.string().optional(),token_type:a.z.string(),expires_in:a.z.number()});a.z.object({code:a.z.string(),state:a.z.string().optional()});const Rd=a.z.object({button_border_radius:a.z.number(),button_border_weight:a.z.number(),buttons_style:a.z.enum(["pill"]),input_border_radius:a.z.number(),input_border_weight:a.z.number(),inputs_style:a.z.enum(["pill"]),show_widget_shadow:a.z.boolean(),widget_border_weight:a.z.number(),widget_corner_radius:a.z.number()}),Pd=a.z.object({base_focus_color:a.z.string(),base_hover_color:a.z.string(),body_text:a.z.string(),captcha_widget_theme:a.z.enum(["auto"]),error:a.z.string(),header:a.z.string(),icons:a.z.string(),input_background:a.z.string(),input_border:a.z.string(),input_filled_text:a.z.string(),input_labels_placeholders:a.z.string(),links_focused_components:a.z.string(),primary_button:a.z.string(),primary_button_label:a.z.string(),secondary_button_border:a.z.string(),secondary_button_label:a.z.string(),success:a.z.string(),widget_background:a.z.string(),widget_border:a.z.string()}),Zt=a.z.object({bold:a.z.boolean(),size:a.z.number()}),Ld=a.z.object({body_text:Zt,buttons_text:Zt,font_url:a.z.string(),input_labels:Zt,links:Zt,links_style:a.z.enum(["normal"]),reference_text_size:a.z.number(),subtitle:Zt,title:Zt}),Ud=a.z.object({background_color:a.z.string(),background_image_url:a.z.string(),page_layout:a.z.enum(["center"])}),Vd=a.z.object({header_text_alignment:a.z.enum(["center"]),logo_height:a.z.number(),logo_position:a.z.enum(["center"]),logo_url:a.z.string(),social_buttons_layout:a.z.enum(["bottom"])}),Md=a.z.object({borders:Rd,colors:Pd,displayName:a.z.string(),fonts:Ld,page_background:Ud,widget:Vd}),ng=Md.extend({themeId:a.z.string()}),tr=a.z.object({universal_login_experience:a.z.enum(["new","classic"]).default("new"),identifier_first:a.z.boolean().default(!0),password_first:a.z.boolean().default(!1),webauthn_platform_first_factor:a.z.boolean()}),nr=a.z.object({name:a.z.string(),enabled:a.z.boolean().optional().default(!0),default_from_address:a.z.string().optional(),credentials:a.z.union([a.z.object({accessKeyId:a.z.string(),secretAccessKey:a.z.string(),region:a.z.string()}),a.z.object({smtp_host:a.z.array(a.z.string()),smtp_port:a.z.number(),smtp_user:a.z.string(),smtp_pass:a.z.string()}),a.z.object({api_key:a.z.string(),domain:a.z.string().optional()}),a.z.object({connectionString:a.z.string()}),a.z.object({tenantId:a.z.string(),clientId:a.z.string(),clientSecret:a.z.string()})]),settings:a.z.object({}).optional()}),Hd=a.z.object({token:a.z.string(),session_id:a.z.string(),scope:a.z.string(),audience:a.z.string(),expires_at:a.z.string(),used_at:a.z.string().optional(),revoked_at:a.z.string().optional()}),ig=a.z.object({created_at:a.z.string(),...Hd.shape});function rg(n){const[e,t]=n.split("|");if(!e||!t)throw new Error(`Invalid user_id: ${n}`);return{connection:e,id:t}}const sg=new a.OpenAPIHono().openapi(a.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:wo}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.branding.get(e);return t?n.json(t):n.json({})}).openapi(a.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(wo.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.branding.set(e,t),n.text("OK")});var j=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});te(this,"res");te(this,"status");this.res=t==null?void 0:t.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function og(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function ag(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),t}function cg(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Dd={exports:{}};const lg={},ug=Object.freeze(Object.defineProperty({__proto__:null,default:lg},Symbol.toStringTag,{value:"Module"})),dg=ag(ug);(function(n){/**
1
+ "use strict";var Ih=Object.defineProperty;var Eh=(n,e,t)=>e in n?Ih(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var te=(n,e,t)=>Eh(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@hono/zod-openapi"),X=n=>typeof n=="string",ni=()=>{let n,e;const t=new Promise((i,r)=>{n=i,e=r});return t.resolve=n,t.reject=e,t},cl=n=>n==null?"":""+n,zh=(n,e,t)=>{n.forEach(i=>{e[i]&&(t[i]=e[i])})},$h=/###/g,ll=n=>n&&n.indexOf("###")>-1?n.replace($h,"."):n,ul=n=>!n||X(n),ai=(n,e,t)=>{const i=X(e)?e.split("."):e;let r=0;for(;r<i.length-1;){if(ul(n))return{};const s=ll(i[r]);!n[s]&&t&&(n[s]=new t),Object.prototype.hasOwnProperty.call(n,s)?n=n[s]:n={},++r}return ul(n)?{}:{obj:n,k:ll(i[r])}},dl=(n,e,t)=>{const{obj:i,k:r}=ai(n,e,Object);if(i!==void 0||e.length===1){i[r]=t;return}let s=e[e.length-1],a=e.slice(0,e.length-1),c=ai(n,a,Object);for(;c.obj===void 0&&a.length;)s=`${a[a.length-1]}.${s}`,a=a.slice(0,a.length-1),c=ai(n,a,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${s}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${s}`]=t},Ch=(n,e,t,i)=>{const{obj:r,k:s}=ai(n,e,Object);r[s]=r[s]||[],r[s].push(t)},lr=(n,e)=>{const{obj:t,k:i}=ai(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},jh=(n,e,t)=>{const i=lr(n,t);return i!==void 0?i:lr(e,t)},kd=(n,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in n?X(n[i])||n[i]instanceof String||X(e[i])||e[i]instanceof String?t&&(n[i]=e[i]):kd(n[i],e[i],t):n[i]=e[i]);return n},kn=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Oh=n=>X(n)?n.replace(/[&<>"'\/]/g,e=>Nh[e]):n;class Bh{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 Th=[" ",",","?","!",";"],Rh=new Bh(20),Ph=(n,e,t)=>{e=e||"",t=t||"";const i=Th.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(i.length===0)return!0;const r=Rh.getRegExp(`(${i.map(a=>a==="?"?"\\?":a).join("|")})`);let s=!r.test(n);if(!s){const a=n.indexOf(t);a>0&&!r.test(n.substring(0,a))&&(s=!0)}return s},wo=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const i=e.split(t);let r=n;for(let s=0;s<i.length;){if(!r||typeof r!="object")return;let a,c="";for(let l=s;l<i.length;++l)if(l!==s&&(c+=t),c+=i[l],a=r[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<i.length-1)continue;s+=l-s+1;break}r=a}return r},ur=n=>n==null?void 0:n.replace("_","-"),Lh={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){var t,i;(i=(t=console==null?void 0:console[n])==null?void 0:t.apply)==null||i.call(t,console,e)}};class dr{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Lh,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,r){return r&&!this.debug?null:(X(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new dr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new dr(this.logger,e)}}var gt=new dr;class is{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(t)||0;this.observers[i].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[c,l]=a;for(let u=0;u<l;u++)c(...i)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[c,l]=a;for(let u=0;u<l;u++)c.apply(c,[e,...i])})}}class pl extends is{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){var u,p;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,t],i&&(Array.isArray(i)?c.push(...i):X(i)&&s?c.push(...i.split(s)):c.push(i)));const l=lr(this.data,c);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=c[0],t=c[1],i=c.slice(2).join(".")),l||!a||!X(i)?l:wo((p=(u=this.data)==null?void 0:u[e])==null?void 0:p[t],i,s)}addResource(e,t,i,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let c=[e,t];i&&(c=c.concat(a?i.split(a):i)),e.indexOf(".")>-1&&(c=e.split("."),r=t,t=c[1]),this.addNamespaces(t),dl(this.data,c,r),s.silent||this.emit("added",e,t,i,r)}addResources(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in i)(X(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,r,s){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},c=[e,t];e.indexOf(".")>-1&&(c=e.split("."),r=i,i=t,t=c[1]),this.addNamespaces(t);let l=lr(this.data,c)||{};a.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?kd(l,i,s):l={...l,...i},dl(this.data,c,l),a.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(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var xd={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,i,r){return n.forEach(s=>{var a;e=((a=this.processors[s])==null?void 0:a.process(e,t,i,r))??e}),e}};const fl={};class pr extends is{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),zh(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=gt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const i=this.resolve(e,t);return(i==null?void 0:i.res)!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const a=i&&e.indexOf(i)>-1,c=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Ph(e,i,r);if(a&&!c){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:X(s)?[s]:s};const u=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(r)}return{key:e,namespaces:X(s)?[s]:s}}translate(e,t,i){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(e[e.length-1],t),l=c[c.length-1],u=t.lng||this.language,p=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode"){if(p){const F=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${F}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${F}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:a}const g=this.resolve(e,t);let _=g==null?void 0:g.res;const x=(g==null?void 0:g.usedKey)||a,h=(g==null?void 0:g.exactUsedKey)||a,m=Object.prototype.toString.apply(_),b=["[object Number]","[object Function]","[object RegExp]"],S=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,T=!X(_)&&typeof _!="boolean"&&typeof _!="number";if(O&&_&&T&&b.indexOf(m)<0&&!(X(S)&&Array.isArray(_))){if(!t.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,_,{...t,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(g.res=F,g.usedParams=this.getUsedParamsDetails(t),g):F}if(s){const F=Array.isArray(_),oe=F?[]:{},pe=F?h:x;for(const ce in _)if(Object.prototype.hasOwnProperty.call(_,ce)){const Pe=`${pe}${s}${ce}`;oe[ce]=this.translate(Pe,{...t,joinArrays:!1,ns:c}),oe[ce]===Pe&&(oe[ce]=_[ce])}_=oe}}else if(O&&X(S)&&Array.isArray(_))_=_.join(S),_&&(_=this.extendTranslation(_,e,t,i));else{let F=!1,oe=!1;const pe=t.count!==void 0&&!X(t.count),ce=pr.hasDefaultValue(t),Pe=pe?this.pluralResolver.getSuffix(u,t.count,t):"",it=t.ordinal&&pe?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",Fe=pe&&!t.ordinal&&t.count===0,z=Fe&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${Pe}`]||t[`defaultValue${it}`]||t.defaultValue;!this.isValidLookup(_)&&ce&&(F=!0,_=z),this.isValidLookup(_)||(oe=!0,_=a);const A=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&oe?void 0:_,w=ce&&z!==_&&this.options.updateMissing;if(oe||F||w){if(this.logger.log(w?"updateKey":"missingKey",u,l,a,w?z:_),s){const Z=this.resolve(a,{...t,keySeparator:!1});Z&&Z.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 v=[];const $=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&$&&$[0])for(let Z=0;Z<$.length;Z++)v.push($[Z]);else this.options.saveMissingTo==="all"?v=this.languageUtils.toResolveHierarchy(t.lng||this.language):v.push(t.lng||this.language);const R=(Z,K,ee)=>{var M;const se=ce&&ee!==_?ee:A;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,l,K,se,w,t):(M=this.backendConnector)!=null&&M.saveMissing&&this.backendConnector.saveMissing(Z,l,K,se,w,t),this.emit("missingKey",Z,l,K,_)};this.options.saveMissing&&(this.options.saveMissingPlurals&&pe?v.forEach(Z=>{const K=this.pluralResolver.getSuffixes(Z,t);Fe&&t[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(ee=>{R([Z],a+ee,t[`defaultValue${ee}`]||z)})}):R(v,a,z))}_=this.extendTranslation(_,e,t,g,i),oe&&_===a&&this.options.appendNamespaceToMissingKey&&(_=`${l}:${a}`),(oe||F)&&this.options.parseMissingKeyHandler&&(_=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,F?_:void 0))}return r?(g.res=_,g.usedParams=this.getUsedParamsDetails(t),g):_}extendTranslation(e,t,i,r,s){var u,p;var a=this;if((u=this.i18nFormat)!=null&&u.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const g=X(e)&&(((p=i==null?void 0:i.interpolation)==null?void 0:p.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let _;if(g){const h=e.match(this.interpolator.nestingRegexp);_=h&&h.length}let x=i.replace&&!X(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),e=this.interpolator.interpolate(e,x,i.lng||this.language||r.usedLng,i),g){const h=e.match(this.interpolator.nestingRegexp),m=h&&h.length;_<m&&(i.nest=!1)}!i.lng&&r&&r.res&&(i.lng=this.language||r.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var h=arguments.length,m=new Array(h),b=0;b<h;b++)m[b]=arguments[b];return(s==null?void 0:s[0])===m[0]&&!i.context?(a.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${t[0]}`),null):a.translate(...m,t)},i)),i.interpolation&&this.interpolator.reset()}const c=i.postProcess||this.options.postProcess,l=X(c)?[c]:c;return e!=null&&(l!=null&&l.length)&&i.applyPostProcessor!==!1&&(e=xd.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i,r,s,a,c;return X(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const u=this.extractFromKey(l,t),p=u.key;r=p;let g=u.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const _=t.count!==void 0&&!X(t.count),x=_&&!t.ordinal&&t.count===0,h=t.context!==void 0&&(X(t.context)||typeof t.context=="number")&&t.context!=="",m=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);g.forEach(b=>{var S,O;this.isValidLookup(i)||(c=b,!fl[`${m[0]}-${b}`]&&((S=this.utils)!=null&&S.hasLoadedNamespace)&&!((O=this.utils)!=null&&O.hasLoadedNamespace(c))&&(fl[`${m[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${m.join(", ")}" won't get resolved as namespace "${c}" 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!!!")),m.forEach(T=>{var pe;if(this.isValidLookup(i))return;a=T;const F=[p];if((pe=this.i18nFormat)!=null&&pe.addLookupKeys)this.i18nFormat.addLookupKeys(F,p,T,b,t);else{let ce;_&&(ce=this.pluralResolver.getSuffix(T,t.count,t));const Pe=`${this.options.pluralSeparator}zero`,it=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(_&&(F.push(p+ce),t.ordinal&&ce.indexOf(it)===0&&F.push(p+ce.replace(it,this.options.pluralSeparator)),x&&F.push(p+Pe)),h){const Fe=`${p}${this.options.contextSeparator}${t.context}`;F.push(Fe),_&&(F.push(Fe+ce),t.ordinal&&ce.indexOf(it)===0&&F.push(Fe+ce.replace(it,this.options.pluralSeparator)),x&&F.push(Fe+Pe))}}let oe;for(;oe=F.pop();)this.isValidLookup(i)||(s=oe,i=this.getResource(T,b,oe,t))}))})}),{res:i,usedKey:r,exactUsedKey:s,usedLng:a,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i){var s;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!X(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const s of t)delete r[s]}return r}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 hl{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=gt.create("languageUtils")}getScriptPartFromCode(e){if(e=ur(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=ur(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(X(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}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 r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),X(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||this.options.fallbackLng||[],e),r=[],s=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return X(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):X(e)&&s(this.formatLanguageCode(e)),i.forEach(a=>{r.indexOf(a)<0&&s(this.formatLanguageCode(a))}),r}}const gl={zero:0,one:1,two:2,few:3,many:4,other:5},_l={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Uh{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=gt.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=ur(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let a;try{a=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),_l;if(!e.match(/-|_/))return _l;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[s]=a,a}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((r,s)=>gl[r]-gl[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const ml=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=jh(n,e,t);return!s&&r&&X(t)&&(s=wo(n,t,i),s===void 0&&(s=wo(e,t,i))),s},ro=n=>n.replace(/\$/g,"$$$$");class Vh{constructor(){var t;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=gt.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(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:r,prefix:s,prefixEscaped:a,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:p,unescapePrefix:g,nestingPrefix:_,nestingPrefixEscaped:x,nestingSuffix:h,nestingSuffixEscaped:m,nestingOptionsSeparator:b,maxReplaces:S,alwaysFormat:O}=e.interpolation;this.escape=t!==void 0?t:Oh,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?kn(s):a||"{{",this.suffix=c?kn(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=_?kn(_):x||kn("$t("),this.nestingSuffix=h?kn(h):m||kn(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=S||1e3,this.alwaysFormat=O!==void 0?O:!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,r){var x;let s,a,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const O=ml(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,i,{...r,...t,interpolationkey:h}):O}const m=h.split(this.formatSeparator),b=m.shift().trim(),S=m.join(this.formatSeparator).trim();return this.format(ml(t,l,b,this.options.keySeparator,this.options.ignoreJSONStructure),S,i,{...r,...t,interpolationkey:b})};this.resetRegExp();const p=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,g=((x=r==null?void 0:r.interpolation)==null?void 0:x.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>ro(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?ro(this.escape(h)):ro(h)}].forEach(h=>{for(c=0;s=h.regex.exec(e);){const m=s[1].trim();if(a=u(m),a===void 0)if(typeof p=="function"){const S=p(e,s,r);a=X(S)?S:""}else if(r&&Object.prototype.hasOwnProperty.call(r,m))a="";else if(g){a=s[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),a="";else!X(a)&&!this.useRawValueToEscape&&(a=cl(a));const b=h.safeValue(a);if(e=e.replace(s[0],b),g?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,s,a;const c=(l,u)=>{const p=this.nestingOptionsSeparator;if(l.indexOf(p)<0)return l;const g=l.split(new RegExp(`${p}[ ]*{`));let _=`{${g[1]}`;l=g[0],_=this.interpolate(_,a);const x=_.match(/'/g),h=_.match(/"/g);(((x==null?void 0:x.length)??0)%2===0&&!h||h.length%2!==0)&&(_=_.replace(/'/g,'"'));try{a=JSON.parse(_),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${p}${_}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];a={...i},a=a.replace&&!X(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const p=r[1].split(this.formatSeparator).map(g=>g.trim());r[1]=p.shift(),l=p,u=!0}if(s=t(c.call(this,r[1].trim(),a),a),s&&r[0]===e&&!X(s))return s;X(s)||(s=cl(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),u&&(s=l.reduce((p,g)=>this.format(p,g,i.lng,{...i,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const Mh=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const i=n.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(a=>{if(a){const[c,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),p=c.trim();t[p]||(t[p]=u),u==="false"&&(t[p]=!1),u==="true"&&(t[p]=!0),isNaN(u)||(t[p]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},xn=n=>{const e={};return(t,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const a=i+JSON.stringify(s);let c=e[a];return c||(c=n(ur(i),r),e[a]=c),c(t)}};class Hh{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=gt.create("formatter"),this.options=e,this.formats={number:xn((t,i)=>{const r=new Intl.NumberFormat(t,{...i});return s=>r.format(s)}),currency:xn((t,i)=>{const r=new Intl.NumberFormat(t,{...i,style:"currency"});return s=>r.format(s)}),datetime:xn((t,i)=>{const r=new Intl.DateTimeFormat(t,{...i});return s=>r.format(s)}),relativetime:xn((t,i)=>{const r=new Intl.RelativeTimeFormat(t,{...i});return s=>r.format(s,i.range||"day")}),list:xn((t,i)=>{const r=new Intl.ListFormat(t,{...i});return s=>r.format(s)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=xn(t)}format(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(c=>c.indexOf(")")>-1)){const c=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,c)].join(this.formatSeparator)}return s.reduce((c,l)=>{var g;const{formatName:u,formatOptions:p}=Mh(l);if(this.formats[u]){let _=c;try{const x=((g=r==null?void 0:r.formatParams)==null?void 0:g[r.interpolationkey])||{},h=x.locale||x.lng||r.locale||r.lng||i;_=this.formats[u](c,h,{...p,...r,...x})}catch(x){this.logger.warn(x)}return _}else this.logger.warn(`there was no format function for ${u}`);return c},e)}}const Dh=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class qh extends is{constructor(e,t,i){var s,a;let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=gt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(a=(s=this.backend)==null?void 0:s.init)==null||a.call(s,i,r.backend,r)}queueLoad(e,t,i,r){const s={},a={},c={},l={};return e.forEach(u=>{let p=!0;t.forEach(g=>{const _=`${u}|${g}`;!i.reload&&this.store.hasResourceBundle(u,g)?this.state[_]=2:this.state[_]<0||(this.state[_]===1?a[_]===void 0&&(a[_]=!0):(this.state[_]=1,p=!1,a[_]===void 0&&(a[_]=!0),s[_]===void 0&&(s[_]=!0),l[g]===void 0&&(l[g]=!0)))}),p||(c[u]=!0)}),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const r=e.split("|"),s=r[0],a=r[1];t&&this.emit("failedLoading",s,a,t),!t&&i&&this.store.addResourceBundle(s,a,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const c={};this.queue.forEach(l=>{Ch(l.loaded,[s],a),Dh(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});const p=l.loaded[u];p.length&&p.forEach(g=>{c[u][g]===void 0&&(c[u][g]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:r,wait:s,callback:a});return}this.readingCalls++;const c=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(u&&p&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,r+1,s*2,a)},s);return}a(u,p)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(p=>c(null,p)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,t,c)}prepareLoading(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();X(e)&&(e=this.languageUtils.toResolveHierarchy(e)),X(t)&&(t=[t]);const s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,a),!a&&c&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,c),this.loaded(e,a,c)})}saveMissing(e,t,i,r,s){var l,u,p,g,_;let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((g=(p=this.services)==null?void 0:p.utils)!=null&&g.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((_=this.backend)!=null&&_.create){const x={...a,isUpdate:s},h=this.backend.create.bind(this.backend);if(h.length<6)try{let m;h.length===5?m=h(e,t,i,r,x):m=h(e,t,i,r),m&&typeof m.then=="function"?m.then(b=>c(null,b)).catch(c):c(null,m)}catch(m){c(m)}else h(e,t,i,r,c,x)}!e||!e[0]||this.store.addResource(e[0],t,i,r)}}}const yl=()=>({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:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),X(n[1])&&(e.defaultValue=n[1]),X(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),vl=n=>{var e,t;return X(n.ns)&&(n.ns=[n.ns]),X(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),X(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((t=(e=n.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},Ji=()=>{},Fh=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class gi extends is{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=vl(e),this.services={},this.logger=gt,this.modules={external:[]},Fh(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(X(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=yl();this.options={...r,...this.options,...vl(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?gt.init(s(this.modules.logger),this.options):gt.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=Hh;const g=new hl(this.options);this.store=new pl(this.options.resources,this.options);const _=this.services;_.logger=gt,_.resourceStore=this.store,_.languageUtils=g,_.pluralResolver=new Uh(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(_.formatter=s(p),_.formatter.init(_,this.options),this.options.interpolation.format=_.formatter.format.bind(_.formatter)),_.interpolator=new Vh(this.options),_.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},_.backendConnector=new qh(s(this.modules.backend),_.resourceStore,_,this.options),_.backendConnector.on("*",function(x){for(var h=arguments.length,m=new Array(h>1?h-1:0),b=1;b<h;b++)m[b-1]=arguments[b];e.emit(x,...m)}),this.modules.languageDetector&&(_.languageDetector=s(this.modules.languageDetector),_.languageDetector.init&&_.languageDetector.init(_,this.options.detection,this.options)),this.modules.i18nFormat&&(_.i18nFormat=s(this.modules.i18nFormat),_.i18nFormat.init&&_.i18nFormat.init(this)),this.translator=new pr(this.services,this.options),this.translator.on("*",function(x){for(var h=arguments.length,m=new Array(h>1?h-1:0),b=1;b<h;b++)m[b-1]=arguments[b];e.emit(x,...m)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,i||(i=Ji),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=function(){return e.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return e.store[p](...arguments),e}});const l=ni(),u=()=>{const p=(g,_)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(_),i(g,_)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),l}loadResources(e){var s,a;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ji;const r=X(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const c=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(g=>{g!=="cimode"&&c.indexOf(g)<0&&c.push(g)})};r?l(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>l(p)),(a=(s=this.options.preload)==null?void 0:s.forEach)==null||a.call(s,u=>l(u)),this.services.backendConnector.load(c,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(u)})}else i(null)}reloadResources(e,t,i){const r=ni();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=Ji),this.services.backendConnector.reload(e,t,s=>{r.resolve(),i(s)}),r}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"&&xd.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}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const r=ni();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,r.resolve(function(){return i.t(...arguments)}),t&&t(l,function(){return i.t(...arguments)})},c=l=>{var p,g;!e&&!l&&this.services.languageDetector&&(l=[]);const u=X(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(g=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||g.call(p,u)),this.loadResources(u,_=>{a(_,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(e),r}getFixedT(e,t,i){var r=this;const s=function(a,c){let l;if(typeof c!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),g=2;g<u;g++)p[g-2]=arguments[g];l=r.options.overloadTranslationOptionHandler([a,c].concat(p))}else l={...c};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 _=r.options.keySeparator||".";let x;return l.keyPrefix&&Array.isArray(a)?x=a.map(h=>`${l.keyPrefix}${_}${h}`):x=l.keyPrefix?`${l.keyPrefix}${_}${a}`:a,r.t(x,l)};return X(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.translate(...t)}exists(){var r;for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return(r=this.translator)==null?void 0:r.exists(...t)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const a=(c,l)=>{const u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const c=t.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(i,e)&&(!r||a(s,e)))}loadNamespaces(e,t){const i=ni();return this.options.ns?(X(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=ni();X(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return s.length?(this.options.preload=r.concat(s),this.loadResources(a=>{i.resolve(),t&&t(a)}),i):(t&&t(),Promise.resolve())}dir(e){var r,s;if(e||(e=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!e)return"rtl";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=((s=this.services)==null?void 0:s.languageUtils)||new hl(yl());return t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new gi(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ji;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new gi(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(c=>{s[c]=this[c]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},Object.keys(l[u]).reduce((p,g)=>(p[g]={...l[u][g]},p),{})),{});s.store=new pl(c,r),s.services.resourceStore=s.store}return s.translator=new pr(s.services,r),s.translator.on("*",function(c){for(var l=arguments.length,u=new Array(l>1?l-1:0),p=1;p<l;p++)u[p-1]=arguments[p];s.emit(c,...u)}),s.init(r,t),s.translator.options=r,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Oe=gi.createInstance();Oe.createInstance=gi.createInstance;Oe.createInstance;Oe.dir;Oe.init;Oe.loadResources;Oe.reloadResources;Oe.use;Oe.changeLanguage;Oe.getFixedT;const ue=Oe.t;Oe.exists;Oe.setDefaultNamespace;Oe.hasLoadedNamespace;Oe.loadNamespaces;Oe.loadLanguages;const qt=o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()}),Fa=o.z.object({created_at:o.z.string(),updated_at:o.z.string()}),Sd=o.z.object({email:o.z.string().optional(),email_verified:o.z.boolean().optional(),name:o.z.string().optional(),username:o.z.string().optional(),given_name:o.z.string().optional(),phone_number:o.z.string().optional(),phone_verified:o.z.boolean().optional(),family_name:o.z.string().optional()}).catchall(o.z.any()),Ad=o.z.object({connection:o.z.string(),user_id:o.z.string(),provider:o.z.string(),isSocial:o.z.boolean(),access_token:o.z.string().optional(),access_token_secret:o.z.string().optional(),refresh_token:o.z.string().optional(),profileData:Sd.optional()}),rs=o.z.object({email:o.z.string().optional(),username:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),nickname:o.z.string().optional(),name:o.z.string().optional(),picture:o.z.string().optional(),locale:o.z.string().optional(),linked_to:o.z.string().optional(),profileData:o.z.string().optional(),user_id:o.z.string().optional(),app_metadata:o.z.any().default({}).optional(),user_metadata:o.z.any().default({}).optional()}),fr=rs.extend({email_verified:o.z.boolean().default(!1),verify_email:o.z.boolean().optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string().optional(),provider:o.z.string().default("email"),connection:o.z.string().default("email"),is_social:o.z.boolean().optional()}),Ka=o.z.object({...fr.shape,...Fa.shape,user_id:o.z.string(),is_social:o.z.boolean(),email:o.z.string(),login_count:o.z.number(),identities:o.z.array(Ad).optional()}),ht=Ka,Kh=rs.extend({email:o.z.string(),login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any()),Wh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Gh=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=Wh[t[n]&63];return e};const Id=o.z.object({audience:o.z.string().optional(),recipient:o.z.string().optional(),createUpnClaim:o.z.boolean().optional(),mapUnknownClaimsAsIs:o.z.boolean().optional(),passthroughClaimsWithNoMapping:o.z.boolean().optional(),mapIdentities:o.z.boolean().optional(),signatureAlgorithm:o.z.string().optional(),digestAlgorithm:o.z.string().optional(),issuer:o.z.string().optional(),destination:o.z.string().optional(),lifetimeInSeconds:o.z.number().optional(),signResponse:o.z.boolean().optional(),nameIdentifierFormat:o.z.string().optional(),nameIdentifierProbes:o.z.array(o.z.string()).optional(),authnContextClassRef:o.z.string().optional(),mappings:o.z.record(o.z.string()).optional()}),hr=o.z.object({id:o.z.string(),name:o.z.string(),callbacks:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."}),allowed_origins:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."}),web_origins:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),allowed_logout_urls:o.z.array(o.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),allowed_clients:o.z.array(o.z.string()).default([]).optional().openapi({description:"Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"}),addons:o.z.object({samlp:Id.optional()}).default({}).optional().openapi({description:"Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."}),email_validation:o.z.enum(["enabled","disabled","enforced"]).default("enforced").optional().openapi({description:"Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"}),client_secret:o.z.string().default(()=>Gh()).optional(),disable_sign_ups:o.z.boolean().optional().default(!1).openapi({description:"Prevents users from signing up using the hosted login page. This is not available in auth0"})}),Xt=o.z.object({created_at:o.z.string().transform(n=>n===null?"":n),updated_at:o.z.string().transform(n=>n===null?"":n),...hr.shape});var Ut=(n=>(n.TOKEN="token",n.TOKEN_ID_TOKEN="token id_token",n.CODE="code",n))(Ut||{}),Vt=(n=>(n.QUERY="query",n.FRAGMENT="fragment",n.FORM_POST="form_post",n.WEB_MESSAGE="web_message",n.SAML_POST="saml_post",n))(Vt||{}),ss=(n=>(n.S256="S256",n.Plain="plain",n))(ss||{});const Wa=o.z.object({client_id:o.z.string(),vendor_id:o.z.string().optional(),act_as:o.z.string().optional(),response_type:o.z.nativeEnum(Ut).optional(),response_mode:o.z.nativeEnum(Vt).optional(),redirect_uri:o.z.string().optional(),audience:o.z.string().optional(),state:o.z.string().optional(),nonce:o.z.string().optional(),scope:o.z.string().optional(),prompt:o.z.string().optional(),code_challenge_method:o.z.nativeEnum(ss).optional(),code_challenge:o.z.string().optional(),username:o.z.string().optional(),ui_locales:o.z.string().optional()}),bo=o.z.object({colors:o.z.object({primary:o.z.string(),page_background:o.z.object({type:o.z.string().optional(),start:o.z.string().optional(),end:o.z.string().optional(),angle_deg:o.z.number().optional()}).optional()}).optional(),logo_url:o.z.string().optional(),favicon_url:o.z.string().optional(),font:o.z.object({url:o.z.string()}).optional()}),gr=o.z.object({id:o.z.string().optional(),name:o.z.string(),strategy:o.z.string(),options:o.z.object({kid:o.z.string().optional(),team_id:o.z.string().optional(),realms:o.z.string().optional(),client_id:o.z.string().optional(),client_secret:o.z.string().optional(),app_secret:o.z.string().optional(),scope:o.z.string().optional(),authorization_endpoint:o.z.string().default("").optional(),token_endpoint:o.z.string().default("").optional(),userinfo_endpoint:o.z.string().default("").optional(),jwks_uri:o.z.string().default("").optional(),discovery_url:o.z.string().default("").optional(),issuer:o.z.string().default("").optional()}).default({}).optional(),enabled_clients:o.z.array(o.z.string()).default([]).optional(),response_type:o.z.custom().optional(),response_mode:o.z.custom().optional()}),Bt=o.z.object({id:o.z.string(),created_at:o.z.string().transform(n=>n===null?"":n),updated_at:o.z.string().transform(n=>n===null?"":n)}).extend(gr.shape),_r=o.z.object({name:o.z.string(),audience:o.z.string(),sender_email:o.z.string().email(),sender_name:o.z.string(),support_url:o.z.string().url().optional(),logo:o.z.string().url().optional(),primary_color:o.z.string().optional(),secondary_color:o.z.string().optional(),language:o.z.string().optional()}),En=o.z.object({created_at:o.z.string().transform(n=>n===null?"":n),updated_at:o.z.string().transform(n=>n===null?"":n),id:o.z.string(),..._r.shape}),Jh=o.z.object({logoUrl:o.z.string(),loginBackgroundImage:o.z.string().nullish(),style:o.z.object({primaryColor:o.z.string(),buttonTextColor:o.z.string(),primaryHoverColor:o.z.string()}),supportEmail:o.z.string().nullable(),supportUrl:o.z.string().nullable(),name:o.z.string(),showGreyishBackground:o.z.boolean().optional(),termsAndConditionsUrl:o.z.string().nullable(),companyName:o.z.string().optional(),checkoutHideSocial:o.z.boolean().optional(),siteUrl:o.z.string().nullable(),manageSubscriptionsUrl:o.z.string().optional()}),Zh=o.z.object({domain:o.z.string(),dkim_private_key:o.z.string().optional(),dkim_public_key:o.z.string().optional(),email_api_key:o.z.string().optional(),email_service:o.z.string().optional()});o.z.object({...Xt.shape,domains:o.z.array(Zh),tenant:En,connections:o.z.array(Bt)});const Ed=o.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),zd=o.z.object({code_id:o.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:o.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:o.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:Ed,code_verifier:o.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),expires_at:o.z.string(),used_at:o.z.string().optional(),user_id:o.z.string().optional()}),Yh=o.z.object({...zd.shape,created_at:o.z.string()}),$d=o.z.object({domain:o.z.string(),dkim_private_key:o.z.string().optional(),dkim_public_key:o.z.string().optional(),email_api_key:o.z.string().optional(),email_service:o.z.string().optional()}),Xh=Fa.extend({...$d.shape,id:o.z.string()}),mr=o.z.object({trigger_id:o.z.enum(["pre-user-signup","post-user-registration","post-user-login"]),enabled:o.z.boolean().default(!1),url:o.z.string(),hook_id:o.z.string().optional(),synchronous:o.z.boolean().default(!1),priority:o.z.number().optional()}),An=mr.extend({...Fa.shape,hook_id:o.z.string()}),Ga=o.z.object({alg:o.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:o.z.string(),kid:o.z.string(),kty:o.z.enum(["RSA","EC","oct"]),n:o.z.string(),x5t:o.z.string().optional(),x5c:o.z.array(o.z.string()).optional(),use:o.z.enum(["sig","enc"]).optional()}),Cd=o.z.object({keys:o.z.array(Ga)}),ko=o.z.object({issuer:o.z.string(),authorization_endpoint:o.z.string(),token_endpoint:o.z.string(),device_authorization_endpoint:o.z.string(),userinfo_endpoint:o.z.string(),mfa_challenge_endpoint:o.z.string(),jwks_uri:o.z.string(),registration_endpoint:o.z.string(),revocation_endpoint:o.z.string(),scopes_supported:o.z.array(o.z.string()),response_types_supported:o.z.array(o.z.string()),code_challenge_methods_supported:o.z.array(o.z.string()),response_modes_supported:o.z.array(o.z.string()),subject_types_supported:o.z.array(o.z.string()),id_token_signing_alg_values_supported:o.z.array(o.z.string()),token_endpoint_auth_methods_supported:o.z.array(o.z.string()),claims_supported:o.z.array(o.z.string()),request_uri_parameter_supported:o.z.boolean(),request_parameter_supported:o.z.boolean(),token_endpoint_auth_signing_alg_values_supported:o.z.array(o.z.string())}),jd=o.z.object({auth0Client:o.z.string().optional(),authParams:Wa,expires_at:o.z.string(),deleted_at:o.z.string().optional(),ip:o.z.string().optional(),useragent:o.z.string().optional()}).openapi({description:"This represents a login sesion"}),Qh=o.z.object({...jd.shape,login_id:o.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:o.z.string(),updated_at:o.z.string()});var _e=(n=>(n.FAILED_SILENT_AUTH="fsa",n.FAILED_SIGNUP="fs",n.FAILED_LOGIN="f",n.FAILED_LOGIN_INCORRECT_PASSWORD="fp",n.FAILED_CHANGE_PASSWORD="fcp",n.FAILED_BY_CONNECTOR="fc",n.FAILED_LOGIN_INVALID_EMAIL_USERNAME="fu",n.FAILED_HOOK="fh",n.FAILED_CROSS_ORIGIN_AUTHENTICATION="fcoa",n.SUCCESS_API_OPERATION="sapi",n.SUCCESS_CHANGE_PASSWORD="scp",n.SUCCESS_CHANGE_PASSWORD_REQUEST="scpr",n.SUCCESS_CHANGE_USERNAME="scu",n.SUCCESS_CROSS_ORIGIN_AUTHENTICATION="scoa",n.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN="seacft",n.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN="serft",n.SUCCESS_LOGIN="s",n.SUCCESS_LOGOUT="slo",n.SUCCESS_SIGNUP="ss",n.SUCCESS_SILENT_AUTH="ssa",n.SUCCESS_VERIFICATION_EMAIL="sv",n.SUCCESS_VERIFICATION_EMAIL_REQUEST="svr",n.CODE_LINK_SENT="cls",n.BLOCKED_ACCOUNT_EMAIL="limit_wc",n.BLOCKED_ACCOUNT_IP="limit_sul",n.BLOCKED_IP_ADDRESS="limit_mu",n))(_e||{});const eg=o.z.enum(["cls","fsa","fs","f","fc","fcoa","fcp","fh","fp","fs","fu","s","sapi","scoa","scp","scpr","scu","seacft","serft","slo","ss","ssa","sv","svr"]),Nd=o.z.object({name:o.z.string(),version:o.z.string(),env:o.z.object({node:o.z.string().optional()}).optional()}),yr=o.z.object({type:eg,date:o.z.string(),description:o.z.string().optional(),log_id:o.z.string().optional(),_id:o.z.string().optional(),ip:o.z.string(),user_agent:o.z.string(),details:o.z.any().optional(),isMobile:o.z.boolean(),user_id:o.z.string().optional(),user_name:o.z.string().optional(),connection:o.z.string().optional(),connection_id:o.z.string().optional(),client_id:o.z.string().optional(),client_name:o.z.string().optional(),audience:o.z.string().optional(),scope:o.z.array(o.z.string()).optional(),strategy:o.z.string().optional(),strategy_type:o.z.string().optional(),hostname:o.z.string().optional(),auth0_client:Nd.optional()}),Od=o.z.object({user_id:o.z.string(),password:o.z.string(),algorithm:o.z.enum(["bcrypt","argon2id"]).default("argon2id")}),tg=o.z.object({...Od.shape,created_at:o.z.string(),updated_at:o.z.string()}),ng=o.z.object({initial_user_agent:o.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:o.z.string().describe("First IP address associated with this session"),initial_asn:o.z.string().describe("First autonomous system number associated with this session"),last_user_agent:o.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:o.z.string().describe("Last IP address from which this user logged in"),last_asn:o.z.string().describe("Last autonomous system number from which this user logged in")}),Bd=o.z.object({id:o.z.string(),session_id:o.z.string().optional(),client_id:o.z.string(),revoked_at:o.z.string().optional(),used_at:o.z.string(),user_id:o.z.string().describe("The user ID associated with the session"),expires_at:o.z.string().optional(),idle_expires_at:o.z.string().optional(),device:ng.describe("Metadata related to the device used in the session"),clients:o.z.array(o.z.string()).describe("List of client details for the session")}),os=o.z.object({created_at:o.z.string(),updated_at:o.z.string(),authenticated_at:o.z.string(),last_interaction_at:o.z.string(),...Bd.shape}),xo=o.z.object({kid:o.z.string().openapi({description:"The key id of the signing key"}),cert:o.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:o.z.string().openapi({description:"The cert fingerprint"}),thumbprint:o.z.string().openapi({description:"The cert thumbprint"}),pkcs7:o.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:o.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:o.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:o.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:o.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:o.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:o.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:o.z.string().optional().openapi({description:"The date and time when the key was revoked"})});var ci=(n=>(n.RefreshToken="refresh_token",n.AuthorizationCode="authorization_code",n.ClientCredential="client_credentials",n.Passwordless="passwordless",n.Password="password",n))(ci||{});const Td=o.z.object({access_token:o.z.string(),id_token:o.z.string().optional(),scope:o.z.string().optional(),state:o.z.string().optional(),refresh_token:o.z.string().optional(),token_type:o.z.string(),expires_in:o.z.number()});o.z.object({code:o.z.string(),state:o.z.string().optional()});const Rd=o.z.object({button_border_radius:o.z.number(),button_border_weight:o.z.number(),buttons_style:o.z.enum(["pill"]),input_border_radius:o.z.number(),input_border_weight:o.z.number(),inputs_style:o.z.enum(["pill"]),show_widget_shadow:o.z.boolean(),widget_border_weight:o.z.number(),widget_corner_radius:o.z.number()}),Pd=o.z.object({base_focus_color:o.z.string(),base_hover_color:o.z.string(),body_text:o.z.string(),captcha_widget_theme:o.z.enum(["auto"]),error:o.z.string(),header:o.z.string(),icons:o.z.string(),input_background:o.z.string(),input_border:o.z.string(),input_filled_text:o.z.string(),input_labels_placeholders:o.z.string(),links_focused_components:o.z.string(),primary_button:o.z.string(),primary_button_label:o.z.string(),secondary_button_border:o.z.string(),secondary_button_label:o.z.string(),success:o.z.string(),widget_background:o.z.string(),widget_border:o.z.string()}),Zt=o.z.object({bold:o.z.boolean(),size:o.z.number()}),Ld=o.z.object({body_text:Zt,buttons_text:Zt,font_url:o.z.string(),input_labels:Zt,links:Zt,links_style:o.z.enum(["normal"]),reference_text_size:o.z.number(),subtitle:Zt,title:Zt}),Ud=o.z.object({background_color:o.z.string(),background_image_url:o.z.string(),page_layout:o.z.enum(["center"])}),Vd=o.z.object({header_text_alignment:o.z.enum(["center"]),logo_height:o.z.number(),logo_position:o.z.enum(["center"]),logo_url:o.z.string(),social_buttons_layout:o.z.enum(["bottom"])}),Md=o.z.object({borders:Rd,colors:Pd,displayName:o.z.string(),fonts:Ld,page_background:Ud,widget:Vd}),ig=Md.extend({themeId:o.z.string()}),tr=o.z.object({universal_login_experience:o.z.enum(["new","classic"]).default("new"),identifier_first:o.z.boolean().default(!0),password_first:o.z.boolean().default(!1),webauthn_platform_first_factor:o.z.boolean()}),nr=o.z.object({name:o.z.string(),enabled:o.z.boolean().optional().default(!0),default_from_address:o.z.string().optional(),credentials:o.z.union([o.z.object({accessKeyId:o.z.string(),secretAccessKey:o.z.string(),region:o.z.string()}),o.z.object({smtp_host:o.z.array(o.z.string()),smtp_port:o.z.number(),smtp_user:o.z.string(),smtp_pass:o.z.string()}),o.z.object({api_key:o.z.string(),domain:o.z.string().optional()}),o.z.object({connectionString:o.z.string()}),o.z.object({tenantId:o.z.string(),clientId:o.z.string(),clientSecret:o.z.string()})]),settings:o.z.object({}).optional()}),Hd=o.z.object({token:o.z.string(),session_id:o.z.string(),scope:o.z.string(),audience:o.z.string(),expires_at:o.z.string(),used_at:o.z.string().optional(),revoked_at:o.z.string().optional()}),rg=o.z.object({created_at:o.z.string(),...Hd.shape});function sg(n){const[e,t]=n.split("|");if(!e||!t)throw new Error(`Invalid user_id: ${n}`);return{connection:e,id:t}}const og=new o.OpenAPIHono().openapi(o.createRoute({tags:["branding"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bo}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.branding.get(e);return t?n.json(t):n.json({})}).openapi(o.createRoute({tags:["branding"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(bo.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.branding.set(e,t),n.text("OK")});var j=class extends Error{constructor(e=500,t){super(t==null?void 0:t.message,{cause:t==null?void 0:t.cause});te(this,"res");te(this,"status");this.res=t==null?void 0:t.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ag(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function cg(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),t}function lg(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Dd={exports:{}};const ug={},dg=Object.freeze(Object.defineProperty({__proto__:null,default:ug},Symbol.toStringTag,{value:"Module"})),pg=cg(dg);(function(n){/**
2
2
  * @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
3
3
  * Released under the Apache License, Version 2.0
4
4
  * see: https://github.com/dcodeIO/bcrypt.js for details
5
- */(function(e,t){typeof cg=="function"&&n&&n.exports?n.exports=t():(e.dcodeIO=e.dcodeIO||{}).bcrypt=t()})(vr,function(){var e={},t=null;function i($){if(n&&n.exports)try{return dg.randomBytes($)}catch{}try{var E;return(self.crypto||self.msCrypto).getRandomValues(E=new Uint32Array($)),Array.prototype.slice.call(E)}catch{}if(!t)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return t($)}var r=!1;try{i(1),r=!0}catch{}t=null,e.setRandomFallback=function($){t=$},e.genSaltSync=function($,E){if($=$||m,typeof $!="number")throw Error("Illegal arguments: "+typeof $+", "+typeof E);$<4?$=4:$>31&&($=31);var A=[];return A.push("$2a$"),$<10&&A.push("0"),A.push($.toString()),A.push("$"),A.push(g(i(h),h)),A.join("")},e.genSalt=function($,E,A){if(typeof E=="function"&&(A=E,E=void 0),typeof $=="function"&&(A=$,$=void 0),typeof $>"u")$=m;else if(typeof $!="number")throw Error("illegal arguments: "+typeof $);function w(v){o(function(){try{v(null,e.genSaltSync($))}catch(C){v(C)}})}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);w(A)}else return new Promise(function(v,C){w(function(R,Z){if(R){C(R);return}v(Z)})})},e.hashSync=function($,E){if(typeof E>"u"&&(E=m),typeof E=="number"&&(E=e.genSaltSync(E)),typeof $!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof $+", "+typeof E);return Fe($,E)},e.hash=function($,E,A,w){function v(C){typeof $=="string"&&typeof E=="number"?e.genSalt(E,function(R,Z){Fe($,Z,C,w)}):typeof $=="string"&&typeof E=="string"?Fe($,E,C,w):o(C.bind(this,Error("Illegal arguments: "+typeof $+", "+typeof E)))}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);v(A)}else return new Promise(function(C,R){v(function(Z,K){if(Z){R(Z);return}C(K)})})};function s($,E){for(var A=0,w=0,v=0,C=$.length;v<C;++v)$.charCodeAt(v)===E.charCodeAt(v)?++A:++w;return A<0?!1:w===0}e.compareSync=function($,E){if(typeof $!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof $+", "+typeof E);return E.length!==60?!1:s(e.hashSync($,E.substr(0,E.length-31)),E)},e.compare=function($,E,A,w){function v(C){if(typeof $!="string"||typeof E!="string"){o(C.bind(this,Error("Illegal arguments: "+typeof $+", "+typeof E)));return}if(E.length!==60){o(C.bind(this,null,!1));return}e.hash($,E.substr(0,29),function(R,Z){R?C(R):C(null,s(Z,E))},w)}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);v(A)}else return new Promise(function(C,R){v(function(Z,K){if(Z){R(Z);return}C(K)})})},e.getRounds=function($){if(typeof $!="string")throw Error("Illegal arguments: "+typeof $);return parseInt($.split("$")[2],10)},e.getSalt=function($){if(typeof $!="string")throw Error("Illegal arguments: "+typeof $);if($.length!==60)throw Error("Illegal hash length: "+$.length+" != 60");return $.substring(0,29)};var o=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c($){var E=[],A=0;return x.encodeUTF16toUTF8(function(){return A>=$.length?null:$.charCodeAt(A++)},function(w){E.push(w)}),E}var l="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],p=String.fromCharCode;function g($,E){var A=0,w=[],v,C;if(E<=0||E>$.length)throw Error("Illegal len: "+E);for(;A<E;){if(v=$[A++]&255,w.push(l[v>>2&63]),v=(v&3)<<4,A>=E){w.push(l[v&63]);break}if(C=$[A++]&255,v|=C>>4&15,w.push(l[v&63]),v=(C&15)<<2,A>=E){w.push(l[v&63]);break}C=$[A++]&255,v|=C>>6&3,w.push(l[v&63]),w.push(l[C&63])}return w.join("")}function _($,E){var A=0,w=$.length,v=0,C=[],R,Z,K,ee,se,M;if(E<=0)throw Error("Illegal len: "+E);for(;A<w-1&&v<E&&(M=$.charCodeAt(A++),R=M<u.length?u[M]:-1,M=$.charCodeAt(A++),Z=M<u.length?u[M]:-1,!(R==-1||Z==-1||(se=R<<2>>>0,se|=(Z&48)>>4,C.push(p(se)),++v>=E||A>=w)||(M=$.charCodeAt(A++),K=M<u.length?u[M]:-1,K==-1)||(se=(Z&15)<<4>>>0,se|=(K&60)>>2,C.push(p(se)),++v>=E||A>=w)));)M=$.charCodeAt(A++),ee=M<u.length?u[M]:-1,se=(K&3)<<6>>>0,se|=ee,C.push(p(se)),++v;var Se=[];for(A=0;A<v;A++)Se.push(C[A].charCodeAt(0));return Se}var x=function(){var $={};return $.MAX_CODEPOINT=1114111,$.encodeUTF8=function(E,A){var w=null;for(typeof E=="number"&&(w=E,E=function(){return null});w!==null||(w=E())!==null;)w<128?A(w&127):w<2048?(A(w>>6&31|192),A(w&63|128)):w<65536?(A(w>>12&15|224),A(w>>6&63|128),A(w&63|128)):(A(w>>18&7|240),A(w>>12&63|128),A(w>>6&63|128),A(w&63|128)),w=null},$.decodeUTF8=function(E,A){for(var w,v,C,R,Z=function(K){K=K.slice(0,K.indexOf(null));var ee=Error(K.toString());throw ee.name="TruncatedError",ee.bytes=K,ee};(w=E())!==null;)if(!(w&128))A(w);else if((w&224)===192)(v=E())===null&&Z([w,v]),A((w&31)<<6|v&63);else if((w&240)===224)((v=E())===null||(C=E())===null)&&Z([w,v,C]),A((w&15)<<12|(v&63)<<6|C&63);else if((w&248)===240)((v=E())===null||(C=E())===null||(R=E())===null)&&Z([w,v,C,R]),A((w&7)<<18|(v&63)<<12|(C&63)<<6|R&63);else throw RangeError("Illegal starting byte: "+w)},$.UTF16toUTF8=function(E,A){for(var w,v=null;(w=v!==null?v:E())!==null;){if(w>=55296&&w<=57343&&(v=E())!==null&&v>=56320&&v<=57343){A((w-55296)*1024+v-56320+65536),v=null;continue}A(w)}v!==null&&A(v)},$.UTF8toUTF16=function(E,A){var w=null;for(typeof E=="number"&&(w=E,E=function(){return null});w!==null||(w=E())!==null;)w<=65535?A(w):(w-=65536,A((w>>10)+55296),A(w%1024+56320)),w=null},$.encodeUTF16toUTF8=function(E,A){$.UTF16toUTF8(E,function(w){$.encodeUTF8(w,A)})},$.decodeUTF8toUTF16=function(E,A){$.decodeUTF8(E,function(w){$.UTF8toUTF16(w,A)})},$.calculateCodePoint=function(E){return E<128?1:E<2048?2:E<65536?3:4},$.calculateUTF8=function(E){for(var A,w=0;(A=E())!==null;)w+=$.calculateCodePoint(A);return w},$.calculateUTF16asUTF8=function(E){var A=0,w=0;return $.UTF16toUTF8(E,function(v){++A,w+=$.calculateCodePoint(v)}),[A,w]},$}();Date.now=Date.now||function(){return+new Date};var h=16,m=10,b=16,S=100,O=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],T=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],q=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function oe($,E,A,w){var v,C=$[E],R=$[E+1];return C^=A[0],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[1],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[2],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[3],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[4],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[5],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[6],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[7],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[8],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[9],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[10],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[11],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[12],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[13],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[14],v=w[C>>>24],v+=w[256|C>>16&255],v^=w[512|C>>8&255],v+=w[768|C&255],R^=v^A[15],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],C^=v^A[16],$[E]=R^A[b+1],$[E+1]=C,$}function pe($,E){for(var A=0,w=0;A<4;++A)w=w<<8|$[E]&255,E=(E+1)%$.length;return{key:w,offp:E}}function ce($,E,A){for(var w=0,v=[0,0],C=E.length,R=A.length,Z,K=0;K<C;K++)Z=pe($,w),w=Z.offp,E[K]=E[K]^Z.key;for(K=0;K<C;K+=2)v=oe(v,0,E,A),E[K]=v[0],E[K+1]=v[1];for(K=0;K<R;K+=2)v=oe(v,0,E,A),A[K]=v[0],A[K+1]=v[1]}function Re($,E,A,w){for(var v=0,C=[0,0],R=A.length,Z=w.length,K,ee=0;ee<R;ee++)K=pe(E,v),v=K.offp,A[ee]=A[ee]^K.key;for(v=0,ee=0;ee<R;ee+=2)K=pe($,v),v=K.offp,C[0]^=K.key,K=pe($,v),v=K.offp,C[1]^=K.key,C=oe(C,0,A,w),A[ee]=C[0],A[ee+1]=C[1];for(ee=0;ee<Z;ee+=2)K=pe($,v),v=K.offp,C[0]^=K.key,K=pe($,v),v=K.offp,C[1]^=K.key,C=oe(C,0,A,w),w[ee]=C[0],w[ee+1]=C[1]}function nt($,E,A,w,v){var C=q.slice(),R=C.length,Z;if(A<4||A>31)if(Z=Error("Illegal number of rounds (4-31): "+A),w){o(w.bind(this,Z));return}else throw Z;if(E.length!==h)if(Z=Error("Illegal salt length: "+E.length+" != "+h),w){o(w.bind(this,Z));return}else throw Z;A=1<<A>>>0;var K,ee,se=0,M;Int32Array?(K=new Int32Array(O),ee=new Int32Array(T)):(K=O.slice(),ee=T.slice()),Re(E,$,K,ee);function Se(){if(v&&v(se/A),se<A)for(var de=Date.now();se<A&&(se=se+1,ce($,K,ee),ce(E,K,ee),!(Date.now()-de>S)););else{for(se=0;se<64;se++)for(M=0;M<R>>1;M++)oe(C,M<<1,K,ee);var we=[];for(se=0;se<R;se++)we.push((C[se]>>24&255)>>>0),we.push((C[se]>>16&255)>>>0),we.push((C[se]>>8&255)>>>0),we.push((C[se]&255)>>>0);if(w){w(null,we);return}else return we}w&&o(Se)}if(typeof w<"u")Se();else for(var Jt;;)if(typeof(Jt=Se())<"u")return Jt||[]}function Fe($,E,A,w){var v;if(typeof $!="string"||typeof E!="string")if(v=Error("Invalid string / salt: Not a string"),A){o(A.bind(this,v));return}else throw v;var C,R;if(E.charAt(0)!=="$"||E.charAt(1)!=="2")if(v=Error("Invalid salt version: "+E.substring(0,2)),A){o(A.bind(this,v));return}else throw v;if(E.charAt(2)==="$")C="\0",R=3;else{if(C=E.charAt(2),C!=="a"&&C!=="b"&&C!=="y"||E.charAt(3)!=="$")if(v=Error("Invalid salt revision: "+E.substring(2,4)),A){o(A.bind(this,v));return}else throw v;R=4}if(E.charAt(R+2)>"$")if(v=Error("Missing salt rounds"),A){o(A.bind(this,v));return}else throw v;var Z=parseInt(E.substring(R,R+1),10)*10,K=parseInt(E.substring(R+1,R+2),10),ee=Z+K,se=E.substring(R+3,R+25);$+=C>="a"?"\0":"";var M=c($),Se=_(se,h);function Jt(de){var we=[];return we.push("$2"),C>="a"&&we.push(C),we.push("$"),ee<10&&we.push("0"),we.push(ee.toString()),we.push("$"),we.push(g(Se,Se.length)),we.push(g(de,q.length*4-1)),we.join("")}if(typeof A>"u")return Jt(nt(M,Se,ee));nt(M,Se,ee,function(de,we){de?A(de,null):A(null,Jt(we))},w)}return e.encodeBase64=g,e.decodeBase64=_,e})})(Dd);var pg=Dd.exports;const Ja=og(pg),fg="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let hg=n=>crypto.getRandomValues(new Uint8Array(n)),gg=(n,e,t)=>{let i=(2<<Math.log2(n.length-1))-1,r=-~(1.6*i*e/n.length);return(s=e)=>{let o="";for(;;){let c=t(r),l=r;for(;l--;)if(o+=n[c[l]&i]||"",o.length===s)return o}}},_g=(n,e=21)=>gg(n,e,hg),Ve=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=fg[t[n]&63];return e};const mg=24;function Za(){return _g("0123456789abcdef",mg)()}function wl(n){if(!n.includes("|"))return console.error("Invalid user_id format"),n;const[,e]=n.split("|");return e}async function Fd(n,e,t){return(await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`})).users}async function Ya({userAdapter:n,tenant_id:e,email:t,provider:i}){const{users:r}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t} provider:${i}`});return r.length>1&&console.error("More than one user found for same email and provider"),r[0]||null}async function qd({userAdapter:n,tenant_id:e,email:t}){var c;const{users:i}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`}),r=i.filter(l=>!(l.provider==="auth2"&&!l.email_verified));if(r.length===0)return;const s=r.filter(l=>!l.linked_to);if(s.length>0)return s.length>1&&console.error("More than one primary user found for same email"),s[0];const o=await n.get(e,(c=r[0])==null?void 0:c.linked_to);if(!o)throw new Error("Primary account not found");return o}async function os({userAdapter:n,tenant_id:e,email:t,provider:i}){const r=await Ya({userAdapter:n,tenant_id:e,email:t,provider:i});return r?r.linked_to?n.get(e,r.linked_to):r:null}const on=a.z.object({page:a.z.string().min(0).optional().default("0").transform(n=>parseInt(n,10)).openapi({description:"The page number where 0 is the first page"}),per_page:a.z.string().min(1).optional().default("10").transform(n=>parseInt(n,10)).openapi({description:"The number of items per page"}),include_totals:a.z.string().optional().default("false").transform(n=>n==="true").openapi({description:"If the total number of items should be included in the response"}),sort:a.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:a.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function Dn(n){if(!n)return;const[e,t]=n.split(":"),i=t==="1"?"asc":"desc";if(!(!e||!i))return{sort_by:e,sort_order:i}}function be(n,e){return{type:e.type,description:e.description||"",ip:n.req.header("x-real-ip")||"",user_agent:n.req.header("user-agent")||"",date:new Date().toISOString(),details:{request:{method:n.req.method,path:n.req.path,qs:n.req.queries(),body:e.body||n.var.body||""}},isMobile:!1,client_id:n.var.client_id,client_name:"",user_id:e.userId||n.var.user_id||"",hostname:n.req.header("host")||"",user_name:n.var.username||"",connection_id:"",connection:n.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}var yg={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},vg=()=>{var t,i;const n=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[r,s]of Object.entries(yg))if(wg(s))return r}return typeof(n==null?void 0:n.EdgeRuntime)=="string"?"edge-light":(n==null?void 0:n.fastly)!==void 0?"fastly":((i=(t=n==null?void 0:n.process)==null?void 0:t.release)==null?void 0:i.name)==="node"?"node":"other"},wg=n=>navigator.userAgent.startsWith(n);function gt(n,e){vg()==="workerd"&&n.executionCtx.waitUntil(e)}const bl=Ft.extend({users:a.z.array(ft)}),bg=Ft.extend({sessions:a.z.array(Ga)}),kg=new a.OpenAPIHono().openapi(a.createRoute({tags:["users"],method:"get",path:"/",request:{query:on,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(ft),bl])}},description:"List of users"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":o}=n.req.valid("header");if(s!=null&&s.includes("identities.profileData.email")){const p=s.split("=")[1],_=(await n.env.data.users.list(o,{page:e,per_page:t,include_totals:i,q:`email:${p}`})).users.filter(m=>m.linked_to),[x]=_;if(!x)return n.json([]);const h=await n.env.data.users.get(o,x.linked_to);if(!h)throw new j(500,{message:"Primary account not found"});return n.json([ft.parse(h)])}const c=["-_exists_:linked_to"];s&&c.push(s);const l=await n.env.data.users.list(o,{page:e,per_page:t,include_totals:i,sort:Dn(r),q:c.join(" ")}),u=l.users.filter(p=>!p.linked_to);return i?n.json(bl.parse({users:u,length:l.length,start:l.start,limit:l.limit})):n.json(a.z.array(ft).parse(u))}).openapi(a.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ft}},description:"List of users"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header"),i=await n.env.data.users.get(t,e);if(!i)throw new j(404);if(i.linked_to)throw new j(404,{message:"User is linked to another user"});return n.json(i)}).openapi(a.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header");if(!await n.env.data.users.remove(t,e))throw new j(404);return n.text("OK")}).openapi(a.createRoute({tags:["users"],method:"post",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object({...fr.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ft}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");n.set("body",t);const{email:i}=t;if(!i)throw new j(400,{message:"Email is required"});const r=i.toLowerCase(),s=`${t.provider}|${t.user_id||Za()}`;try{const o=await n.env.data.users.create(e,{email:r,user_id:s,name:t.name||r,provider:t.provider,connection:t.connection,email_verified:t.email_verified||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});n.set("user_id",o.user_id);const c=be(n,{type:_e.SUCCESS_API_OPERATION,description:"User created"});gt(n,n.env.data.logs.create(e,c));const l={...o,identities:[{connection:o.connection,provider:o.provider,user_id:wl(o.user_id),isSocial:o.is_social}]};return n.json(ft.parse(l),{status:201})}catch(o){throw o.message==="User already exists"?new j(409,{message:"User already exists"}):o}}).openapi(a.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object({...fr.shape,verify_email:a.z.boolean(),password:a.z.string()}).partial()}}},params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{var u;const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),{verify_email:r,password:s,...o}=t,c=await n.env.data.users.get(e,i);if(!c)throw new j(404);if(o.email&&o.email!==c.email){const p=await Fd(n.env.data.users,e,o.email);if(p.length&&p.some(g=>g.user_id!==i))throw new j(409,{message:"Another user with the same email address already exists."})}if(c.linked_to)throw new j(404,{message:"User is linked to another user"});if(await n.env.data.users.update(e,i,o),s){const p=(u=c.identities)==null?void 0:u.find(g=>g.connection==="Username-Password-Authentication");if(!p)throw new j(400,{message:"User does not have a password identity"});await n.env.data.passwords.update(e,{user_id:`${p.provider}|${p.user_id}`,password:Ja.hashSync(s,10),algorithm:"bcrypt"})}const l=await n.env.data.users.get(e,i);if(!l)throw new j(500);return n.json(l)}).openapi(a.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.union([a.z.object({link_with:a.z.string()}),a.z.object({user_id:a.z.string(),provider:a.z.string(),connection:a.z.string().optional()})])}}},params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:a.z.array(a.z.object({connection:a.z.string(),provider:a.z.string(),user_id:a.z.string(),isSocial:a.z.boolean()}))}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),r="link_with"in t?t.link_with:t.user_id,s=await n.env.data.users.get(e,i);if(!s)throw new j(400,{message:"Linking an inexistent identity is not allowed."});await n.env.data.users.update(e,r,{linked_to:i});const o=await n.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${i}`}),c=[s,...o.users].map(l=>({connection:l.connection,provider:l.provider,user_id:wl(l.user_id),isSocial:l.is_social}));return n.json(c,{status:201})}).openapi(a.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string(),provider:a.z.string(),linked_user_id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:a.z.array(ft)}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{user_id:t,provider:i,linked_user_id:r}=n.req.valid("param");await n.env.data.users.unlink(e,t,i,r);const s=await n.env.data.users.get(e,t);if(!s)throw new j(404);return n.json([ft.parse(s)])}).openapi(a.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:on,headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({user_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(Ga),bg])}},description:"List of sessions"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{include_totals:t}=n.req.valid("query"),{"tenant-id":i}=n.req.valid("header"),r=await n.env.data.sessions.list(i,{page:0,per_page:10,include_totals:!1,q:`user_id:${e}`});return t?n.json(r):n.json(r.sessions)});/*! *****************************************************************************
5
+ */(function(e,t){typeof lg=="function"&&n&&n.exports?n.exports=t():(e.dcodeIO=e.dcodeIO||{}).bcrypt=t()})(vr,function(){var e={},t=null;function i(z){if(n&&n.exports)try{return pg.randomBytes(z)}catch{}try{var E;return(self.crypto||self.msCrypto).getRandomValues(E=new Uint32Array(z)),Array.prototype.slice.call(E)}catch{}if(!t)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return t(z)}var r=!1;try{i(1),r=!0}catch{}t=null,e.setRandomFallback=function(z){t=z},e.genSaltSync=function(z,E){if(z=z||m,typeof z!="number")throw Error("Illegal arguments: "+typeof z+", "+typeof E);z<4?z=4:z>31&&(z=31);var A=[];return A.push("$2a$"),z<10&&A.push("0"),A.push(z.toString()),A.push("$"),A.push(g(i(h),h)),A.join("")},e.genSalt=function(z,E,A){if(typeof E=="function"&&(A=E,E=void 0),typeof z=="function"&&(A=z,z=void 0),typeof z>"u")z=m;else if(typeof z!="number")throw Error("illegal arguments: "+typeof z);function w(v){a(function(){try{v(null,e.genSaltSync(z))}catch($){v($)}})}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);w(A)}else return new Promise(function(v,$){w(function(R,Z){if(R){$(R);return}v(Z)})})},e.hashSync=function(z,E){if(typeof E>"u"&&(E=m),typeof E=="number"&&(E=e.genSaltSync(E)),typeof z!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof z+", "+typeof E);return Fe(z,E)},e.hash=function(z,E,A,w){function v($){typeof z=="string"&&typeof E=="number"?e.genSalt(E,function(R,Z){Fe(z,Z,$,w)}):typeof z=="string"&&typeof E=="string"?Fe(z,E,$,w):a($.bind(this,Error("Illegal arguments: "+typeof z+", "+typeof E)))}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);v(A)}else return new Promise(function($,R){v(function(Z,K){if(Z){R(Z);return}$(K)})})};function s(z,E){for(var A=0,w=0,v=0,$=z.length;v<$;++v)z.charCodeAt(v)===E.charCodeAt(v)?++A:++w;return A<0?!1:w===0}e.compareSync=function(z,E){if(typeof z!="string"||typeof E!="string")throw Error("Illegal arguments: "+typeof z+", "+typeof E);return E.length!==60?!1:s(e.hashSync(z,E.substr(0,E.length-31)),E)},e.compare=function(z,E,A,w){function v($){if(typeof z!="string"||typeof E!="string"){a($.bind(this,Error("Illegal arguments: "+typeof z+", "+typeof E)));return}if(E.length!==60){a($.bind(this,null,!1));return}e.hash(z,E.substr(0,29),function(R,Z){R?$(R):$(null,s(Z,E))},w)}if(A){if(typeof A!="function")throw Error("Illegal callback: "+typeof A);v(A)}else return new Promise(function($,R){v(function(Z,K){if(Z){R(Z);return}$(K)})})},e.getRounds=function(z){if(typeof z!="string")throw Error("Illegal arguments: "+typeof z);return parseInt(z.split("$")[2],10)},e.getSalt=function(z){if(typeof z!="string")throw Error("Illegal arguments: "+typeof z);if(z.length!==60)throw Error("Illegal hash length: "+z.length+" != 60");return z.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function c(z){var E=[],A=0;return x.encodeUTF16toUTF8(function(){return A>=z.length?null:z.charCodeAt(A++)},function(w){E.push(w)}),E}var l="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],p=String.fromCharCode;function g(z,E){var A=0,w=[],v,$;if(E<=0||E>z.length)throw Error("Illegal len: "+E);for(;A<E;){if(v=z[A++]&255,w.push(l[v>>2&63]),v=(v&3)<<4,A>=E){w.push(l[v&63]);break}if($=z[A++]&255,v|=$>>4&15,w.push(l[v&63]),v=($&15)<<2,A>=E){w.push(l[v&63]);break}$=z[A++]&255,v|=$>>6&3,w.push(l[v&63]),w.push(l[$&63])}return w.join("")}function _(z,E){var A=0,w=z.length,v=0,$=[],R,Z,K,ee,se,M;if(E<=0)throw Error("Illegal len: "+E);for(;A<w-1&&v<E&&(M=z.charCodeAt(A++),R=M<u.length?u[M]:-1,M=z.charCodeAt(A++),Z=M<u.length?u[M]:-1,!(R==-1||Z==-1||(se=R<<2>>>0,se|=(Z&48)>>4,$.push(p(se)),++v>=E||A>=w)||(M=z.charCodeAt(A++),K=M<u.length?u[M]:-1,K==-1)||(se=(Z&15)<<4>>>0,se|=(K&60)>>2,$.push(p(se)),++v>=E||A>=w)));)M=z.charCodeAt(A++),ee=M<u.length?u[M]:-1,se=(K&3)<<6>>>0,se|=ee,$.push(p(se)),++v;var Se=[];for(A=0;A<v;A++)Se.push($[A].charCodeAt(0));return Se}var x=function(){var z={};return z.MAX_CODEPOINT=1114111,z.encodeUTF8=function(E,A){var w=null;for(typeof E=="number"&&(w=E,E=function(){return null});w!==null||(w=E())!==null;)w<128?A(w&127):w<2048?(A(w>>6&31|192),A(w&63|128)):w<65536?(A(w>>12&15|224),A(w>>6&63|128),A(w&63|128)):(A(w>>18&7|240),A(w>>12&63|128),A(w>>6&63|128),A(w&63|128)),w=null},z.decodeUTF8=function(E,A){for(var w,v,$,R,Z=function(K){K=K.slice(0,K.indexOf(null));var ee=Error(K.toString());throw ee.name="TruncatedError",ee.bytes=K,ee};(w=E())!==null;)if(!(w&128))A(w);else if((w&224)===192)(v=E())===null&&Z([w,v]),A((w&31)<<6|v&63);else if((w&240)===224)((v=E())===null||($=E())===null)&&Z([w,v,$]),A((w&15)<<12|(v&63)<<6|$&63);else if((w&248)===240)((v=E())===null||($=E())===null||(R=E())===null)&&Z([w,v,$,R]),A((w&7)<<18|(v&63)<<12|($&63)<<6|R&63);else throw RangeError("Illegal starting byte: "+w)},z.UTF16toUTF8=function(E,A){for(var w,v=null;(w=v!==null?v:E())!==null;){if(w>=55296&&w<=57343&&(v=E())!==null&&v>=56320&&v<=57343){A((w-55296)*1024+v-56320+65536),v=null;continue}A(w)}v!==null&&A(v)},z.UTF8toUTF16=function(E,A){var w=null;for(typeof E=="number"&&(w=E,E=function(){return null});w!==null||(w=E())!==null;)w<=65535?A(w):(w-=65536,A((w>>10)+55296),A(w%1024+56320)),w=null},z.encodeUTF16toUTF8=function(E,A){z.UTF16toUTF8(E,function(w){z.encodeUTF8(w,A)})},z.decodeUTF8toUTF16=function(E,A){z.decodeUTF8(E,function(w){z.UTF8toUTF16(w,A)})},z.calculateCodePoint=function(E){return E<128?1:E<2048?2:E<65536?3:4},z.calculateUTF8=function(E){for(var A,w=0;(A=E())!==null;)w+=z.calculateCodePoint(A);return w},z.calculateUTF16asUTF8=function(E){var A=0,w=0;return z.UTF16toUTF8(E,function(v){++A,w+=z.calculateCodePoint(v)}),[A,w]},z}();Date.now=Date.now||function(){return+new Date};var h=16,m=10,b=16,S=100,O=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],T=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],F=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function oe(z,E,A,w){var v,$=z[E],R=z[E+1];return $^=A[0],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[1],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[2],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[3],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[4],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[5],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[6],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[7],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[8],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[9],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[10],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[11],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[12],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[13],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[14],v=w[$>>>24],v+=w[256|$>>16&255],v^=w[512|$>>8&255],v+=w[768|$&255],R^=v^A[15],v=w[R>>>24],v+=w[256|R>>16&255],v^=w[512|R>>8&255],v+=w[768|R&255],$^=v^A[16],z[E]=R^A[b+1],z[E+1]=$,z}function pe(z,E){for(var A=0,w=0;A<4;++A)w=w<<8|z[E]&255,E=(E+1)%z.length;return{key:w,offp:E}}function ce(z,E,A){for(var w=0,v=[0,0],$=E.length,R=A.length,Z,K=0;K<$;K++)Z=pe(z,w),w=Z.offp,E[K]=E[K]^Z.key;for(K=0;K<$;K+=2)v=oe(v,0,E,A),E[K]=v[0],E[K+1]=v[1];for(K=0;K<R;K+=2)v=oe(v,0,E,A),A[K]=v[0],A[K+1]=v[1]}function Pe(z,E,A,w){for(var v=0,$=[0,0],R=A.length,Z=w.length,K,ee=0;ee<R;ee++)K=pe(E,v),v=K.offp,A[ee]=A[ee]^K.key;for(v=0,ee=0;ee<R;ee+=2)K=pe(z,v),v=K.offp,$[0]^=K.key,K=pe(z,v),v=K.offp,$[1]^=K.key,$=oe($,0,A,w),A[ee]=$[0],A[ee+1]=$[1];for(ee=0;ee<Z;ee+=2)K=pe(z,v),v=K.offp,$[0]^=K.key,K=pe(z,v),v=K.offp,$[1]^=K.key,$=oe($,0,A,w),w[ee]=$[0],w[ee+1]=$[1]}function it(z,E,A,w,v){var $=F.slice(),R=$.length,Z;if(A<4||A>31)if(Z=Error("Illegal number of rounds (4-31): "+A),w){a(w.bind(this,Z));return}else throw Z;if(E.length!==h)if(Z=Error("Illegal salt length: "+E.length+" != "+h),w){a(w.bind(this,Z));return}else throw Z;A=1<<A>>>0;var K,ee,se=0,M;Int32Array?(K=new Int32Array(O),ee=new Int32Array(T)):(K=O.slice(),ee=T.slice()),Pe(E,z,K,ee);function Se(){if(v&&v(se/A),se<A)for(var de=Date.now();se<A&&(se=se+1,ce(z,K,ee),ce(E,K,ee),!(Date.now()-de>S)););else{for(se=0;se<64;se++)for(M=0;M<R>>1;M++)oe($,M<<1,K,ee);var we=[];for(se=0;se<R;se++)we.push(($[se]>>24&255)>>>0),we.push(($[se]>>16&255)>>>0),we.push(($[se]>>8&255)>>>0),we.push(($[se]&255)>>>0);if(w){w(null,we);return}else return we}w&&a(Se)}if(typeof w<"u")Se();else for(var Jt;;)if(typeof(Jt=Se())<"u")return Jt||[]}function Fe(z,E,A,w){var v;if(typeof z!="string"||typeof E!="string")if(v=Error("Invalid string / salt: Not a string"),A){a(A.bind(this,v));return}else throw v;var $,R;if(E.charAt(0)!=="$"||E.charAt(1)!=="2")if(v=Error("Invalid salt version: "+E.substring(0,2)),A){a(A.bind(this,v));return}else throw v;if(E.charAt(2)==="$")$="\0",R=3;else{if($=E.charAt(2),$!=="a"&&$!=="b"&&$!=="y"||E.charAt(3)!=="$")if(v=Error("Invalid salt revision: "+E.substring(2,4)),A){a(A.bind(this,v));return}else throw v;R=4}if(E.charAt(R+2)>"$")if(v=Error("Missing salt rounds"),A){a(A.bind(this,v));return}else throw v;var Z=parseInt(E.substring(R,R+1),10)*10,K=parseInt(E.substring(R+1,R+2),10),ee=Z+K,se=E.substring(R+3,R+25);z+=$>="a"?"\0":"";var M=c(z),Se=_(se,h);function Jt(de){var we=[];return we.push("$2"),$>="a"&&we.push($),we.push("$"),ee<10&&we.push("0"),we.push(ee.toString()),we.push("$"),we.push(g(Se,Se.length)),we.push(g(de,F.length*4-1)),we.join("")}if(typeof A>"u")return Jt(it(M,Se,ee));it(M,Se,ee,function(de,we){de?A(de,null):A(null,Jt(we))},w)}return e.encodeBase64=g,e.decodeBase64=_,e})})(Dd);var fg=Dd.exports;const Ja=ag(fg),hg="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let gg=n=>crypto.getRandomValues(new Uint8Array(n)),_g=(n,e,t)=>{let i=(2<<Math.log2(n.length-1))-1,r=-~(1.6*i*e/n.length);return(s=e)=>{let a="";for(;;){let c=t(r),l=r;for(;l--;)if(a+=n[c[l]&i]||"",a.length===s)return a}}},mg=(n,e=21)=>_g(n,e,gg),Me=(n=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(n));for(;n--;)e+=hg[t[n]&63];return e};const yg=24;function Za(){return mg("0123456789abcdef",yg)()}function wl(n){if(!n.includes("|"))return console.error("Invalid user_id format"),n;const[,e]=n.split("|");return e}async function qd(n,e,t){return(await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`})).users}async function Ya({userAdapter:n,tenant_id:e,email:t,provider:i}){const{users:r}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t} provider:${i}`});return r.length>1&&console.error("More than one user found for same email and provider"),r[0]||null}async function Fd({userAdapter:n,tenant_id:e,email:t}){var c;const{users:i}=await n.list(e,{page:0,per_page:10,include_totals:!1,q:`email:${t}`}),r=i.filter(l=>!(l.provider==="auth2"&&!l.email_verified));if(r.length===0)return;const s=r.filter(l=>!l.linked_to);if(s.length>0)return s.length>1&&console.error("More than one primary user found for same email"),s[0];const a=await n.get(e,(c=r[0])==null?void 0:c.linked_to);if(!a)throw new Error("Primary account not found");return a}async function as({userAdapter:n,tenant_id:e,email:t,provider:i}){const r=await Ya({userAdapter:n,tenant_id:e,email:t,provider:i});return r?r.linked_to?n.get(e,r.linked_to):r:null}const on=o.z.object({page:o.z.string().min(0).optional().default("0").transform(n=>parseInt(n,10)).openapi({description:"The page number where 0 is the first page"}),per_page:o.z.string().min(1).optional().default("10").transform(n=>parseInt(n,10)).openapi({description:"The number of items per page"}),include_totals:o.z.string().optional().default("false").transform(n=>n==="true").openapi({description:"If the total number of items should be included in the response"}),sort:o.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:o.z.string().optional().openapi({description:"A lucene query string used to filter the results"})});function Dn(n){if(!n)return;const[e,t]=n.split(":"),i=t==="1"?"asc":"desc";if(!(!e||!i))return{sort_by:e,sort_order:i}}function be(n,e){return{type:e.type,description:e.description||"",ip:n.req.header("x-real-ip")||"",user_agent:n.req.header("user-agent")||"",date:new Date().toISOString(),details:{request:{method:n.req.method,path:n.req.path,qs:n.req.queries(),body:e.body||n.var.body||""}},isMobile:!1,client_id:n.var.client_id,client_name:"",user_id:e.userId||n.var.user_id||"",hostname:n.req.header("host")||"",user_name:n.var.username||"",connection_id:"",connection:n.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}var vg={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},wg=()=>{var t,i;const n=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[r,s]of Object.entries(vg))if(bg(s))return r}return typeof(n==null?void 0:n.EdgeRuntime)=="string"?"edge-light":(n==null?void 0:n.fastly)!==void 0?"fastly":((i=(t=n==null?void 0:n.process)==null?void 0:t.release)==null?void 0:i.name)==="node"?"node":"other"},bg=n=>navigator.userAgent.startsWith(n);function _t(n,e){wg()==="workerd"&&n.executionCtx.waitUntil(e)}const bl=qt.extend({users:o.z.array(ht)}),kg=qt.extend({sessions:o.z.array(os)}),xg=new o.OpenAPIHono().openapi(o.createRoute({tags:["users"],method:"get",path:"/",request:{query:on,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(ht),bl])}},description:"List of users"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":a}=n.req.valid("header");if(s!=null&&s.includes("identities.profileData.email")){const p=s.split("=")[1],_=(await n.env.data.users.list(a,{page:e,per_page:t,include_totals:i,q:`email:${p}`})).users.filter(m=>m.linked_to),[x]=_;if(!x)return n.json([]);const h=await n.env.data.users.get(a,x.linked_to);if(!h)throw new j(500,{message:"Primary account not found"});return n.json([ht.parse(h)])}const c=["-_exists_:linked_to"];s&&c.push(s);const l=await n.env.data.users.list(a,{page:e,per_page:t,include_totals:i,sort:Dn(r),q:c.join(" ")}),u=l.users.filter(p=>!p.linked_to);return i?n.json(bl.parse({users:u,length:l.length,start:l.start,limit:l.limit})):n.json(o.z.array(ht).parse(u))}).openapi(o.createRoute({tags:["users"],method:"get",path:"/{user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ht}},description:"List of users"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header"),i=await n.env.data.users.get(t,e);if(!i)throw new j(404);if(i.linked_to)throw new j(404,{message:"User is linked to another user"});return n.json(i)}).openapi(o.createRoute({tags:["users"],method:"delete",path:"/{user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{"tenant-id":t}=n.req.valid("header");if(!await n.env.data.users.remove(t,e))throw new j(404);return n.text("OK")}).openapi(o.createRoute({tags:["users"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({...fr.shape})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:ht}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");n.set("body",t);const{email:i}=t;if(!i)throw new j(400,{message:"Email is required"});const r=i.toLowerCase(),s=`${t.provider}|${t.user_id||Za()}`;try{const a=await n.env.data.users.create(e,{email:r,user_id:s,name:t.name||r,provider:t.provider,connection:t.connection,email_verified:t.email_verified||!1,last_ip:"",is_social:!1,last_login:new Date().toISOString()});n.set("user_id",a.user_id);const c=be(n,{type:_e.SUCCESS_API_OPERATION,description:"User created"});_t(n,n.env.data.logs.create(e,c));const l={...a,identities:[{connection:a.connection,provider:a.provider,user_id:wl(a.user_id),isSocial:a.is_social}]};return n.json(ht.parse(l),{status:201})}catch(a){throw a.message==="User already exists"?new j(409,{message:"User already exists"}):a}}).openapi(o.createRoute({tags:["users"],method:"patch",path:"/{user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object({...fr.shape,verify_email:o.z.boolean(),password:o.z.string()}).partial()}}},params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{var u;const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),{verify_email:r,password:s,...a}=t,c=await n.env.data.users.get(e,i);if(!c)throw new j(404);if(a.email&&a.email!==c.email){const p=await qd(n.env.data.users,e,a.email);if(p.length&&p.some(g=>g.user_id!==i))throw new j(409,{message:"Another user with the same email address already exists."})}if(c.linked_to)throw new j(404,{message:"User is linked to another user"});if(await n.env.data.users.update(e,i,a),s){const p=(u=c.identities)==null?void 0:u.find(g=>g.connection==="Username-Password-Authentication");if(!p)throw new j(400,{message:"User does not have a password identity"});await n.env.data.passwords.update(e,{user_id:`${p.provider}|${p.user_id}`,password:Ja.hashSync(s,10),algorithm:"bcrypt"})}const l=await n.env.data.users.get(e,i);if(!l)throw new j(500);return n.json(l)}).openapi(o.createRoute({tags:["users"],method:"post",path:"/{user_id}/identities",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.union([o.z.object({link_with:o.z.string()}),o.z.object({user_id:o.z.string(),provider:o.z.string(),connection:o.z.string().optional()})])}}},params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:o.z.array(o.z.object({connection:o.z.string(),provider:o.z.string(),user_id:o.z.string(),isSocial:o.z.boolean()}))}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),{user_id:i}=n.req.valid("param"),r="link_with"in t?t.link_with:t.user_id,s=await n.env.data.users.get(e,i);if(!s)throw new j(400,{message:"Linking an inexistent identity is not allowed."});await n.env.data.users.update(e,r,{linked_to:i});const a=await n.env.data.users.list(e,{page:0,per_page:10,include_totals:!1,q:`linked_to:${i}`}),c=[s,...a.users].map(l=>({connection:l.connection,provider:l.provider,user_id:wl(l.user_id),isSocial:l.is_social}));return n.json(c,{status:201})}).openapi(o.createRoute({tags:["users"],method:"delete",path:"/{user_id}/identities/{provider}/{linked_user_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string(),provider:o.z.string(),linked_user_id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:o.z.array(ht)}},description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{user_id:t,provider:i,linked_user_id:r}=n.req.valid("param");await n.env.data.users.unlink(e,t,i,r);const s=await n.env.data.users.get(e,t);if(!s)throw new j(404);return n.json([ht.parse(s)])}).openapi(o.createRoute({tags:["users"],method:"get",path:"/{user_id}/sessions",request:{query:on,headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({user_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(os),kg])}},description:"List of sessions"}}}),async n=>{const{user_id:e}=n.req.valid("param"),{include_totals:t}=n.req.valid("query"),{"tenant-id":i}=n.req.valid("header"),r=await n.env.data.sessions.list(i,{page:0,per_page:10,include_totals:!1,q:`user_id:${e}`});return t?n.json(r):n.json(r.sessions)});/*! *****************************************************************************
6
6
  Copyright (C) Microsoft. All rights reserved.
7
7
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
8
8
  this file except in compliance with the License. You may obtain a copy of the
@@ -15,7 +15,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
15
15
 
16
16
  See the Apache Version 2.0 License for specific language governing permissions
17
17
  and limitations under the License.
18
- ***************************************************************************** */var kl;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof vr=="object"?vr:typeof self=="object"?self:typeof this=="object"?this:c(),i=r(n);typeof t.Reflect<"u"&&(i=r(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=n);function r(l,u){return function(p,g){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:g}),u&&u(p,g)}}function s(){try{return Function("return this;")()}catch{}}function o(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return s()||o()}})(function(e,t){var i=Object.prototype.hasOwnProperty,r=typeof Symbol=="function",s=r&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=r&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return no(Object.create(null))}:l?function(){return no({__proto__:null})}:function(){return no({})},has:u?function(k,I){return i.call(k,I)}:function(k,I){return I in k},get:u?function(k,I){return i.call(k,I)?k[I]:void 0}:function(k,I){return k[I]}},g=Object.getPrototypeOf(Function),_=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:bh(),x=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:kh(),h=typeof WeakMap=="function"?WeakMap:xh(),m=r?Symbol.for("@reflect-metadata:registry"):void 0,b=yh(),S=vh(b);function O(k,I,z,P){if(M(z)){if(!el(k))throw new TypeError;if(!tl(I))throw new TypeError;return E(k,I)}else{if(!el(k))throw new TypeError;if(!de(I))throw new TypeError;if(!de(P)&&!M(P)&&!Se(P))throw new TypeError;return Se(P)&&(P=void 0),z=ut(z),A(k,I,z,P)}}e("decorate",O);function T(k,I){function z(P,Y){if(!de(P))throw new TypeError;if(!M(Y)&&!_h(Y))throw new TypeError;Z(k,I,P,Y)}return z}e("metadata",T);function q(k,I,z,P){if(!de(z))throw new TypeError;return M(P)||(P=ut(P)),Z(k,I,z,P)}e("defineMetadata",q);function oe(k,I,z){if(!de(I))throw new TypeError;return M(z)||(z=ut(z)),w(k,I,z)}e("hasMetadata",oe);function pe(k,I,z){if(!de(I))throw new TypeError;return M(z)||(z=ut(z)),v(k,I,z)}e("hasOwnMetadata",pe);function ce(k,I,z){if(!de(I))throw new TypeError;return M(z)||(z=ut(z)),C(k,I,z)}e("getMetadata",ce);function Re(k,I,z){if(!de(I))throw new TypeError;return M(z)||(z=ut(z)),R(k,I,z)}e("getOwnMetadata",Re);function nt(k,I){if(!de(k))throw new TypeError;return M(I)||(I=ut(I)),K(k,I)}e("getMetadataKeys",nt);function Fe(k,I){if(!de(k))throw new TypeError;return M(I)||(I=ut(I)),ee(k,I)}e("getOwnMetadataKeys",Fe);function $(k,I,z){if(!de(I))throw new TypeError;if(M(z)||(z=ut(z)),!de(I))throw new TypeError;M(z)||(z=ut(z));var P=ti(I,z,!1);return M(P)?!1:P.OrdinaryDeleteMetadata(k,I,z)}e("deleteMetadata",$);function E(k,I){for(var z=k.length-1;z>=0;--z){var P=k[z],Y=P(I);if(!M(Y)&&!Se(Y)){if(!tl(Y))throw new TypeError;I=Y}}return I}function A(k,I,z,P){for(var Y=k.length-1;Y>=0;--Y){var Ae=k[Y],ke=Ae(I,z,P);if(!M(ke)&&!Se(ke)){if(!de(ke))throw new TypeError;P=ke}}return P}function w(k,I,z){var P=v(k,I,z);if(P)return!0;var Y=to(I);return Se(Y)?!1:w(k,Y,z)}function v(k,I,z){var P=ti(I,z,!1);return M(P)?!1:Qc(P.OrdinaryHasOwnMetadata(k,I,z))}function C(k,I,z){var P=v(k,I,z);if(P)return R(k,I,z);var Y=to(I);if(!Se(Y))return C(k,Y,z)}function R(k,I,z){var P=ti(I,z,!1);if(!M(P))return P.OrdinaryGetOwnMetadata(k,I,z)}function Z(k,I,z,P){var Y=ti(z,P,!0);Y.OrdinaryDefineOwnMetadata(k,I,z,P)}function K(k,I){var z=ee(k,I),P=to(k);if(P===null)return z;var Y=K(P,I);if(Y.length<=0)return z;if(z.length<=0)return Y;for(var Ae=new x,ke=[],ne=0,V=z;ne<V.length;ne++){var F=V[ne],G=Ae.has(F);G||(Ae.add(F),ke.push(F))}for(var J=0,ie=Y;J<ie.length;J++){var F=ie[J],G=Ae.has(F);G||(Ae.add(F),ke.push(F))}return ke}function ee(k,I){var z=ti(k,I,!1);return z?z.OrdinaryOwnMetadataKeys(k,I):[]}function se(k){if(k===null)return 1;switch(typeof k){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return k===null?1:6;default:return 6}}function M(k){return k===void 0}function Se(k){return k===null}function Jt(k){return typeof k=="symbol"}function de(k){return typeof k=="object"?k!==null:typeof k=="function"}function we(k,I){switch(se(k)){case 0:return k;case 1:return k;case 2:return k;case 3:return k;case 4:return k;case 5:return k}var z="string",P=nl(k,s);if(P!==void 0){var Y=P.call(k,z);if(de(Y))throw new TypeError;return Y}return hh(k)}function hh(k,I){var z,P;{var Y=k.toString;if(Gi(Y)){var P=Y.call(k);if(!de(P))return P}var z=k.valueOf;if(Gi(z)){var P=z.call(k);if(!de(P))return P}}throw new TypeError}function Qc(k){return!!k}function gh(k){return""+k}function ut(k){var I=we(k);return Jt(I)?I:gh(I)}function el(k){return Array.isArray?Array.isArray(k):k instanceof Object?k instanceof Array:Object.prototype.toString.call(k)==="[object Array]"}function Gi(k){return typeof k=="function"}function tl(k){return typeof k=="function"}function _h(k){switch(se(k)){case 3:return!0;case 4:return!0;default:return!1}}function eo(k,I){return k===I||k!==k&&I!==I}function nl(k,I){var z=k[I];if(z!=null){if(!Gi(z))throw new TypeError;return z}}function il(k){var I=nl(k,o);if(!Gi(I))throw new TypeError;var z=I.call(k);if(!de(z))throw new TypeError;return z}function rl(k){return k.value}function sl(k){var I=k.next();return I.done?!1:I}function ol(k){var I=k.return;I&&I.call(k)}function to(k){var I=Object.getPrototypeOf(k);if(typeof k!="function"||k===g||I!==g)return I;var z=k.prototype,P=z&&Object.getPrototypeOf(z);if(P==null||P===Object.prototype)return I;var Y=P.constructor;return typeof Y!="function"||Y===k?I:Y}function mh(){var k;!M(m)&&typeof t.Reflect<"u"&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(k=wh(t.Reflect));var I,z,P,Y=new h,Ae={registerProvider:ke,getProvider:V,setProvider:G};return Ae;function ke(J){if(!Object.isExtensible(Ae))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case k===J:break;case M(I):I=J;break;case I===J:break;case M(z):z=J;break;case z===J:break;default:P===void 0&&(P=new x),P.add(J);break}}function ne(J,ie){if(!M(I)){if(I.isProviderFor(J,ie))return I;if(!M(z)){if(z.isProviderFor(J,ie))return I;if(!M(P))for(var fe=il(P);;){var me=sl(fe);if(!me)return;var it=rl(me);if(it.isProviderFor(J,ie))return ol(fe),it}}}if(!M(k)&&k.isProviderFor(J,ie))return k}function V(J,ie){var fe=Y.get(J),me;return M(fe)||(me=fe.get(ie)),M(me)&&(me=ne(J,ie),M(me)||(M(fe)&&(fe=new _,Y.set(J,fe)),fe.set(ie,me))),me}function F(J){if(M(J))throw new TypeError;return I===J||z===J||!M(P)&&P.has(J)}function G(J,ie,fe){if(!F(fe))throw new Error("Metadata provider not registered.");var me=V(J,ie);if(me!==fe){if(!M(me))return!1;var it=Y.get(J);M(it)&&(it=new _,Y.set(J,it)),it.set(ie,fe)}return!0}}function yh(){var k;return!M(m)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&(k=t.Reflect[m]),M(k)&&(k=mh()),!M(m)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:k}),k}function vh(k){var I=new h,z={isProviderFor:function(F,G){var J=I.get(F);return M(J)?!1:J.has(G)},OrdinaryDefineOwnMetadata:ke,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:Ae,OrdinaryOwnMetadataKeys:ne,OrdinaryDeleteMetadata:V};return b.registerProvider(z),z;function P(F,G,J){var ie=I.get(F),fe=!1;if(M(ie)){if(!J)return;ie=new _,I.set(F,ie),fe=!0}var me=ie.get(G);if(M(me)){if(!J)return;if(me=new _,ie.set(G,me),!k.setProvider(F,G,z))throw ie.delete(G),fe&&I.delete(F),new Error("Wrong provider for target.")}return me}function Y(F,G,J){var ie=P(G,J,!1);return M(ie)?!1:Qc(ie.has(F))}function Ae(F,G,J){var ie=P(G,J,!1);if(!M(ie))return ie.get(F)}function ke(F,G,J,ie){var fe=P(J,ie,!0);fe.set(F,G)}function ne(F,G){var J=[],ie=P(F,G,!1);if(M(ie))return J;for(var fe=ie.keys(),me=il(fe),it=0;;){var al=sl(me);if(!al)return J.length=it,J;var Sh=rl(al);try{J[it]=Sh}catch(Ah){try{ol(me)}finally{throw Ah}}it++}}function V(F,G,J){var ie=P(G,J,!1);if(M(ie)||!ie.delete(F))return!1;if(ie.size===0){var fe=I.get(G);M(fe)||(fe.delete(J),fe.size===0&&I.delete(fe))}return!0}}function wh(k){var I=k.defineMetadata,z=k.hasOwnMetadata,P=k.getOwnMetadata,Y=k.getOwnMetadataKeys,Ae=k.deleteMetadata,ke=new h,ne={isProviderFor:function(V,F){var G=ke.get(V);return!M(G)&&G.has(F)?!0:Y(V,F).length?(M(G)&&(G=new x,ke.set(V,G)),G.add(F),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:z,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:Y,OrdinaryDeleteMetadata:Ae};return ne}function ti(k,I,z){var P=b.getProvider(k,I);if(!M(P))return P;if(z){if(b.setProvider(k,I,S))return S;throw new Error("Illegal state.")}}function bh(){var k={},I=[],z=function(){function ne(V,F,G){this._index=0,this._keys=V,this._values=F,this._selector=G}return ne.prototype["@@iterator"]=function(){return this},ne.prototype[o]=function(){return this},ne.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var F=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:F,done:!1}}return{value:void 0,done:!0}},ne.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),V},ne.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:V,done:!0}},ne}(),P=function(){function ne(){this._keys=[],this._values=[],this._cacheKey=k,this._cacheIndex=-2}return Object.defineProperty(ne.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ne.prototype.has=function(V){return this._find(V,!1)>=0},ne.prototype.get=function(V){var F=this._find(V,!1);return F>=0?this._values[F]:void 0},ne.prototype.set=function(V,F){var G=this._find(V,!0);return this._values[G]=F,this},ne.prototype.delete=function(V){var F=this._find(V,!1);if(F>=0){for(var G=this._keys.length,J=F+1;J<G;J++)this._keys[J-1]=this._keys[J],this._values[J-1]=this._values[J];return this._keys.length--,this._values.length--,eo(V,this._cacheKey)&&(this._cacheKey=k,this._cacheIndex=-2),!0}return!1},ne.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=k,this._cacheIndex=-2},ne.prototype.keys=function(){return new z(this._keys,this._values,Y)},ne.prototype.values=function(){return new z(this._keys,this._values,Ae)},ne.prototype.entries=function(){return new z(this._keys,this._values,ke)},ne.prototype["@@iterator"]=function(){return this.entries()},ne.prototype[o]=function(){return this.entries()},ne.prototype._find=function(V,F){if(!eo(this._cacheKey,V)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(eo(this._keys[G],V)){this._cacheIndex=G;break}}return this._cacheIndex<0&&F&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},ne}();return P;function Y(ne,V){return ne}function Ae(ne,V){return V}function ke(ne,V){return[ne,V]}}function kh(){var k=function(){function I(){this._map=new _}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(z){return this._map.has(z)},I.prototype.add=function(z){return this._map.set(z,z),this},I.prototype.delete=function(z){return this._map.delete(z)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[o]=function(){return this.keys()},I}();return k}function xh(){var k=16,I=p.create(),z=P();return function(){function V(){this._key=P()}return V.prototype.has=function(F){var G=Y(F,!1);return G!==void 0?p.has(G,this._key):!1},V.prototype.get=function(F){var G=Y(F,!1);return G!==void 0?p.get(G,this._key):void 0},V.prototype.set=function(F,G){var J=Y(F,!0);return J[this._key]=G,this},V.prototype.delete=function(F){var G=Y(F,!1);return G!==void 0?delete G[this._key]:!1},V.prototype.clear=function(){this._key=P()},V}();function P(){var V;do V="@@WeakMap@@"+ne();while(p.has(I,V));return I[V]=!0,V}function Y(V,F){if(!i.call(V,z)){if(!F)return;Object.defineProperty(V,z,{value:p.create()})}return V[z]}function Ae(V,F){for(var G=0;G<F;++G)V[G]=Math.random()*255|0;return V}function ke(V){if(typeof Uint8Array=="function"){var F=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(F):typeof msCrypto<"u"?msCrypto.getRandomValues(F):Ae(F,V),F}return Ae(new Array(V),V)}function ne(){var V=ke(k);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var F="",G=0;G<k;++G){var J=V[G];(G===4||G===6||G===8)&&(F+="-"),J<16&&(F+="0"),F+=J.toString(16).toLowerCase()}return F}}function no(k){return k.__=void 0,delete k.__,k}})})(kl||(kl={}));/*!
18
+ ***************************************************************************** */var kl;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof vr=="object"?vr:typeof self=="object"?self:typeof this=="object"?this:c(),i=r(n);typeof t.Reflect<"u"&&(i=r(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=n);function r(l,u){return function(p,g){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:g}),u&&u(p,g)}}function s(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return s()||a()}})(function(e,t){var i=Object.prototype.hasOwnProperty,r=typeof Symbol=="function",s=r&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=r&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return io(Object.create(null))}:l?function(){return io({__proto__:null})}:function(){return io({})},has:u?function(k,I){return i.call(k,I)}:function(k,I){return I in k},get:u?function(k,I){return i.call(k,I)?k[I]:void 0}:function(k,I){return k[I]}},g=Object.getPrototypeOf(Function),_=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:bh(),x=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:kh(),h=typeof WeakMap=="function"?WeakMap:xh(),m=r?Symbol.for("@reflect-metadata:registry"):void 0,b=yh(),S=vh(b);function O(k,I,C,P){if(M(C)){if(!el(k))throw new TypeError;if(!tl(I))throw new TypeError;return E(k,I)}else{if(!el(k))throw new TypeError;if(!de(I))throw new TypeError;if(!de(P)&&!M(P)&&!Se(P))throw new TypeError;return Se(P)&&(P=void 0),C=dt(C),A(k,I,C,P)}}e("decorate",O);function T(k,I){function C(P,Y){if(!de(P))throw new TypeError;if(!M(Y)&&!_h(Y))throw new TypeError;Z(k,I,P,Y)}return C}e("metadata",T);function F(k,I,C,P){if(!de(C))throw new TypeError;return M(P)||(P=dt(P)),Z(k,I,C,P)}e("defineMetadata",F);function oe(k,I,C){if(!de(I))throw new TypeError;return M(C)||(C=dt(C)),w(k,I,C)}e("hasMetadata",oe);function pe(k,I,C){if(!de(I))throw new TypeError;return M(C)||(C=dt(C)),v(k,I,C)}e("hasOwnMetadata",pe);function ce(k,I,C){if(!de(I))throw new TypeError;return M(C)||(C=dt(C)),$(k,I,C)}e("getMetadata",ce);function Pe(k,I,C){if(!de(I))throw new TypeError;return M(C)||(C=dt(C)),R(k,I,C)}e("getOwnMetadata",Pe);function it(k,I){if(!de(k))throw new TypeError;return M(I)||(I=dt(I)),K(k,I)}e("getMetadataKeys",it);function Fe(k,I){if(!de(k))throw new TypeError;return M(I)||(I=dt(I)),ee(k,I)}e("getOwnMetadataKeys",Fe);function z(k,I,C){if(!de(I))throw new TypeError;if(M(C)||(C=dt(C)),!de(I))throw new TypeError;M(C)||(C=dt(C));var P=ti(I,C,!1);return M(P)?!1:P.OrdinaryDeleteMetadata(k,I,C)}e("deleteMetadata",z);function E(k,I){for(var C=k.length-1;C>=0;--C){var P=k[C],Y=P(I);if(!M(Y)&&!Se(Y)){if(!tl(Y))throw new TypeError;I=Y}}return I}function A(k,I,C,P){for(var Y=k.length-1;Y>=0;--Y){var Ae=k[Y],ke=Ae(I,C,P);if(!M(ke)&&!Se(ke)){if(!de(ke))throw new TypeError;P=ke}}return P}function w(k,I,C){var P=v(k,I,C);if(P)return!0;var Y=no(I);return Se(Y)?!1:w(k,Y,C)}function v(k,I,C){var P=ti(I,C,!1);return M(P)?!1:Qc(P.OrdinaryHasOwnMetadata(k,I,C))}function $(k,I,C){var P=v(k,I,C);if(P)return R(k,I,C);var Y=no(I);if(!Se(Y))return $(k,Y,C)}function R(k,I,C){var P=ti(I,C,!1);if(!M(P))return P.OrdinaryGetOwnMetadata(k,I,C)}function Z(k,I,C,P){var Y=ti(C,P,!0);Y.OrdinaryDefineOwnMetadata(k,I,C,P)}function K(k,I){var C=ee(k,I),P=no(k);if(P===null)return C;var Y=K(P,I);if(Y.length<=0)return C;if(C.length<=0)return Y;for(var Ae=new x,ke=[],ne=0,V=C;ne<V.length;ne++){var q=V[ne],G=Ae.has(q);G||(Ae.add(q),ke.push(q))}for(var J=0,ie=Y;J<ie.length;J++){var q=ie[J],G=Ae.has(q);G||(Ae.add(q),ke.push(q))}return ke}function ee(k,I){var C=ti(k,I,!1);return C?C.OrdinaryOwnMetadataKeys(k,I):[]}function se(k){if(k===null)return 1;switch(typeof k){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return k===null?1:6;default:return 6}}function M(k){return k===void 0}function Se(k){return k===null}function Jt(k){return typeof k=="symbol"}function de(k){return typeof k=="object"?k!==null:typeof k=="function"}function we(k,I){switch(se(k)){case 0:return k;case 1:return k;case 2:return k;case 3:return k;case 4:return k;case 5:return k}var C="string",P=nl(k,s);if(P!==void 0){var Y=P.call(k,C);if(de(Y))throw new TypeError;return Y}return hh(k)}function hh(k,I){var C,P;{var Y=k.toString;if(Gi(Y)){var P=Y.call(k);if(!de(P))return P}var C=k.valueOf;if(Gi(C)){var P=C.call(k);if(!de(P))return P}}throw new TypeError}function Qc(k){return!!k}function gh(k){return""+k}function dt(k){var I=we(k);return Jt(I)?I:gh(I)}function el(k){return Array.isArray?Array.isArray(k):k instanceof Object?k instanceof Array:Object.prototype.toString.call(k)==="[object Array]"}function Gi(k){return typeof k=="function"}function tl(k){return typeof k=="function"}function _h(k){switch(se(k)){case 3:return!0;case 4:return!0;default:return!1}}function to(k,I){return k===I||k!==k&&I!==I}function nl(k,I){var C=k[I];if(C!=null){if(!Gi(C))throw new TypeError;return C}}function il(k){var I=nl(k,a);if(!Gi(I))throw new TypeError;var C=I.call(k);if(!de(C))throw new TypeError;return C}function rl(k){return k.value}function sl(k){var I=k.next();return I.done?!1:I}function ol(k){var I=k.return;I&&I.call(k)}function no(k){var I=Object.getPrototypeOf(k);if(typeof k!="function"||k===g||I!==g)return I;var C=k.prototype,P=C&&Object.getPrototypeOf(C);if(P==null||P===Object.prototype)return I;var Y=P.constructor;return typeof Y!="function"||Y===k?I:Y}function mh(){var k;!M(m)&&typeof t.Reflect<"u"&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(k=wh(t.Reflect));var I,C,P,Y=new h,Ae={registerProvider:ke,getProvider:V,setProvider:G};return Ae;function ke(J){if(!Object.isExtensible(Ae))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case k===J:break;case M(I):I=J;break;case I===J:break;case M(C):C=J;break;case C===J:break;default:P===void 0&&(P=new x),P.add(J);break}}function ne(J,ie){if(!M(I)){if(I.isProviderFor(J,ie))return I;if(!M(C)){if(C.isProviderFor(J,ie))return I;if(!M(P))for(var fe=il(P);;){var me=sl(fe);if(!me)return;var rt=rl(me);if(rt.isProviderFor(J,ie))return ol(fe),rt}}}if(!M(k)&&k.isProviderFor(J,ie))return k}function V(J,ie){var fe=Y.get(J),me;return M(fe)||(me=fe.get(ie)),M(me)&&(me=ne(J,ie),M(me)||(M(fe)&&(fe=new _,Y.set(J,fe)),fe.set(ie,me))),me}function q(J){if(M(J))throw new TypeError;return I===J||C===J||!M(P)&&P.has(J)}function G(J,ie,fe){if(!q(fe))throw new Error("Metadata provider not registered.");var me=V(J,ie);if(me!==fe){if(!M(me))return!1;var rt=Y.get(J);M(rt)&&(rt=new _,Y.set(J,rt)),rt.set(ie,fe)}return!0}}function yh(){var k;return!M(m)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&(k=t.Reflect[m]),M(k)&&(k=mh()),!M(m)&&de(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:k}),k}function vh(k){var I=new h,C={isProviderFor:function(q,G){var J=I.get(q);return M(J)?!1:J.has(G)},OrdinaryDefineOwnMetadata:ke,OrdinaryHasOwnMetadata:Y,OrdinaryGetOwnMetadata:Ae,OrdinaryOwnMetadataKeys:ne,OrdinaryDeleteMetadata:V};return b.registerProvider(C),C;function P(q,G,J){var ie=I.get(q),fe=!1;if(M(ie)){if(!J)return;ie=new _,I.set(q,ie),fe=!0}var me=ie.get(G);if(M(me)){if(!J)return;if(me=new _,ie.set(G,me),!k.setProvider(q,G,C))throw ie.delete(G),fe&&I.delete(q),new Error("Wrong provider for target.")}return me}function Y(q,G,J){var ie=P(G,J,!1);return M(ie)?!1:Qc(ie.has(q))}function Ae(q,G,J){var ie=P(G,J,!1);if(!M(ie))return ie.get(q)}function ke(q,G,J,ie){var fe=P(J,ie,!0);fe.set(q,G)}function ne(q,G){var J=[],ie=P(q,G,!1);if(M(ie))return J;for(var fe=ie.keys(),me=il(fe),rt=0;;){var al=sl(me);if(!al)return J.length=rt,J;var Sh=rl(al);try{J[rt]=Sh}catch(Ah){try{ol(me)}finally{throw Ah}}rt++}}function V(q,G,J){var ie=P(G,J,!1);if(M(ie)||!ie.delete(q))return!1;if(ie.size===0){var fe=I.get(G);M(fe)||(fe.delete(J),fe.size===0&&I.delete(fe))}return!0}}function wh(k){var I=k.defineMetadata,C=k.hasOwnMetadata,P=k.getOwnMetadata,Y=k.getOwnMetadataKeys,Ae=k.deleteMetadata,ke=new h,ne={isProviderFor:function(V,q){var G=ke.get(V);return!M(G)&&G.has(q)?!0:Y(V,q).length?(M(G)&&(G=new x,ke.set(V,G)),G.add(q),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:C,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:Y,OrdinaryDeleteMetadata:Ae};return ne}function ti(k,I,C){var P=b.getProvider(k,I);if(!M(P))return P;if(C){if(b.setProvider(k,I,S))return S;throw new Error("Illegal state.")}}function bh(){var k={},I=[],C=function(){function ne(V,q,G){this._index=0,this._keys=V,this._values=q,this._selector=G}return ne.prototype["@@iterator"]=function(){return this},ne.prototype[a]=function(){return this},ne.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var q=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},ne.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),V},ne.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:V,done:!0}},ne}(),P=function(){function ne(){this._keys=[],this._values=[],this._cacheKey=k,this._cacheIndex=-2}return Object.defineProperty(ne.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),ne.prototype.has=function(V){return this._find(V,!1)>=0},ne.prototype.get=function(V){var q=this._find(V,!1);return q>=0?this._values[q]:void 0},ne.prototype.set=function(V,q){var G=this._find(V,!0);return this._values[G]=q,this},ne.prototype.delete=function(V){var q=this._find(V,!1);if(q>=0){for(var G=this._keys.length,J=q+1;J<G;J++)this._keys[J-1]=this._keys[J],this._values[J-1]=this._values[J];return this._keys.length--,this._values.length--,to(V,this._cacheKey)&&(this._cacheKey=k,this._cacheIndex=-2),!0}return!1},ne.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=k,this._cacheIndex=-2},ne.prototype.keys=function(){return new C(this._keys,this._values,Y)},ne.prototype.values=function(){return new C(this._keys,this._values,Ae)},ne.prototype.entries=function(){return new C(this._keys,this._values,ke)},ne.prototype["@@iterator"]=function(){return this.entries()},ne.prototype[a]=function(){return this.entries()},ne.prototype._find=function(V,q){if(!to(this._cacheKey,V)){this._cacheIndex=-1;for(var G=0;G<this._keys.length;G++)if(to(this._keys[G],V)){this._cacheIndex=G;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},ne}();return P;function Y(ne,V){return ne}function Ae(ne,V){return V}function ke(ne,V){return[ne,V]}}function kh(){var k=function(){function I(){this._map=new _}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(C){return this._map.has(C)},I.prototype.add=function(C){return this._map.set(C,C),this},I.prototype.delete=function(C){return this._map.delete(C)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[a]=function(){return this.keys()},I}();return k}function xh(){var k=16,I=p.create(),C=P();return function(){function V(){this._key=P()}return V.prototype.has=function(q){var G=Y(q,!1);return G!==void 0?p.has(G,this._key):!1},V.prototype.get=function(q){var G=Y(q,!1);return G!==void 0?p.get(G,this._key):void 0},V.prototype.set=function(q,G){var J=Y(q,!0);return J[this._key]=G,this},V.prototype.delete=function(q){var G=Y(q,!1);return G!==void 0?delete G[this._key]:!1},V.prototype.clear=function(){this._key=P()},V}();function P(){var V;do V="@@WeakMap@@"+ne();while(p.has(I,V));return I[V]=!0,V}function Y(V,q){if(!i.call(V,C)){if(!q)return;Object.defineProperty(V,C,{value:p.create()})}return V[C]}function Ae(V,q){for(var G=0;G<q;++G)V[G]=Math.random()*255|0;return V}function ke(V){if(typeof Uint8Array=="function"){var q=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):Ae(q,V),q}return Ae(new Array(V),V)}function ne(){var V=ke(k);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var q="",G=0;G<k;++G){var J=V[G];(G===4||G===6||G===8)&&(q+="-"),J<16&&(q+="0"),q+=J.toString(16).toLowerCase()}return q}}function io(k){return k.__=void 0,delete k.__,k}})})(kl||(kl={}));/*!
19
19
  * MIT License
20
20
  *
21
21
  * Copyright (c) 2017-2022 Peculiar Ventures, LLC
@@ -38,9 +38,9 @@ and limitations under the License.
38
38
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
39
  * SOFTWARE.
40
40
  *
41
- */const xg="[object ArrayBuffer]";class U{static isArrayBuffer(e){return Object.prototype.toString.call(e)===xg}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const i=U.toUint8Array(e),r=U.toUint8Array(t);if(i.length!==r.byteLength)return!1;for(let s=0;s<i.length;s++)if(i[s]!==r[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let i=0;for(const o of t)i+=o.byteLength;const r=new Uint8Array(i);let s=0;for(const o of t){const c=this.toUint8Array(o);r.set(c,s),s+=c.length}return e[e.length-1]instanceof Function?this.toView(r,e[e.length-1]):r.buffer}}const ro="string",Sg=/^[0-9a-f]+$/i,Ag=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ig=/^[a-zA-Z0-9-_]+$/;class xl{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i.buffer}static toString(e){const t=U.toUint8Array(e);let i="";for(let s=0;s<t.length;s++)i+=String.fromCharCode(t[s]);return decodeURIComponent(escape(i))}}class dt{static toString(e,t=!1){const i=U.toArrayBuffer(e),r=new DataView(i);let s="";for(let o=0;o<i.byteLength;o+=2){const c=r.getUint16(o,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),r=new DataView(i);for(let s=0;s<e.length;s++)r.setUint16(s*2,e.charCodeAt(s),t);return i}}class W{static isHex(e){return typeof e===ro&&Sg.test(e)}static isBase64(e){return typeof e===ro&&Ag.test(e)}static isBase64Url(e){return typeof e===ro&&Ig.test(e)}static ToString(e,t="utf8"){const i=U.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return dt.toString(i,!0);case"utf16":case"utf16be":return dt.toString(i);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return dt.fromString(e,!0);case"utf16":case"utf16be":return dt.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=U.toUint8Array(e);if(typeof btoa<"u"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return xl.fromString(e);case"utf16":case"utf16be":return dt.fromString(e);case"utf16le":case"usc2":return dt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return xl.toString(e);case"utf16":case"utf16be":return dt.toString(e);case"utf16le":case"usc2":return dt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);return i.buffer}static ToBinary(e){const t=U.toUint8Array(e);let i="";for(let r=0;r<t.length;r++)i+=String.fromCharCode(t[r]);return i}static ToHex(e){const t=U.toUint8Array(e);let i="";const r=t.length;for(let s=0;s<r;s++){const o=t[s];o<16&&(i+="0"),i+=o.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let r=0;r<t.length;r=r+2){const s=t.slice(r,r+2);i[r/2]=parseInt(s,16)}return i.buffer}static ToUtf16String(e,t=!1){return dt.toString(e,t)}static FromUtf16String(e,t=!1){return dt.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}W.DEFAULT_UTF8_ENCODING="utf8";function Eg(...n){const e=n.map(r=>r.byteLength).reduce((r,s)=>r+s),t=new Uint8Array(e);let i=0;return n.map(r=>new Uint8Array(r)).forEach(r=>{for(const s of r)t[i++]=s}),t.buffer}function Kd(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}/*!
41
+ */const Sg="[object ArrayBuffer]";class U{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Sg}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const i=U.toUint8Array(e),r=U.toUint8Array(t);if(i.length!==r.byteLength)return!1;for(let s=0;s<i.length;s++)if(i[s]!==r[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let i=0;for(const a of t)i+=a.byteLength;const r=new Uint8Array(i);let s=0;for(const a of t){const c=this.toUint8Array(a);r.set(c,s),s+=c.length}return e[e.length-1]instanceof Function?this.toView(r,e[e.length-1]):r.buffer}}const so="string",Ag=/^[0-9a-f]+$/i,Ig=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Eg=/^[a-zA-Z0-9-_]+$/;class xl{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i.buffer}static toString(e){const t=U.toUint8Array(e);let i="";for(let s=0;s<t.length;s++)i+=String.fromCharCode(t[s]);return decodeURIComponent(escape(i))}}class pt{static toString(e,t=!1){const i=U.toArrayBuffer(e),r=new DataView(i);let s="";for(let a=0;a<i.byteLength;a+=2){const c=r.getUint16(a,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),r=new DataView(i);for(let s=0;s<e.length;s++)r.setUint16(s*2,e.charCodeAt(s),t);return i}}class W{static isHex(e){return typeof e===so&&Ag.test(e)}static isBase64(e){return typeof e===so&&Ig.test(e)}static isBase64Url(e){return typeof e===so&&Eg.test(e)}static ToString(e,t="utf8"){const i=U.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return pt.toString(i,!0);case"utf16":case"utf16be":return pt.toString(i);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return pt.fromString(e,!0);case"utf16":case"utf16be":return pt.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=U.toUint8Array(e);if(typeof btoa<"u"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return xl.fromString(e);case"utf16":case"utf16be":return pt.fromString(e);case"utf16le":case"usc2":return pt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=W.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return xl.toString(e);case"utf16":case"utf16be":return pt.toString(e);case"utf16le":case"usc2":return pt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);return i.buffer}static ToBinary(e){const t=U.toUint8Array(e);let i="";for(let r=0;r<t.length;r++)i+=String.fromCharCode(t[r]);return i}static ToHex(e){const t=U.toUint8Array(e);let i="";const r=t.length;for(let s=0;s<r;s++){const a=t[s];a<16&&(i+="0"),i+=a.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!W.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let r=0;r<t.length;r=r+2){const s=t.slice(r,r+2);i[r/2]=parseInt(s,16)}return i.buffer}static ToUtf16String(e,t=!1){return pt.toString(e,t)}static FromUtf16String(e,t=!1){return pt.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}W.DEFAULT_UTF8_ENCODING="utf8";function zg(...n){const e=n.map(r=>r.byteLength).reduce((r,s)=>r+s),t=new Uint8Array(e);let i=0;return n.map(r=>new Uint8Array(r)).forEach(r=>{for(const s of r)t[i++]=s}),t.buffer}function Kd(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}/*!
42
42
  Copyright (c) Peculiar Ventures, LLC
43
- */function jn(n,e){let t=0;if(n.length===1)return n[0];for(let i=n.length-1;i>=0;i--)t+=n[n.length-1-i]*Math.pow(2,e*i);return t}function an(n,e,t=-1){const i=t;let r=n,s=0,o=Math.pow(2,e);for(let c=1;c<8;c++){if(n<o){let l;if(i<0)l=new ArrayBuffer(c),s=c;else{if(i<c)return new ArrayBuffer(0);l=new ArrayBuffer(i),s=i}const u=new Uint8Array(l);for(let p=c-1;p>=0;p--){const g=Math.pow(2,p*e);u[s-p-1]=Math.floor(r/g),r-=u[s-p-1]*g}return l}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function xo(...n){let e=0,t=0;for(const s of n)e+=s.length;const i=new ArrayBuffer(e),r=new Uint8Array(i);for(const s of n)r.set(s,t),t+=s.length;return r}function Wd(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=n[0]===255&&n[1]&128,l=n[0]===0&&(n[1]&128)===0;(c||l)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=n[0]&128;const i=jn(t,8),r=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(r);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=n[c];return s[0]&=127,jn(s,8)-i}function $g(n){const e=n<0?n*-1:n;let t=128;for(let i=1;i<8;i++){if(e<=t){if(n<0){const o=t-e,c=an(o,8,i),l=new Uint8Array(c);return l[0]|=128,c}let r=an(e,8,i),s=new Uint8Array(r);if(s[0]&128){const o=r.slice(0),c=new Uint8Array(o);r=new ArrayBuffer(r.byteLength+1),s=new Uint8Array(r);for(let l=0;l<o.byteLength;l++)s[l+1]=c[l];s[0]=0}return r}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function Cg(n,e){if(n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}function qe(n,e){const t=n.toString(10);if(e<t.length)return"";const i=e-t.length,r=new Array(i);for(let o=0;o<i;o++)r[o]="0";return r.join("").concat(t)}/*!
43
+ */function jn(n,e){let t=0;if(n.length===1)return n[0];for(let i=n.length-1;i>=0;i--)t+=n[n.length-1-i]*Math.pow(2,e*i);return t}function an(n,e,t=-1){const i=t;let r=n,s=0,a=Math.pow(2,e);for(let c=1;c<8;c++){if(n<a){let l;if(i<0)l=new ArrayBuffer(c),s=c;else{if(i<c)return new ArrayBuffer(0);l=new ArrayBuffer(i),s=i}const u=new Uint8Array(l);for(let p=c-1;p>=0;p--){const g=Math.pow(2,p*e);u[s-p-1]=Math.floor(r/g),r-=u[s-p-1]*g}return l}a*=Math.pow(2,e)}return new ArrayBuffer(0)}function So(...n){let e=0,t=0;for(const s of n)e+=s.length;const i=new ArrayBuffer(e),r=new Uint8Array(i);for(const s of n)r.set(s,t),t+=s.length;return r}function Wd(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=n[0]===255&&n[1]&128,l=n[0]===0&&(n[1]&128)===0;(c||l)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=n[0]&128;const i=jn(t,8),r=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(r);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=n[c];return s[0]&=127,jn(s,8)-i}function $g(n){const e=n<0?n*-1:n;let t=128;for(let i=1;i<8;i++){if(e<=t){if(n<0){const a=t-e,c=an(a,8,i),l=new Uint8Array(c);return l[0]|=128,c}let r=an(e,8,i),s=new Uint8Array(r);if(s[0]&128){const a=r.slice(0),c=new Uint8Array(a);r=new ArrayBuffer(r.byteLength+1),s=new Uint8Array(r);for(let l=0;l<a.byteLength;l++)s[l+1]=c[l];s[0]=0}return r}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function Cg(n,e){if(n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}function Ke(n,e){const t=n.toString(10);if(e<t.length)return"";const i=e-t.length,r=new Array(i);for(let a=0;a<i;a++)r[a]="0";return r.join("").concat(t)}/*!
44
44
  * Copyright (c) 2014, GMO GlobalSign
45
45
  * Copyright (c) 2015-2022, Peculiar Ventures
46
46
  * All rights reserved.
@@ -72,11 +72,11 @@ and limitations under the License.
72
72
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
73
73
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74
74
  *
75
- */function wr(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Xa(n){let e=0,t=0;for(let r=0;r<n.length;r++){const s=n[r];e+=s.byteLength}const i=new Uint8Array(e);for(let r=0;r<n.length;r++){const s=n[r];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function jt(n,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(n.error="Wrong parameter: inputOffset less than zero",!1):i<0?(n.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class as{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Xa(this.items)}}const ii=[new Uint8Array([1])],Sl="0123456789",so="name",Al="valueHexView",zg="isHexOnly",jg="idBlock",Ng="tagClass",Og="tagNumber",Bg="isConstructed",Tg="fromBER",Rg="toBER",Pg="local",Le="",ct=new ArrayBuffer(0),cs=new Uint8Array(0),_i="EndOfContent",Gd="OCTET STRING",Jd="BIT STRING";function vt(n){var e;return e=class extends n{constructor(...i){var r;super(...i);const s=i[0]||{};this.isHexOnly=(r=s.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=s.valueHex?U.toUint8Array(s.valueHex):cs}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,r,s){const o=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!jt(this,o,r,s))return-1;const c=r+s;return this.valueHexView=o.subarray(r,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),r)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",ct)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:W.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class vn{constructor({blockLength:e=0,error:t=Le,warnings:i=[],valueBeforeDecode:r=cs}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=U.toUint8Array(r)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:W.ToHex(this.valueBeforeDecodeView)}}}vn.NAME="baseBlock";class Te extends vn{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Te.NAME="valueBlock";class Zd extends vt(vn){constructor({idBlock:e={}}={}){var t,i,r,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?U.toUint8Array(e.valueHex):cs,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(r=e.tagNumber)!==null&&r!==void 0?r:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",ct}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const r=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,r[0]=t}return r.buffer}if(!this.isHexOnly){const r=an(this.tagNumber,7),s=new Uint8Array(r),o=r.byteLength,c=new Uint8Array(o+1);if(c[0]=t|31,!e){for(let l=0;l<o-1;l++)c[l+1]=s[l]|128;c[o]=s[o-1]}return c.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const r=this.valueHexView;for(let s=0;s<r.length-1;s++)i[s+1]=r[s]|128;i[this.valueHexView.byteLength]=r[r.length-1]}return i.buffer}fromBER(e,t,i){const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;const c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=1,u=this.valueHexView=new Uint8Array(255),p=255;for(;s[l]&128;){if(u[l-1]=s[l]&127,l++,l>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(l===p){p+=255;const _=new Uint8Array(p);for(let x=0;x<u.length;x++)_[x]=u[x];u=this.valueHexView=new Uint8Array(p)}}this.blockLength=l+1,u[l-1]=s[l]&127;const g=new Uint8Array(l);for(let _=0;_<l;_++)g[_]=u[_];u=this.valueHexView=new Uint8Array(l),u.set(g),this.blockLength<=9?this.tagNumber=jn(u,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}Zd.NAME="identificationBlock";class Yd extends vn{constructor({lenBlock:e={}}={}){var t,i,r;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(r=e.length)!==null&&r!==void 0?r:0}fromBER(e,t,i){const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const o=s[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const c=t+1,l=r.subarray(c,c+o);return l[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=jn(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const r=an(this.length,8);if(r.byteLength>127)return this.error="Too big length",ct;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const s=new Uint8Array(r);i=new Uint8Array(t),i[0]=r.byteLength|128;for(let o=0;o<r.byteLength;o++)i[o+1]=s[o];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}Yd.NAME="lengthBlock";const D={};class $e extends vn{constructor({name:e=Le,optional:t=!1,primitiveSchema:i,...r}={},s){super(r),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new Zd(r),this.lenBlock=new Yd(r),this.valueBlock=s?new s(r):new Te(r)}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(e,t){const i=t||new as;t||Xd(this);const r=this.idBlock.toBER(e);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const o=this.lenBlock.toBER(e);i.write(o),i.write(s)}return t?ct:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():W.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${W.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return Cg(t,i)}}$e.NAME="BaseBlock";function Xd(n){if(n instanceof D.Constructed)for(const e of n.valueBlock.value)Xd(e)&&(n.lenBlock.isIndefiniteForm=!0);return!!n.lenBlock.isIndefiniteForm}class Qa extends $e{constructor({value:e=Le,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Qa.NAME="BaseStringBlock";class Qd extends vt(Te){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Qd.NAME="PrimitiveValueBlock";var ep;class zi extends $e{constructor(e={}){super(e,Qd),this.idBlock.isConstructed=!1}}ep=zi;D.Primitive=ep;zi.NAME="PRIMITIVE";function Lg(n,e){if(n instanceof e)return n;const t=new e;return t.idBlock=n.idBlock,t.lenBlock=n.lenBlock,t.warnings=n.warnings,t.valueBeforeDecodeView=n.valueBeforeDecodeView,t}function Fn(n,e=0,t=n.length){const i=e;let r=new $e({},Te);const s=new vn;if(!jt(s,n,e,t))return r.error=s.error,{offset:-1,result:r};if(!n.subarray(e,e+t).length)return r.error="Zero buffer length",{offset:-1,result:r};let c=r.idBlock.fromBER(n,e,t);if(r.idBlock.warnings.length&&r.warnings.concat(r.idBlock.warnings),c===-1)return r.error=r.idBlock.error,{offset:-1,result:r};if(e=c,t-=r.idBlock.blockLength,c=r.lenBlock.fromBER(n,e,t),r.lenBlock.warnings.length&&r.warnings.concat(r.lenBlock.warnings),c===-1)return r.error=r.lenBlock.error,{offset:-1,result:r};if(e=c,t-=r.lenBlock.blockLength,!r.idBlock.isConstructed&&r.lenBlock.isIndefiniteForm)return r.error="Indefinite length form used for primitive encoding form",{offset:-1,result:r};let l=$e;switch(r.idBlock.tagClass){case 1:if(r.idBlock.tagNumber>=37&&r.idBlock.isHexOnly===!1)return r.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:r};switch(r.idBlock.tagNumber){case 0:if(r.idBlock.isConstructed&&r.lenBlock.length>0)return r.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:r};l=D.EndOfContent;break;case 1:l=D.Boolean;break;case 2:l=D.Integer;break;case 3:l=D.BitString;break;case 4:l=D.OctetString;break;case 5:l=D.Null;break;case 6:l=D.ObjectIdentifier;break;case 10:l=D.Enumerated;break;case 12:l=D.Utf8String;break;case 13:l=D.RelativeObjectIdentifier;break;case 14:l=D.TIME;break;case 15:return r.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:r};case 16:l=D.Sequence;break;case 17:l=D.Set;break;case 18:l=D.NumericString;break;case 19:l=D.PrintableString;break;case 20:l=D.TeletexString;break;case 21:l=D.VideotexString;break;case 22:l=D.IA5String;break;case 23:l=D.UTCTime;break;case 24:l=D.GeneralizedTime;break;case 25:l=D.GraphicString;break;case 26:l=D.VisibleString;break;case 27:l=D.GeneralString;break;case 28:l=D.UniversalString;break;case 29:l=D.CharacterString;break;case 30:l=D.BmpString;break;case 31:l=D.DATE;break;case 32:l=D.TimeOfDay;break;case 33:l=D.DateTime;break;case 34:l=D.Duration;break;default:{const u=r.idBlock.isConstructed?new D.Constructed:new D.Primitive;u.idBlock=r.idBlock,u.lenBlock=r.lenBlock,u.warnings=r.warnings,r=u}}break;case 2:case 3:case 4:default:l=r.idBlock.isConstructed?D.Constructed:D.Primitive}return r=Lg(r,l),c=r.fromBER(n,e,r.lenBlock.isIndefiniteForm?t:r.lenBlock.length),r.valueBeforeDecodeView=n.subarray(i,i+r.blockLength),{offset:c,result:r}}function $n(n){if(!n.byteLength){const e=new $e({},Te);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Fn(U.toUint8Array(n).slice(),0,n.byteLength)}function Ug(n,e){return n?1:e}class Pt extends Te{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Ug(this.isIndefiniteForm,i)>0;){const o=Fn(r,s,i);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(s=o.offset,this.blockLength+=o.result.blockLength,i-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===_i)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===_i?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new as;for(let r=0;r<this.value.length;r++)this.value[r].toBER(e,i);return t?ct:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}Pt.NAME="ConstructedValueBlock";var tp;class Ue extends $e{constructor(e={}){super(e,Pt),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
75
+ */function wr(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Xa(n){let e=0,t=0;for(let r=0;r<n.length;r++){const s=n[r];e+=s.byteLength}const i=new Uint8Array(e);for(let r=0;r<n.length;r++){const s=n[r];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function jt(n,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(n.error="Wrong parameter: inputOffset less than zero",!1):i<0?(n.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class cs{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Xa(this.items)}}const ii=[new Uint8Array([1])],Sl="0123456789",oo="name",Al="valueHexView",jg="isHexOnly",Ng="idBlock",Og="tagClass",Bg="tagNumber",Tg="isConstructed",Rg="fromBER",Pg="toBER",Lg="local",Ue="",lt=new ArrayBuffer(0),ls=new Uint8Array(0),_i="EndOfContent",Gd="OCTET STRING",Jd="BIT STRING";function wt(n){var e;return e=class extends n{constructor(...i){var r;super(...i);const s=i[0]||{};this.isHexOnly=(r=s.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=s.valueHex?U.toUint8Array(s.valueHex):ls}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,r,s){const a=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!jt(this,a,r,s))return-1;const c=r+s;return this.valueHexView=a.subarray(r,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),r)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",lt)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:W.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class vn{constructor({blockLength:e=0,error:t=Ue,warnings:i=[],valueBeforeDecode:r=ls}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=U.toUint8Array(r)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:W.ToHex(this.valueBeforeDecodeView)}}}vn.NAME="baseBlock";class Re extends vn{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Re.NAME="valueBlock";class Zd extends wt(vn){constructor({idBlock:e={}}={}){var t,i,r,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?U.toUint8Array(e.valueHex):ls,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(r=e.tagNumber)!==null&&r!==void 0?r:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",lt}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const r=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,r[0]=t}return r.buffer}if(!this.isHexOnly){const r=an(this.tagNumber,7),s=new Uint8Array(r),a=r.byteLength,c=new Uint8Array(a+1);if(c[0]=t|31,!e){for(let l=0;l<a-1;l++)c[l+1]=s[l]|128;c[a]=s[a-1]}return c.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const r=this.valueHexView;for(let s=0;s<r.length-1;s++)i[s+1]=r[s]|128;i[this.valueHexView.byteLength]=r[r.length-1]}return i.buffer}fromBER(e,t,i){const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;const c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=1,u=this.valueHexView=new Uint8Array(255),p=255;for(;s[l]&128;){if(u[l-1]=s[l]&127,l++,l>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(l===p){p+=255;const _=new Uint8Array(p);for(let x=0;x<u.length;x++)_[x]=u[x];u=this.valueHexView=new Uint8Array(p)}}this.blockLength=l+1,u[l-1]=s[l]&127;const g=new Uint8Array(l);for(let _=0;_<l;_++)g[_]=u[_];u=this.valueHexView=new Uint8Array(l),u.set(g),this.blockLength<=9?this.tagNumber=jn(u,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}Zd.NAME="identificationBlock";class Yd extends vn{constructor({lenBlock:e={}}={}){var t,i,r;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(r=e.length)!==null&&r!==void 0?r:0}fromBER(e,t,i){const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const a=s[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const c=t+1,l=r.subarray(c,c+a);return l[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=jn(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const r=an(this.length,8);if(r.byteLength>127)return this.error="Too big length",lt;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const s=new Uint8Array(r);i=new Uint8Array(t),i[0]=r.byteLength|128;for(let a=0;a<r.byteLength;a++)i[a+1]=s[a];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}Yd.NAME="lengthBlock";const D={};class $e extends vn{constructor({name:e=Ue,optional:t=!1,primitiveSchema:i,...r}={},s){super(r),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new Zd(r),this.lenBlock=new Yd(r),this.valueBlock=s?new s(r):new Re(r)}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(e,t){const i=t||new cs;t||Xd(this);const r=this.idBlock.toBER(e);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const a=this.lenBlock.toBER(e);i.write(a),i.write(s)}return t?lt:i.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():W.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${W.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return Cg(t,i)}}$e.NAME="BaseBlock";function Xd(n){if(n instanceof D.Constructed)for(const e of n.valueBlock.value)Xd(e)&&(n.lenBlock.isIndefiniteForm=!0);return!!n.lenBlock.isIndefiniteForm}class Qa extends $e{constructor({value:e=Ue,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Qa.NAME="BaseStringBlock";class Qd extends wt(Re){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Qd.NAME="PrimitiveValueBlock";var ep;class Ci extends $e{constructor(e={}){super(e,Qd),this.idBlock.isConstructed=!1}}ep=Ci;D.Primitive=ep;Ci.NAME="PRIMITIVE";function Ug(n,e){if(n instanceof e)return n;const t=new e;return t.idBlock=n.idBlock,t.lenBlock=n.lenBlock,t.warnings=n.warnings,t.valueBeforeDecodeView=n.valueBeforeDecodeView,t}function qn(n,e=0,t=n.length){const i=e;let r=new $e({},Re);const s=new vn;if(!jt(s,n,e,t))return r.error=s.error,{offset:-1,result:r};if(!n.subarray(e,e+t).length)return r.error="Zero buffer length",{offset:-1,result:r};let c=r.idBlock.fromBER(n,e,t);if(r.idBlock.warnings.length&&r.warnings.concat(r.idBlock.warnings),c===-1)return r.error=r.idBlock.error,{offset:-1,result:r};if(e=c,t-=r.idBlock.blockLength,c=r.lenBlock.fromBER(n,e,t),r.lenBlock.warnings.length&&r.warnings.concat(r.lenBlock.warnings),c===-1)return r.error=r.lenBlock.error,{offset:-1,result:r};if(e=c,t-=r.lenBlock.blockLength,!r.idBlock.isConstructed&&r.lenBlock.isIndefiniteForm)return r.error="Indefinite length form used for primitive encoding form",{offset:-1,result:r};let l=$e;switch(r.idBlock.tagClass){case 1:if(r.idBlock.tagNumber>=37&&r.idBlock.isHexOnly===!1)return r.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:r};switch(r.idBlock.tagNumber){case 0:if(r.idBlock.isConstructed&&r.lenBlock.length>0)return r.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:r};l=D.EndOfContent;break;case 1:l=D.Boolean;break;case 2:l=D.Integer;break;case 3:l=D.BitString;break;case 4:l=D.OctetString;break;case 5:l=D.Null;break;case 6:l=D.ObjectIdentifier;break;case 10:l=D.Enumerated;break;case 12:l=D.Utf8String;break;case 13:l=D.RelativeObjectIdentifier;break;case 14:l=D.TIME;break;case 15:return r.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:r};case 16:l=D.Sequence;break;case 17:l=D.Set;break;case 18:l=D.NumericString;break;case 19:l=D.PrintableString;break;case 20:l=D.TeletexString;break;case 21:l=D.VideotexString;break;case 22:l=D.IA5String;break;case 23:l=D.UTCTime;break;case 24:l=D.GeneralizedTime;break;case 25:l=D.GraphicString;break;case 26:l=D.VisibleString;break;case 27:l=D.GeneralString;break;case 28:l=D.UniversalString;break;case 29:l=D.CharacterString;break;case 30:l=D.BmpString;break;case 31:l=D.DATE;break;case 32:l=D.TimeOfDay;break;case 33:l=D.DateTime;break;case 34:l=D.Duration;break;default:{const u=r.idBlock.isConstructed?new D.Constructed:new D.Primitive;u.idBlock=r.idBlock,u.lenBlock=r.lenBlock,u.warnings=r.warnings,r=u}}break;case 2:case 3:case 4:default:l=r.idBlock.isConstructed?D.Constructed:D.Primitive}return r=Ug(r,l),c=r.fromBER(n,e,r.lenBlock.isIndefiniteForm?t:r.lenBlock.length),r.valueBeforeDecodeView=n.subarray(i,i+r.blockLength),{offset:c,result:r}}function zn(n){if(!n.byteLength){const e=new $e({},Re);return e.error="Input buffer has zero length",{offset:-1,result:e}}return qn(U.toUint8Array(n).slice(),0,n.byteLength)}function Vg(n,e){return n?1:e}class Pt extends Re{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;Vg(this.isIndefiniteForm,i)>0;){const a=qn(r,s,i);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(s=a.offset,this.blockLength+=a.result.blockLength,i-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===_i)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===_i?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new cs;for(let r=0;r<this.value.length;r++)this.value[r].toBER(e,i);return t?lt:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}Pt.NAME="ConstructedValueBlock";var tp;class Ve extends $e{constructor(e={}){super(e,Pt),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return r===-1?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
76
76
  `).map(r=>` ${r}`).join(`
77
77
  `));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
78
78
  ${e.join(`
79
- `)}`:`${t} :`}}tp=Ue;D.Constructed=tp;Ue.NAME="CONSTRUCTED";class np extends Te{fromBER(e,t,i){return t}toBER(e){return ct}}np.override="EndOfContentValueBlock";var ip;class ec extends $e{constructor(e={}){super(e,np),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}ip=ec;D.EndOfContent=ip;ec.NAME=_i;var rp;class cn extends $e{constructor(e={}){super(e,Te),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const r=new Uint8Array(i);r[0]=5,r[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}rp=cn;D.Null=rp;cn.NAME="NULL";class sp extends vt(Te){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=U.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const r=U.toUint8Array(e);return jt(this,r,t,i)?(this.valueHexView=r.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Wd.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}sp.NAME="BooleanValueBlock";var op;class ls extends $e{constructor(e={}){super(e,sp),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}op=ls;D.Boolean=op;ls.NAME="BOOLEAN";class ap extends vt(Pt){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=Pt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(let s=0;s<this.value.length;s++){const o=this.value[s].constructor.NAME;if(o===_i){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(o!==Gd)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,i),this.blockLength=i;return r}toBER(e,t){return this.isConstructed?Pt.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}ap.NAME="OctetStringValueBlock";var cp;let nn=class lp extends $e{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},ap),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const o=Fn(s,0,s.byteLength);o.offset!==-1&&o.offset===i&&(this.valueBlock.value=[o.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Ue.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${W.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof lp&&e.push(t.valueBlock.valueHexView);return U.concat(e)}};cp=nn;D.OctetString=cp;nn.NAME=Gd;class up extends vt(Pt){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let r=-1;if(this.isConstructed){if(r=Pt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(const c of this.value){const l=c.constructor.NAME;if(l===_i){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(l!==Jd)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const u=c.valueBlock;if(this.unusedBits>0&&u.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=u.unusedBits}return r}const s=U.toUint8Array(e);if(!jt(this,s,t,i))return-1;const o=s.subarray(t,t+i);if(this.unusedBits=o[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=o.subarray(1);try{if(c.byteLength){const l=Fn(c,0,c.byteLength);l.offset!==-1&&l.offset===i-1&&(this.value=[l.result])}}catch{}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,t+i}toBER(e,t){if(this.isConstructed)return Pt.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return ct;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}up.NAME="BitStringValueBlock";var dp;let rn=class extends $e{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},up),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ue.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const r of t)e.push(r.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};dp=rn;D.BitString=dp;rn.NAME=Jd;var pp;function Vg(n,e){const t=new Uint8Array([0]),i=new Uint8Array(n),r=new Uint8Array(e);let s=i.slice(0);const o=s.length-1,c=r.slice(0),l=c.length-1;let u=0;const p=l<o?o:l;let g=0;for(let _=p;_>=0;_--,g++){switch(!0){case g<c.length:u=s[o-g]+c[l-g]+t[0];break;default:u=s[o-g]+t[0]}switch(t[0]=u/10,!0){case g>=s.length:s=xo(new Uint8Array([u%10]),s);break;default:s[o-g]=u%10}}return t[0]>0&&(s=xo(t,s)),s}function Il(n){if(n>=ii.length)for(let e=ii.length;e<=n;e++){const t=new Uint8Array([0]);let i=ii[e-1].slice(0);for(let r=i.length-1;r>=0;r--){const s=new Uint8Array([(i[r]<<1)+t[0]]);t[0]=s[0]/10,i[r]=s[0]%10}t[0]>0&&(i=xo(t,i)),ii.push(i)}return ii[n]}function Mg(n,e){let t=0;const i=new Uint8Array(n),r=new Uint8Array(e),s=i.slice(0),o=s.length-1,c=r.slice(0),l=c.length-1;let u,p=0;for(let g=l;g>=0;g--,p++)switch(u=s[o-p]-c[l-p]-t,!0){case u<0:t=1,s[o-p]=u+10;break;default:t=0,s[o-p]=u}if(t>0)for(let g=o-l+1;g>=0;g--,p++)if(u=s[o-p]-t,u<0)t=1,s[o-p]=u+10;else{t=0,s[o-p]=u;break}return s.slice()}class tc extends vt(Te){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=Wd.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array($g(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,r=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const o=this.valueHexView;return o[0]===0&&o[1]&128?this.valueHexView=o.subarray(1):r!==0&&o.length<r&&(r-o.length>1&&(r=o.length+1),this.valueHexView=o.subarray(r-o.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const r=super.fromBER(e,t,i);return r===-1||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,r;const s=this.valueHexView;let o="",c=!1;for(let l=s.byteLength-1;l>=0;l--){r=s[l];for(let u=0;u<8;u++){if((r&1)===1)switch(i){case e:t=Mg(Il(i),t),o="-";break;default:t=Vg(t,Il(i))}i++,r>>=1}}for(let l=0;l<t.length;l++)t[l]&&(c=!0),c&&(o+=Sl.charAt(t[l]));return c===!1&&(o+=Sl.charAt(0)),o}}pp=tc;tc.NAME="IntegerValueBlock";Object.defineProperty(pp.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var fp;class _t extends $e{constructor(e={}){super(e,tc),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return wr(),BigInt(this.valueBlock.toString())}static fromBigInt(e){wr();const t=BigInt(e),i=new as,r=t.toString(16).replace(/^-/,""),s=new Uint8Array(W.FromHex(r));if(t<0){const c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;const u=BigInt(`0x${W.ToHex(c)}`)+t,p=U.toUint8Array(W.FromHex(u.toString(16)));p[0]|=128,i.write(p)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new _t({valueHex:i.final()})}convertToDER(){const e=new _t({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new _t({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}fp=_t;D.Integer=fp;_t.NAME="INTEGER";var hp;class us extends _t{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}hp=us;D.Enumerated=hp;us.NAME="ENUMERATED";class So extends vt(Te){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)o[c]=this.valueHexView[c];return this.valueHexView=o,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=jn(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){wr();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let r=0;r<i.length;r++)i[r]=parseInt(t.slice(r*7,r*7+7),2)+(r+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=r[o]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=an(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ct;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)i[o]=r[o]|128;i[s]=r[s]}return i}toString(){let e="";if(this.isHexOnly)e=W.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}So.NAME="sidBlock";class gp extends Te{constructor({value:e=Le,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new So;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(e);if(r.byteLength===0)return this.error=this.value[i].error,ct;t.push(r)}return Xa(t)}fromString(e){this.value=[];let t=0,i=0,r="",s=!1;do if(i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1,s){const o=this.value[0];let c=0;switch(o.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const l=parseInt(r,10);if(isNaN(l))return;o.valueDec=l+c,s=!1}else{const o=new So;if(r>Number.MAX_SAFE_INTEGER){wr();const c=BigInt(r);o.valueBigInt=c}else if(o.valueDec=parseInt(r,10),isNaN(o.valueDec))return;this.value.length||(o.isFirstSid=!0,s=!0),this.value.push(o)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t?(r=`{${r}}`,this.value[i].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}gp.NAME="ObjectIdentifierValueBlock";var _p;class ds extends $e{constructor(e={}){super(e,gp),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_p=ds;D.ObjectIdentifier=_p;ds.NAME="OBJECT IDENTIFIER";class Ao extends vt(vn){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const o=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)o[c]=this.valueHexView[c];return this.valueHexView=o,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=jn(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)s[o]=r[o]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=an(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ct;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let o=0;o<s;o++)i[o]=r[o]|128;i[s]=r[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=W.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Ao.NAME="relativeSidBlock";class mp extends Te{constructor({value:e=Le,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new Ao;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e,t){const i=[];for(let r=0;r<this.value.length;r++){const s=this.value[r].toBER(e);if(s.byteLength===0)return this.error=this.value[r].error,ct;i.push(s)}return Xa(i)}fromString(e){this.value=[];let t=0,i=0,r="";do{i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1;const s=new Ao;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(r=`{${r}}`),e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}mp.NAME="RelativeObjectIdentifierValueBlock";var yp;class nc extends $e{constructor(e={}){super(e,mp),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}yp=nc;D.RelativeObjectIdentifier=yp;nc.NAME="RelativeObjectIdentifier";var vp;class St extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}vp=St;D.Sequence=vp;St.NAME="SEQUENCE";var wp;let At=class extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};wp=At;D.Set=wp;At.NAME="SET";class bp extends vt(Te){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Le}toJSON(){return{...super.toJSON(),value:this.value}}}bp.NAME="StringValueBlock";class kp extends bp{}kp.NAME="SimpleStringValueBlock";class We extends Qa{constructor({...e}={}){super(e,kp)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,U.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);this.valueBlock.value=e}}We.NAME="SIMPLE STRING";class xp extends We{fromBuffer(e){this.valueBlock.valueHexView=U.toUint8Array(e);try{this.valueBlock.value=W.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=W.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(W.FromUtf8String(e)),this.valueBlock.value=e}}xp.NAME="Utf8StringValueBlock";var Sp;class Nt extends xp{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Sp=Nt;D.Utf8String=Sp;Nt.NAME="UTF8String";class Ap extends We{fromBuffer(e){this.valueBlock.value=W.ToUtf16String(e),this.valueBlock.valueHexView=U.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(W.FromUtf16String(e))}}Ap.NAME="BmpStringValueBlock";var Ip;class ps extends Ap{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}Ip=ps;D.BmpString=Ip;ps.NAME="BMPString";class Ep extends We{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let r=0;r<i.length;r+=4)i[r]=i[r+3],i[r+1]=i[r+2],i[r+2]=0,i[r+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let r=0;r<t;r++){const s=an(e.charCodeAt(r),8),o=new Uint8Array(s);if(o.length>4)continue;const c=4-o.length;for(let l=o.length-1;l>=0;l--)i[r*4+l+c]=o[l]}this.valueBlock.value=e}}Ep.NAME="UniversalStringValueBlock";var $p;class fs extends Ep{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}$p=fs;D.UniversalString=$p;fs.NAME="UniversalString";var Cp;class hs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Cp=hs;D.NumericString=Cp;hs.NAME="NumericString";var zp;class gs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}zp=gs;D.PrintableString=zp;gs.NAME="PrintableString";var jp;class _s extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}jp=_s;D.TeletexString=jp;_s.NAME="TeletexString";var Np;class ms extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Np=ms;D.VideotexString=Np;ms.NAME="VideotexString";var Op;class ys extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Op=ys;D.IA5String=Op;ys.NAME="IA5String";var Bp;class vs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Bp=vs;D.GraphicString=Bp;vs.NAME="GraphicString";var Tp;class ji extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Tp=ji;D.VisibleString=Tp;ji.NAME="VisibleString";var Rp;class ws extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Rp=ws;D.GeneralString=Rp;ws.NAME="GeneralString";var Pp;class bs extends We{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Pp=bs;D.CharacterString=Pp;bs.NAME="CharacterString";var Lp;class Ni extends ji{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let r=0;r<e.length;r++)this.valueBlock.valueHexView[r]=e.charCodeAt(r)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,U.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const r=parseInt(i[1],10);r>=50?this.year=1900+r:this.year=2e3+r,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=qe(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=qe(this.month,2),t[2]=qe(this.day,2),t[3]=qe(this.hour,2),t[4]=qe(this.minute,2),t[5]=qe(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Lp=Ni;D.UTCTime=Lp;Ni.NAME="UTCTime";var Up;class ks extends Ni{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",r="",s=0,o,c=0,l=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const g=new Number(e[e.length-1]);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let g=1,_=i.indexOf("+"),x="";if(_===-1&&(_=i.indexOf("-"),g=-1),_!==-1){if(x=i.substring(_+1),i=i.substring(0,_),x.length!==2&&x.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(x.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=g*h,x.length===4){if(h=parseInt(x.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");l=g*h}}}let u=i.indexOf(".");if(u===-1&&(u=i.indexOf(",")),u!==-1){const g=new Number(`0${i.substring(u)}`);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");s=g.valueOf(),r=i.substring(0,u)}else r=i;switch(!0){case r.length===8:if(o=/(\d{4})(\d{2})(\d{2})/ig,u!==-1)throw new Error("Wrong input string for conversion");break;case r.length===10:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let g=60*s;this.minute=Math.floor(g),g=60*(g-this.minute),this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===12:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let g=60*s;this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===14:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){const g=1e3*s;this.millisecond=Math.floor(g)}break;default:throw new Error("Wrong input string for conversion")}const p=o.exec(r);if(p===null)throw new Error("Wrong input string for conversion");for(let g=1;g<p.length;g++)switch(g){case 1:this.year=parseInt(p[g],10);break;case 2:this.month=parseInt(p[g],10);break;case 3:this.day=parseInt(p[g],10);break;case 4:this.hour=parseInt(p[g],10)+c;break;case 5:this.minute=parseInt(p[g],10)+l;break;case 6:this.second=parseInt(p[g],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const g=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=g.getUTCFullYear(),this.month=g.getUTCMonth(),this.day=g.getUTCDay(),this.hour=g.getUTCHours(),this.minute=g.getUTCMinutes(),this.second=g.getUTCSeconds(),this.millisecond=g.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(qe(this.year,4)),t.push(qe(this.month,2)),t.push(qe(this.day,2)),t.push(qe(this.hour,2)),t.push(qe(this.minute,2)),t.push(qe(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(qe(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Up=ks;D.GeneralizedTime=Up;ks.NAME="GeneralizedTime";var Vp;class ic extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Vp=ic;D.DATE=Vp;ic.NAME="DATE";var Mp;class rc extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}Mp=rc;D.TimeOfDay=Mp;rc.NAME="TimeOfDay";var Hp;class sc extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Hp=sc;D.DateTime=Hp;sc.NAME="DateTime";var Dp;class oc extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}Dp=oc;D.Duration=Dp;oc.NAME="Duration";var Fp;class ac extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}Fp=ac;D.TIME=Fp;ac.NAME="TIME";class ln{constructor({name:e=Le,optional:t=!1}={}){this.name=e,this.optional=t}}class cc extends ln{constructor({value:e=[],...t}={}){super(t),this.value=e}}class br extends ln{constructor({value:e=new ln,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class Hg{constructor({data:e=cs}={}){this.dataView=U.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=U.toUint8Array(e)}fromBER(e,t,i){const r=t+i;return this.dataView=U.toUint8Array(e).subarray(t,r),r}toBER(e){return this.dataView.slice().buffer}}function Qt(n,e,t){if(t instanceof cc){for(let s=0;s<t.value.length;s++)if(Qt(n,e,t.value[s]).verified)return{verified:!0,result:n};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(so)&&(s.name=t.name),s}}if(t instanceof ln)return t.hasOwnProperty(so)&&(n[t.name]=e),{verified:!0,result:n};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(jg in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Tg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Rg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(Ng)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(Og)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(Bg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:n};if(!(zg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:n};if(t.idBlock.isHexOnly){if(!(Al in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,o=e.idBlock.valueHexView;if(s.length!==o.length)return{verified:!1,result:n};for(let c=0;c<s.length;c++)if(s[c]!==o[1])return{verified:!1,result:n}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(n[t.name]=e)),t instanceof D.Constructed){let s=0,o={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof br&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:n};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let l=!0;for(let u=0;u<t.valueBlock.value.length;u++)l=l&&(t.valueBlock.value[u].optional||!1);return l?{verified:!0,result:n}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&delete n[t.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let l=0;l<c;l++)if(l-s>=e.valueBlock.value.length){if(t.valueBlock.value[l].optional===!1){const u={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(delete n[t.name],u.name=t.name)),u}}else if(t.valueBlock.value[0]instanceof br){if(o=Qt(n,e.valueBlock.value[l],t.valueBlock.value[0].value),o.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&delete n[t.name]),o;if(so in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let u={};Pg in t.valueBlock.value[0]&&t.valueBlock.value[0].local?u=e:u=n,typeof u[t.valueBlock.value[0].name]>"u"&&(u[t.valueBlock.value[0].name]=[]),u[t.valueBlock.value[0].name].push(e.valueBlock.value[l])}}else if(o=Qt(n,e.valueBlock.value[l-s],t.valueBlock.value[l]),o.verified===!1)if(t.valueBlock.value[l].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&delete n[t.name]),o;if(o.verified===!1){const l={verified:!1,result:n};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(delete n[t.name],l.name=t.name)),l}return{verified:!0,result:n}}if(t.primitiveSchema&&Al in e.valueBlock){const s=Fn(e.valueBlock.valueHexView);if(s.offset===-1){const o={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Le),t.name&&(delete n[t.name],o.name=t.name)),o}return Qt(n,s.result,t.primitiveSchema)}return{verified:!0,result:n}}function Dg(n,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=Fn(U.toUint8Array(n));return t.offset===-1?{verified:!1,result:t.result}:Qt(t.result,t.result,e)}const qp=Object.freeze(Object.defineProperty({__proto__:null,Any:ln,BaseBlock:$e,BaseStringBlock:Qa,BitString:rn,BmpString:ps,Boolean:ls,CharacterString:bs,Choice:cc,Constructed:Ue,DATE:ic,DateTime:sc,Duration:oc,EndOfContent:ec,Enumerated:us,GeneralString:ws,GeneralizedTime:ks,GraphicString:vs,HexBlock:vt,IA5String:ys,Integer:_t,Null:cn,NumericString:hs,ObjectIdentifier:ds,OctetString:nn,Primitive:zi,PrintableString:gs,RawData:Hg,RelativeObjectIdentifier:nc,Repeated:br,Sequence:St,Set:At,TIME:ac,TeletexString:_s,TimeOfDay:rc,UTCTime:Ni,UniversalString:fs,Utf8String:Nt,ValueBlock:Te,VideotexString:ms,ViewWriter:as,VisibleString:ji,compareSchema:Qt,fromBER:$n,verifySchema:Dg},Symbol.toStringTag,{value:"Module"}));var N;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(N||(N={}));var y;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(y||(y={}));class xs{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(U.isBufferSource(e))this.unusedBits=t,this.value=U.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof rn))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new rn({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new rn({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const r=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=r.buffer}}class re{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):U.isBufferSource(e)?this.buffer=U.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof nn))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new nn({valueHex:this.buffer})}toSchema(e){return new nn({name:e})}}const Fg={fromASN:n=>n instanceof cn?null:n.valueBeforeDecodeView,toASN:n=>{if(n===null)return new cn;const e=$n(n);if(e.result.error)throw new Error(e.result.error);return e.result}},qg={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new _t({value:+n})},Kg={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new us({value:n})},he={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new _t({valueHex:n})},Wg={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new rn({valueHex:n})},Gg={fromASN:n=>n.valueBlock.toString(),toASN:n=>new ds({value:n})},Jg={fromASN:n=>n.valueBlock.value,toASN:n=>new ls({value:n})},kr={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new nn({valueHex:n})},Zg={fromASN:n=>new re(n.getValue()),toASN:n=>n.toASN()};function Qe(n){return{fromASN:e=>e.valueBlock.value,toASN:e=>new n({value:e})}}const Kp=Qe(Nt),Yg=Qe(ps),Xg=Qe(fs),Qg=Qe(hs),e_=Qe(gs),t_=Qe(_s),n_=Qe(ms),i_=Qe(ys),r_=Qe(vs),s_=Qe(ji),o_=Qe(ws),a_=Qe(bs),c_={fromASN:n=>n.toDate(),toASN:n=>new Ni({valueDate:n})},l_={fromASN:n=>n.toDate(),toASN:n=>new ks({valueDate:n})},u_={fromASN:()=>null,toASN:()=>new cn};function lc(n){switch(n){case y.Any:return Fg;case y.BitString:return Wg;case y.BmpString:return Yg;case y.Boolean:return Jg;case y.CharacterString:return a_;case y.Enumerated:return Kg;case y.GeneralString:return o_;case y.GeneralizedTime:return l_;case y.GraphicString:return r_;case y.IA5String:return i_;case y.Integer:return qg;case y.Null:return u_;case y.NumericString:return Qg;case y.ObjectIdentifier:return Gg;case y.OctetString:return kr;case y.PrintableString:return e_;case y.TeletexString:return t_;case y.UTCTime:return c_;case y.UniversalString:return Xg;case y.Utf8String:return Kp;case y.VideotexString:return n_;case y.VisibleString:return s_;default:return null}}function xt(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:xt(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function Wp(n){var e;if(n){const t=Object.getPrototypeOf(n);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:Wp(t)}return!1}function d_(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}class p_{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:N.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),r=[];for(const s in i.items){const o=i.items[s],c=t?s:"";let l;if(typeof o.type=="number"){const p=y[o.type],g=qp[p];if(!g)throw new Error(`Cannot get ASN1 class by name '${p}'`);l=new g({name:c})}else xt(o.type)?l=new o.type().toSchema(c):o.optional?this.get(o.type).type===N.Choice?l=new ln({name:c}):(l=this.create(o.type,!1),l.name=c):l=new ln({name:c});const u=!!o.optional||o.defaultValue!==void 0;if(o.repeated){l.name="";const p=o.repeated==="set"?At:St;l=new p({name:"",value:[new br({name:c,value:l})]})}if(o.context!==null&&o.context!==void 0)if(o.implicit)if(typeof o.type=="number"||xt(o.type)){const p=o.repeated?Ue:zi;r.push(new p({name:c,optional:u,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);const p=!!o.repeated;let g=p?l:this.get(o.type,!0).schema;g="valueBlock"in g?g.valueBlock.value:g.value,r.push(new Ue({name:p?"":c,optional:u,idBlock:{tagClass:3,tagNumber:o.context},value:g}))}else r.push(new Ue({optional:u,idBlock:{tagClass:3,tagNumber:o.context},value:[l]}));else l.optional=u,r.push(l)}switch(i.type){case N.Sequence:return new St({value:r,name:""});case N.Set:return new At({value:r,name:""});case N.Choice:return new cc({value:r,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const Je=new p_,B=n=>e=>{let t;Je.has(e)?t=Je.get(e):(t=Je.createDefault(e),Je.set(e,t)),Object.assign(t,n)},f=n=>(e,t)=>{let i;Je.has(e.constructor)?i=Je.get(e.constructor):(i=Je.createDefault(e.constructor),Je.set(e.constructor,i));const r=Object.assign({},n);if(typeof r.type=="number"&&!r.converter){const s=lc(n.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);r.converter=s}i.items[t]=r};class El extends Error{constructor(){super(...arguments),this.schemas=[]}}class f_{static parse(e,t){const i=$n(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(xt(t))return new t().fromASN(e);const r=Je.get(t);Je.cache(t);let s=r.schema;if(e.constructor===Ue&&r.type!==N.Choice){s=new Ue({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const l in r.items)delete e[l]}const o=Qt({},e,s);if(!o.verified)throw new El(`Data does not match to ${t.name} ASN1 schema. ${o.result.error}`);const c=new t;if(Wp(t)){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=r.itemType;if(typeof l=="number"){const u=lc(l);if(!u)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,p=>u.fromASN(p))}else return t.from(e.valueBlock.value,u=>this.fromASN(u,l))}for(const l in r.items){const u=o.result[l];if(!u)continue;const p=r.items[l],g=p.type;if(typeof g=="number"||xt(g)){const _=(i=p.converter)!==null&&i!==void 0?i:xt(g)?new g:null;if(!_)throw new Error("Converter is empty");if(p.repeated)if(p.implicit){const x=p.repeated==="sequence"?St:At,h=new x;h.valueBlock=u.valueBlock;const m=$n(h.toBER(!1));if(m.offset===-1)throw new Error(`Cannot parse the child item. ${m.result.error}`);if(!("value"in m.result.valueBlock&&Array.isArray(m.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const b=m.result.valueBlock.value;c[l]=Array.from(b,S=>_.fromASN(S))}else c[l]=Array.from(u,x=>_.fromASN(x));else{let x=u;if(p.implicit){let h;if(xt(g))h=new g().toSchema("");else{const m=y[g],b=qp[m];if(!b)throw new Error(`Cannot get '${m}' class from asn1js module`);h=new b}h.valueBlock=x.valueBlock,x=$n(h.toBER(!1)).result}c[l]=_.fromASN(x)}}else if(p.repeated){if(!Array.isArray(u))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");c[l]=Array.from(u,_=>this.fromASN(_,g))}else c[l]=this.fromASN(u,g)}return c}catch(r){throw r instanceof El&&r.schemas.push(t.name),r}}}class uc{static serialize(e){return e instanceof $e?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&xt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Je.get(t);Je.cache(t);let r=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const o=lc(i.itemType);if(!o)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);r=e.map(c=>o.toASN(c))}else r=e.map(o=>this.toAsnItem({type:i.itemType},"[]",t,o))}else for(const o in i.items){const c=i.items[o],l=e[o];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&d_(this.serialize(c.defaultValue),this.serialize(l)))continue;const u=uc.toAsnItem(c,o,t,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||xt(c.type))){const p={};p.valueHex=u instanceof cn?u.valueBeforeDecodeView:u.valueBlock.toBER(),r.push(new zi({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...p}))}else r.push(new Ue({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:u.valueBlock.value}));else r.push(new Ue({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else c.repeated?r=r.concat(u):r.push(u)}let s;switch(i.type){case N.Sequence:s=new St({value:r});break;case N.Set:s=new At({value:r});break;case N.Choice:if(!r[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=r[0];break}return s}static toAsnItem(e,t,i,r){let s;if(typeof e.type=="number"){const o=e.converter;if(!o)throw new Error(`Property '${t}' doesn't have converter for type ${y[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(r,u=>o.toASN(u)),l=e.repeated==="sequence"?St:At;s=new l({value:c})}else s=o.toASN(r)}else if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const o=Array.from(r,l=>this.toASN(l)),c=e.repeated==="sequence"?St:At;s=new c({value:o})}else s=this.toASN(r);return s}}class le extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class L{static serialize(e){return uc.serialize(e)}static parse(e,t){return f_.parse(e,t)}static toString(e){const t=U.isBufferSource(e)?U.toArrayBuffer(e):L.serialize(e),i=$n(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function d(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var c=n.length-1;c>=0;c--)(o=n[c])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}var Gp={exports:{}};(function(n){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},r=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${o})?$`,"i")};function u(h,m){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let b=0,S=-1,O=(h.match(l.zoneIndex)||[])[0],T,q;for(O&&(O=O.substring(1),h=h.replace(/%.+$/,""));(S=h.indexOf(":",S+1))>=0;)b++;if(h.substr(0,2)==="::"&&b--,h.substr(-2,2)==="::"&&b--,b>m)return null;for(q=m-b,T=":";q--;)T+="0:";return h=h.replace("::",T),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),m=function(){const oe=h.split(":"),pe=[];for(let ce=0;ce<oe.length;ce++)pe.push(parseInt(oe[ce],16));return pe}(),{parts:m,zoneId:O}}function p(h,m,b,S){if(h.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let O=0,T;for(;S>0;){if(T=b-S,T<0&&(T=0),h[O]>>T!==m[O]>>T)return!1;S-=b,O+=1}return!0}function g(h){if(s.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(r.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}function _(h,m){for(;h.length<m;)h=`0${h}`;return h}const x={};x.IPv4=function(){function h(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let b,S;for(b=0;b<m.length;b++)if(S=m[b],!(0<=S&&S<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(m,b){let S;if(b===void 0&&(S=m,m=S[0],b=S[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return p(this.octets,m.octets,8,b)},h.prototype.prefixLengthFromSubnetMask=function(){let m=0,b=!1;const S={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let O,T,q;for(O=3;O>=0;O-=1)if(T=this.octets[O],T in S){if(q=S[T],b&&q!==0)return null;q!==8&&(b=!0),m+=q}else return null;return 32-m},h.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h}(),x.IPv4.broadcastAddressFromCIDR=function(h){try{const m=this.parseCIDR(h),b=m[0].toByteArray(),S=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[];let T=0;for(;T<4;)O.push(parseInt(b[T],10)|parseInt(S[T],10)^255),T++;return new this(O)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(h){return this.parser(h)!==null},x.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(h){return!!(x.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.networkAddressFromCIDR=function(h){let m,b,S,O,T;try{for(m=this.parseCIDR(h),S=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[],b=0;b<4;)O.push(parseInt(S[b],10)&parseInt(T[b],10)),b++;return new this(O)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(h){const m=this.parser(h);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},x.IPv4.parseCIDR=function(h){let m;if(m=h.match(/^(.+)\/(\d+)$/)){const b=parseInt(m[2]);if(b>=0&&b<=32){const S=[this.parse(m[1]),b];return Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(h){let m,b,S;if(m=h.match(i.fourOctet))return function(){const O=m.slice(1,6),T=[];for(let q=0;q<O.length;q++)b=O[q],T.push(g(b));return T}();if(m=h.match(i.longValue)){if(S=g(m[1]),S>4294967295||S<0)throw new Error("ipaddr: address outside defined range");return function(){const O=[];let T;for(T=0;T<=24;T+=8)O.push(S>>T&255);return O}().reverse()}else return(m=h.match(i.twoOctet))?function(){const O=m.slice(1,4),T=[];if(S=g(O[1]),S>16777215||S<0)throw new Error("ipaddr: address outside defined range");return T.push(g(O[0])),T.push(S>>16&255),T.push(S>>8&255),T.push(S&255),T}():(m=h.match(i.threeOctet))?function(){const O=m.slice(1,5),T=[];if(S=g(O[2]),S>65535||S<0)throw new Error("ipaddr: address outside defined range");return T.push(g(O[0])),T.push(g(O[1])),T.push(S>>8&255),T.push(S&255),T}():null},x.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");const m=[0,0,0,0];let b=0;const S=Math.floor(h/8);for(;b<S;)m[b]=255,b++;return S<4&&(m[S]=Math.pow(2,h%8)-1<<8-h%8),new this(m)},x.IPv6=function(){function h(m,b){let S,O;if(m.length===16)for(this.parts=[],S=0;S<=14;S+=2)this.parts.push(m[S]<<8|m[S+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(S=0;S<this.parts.length;S++)if(O=this.parts[S],!(0<=O&&O<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");b&&(this.zoneId=b)}return h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(m,b){let S;if(b===void 0&&(S=m,m=S[0],b=S[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return p(this.parts,m.parts,16,b)},h.prototype.prefixLengthFromSubnetMask=function(){let m=0,b=!1;const S={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let O,T;for(let q=7;q>=0;q-=1)if(O=this.parts[q],O in S){if(T=S[O],b&&T!==0)return null;T!==16&&(b=!0),m+=T}else return null;return 128-m},h.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let m;const b=[],S=this.parts;for(let O=0;O<S.length;O++)m=S[O],b.push(m>>8),b.push(m&255);return b},h.prototype.toFixedLengthString=function(){const m=(function(){const S=[];for(let O=0;O<this.parts.length;O++)S.push(_(this.parts[O].toString(16),4));return S}).call(this).join(":");let b="";return this.zoneId&&(b=`%${this.zoneId}`),m+b},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const m=this.parts.slice(-2),b=m[0],S=m[1];return new x.IPv4([b>>8,b&255,S>>8,S&255])},h.prototype.toNormalizedString=function(){const m=(function(){const S=[];for(let O=0;O<this.parts.length;O++)S.push(this.parts[O].toString(16));return S}).call(this).join(":");let b="";return this.zoneId&&(b=`%${this.zoneId}`),m+b},h.prototype.toRFC5952String=function(){const m=/((^|:)(0(:|$)){2,})/g,b=this.toNormalizedString();let S=0,O=-1,T;for(;T=m.exec(b);)T[0].length>O&&(S=T.index,O=T[0].length);return O<0?b:`${b.substring(0,S)}::${b.substring(S+O)}`},h.prototype.toString=function(){return this.toRFC5952String()},h}(),x.IPv6.broadcastAddressFromCIDR=function(h){try{const m=this.parseCIDR(h),b=m[0].toByteArray(),S=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[];let T=0;for(;T<16;)O.push(parseInt(b[T],10)|parseInt(S[T],10)^255),T++;return new this(O)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},x.IPv6.isIPv6=function(h){return this.parser(h)!==null},x.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{const m=this.parser(h);return new this(m.parts,m.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(h){let m,b,S,O,T;try{for(m=this.parseCIDR(h),S=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[],b=0;b<16;)O.push(parseInt(S[b],10)&parseInt(T[b],10)),b++;return new this(O)}catch(q){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${q})`)}},x.IPv6.parse=function(h){const m=this.parser(h);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},x.IPv6.parseCIDR=function(h){let m,b,S;if((b=h.match(/^(.+)\/(\d+)$/))&&(m=parseInt(b[2]),m>=0&&m<=128))return S=[this.parse(b[1]),m],Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(h){let m,b,S,O,T,q;if(S=h.match(l.deprecatedTransitional))return this.parser(`::ffff:${S[1]}`);if(l.native.test(h))return u(h,8);if((S=h.match(l.transitional))&&(q=S[6]||"",m=S[1],S[1].endsWith("::")||(m=m.slice(0,-1)),m=u(m+q,6),m.parts)){for(T=[parseInt(S[2]),parseInt(S[3]),parseInt(S[4]),parseInt(S[5])],b=0;b<T.length;b++)if(O=T[b],!(0<=O&&O<=255))return null;return m.parts.push(T[0]<<8|T[1]),m.parts.push(T[2]<<8|T[3]),{parts:m.parts,zoneId:m.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");const m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let b=0;const S=Math.floor(h/8);for(;b<S;)m[b]=255,b++;return S<16&&(m[S]=Math.pow(2,h%8)-1<<8-h%8),new this(m)},x.fromByteArray=function(h){const m=h.length;if(m===4)return new x.IPv4(h);if(m===16)return new x.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(h){return x.IPv6.isValid(h)||x.IPv4.isValid(h)},x.isValidCIDR=function(h){return x.IPv6.isValidCIDR(h)||x.IPv4.isValidCIDR(h)},x.parse=function(h){if(x.IPv6.isValid(h))return x.IPv6.parse(h);if(x.IPv4.isValid(h))return x.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(h){try{return x.IPv6.parseCIDR(h)}catch{try{return x.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(h){const m=this.parse(h);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},x.subnetMatch=function(h,m,b){let S,O,T,q;b==null&&(b="unicast");for(O in m)if(Object.prototype.hasOwnProperty.call(m,O)){for(T=m[O],T[0]&&!(T[0]instanceof Array)&&(T=[T]),S=0;S<T.length;S++)if(q=T[S],h.kind()===q[0].kind()&&h.match.apply(h,q))return O}return b},n.exports?n.exports=x:e.ipaddr=x})(vr)})(Gp);var $l=Gp.exports;class Cl{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((r,s)=>r+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,r=>`${parseInt(r,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return $l.fromByteArray(Array.from(t)).toString()}return this.decodeIP(W.ToHex(e))}static fromString(e){const t=$l.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var Io,Eo,$o;let Ce=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};d([f({type:y.TeletexString})],Ce.prototype,"teletexString",void 0);d([f({type:y.PrintableString})],Ce.prototype,"printableString",void 0);d([f({type:y.UniversalString})],Ce.prototype,"universalString",void 0);d([f({type:y.Utf8String})],Ce.prototype,"utf8String",void 0);d([f({type:y.BmpString})],Ce.prototype,"bmpString",void 0);Ce=d([B({type:N.Choice})],Ce);let Nn=class extends Ce{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?W.ToHex(this.anyValue):super.toString())}};d([f({type:y.IA5String})],Nn.prototype,"ia5String",void 0);d([f({type:y.Any})],Nn.prototype,"anyValue",void 0);Nn=d([B({type:N.Choice})],Nn);class Ss{constructor(e={}){this.type="",this.value=new Nn,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ss.prototype,"type",void 0);d([f({type:Nn})],Ss.prototype,"value",void 0);let On=Io=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Io.prototype)}};On=Io=d([B({type:N.Set,itemType:Ss})],On);let Co=Eo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Eo.prototype)}};Co=Eo=d([B({type:N.Sequence,itemType:On})],Co);let ve=$o=class extends Co{constructor(e){super(e),Object.setPrototypeOf(this,$o.prototype)}};ve=$o=d([B({type:N.Sequence})],ve);const h_={fromASN:n=>Cl.toString(kr.fromASN(n)),toASN:n=>kr.toASN(Cl.fromString(n))};class mi{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],mi.prototype,"typeId",void 0);d([f({type:y.Any,context:0})],mi.prototype,"value",void 0);class dc{constructor(e={}){this.partyName=new Ce,Object.assign(this,e)}}d([f({type:Ce,optional:!0,context:0,implicit:!0})],dc.prototype,"nameAssigner",void 0);d([f({type:Ce,context:1,implicit:!0})],dc.prototype,"partyName",void 0);let Q=class{constructor(e={}){Object.assign(this,e)}};d([f({type:mi,context:0,implicit:!0})],Q.prototype,"otherName",void 0);d([f({type:y.IA5String,context:1,implicit:!0})],Q.prototype,"rfc822Name",void 0);d([f({type:y.IA5String,context:2,implicit:!0})],Q.prototype,"dNSName",void 0);d([f({type:y.Any,context:3,implicit:!0})],Q.prototype,"x400Address",void 0);d([f({type:ve,context:4,implicit:!1})],Q.prototype,"directoryName",void 0);d([f({type:dc,context:5})],Q.prototype,"ediPartyName",void 0);d([f({type:y.IA5String,context:6,implicit:!0})],Q.prototype,"uniformResourceIdentifier",void 0);d([f({type:y.OctetString,context:7,implicit:!0,converter:h_})],Q.prototype,"iPAddress",void 0);d([f({type:y.ObjectIdentifier,context:8,implicit:!0})],Q.prototype,"registeredID",void 0);Q=d([B({type:N.Choice})],Q);const pc="1.3.6.1.5.5.7",g_=`${pc}.1`,qn=`${pc}.3`,As=`${pc}.48`,zl=`${As}.1`,jl=`${As}.2`,Nl=`${As}.3`,Ol=`${As}.5`,qt="2.5.29";var zo;const jo=`${g_}.1`;class Oi{constructor(e={}){this.accessMethod="",this.accessLocation=new Q,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Oi.prototype,"accessMethod",void 0);d([f({type:Q})],Oi.prototype,"accessLocation",void 0);let In=zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,zo.prototype)}};In=zo=d([B({type:N.Sequence,itemType:Oi})],In);const No=`${qt}.35`;class fc extends re{}class en{constructor(e={}){e&&Object.assign(this,e)}}d([f({type:fc,context:0,optional:!0,implicit:!0})],en.prototype,"keyIdentifier",void 0);d([f({type:Q,context:1,optional:!0,implicit:!0,repeated:"sequence"})],en.prototype,"authorityCertIssuer",void 0);d([f({type:y.Integer,context:2,optional:!0,implicit:!0,converter:he})],en.prototype,"authorityCertSerialNumber",void 0);const Jp=`${qt}.19`;class xr{constructor(e={}){this.cA=!1,Object.assign(this,e)}}d([f({type:y.Boolean,defaultValue:!1})],xr.prototype,"cA",void 0);d([f({type:y.Integer,optional:!0})],xr.prototype,"pathLenConstraint",void 0);var Oo;let Be=Oo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};Be=Oo=d([B({type:N.Sequence,itemType:Q})],Be);var Bo;let Bl=Bo=class extends Be{constructor(e){super(e),Object.setPrototypeOf(this,Bo.prototype)}};Bl=Bo=d([B({type:N.Sequence})],Bl);var To;const Zp=`${qt}.32`;let It=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};d([f({type:y.IA5String})],It.prototype,"ia5String",void 0);d([f({type:y.VisibleString})],It.prototype,"visibleString",void 0);d([f({type:y.BmpString})],It.prototype,"bmpString",void 0);d([f({type:y.Utf8String})],It.prototype,"utf8String",void 0);It=d([B({type:N.Choice})],It);class hc{constructor(e={}){this.organization=new It,this.noticeNumbers=[],Object.assign(this,e)}}d([f({type:It})],hc.prototype,"organization",void 0);d([f({type:y.Integer,repeated:"sequence"})],hc.prototype,"noticeNumbers",void 0);class gc{constructor(e={}){Object.assign(this,e)}}d([f({type:hc,optional:!0})],gc.prototype,"noticeRef",void 0);d([f({type:It,optional:!0})],gc.prototype,"explicitText",void 0);let Sr=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.IA5String})],Sr.prototype,"cPSuri",void 0);d([f({type:gc})],Sr.prototype,"userNotice",void 0);Sr=d([B({type:N.Choice})],Sr);class _c{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],_c.prototype,"policyQualifierId",void 0);d([f({type:y.Any})],_c.prototype,"qualifier",void 0);class Is{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Is.prototype,"policyIdentifier",void 0);d([f({type:_c,repeated:"sequence",optional:!0})],Is.prototype,"policyQualifiers",void 0);let Ar=To=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};Ar=To=d([B({type:N.Sequence,itemType:Is})],Ar);let Ir=class{constructor(e=0){this.value=e}};d([f({type:y.Integer})],Ir.prototype,"value",void 0);Ir=d([B({type:N.Choice})],Ir);let Tl=class extends Ir{};Tl=d([B({type:N.Choice})],Tl);var Ro;const Po=`${qt}.31`;var rt;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(rt||(rt={}));class Yp extends xs{toJSON(){const e=[],t=this.toNumber();return t&rt.aACompromise&&e.push("aACompromise"),t&rt.affiliationChanged&&e.push("affiliationChanged"),t&rt.cACompromise&&e.push("cACompromise"),t&rt.certificateHold&&e.push("certificateHold"),t&rt.cessationOfOperation&&e.push("cessationOfOperation"),t&rt.keyCompromise&&e.push("keyCompromise"),t&rt.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&rt.superseded&&e.push("superseded"),t&rt.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let un=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,context:0,repeated:"sequence",implicit:!0})],un.prototype,"fullName",void 0);d([f({type:On,context:1,implicit:!0})],un.prototype,"nameRelativeToCRLIssuer",void 0);un=d([B({type:N.Choice})],un);class Kn{constructor(e={}){Object.assign(this,e)}}d([f({type:un,context:0,optional:!0})],Kn.prototype,"distributionPoint",void 0);d([f({type:Yp,context:1,optional:!0,implicit:!0})],Kn.prototype,"reasons",void 0);d([f({type:Q,context:2,optional:!0,repeated:"sequence",implicit:!0})],Kn.prototype,"cRLIssuer",void 0);let Cn=Ro=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ro.prototype)}};Cn=Ro=d([B({type:N.Sequence,itemType:Kn})],Cn);var Lo;let Rl=Lo=class extends Cn{constructor(e){super(e),Object.setPrototypeOf(this,Lo.prototype)}};Rl=Lo=d([B({type:N.Sequence,itemType:Kn})],Rl);class je{constructor(e={}){this.onlyContainsUserCerts=je.ONLY,this.onlyContainsCACerts=je.ONLY,this.indirectCRL=je.ONLY,this.onlyContainsAttributeCerts=je.ONLY,Object.assign(this,e)}}je.ONLY=!1;d([f({type:un,context:0,optional:!0})],je.prototype,"distributionPoint",void 0);d([f({type:y.Boolean,context:1,defaultValue:je.ONLY,implicit:!0})],je.prototype,"onlyContainsUserCerts",void 0);d([f({type:y.Boolean,context:2,defaultValue:je.ONLY,implicit:!0})],je.prototype,"onlyContainsCACerts",void 0);d([f({type:Yp,context:3,optional:!0,implicit:!0})],je.prototype,"onlySomeReasons",void 0);d([f({type:y.Boolean,context:4,defaultValue:je.ONLY,implicit:!0})],je.prototype,"indirectCRL",void 0);d([f({type:y.Boolean,context:5,defaultValue:je.ONLY,implicit:!0})],je.prototype,"onlyContainsAttributeCerts",void 0);var li;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(li||(li={}));let Uo=class{constructor(e=li.unspecified){this.reason=li.unspecified,this.reason=e}toJSON(){return li[this.reason]}toString(){return this.toJSON()}};d([f({type:y.Enumerated})],Uo.prototype,"reason",void 0);Uo=d([B({type:N.Choice})],Uo);var Vo;const Xp=`${qt}.37`;let Er=Vo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Vo.prototype)}};Er=Vo=d([B({type:N.Sequence,itemType:y.ObjectIdentifier})],Er);const __=`${qn}.1`,m_=`${qn}.2`,y_=`${qn}.3`,v_=`${qn}.4`,w_=`${qn}.8`,b_=`${qn}.9`;let Mo=class{constructor(e=new ArrayBuffer(0)){this.value=e}};d([f({type:y.Integer,converter:he})],Mo.prototype,"value",void 0);Mo=d([B({type:N.Choice})],Mo);let Ho=class{constructor(e){this.value=new Date,e&&(this.value=e)}};d([f({type:y.GeneralizedTime})],Ho.prototype,"value",void 0);Ho=d([B({type:N.Choice})],Ho);var Do;let Pl=Do=class extends Be{constructor(e){super(e),Object.setPrototypeOf(this,Do.prototype)}};Pl=Do=d([B({type:N.Sequence})],Pl);const Qp=`${qt}.15`;var st;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(st||(st={}));class oo extends xs{toJSON(){const e=this.toNumber(),t=[];return e&st.cRLSign&&t.push("crlSign"),e&st.dataEncipherment&&t.push("dataEncipherment"),e&st.decipherOnly&&t.push("decipherOnly"),e&st.digitalSignature&&t.push("digitalSignature"),e&st.encipherOnly&&t.push("encipherOnly"),e&st.keyAgreement&&t.push("keyAgreement"),e&st.keyCertSign&&t.push("keyCertSign"),e&st.keyEncipherment&&t.push("keyEncipherment"),e&st.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Fo;class Es{constructor(e={}){this.base=new Q,this.minimum=0,Object.assign(this,e)}}d([f({type:Q})],Es.prototype,"base",void 0);d([f({type:y.Integer,context:0,defaultValue:0,implicit:!0})],Es.prototype,"minimum",void 0);d([f({type:y.Integer,context:1,optional:!0,implicit:!0})],Es.prototype,"maximum",void 0);let $r=Fo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Fo.prototype)}};$r=Fo=d([B({type:N.Sequence,itemType:Es})],$r);class ef{constructor(e={}){Object.assign(this,e)}}d([f({type:$r,context:0,optional:!0,implicit:!0})],ef.prototype,"permittedSubtrees",void 0);d([f({type:$r,context:1,optional:!0,implicit:!0})],ef.prototype,"excludedSubtrees",void 0);class tf{constructor(e={}){Object.assign(this,e)}}d([f({type:y.Integer,context:0,implicit:!0,optional:!0,converter:he})],tf.prototype,"requireExplicitPolicy",void 0);d([f({type:y.Integer,context:1,implicit:!0,optional:!0,converter:he})],tf.prototype,"inhibitPolicyMapping",void 0);var qo;class mc{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],mc.prototype,"issuerDomainPolicy",void 0);d([f({type:y.ObjectIdentifier})],mc.prototype,"subjectDomainPolicy",void 0);let Ll=qo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,qo.prototype)}};Ll=qo=d([B({type:N.Sequence,itemType:mc})],Ll);var Ko;const nf=`${qt}.17`;let Wo=Ko=class extends Be{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};Wo=Ko=d([B({type:N.Sequence})],Wo);let Et=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Et.prototype,"type",void 0);d([f({type:y.Any,repeated:"set"})],Et.prototype,"values",void 0);var Go;let Ul=Go=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Go.prototype)}};Ul=Go=d([B({type:N.Sequence,itemType:Et})],Ul);const rf=`${qt}.14`;class Lt extends fc{}class sf{constructor(e={}){Object.assign(this,e)}}d([f({type:y.GeneralizedTime,context:0,implicit:!0,optional:!0})],sf.prototype,"notBefore",void 0);d([f({type:y.GeneralizedTime,context:1,implicit:!0,optional:!0})],sf.prototype,"notAfter",void 0);var ui;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(ui||(ui={}));class of extends xs{toJSON(){const e=[],t=this.toNumber();return t&ui.pKIXCertificate&&e.push("pKIXCertificate"),t&ui.newExtensions&&e.push("newExtensions"),t&ui.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class af{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new of,Object.assign(this,e)}}d([f({type:y.GeneralString})],af.prototype,"entrustVers",void 0);d([f({type:of})],af.prototype,"entrustInfoFlags",void 0);var Jo;let Vl=Jo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Jo.prototype)}};Vl=Jo=d([B({type:N.Sequence,itemType:Oi})],Vl);class H{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof H&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Kd(e.parameters,this.parameters)||e.parameters===this.parameters)}}d([f({type:y.ObjectIdentifier})],H.prototype,"algorithm",void 0);d([f({type:y.Any,optional:!0})],H.prototype,"parameters",void 0);class ot{constructor(e={}){this.algorithm=new H,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:H})],ot.prototype,"algorithm",void 0);d([f({type:y.BitString})],ot.prototype,"subjectPublicKey",void 0);let Ee=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};d([f({type:y.UTCTime})],Ee.prototype,"utcTime",void 0);d([f({type:y.GeneralizedTime})],Ee.prototype,"generalTime",void 0);Ee=d([B({type:N.Choice})],Ee);class Bi{constructor(e){this.notBefore=new Ee(new Date),this.notAfter=new Ee(new Date),e&&(this.notBefore=new Ee(e.notBefore),this.notAfter=new Ee(e.notAfter))}}d([f({type:Ee})],Bi.prototype,"notBefore",void 0);d([f({type:Ee})],Bi.prototype,"notAfter",void 0);var Zo;let Xe=class cf{constructor(e={}){this.extnID="",this.critical=cf.CRITICAL,this.extnValue=new re,Object.assign(this,e)}};Xe.CRITICAL=!1;d([f({type:y.ObjectIdentifier})],Xe.prototype,"extnID",void 0);d([f({type:y.Boolean,defaultValue:Xe.CRITICAL})],Xe.prototype,"critical",void 0);d([f({type:re})],Xe.prototype,"extnValue",void 0);let Mt=Zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};Mt=Zo=d([B({type:N.Sequence,itemType:Xe})],Mt);var dn;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(dn||(dn={}));class Ge{constructor(e={}){this.version=dn.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new H,this.issuer=new ve,this.validity=new Bi,this.subject=new ve,this.subjectPublicKeyInfo=new ot,Object.assign(this,e)}}d([f({type:y.Integer,context:0,defaultValue:dn.v1})],Ge.prototype,"version",void 0);d([f({type:y.Integer,converter:he})],Ge.prototype,"serialNumber",void 0);d([f({type:H})],Ge.prototype,"signature",void 0);d([f({type:ve})],Ge.prototype,"issuer",void 0);d([f({type:Bi})],Ge.prototype,"validity",void 0);d([f({type:ve})],Ge.prototype,"subject",void 0);d([f({type:ot})],Ge.prototype,"subjectPublicKeyInfo",void 0);d([f({type:y.BitString,context:1,implicit:!0,optional:!0})],Ge.prototype,"issuerUniqueID",void 0);d([f({type:y.BitString,context:2,implicit:!0,optional:!0})],Ge.prototype,"subjectUniqueID",void 0);d([f({type:Mt,context:3,optional:!0})],Ge.prototype,"extensions",void 0);class pn{constructor(e={}){this.tbsCertificate=new Ge,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Ge})],pn.prototype,"tbsCertificate",void 0);d([f({type:H})],pn.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],pn.prototype,"signatureValue",void 0);class $s{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Ee,Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],$s.prototype,"userCertificate",void 0);d([f({type:Ee})],$s.prototype,"revocationDate",void 0);d([f({type:Xe,optional:!0,repeated:"sequence"})],$s.prototype,"crlEntryExtensions",void 0);class Ot{constructor(e={}){this.signature=new H,this.issuer=new ve,this.thisUpdate=new Ee,Object.assign(this,e)}}d([f({type:y.Integer,optional:!0})],Ot.prototype,"version",void 0);d([f({type:H})],Ot.prototype,"signature",void 0);d([f({type:ve})],Ot.prototype,"issuer",void 0);d([f({type:Ee})],Ot.prototype,"thisUpdate",void 0);d([f({type:Ee,optional:!0})],Ot.prototype,"nextUpdate",void 0);d([f({type:$s,repeated:"sequence",optional:!0})],Ot.prototype,"revokedCertificates",void 0);d([f({type:Xe,optional:!0,context:0,repeated:"sequence"})],Ot.prototype,"crlExtensions",void 0);class yc{constructor(e={}){this.tbsCertList=new Ot,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Ot})],yc.prototype,"tbsCertList",void 0);d([f({type:H})],yc.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],yc.prototype,"signature",void 0);class Wn{constructor(e={}){this.issuer=new ve,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:ve})],Wn.prototype,"issuer",void 0);d([f({type:y.Integer,converter:he})],Wn.prototype,"serialNumber",void 0);let Bn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Lt,context:0,implicit:!0})],Bn.prototype,"subjectKeyIdentifier",void 0);d([f({type:Wn})],Bn.prototype,"issuerAndSerialNumber",void 0);Bn=d([B({type:N.Choice})],Bn);var $t;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})($t||($t={}));let yi=class extends H{};yi=d([B({type:N.Sequence})],yi);let Cr=class extends H{};Cr=d([B({type:N.Sequence})],Cr);let mt=class extends H{};mt=d([B({type:N.Sequence})],mt);let zr=class extends H{};zr=d([B({type:N.Sequence})],zr);let Ml=class extends H{};Ml=d([B({type:N.Sequence})],Ml);let Yo=class extends H{};Yo=d([B({type:N.Sequence})],Yo);let Gn=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Gn.prototype,"attrType",void 0);d([f({type:y.Any,repeated:"set"})],Gn.prototype,"attrValues",void 0);var Xo;class wt{constructor(e={}){this.version=$t.v0,this.sid=new Bn,this.digestAlgorithm=new yi,this.signatureAlgorithm=new Cr,this.signature=new re,Object.assign(this,e)}}d([f({type:y.Integer})],wt.prototype,"version",void 0);d([f({type:Bn})],wt.prototype,"sid",void 0);d([f({type:yi})],wt.prototype,"digestAlgorithm",void 0);d([f({type:Gn,repeated:"set",context:0,implicit:!0,optional:!0})],wt.prototype,"signedAttrs",void 0);d([f({type:Cr})],wt.prototype,"signatureAlgorithm",void 0);d([f({type:re})],wt.prototype,"signature",void 0);d([f({type:Gn,repeated:"set",context:1,implicit:!0,optional:!0})],wt.prototype,"unsignedAttrs",void 0);let jr=Xo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Xo.prototype)}};jr=Xo=d([B({type:N.Set,itemType:wt})],jr);let Hl=class extends Ee{};Hl=d([B({type:N.Choice})],Hl);let Dl=class extends wt{};Dl=d([B({type:N.Sequence})],Dl);class vc{constructor(e={}){this.acIssuer=new Q,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}d([f({type:Q})],vc.prototype,"acIssuer",void 0);d([f({type:y.Integer})],vc.prototype,"acSerial",void 0);d([f({type:Et,repeated:"sequence"})],vc.prototype,"attrs",void 0);var Qo;let Nr=Qo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Qo.prototype)}};Nr=Qo=d([B({type:N.Sequence,itemType:y.ObjectIdentifier})],Nr);class Cs{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}d([f({type:y.Integer,optional:!0})],Cs.prototype,"pathLenConstraint",void 0);d([f({type:Nr,implicit:!0,context:0,optional:!0})],Cs.prototype,"permittedAttrs",void 0);d([f({type:Nr,implicit:!0,context:1,optional:!0})],Cs.prototype,"excludedAttrs",void 0);d([f({type:y.Boolean,defaultValue:!0})],Cs.prototype,"permitUnSpecified",void 0);class wn{constructor(e={}){this.issuer=new Be,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Be})],wn.prototype,"issuer",void 0);d([f({type:y.Integer,converter:he})],wn.prototype,"serial",void 0);d([f({type:y.BitString,optional:!0})],wn.prototype,"issuerUID",void 0);var ea;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(ea||(ea={}));class bn{constructor(e={}){this.digestedObjectType=ea.publicKey,this.digestAlgorithm=new H,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Enumerated})],bn.prototype,"digestedObjectType",void 0);d([f({type:y.ObjectIdentifier,optional:!0})],bn.prototype,"otherObjectTypeID",void 0);d([f({type:H})],bn.prototype,"digestAlgorithm",void 0);d([f({type:y.BitString})],bn.prototype,"objectDigest",void 0);class zs{constructor(e={}){Object.assign(this,e)}}d([f({type:Be,optional:!0})],zs.prototype,"issuerName",void 0);d([f({type:wn,context:0,implicit:!0,optional:!0})],zs.prototype,"baseCertificateID",void 0);d([f({type:bn,context:1,implicit:!0,optional:!0})],zs.prototype,"objectDigestInfo",void 0);let Tn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,repeated:"sequence"})],Tn.prototype,"v1Form",void 0);d([f({type:zs,context:0,implicit:!0})],Tn.prototype,"v2Form",void 0);Tn=d([B({type:N.Choice})],Tn);class js{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}d([f({type:y.GeneralizedTime})],js.prototype,"notBeforeTime",void 0);d([f({type:y.GeneralizedTime})],js.prototype,"notAfterTime",void 0);class Ti{constructor(e={}){Object.assign(this,e)}}d([f({type:wn,implicit:!0,context:0,optional:!0})],Ti.prototype,"baseCertificateID",void 0);d([f({type:Be,implicit:!0,context:1,optional:!0})],Ti.prototype,"entityName",void 0);d([f({type:bn,implicit:!0,context:2,optional:!0})],Ti.prototype,"objectDigestInfo",void 0);var ta;(function(n){n[n.v2=1]="v2"})(ta||(ta={}));class lt{constructor(e={}){this.version=ta.v2,this.holder=new Ti,this.issuer=new Tn,this.signature=new H,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new js,this.attributes=[],Object.assign(this,e)}}d([f({type:y.Integer})],lt.prototype,"version",void 0);d([f({type:Ti})],lt.prototype,"holder",void 0);d([f({type:Tn})],lt.prototype,"issuer",void 0);d([f({type:H})],lt.prototype,"signature",void 0);d([f({type:y.Integer,converter:he})],lt.prototype,"serialNumber",void 0);d([f({type:js})],lt.prototype,"attrCertValidityPeriod",void 0);d([f({type:Et,repeated:"sequence"})],lt.prototype,"attributes",void 0);d([f({type:y.BitString,optional:!0})],lt.prototype,"issuerUniqueID",void 0);d([f({type:Mt,optional:!0})],lt.prototype,"extensions",void 0);class Ns{constructor(e={}){this.acinfo=new lt,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:lt})],Ns.prototype,"acinfo",void 0);d([f({type:H})],Ns.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],Ns.prototype,"signatureValue",void 0);var Or;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(Or||(Or={}));class na extends xs{}class wc{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier,implicit:!0,context:0})],wc.prototype,"type",void 0);d([f({type:y.Any,implicit:!0,context:1})],wc.prototype,"value",void 0);class bc{constructor(e={}){this.policyId="",this.classList=new na(Or.unclassified),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],bc.prototype,"policyId",void 0);d([f({type:na,defaultValue:new na(Or.unclassified)})],bc.prototype,"classList",void 0);d([f({type:wc,repeated:"set"})],bc.prototype,"securityCategories",void 0);class Os{constructor(e={}){Object.assign(this,e)}}d([f({type:re})],Os.prototype,"cotets",void 0);d([f({type:y.ObjectIdentifier})],Os.prototype,"oid",void 0);d([f({type:y.Utf8String})],Os.prototype,"string",void 0);class lf{constructor(e={}){this.values=[],Object.assign(this,e)}}d([f({type:Be,implicit:!0,context:0,optional:!0})],lf.prototype,"policyAuthority",void 0);d([f({type:Os,repeated:"sequence"})],lf.prototype,"values",void 0);var ia;class Bs{constructor(e={}){this.targetCertificate=new wn,Object.assign(this,e)}}d([f({type:wn})],Bs.prototype,"targetCertificate",void 0);d([f({type:Q,optional:!0})],Bs.prototype,"targetName",void 0);d([f({type:bn,optional:!0})],Bs.prototype,"certDigestInfo",void 0);let Rn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,context:0,implicit:!0})],Rn.prototype,"targetName",void 0);d([f({type:Q,context:1,implicit:!0})],Rn.prototype,"targetGroup",void 0);d([f({type:Bs,context:2,implicit:!0})],Rn.prototype,"targetCert",void 0);Rn=d([B({type:N.Choice})],Rn);let ra=ia=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ia.prototype)}};ra=ia=d([B({type:N.Sequence,itemType:Rn})],ra);var sa;let Fl=sa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,sa.prototype)}};Fl=sa=d([B({type:N.Sequence,itemType:ra})],Fl);class uf{constructor(e={}){Object.assign(this,e)}}d([f({type:Be,implicit:!0,context:0,optional:!0})],uf.prototype,"roleAuthority",void 0);d([f({type:Q,implicit:!0,context:1})],uf.prototype,"roleName",void 0);class kc{constructor(e={}){this.service=new Q,this.ident=new Q,Object.assign(this,e)}}d([f({type:Q})],kc.prototype,"service",void 0);d([f({type:Q})],kc.prototype,"ident",void 0);d([f({type:re,optional:!0})],kc.prototype,"authInfo",void 0);var oa;class xc{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],xc.prototype,"otherCertFormat",void 0);d([f({type:y.Any})],xc.prototype,"otherCert",void 0);let Pn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:pn})],Pn.prototype,"certificate",void 0);d([f({type:Ns,context:2,implicit:!0})],Pn.prototype,"v2AttrCert",void 0);d([f({type:xc,context:3,implicit:!0})],Pn.prototype,"other",void 0);Pn=d([B({type:N.Choice})],Pn);let Br=oa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,oa.prototype)}};Br=oa=d([B({type:N.Set,itemType:Pn})],Br);class Jn{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Jn.prototype,"contentType",void 0);d([f({type:y.Any,context:0})],Jn.prototype,"content",void 0);let vi=class{constructor(e={}){Object.assign(this,e)}};d([f({type:re})],vi.prototype,"single",void 0);d([f({type:y.Any})],vi.prototype,"any",void 0);vi=d([B({type:N.Choice})],vi);class Ts{constructor(e={}){this.eContentType="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ts.prototype,"eContentType",void 0);d([f({type:vi,context:0,optional:!0})],Ts.prototype,"eContent",void 0);let wi=class{constructor(e={}){Object.assign(this,e)}};d([f({type:re,context:0,implicit:!0,optional:!0})],wi.prototype,"value",void 0);d([f({type:re,converter:Zg,context:0,implicit:!0,optional:!0,repeated:"sequence"})],wi.prototype,"constructedValue",void 0);wi=d([B({type:N.Choice})],wi);class Ri{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new zr,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ri.prototype,"contentType",void 0);d([f({type:zr})],Ri.prototype,"contentEncryptionAlgorithm",void 0);d([f({type:wi,optional:!0})],Ri.prototype,"encryptedContent",void 0);class Rs{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Rs.prototype,"keyAttrId",void 0);d([f({type:y.Any,optional:!0})],Rs.prototype,"keyAttr",void 0);var aa;class Ps{constructor(e={}){this.subjectKeyIdentifier=new Lt,Object.assign(this,e)}}d([f({type:Lt})],Ps.prototype,"subjectKeyIdentifier",void 0);d([f({type:y.GeneralizedTime,optional:!0})],Ps.prototype,"date",void 0);d([f({type:Rs,optional:!0})],Ps.prototype,"other",void 0);let Ln=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Ps,context:0,implicit:!0,optional:!0})],Ln.prototype,"rKeyId",void 0);d([f({type:Wn,optional:!0})],Ln.prototype,"issuerAndSerialNumber",void 0);Ln=d([B({type:N.Choice})],Ln);class Sc{constructor(e={}){this.rid=new Ln,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:Ln})],Sc.prototype,"rid",void 0);d([f({type:re})],Sc.prototype,"encryptedKey",void 0);let Tr=aa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,aa.prototype)}};Tr=aa=d([B({type:N.Sequence,itemType:Sc})],Tr);class Ac{constructor(e={}){this.algorithm=new H,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:H})],Ac.prototype,"algorithm",void 0);d([f({type:y.BitString})],Ac.prototype,"publicKey",void 0);let fn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Lt,context:0,implicit:!0,optional:!0})],fn.prototype,"subjectKeyIdentifier",void 0);d([f({type:Ac,context:1,implicit:!0,optional:!0})],fn.prototype,"originatorKey",void 0);d([f({type:Wn,optional:!0})],fn.prototype,"issuerAndSerialNumber",void 0);fn=d([B({type:N.Choice})],fn);class Zn{constructor(e={}){this.version=$t.v3,this.originator=new fn,this.keyEncryptionAlgorithm=new mt,this.recipientEncryptedKeys=new Tr,Object.assign(this,e)}}d([f({type:y.Integer})],Zn.prototype,"version",void 0);d([f({type:fn,context:0})],Zn.prototype,"originator",void 0);d([f({type:re,context:1,optional:!0})],Zn.prototype,"ukm",void 0);d([f({type:mt})],Zn.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:Tr})],Zn.prototype,"recipientEncryptedKeys",void 0);let Un=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Lt,context:0,implicit:!0})],Un.prototype,"subjectKeyIdentifier",void 0);d([f({type:Wn})],Un.prototype,"issuerAndSerialNumber",void 0);Un=d([B({type:N.Choice})],Un);class Pi{constructor(e={}){this.version=$t.v0,this.rid=new Un,this.keyEncryptionAlgorithm=new mt,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Pi.prototype,"version",void 0);d([f({type:Un})],Pi.prototype,"rid",void 0);d([f({type:mt})],Pi.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Pi.prototype,"encryptedKey",void 0);class Li{constructor(e={}){this.keyIdentifier=new re,Object.assign(this,e)}}d([f({type:re})],Li.prototype,"keyIdentifier",void 0);d([f({type:y.GeneralizedTime,optional:!0})],Li.prototype,"date",void 0);d([f({type:Rs,optional:!0})],Li.prototype,"other",void 0);class Ui{constructor(e={}){this.version=$t.v4,this.kekid=new Li,this.keyEncryptionAlgorithm=new mt,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Ui.prototype,"version",void 0);d([f({type:Li})],Ui.prototype,"kekid",void 0);d([f({type:mt})],Ui.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Ui.prototype,"encryptedKey",void 0);class Vi{constructor(e={}){this.version=$t.v0,this.keyEncryptionAlgorithm=new mt,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Vi.prototype,"version",void 0);d([f({type:Yo,context:0,optional:!0})],Vi.prototype,"keyDerivationAlgorithm",void 0);d([f({type:mt})],Vi.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Vi.prototype,"encryptedKey",void 0);class Ic{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ic.prototype,"oriType",void 0);d([f({type:y.Any})],Ic.prototype,"oriValue",void 0);let Ht=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Pi,optional:!0})],Ht.prototype,"ktri",void 0);d([f({type:Zn,context:1,implicit:!0,optional:!0})],Ht.prototype,"kari",void 0);d([f({type:Ui,context:2,implicit:!0,optional:!0})],Ht.prototype,"kekri",void 0);d([f({type:Vi,context:3,implicit:!0,optional:!0})],Ht.prototype,"pwri",void 0);d([f({type:Ic,context:4,implicit:!0,optional:!0})],Ht.prototype,"ori",void 0);Ht=d([B({type:N.Choice})],Ht);var ca;let Rr=ca=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ca.prototype)}};Rr=ca=d([B({type:N.Set,itemType:Ht})],Rr);var la;class Ls{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ls.prototype,"otherRevInfoFormat",void 0);d([f({type:y.Any})],Ls.prototype,"otherRevInfo",void 0);let Pr=class{constructor(e={}){this.other=new Ls,Object.assign(this,e)}};d([f({type:Ls,context:1,implicit:!0})],Pr.prototype,"other",void 0);Pr=d([B({type:N.Choice})],Pr);let Lr=la=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,la.prototype)}};Lr=la=d([B({type:N.Set,itemType:Pr})],Lr);class Ec{constructor(e={}){Object.assign(this,e)}}d([f({type:Br,context:0,implicit:!0,optional:!0})],Ec.prototype,"certs",void 0);d([f({type:Lr,context:1,implicit:!0,optional:!0})],Ec.prototype,"crls",void 0);var ua;let da=ua=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ua.prototype)}};da=ua=d([B({type:N.Set,itemType:Gn})],da);class Mi{constructor(e={}){this.version=$t.v0,this.recipientInfos=new Rr,this.encryptedContentInfo=new Ri,Object.assign(this,e)}}d([f({type:y.Integer})],Mi.prototype,"version",void 0);d([f({type:Ec,context:0,implicit:!0,optional:!0})],Mi.prototype,"originatorInfo",void 0);d([f({type:Rr})],Mi.prototype,"recipientInfos",void 0);d([f({type:Ri})],Mi.prototype,"encryptedContentInfo",void 0);d([f({type:da,context:1,implicit:!0,optional:!0})],Mi.prototype,"unprotectedAttrs",void 0);const k_="1.2.840.113549.1.7.2";var pa;let Ur=pa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,pa.prototype)}};Ur=pa=d([B({type:N.Set,itemType:yi})],Ur);class Yn{constructor(e={}){this.version=$t.v0,this.digestAlgorithms=new Ur,this.encapContentInfo=new Ts,this.signerInfos=new jr,Object.assign(this,e)}}d([f({type:y.Integer})],Yn.prototype,"version",void 0);d([f({type:Ur})],Yn.prototype,"digestAlgorithms",void 0);d([f({type:Ts})],Yn.prototype,"encapContentInfo",void 0);d([f({type:Br,context:0,implicit:!0,optional:!0})],Yn.prototype,"certificates",void 0);d([f({type:Lr,context:1,implicit:!0,optional:!0})],Yn.prototype,"crls",void 0);d([f({type:jr})],Yn.prototype,"signerInfos",void 0);const bi="1.2.840.10045.2.1",$c="1.2.840.10045.4.1",df="1.2.840.10045.4.3.1",Cc="1.2.840.10045.4.3.2",zc="1.2.840.10045.4.3.3",jc="1.2.840.10045.4.3.4",ql="1.2.840.10045.3.1.7",Kl="1.3.132.0.34",Wl="1.3.132.0.35";function Hi(n){return new H({algorithm:n})}const x_=Hi($c);Hi(df);const S_=Hi(Cc),A_=Hi(zc),I_=Hi(jc);let ki=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],ki.prototype,"fieldType",void 0);d([f({type:y.Any})],ki.prototype,"parameters",void 0);ki=d([B({type:N.Sequence})],ki);class E_ extends re{}let Vn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.OctetString})],Vn.prototype,"a",void 0);d([f({type:y.OctetString})],Vn.prototype,"b",void 0);d([f({type:y.BitString,optional:!0})],Vn.prototype,"seed",void 0);Vn=d([B({type:N.Sequence})],Vn);var fa;(function(n){n[n.ecpVer1=1]="ecpVer1"})(fa||(fa={}));let Ct=class{constructor(e={}){this.version=fa.ecpVer1,Object.assign(this,e)}};d([f({type:y.Integer})],Ct.prototype,"version",void 0);d([f({type:ki})],Ct.prototype,"fieldID",void 0);d([f({type:Vn})],Ct.prototype,"curve",void 0);d([f({type:E_})],Ct.prototype,"base",void 0);d([f({type:y.Integer,converter:he})],Ct.prototype,"order",void 0);d([f({type:y.Integer,optional:!0})],Ct.prototype,"cofactor",void 0);Ct=d([B({type:N.Sequence})],Ct);let Dt=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Dt.prototype,"namedCurve",void 0);d([f({type:y.Null})],Dt.prototype,"implicitCurve",void 0);d([f({type:Ct})],Dt.prototype,"specifiedCurve",void 0);Dt=d([B({type:N.Choice})],Dt);class Us{constructor(e={}){this.version=1,this.privateKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Us.prototype,"version",void 0);d([f({type:re})],Us.prototype,"privateKey",void 0);d([f({type:Dt,context:0,optional:!0})],Us.prototype,"parameters",void 0);d([f({type:y.BitString,context:1,optional:!0})],Us.prototype,"publicKey",void 0);class Vr{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Vr.prototype,"r",void 0);d([f({type:y.Integer,converter:he})],Vr.prototype,"s",void 0);const He="1.2.840.113549.1.1",hn=`${He}.1`,$_=`${He}.7`,C_=`${He}.9`,di=`${He}.10`,z_=`${He}.2`,j_=`${He}.4`,Mr=`${He}.5`,N_=`${He}.14`,ha=`${He}.11`,Hr=`${He}.12`,Dr=`${He}.13`,pf=`${He}.15`,ff=`${He}.16`,Fr="1.3.14.3.2.26",hf="2.16.840.1.101.3.4.2.4",qr="2.16.840.1.101.3.4.2.1",Kr="2.16.840.1.101.3.4.2.2",Wr="2.16.840.1.101.3.4.2.3",O_="2.16.840.1.101.3.4.2.5",B_="2.16.840.1.101.3.4.2.6",T_="1.2.840.113549.2.2",R_="1.2.840.113549.2.5",Vs=`${He}.8`;function xe(n){return new H({algorithm:n,parameters:null})}xe(T_);xe(R_);const gn=xe(Fr);xe(hf);xe(qr);xe(Kr);xe(Wr);xe(O_);xe(B_);const gf=new H({algorithm:Vs,parameters:L.serialize(gn)}),_f=new H({algorithm:C_,parameters:L.serialize(kr.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});xe(hn);xe(z_);xe(j_);xe(Mr);xe(pf);xe(ff);xe(Hr);xe(Dr);xe(pf);xe(ff);class Ms{constructor(e={}){this.hashAlgorithm=new H(gn),this.maskGenAlgorithm=new H({algorithm:Vs,parameters:L.serialize(gn)}),this.pSourceAlgorithm=new H(_f),Object.assign(this,e)}}d([f({type:H,context:0,defaultValue:gn})],Ms.prototype,"hashAlgorithm",void 0);d([f({type:H,context:1,defaultValue:gf})],Ms.prototype,"maskGenAlgorithm",void 0);d([f({type:H,context:2,defaultValue:_f})],Ms.prototype,"pSourceAlgorithm",void 0);new H({algorithm:$_,parameters:L.serialize(new Ms)});class _n{constructor(e={}){this.hashAlgorithm=new H(gn),this.maskGenAlgorithm=new H({algorithm:Vs,parameters:L.serialize(gn)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}d([f({type:H,context:0,defaultValue:gn})],_n.prototype,"hashAlgorithm",void 0);d([f({type:H,context:1,defaultValue:gf})],_n.prototype,"maskGenAlgorithm",void 0);d([f({type:y.Integer,context:2,defaultValue:20})],_n.prototype,"saltLength",void 0);d([f({type:y.Integer,context:3,defaultValue:1})],_n.prototype,"trailerField",void 0);new H({algorithm:di,parameters:L.serialize(new _n)});class Hs{constructor(e={}){this.digestAlgorithm=new H,this.digest=new re,Object.assign(this,e)}}d([f({type:H})],Hs.prototype,"digestAlgorithm",void 0);d([f({type:re})],Hs.prototype,"digest",void 0);var ga;class Ds{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Ds.prototype,"prime",void 0);d([f({type:y.Integer,converter:he})],Ds.prototype,"exponent",void 0);d([f({type:y.Integer,converter:he})],Ds.prototype,"coefficient",void 0);let _a=ga=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ga.prototype)}};_a=ga=d([B({type:N.Sequence,itemType:Ds})],_a);class bt{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer})],bt.prototype,"version",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"modulus",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"publicExponent",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"privateExponent",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"prime1",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"prime2",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"exponent1",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"exponent2",void 0);d([f({type:y.Integer,converter:he})],bt.prototype,"coefficient",void 0);d([f({type:_a,optional:!0})],bt.prototype,"otherPrimeInfos",void 0);class Nc{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Nc.prototype,"modulus",void 0);d([f({type:y.Integer,converter:he})],Nc.prototype,"publicExponent",void 0);var ma;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ma||(ma={}));const Pe=ma;/*! *****************************************************************************
79
+ `)}`:`${t} :`}}tp=Ve;D.Constructed=tp;Ve.NAME="CONSTRUCTED";class np extends Re{fromBER(e,t,i){return t}toBER(e){return lt}}np.override="EndOfContentValueBlock";var ip;class ec extends $e{constructor(e={}){super(e,np),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}ip=ec;D.EndOfContent=ip;ec.NAME=_i;var rp;class cn extends $e{constructor(e={}){super(e,Re),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const r=new Uint8Array(i);r[0]=5,r[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}rp=cn;D.Null=rp;cn.NAME="NULL";class sp extends wt(Re){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=U.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const r=U.toUint8Array(e);return jt(this,r,t,i)?(this.valueHexView=r.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Wd.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}sp.NAME="BooleanValueBlock";var op;class us extends $e{constructor(e={}){super(e,sp),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}op=us;D.Boolean=op;us.NAME="BOOLEAN";class ap extends wt(Pt){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=Pt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(let s=0;s<this.value.length;s++){const a=this.value[s].constructor.NAME;if(a===_i){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==Gd)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,i),this.blockLength=i;return r}toBER(e,t){return this.isConstructed?Pt.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}ap.NAME="OctetStringValueBlock";var cp;let nn=class lp extends $e{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},ap),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const a=qn(s,0,s.byteLength);a.offset!==-1&&a.offset===i&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Ve.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${W.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof lp&&e.push(t.valueBlock.valueHexView);return U.concat(e)}};cp=nn;D.OctetString=cp;nn.NAME=Gd;class up extends wt(Pt){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let r=-1;if(this.isConstructed){if(r=Pt.prototype.fromBER.call(this,e,t,i),r===-1)return r;for(const c of this.value){const l=c.constructor.NAME;if(l===_i){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(l!==Jd)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const u=c.valueBlock;if(this.unusedBits>0&&u.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=u.unusedBits}return r}const s=U.toUint8Array(e);if(!jt(this,s,t,i))return-1;const a=s.subarray(t,t+i);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=a.subarray(1);try{if(c.byteLength){const l=qn(c,0,c.byteLength);l.offset!==-1&&l.offset===i-1&&(this.value=[l.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+i}toBER(e,t){if(this.isConstructed)return Pt.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return lt;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}up.NAME="BitStringValueBlock";var dp;let rn=class extends $e{constructor({idBlock:e={},lenBlock:t={},...i}={}){var r,s;(r=i.isConstructed)!==null&&r!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},up),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ve.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const r of t)e.push(r.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};dp=rn;D.BitString=dp;rn.NAME=Jd;var pp;function Mg(n,e){const t=new Uint8Array([0]),i=new Uint8Array(n),r=new Uint8Array(e);let s=i.slice(0);const a=s.length-1,c=r.slice(0),l=c.length-1;let u=0;const p=l<a?a:l;let g=0;for(let _=p;_>=0;_--,g++){switch(!0){case g<c.length:u=s[a-g]+c[l-g]+t[0];break;default:u=s[a-g]+t[0]}switch(t[0]=u/10,!0){case g>=s.length:s=So(new Uint8Array([u%10]),s);break;default:s[a-g]=u%10}}return t[0]>0&&(s=So(t,s)),s}function Il(n){if(n>=ii.length)for(let e=ii.length;e<=n;e++){const t=new Uint8Array([0]);let i=ii[e-1].slice(0);for(let r=i.length-1;r>=0;r--){const s=new Uint8Array([(i[r]<<1)+t[0]]);t[0]=s[0]/10,i[r]=s[0]%10}t[0]>0&&(i=So(t,i)),ii.push(i)}return ii[n]}function Hg(n,e){let t=0;const i=new Uint8Array(n),r=new Uint8Array(e),s=i.slice(0),a=s.length-1,c=r.slice(0),l=c.length-1;let u,p=0;for(let g=l;g>=0;g--,p++)switch(u=s[a-p]-c[l-p]-t,!0){case u<0:t=1,s[a-p]=u+10;break;default:t=0,s[a-p]=u}if(t>0)for(let g=a-l+1;g>=0;g--,p++)if(u=s[a-p]-t,u<0)t=1,s[a-p]=u+10;else{t=0,s[a-p]=u;break}return s.slice()}class tc extends wt(Re){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=Wd.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array($g(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,r=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const a=this.valueHexView;return a[0]===0&&a[1]&128?this.valueHexView=a.subarray(1):r!==0&&a.length<r&&(r-a.length>1&&(r=a.length+1),this.valueHexView=a.subarray(r-a.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const r=super.fromBER(e,t,i);return r===-1||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,r;const s=this.valueHexView;let a="",c=!1;for(let l=s.byteLength-1;l>=0;l--){r=s[l];for(let u=0;u<8;u++){if((r&1)===1)switch(i){case e:t=Hg(Il(i),t),a="-";break;default:t=Mg(t,Il(i))}i++,r>>=1}}for(let l=0;l<t.length;l++)t[l]&&(c=!0),c&&(a+=Sl.charAt(t[l]));return c===!1&&(a+=Sl.charAt(0)),a}}pp=tc;tc.NAME="IntegerValueBlock";Object.defineProperty(pp.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var fp;class mt extends $e{constructor(e={}){super(e,tc),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return wr(),BigInt(this.valueBlock.toString())}static fromBigInt(e){wr();const t=BigInt(e),i=new cs,r=t.toString(16).replace(/^-/,""),s=new Uint8Array(W.FromHex(r));if(t<0){const c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;const u=BigInt(`0x${W.ToHex(c)}`)+t,p=U.toUint8Array(W.FromHex(u.toString(16)));p[0]|=128,i.write(p)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new mt({valueHex:i.final()})}convertToDER(){const e=new mt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new mt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}fp=mt;D.Integer=fp;mt.NAME="INTEGER";var hp;class ds extends mt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}hp=ds;D.Enumerated=hp;ds.NAME="ENUMERATED";class Ao extends wt(Re){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=jn(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){wr();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let r=0;r<i.length;r++)i[r]=parseInt(t.slice(r*7,r*7+7),2)+(r+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=r[a]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=an(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",lt;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)i[a]=r[a]|128;i[s]=r[s]}return i}toString(){let e="";if(this.isHexOnly)e=W.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}Ao.NAME="sidBlock";class gp extends Re{constructor({value:e=Ue,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new Ao;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(e);if(r.byteLength===0)return this.error=this.value[i].error,lt;t.push(r)}return Xa(t)}fromString(e){this.value=[];let t=0,i=0,r="",s=!1;do if(i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1,s){const a=this.value[0];let c=0;switch(a.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const l=parseInt(r,10);if(isNaN(l))return;a.valueDec=l+c,s=!1}else{const a=new Ao;if(r>Number.MAX_SAFE_INTEGER){wr();const c=BigInt(r);a.valueBigInt=c}else if(a.valueDec=parseInt(r,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,s=!0),this.value.push(a)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t?(r=`{${r}}`,this.value[i].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}gp.NAME="ObjectIdentifierValueBlock";var _p;class ps extends $e{constructor(e={}){super(e,gp),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_p=ps;D.ObjectIdentifier=_p;ps.NAME="OBJECT IDENTIFIER";class Io extends wt(vn){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const r=U.toUint8Array(e);if(!jt(this,r,t,i))return-1;const s=r.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=s[c]&127,this.blockLength++,!!(s[c]&128));c++);const a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,s[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=jn(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const r=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=r[a]|128;return s[this.blockLength-1]=r[this.blockLength-1],s.buffer}const t=an(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",lt;const i=new Uint8Array(t.byteLength);if(!e){const r=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)i[a]=r[a]|128;i[s]=r[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=W.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Io.NAME="relativeSidBlock";class mp extends Re{constructor({value:e=Ue,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let r=t;for(;i>0;){const s=new Io;if(r=s.fromBER(e,r,i),r===-1)return this.blockLength=0,this.error=s.error,r;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return r}toBER(e,t){const i=[];for(let r=0;r<this.value.length;r++){const s=this.value[r].toBER(e);if(s.byteLength===0)return this.error=this.value[r].error,lt;i.push(s)}return Xa(i)}fromString(e){this.value=[];let t=0,i=0,r="";do{i=e.indexOf(".",t),i===-1?r=e.substring(t):r=e.substring(t,i),t=i+1;const s=new Io;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let r=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(r=`{${r}}`),e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}mp.NAME="RelativeObjectIdentifierValueBlock";var yp;class nc extends $e{constructor(e={}){super(e,mp),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}yp=nc;D.RelativeObjectIdentifier=yp;nc.NAME="RelativeObjectIdentifier";var vp;class St extends Ve{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}vp=St;D.Sequence=vp;St.NAME="SEQUENCE";var wp;let At=class extends Ve{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};wp=At;D.Set=wp;At.NAME="SET";class bp extends wt(Re){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Ue}toJSON(){return{...super.toJSON(),value:this.value}}}bp.NAME="StringValueBlock";class kp extends bp{}kp.NAME="SimpleStringValueBlock";class Ge extends Qa{constructor({...e}={}){super(e,kp)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,U.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)i[r]=e.charCodeAt(r);this.valueBlock.value=e}}Ge.NAME="SIMPLE STRING";class xp extends Ge{fromBuffer(e){this.valueBlock.valueHexView=U.toUint8Array(e);try{this.valueBlock.value=W.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=W.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(W.FromUtf8String(e)),this.valueBlock.value=e}}xp.NAME="Utf8StringValueBlock";var Sp;class Nt extends xp{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Sp=Nt;D.Utf8String=Sp;Nt.NAME="UTF8String";class Ap extends Ge{fromBuffer(e){this.valueBlock.value=W.ToUtf16String(e),this.valueBlock.valueHexView=U.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(W.FromUtf16String(e))}}Ap.NAME="BmpStringValueBlock";var Ip;class fs extends Ap{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}Ip=fs;D.BmpString=Ip;fs.NAME="BMPString";class Ep extends Ge{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let r=0;r<i.length;r+=4)i[r]=i[r+3],i[r+1]=i[r+2],i[r+2]=0,i[r+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let r=0;r<t;r++){const s=an(e.charCodeAt(r),8),a=new Uint8Array(s);if(a.length>4)continue;const c=4-a.length;for(let l=a.length-1;l>=0;l--)i[r*4+l+c]=a[l]}this.valueBlock.value=e}}Ep.NAME="UniversalStringValueBlock";var zp;class hs extends Ep{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}zp=hs;D.UniversalString=zp;hs.NAME="UniversalString";var $p;class gs extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}$p=gs;D.NumericString=$p;gs.NAME="NumericString";var Cp;class _s extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Cp=_s;D.PrintableString=Cp;_s.NAME="PrintableString";var jp;class ms extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}jp=ms;D.TeletexString=jp;ms.NAME="TeletexString";var Np;class ys extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Np=ys;D.VideotexString=Np;ys.NAME="VideotexString";var Op;class vs extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Op=vs;D.IA5String=Op;vs.NAME="IA5String";var Bp;class ws extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Bp=ws;D.GraphicString=Bp;ws.NAME="GraphicString";var Tp;class ji extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Tp=ji;D.VisibleString=Tp;ji.NAME="VisibleString";var Rp;class bs extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Rp=bs;D.GeneralString=Rp;bs.NAME="GeneralString";var Pp;class ks extends Ge{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Pp=ks;D.CharacterString=Pp;ks.NAME="CharacterString";var Lp;class Ni extends ji{constructor({value:e,valueDate:t,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let r=0;r<e.length;r++)this.valueBlock.valueHexView[r]=e.charCodeAt(r)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,U.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const r=parseInt(i[1],10);r>=50?this.year=1900+r:this.year=2e3+r,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=Ke(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Ke(this.month,2),t[2]=Ke(this.day,2),t[3]=Ke(this.hour,2),t[4]=Ke(this.minute,2),t[5]=Ke(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Lp=Ni;D.UTCTime=Lp;Ni.NAME="UTCTime";var Up;class xs extends Ni{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",r="",s=0,a,c=0,l=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const g=new Number(e[e.length-1]);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let g=1,_=i.indexOf("+"),x="";if(_===-1&&(_=i.indexOf("-"),g=-1),_!==-1){if(x=i.substring(_+1),i=i.substring(0,_),x.length!==2&&x.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(x.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=g*h,x.length===4){if(h=parseInt(x.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");l=g*h}}}let u=i.indexOf(".");if(u===-1&&(u=i.indexOf(",")),u!==-1){const g=new Number(`0${i.substring(u)}`);if(isNaN(g.valueOf()))throw new Error("Wrong input string for conversion");s=g.valueOf(),r=i.substring(0,u)}else r=i;switch(!0){case r.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,u!==-1)throw new Error("Wrong input string for conversion");break;case r.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let g=60*s;this.minute=Math.floor(g),g=60*(g-this.minute),this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let g=60*s;this.second=Math.floor(g),g=1e3*(g-this.second),this.millisecond=Math.floor(g)}break;case r.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){const g=1e3*s;this.millisecond=Math.floor(g)}break;default:throw new Error("Wrong input string for conversion")}const p=a.exec(r);if(p===null)throw new Error("Wrong input string for conversion");for(let g=1;g<p.length;g++)switch(g){case 1:this.year=parseInt(p[g],10);break;case 2:this.month=parseInt(p[g],10);break;case 3:this.day=parseInt(p[g],10);break;case 4:this.hour=parseInt(p[g],10)+c;break;case 5:this.minute=parseInt(p[g],10)+l;break;case 6:this.second=parseInt(p[g],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const g=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=g.getUTCFullYear(),this.month=g.getUTCMonth(),this.day=g.getUTCDay(),this.hour=g.getUTCHours(),this.minute=g.getUTCMinutes(),this.second=g.getUTCSeconds(),this.millisecond=g.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(Ke(this.year,4)),t.push(Ke(this.month,2)),t.push(Ke(this.day,2)),t.push(Ke(this.hour,2)),t.push(Ke(this.minute,2)),t.push(Ke(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Ke(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Up=xs;D.GeneralizedTime=Up;xs.NAME="GeneralizedTime";var Vp;class ic extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Vp=ic;D.DATE=Vp;ic.NAME="DATE";var Mp;class rc extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}Mp=rc;D.TimeOfDay=Mp;rc.NAME="TimeOfDay";var Hp;class sc extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Hp=sc;D.DateTime=Hp;sc.NAME="DateTime";var Dp;class oc extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}Dp=oc;D.Duration=Dp;oc.NAME="Duration";var qp;class ac extends Nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}qp=ac;D.TIME=qp;ac.NAME="TIME";class ln{constructor({name:e=Ue,optional:t=!1}={}){this.name=e,this.optional=t}}class cc extends ln{constructor({value:e=[],...t}={}){super(t),this.value=e}}class br extends ln{constructor({value:e=new ln,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class Dg{constructor({data:e=ls}={}){this.dataView=U.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=U.toUint8Array(e)}fromBER(e,t,i){const r=t+i;return this.dataView=U.toUint8Array(e).subarray(t,r),r}toBER(e){return this.dataView.slice().buffer}}function Qt(n,e,t){if(t instanceof cc){for(let s=0;s<t.value.length;s++)if(Qt(n,e,t.value[s]).verified)return{verified:!0,result:n};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(oo)&&(s.name=t.name),s}}if(t instanceof ln)return t.hasOwnProperty(oo)&&(n[t.name]=e),{verified:!0,result:n};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Ng in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Rg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Pg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(Og)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(Bg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:n};if(t.idBlock.hasOwnProperty(Tg)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:n};if(!(jg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:n};if(t.idBlock.isHexOnly){if(!(Al in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(s.length!==a.length)return{verified:!1,result:n};for(let c=0;c<s.length;c++)if(s[c]!==a[1])return{verified:!1,result:n}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&(n[t.name]=e)),t instanceof D.Constructed){let s=0,a={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof br&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:n};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let l=!0;for(let u=0;u<t.valueBlock.value.length;u++)l=l&&(t.valueBlock.value[u].optional||!1);return l?{verified:!0,result:n}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&delete n[t.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let l=0;l<c;l++)if(l-s>=e.valueBlock.value.length){if(t.valueBlock.value[l].optional===!1){const u={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&(delete n[t.name],u.name=t.name)),u}}else if(t.valueBlock.value[0]instanceof br){if(a=Qt(n,e.valueBlock.value[l],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&delete n[t.name]),a;if(oo in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let u={};Lg in t.valueBlock.value[0]&&t.valueBlock.value[0].local?u=e:u=n,typeof u[t.valueBlock.value[0].name]>"u"&&(u[t.valueBlock.value[0].name]=[]),u[t.valueBlock.value[0].name].push(e.valueBlock.value[l])}}else if(a=Qt(n,e.valueBlock.value[l-s],t.valueBlock.value[l]),a.verified===!1)if(t.valueBlock.value[l].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&delete n[t.name]),a;if(a.verified===!1){const l={verified:!1,result:n};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&(delete n[t.name],l.name=t.name)),l}return{verified:!0,result:n}}if(t.primitiveSchema&&Al in e.valueBlock){const s=qn(e.valueBlock.valueHexView);if(s.offset===-1){const a={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ue),t.name&&(delete n[t.name],a.name=t.name)),a}return Qt(n,s.result,t.primitiveSchema)}return{verified:!0,result:n}}function qg(n,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=qn(U.toUint8Array(n));return t.offset===-1?{verified:!1,result:t.result}:Qt(t.result,t.result,e)}const Fp=Object.freeze(Object.defineProperty({__proto__:null,Any:ln,BaseBlock:$e,BaseStringBlock:Qa,BitString:rn,BmpString:fs,Boolean:us,CharacterString:ks,Choice:cc,Constructed:Ve,DATE:ic,DateTime:sc,Duration:oc,EndOfContent:ec,Enumerated:ds,GeneralString:bs,GeneralizedTime:xs,GraphicString:ws,HexBlock:wt,IA5String:vs,Integer:mt,Null:cn,NumericString:gs,ObjectIdentifier:ps,OctetString:nn,Primitive:Ci,PrintableString:_s,RawData:Dg,RelativeObjectIdentifier:nc,Repeated:br,Sequence:St,Set:At,TIME:ac,TeletexString:ms,TimeOfDay:rc,UTCTime:Ni,UniversalString:hs,Utf8String:Nt,ValueBlock:Re,VideotexString:ys,ViewWriter:cs,VisibleString:ji,compareSchema:Qt,fromBER:zn,verifySchema:qg},Symbol.toStringTag,{value:"Module"}));var N;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(N||(N={}));var y;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(y||(y={}));class Ss{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(U.isBufferSource(e))this.unusedBits=t,this.value=U.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof rn))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new rn({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new rn({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const r=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=r.buffer}}class re{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):U.isBufferSource(e)?this.buffer=U.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof nn))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new nn({valueHex:this.buffer})}toSchema(e){return new nn({name:e})}}const Fg={fromASN:n=>n instanceof cn?null:n.valueBeforeDecodeView,toASN:n=>{if(n===null)return new cn;const e=zn(n);if(e.result.error)throw new Error(e.result.error);return e.result}},Kg={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new mt({value:+n})},Wg={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new ds({value:n})},he={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new mt({valueHex:n})},Gg={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new rn({valueHex:n})},Jg={fromASN:n=>n.valueBlock.toString(),toASN:n=>new ps({value:n})},Zg={fromASN:n=>n.valueBlock.value,toASN:n=>new us({value:n})},kr={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new nn({valueHex:n})},Yg={fromASN:n=>new re(n.getValue()),toASN:n=>n.toASN()};function et(n){return{fromASN:e=>e.valueBlock.value,toASN:e=>new n({value:e})}}const Kp=et(Nt),Xg=et(fs),Qg=et(hs),e_=et(gs),t_=et(_s),n_=et(ms),i_=et(ys),r_=et(vs),s_=et(ws),o_=et(ji),a_=et(bs),c_=et(ks),l_={fromASN:n=>n.toDate(),toASN:n=>new Ni({valueDate:n})},u_={fromASN:n=>n.toDate(),toASN:n=>new xs({valueDate:n})},d_={fromASN:()=>null,toASN:()=>new cn};function lc(n){switch(n){case y.Any:return Fg;case y.BitString:return Gg;case y.BmpString:return Xg;case y.Boolean:return Zg;case y.CharacterString:return c_;case y.Enumerated:return Wg;case y.GeneralString:return a_;case y.GeneralizedTime:return u_;case y.GraphicString:return s_;case y.IA5String:return r_;case y.Integer:return Kg;case y.Null:return d_;case y.NumericString:return e_;case y.ObjectIdentifier:return Jg;case y.OctetString:return kr;case y.PrintableString:return t_;case y.TeletexString:return n_;case y.UTCTime:return l_;case y.UniversalString:return Qg;case y.Utf8String:return Kp;case y.VideotexString:return i_;case y.VisibleString:return o_;default:return null}}function xt(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:xt(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function Wp(n){var e;if(n){const t=Object.getPrototypeOf(n);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:Wp(t)}return!1}function p_(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const t=new Uint8Array(n),i=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)if(t[r]!==i[r])return!1;return!0}class f_{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:N.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),r=[];for(const s in i.items){const a=i.items[s],c=t?s:"";let l;if(typeof a.type=="number"){const p=y[a.type],g=Fp[p];if(!g)throw new Error(`Cannot get ASN1 class by name '${p}'`);l=new g({name:c})}else xt(a.type)?l=new a.type().toSchema(c):a.optional?this.get(a.type).type===N.Choice?l=new ln({name:c}):(l=this.create(a.type,!1),l.name=c):l=new ln({name:c});const u=!!a.optional||a.defaultValue!==void 0;if(a.repeated){l.name="";const p=a.repeated==="set"?At:St;l=new p({name:"",value:[new br({name:c,value:l})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||xt(a.type)){const p=a.repeated?Ve:Ci;r.push(new p({name:c,optional:u,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const p=!!a.repeated;let g=p?l:this.get(a.type,!0).schema;g="valueBlock"in g?g.valueBlock.value:g.value,r.push(new Ve({name:p?"":c,optional:u,idBlock:{tagClass:3,tagNumber:a.context},value:g}))}else r.push(new Ve({optional:u,idBlock:{tagClass:3,tagNumber:a.context},value:[l]}));else l.optional=u,r.push(l)}switch(i.type){case N.Sequence:return new St({value:r,name:""});case N.Set:return new At({value:r,name:""});case N.Choice:return new cc({value:r,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const Ze=new f_,B=n=>e=>{let t;Ze.has(e)?t=Ze.get(e):(t=Ze.createDefault(e),Ze.set(e,t)),Object.assign(t,n)},f=n=>(e,t)=>{let i;Ze.has(e.constructor)?i=Ze.get(e.constructor):(i=Ze.createDefault(e.constructor),Ze.set(e.constructor,i));const r=Object.assign({},n);if(typeof r.type=="number"&&!r.converter){const s=lc(n.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);r.converter=s}i.items[t]=r};class El extends Error{constructor(){super(...arguments),this.schemas=[]}}class h_{static parse(e,t){const i=zn(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(xt(t))return new t().fromASN(e);const r=Ze.get(t);Ze.cache(t);let s=r.schema;if(e.constructor===Ve&&r.type!==N.Choice){s=new Ve({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const l in r.items)delete e[l]}const a=Qt({},e,s);if(!a.verified)throw new El(`Data does not match to ${t.name} ASN1 schema. ${a.result.error}`);const c=new t;if(Wp(t)){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=r.itemType;if(typeof l=="number"){const u=lc(l);if(!u)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,p=>u.fromASN(p))}else return t.from(e.valueBlock.value,u=>this.fromASN(u,l))}for(const l in r.items){const u=a.result[l];if(!u)continue;const p=r.items[l],g=p.type;if(typeof g=="number"||xt(g)){const _=(i=p.converter)!==null&&i!==void 0?i:xt(g)?new g:null;if(!_)throw new Error("Converter is empty");if(p.repeated)if(p.implicit){const x=p.repeated==="sequence"?St:At,h=new x;h.valueBlock=u.valueBlock;const m=zn(h.toBER(!1));if(m.offset===-1)throw new Error(`Cannot parse the child item. ${m.result.error}`);if(!("value"in m.result.valueBlock&&Array.isArray(m.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const b=m.result.valueBlock.value;c[l]=Array.from(b,S=>_.fromASN(S))}else c[l]=Array.from(u,x=>_.fromASN(x));else{let x=u;if(p.implicit){let h;if(xt(g))h=new g().toSchema("");else{const m=y[g],b=Fp[m];if(!b)throw new Error(`Cannot get '${m}' class from asn1js module`);h=new b}h.valueBlock=x.valueBlock,x=zn(h.toBER(!1)).result}c[l]=_.fromASN(x)}}else if(p.repeated){if(!Array.isArray(u))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");c[l]=Array.from(u,_=>this.fromASN(_,g))}else c[l]=this.fromASN(u,g)}return c}catch(r){throw r instanceof El&&r.schemas.push(t.name),r}}}class uc{static serialize(e){return e instanceof $e?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&xt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Ze.get(t);Ze.cache(t);let r=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const a=lc(i.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);r=e.map(c=>a.toASN(c))}else r=e.map(a=>this.toAsnItem({type:i.itemType},"[]",t,a))}else for(const a in i.items){const c=i.items[a],l=e[a];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&p_(this.serialize(c.defaultValue),this.serialize(l)))continue;const u=uc.toAsnItem(c,a,t,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||xt(c.type))){const p={};p.valueHex=u instanceof cn?u.valueBeforeDecodeView:u.valueBlock.toBER(),r.push(new Ci({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...p}))}else r.push(new Ve({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:u.valueBlock.value}));else r.push(new Ve({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else c.repeated?r=r.concat(u):r.push(u)}let s;switch(i.type){case N.Sequence:s=new St({value:r});break;case N.Set:s=new At({value:r});break;case N.Choice:if(!r[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=r[0];break}return s}static toAsnItem(e,t,i,r){let s;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${t}' doesn't have converter for type ${y[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(r,u=>a.toASN(u)),l=e.repeated==="sequence"?St:At;s=new l({value:c})}else s=a.toASN(r)}else if(e.repeated){if(!Array.isArray(r))throw new TypeError("Parameter 'objProp' should be type of Array.");const a=Array.from(r,l=>this.toASN(l)),c=e.repeated==="sequence"?St:At;s=new c({value:a})}else s=this.toASN(r);return s}}class le extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class L{static serialize(e){return uc.serialize(e)}static parse(e,t){return h_.parse(e,t)}static toString(e){const t=U.isBufferSource(e)?U.toArrayBuffer(e):L.serialize(e),i=zn(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function d(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(r<3?a(s):r>3?a(e,t,s):a(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}var Gp={exports:{}};(function(n){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},r=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function u(h,m){if(h.indexOf("::")!==h.lastIndexOf("::"))return null;let b=0,S=-1,O=(h.match(l.zoneIndex)||[])[0],T,F;for(O&&(O=O.substring(1),h=h.replace(/%.+$/,""));(S=h.indexOf(":",S+1))>=0;)b++;if(h.substr(0,2)==="::"&&b--,h.substr(-2,2)==="::"&&b--,b>m)return null;for(F=m-b,T=":";F--;)T+="0:";return h=h.replace("::",T),h[0]===":"&&(h=h.slice(1)),h[h.length-1]===":"&&(h=h.slice(0,-1)),m=function(){const oe=h.split(":"),pe=[];for(let ce=0;ce<oe.length;ce++)pe.push(parseInt(oe[ce],16));return pe}(),{parts:m,zoneId:O}}function p(h,m,b,S){if(h.length!==m.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let O=0,T;for(;S>0;){if(T=b-S,T<0&&(T=0),h[O]>>T!==m[O]>>T)return!1;S-=b,O+=1}return!0}function g(h){if(s.test(h))return parseInt(h,16);if(h[0]==="0"&&!isNaN(parseInt(h[1],10))){if(r.test(h))return parseInt(h,8);throw new Error(`ipaddr: cannot parse ${h} as octal`)}return parseInt(h,10)}function _(h,m){for(;h.length<m;)h=`0${h}`;return h}const x={};x.IPv4=function(){function h(m){if(m.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let b,S;for(b=0;b<m.length;b++)if(S=m[b],!(0<=S&&S<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=m}return h.prototype.SpecialRanges={unspecified:[[new h([0,0,0,0]),8]],broadcast:[[new h([255,255,255,255]),32]],multicast:[[new h([224,0,0,0]),4]],linkLocal:[[new h([169,254,0,0]),16]],loopback:[[new h([127,0,0,0]),8]],carrierGradeNat:[[new h([100,64,0,0]),10]],private:[[new h([10,0,0,0]),8],[new h([172,16,0,0]),12],[new h([192,168,0,0]),16]],reserved:[[new h([192,0,0,0]),24],[new h([192,0,2,0]),24],[new h([192,88,99,0]),24],[new h([198,18,0,0]),15],[new h([198,51,100,0]),24],[new h([203,0,113,0]),24],[new h([240,0,0,0]),4]],as112:[[new h([192,175,48,0]),24],[new h([192,31,196,0]),24]],amt:[[new h([192,52,193,0]),24]]},h.prototype.kind=function(){return"ipv4"},h.prototype.match=function(m,b){let S;if(b===void 0&&(S=m,m=S[0],b=S[1]),m.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return p(this.octets,m.octets,8,b)},h.prototype.prefixLengthFromSubnetMask=function(){let m=0,b=!1;const S={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let O,T,F;for(O=3;O>=0;O-=1)if(T=this.octets[O],T in S){if(F=S[T],b&&F!==0)return null;F!==8&&(b=!0),m+=F}else return null;return 32-m},h.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){return this.octets.slice(0)},h.prototype.toIPv4MappedAddress=function(){return x.IPv6.parse(`::ffff:${this.toString()}`)},h.prototype.toNormalizedString=function(){return this.toString()},h.prototype.toString=function(){return this.octets.join(".")},h}(),x.IPv4.broadcastAddressFromCIDR=function(h){try{const m=this.parseCIDR(h),b=m[0].toByteArray(),S=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[];let T=0;for(;T<4;)O.push(parseInt(b[T],10)|parseInt(S[T],10)^255),T++;return new this(O)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.isIPv4=function(h){return this.parser(h)!==null},x.IPv4.isValid=function(h){try{return new this(this.parser(h)),!0}catch{return!1}},x.IPv4.isValidCIDR=function(h){try{return this.parseCIDR(h),!0}catch{return!1}},x.IPv4.isValidFourPartDecimal=function(h){return!!(x.IPv4.isValid(h)&&h.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},x.IPv4.networkAddressFromCIDR=function(h){let m,b,S,O,T;try{for(m=this.parseCIDR(h),S=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[],b=0;b<4;)O.push(parseInt(S[b],10)&parseInt(T[b],10)),b++;return new this(O)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},x.IPv4.parse=function(h){const m=this.parser(h);if(m===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(m)},x.IPv4.parseCIDR=function(h){let m;if(m=h.match(/^(.+)\/(\d+)$/)){const b=parseInt(m[2]);if(b>=0&&b<=32){const S=[this.parse(m[1]),b];return Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},x.IPv4.parser=function(h){let m,b,S;if(m=h.match(i.fourOctet))return function(){const O=m.slice(1,6),T=[];for(let F=0;F<O.length;F++)b=O[F],T.push(g(b));return T}();if(m=h.match(i.longValue)){if(S=g(m[1]),S>4294967295||S<0)throw new Error("ipaddr: address outside defined range");return function(){const O=[];let T;for(T=0;T<=24;T+=8)O.push(S>>T&255);return O}().reverse()}else return(m=h.match(i.twoOctet))?function(){const O=m.slice(1,4),T=[];if(S=g(O[1]),S>16777215||S<0)throw new Error("ipaddr: address outside defined range");return T.push(g(O[0])),T.push(S>>16&255),T.push(S>>8&255),T.push(S&255),T}():(m=h.match(i.threeOctet))?function(){const O=m.slice(1,5),T=[];if(S=g(O[2]),S>65535||S<0)throw new Error("ipaddr: address outside defined range");return T.push(g(O[0])),T.push(g(O[1])),T.push(S>>8&255),T.push(S&255),T}():null},x.IPv4.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>32)throw new Error("ipaddr: invalid IPv4 prefix length");const m=[0,0,0,0];let b=0;const S=Math.floor(h/8);for(;b<S;)m[b]=255,b++;return S<4&&(m[S]=Math.pow(2,h%8)-1<<8-h%8),new this(m)},x.IPv6=function(){function h(m,b){let S,O;if(m.length===16)for(this.parts=[],S=0;S<=14;S+=2)this.parts.push(m[S]<<8|m[S+1]);else if(m.length===8)this.parts=m;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(S=0;S<this.parts.length;S++)if(O=this.parts[S],!(0<=O&&O<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");b&&(this.zoneId=b)}return h.prototype.SpecialRanges={unspecified:[new h([0,0,0,0,0,0,0,0]),128],linkLocal:[new h([65152,0,0,0,0,0,0,0]),10],multicast:[new h([65280,0,0,0,0,0,0,0]),8],loopback:[new h([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new h([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new h([0,0,0,0,0,65535,0,0]),96],discard:[new h([256,0,0,0,0,0,0,0]),64],rfc6145:[new h([0,0,0,0,65535,0,0,0]),96],rfc6052:[new h([100,65435,0,0,0,0,0,0]),96],"6to4":[new h([8194,0,0,0,0,0,0,0]),16],teredo:[new h([8193,0,0,0,0,0,0,0]),32],benchmarking:[new h([8193,2,0,0,0,0,0,0]),48],amt:[new h([8193,3,0,0,0,0,0,0]),32],as112v6:[[new h([8193,4,274,0,0,0,0,0]),48],[new h([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new h([8193,16,0,0,0,0,0,0]),28],orchid2:[new h([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new h([8193,48,0,0,0,0,0,0]),28],reserved:[[new h([8193,0,0,0,0,0,0,0]),23],[new h([8193,3512,0,0,0,0,0,0]),32]]},h.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},h.prototype.kind=function(){return"ipv6"},h.prototype.match=function(m,b){let S;if(b===void 0&&(S=m,m=S[0],b=S[1]),m.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return p(this.parts,m.parts,16,b)},h.prototype.prefixLengthFromSubnetMask=function(){let m=0,b=!1;const S={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let O,T;for(let F=7;F>=0;F-=1)if(O=this.parts[F],O in S){if(T=S[O],b&&T!==0)return null;T!==16&&(b=!0),m+=T}else return null;return 128-m},h.prototype.range=function(){return x.subnetMatch(this,this.SpecialRanges)},h.prototype.toByteArray=function(){let m;const b=[],S=this.parts;for(let O=0;O<S.length;O++)m=S[O],b.push(m>>8),b.push(m&255);return b},h.prototype.toFixedLengthString=function(){const m=(function(){const S=[];for(let O=0;O<this.parts.length;O++)S.push(_(this.parts[O].toString(16),4));return S}).call(this).join(":");let b="";return this.zoneId&&(b=`%${this.zoneId}`),m+b},h.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const m=this.parts.slice(-2),b=m[0],S=m[1];return new x.IPv4([b>>8,b&255,S>>8,S&255])},h.prototype.toNormalizedString=function(){const m=(function(){const S=[];for(let O=0;O<this.parts.length;O++)S.push(this.parts[O].toString(16));return S}).call(this).join(":");let b="";return this.zoneId&&(b=`%${this.zoneId}`),m+b},h.prototype.toRFC5952String=function(){const m=/((^|:)(0(:|$)){2,})/g,b=this.toNormalizedString();let S=0,O=-1,T;for(;T=m.exec(b);)T[0].length>O&&(S=T.index,O=T[0].length);return O<0?b:`${b.substring(0,S)}::${b.substring(S+O)}`},h.prototype.toString=function(){return this.toRFC5952String()},h}(),x.IPv6.broadcastAddressFromCIDR=function(h){try{const m=this.parseCIDR(h),b=m[0].toByteArray(),S=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[];let T=0;for(;T<16;)O.push(parseInt(b[T],10)|parseInt(S[T],10)^255),T++;return new this(O)}catch(m){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${m})`)}},x.IPv6.isIPv6=function(h){return this.parser(h)!==null},x.IPv6.isValid=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{const m=this.parser(h);return new this(m.parts,m.zoneId),!0}catch{return!1}},x.IPv6.isValidCIDR=function(h){if(typeof h=="string"&&h.indexOf(":")===-1)return!1;try{return this.parseCIDR(h),!0}catch{return!1}},x.IPv6.networkAddressFromCIDR=function(h){let m,b,S,O,T;try{for(m=this.parseCIDR(h),S=m[0].toByteArray(),T=this.subnetMaskFromPrefixLength(m[1]).toByteArray(),O=[],b=0;b<16;)O.push(parseInt(S[b],10)&parseInt(T[b],10)),b++;return new this(O)}catch(F){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${F})`)}},x.IPv6.parse=function(h){const m=this.parser(h);if(m.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(m.parts,m.zoneId)},x.IPv6.parseCIDR=function(h){let m,b,S;if((b=h.match(/^(.+)\/(\d+)$/))&&(m=parseInt(b[2]),m>=0&&m<=128))return S=[this.parse(b[1]),m],Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},x.IPv6.parser=function(h){let m,b,S,O,T,F;if(S=h.match(l.deprecatedTransitional))return this.parser(`::ffff:${S[1]}`);if(l.native.test(h))return u(h,8);if((S=h.match(l.transitional))&&(F=S[6]||"",m=S[1],S[1].endsWith("::")||(m=m.slice(0,-1)),m=u(m+F,6),m.parts)){for(T=[parseInt(S[2]),parseInt(S[3]),parseInt(S[4]),parseInt(S[5])],b=0;b<T.length;b++)if(O=T[b],!(0<=O&&O<=255))return null;return m.parts.push(T[0]<<8|T[1]),m.parts.push(T[2]<<8|T[3]),{parts:m.parts,zoneId:m.zoneId}}return null},x.IPv6.subnetMaskFromPrefixLength=function(h){if(h=parseInt(h),h<0||h>128)throw new Error("ipaddr: invalid IPv6 prefix length");const m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let b=0;const S=Math.floor(h/8);for(;b<S;)m[b]=255,b++;return S<16&&(m[S]=Math.pow(2,h%8)-1<<8-h%8),new this(m)},x.fromByteArray=function(h){const m=h.length;if(m===4)return new x.IPv4(h);if(m===16)return new x.IPv6(h);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},x.isValid=function(h){return x.IPv6.isValid(h)||x.IPv4.isValid(h)},x.isValidCIDR=function(h){return x.IPv6.isValidCIDR(h)||x.IPv4.isValidCIDR(h)},x.parse=function(h){if(x.IPv6.isValid(h))return x.IPv6.parse(h);if(x.IPv4.isValid(h))return x.IPv4.parse(h);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},x.parseCIDR=function(h){try{return x.IPv6.parseCIDR(h)}catch{try{return x.IPv4.parseCIDR(h)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},x.process=function(h){const m=this.parse(h);return m.kind()==="ipv6"&&m.isIPv4MappedAddress()?m.toIPv4Address():m},x.subnetMatch=function(h,m,b){let S,O,T,F;b==null&&(b="unicast");for(O in m)if(Object.prototype.hasOwnProperty.call(m,O)){for(T=m[O],T[0]&&!(T[0]instanceof Array)&&(T=[T]),S=0;S<T.length;S++)if(F=T[S],h.kind()===F[0].kind()&&h.match.apply(h,F))return O}return b},n.exports?n.exports=x:e.ipaddr=x})(vr)})(Gp);var zl=Gp.exports;class $l{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((r,s)=>r+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,r=>`${parseInt(r,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return zl.fromByteArray(Array.from(t)).toString()}return this.decodeIP(W.ToHex(e))}static fromString(e){const t=zl.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var Eo,zo,$o;let Ce=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};d([f({type:y.TeletexString})],Ce.prototype,"teletexString",void 0);d([f({type:y.PrintableString})],Ce.prototype,"printableString",void 0);d([f({type:y.UniversalString})],Ce.prototype,"universalString",void 0);d([f({type:y.Utf8String})],Ce.prototype,"utf8String",void 0);d([f({type:y.BmpString})],Ce.prototype,"bmpString",void 0);Ce=d([B({type:N.Choice})],Ce);let Nn=class extends Ce{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?W.ToHex(this.anyValue):super.toString())}};d([f({type:y.IA5String})],Nn.prototype,"ia5String",void 0);d([f({type:y.Any})],Nn.prototype,"anyValue",void 0);Nn=d([B({type:N.Choice})],Nn);class As{constructor(e={}){this.type="",this.value=new Nn,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],As.prototype,"type",void 0);d([f({type:Nn})],As.prototype,"value",void 0);let On=Eo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Eo.prototype)}};On=Eo=d([B({type:N.Set,itemType:As})],On);let Co=zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,zo.prototype)}};Co=zo=d([B({type:N.Sequence,itemType:On})],Co);let ve=$o=class extends Co{constructor(e){super(e),Object.setPrototypeOf(this,$o.prototype)}};ve=$o=d([B({type:N.Sequence})],ve);const g_={fromASN:n=>$l.toString(kr.fromASN(n)),toASN:n=>kr.toASN($l.fromString(n))};class mi{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],mi.prototype,"typeId",void 0);d([f({type:y.Any,context:0})],mi.prototype,"value",void 0);class dc{constructor(e={}){this.partyName=new Ce,Object.assign(this,e)}}d([f({type:Ce,optional:!0,context:0,implicit:!0})],dc.prototype,"nameAssigner",void 0);d([f({type:Ce,context:1,implicit:!0})],dc.prototype,"partyName",void 0);let Q=class{constructor(e={}){Object.assign(this,e)}};d([f({type:mi,context:0,implicit:!0})],Q.prototype,"otherName",void 0);d([f({type:y.IA5String,context:1,implicit:!0})],Q.prototype,"rfc822Name",void 0);d([f({type:y.IA5String,context:2,implicit:!0})],Q.prototype,"dNSName",void 0);d([f({type:y.Any,context:3,implicit:!0})],Q.prototype,"x400Address",void 0);d([f({type:ve,context:4,implicit:!1})],Q.prototype,"directoryName",void 0);d([f({type:dc,context:5})],Q.prototype,"ediPartyName",void 0);d([f({type:y.IA5String,context:6,implicit:!0})],Q.prototype,"uniformResourceIdentifier",void 0);d([f({type:y.OctetString,context:7,implicit:!0,converter:g_})],Q.prototype,"iPAddress",void 0);d([f({type:y.ObjectIdentifier,context:8,implicit:!0})],Q.prototype,"registeredID",void 0);Q=d([B({type:N.Choice})],Q);const pc="1.3.6.1.5.5.7",__=`${pc}.1`,Fn=`${pc}.3`,Is=`${pc}.48`,Cl=`${Is}.1`,jl=`${Is}.2`,Nl=`${Is}.3`,Ol=`${Is}.5`,Ft="2.5.29";var jo;const No=`${__}.1`;class Oi{constructor(e={}){this.accessMethod="",this.accessLocation=new Q,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Oi.prototype,"accessMethod",void 0);d([f({type:Q})],Oi.prototype,"accessLocation",void 0);let In=jo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,jo.prototype)}};In=jo=d([B({type:N.Sequence,itemType:Oi})],In);const Oo=`${Ft}.35`;class fc extends re{}class en{constructor(e={}){e&&Object.assign(this,e)}}d([f({type:fc,context:0,optional:!0,implicit:!0})],en.prototype,"keyIdentifier",void 0);d([f({type:Q,context:1,optional:!0,implicit:!0,repeated:"sequence"})],en.prototype,"authorityCertIssuer",void 0);d([f({type:y.Integer,context:2,optional:!0,implicit:!0,converter:he})],en.prototype,"authorityCertSerialNumber",void 0);const Jp=`${Ft}.19`;class xr{constructor(e={}){this.cA=!1,Object.assign(this,e)}}d([f({type:y.Boolean,defaultValue:!1})],xr.prototype,"cA",void 0);d([f({type:y.Integer,optional:!0})],xr.prototype,"pathLenConstraint",void 0);var Bo;let Te=Bo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Bo.prototype)}};Te=Bo=d([B({type:N.Sequence,itemType:Q})],Te);var To;let Bl=To=class extends Te{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};Bl=To=d([B({type:N.Sequence})],Bl);var Ro;const Zp=`${Ft}.32`;let It=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};d([f({type:y.IA5String})],It.prototype,"ia5String",void 0);d([f({type:y.VisibleString})],It.prototype,"visibleString",void 0);d([f({type:y.BmpString})],It.prototype,"bmpString",void 0);d([f({type:y.Utf8String})],It.prototype,"utf8String",void 0);It=d([B({type:N.Choice})],It);class hc{constructor(e={}){this.organization=new It,this.noticeNumbers=[],Object.assign(this,e)}}d([f({type:It})],hc.prototype,"organization",void 0);d([f({type:y.Integer,repeated:"sequence"})],hc.prototype,"noticeNumbers",void 0);class gc{constructor(e={}){Object.assign(this,e)}}d([f({type:hc,optional:!0})],gc.prototype,"noticeRef",void 0);d([f({type:It,optional:!0})],gc.prototype,"explicitText",void 0);let Sr=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.IA5String})],Sr.prototype,"cPSuri",void 0);d([f({type:gc})],Sr.prototype,"userNotice",void 0);Sr=d([B({type:N.Choice})],Sr);class _c{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],_c.prototype,"policyQualifierId",void 0);d([f({type:y.Any})],_c.prototype,"qualifier",void 0);class Es{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Es.prototype,"policyIdentifier",void 0);d([f({type:_c,repeated:"sequence",optional:!0})],Es.prototype,"policyQualifiers",void 0);let Ar=Ro=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ro.prototype)}};Ar=Ro=d([B({type:N.Sequence,itemType:Es})],Ar);let Ir=class{constructor(e=0){this.value=e}};d([f({type:y.Integer})],Ir.prototype,"value",void 0);Ir=d([B({type:N.Choice})],Ir);let Tl=class extends Ir{};Tl=d([B({type:N.Choice})],Tl);var Po;const Lo=`${Ft}.31`;var st;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(st||(st={}));class Yp extends Ss{toJSON(){const e=[],t=this.toNumber();return t&st.aACompromise&&e.push("aACompromise"),t&st.affiliationChanged&&e.push("affiliationChanged"),t&st.cACompromise&&e.push("cACompromise"),t&st.certificateHold&&e.push("certificateHold"),t&st.cessationOfOperation&&e.push("cessationOfOperation"),t&st.keyCompromise&&e.push("keyCompromise"),t&st.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&st.superseded&&e.push("superseded"),t&st.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let un=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,context:0,repeated:"sequence",implicit:!0})],un.prototype,"fullName",void 0);d([f({type:On,context:1,implicit:!0})],un.prototype,"nameRelativeToCRLIssuer",void 0);un=d([B({type:N.Choice})],un);class Kn{constructor(e={}){Object.assign(this,e)}}d([f({type:un,context:0,optional:!0})],Kn.prototype,"distributionPoint",void 0);d([f({type:Yp,context:1,optional:!0,implicit:!0})],Kn.prototype,"reasons",void 0);d([f({type:Q,context:2,optional:!0,repeated:"sequence",implicit:!0})],Kn.prototype,"cRLIssuer",void 0);let $n=Po=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Po.prototype)}};$n=Po=d([B({type:N.Sequence,itemType:Kn})],$n);var Uo;let Rl=Uo=class extends $n{constructor(e){super(e),Object.setPrototypeOf(this,Uo.prototype)}};Rl=Uo=d([B({type:N.Sequence,itemType:Kn})],Rl);class Ne{constructor(e={}){this.onlyContainsUserCerts=Ne.ONLY,this.onlyContainsCACerts=Ne.ONLY,this.indirectCRL=Ne.ONLY,this.onlyContainsAttributeCerts=Ne.ONLY,Object.assign(this,e)}}Ne.ONLY=!1;d([f({type:un,context:0,optional:!0})],Ne.prototype,"distributionPoint",void 0);d([f({type:y.Boolean,context:1,defaultValue:Ne.ONLY,implicit:!0})],Ne.prototype,"onlyContainsUserCerts",void 0);d([f({type:y.Boolean,context:2,defaultValue:Ne.ONLY,implicit:!0})],Ne.prototype,"onlyContainsCACerts",void 0);d([f({type:Yp,context:3,optional:!0,implicit:!0})],Ne.prototype,"onlySomeReasons",void 0);d([f({type:y.Boolean,context:4,defaultValue:Ne.ONLY,implicit:!0})],Ne.prototype,"indirectCRL",void 0);d([f({type:y.Boolean,context:5,defaultValue:Ne.ONLY,implicit:!0})],Ne.prototype,"onlyContainsAttributeCerts",void 0);var li;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(li||(li={}));let Vo=class{constructor(e=li.unspecified){this.reason=li.unspecified,this.reason=e}toJSON(){return li[this.reason]}toString(){return this.toJSON()}};d([f({type:y.Enumerated})],Vo.prototype,"reason",void 0);Vo=d([B({type:N.Choice})],Vo);var Mo;const Xp=`${Ft}.37`;let Er=Mo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Mo.prototype)}};Er=Mo=d([B({type:N.Sequence,itemType:y.ObjectIdentifier})],Er);const m_=`${Fn}.1`,y_=`${Fn}.2`,v_=`${Fn}.3`,w_=`${Fn}.4`,b_=`${Fn}.8`,k_=`${Fn}.9`;let Ho=class{constructor(e=new ArrayBuffer(0)){this.value=e}};d([f({type:y.Integer,converter:he})],Ho.prototype,"value",void 0);Ho=d([B({type:N.Choice})],Ho);let Do=class{constructor(e){this.value=new Date,e&&(this.value=e)}};d([f({type:y.GeneralizedTime})],Do.prototype,"value",void 0);Do=d([B({type:N.Choice})],Do);var qo;let Pl=qo=class extends Te{constructor(e){super(e),Object.setPrototypeOf(this,qo.prototype)}};Pl=qo=d([B({type:N.Sequence})],Pl);const Qp=`${Ft}.15`;var ot;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(ot||(ot={}));class ao extends Ss{toJSON(){const e=this.toNumber(),t=[];return e&ot.cRLSign&&t.push("crlSign"),e&ot.dataEncipherment&&t.push("dataEncipherment"),e&ot.decipherOnly&&t.push("decipherOnly"),e&ot.digitalSignature&&t.push("digitalSignature"),e&ot.encipherOnly&&t.push("encipherOnly"),e&ot.keyAgreement&&t.push("keyAgreement"),e&ot.keyCertSign&&t.push("keyCertSign"),e&ot.keyEncipherment&&t.push("keyEncipherment"),e&ot.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Fo;class zs{constructor(e={}){this.base=new Q,this.minimum=0,Object.assign(this,e)}}d([f({type:Q})],zs.prototype,"base",void 0);d([f({type:y.Integer,context:0,defaultValue:0,implicit:!0})],zs.prototype,"minimum",void 0);d([f({type:y.Integer,context:1,optional:!0,implicit:!0})],zs.prototype,"maximum",void 0);let zr=Fo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Fo.prototype)}};zr=Fo=d([B({type:N.Sequence,itemType:zs})],zr);class ef{constructor(e={}){Object.assign(this,e)}}d([f({type:zr,context:0,optional:!0,implicit:!0})],ef.prototype,"permittedSubtrees",void 0);d([f({type:zr,context:1,optional:!0,implicit:!0})],ef.prototype,"excludedSubtrees",void 0);class tf{constructor(e={}){Object.assign(this,e)}}d([f({type:y.Integer,context:0,implicit:!0,optional:!0,converter:he})],tf.prototype,"requireExplicitPolicy",void 0);d([f({type:y.Integer,context:1,implicit:!0,optional:!0,converter:he})],tf.prototype,"inhibitPolicyMapping",void 0);var Ko;class mc{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],mc.prototype,"issuerDomainPolicy",void 0);d([f({type:y.ObjectIdentifier})],mc.prototype,"subjectDomainPolicy",void 0);let Ll=Ko=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};Ll=Ko=d([B({type:N.Sequence,itemType:mc})],Ll);var Wo;const nf=`${Ft}.17`;let Go=Wo=class extends Te{constructor(e){super(e),Object.setPrototypeOf(this,Wo.prototype)}};Go=Wo=d([B({type:N.Sequence})],Go);let Et=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Et.prototype,"type",void 0);d([f({type:y.Any,repeated:"set"})],Et.prototype,"values",void 0);var Jo;let Ul=Jo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Jo.prototype)}};Ul=Jo=d([B({type:N.Sequence,itemType:Et})],Ul);const rf=`${Ft}.14`;class Lt extends fc{}class sf{constructor(e={}){Object.assign(this,e)}}d([f({type:y.GeneralizedTime,context:0,implicit:!0,optional:!0})],sf.prototype,"notBefore",void 0);d([f({type:y.GeneralizedTime,context:1,implicit:!0,optional:!0})],sf.prototype,"notAfter",void 0);var ui;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(ui||(ui={}));class of extends Ss{toJSON(){const e=[],t=this.toNumber();return t&ui.pKIXCertificate&&e.push("pKIXCertificate"),t&ui.newExtensions&&e.push("newExtensions"),t&ui.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class af{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new of,Object.assign(this,e)}}d([f({type:y.GeneralString})],af.prototype,"entrustVers",void 0);d([f({type:of})],af.prototype,"entrustInfoFlags",void 0);var Zo;let Vl=Zo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};Vl=Zo=d([B({type:N.Sequence,itemType:Oi})],Vl);class H{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof H&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Kd(e.parameters,this.parameters)||e.parameters===this.parameters)}}d([f({type:y.ObjectIdentifier})],H.prototype,"algorithm",void 0);d([f({type:y.Any,optional:!0})],H.prototype,"parameters",void 0);class at{constructor(e={}){this.algorithm=new H,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:H})],at.prototype,"algorithm",void 0);d([f({type:y.BitString})],at.prototype,"subjectPublicKey",void 0);let ze=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};d([f({type:y.UTCTime})],ze.prototype,"utcTime",void 0);d([f({type:y.GeneralizedTime})],ze.prototype,"generalTime",void 0);ze=d([B({type:N.Choice})],ze);class Bi{constructor(e){this.notBefore=new ze(new Date),this.notAfter=new ze(new Date),e&&(this.notBefore=new ze(e.notBefore),this.notAfter=new ze(e.notAfter))}}d([f({type:ze})],Bi.prototype,"notBefore",void 0);d([f({type:ze})],Bi.prototype,"notAfter",void 0);var Yo;let Qe=class cf{constructor(e={}){this.extnID="",this.critical=cf.CRITICAL,this.extnValue=new re,Object.assign(this,e)}};Qe.CRITICAL=!1;d([f({type:y.ObjectIdentifier})],Qe.prototype,"extnID",void 0);d([f({type:y.Boolean,defaultValue:Qe.CRITICAL})],Qe.prototype,"critical",void 0);d([f({type:re})],Qe.prototype,"extnValue",void 0);let Mt=Yo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Yo.prototype)}};Mt=Yo=d([B({type:N.Sequence,itemType:Qe})],Mt);var dn;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(dn||(dn={}));class Je{constructor(e={}){this.version=dn.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new H,this.issuer=new ve,this.validity=new Bi,this.subject=new ve,this.subjectPublicKeyInfo=new at,Object.assign(this,e)}}d([f({type:y.Integer,context:0,defaultValue:dn.v1})],Je.prototype,"version",void 0);d([f({type:y.Integer,converter:he})],Je.prototype,"serialNumber",void 0);d([f({type:H})],Je.prototype,"signature",void 0);d([f({type:ve})],Je.prototype,"issuer",void 0);d([f({type:Bi})],Je.prototype,"validity",void 0);d([f({type:ve})],Je.prototype,"subject",void 0);d([f({type:at})],Je.prototype,"subjectPublicKeyInfo",void 0);d([f({type:y.BitString,context:1,implicit:!0,optional:!0})],Je.prototype,"issuerUniqueID",void 0);d([f({type:y.BitString,context:2,implicit:!0,optional:!0})],Je.prototype,"subjectUniqueID",void 0);d([f({type:Mt,context:3,optional:!0})],Je.prototype,"extensions",void 0);class pn{constructor(e={}){this.tbsCertificate=new Je,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Je})],pn.prototype,"tbsCertificate",void 0);d([f({type:H})],pn.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],pn.prototype,"signatureValue",void 0);class $s{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ze,Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],$s.prototype,"userCertificate",void 0);d([f({type:ze})],$s.prototype,"revocationDate",void 0);d([f({type:Qe,optional:!0,repeated:"sequence"})],$s.prototype,"crlEntryExtensions",void 0);class Ot{constructor(e={}){this.signature=new H,this.issuer=new ve,this.thisUpdate=new ze,Object.assign(this,e)}}d([f({type:y.Integer,optional:!0})],Ot.prototype,"version",void 0);d([f({type:H})],Ot.prototype,"signature",void 0);d([f({type:ve})],Ot.prototype,"issuer",void 0);d([f({type:ze})],Ot.prototype,"thisUpdate",void 0);d([f({type:ze,optional:!0})],Ot.prototype,"nextUpdate",void 0);d([f({type:$s,repeated:"sequence",optional:!0})],Ot.prototype,"revokedCertificates",void 0);d([f({type:Qe,optional:!0,context:0,repeated:"sequence"})],Ot.prototype,"crlExtensions",void 0);class yc{constructor(e={}){this.tbsCertList=new Ot,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Ot})],yc.prototype,"tbsCertList",void 0);d([f({type:H})],yc.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],yc.prototype,"signature",void 0);class Wn{constructor(e={}){this.issuer=new ve,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:ve})],Wn.prototype,"issuer",void 0);d([f({type:y.Integer,converter:he})],Wn.prototype,"serialNumber",void 0);let Bn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Lt,context:0,implicit:!0})],Bn.prototype,"subjectKeyIdentifier",void 0);d([f({type:Wn})],Bn.prototype,"issuerAndSerialNumber",void 0);Bn=d([B({type:N.Choice})],Bn);var zt;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})(zt||(zt={}));let yi=class extends H{};yi=d([B({type:N.Sequence})],yi);let $r=class extends H{};$r=d([B({type:N.Sequence})],$r);let yt=class extends H{};yt=d([B({type:N.Sequence})],yt);let Cr=class extends H{};Cr=d([B({type:N.Sequence})],Cr);let Ml=class extends H{};Ml=d([B({type:N.Sequence})],Ml);let Xo=class extends H{};Xo=d([B({type:N.Sequence})],Xo);let Gn=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Gn.prototype,"attrType",void 0);d([f({type:y.Any,repeated:"set"})],Gn.prototype,"attrValues",void 0);var Qo;class bt{constructor(e={}){this.version=zt.v0,this.sid=new Bn,this.digestAlgorithm=new yi,this.signatureAlgorithm=new $r,this.signature=new re,Object.assign(this,e)}}d([f({type:y.Integer})],bt.prototype,"version",void 0);d([f({type:Bn})],bt.prototype,"sid",void 0);d([f({type:yi})],bt.prototype,"digestAlgorithm",void 0);d([f({type:Gn,repeated:"set",context:0,implicit:!0,optional:!0})],bt.prototype,"signedAttrs",void 0);d([f({type:$r})],bt.prototype,"signatureAlgorithm",void 0);d([f({type:re})],bt.prototype,"signature",void 0);d([f({type:Gn,repeated:"set",context:1,implicit:!0,optional:!0})],bt.prototype,"unsignedAttrs",void 0);let jr=Qo=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Qo.prototype)}};jr=Qo=d([B({type:N.Set,itemType:bt})],jr);let Hl=class extends ze{};Hl=d([B({type:N.Choice})],Hl);let Dl=class extends bt{};Dl=d([B({type:N.Sequence})],Dl);class vc{constructor(e={}){this.acIssuer=new Q,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}d([f({type:Q})],vc.prototype,"acIssuer",void 0);d([f({type:y.Integer})],vc.prototype,"acSerial",void 0);d([f({type:Et,repeated:"sequence"})],vc.prototype,"attrs",void 0);var ea;let Nr=ea=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ea.prototype)}};Nr=ea=d([B({type:N.Sequence,itemType:y.ObjectIdentifier})],Nr);class Cs{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}d([f({type:y.Integer,optional:!0})],Cs.prototype,"pathLenConstraint",void 0);d([f({type:Nr,implicit:!0,context:0,optional:!0})],Cs.prototype,"permittedAttrs",void 0);d([f({type:Nr,implicit:!0,context:1,optional:!0})],Cs.prototype,"excludedAttrs",void 0);d([f({type:y.Boolean,defaultValue:!0})],Cs.prototype,"permitUnSpecified",void 0);class wn{constructor(e={}){this.issuer=new Te,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Te})],wn.prototype,"issuer",void 0);d([f({type:y.Integer,converter:he})],wn.prototype,"serial",void 0);d([f({type:y.BitString,optional:!0})],wn.prototype,"issuerUID",void 0);var ta;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(ta||(ta={}));class bn{constructor(e={}){this.digestedObjectType=ta.publicKey,this.digestAlgorithm=new H,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Enumerated})],bn.prototype,"digestedObjectType",void 0);d([f({type:y.ObjectIdentifier,optional:!0})],bn.prototype,"otherObjectTypeID",void 0);d([f({type:H})],bn.prototype,"digestAlgorithm",void 0);d([f({type:y.BitString})],bn.prototype,"objectDigest",void 0);class js{constructor(e={}){Object.assign(this,e)}}d([f({type:Te,optional:!0})],js.prototype,"issuerName",void 0);d([f({type:wn,context:0,implicit:!0,optional:!0})],js.prototype,"baseCertificateID",void 0);d([f({type:bn,context:1,implicit:!0,optional:!0})],js.prototype,"objectDigestInfo",void 0);let Tn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,repeated:"sequence"})],Tn.prototype,"v1Form",void 0);d([f({type:js,context:0,implicit:!0})],Tn.prototype,"v2Form",void 0);Tn=d([B({type:N.Choice})],Tn);class Ns{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}d([f({type:y.GeneralizedTime})],Ns.prototype,"notBeforeTime",void 0);d([f({type:y.GeneralizedTime})],Ns.prototype,"notAfterTime",void 0);class Ti{constructor(e={}){Object.assign(this,e)}}d([f({type:wn,implicit:!0,context:0,optional:!0})],Ti.prototype,"baseCertificateID",void 0);d([f({type:Te,implicit:!0,context:1,optional:!0})],Ti.prototype,"entityName",void 0);d([f({type:bn,implicit:!0,context:2,optional:!0})],Ti.prototype,"objectDigestInfo",void 0);var na;(function(n){n[n.v2=1]="v2"})(na||(na={}));class ut{constructor(e={}){this.version=na.v2,this.holder=new Ti,this.issuer=new Tn,this.signature=new H,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Ns,this.attributes=[],Object.assign(this,e)}}d([f({type:y.Integer})],ut.prototype,"version",void 0);d([f({type:Ti})],ut.prototype,"holder",void 0);d([f({type:Tn})],ut.prototype,"issuer",void 0);d([f({type:H})],ut.prototype,"signature",void 0);d([f({type:y.Integer,converter:he})],ut.prototype,"serialNumber",void 0);d([f({type:Ns})],ut.prototype,"attrCertValidityPeriod",void 0);d([f({type:Et,repeated:"sequence"})],ut.prototype,"attributes",void 0);d([f({type:y.BitString,optional:!0})],ut.prototype,"issuerUniqueID",void 0);d([f({type:Mt,optional:!0})],ut.prototype,"extensions",void 0);class Os{constructor(e={}){this.acinfo=new ut,this.signatureAlgorithm=new H,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:ut})],Os.prototype,"acinfo",void 0);d([f({type:H})],Os.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],Os.prototype,"signatureValue",void 0);var Or;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(Or||(Or={}));class ia extends Ss{}class wc{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier,implicit:!0,context:0})],wc.prototype,"type",void 0);d([f({type:y.Any,implicit:!0,context:1})],wc.prototype,"value",void 0);class bc{constructor(e={}){this.policyId="",this.classList=new ia(Or.unclassified),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],bc.prototype,"policyId",void 0);d([f({type:ia,defaultValue:new ia(Or.unclassified)})],bc.prototype,"classList",void 0);d([f({type:wc,repeated:"set"})],bc.prototype,"securityCategories",void 0);class Bs{constructor(e={}){Object.assign(this,e)}}d([f({type:re})],Bs.prototype,"cotets",void 0);d([f({type:y.ObjectIdentifier})],Bs.prototype,"oid",void 0);d([f({type:y.Utf8String})],Bs.prototype,"string",void 0);class lf{constructor(e={}){this.values=[],Object.assign(this,e)}}d([f({type:Te,implicit:!0,context:0,optional:!0})],lf.prototype,"policyAuthority",void 0);d([f({type:Bs,repeated:"sequence"})],lf.prototype,"values",void 0);var ra;class Ts{constructor(e={}){this.targetCertificate=new wn,Object.assign(this,e)}}d([f({type:wn})],Ts.prototype,"targetCertificate",void 0);d([f({type:Q,optional:!0})],Ts.prototype,"targetName",void 0);d([f({type:bn,optional:!0})],Ts.prototype,"certDigestInfo",void 0);let Rn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Q,context:0,implicit:!0})],Rn.prototype,"targetName",void 0);d([f({type:Q,context:1,implicit:!0})],Rn.prototype,"targetGroup",void 0);d([f({type:Ts,context:2,implicit:!0})],Rn.prototype,"targetCert",void 0);Rn=d([B({type:N.Choice})],Rn);let sa=ra=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ra.prototype)}};sa=ra=d([B({type:N.Sequence,itemType:Rn})],sa);var oa;let ql=oa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,oa.prototype)}};ql=oa=d([B({type:N.Sequence,itemType:sa})],ql);class uf{constructor(e={}){Object.assign(this,e)}}d([f({type:Te,implicit:!0,context:0,optional:!0})],uf.prototype,"roleAuthority",void 0);d([f({type:Q,implicit:!0,context:1})],uf.prototype,"roleName",void 0);class kc{constructor(e={}){this.service=new Q,this.ident=new Q,Object.assign(this,e)}}d([f({type:Q})],kc.prototype,"service",void 0);d([f({type:Q})],kc.prototype,"ident",void 0);d([f({type:re,optional:!0})],kc.prototype,"authInfo",void 0);var aa;class xc{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],xc.prototype,"otherCertFormat",void 0);d([f({type:y.Any})],xc.prototype,"otherCert",void 0);let Pn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:pn})],Pn.prototype,"certificate",void 0);d([f({type:Os,context:2,implicit:!0})],Pn.prototype,"v2AttrCert",void 0);d([f({type:xc,context:3,implicit:!0})],Pn.prototype,"other",void 0);Pn=d([B({type:N.Choice})],Pn);let Br=aa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,aa.prototype)}};Br=aa=d([B({type:N.Set,itemType:Pn})],Br);class Jn{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Jn.prototype,"contentType",void 0);d([f({type:y.Any,context:0})],Jn.prototype,"content",void 0);let vi=class{constructor(e={}){Object.assign(this,e)}};d([f({type:re})],vi.prototype,"single",void 0);d([f({type:y.Any})],vi.prototype,"any",void 0);vi=d([B({type:N.Choice})],vi);class Rs{constructor(e={}){this.eContentType="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Rs.prototype,"eContentType",void 0);d([f({type:vi,context:0,optional:!0})],Rs.prototype,"eContent",void 0);let wi=class{constructor(e={}){Object.assign(this,e)}};d([f({type:re,context:0,implicit:!0,optional:!0})],wi.prototype,"value",void 0);d([f({type:re,converter:Yg,context:0,implicit:!0,optional:!0,repeated:"sequence"})],wi.prototype,"constructedValue",void 0);wi=d([B({type:N.Choice})],wi);class Ri{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Cr,Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ri.prototype,"contentType",void 0);d([f({type:Cr})],Ri.prototype,"contentEncryptionAlgorithm",void 0);d([f({type:wi,optional:!0})],Ri.prototype,"encryptedContent",void 0);class Ps{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ps.prototype,"keyAttrId",void 0);d([f({type:y.Any,optional:!0})],Ps.prototype,"keyAttr",void 0);var ca;class Ls{constructor(e={}){this.subjectKeyIdentifier=new Lt,Object.assign(this,e)}}d([f({type:Lt})],Ls.prototype,"subjectKeyIdentifier",void 0);d([f({type:y.GeneralizedTime,optional:!0})],Ls.prototype,"date",void 0);d([f({type:Ps,optional:!0})],Ls.prototype,"other",void 0);let Ln=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Ls,context:0,implicit:!0,optional:!0})],Ln.prototype,"rKeyId",void 0);d([f({type:Wn,optional:!0})],Ln.prototype,"issuerAndSerialNumber",void 0);Ln=d([B({type:N.Choice})],Ln);class Sc{constructor(e={}){this.rid=new Ln,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:Ln})],Sc.prototype,"rid",void 0);d([f({type:re})],Sc.prototype,"encryptedKey",void 0);let Tr=ca=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ca.prototype)}};Tr=ca=d([B({type:N.Sequence,itemType:Sc})],Tr);class Ac{constructor(e={}){this.algorithm=new H,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:H})],Ac.prototype,"algorithm",void 0);d([f({type:y.BitString})],Ac.prototype,"publicKey",void 0);let fn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Lt,context:0,implicit:!0,optional:!0})],fn.prototype,"subjectKeyIdentifier",void 0);d([f({type:Ac,context:1,implicit:!0,optional:!0})],fn.prototype,"originatorKey",void 0);d([f({type:Wn,optional:!0})],fn.prototype,"issuerAndSerialNumber",void 0);fn=d([B({type:N.Choice})],fn);class Zn{constructor(e={}){this.version=zt.v3,this.originator=new fn,this.keyEncryptionAlgorithm=new yt,this.recipientEncryptedKeys=new Tr,Object.assign(this,e)}}d([f({type:y.Integer})],Zn.prototype,"version",void 0);d([f({type:fn,context:0})],Zn.prototype,"originator",void 0);d([f({type:re,context:1,optional:!0})],Zn.prototype,"ukm",void 0);d([f({type:yt})],Zn.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:Tr})],Zn.prototype,"recipientEncryptedKeys",void 0);let Un=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Lt,context:0,implicit:!0})],Un.prototype,"subjectKeyIdentifier",void 0);d([f({type:Wn})],Un.prototype,"issuerAndSerialNumber",void 0);Un=d([B({type:N.Choice})],Un);class Pi{constructor(e={}){this.version=zt.v0,this.rid=new Un,this.keyEncryptionAlgorithm=new yt,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Pi.prototype,"version",void 0);d([f({type:Un})],Pi.prototype,"rid",void 0);d([f({type:yt})],Pi.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Pi.prototype,"encryptedKey",void 0);class Li{constructor(e={}){this.keyIdentifier=new re,Object.assign(this,e)}}d([f({type:re})],Li.prototype,"keyIdentifier",void 0);d([f({type:y.GeneralizedTime,optional:!0})],Li.prototype,"date",void 0);d([f({type:Ps,optional:!0})],Li.prototype,"other",void 0);class Ui{constructor(e={}){this.version=zt.v4,this.kekid=new Li,this.keyEncryptionAlgorithm=new yt,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Ui.prototype,"version",void 0);d([f({type:Li})],Ui.prototype,"kekid",void 0);d([f({type:yt})],Ui.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Ui.prototype,"encryptedKey",void 0);class Vi{constructor(e={}){this.version=zt.v0,this.keyEncryptionAlgorithm=new yt,this.encryptedKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Vi.prototype,"version",void 0);d([f({type:Xo,context:0,optional:!0})],Vi.prototype,"keyDerivationAlgorithm",void 0);d([f({type:yt})],Vi.prototype,"keyEncryptionAlgorithm",void 0);d([f({type:re})],Vi.prototype,"encryptedKey",void 0);class Ic{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Ic.prototype,"oriType",void 0);d([f({type:y.Any})],Ic.prototype,"oriValue",void 0);let Ht=class{constructor(e={}){Object.assign(this,e)}};d([f({type:Pi,optional:!0})],Ht.prototype,"ktri",void 0);d([f({type:Zn,context:1,implicit:!0,optional:!0})],Ht.prototype,"kari",void 0);d([f({type:Ui,context:2,implicit:!0,optional:!0})],Ht.prototype,"kekri",void 0);d([f({type:Vi,context:3,implicit:!0,optional:!0})],Ht.prototype,"pwri",void 0);d([f({type:Ic,context:4,implicit:!0,optional:!0})],Ht.prototype,"ori",void 0);Ht=d([B({type:N.Choice})],Ht);var la;let Rr=la=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,la.prototype)}};Rr=la=d([B({type:N.Set,itemType:Ht})],Rr);var ua;class Us{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Us.prototype,"otherRevInfoFormat",void 0);d([f({type:y.Any})],Us.prototype,"otherRevInfo",void 0);let Pr=class{constructor(e={}){this.other=new Us,Object.assign(this,e)}};d([f({type:Us,context:1,implicit:!0})],Pr.prototype,"other",void 0);Pr=d([B({type:N.Choice})],Pr);let Lr=ua=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ua.prototype)}};Lr=ua=d([B({type:N.Set,itemType:Pr})],Lr);class Ec{constructor(e={}){Object.assign(this,e)}}d([f({type:Br,context:0,implicit:!0,optional:!0})],Ec.prototype,"certs",void 0);d([f({type:Lr,context:1,implicit:!0,optional:!0})],Ec.prototype,"crls",void 0);var da;let pa=da=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,da.prototype)}};pa=da=d([B({type:N.Set,itemType:Gn})],pa);class Mi{constructor(e={}){this.version=zt.v0,this.recipientInfos=new Rr,this.encryptedContentInfo=new Ri,Object.assign(this,e)}}d([f({type:y.Integer})],Mi.prototype,"version",void 0);d([f({type:Ec,context:0,implicit:!0,optional:!0})],Mi.prototype,"originatorInfo",void 0);d([f({type:Rr})],Mi.prototype,"recipientInfos",void 0);d([f({type:Ri})],Mi.prototype,"encryptedContentInfo",void 0);d([f({type:pa,context:1,implicit:!0,optional:!0})],Mi.prototype,"unprotectedAttrs",void 0);const x_="1.2.840.113549.1.7.2";var fa;let Ur=fa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,fa.prototype)}};Ur=fa=d([B({type:N.Set,itemType:yi})],Ur);class Yn{constructor(e={}){this.version=zt.v0,this.digestAlgorithms=new Ur,this.encapContentInfo=new Rs,this.signerInfos=new jr,Object.assign(this,e)}}d([f({type:y.Integer})],Yn.prototype,"version",void 0);d([f({type:Ur})],Yn.prototype,"digestAlgorithms",void 0);d([f({type:Rs})],Yn.prototype,"encapContentInfo",void 0);d([f({type:Br,context:0,implicit:!0,optional:!0})],Yn.prototype,"certificates",void 0);d([f({type:Lr,context:1,implicit:!0,optional:!0})],Yn.prototype,"crls",void 0);d([f({type:jr})],Yn.prototype,"signerInfos",void 0);const bi="1.2.840.10045.2.1",zc="1.2.840.10045.4.1",df="1.2.840.10045.4.3.1",$c="1.2.840.10045.4.3.2",Cc="1.2.840.10045.4.3.3",jc="1.2.840.10045.4.3.4",Fl="1.2.840.10045.3.1.7",Kl="1.3.132.0.34",Wl="1.3.132.0.35";function Hi(n){return new H({algorithm:n})}const S_=Hi(zc);Hi(df);const A_=Hi($c),I_=Hi(Cc),E_=Hi(jc);let ki=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],ki.prototype,"fieldType",void 0);d([f({type:y.Any})],ki.prototype,"parameters",void 0);ki=d([B({type:N.Sequence})],ki);class z_ extends re{}let Vn=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.OctetString})],Vn.prototype,"a",void 0);d([f({type:y.OctetString})],Vn.prototype,"b",void 0);d([f({type:y.BitString,optional:!0})],Vn.prototype,"seed",void 0);Vn=d([B({type:N.Sequence})],Vn);var ha;(function(n){n[n.ecpVer1=1]="ecpVer1"})(ha||(ha={}));let $t=class{constructor(e={}){this.version=ha.ecpVer1,Object.assign(this,e)}};d([f({type:y.Integer})],$t.prototype,"version",void 0);d([f({type:ki})],$t.prototype,"fieldID",void 0);d([f({type:Vn})],$t.prototype,"curve",void 0);d([f({type:z_})],$t.prototype,"base",void 0);d([f({type:y.Integer,converter:he})],$t.prototype,"order",void 0);d([f({type:y.Integer,optional:!0})],$t.prototype,"cofactor",void 0);$t=d([B({type:N.Sequence})],$t);let Dt=class{constructor(e={}){Object.assign(this,e)}};d([f({type:y.ObjectIdentifier})],Dt.prototype,"namedCurve",void 0);d([f({type:y.Null})],Dt.prototype,"implicitCurve",void 0);d([f({type:$t})],Dt.prototype,"specifiedCurve",void 0);Dt=d([B({type:N.Choice})],Dt);class Vs{constructor(e={}){this.version=1,this.privateKey=new re,Object.assign(this,e)}}d([f({type:y.Integer})],Vs.prototype,"version",void 0);d([f({type:re})],Vs.prototype,"privateKey",void 0);d([f({type:Dt,context:0,optional:!0})],Vs.prototype,"parameters",void 0);d([f({type:y.BitString,context:1,optional:!0})],Vs.prototype,"publicKey",void 0);class Vr{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Vr.prototype,"r",void 0);d([f({type:y.Integer,converter:he})],Vr.prototype,"s",void 0);const De="1.2.840.113549.1.1",hn=`${De}.1`,$_=`${De}.7`,C_=`${De}.9`,di=`${De}.10`,j_=`${De}.2`,N_=`${De}.4`,Mr=`${De}.5`,O_=`${De}.14`,ga=`${De}.11`,Hr=`${De}.12`,Dr=`${De}.13`,pf=`${De}.15`,ff=`${De}.16`,qr="1.3.14.3.2.26",hf="2.16.840.1.101.3.4.2.4",Fr="2.16.840.1.101.3.4.2.1",Kr="2.16.840.1.101.3.4.2.2",Wr="2.16.840.1.101.3.4.2.3",B_="2.16.840.1.101.3.4.2.5",T_="2.16.840.1.101.3.4.2.6",R_="1.2.840.113549.2.2",P_="1.2.840.113549.2.5",Ms=`${De}.8`;function xe(n){return new H({algorithm:n,parameters:null})}xe(R_);xe(P_);const gn=xe(qr);xe(hf);xe(Fr);xe(Kr);xe(Wr);xe(B_);xe(T_);const gf=new H({algorithm:Ms,parameters:L.serialize(gn)}),_f=new H({algorithm:C_,parameters:L.serialize(kr.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});xe(hn);xe(j_);xe(N_);xe(Mr);xe(pf);xe(ff);xe(Hr);xe(Dr);xe(pf);xe(ff);class Hs{constructor(e={}){this.hashAlgorithm=new H(gn),this.maskGenAlgorithm=new H({algorithm:Ms,parameters:L.serialize(gn)}),this.pSourceAlgorithm=new H(_f),Object.assign(this,e)}}d([f({type:H,context:0,defaultValue:gn})],Hs.prototype,"hashAlgorithm",void 0);d([f({type:H,context:1,defaultValue:gf})],Hs.prototype,"maskGenAlgorithm",void 0);d([f({type:H,context:2,defaultValue:_f})],Hs.prototype,"pSourceAlgorithm",void 0);new H({algorithm:$_,parameters:L.serialize(new Hs)});class _n{constructor(e={}){this.hashAlgorithm=new H(gn),this.maskGenAlgorithm=new H({algorithm:Ms,parameters:L.serialize(gn)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}d([f({type:H,context:0,defaultValue:gn})],_n.prototype,"hashAlgorithm",void 0);d([f({type:H,context:1,defaultValue:gf})],_n.prototype,"maskGenAlgorithm",void 0);d([f({type:y.Integer,context:2,defaultValue:20})],_n.prototype,"saltLength",void 0);d([f({type:y.Integer,context:3,defaultValue:1})],_n.prototype,"trailerField",void 0);new H({algorithm:di,parameters:L.serialize(new _n)});class Ds{constructor(e={}){this.digestAlgorithm=new H,this.digest=new re,Object.assign(this,e)}}d([f({type:H})],Ds.prototype,"digestAlgorithm",void 0);d([f({type:re})],Ds.prototype,"digest",void 0);var _a;class qs{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],qs.prototype,"prime",void 0);d([f({type:y.Integer,converter:he})],qs.prototype,"exponent",void 0);d([f({type:y.Integer,converter:he})],qs.prototype,"coefficient",void 0);let ma=_a=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,_a.prototype)}};ma=_a=d([B({type:N.Sequence,itemType:qs})],ma);class kt{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer})],kt.prototype,"version",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"modulus",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"publicExponent",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"privateExponent",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"prime1",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"prime2",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"exponent1",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"exponent2",void 0);d([f({type:y.Integer,converter:he})],kt.prototype,"coefficient",void 0);d([f({type:ma,optional:!0})],kt.prototype,"otherPrimeInfos",void 0);class Nc{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.Integer,converter:he})],Nc.prototype,"modulus",void 0);d([f({type:y.Integer,converter:he})],Nc.prototype,"publicExponent",void 0);var ya;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ya||(ya={}));const Le=ya;/*! *****************************************************************************
80
80
  Copyright (c) Microsoft Corporation.
81
81
 
82
82
  Permission to use, copy, modify, and/or distribute this software for any
@@ -89,9 +89,9 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
89
89
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
90
90
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
91
91
  PERFORMANCE OF THIS SOFTWARE.
92
- ***************************************************************************** */var ya=function(n,e){return ya=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])},ya(n,e)};function Oc(n,e){ya(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function P_(n,e,t,i){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function c(p){try{u(i.next(p))}catch(g){o(g)}}function l(p){try{u(i.throw(p))}catch(g){o(g)}}function u(p){p.done?s(p.value):r(p.value).then(c,l)}u((i=i.apply(n,[])).next())})}function L_(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(u){return function(p){return l([u,p])}}function l(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(s=u[0]&2?r.return:u[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,u[1])).done)return s;switch(r=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(p){u=[6,p],r=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Zi(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gr(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(c){o={error:c}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function Yt(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Gr(arguments[e]));return n}var U_="injectionTokens";function V_(n){var e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(U_,n)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function mf(n){return!!n.useClass}function va(n){return!!n.useFactory}var yf=function(){function n(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return n.prototype.createProxy=function(e){var t=this,i={},r=!1,s,o=function(){return r||(s=e(t.wrap()),r=!0),s};return new Proxy(i,this.createHandler(o))},n.prototype.createHandler=function(e){var t={},i=function(r){t[r]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];s[0]=e();var c=Reflect[r];return c.apply(void 0,Yt(s))}};return this.reflectMethods.forEach(i),t},n}();function Sn(n){return typeof n=="string"||typeof n=="symbol"}function M_(n){return typeof n=="object"&&"token"in n&&"multiple"in n}function Gl(n){return typeof n=="object"&&"token"in n&&"transform"in n}function H_(n){return typeof n=="function"||n instanceof yf}function ir(n){return!!n.useToken}function rr(n){return n.useValue!=null}function D_(n){return mf(n)||rr(n)||ir(n)||va(n)}var Bc=function(){function n(){this._registryMap=new Map}return n.prototype.entries=function(){return this._registryMap.entries()},n.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},n.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},n.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},n.prototype.setAll=function(e,t){this._registryMap.set(e,t)},n.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},n.prototype.clear=function(){this._registryMap.clear()},n.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},n}(),F_=function(n){Oc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Bc),Jl=function(){function n(){this.scopedResolutions=new Map}return n}();function q_(n,e){if(n===null)return"at position #"+e;var t=n.split(",")[e].trim();return'"'+t+'" at position #'+e}function K_(n,e,t){return t===void 0&&(t=" "),Yt([n],e.message.split(`
92
+ ***************************************************************************** */var va=function(n,e){return va=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])},va(n,e)};function Oc(n,e){va(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function L_(n,e,t,i){function r(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function c(p){try{u(i.next(p))}catch(g){a(g)}}function l(p){try{u(i.throw(p))}catch(g){a(g)}}function u(p){p.done?s(p.value):r(p.value).then(c,l)}u((i=i.apply(n,[])).next())})}function U_(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(p){return l([u,p])}}function l(u){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(s=u[0]&2?r.return:u[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,u[1])).done)return s;switch(r=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,r=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(p){u=[6,p],r=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Zi(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gr(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),r,s=[],a;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(c){a={error:c}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return s}function Yt(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Gr(arguments[e]));return n}var V_="injectionTokens";function M_(n){var e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(V_,n)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function mf(n){return!!n.useClass}function wa(n){return!!n.useFactory}var yf=function(){function n(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return n.prototype.createProxy=function(e){var t=this,i={},r=!1,s,a=function(){return r||(s=e(t.wrap()),r=!0),s};return new Proxy(i,this.createHandler(a))},n.prototype.createHandler=function(e){var t={},i=function(r){t[r]=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];s[0]=e();var c=Reflect[r];return c.apply(void 0,Yt(s))}};return this.reflectMethods.forEach(i),t},n}();function Sn(n){return typeof n=="string"||typeof n=="symbol"}function H_(n){return typeof n=="object"&&"token"in n&&"multiple"in n}function Gl(n){return typeof n=="object"&&"token"in n&&"transform"in n}function D_(n){return typeof n=="function"||n instanceof yf}function ir(n){return!!n.useToken}function rr(n){return n.useValue!=null}function q_(n){return mf(n)||rr(n)||ir(n)||wa(n)}var Bc=function(){function n(){this._registryMap=new Map}return n.prototype.entries=function(){return this._registryMap.entries()},n.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},n.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},n.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},n.prototype.setAll=function(e,t){this._registryMap.set(e,t)},n.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},n.prototype.clear=function(){this._registryMap.clear()},n.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},n}(),F_=function(n){Oc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Bc),Jl=function(){function n(){this.scopedResolutions=new Map}return n}();function K_(n,e){if(n===null)return"at position #"+e;var t=n.split(",")[e].trim();return'"'+t+'" at position #'+e}function W_(n,e,t){return t===void 0&&(t=" "),Yt([n],e.message.split(`
93
93
  `).map(function(i){return t+i})).join(`
94
- `)}function W_(n,e,t){var i=Gr(n.toString().match(/constructor\(([\w, ]+)\)/)||[],2),r=i[1],s=r===void 0?null:r,o=q_(s,e);return K_("Cannot inject the dependency "+o+' of "'+n.name+'" constructor. Reason:',t)}function G_(n){if(typeof n.dispose!="function")return!1;var e=n.dispose;return!(e.length>0)}var J_=function(n){Oc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Bc),Z_=function(n){Oc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Bc),Y_=function(){function n(){this.preResolution=new J_,this.postResolution=new Z_}return n}(),vf=new Map,X_=function(){function n(e){this.parent=e,this._registry=new F_,this.interceptors=new Y_,this.disposed=!1,this.disposables=new Set}return n.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:Pe.Transient}),this.ensureNotDisposed();var r;if(D_(t)?r=t:r={useClass:t},ir(r))for(var s=[e],o=r;o!=null;){var c=o.useToken;if(s.includes(c))throw new Error("Token registration cycle detected! "+Yt(s,[c]).join(" -> "));s.push(c);var l=this._registry.get(c);l&&ir(l.provider)?o=l.provider:o=null}if((i.lifecycle===Pe.Singleton||i.lifecycle==Pe.ContainerScoped||i.lifecycle==Pe.ResolutionScoped)&&(rr(r)||va(r)))throw new Error('Cannot use lifecycle "'+Pe[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:r,options:i}),this},n.prototype.registerType=function(e,t){return this.ensureNotDisposed(),Sn(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},n.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},n.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),Sn(e)){if(Sn(t))return this.register(e,{useToken:t},{lifecycle:Pe.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Pe.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!Sn(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:Pe.Singleton})},n.prototype.resolve=function(e,t){t===void 0&&(t=new Jl),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&Sn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),i){var r=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}if(H_(e)){var r=this.construct(e,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},n.prototype.executePreResolutionInterceptor=function(e,t){var i,r;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var o=Zi(this.interceptors.preResolution.getAll(e)),c=o.next();!c.done;c=o.next()){var l=c.value;l.options.frequency!="Once"&&s.push(l),l.callback(e,t)}}catch(u){i={error:u}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},n.prototype.executePostResolutionInterceptor=function(e,t,i){var r,s;if(this.interceptors.postResolution.has(e)){var o=[];try{for(var c=Zi(this.interceptors.postResolution.getAll(e)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,t,i)}}catch(p){r={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}this.interceptors.postResolution.setAll(e,o)}},n.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Pe.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===Pe.Singleton,r=e.options.lifecycle===Pe.ContainerScoped,s=i||r,o;return rr(e.provider)?o=e.provider.useValue:ir(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):mf(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):va(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===Pe.ResolutionScoped&&t.scopedResolutions.set(e,o),o},n.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Jl),this.ensureNotDisposed();var r=this.getAllRegistrations(e);if(!r&&Sn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),r){var s=r.map(function(c){return i.resolveRegistration(c,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,o,"All"),o},n.prototype.isRegistered=function(e,t){return t===void 0&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},n.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},n.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=Zi(this._registry.entries()),r=i.next();!r.done;r=i.next()){var s=Gr(r.value,2),o=s[0],c=s[1];this._registry.setAll(o,c.filter(function(l){return!rr(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},n.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new n(this);try{for(var r=Zi(this._registry.entries()),s=r.next();!s.done;s=r.next()){var o=Gr(s.value,2),c=o[0],l=o[1];l.some(function(u){var p=u.options;return p.lifecycle===Pe.ContainerScoped})&&i._registry.setAll(c,l.map(function(u){return u.options.lifecycle===Pe.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return i},n.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},n.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},n.prototype.dispose=function(){return P_(this,void 0,void 0,function(){var e;return L_(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var r=i.dispose();r&&e.push(r)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},n.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},n.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},n.prototype.construct=function(e,t){var i=this;if(e instanceof yf)return e.createProxy(function(s){return i.resolve(s,t)});var r=function(){var s=vf.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var o=s.map(i.resolveParams(t,e));return new(e.bind.apply(e,Yt([void 0],o)))}();return G_(r)&&this.disposables.add(r),r},n.prototype.resolveParams=function(e,t){var i=this;return function(r,s){var o,c,l;try{return M_(r)?Gl(r)?r.multiple?(o=i.resolve(r.transform)).transform.apply(o,Yt([i.resolveAll(r.token)],r.transformArgs)):(c=i.resolve(r.transform)).transform.apply(c,Yt([i.resolve(r.token,e)],r.transformArgs)):r.multiple?i.resolveAll(r.token):i.resolve(r.token,e):Gl(r)?(l=i.resolve(r.transform,e)).transform.apply(l,Yt([i.resolve(r.token,e)],r.transformArgs)):i.resolve(r,e)}catch(u){throw new Error(W_(t,s,u))}}},n.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},n}(),ze=new X_;function Fs(){return function(n){vf.set(n,V_(n))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var wa;class qs{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}d([f({type:y.ObjectIdentifier})],qs.prototype,"attrId",void 0);d([f({type:y.Any,repeated:"set"})],qs.prototype,"attrValues",void 0);let Zl=wa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,wa.prototype)}};Zl=wa=d([B({type:N.Sequence,itemType:qs})],Zl);var ba;let Yl=ba=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ba.prototype)}};Yl=ba=d([B({type:N.Sequence,itemType:Jn})],Yl);class wf{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],wf.prototype,"certId",void 0);d([f({type:y.Any,context:0})],wf.prototype,"certValue",void 0);class bf{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],bf.prototype,"crlId",void 0);d([f({type:y.Any,context:0})],bf.prototype,"crltValue",void 0);class kf extends re{}let Ks=class{constructor(e={}){this.encryptionAlgorithm=new H,this.encryptedData=new kf,Object.assign(this,e)}};d([f({type:H})],Ks.prototype,"encryptionAlgorithm",void 0);d([f({type:kf})],Ks.prototype,"encryptedData",void 0);var ka,xa;(function(n){n[n.v1=0]="v1"})(xa||(xa={}));class xf extends re{}let Sa=ka=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ka.prototype)}};Sa=ka=d([B({type:N.Sequence,itemType:Et})],Sa);class Di{constructor(e={}){this.version=xa.v1,this.privateKeyAlgorithm=new H,this.privateKey=new xf,Object.assign(this,e)}}d([f({type:y.Integer})],Di.prototype,"version",void 0);d([f({type:H})],Di.prototype,"privateKeyAlgorithm",void 0);d([f({type:xf})],Di.prototype,"privateKey",void 0);d([f({type:Sa,implicit:!0,context:0,optional:!0})],Di.prototype,"attributes",void 0);let Xl=class extends Di{};Xl=d([B({type:N.Sequence})],Xl);let Ql=class extends Ks{};Ql=d([B({type:N.Sequence})],Ql);class Sf{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Sf.prototype,"secretTypeId",void 0);d([f({type:y.Any,context:0})],Sf.prototype,"secretValue",void 0);class Fi{constructor(e={}){this.mac=new Hs,this.macSalt=new re,this.iterations=1,Object.assign(this,e)}}d([f({type:Hs})],Fi.prototype,"mac",void 0);d([f({type:re})],Fi.prototype,"macSalt",void 0);d([f({type:y.Integer,defaultValue:1})],Fi.prototype,"iterations",void 0);class Ws{constructor(e={}){this.version=3,this.authSafe=new Jn,this.macData=new Fi,Object.assign(this,e)}}d([f({type:y.Integer})],Ws.prototype,"version",void 0);d([f({type:Jn})],Ws.prototype,"authSafe",void 0);d([f({type:Fi,optional:!0})],Ws.prototype,"macData",void 0);var Aa;class Gs{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Gs.prototype,"bagId",void 0);d([f({type:y.Any,context:0})],Gs.prototype,"bagValue",void 0);d([f({type:qs,repeated:"set",optional:!0})],Gs.prototype,"bagAttributes",void 0);let eu=Aa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Aa.prototype)}};eu=Aa=d([B({type:N.Sequence,itemType:Gs})],eu);var Ia,Ea,$a;const Af="1.2.840.113549.1.9",If=`${Af}.7`,Tc=`${Af}.14`;let Jr=class extends Ce{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};d([f({type:y.IA5String})],Jr.prototype,"ia5String",void 0);Jr=d([B({type:N.Choice})],Jr);let tu=class extends Jn{};tu=d([B({type:N.Sequence})],tu);let nu=class extends Ws{};nu=d([B({type:N.Sequence})],nu);let iu=class extends Ks{};iu=d([B({type:N.Sequence})],iu);let Ca=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.IA5String})],Ca.prototype,"value",void 0);Ca=d([B({type:N.Choice})],Ca);let ru=class extends Jr{};ru=d([B({type:N.Choice})],ru);let su=class extends Ce{};su=d([B({type:N.Choice})],su);let za=class{constructor(e=new Date){this.value=e}};d([f({type:y.GeneralizedTime})],za.prototype,"value",void 0);za=d([B({type:N.Choice})],za);let ou=class extends Ce{};ou=d([B({type:N.Choice})],ou);let ja=class{constructor(e="M"){this.value=e}toString(){return this.value}};d([f({type:y.PrintableString})],ja.prototype,"value",void 0);ja=d([B({type:N.Choice})],ja);let Zr=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.PrintableString})],Zr.prototype,"value",void 0);Zr=d([B({type:N.Choice})],Zr);let au=class extends Zr{};au=d([B({type:N.Choice})],au);let cu=class extends Ce{};cu=d([B({type:N.Choice})],cu);let Na=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.ObjectIdentifier})],Na.prototype,"value",void 0);Na=d([B({type:N.Choice})],Na);let lu=class extends Ee{};lu=d([B({type:N.Choice})],lu);let Oa=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};d([f({type:y.Integer})],Oa.prototype,"value",void 0);Oa=d([B({type:N.Choice})],Oa);let uu=class extends wt{};uu=d([B({type:N.Sequence})],uu);let Yr=class extends Ce{};Yr=d([B({type:N.Choice})],Yr);let du=Ia=class extends Mt{constructor(e){super(e),Object.setPrototypeOf(this,Ia.prototype)}};du=Ia=d([B({type:N.Sequence})],du);let pu=Ea=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ea.prototype)}};pu=Ea=d([B({type:N.Set,itemType:Gn})],pu);let Ba=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.BmpString})],Ba.prototype,"value",void 0);Ba=d([B({type:N.Choice})],Ba);let Ta=class extends H{};Ta=d([B({type:N.Sequence})],Ta);let fu=$a=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,$a.prototype)}};fu=$a=d([B({type:N.Sequence,itemType:Ta})],fu);var Ra;let Xr=Ra=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ra.prototype)}};Xr=Ra=d([B({type:N.Sequence,itemType:Et})],Xr);class Xn{constructor(e={}){this.version=0,this.subject=new ve,this.subjectPKInfo=new ot,this.attributes=new Xr,Object.assign(this,e)}}d([f({type:y.Integer})],Xn.prototype,"version",void 0);d([f({type:ve})],Xn.prototype,"subject",void 0);d([f({type:ot})],Xn.prototype,"subjectPKInfo",void 0);d([f({type:Xr,implicit:!0,context:0})],Xn.prototype,"attributes",void 0);class xi{constructor(e={}){this.certificationRequestInfo=new Xn,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Xn})],xi.prototype,"certificationRequestInfo",void 0);d([f({type:H})],xi.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],xi.prototype,"signature",void 0);/*!
94
+ `)}function G_(n,e,t){var i=Gr(n.toString().match(/constructor\(([\w, ]+)\)/)||[],2),r=i[1],s=r===void 0?null:r,a=K_(s,e);return W_("Cannot inject the dependency "+a+' of "'+n.name+'" constructor. Reason:',t)}function J_(n){if(typeof n.dispose!="function")return!1;var e=n.dispose;return!(e.length>0)}var Z_=function(n){Oc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Bc),Y_=function(n){Oc(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(Bc),X_=function(){function n(){this.preResolution=new Z_,this.postResolution=new Y_}return n}(),vf=new Map,Q_=function(){function n(e){this.parent=e,this._registry=new F_,this.interceptors=new X_,this.disposed=!1,this.disposables=new Set}return n.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:Le.Transient}),this.ensureNotDisposed();var r;if(q_(t)?r=t:r={useClass:t},ir(r))for(var s=[e],a=r;a!=null;){var c=a.useToken;if(s.includes(c))throw new Error("Token registration cycle detected! "+Yt(s,[c]).join(" -> "));s.push(c);var l=this._registry.get(c);l&&ir(l.provider)?a=l.provider:a=null}if((i.lifecycle===Le.Singleton||i.lifecycle==Le.ContainerScoped||i.lifecycle==Le.ResolutionScoped)&&(rr(r)||wa(r)))throw new Error('Cannot use lifecycle "'+Le[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:r,options:i}),this},n.prototype.registerType=function(e,t){return this.ensureNotDisposed(),Sn(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},n.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},n.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),Sn(e)){if(Sn(t))return this.register(e,{useToken:t},{lifecycle:Le.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Le.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!Sn(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:Le.Singleton})},n.prototype.resolve=function(e,t){t===void 0&&(t=new Jl),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&Sn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),i){var r=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}if(D_(e)){var r=this.construct(e,t);return this.executePostResolutionInterceptor(e,r,"Single"),r}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},n.prototype.executePreResolutionInterceptor=function(e,t){var i,r;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var a=Zi(this.interceptors.preResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var l=c.value;l.options.frequency!="Once"&&s.push(l),l.callback(e,t)}}catch(u){i={error:u}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},n.prototype.executePostResolutionInterceptor=function(e,t,i){var r,s;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var c=Zi(this.interceptors.postResolution.getAll(e)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&a.push(u),u.callback(e,t,i)}}catch(p){r={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}this.interceptors.postResolution.setAll(e,a)}},n.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Le.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===Le.Singleton,r=e.options.lifecycle===Le.ContainerScoped,s=i||r,a;return rr(e.provider)?a=e.provider.useValue:ir(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):mf(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):wa(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===Le.ResolutionScoped&&t.scopedResolutions.set(e,a),a},n.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Jl),this.ensureNotDisposed();var r=this.getAllRegistrations(e);if(!r&&Sn(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),r){var s=r.map(function(c){return i.resolveRegistration(c,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var a=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,a,"All"),a},n.prototype.isRegistered=function(e,t){return t===void 0&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},n.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},n.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=Zi(this._registry.entries()),r=i.next();!r.done;r=i.next()){var s=Gr(r.value,2),a=s[0],c=s[1];this._registry.setAll(a,c.filter(function(l){return!rr(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},n.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new n(this);try{for(var r=Zi(this._registry.entries()),s=r.next();!s.done;s=r.next()){var a=Gr(s.value,2),c=a[0],l=a[1];l.some(function(u){var p=u.options;return p.lifecycle===Le.ContainerScoped})&&i._registry.setAll(c,l.map(function(u){return u.options.lifecycle===Le.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){e={error:u}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return i},n.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},n.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},n.prototype.dispose=function(){return L_(this,void 0,void 0,function(){var e;return U_(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var r=i.dispose();r&&e.push(r)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},n.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},n.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},n.prototype.construct=function(e,t){var i=this;if(e instanceof yf)return e.createProxy(function(s){return i.resolve(s,t)});var r=function(){var s=vf.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=s.map(i.resolveParams(t,e));return new(e.bind.apply(e,Yt([void 0],a)))}();return J_(r)&&this.disposables.add(r),r},n.prototype.resolveParams=function(e,t){var i=this;return function(r,s){var a,c,l;try{return H_(r)?Gl(r)?r.multiple?(a=i.resolve(r.transform)).transform.apply(a,Yt([i.resolveAll(r.token)],r.transformArgs)):(c=i.resolve(r.transform)).transform.apply(c,Yt([i.resolve(r.token,e)],r.transformArgs)):r.multiple?i.resolveAll(r.token):i.resolve(r.token,e):Gl(r)?(l=i.resolve(r.transform,e)).transform.apply(l,Yt([i.resolve(r.token,e)],r.transformArgs)):i.resolve(r,e)}catch(u){throw new Error(G_(t,s,u))}}},n.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},n}(),je=new Q_;function Fs(){return function(n){vf.set(n,M_(n))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var ba;class Ks{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}d([f({type:y.ObjectIdentifier})],Ks.prototype,"attrId",void 0);d([f({type:y.Any,repeated:"set"})],Ks.prototype,"attrValues",void 0);let Zl=ba=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ba.prototype)}};Zl=ba=d([B({type:N.Sequence,itemType:Ks})],Zl);var ka;let Yl=ka=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,ka.prototype)}};Yl=ka=d([B({type:N.Sequence,itemType:Jn})],Yl);class wf{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],wf.prototype,"certId",void 0);d([f({type:y.Any,context:0})],wf.prototype,"certValue",void 0);class bf{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],bf.prototype,"crlId",void 0);d([f({type:y.Any,context:0})],bf.prototype,"crltValue",void 0);class kf extends re{}let Ws=class{constructor(e={}){this.encryptionAlgorithm=new H,this.encryptedData=new kf,Object.assign(this,e)}};d([f({type:H})],Ws.prototype,"encryptionAlgorithm",void 0);d([f({type:kf})],Ws.prototype,"encryptedData",void 0);var xa,Sa;(function(n){n[n.v1=0]="v1"})(Sa||(Sa={}));class xf extends re{}let Aa=xa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,xa.prototype)}};Aa=xa=d([B({type:N.Sequence,itemType:Et})],Aa);class Di{constructor(e={}){this.version=Sa.v1,this.privateKeyAlgorithm=new H,this.privateKey=new xf,Object.assign(this,e)}}d([f({type:y.Integer})],Di.prototype,"version",void 0);d([f({type:H})],Di.prototype,"privateKeyAlgorithm",void 0);d([f({type:xf})],Di.prototype,"privateKey",void 0);d([f({type:Aa,implicit:!0,context:0,optional:!0})],Di.prototype,"attributes",void 0);let Xl=class extends Di{};Xl=d([B({type:N.Sequence})],Xl);let Ql=class extends Ws{};Ql=d([B({type:N.Sequence})],Ql);class Sf{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Sf.prototype,"secretTypeId",void 0);d([f({type:y.Any,context:0})],Sf.prototype,"secretValue",void 0);class qi{constructor(e={}){this.mac=new Ds,this.macSalt=new re,this.iterations=1,Object.assign(this,e)}}d([f({type:Ds})],qi.prototype,"mac",void 0);d([f({type:re})],qi.prototype,"macSalt",void 0);d([f({type:y.Integer,defaultValue:1})],qi.prototype,"iterations",void 0);class Gs{constructor(e={}){this.version=3,this.authSafe=new Jn,this.macData=new qi,Object.assign(this,e)}}d([f({type:y.Integer})],Gs.prototype,"version",void 0);d([f({type:Jn})],Gs.prototype,"authSafe",void 0);d([f({type:qi,optional:!0})],Gs.prototype,"macData",void 0);var Ia;class Js{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:y.ObjectIdentifier})],Js.prototype,"bagId",void 0);d([f({type:y.Any,context:0})],Js.prototype,"bagValue",void 0);d([f({type:Ks,repeated:"set",optional:!0})],Js.prototype,"bagAttributes",void 0);let eu=Ia=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Ia.prototype)}};eu=Ia=d([B({type:N.Sequence,itemType:Js})],eu);var Ea,za,$a;const Af="1.2.840.113549.1.9",If=`${Af}.7`,Tc=`${Af}.14`;let Jr=class extends Ce{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};d([f({type:y.IA5String})],Jr.prototype,"ia5String",void 0);Jr=d([B({type:N.Choice})],Jr);let tu=class extends Jn{};tu=d([B({type:N.Sequence})],tu);let nu=class extends Gs{};nu=d([B({type:N.Sequence})],nu);let iu=class extends Ws{};iu=d([B({type:N.Sequence})],iu);let Ca=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.IA5String})],Ca.prototype,"value",void 0);Ca=d([B({type:N.Choice})],Ca);let ru=class extends Jr{};ru=d([B({type:N.Choice})],ru);let su=class extends Ce{};su=d([B({type:N.Choice})],su);let ja=class{constructor(e=new Date){this.value=e}};d([f({type:y.GeneralizedTime})],ja.prototype,"value",void 0);ja=d([B({type:N.Choice})],ja);let ou=class extends Ce{};ou=d([B({type:N.Choice})],ou);let Na=class{constructor(e="M"){this.value=e}toString(){return this.value}};d([f({type:y.PrintableString})],Na.prototype,"value",void 0);Na=d([B({type:N.Choice})],Na);let Zr=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.PrintableString})],Zr.prototype,"value",void 0);Zr=d([B({type:N.Choice})],Zr);let au=class extends Zr{};au=d([B({type:N.Choice})],au);let cu=class extends Ce{};cu=d([B({type:N.Choice})],cu);let Oa=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.ObjectIdentifier})],Oa.prototype,"value",void 0);Oa=d([B({type:N.Choice})],Oa);let lu=class extends ze{};lu=d([B({type:N.Choice})],lu);let Ba=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};d([f({type:y.Integer})],Ba.prototype,"value",void 0);Ba=d([B({type:N.Choice})],Ba);let uu=class extends bt{};uu=d([B({type:N.Sequence})],uu);let Yr=class extends Ce{};Yr=d([B({type:N.Choice})],Yr);let du=Ea=class extends Mt{constructor(e){super(e),Object.setPrototypeOf(this,Ea.prototype)}};du=Ea=d([B({type:N.Sequence})],du);let pu=za=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,za.prototype)}};pu=za=d([B({type:N.Set,itemType:Gn})],pu);let Ta=class{constructor(e=""){this.value=e}toString(){return this.value}};d([f({type:y.BmpString})],Ta.prototype,"value",void 0);Ta=d([B({type:N.Choice})],Ta);let Ra=class extends H{};Ra=d([B({type:N.Sequence})],Ra);let fu=$a=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,$a.prototype)}};fu=$a=d([B({type:N.Sequence,itemType:Ra})],fu);var Pa;let Xr=Pa=class extends le{constructor(e){super(e),Object.setPrototypeOf(this,Pa.prototype)}};Xr=Pa=d([B({type:N.Sequence,itemType:Et})],Xr);class Xn{constructor(e={}){this.version=0,this.subject=new ve,this.subjectPKInfo=new at,this.attributes=new Xr,Object.assign(this,e)}}d([f({type:y.Integer})],Xn.prototype,"version",void 0);d([f({type:ve})],Xn.prototype,"subject",void 0);d([f({type:at})],Xn.prototype,"subjectPKInfo",void 0);d([f({type:Xr,implicit:!0,context:0})],Xn.prototype,"attributes",void 0);class xi{constructor(e={}){this.certificationRequestInfo=new Xn,this.signatureAlgorithm=new H,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}d([f({type:Xn})],xi.prototype,"certificationRequestInfo",void 0);d([f({type:H})],xi.prototype,"signatureAlgorithm",void 0);d([f({type:y.BitString})],xi.prototype,"signature",void 0);/*!
95
95
  * MIT License
96
96
  *
97
97
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -114,21 +114,21 @@ PERFORMANCE OF THIS SOFTWARE.
114
114
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
115
115
  * SOFTWARE.
116
116
  *
117
- */const qi="crypto.algorithm";class Q_{getAlgorithms(){return ze.resolveAll(qi)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new H({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const r=i.toWebAlgorithm(e);if(r)return r}return{name:e.algorithm,parameters:e.parameters}}}const mn="crypto.algorithmProvider";ze.registerSingleton(mn,Q_);var sr;const De="1.3.36.3.3.2.8.1.1",hu=`${De}.1`,gu=`${De}.2`,_u=`${De}.3`,mu=`${De}.4`,yu=`${De}.5`,vu=`${De}.6`,wu=`${De}.7`,bu=`${De}.8`,ku=`${De}.9`,xu=`${De}.10`,Su=`${De}.11`,Au=`${De}.12`,Iu=`${De}.13`,Eu=`${De}.14`,$u="brainpoolP160r1",Cu="brainpoolP160t1",zu="brainpoolP192r1",ju="brainpoolP192t1",Nu="brainpoolP224r1",Ou="brainpoolP224t1",Bu="brainpoolP256r1",Tu="brainpoolP256t1",Ru="brainpoolP320r1",Pu="brainpoolP320t1",Lu="brainpoolP384r1",Uu="brainpoolP384t1",Vu="brainpoolP512r1",Mu="brainpoolP512t1",ge="ECDSA";let Si=sr=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case ge.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return x_;case"sha-256":return S_;case"sha-384":return A_;case"sha-512":return I_}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=ql;break;case"K-256":t=sr.SECP256K1;break;case"P-384":t=Kl;break;case"P-521":t=Wl;break;case $u:t=hu;break;case Cu:t=gu;break;case zu:t=_u;break;case ju:t=mu;break;case Nu:t=yu;break;case Ou:t=vu;break;case Bu:t=wu;break;case Tu:t=bu;break;case Ru:t=ku;break;case Pu:t=xu;break;case Lu:t=Su;break;case Uu:t=Au;break;case Vu:t=Iu;break;case Mu:t=Eu;break}if(t)return new H({algorithm:bi,parameters:L.serialize(new Dt({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case $c:return{name:ge,hash:{name:"SHA-1"}};case Cc:return{name:ge,hash:{name:"SHA-256"}};case zc:return{name:ge,hash:{name:"SHA-384"}};case jc:return{name:ge,hash:{name:"SHA-512"}};case bi:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(L.parse(e.parameters,Dt).namedCurve){case ql:return{name:ge,namedCurve:"P-256"};case sr.SECP256K1:return{name:ge,namedCurve:"K-256"};case Kl:return{name:ge,namedCurve:"P-384"};case Wl:return{name:ge,namedCurve:"P-521"};case hu:return{name:ge,namedCurve:$u};case gu:return{name:ge,namedCurve:Cu};case _u:return{name:ge,namedCurve:zu};case mu:return{name:ge,namedCurve:ju};case yu:return{name:ge,namedCurve:Nu};case vu:return{name:ge,namedCurve:Ou};case wu:return{name:ge,namedCurve:Bu};case bu:return{name:ge,namedCurve:Tu};case ku:return{name:ge,namedCurve:Ru};case xu:return{name:ge,namedCurve:Pu};case Su:return{name:ge,namedCurve:Lu};case Au:return{name:ge,namedCurve:Uu};case Iu:return{name:ge,namedCurve:Vu};case Eu:return{name:ge,namedCurve:Mu}}}}return null}};Si.SECP256K1="1.3.132.0.10";Si=sr=d([Fs()],Si);ze.registerSingleton(qi,Si);const Ef=Symbol("name"),$f=Symbol("value");class ae{constructor(e,t={},i=""){this[Ef]=e,this[$f]=i;for(const r in t)this[r]=t[r]}}ae.NAME=Ef;ae.VALUE=$f;class e0{static toTextObject(e){const t=new ae("Algorithm Identifier",{},Kt.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case bi:{const i=new Si().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Kt{static toString(e){const t=this.items[e];return t||e}}Kt.items={[Fr]:"sha1",[hf]:"sha224",[qr]:"sha256",[Kr]:"sha384",[Wr]:"sha512",[hn]:"rsaEncryption",[Mr]:"sha1WithRSAEncryption",[N_]:"sha224WithRSAEncryption",[ha]:"sha256WithRSAEncryption",[Hr]:"sha384WithRSAEncryption",[Dr]:"sha512WithRSAEncryption",[bi]:"ecPublicKey",[$c]:"ecdsaWithSHA1",[df]:"ecdsaWithSHA224",[Cc]:"ecdsaWithSHA256",[zc]:"ecdsaWithSHA384",[jc]:"ecdsaWithSHA512",[__]:"TLS WWW server authentication",[m_]:"TLS WWW client authentication",[y_]:"Code Signing",[v_]:"E-mail Protection",[w_]:"Time Stamping",[b_]:"OCSP Signing",[k_]:"Signed Data"};class yn{static serialize(e){return this.serializeObj(e).join(`
118
- `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let r=this.pad(t++),s="";const o=e[ae.VALUE];o&&(s=` ${o}`),i.push(`${r}${e[ae.NAME]}:${s}`),r=this.pad(t);for(const c in e){if(typeof c=="symbol")continue;const l=e[c],u=c?`${c}: `:"";if(typeof l=="string"||typeof l=="number"||typeof l=="boolean")i.push(`${r}${u}${l}`);else if(l instanceof Date)i.push(`${r}${u}${l.toUTCString()}`);else if(Array.isArray(l))for(const p of l)p[ae.NAME]=c,i.push(...this.serializeObj(p,t));else if(l instanceof ae)l[ae.NAME]=c,i.push(...this.serializeObj(l,t));else if(U.isBufferSource(l))c?(i.push(`${r}${u}`),i.push(...this.serializeBufferSource(l,t+1))):i.push(...this.serializeBufferSource(l,t));else if("toTextObject"in l){const p=l.toTextObject();p[ae.NAME]=c,i.push(...this.serializeObj(p,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),r=U.toUint8Array(e),s=[];for(let o=0;o<r.length;){const c=[];for(let l=0;l<16&&o<r.length;l++){l===8&&c.push("");const u=r[o++].toString(16).padStart(2,"0");c.push(u)}s.push(`${i}${c.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}yn.oidSerializer=Kt;yn.algorithmSerializer=e0;class Wt{constructor(...e){if(e.length===1){const t=e[0];this.rawData=L.serialize(t),this.onInit(t)}else{const t=L.parse(e[0],e[1]);this.rawData=U.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof Wt?Kd(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return L.toString(this.rawData);case"text":return yn.serialize(this.toTextObject());case"hex":return W.ToHex(this.rawData);case"base64":return W.ToBase64(this.rawData);case"base64url":return W.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ae(this.getTextName(),{},e)}}Wt.NAME="ASN";class et extends Wt{constructor(...e){let t;U.isBufferSource(e[0])?t=U.toArrayBuffer(e[0]):t=L.serialize(new Xe({extnID:e[0],critical:e[1],extnValue:new re(U.toArrayBuffer(e[2]))})),super(t,Xe)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ae.NAME]===et.NAME&&(e[ae.NAME]=Kt.toString(this.type)),e}}var Cf;class Tt{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[Cf]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Tt.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Tt.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=Tt.DEFAULT){const t=this.items.get(e.toLowerCase());if(!t)throw new Error(`Cannot get Crypto by name '${e}'`);return t}set(e,t){if(typeof e=="string"){if(!t)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),t)}else this.items.set(Tt.DEFAULT,e);return this}}Cf=Symbol.toStringTag;Tt.DEFAULT="default";const Ie=new Tt,t0=/^[0-2](?:\.[1-9][0-9]*)+$/;function n0(n){return new RegExp(t0).test(n)}class zf{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return n0(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const Me=new zf;Me.register("CN","2.5.4.3");Me.register("L","2.5.4.7");Me.register("ST","2.5.4.8");Me.register("O","2.5.4.10");Me.register("OU","2.5.4.11");Me.register("C","2.5.4.6");Me.register("DC","0.9.2342.19200300.100.1.25");Me.register("E","1.2.840.113549.1.9.1");Me.register("G","2.5.4.42");Me.register("I","2.5.4.43");Me.register("SN","2.5.4.4");Me.register("T","2.5.4.12");function i0(n,e){return`\\${W.ToHex(W.FromUtf8String(e)).toUpperCase()}`}function r0(n){return n.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,i0)}class Ze{static isASCII(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new zf,this.asn=new ve;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];this.extraNames.register(i,r)}typeof e=="string"?this.asn=this.fromString(e):e instanceof ve?this.asn=e:U.isBufferSource(e)?this.asn=L.parse(e,ve):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||Me.findId(e),i=[];for(const r of this.asn)for(const s of r)s.type===t&&i.push(s.value.toString());return i}getName(e){return this.extraNames.get(e)||Me.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,r=t.value.anyValue?`#${W.ToHex(t.value.anyValue)}`:r0(t.value.toString());return`${i}=${r}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const r={};for(const s of i){const o=this.getName(s.type)||s.type;(e=r[o])!==null&&e!==void 0||(r[o]=[]),r[o].push(s.value.anyValue?`#${W.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(r)}return t}fromString(e){const t=new ve,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let r=null,s=",";for(;r=i.exec(`${e},`);){let[,o,c]=r;const l=c[c.length-1];(l===","||l==="+")&&(c=c.slice(0,c.length-1),r[3]=l);const u=r[3];o=this.getTypeOid(o);const p=this.createAttribute(o,c);s==="+"?t[t.length-1].push(p):t.push(new On([p])),s=u}return t}fromJSON(e){const t=new ve;for(const i of e){const r=new On;for(const s in i){const o=this.getTypeOid(s),c=i[s];for(const l of c){const u=this.createAttribute(o,l);r.push(u)}}t.push(r)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const i=new Ss({type:e});if(typeof t=="object")for(const r in t)switch(r){case"ia5String":i.value.ia5String=t[r];break;case"utf8String":i.value.utf8String=t[r];break;case"universalString":i.value.universalString=t[r];break;case"bmpString":i.value.bmpString=t[r];break;case"printableString":i.value.printableString=t[r];break}else if(t[0]==="#")i.value.anyValue=W.FromHex(t.slice(1));else{const r=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?i.value.ia5String=r:Ze.isPrintableString(r)?i.value.printableString=r:i.value.utf8String=r}return i}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
119
- `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return L.serialize(this.asn)}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ie.get()):i=e[0]||Ie.get(),await i.subtle.digest(r,this.toArrayBuffer())}}const jf="Cannot initialize GeneralName from ASN.1 data.",Hu=`${jf} Unsupported string format in use.`,s0=`${jf} Value doesn't match to GUID regular expression.`,Du=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,Fu="1.3.6.1.4.1.311.25.1",qu="1.3.6.1.4.1.311.20.2.3",ao="dns",co="dn",lo="email",uo="ip",po="url",fo="guid",ho="upn",Yi="id";class Rt extends Wt{constructor(...e){let t;if(e.length===2)switch(e[0]){case co:{const i=new Ze(e[1]).toArrayBuffer(),r=L.parse(i,ve);t=new Q({directoryName:r});break}case ao:t=new Q({dNSName:e[1]});break;case lo:t=new Q({rfc822Name:e[1]});break;case fo:{const i=new RegExp(Du,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const r=i.slice(1).map((s,o)=>o<3?W.ToHex(new Uint8Array(W.FromHex(s)).reverse()):s).join("");t=new Q({otherName:new mi({typeId:Fu,value:L.serialize(new re(W.FromHex(r)))})});break}case uo:t=new Q({iPAddress:e[1]});break;case Yi:t=new Q({registeredID:e[1]});break;case ho:{t=new Q({otherName:new mi({typeId:qu,value:L.serialize(Kp.toASN(e[1]))})});break}case po:t=new Q({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else U.isBufferSource(e[0])?t=L.parse(e[0],Q):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=ao,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=lo,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=uo,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=po,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Yi,this.value=e.registeredID;else if(e.directoryName!=null)this.type=co,this.value=new Ze(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===Fu){this.type=fo;const t=L.parse(e.otherName.value,re),i=new RegExp(Du,"i").exec(W.ToHex(t));if(!i)throw new Error(s0);this.value=i.slice(1).map((r,s)=>s<3?W.ToHex(new Uint8Array(W.FromHex(r)).reverse()):r).join("-")}else if(e.otherName.typeId===qu)this.type=ho,this.value=L.parse(e.otherName.value,Ce).toString();else throw new Error(Hu);else throw new Error(Hu)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case co:case ao:case fo:case uo:case Yi:case ho:case po:e=this.type.toUpperCase();break;case lo:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Yi&&(t=Kt.toString(t)),new ae(e,void 0,t)}}class Ai extends Wt{constructor(e){let t;if(e instanceof Be)t=e;else if(Array.isArray(e)){const i=[];for(const r of e)if(r instanceof Q)i.push(r);else{const s=L.parse(new Rt(r.type,r.value).rawData,Q);i.push(s)}t=new Be(i)}else if(U.isBufferSource(e))t=L.parse(e,Be);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let r=null;try{r=new Rt(i)}catch{continue}t.push(r)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let r=e[i[ae.NAME]];Array.isArray(r)||(r=[],e[i[ae.NAME]]=r),r.push(i)}return e}}Ai.NAME="GeneralNames";const pi="-{5}",Ii="\\n",o0=`[^${Ii}]+`,a0=`${pi}BEGIN (${o0}(?=${pi}))${pi}`,c0=`${pi}END \\1${pi}`,Mn="\\n",l0=`[^:${Ii}]+`,u0=`(?:[^${Ii}]+${Mn}(?: +[^${Ii}]+${Mn})*)`,d0="[a-zA-Z0-9=+/]+",p0=`(?:${d0}${Mn})+`,Ku=`${a0}${Mn}(?:((?:${l0}: ${u0})+))?${Mn}?(${p0})${c0}`;class Ke{static isPem(e){return typeof e=="string"&&new RegExp(Ku,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Ku,"g"),i=[];let r=null;for(;r=t.exec(e);){const s=r[3].replace(new RegExp(`[${Ii}]+`,"g"),""),o={type:r[1],headers:[],rawData:W.FromBase64(s)},c=r[2];if(c){const l=c.split(new RegExp(Mn,"g"));let u=null;for(const p of l){const[g,_]=p.split(/:(.*)/);if(_===void 0){if(!u)throw new Error("Cannot parse PEM string. Incorrect header value");u.value+=g.trim()}else u&&o.headers.push(u),u={key:g,value:_.trim()}}u&&o.headers.push(u)}i.push(o)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(r=>{if(!U.isBufferSource(r))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:U.toArrayBuffer(r)}))}):e.forEach(r=>{if(!("type"in r))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(r))}),i.join(`
120
- `)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:U.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),r=[];if(r.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const u of e.headers)r.push(`${u.key}: ${u.value}`);r.push("")}const s=W.ToBase64(e.rawData);let o,c=0;const l=Array();for(;c<s.length&&(s.length-c<64?o=s.substring(c):(o=s.substring(c,c+64),c+=64),o.length!==0);)if(l.push(o),o.length<64)break;return r.push(...l),r.push(`-----END ${i}-----`),r.join(`
121
- `)}}Ke.CertificateTag="CERTIFICATE";Ke.CrlTag="CRL";Ke.CertificateRequestTag="CERTIFICATE REQUEST";Ke.PublicKeyTag="PUBLIC KEY";Ke.PrivateKeyTag="PRIVATE KEY";class zt extends Wt{static isAsnEncoded(e){return U.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(Ke.isPem(e))return Ke.decode(e)[0];if(W.isHex(e))return W.FromHex(e);if(W.isBase64(e))return W.FromBase64(e);if(W.isBase64Url(e))return W.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=W.ToBinary(e);return Ke.isPem(t)?Ke.decode(t)[0]:W.isHex(t)?W.FromHex(t):W.isBase64(t)?W.FromBase64(t):W.isBase64Url(t)?W.FromBase64Url(t):U.toArrayBuffer(e)}}constructor(...e){zt.isAsnEncoded(e[0])?super(zt.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return Ke.encode(this.rawData,this.tag);default:return super.toString(e)}}}class at extends zt{static async create(e,t=Ie.get()){if(e instanceof at)return e;if(Tt.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const i=await t.subtle.exportKey("spki",e);return new at(i)}else{if(e.publicKey)return e.publicKey;if(U.isBufferSource(e))return new at(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){zt.isAsnEncoded(e)?super(e,ot):super(e),this.tag=Ke.PublicKeyTag}async export(...e){let t,i=["verify"],r={hash:"SHA-256",...this.algorithm};e.length>1?(r=e[0]||r,i=e[1]||i,t=e[2]||Ie.get()):t=e[0]||Ie.get();let s=this.rawData;const o=L.parse(this.rawData,ot);return o.algorithm.algorithm===di&&(s=f0(o,s)),t.subtle.importKey("spki",s,r,!0,i)}onInit(e){const t=ze.resolve(mn),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case hn:{const r=L.parse(e.subjectPublicKey,Nc),s=U.toUint8Array(r.modulus);i.publicExponent=U.toUint8Array(r.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ie.get()):i=e[0]||Ie.get(),await i.subtle.digest(r,this.rawData)}async getKeyIdentifier(...e){let t,i="SHA-1";e.length===1?typeof e[0]=="string"?(i=e[0],t=Ie.get()):t=e[0]:e.length===2?(i=e[0],t=e[1]):t=Ie.get();const r=L.parse(this.rawData,ot);return await t.subtle.digest(i,r.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,ot);switch(e.Algorithm=yn.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case bi:e["EC Point"]=t.subjectPublicKey;break;case hn:default:e["Raw Data"]=t.subjectPublicKey}return e}}function f0(n,e){return n.algorithm=new H({algorithm:hn,parameters:null}),e=L.serialize(n),e}class Ei extends et{static async create(e,t=!1,i=Ie.get()){if("name"in e&&"serialNumber"in e)return new Ei(e,t);const s=await(await at.create(e,i)).getKeyIdentifier(i);return new Ei(W.ToHex(s),t)}constructor(...e){if(U.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new en({keyIdentifier:new fc(W.FromHex(e[0]))});super(No,e[1],L.serialize(t))}else{const t=e[0],i=t.name instanceof Ai?L.parse(t.name.rawData,Be):t.name,r=new en({authorityCertIssuer:i,authorityCertSerialNumber:W.FromHex(t.serialNumber)});super(No,e[1],L.serialize(r))}}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,en);t.keyIdentifier&&(this.keyId=W.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?W.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,en);return t.authorityCertIssuer&&(e["Authority Issuer"]=new Ai(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}Ei.NAME="Authority Key Identifier";class Rc extends et{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,xr);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new xr({cA:e[0],pathLenConstraint:e[1]});super(Jp,e[2],L.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}Rc.NAME="Basic Constraints";var Wu;(function(n){n.serverAuth="1.3.6.1.5.5.7.3.1",n.clientAuth="1.3.6.1.5.5.7.3.2",n.codeSigning="1.3.6.1.5.5.7.3.3",n.emailProtection="1.3.6.1.5.5.7.3.4",n.timeStamping="1.3.6.1.5.5.7.3.8",n.ocspSigning="1.3.6.1.5.5.7.3.9"})(Wu||(Wu={}));class Pc extends et{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,Er);this.usages=t.map(i=>i)}else{const t=new Er(e[0]);super(Xp,e[1],L.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Kt.toString(t)).join(", "),e}}Pc.NAME="Extended Key Usages";var Qr;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(Qr||(Qr={}));class Lc extends et{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,oo);this.usages=t.toNumber()}else{const t=new oo(e[0]);super(Qp,e[1],L.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,oo);return e[""]=t.toJSON().join(", "),e}}Lc.NAME="Key Usages";class Ki extends et{static async create(e,t=!1,i=Ie.get()){const s=await(await at.create(e,i)).getKeyIdentifier(i);return new Ki(W.ToHex(s),t)}constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,Lt);this.keyId=W.ToHex(t)}else{const t=typeof e[0]=="string"?W.FromHex(e[0]):e[0],i=new Lt(t);super(rf,e[1],L.serialize(i)),this.keyId=W.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,Lt);return e[""]=t,e}}Ki.NAME="Subject Key Identifier";class Nf extends et{constructor(...e){U.isBufferSource(e[0])?super(e[0]):super(nf,e[1],new Ai(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,Wo);this.names=new Ai(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}Nf.NAME="Subject Alternative Name";class tt{static register(e,t){this.items.set(e,t)}static create(e){const t=new et(e),i=this.items.get(t.type);return i?new i(e):t}}tt.items=new Map;class Of extends et{constructor(...e){var t;if(U.isBufferSource(e[0])){super(e[0]);const i=L.parse(this.value,Ar);this.policies=i.map(r=>r.policyIdentifier)}else{const i=e[0],r=(t=e[1])!==null&&t!==void 0?t:!1,s=new Ar(i.map(o=>new Is({policyIdentifier:o})));super(Zp,r,L.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new ae("",{},Kt.toString(t))),e}}Of.NAME="Certificate Policies";tt.register(Zp,Of);class Bf extends et{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const r=e[0].map(o=>new Kn({distributionPoint:new un({fullName:[new Q({uniformResourceIdentifier:o})]})})),s=new Cn(r);super(Po,e[1],L.serialize(s))}else{const i=new Cn(e[0]);super(Po,e[1],L.serialize(i))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,Cn);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var i;const r={};return t.distributionPoint&&(r[""]=(i=t.distributionPoint.fullName)===null||i===void 0?void 0:i.map(s=>new Rt(s).toString()).join(", ")),t.reasons&&(r.Reasons=t.reasons.toString()),t.cRLIssuer&&(r["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),r}),e}}Bf.NAME="CRL Distribution Points";class Tf extends et{constructor(...e){var t,i,r,s;if(U.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof In){const o=new In(e[0]);super(jo,e[1],L.serialize(o))}else{const o=e[0],c=new In;Qi(c,o,zl,"ocsp"),Qi(c,o,jl,"caIssuers"),Qi(c,o,Nl,"timeStamping"),Qi(c,o,Ol,"caRepository"),super(jo,e[1],L.serialize(c))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(i=this.caIssuers)!==null&&i!==void 0||(this.caIssuers=[]),(r=this.timeStamping)!==null&&r!==void 0||(this.timeStamping=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],L.parse(e.extnValue,In).forEach(i=>{switch(i.accessMethod){case zl:this.ocsp.push(new Rt(i.accessLocation));break;case jl:this.caIssuers.push(new Rt(i.accessLocation));break;case Nl:this.timeStamping.push(new Rt(i.accessLocation));break;case Ol:this.caRepository.push(new Rt(i.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Xi(e,"OCSP",this.ocsp),this.caIssuers.length&&Xi(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Xi(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Xi(e,"CA Repository",this.caRepository),e}}Tf.NAME="Authority Info Access";function Xi(n,e,t){if(t.length===1)n[e]=t[0].toTextObject();else{const i=new ae("");t.forEach((r,s)=>{const o=r.toTextObject(),c=`${o[ae.NAME]} ${s+1}`;let l=i[c];Array.isArray(l)||(l=[],i[c]=l),l.push(o)}),n[e]=i}}function Qi(n,e,t,i){const r=e[i];r&&(Array.isArray(r)?r:[r]).forEach(o=>{typeof o=="string"&&(o=new Rt("url",o)),n.push(new Oi({accessMethod:t,accessLocation:L.parse(o.rawData,Q)}))})}class Qn extends Wt{constructor(...e){let t;if(U.isBufferSource(e[0]))t=U.toArrayBuffer(e[0]);else{const i=e[0],r=Array.isArray(e[1])?e[1].map(s=>U.toArrayBuffer(s)):[];t=L.serialize(new Et({type:i,values:r}))}super(t,Et)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new ae("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ae.NAME]===Qn.NAME&&(e[ae.NAME]=Kt.toString(this.type)),e}}Qn.NAME="Attribute";class Rf extends Qn{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else{const i=new Yr({printableString:e[0]});super(If,[L.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=L.parse(this.values[0],Yr);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ae.VALUE]=this.password,e}}Rf.NAME="Challenge Password";class Uc extends Qn{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else{const i=e[0],r=new Mt;for(const s of i)r.push(L.parse(s.rawData,Xe));super(Tc,[L.serialize(r)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=L.parse(this.values[0],Mt);this.items=t.map(i=>tt.create(L.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[ae.NAME]]=i;return e}}Uc.NAME="Extensions";class Js{static register(e,t){this.items.set(e,t)}static create(e){const t=new Qn(e),i=this.items.get(t.type);return i?new i(e):t}}Js.items=new Map;const Wi="crypto.signatureFormatter";class h0{toAsnSignature(e,t){return U.toArrayBuffer(t)}toWebSignature(e,t){return U.toArrayBuffer(t)}}var or;let Pa=or=class{static createPssParams(e,t){const i=or.getHashAlgorithm(e);return i?new _n({hashAlgorithm:i,maskGenAlgorithm:new H({algorithm:Vs,parameters:L.serialize(i)}),saltLength:t}):null}static getHashAlgorithm(e){const t=ze.resolve(mn);return typeof e=="string"?t.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new H({algorithm:Mr,parameters:null});case"sha-256":return new H({algorithm:ha,parameters:null});case"sha-384":return new H({algorithm:Hr,parameters:null});case"sha-512":return new H({algorithm:Dr,parameters:null})}}else return new H({algorithm:hn,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=or.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new H({algorithm:di,parameters:L.serialize(t)})}else return new H({algorithm:di,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case hn:return{name:"RSASSA-PKCS1-v1_5"};case Mr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case ha:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Hr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Dr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case di:if(e.parameters){const t=L.parse(e.parameters,_n);return{name:"RSA-PSS",hash:ze.resolve(mn).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};Pa=or=d([Fs()],Pa);ze.registerSingleton(qi,Pa);let La=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new H({algorithm:Fr});case"sha-256":return new H({algorithm:qr});case"sha-384":return new H({algorithm:Kr});case"sha-512":return new H({algorithm:Wr})}return null}toWebAlgorithm(e){switch(e.algorithm){case Fr:return{name:"SHA-1"};case qr:return{name:"SHA-256"};case Kr:return{name:"SHA-384"};case Wr:return{name:"SHA-512"}}return null}};La=d([Fs()],La);ze.registerSingleton(qi,La);class Ye{addPadding(e,t){const i=U.toUint8Array(t),r=new Uint8Array(e);return r.set(i,e-i.length),r}removePadding(e,t=!1){let i=U.toUint8Array(e);for(let r=0;r<i.length;r++)if(i[r]){i=i.slice(r);break}if(t&&i[0]>127){const r=new Uint8Array(i.length+1);return r.set(i,1),r.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,r=Ye.namedCurveSize.get(i)||Ye.defaultNamedCurveSize,s=new Vr,o=U.toUint8Array(t);return s.r=this.removePadding(o.slice(0,r),!0),s.s=this.removePadding(o.slice(r,r+r),!0),L.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=L.parse(t,Vr),r=e.namedCurve,s=Ye.namedCurveSize.get(r)||Ye.defaultNamedCurveSize,o=this.addPadding(s,this.removePadding(i.r)),c=this.addPadding(s,this.removePadding(i.s));return Eg(o,c)}return null}}Ye.namedCurveSize=new Map;Ye.defaultNamedCurveSize=32;const go="1.3.101.110",Gu="1.3.101.111",_o="1.3.101.112",Ju="1.3.101.113";let Ua=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=_o;break;case"x25519":t=go;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=_o;break;case"ed448":t=Ju;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=go;break;case"x448":t=Gu;break}}return t?new H({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case _o:return{name:"Ed25519"};case Ju:return{name:"EdDSA",namedCurve:"Ed448"};case go:return{name:"X25519"};case Gu:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Ua=d([Fs()],Ua);ze.registerSingleton(qi,Ua);class g0 extends zt{constructor(e){zt.isAsnEncoded(e)?super(e,xi):super(e),this.tag=Ke.CertificateRequestTag}onInit(e){this.tbs=L.serialize(e.certificationRequestInfo),this.publicKey=new at(e.certificationRequestInfo.subjectPKInfo);const t=ze.resolve(mn);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(r=>Js.create(L.serialize(r)));const i=this.getAttribute(Tc);this.extensions=[],i instanceof Uc&&(this.extensions=i.items),this.subjectName=new Ze(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const t of this.attributes)if(t.type===e)return t;return null}getAttributes(e){return this.attributes.filter(t=>t.type===e)}getExtension(e){for(const t of this.extensions)if(t.type===e)return t;return null}getExtensions(e){return this.extensions.filter(t=>t.type===e)}async verify(e=Ie.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),r=ze.resolveAll(Wi).reverse();let s=null;for(const c of r)if(s=c.toWebSignature(t,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,xi),i=t.certificationRequestInfo,r=new ae("",{Version:`${dn[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ae("");for(const o of this.attributes){const c=o.toTextObject();s[c[ae.NAME]]=c}r.Attributes=s}return e.Data=r,e.Signature=new ae("",{Algorithm:yn.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}g0.NAME="PKCS#10 Certificate Request";class Vc extends zt{constructor(e){zt.isAsnEncoded(e)?super(e,pn):super(e),this.tag=Ke.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=L.serialize(t),this.serialNumber=W.ToHex(t.serialNumber),this.subjectName=new Ze(t.subject),this.subject=new Ze(t.subject).toString(),this.issuerName=new Ze(t.issuer),this.issuer=this.issuerName.toString();const i=ze.resolve(mn);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const r=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!r)throw new Error("Cannot get 'notBefore' value");this.notBefore=r;const s=t.validity.notAfter.utcTime||t.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.extensions=[],t.extensions&&(this.extensions=t.extensions.map(o=>tt.create(L.serialize(o)))),this.publicKey=new at(t.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if(typeof e=="string"){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>typeof e=="string"?t.type===e:t instanceof e)}async verify(e={},t=Ie.get()){let i,r;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},r=await s.publicKey.export(i,["verify"],t);else if(s instanceof at)i={...s.algorithm,...this.signatureAlgorithm},r=await s.export(i,["verify"],t);else if(U.isBufferSource(s)){const u=new at(s);i={...u.algorithm,...this.signatureAlgorithm},r=await u.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},r=s}catch{return!1}const o=ze.resolveAll(Wi).reverse();let c=null;for(const u of o)if(c=u.toWebSignature(i,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await t.subtle.verify(this.signatureAlgorithm,r,c,this.tbs);if(e.signatureOnly)return l;{const p=(e.date||new Date).getTime();return l&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Ie.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Ie.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,pn),i=t.tbsCertificate,r=new ae("",{Version:`${dn[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":yn.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new ae("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(r["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(r["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new ae("");for(const o of this.extensions){const c=o.toTextObject();s[c[ae.NAME]]=c}r.Extensions=s}return e.Data=r,e.Signature=new ae("",{Algorithm:yn.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}Vc.NAME="Certificate";class _0{static async createSelfSigned(e,t=Ie.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},t)}static async create(e,t=Ie.get()){var i;let r;e.publicKey instanceof at?r=e.publicKey.rawData:"publicKey"in e.publicKey?r=e.publicKey.publicKey.rawData:U.isBufferSource(e.publicKey)?r=e.publicKey:r=await t.subtle.exportKey("spki",e.publicKey);const s=e.serialNumber?U.toUint8Array(W.FromHex(e.serialNumber)):t.getRandomValues(new Uint8Array(16));s[0]>127&&(s[0]&=127),s.length>1&&s[0]===0&&(s[1]|=128);const o=e.notBefore||new Date,c=e.notAfter||new Date(o.getTime()+31536e6),l=new pn({tbsCertificate:new Ge({version:dn.v3,serialNumber:s,validity:new Bi({notBefore:o,notAfter:c}),extensions:new Mt(((i=e.extensions)===null||i===void 0?void 0:i.map(b=>L.parse(b.rawData,Xe)))||[]),subjectPublicKeyInfo:L.parse(r,ot)})});if(e.subject){const b=e.subject instanceof Ze?e.subject:new Ze(e.subject);l.tbsCertificate.subject=L.parse(b.toArrayBuffer(),ve)}if(e.issuer){const b=e.issuer instanceof Ze?e.issuer:new Ze(e.issuer);l.tbsCertificate.issuer=L.parse(b.toArrayBuffer(),ve)}const u={hash:"SHA-256"},p="signingKey"in e?{...u,...e.signingAlgorithm,...e.signingKey.algorithm}:{...u,...e.signingAlgorithm},g=ze.resolve(mn);l.tbsCertificate.signature=l.signatureAlgorithm=g.toAsnAlgorithm(p);const _=L.serialize(l.tbsCertificate),x="signingKey"in e?await t.subtle.sign(p,e.signingKey,_):e.signature,h=ze.resolveAll(Wi).reverse();let m=null;for(const b of h)if(m=b.toAsnSignature(p,x),m)break;if(!m)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return l.signatureValue=m,new Vc(L.serialize(l))}}var Zu;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Zu||(Zu={}));tt.register(Jp,Rc);tt.register(Xp,Pc);tt.register(Qp,Lc);tt.register(rf,Ki);tt.register(No,Ei);tt.register(nf,Nf);tt.register(Po,Bf);tt.register(jo,Tf);Js.register(If,Rf);Js.register(Tc,Uc);ze.registerSingleton(Wi,h0);ze.registerSingleton(Wi,Ye);Ye.namedCurveSize.set("P-256",32);Ye.namedCurveSize.set("K-256",32);Ye.namedCurveSize.set("P-384",48);Ye.namedCurveSize.set("P-521",66);const Yu="0123456789abcdef";function Va(n){const e=new Uint8Array(n);let t="";for(let i=0;i<e.length;i++){const r=e[i]>>4;t+=Yu[r];const s=e[i]&15;t+=Yu[s]}return t}class Pf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=5;)s-=5,i+=this.alphabet[r>>s&31];if(s>0&&(i+=this.alphabet[r<<5-s&31]),(t==null?void 0:t.includePadding)??!0){const c=(8-i.length%8)%8;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/8),s=[];for(let o=0;o<r;o++){let c=0;const l=[];for(let p=0;p<8;p++){const g=e[o*8+p];if(g==="="){if(o+1!==r)throw new Error(`Invalid character: ${g}`);c+=1;continue}if(g===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const _=this.decodeMap.get(g)??null;if(_===null)throw new Error(`Invalid character: ${g}`);l.push(_)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const u=(l[0]<<3)+(l[1]>>2);if(s.push(u),c<6){const p=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(p)}if(c<4){const p=((l[3]&255)<<4)+(l[4]>>1);s.push(p)}if(c<3){const p=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(p)}if(c<1){const p=((l[6]&7)<<5)+l[7];s.push(p)}}return Uint8Array.from(s)}}new Pf("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new Pf("0123456789ABCDEFGHIJKLMNOPQRSTUV");class Lf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=6;)s+=-6,i+=this.alphabet[r>>s&63];if(s>0&&(i+=this.alphabet[r<<6-s&63]),(t==null?void 0:t.includePadding)??!0){const c=(4-i.length%4)%4;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/4),s=[];for(let o=0;o<r;o++){let c=0,l=0;for(let u=0;u<4;u++){const p=e[o*4+u];if(p==="="){if(o+1!==r)throw new Error(`Invalid character: ${p}`);c+=1;continue}if(p===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const g=this.decodeMap.get(p)??null;if(g===null)throw new Error(`Invalid character: ${p}`);l+=g<<6*(3-u)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}}const m0=new Lf("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),sn=new Lf("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");class y0{constructor(e){te(this,"hash");this.hash=e}async verify(e,t,i){const r=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",r,t,i)}async sign(e,t){const i=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",i,t)}async generateKeyPair(e){const t=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),i=await crypto.subtle.exportKey("pkcs8",t.privateKey),r=await crypto.subtle.exportKey("spki",t.publicKey);return{privateKey:i,publicKey:r}}}async function Uf(n){return await crypto.subtle.digest("SHA-256",n)}async function Ma(n){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},t=await crypto.subtle.generateKey(e,!0,["sign","verify"]),i=Ve(),r=Va(new TextEncoder().encode(i)),s=await _0.createSelfSigned({serialNumber:r,name:n.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:t,extensions:[new Rc(!0,2,!0),new Pc(["1.3.6.1.5.5.7.3.1"],!0),new Lc(Qr.keyCertSign|Qr.cRLSign,!0),await Ki.create(t.publicKey)]}),o=await crypto.subtle.exportKey("pkcs8",t.privateKey),c=s.toString("pem"),l=await w0(s),u=Va(await s.getThumbprint()),p=v0("PRIVATE",o);return{kid:s.serialNumber,cert:c,thumbprint:u,fingerprint:l,pkcs7:p}}function v0(n,e){const t=m0.encode(new Uint8Array(e));let i=`-----BEGIN ${n} KEY-----\r
117
+ */const Fi="crypto.algorithm";class e0{getAlgorithms(){return je.resolveAll(Fi)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new H({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const r=i.toWebAlgorithm(e);if(r)return r}return{name:e.algorithm,parameters:e.parameters}}}const mn="crypto.algorithmProvider";je.registerSingleton(mn,e0);var sr;const qe="1.3.36.3.3.2.8.1.1",hu=`${qe}.1`,gu=`${qe}.2`,_u=`${qe}.3`,mu=`${qe}.4`,yu=`${qe}.5`,vu=`${qe}.6`,wu=`${qe}.7`,bu=`${qe}.8`,ku=`${qe}.9`,xu=`${qe}.10`,Su=`${qe}.11`,Au=`${qe}.12`,Iu=`${qe}.13`,Eu=`${qe}.14`,zu="brainpoolP160r1",$u="brainpoolP160t1",Cu="brainpoolP192r1",ju="brainpoolP192t1",Nu="brainpoolP224r1",Ou="brainpoolP224t1",Bu="brainpoolP256r1",Tu="brainpoolP256t1",Ru="brainpoolP320r1",Pu="brainpoolP320t1",Lu="brainpoolP384r1",Uu="brainpoolP384t1",Vu="brainpoolP512r1",Mu="brainpoolP512t1",ge="ECDSA";let Si=sr=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case ge.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return S_;case"sha-256":return A_;case"sha-384":return I_;case"sha-512":return E_}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=Fl;break;case"K-256":t=sr.SECP256K1;break;case"P-384":t=Kl;break;case"P-521":t=Wl;break;case zu:t=hu;break;case $u:t=gu;break;case Cu:t=_u;break;case ju:t=mu;break;case Nu:t=yu;break;case Ou:t=vu;break;case Bu:t=wu;break;case Tu:t=bu;break;case Ru:t=ku;break;case Pu:t=xu;break;case Lu:t=Su;break;case Uu:t=Au;break;case Vu:t=Iu;break;case Mu:t=Eu;break}if(t)return new H({algorithm:bi,parameters:L.serialize(new Dt({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case zc:return{name:ge,hash:{name:"SHA-1"}};case $c:return{name:ge,hash:{name:"SHA-256"}};case Cc:return{name:ge,hash:{name:"SHA-384"}};case jc:return{name:ge,hash:{name:"SHA-512"}};case bi:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(L.parse(e.parameters,Dt).namedCurve){case Fl:return{name:ge,namedCurve:"P-256"};case sr.SECP256K1:return{name:ge,namedCurve:"K-256"};case Kl:return{name:ge,namedCurve:"P-384"};case Wl:return{name:ge,namedCurve:"P-521"};case hu:return{name:ge,namedCurve:zu};case gu:return{name:ge,namedCurve:$u};case _u:return{name:ge,namedCurve:Cu};case mu:return{name:ge,namedCurve:ju};case yu:return{name:ge,namedCurve:Nu};case vu:return{name:ge,namedCurve:Ou};case wu:return{name:ge,namedCurve:Bu};case bu:return{name:ge,namedCurve:Tu};case ku:return{name:ge,namedCurve:Ru};case xu:return{name:ge,namedCurve:Pu};case Su:return{name:ge,namedCurve:Lu};case Au:return{name:ge,namedCurve:Uu};case Iu:return{name:ge,namedCurve:Vu};case Eu:return{name:ge,namedCurve:Mu}}}}return null}};Si.SECP256K1="1.3.132.0.10";Si=sr=d([Fs()],Si);je.registerSingleton(Fi,Si);const Ef=Symbol("name"),zf=Symbol("value");class ae{constructor(e,t={},i=""){this[Ef]=e,this[zf]=i;for(const r in t)this[r]=t[r]}}ae.NAME=Ef;ae.VALUE=zf;class t0{static toTextObject(e){const t=new ae("Algorithm Identifier",{},Kt.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case bi:{const i=new Si().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Kt{static toString(e){const t=this.items[e];return t||e}}Kt.items={[qr]:"sha1",[hf]:"sha224",[Fr]:"sha256",[Kr]:"sha384",[Wr]:"sha512",[hn]:"rsaEncryption",[Mr]:"sha1WithRSAEncryption",[O_]:"sha224WithRSAEncryption",[ga]:"sha256WithRSAEncryption",[Hr]:"sha384WithRSAEncryption",[Dr]:"sha512WithRSAEncryption",[bi]:"ecPublicKey",[zc]:"ecdsaWithSHA1",[df]:"ecdsaWithSHA224",[$c]:"ecdsaWithSHA256",[Cc]:"ecdsaWithSHA384",[jc]:"ecdsaWithSHA512",[m_]:"TLS WWW server authentication",[y_]:"TLS WWW client authentication",[v_]:"Code Signing",[w_]:"E-mail Protection",[b_]:"Time Stamping",[k_]:"OCSP Signing",[x_]:"Signed Data"};class yn{static serialize(e){return this.serializeObj(e).join(`
118
+ `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let r=this.pad(t++),s="";const a=e[ae.VALUE];a&&(s=` ${a}`),i.push(`${r}${e[ae.NAME]}:${s}`),r=this.pad(t);for(const c in e){if(typeof c=="symbol")continue;const l=e[c],u=c?`${c}: `:"";if(typeof l=="string"||typeof l=="number"||typeof l=="boolean")i.push(`${r}${u}${l}`);else if(l instanceof Date)i.push(`${r}${u}${l.toUTCString()}`);else if(Array.isArray(l))for(const p of l)p[ae.NAME]=c,i.push(...this.serializeObj(p,t));else if(l instanceof ae)l[ae.NAME]=c,i.push(...this.serializeObj(l,t));else if(U.isBufferSource(l))c?(i.push(`${r}${u}`),i.push(...this.serializeBufferSource(l,t+1))):i.push(...this.serializeBufferSource(l,t));else if("toTextObject"in l){const p=l.toTextObject();p[ae.NAME]=c,i.push(...this.serializeObj(p,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),r=U.toUint8Array(e),s=[];for(let a=0;a<r.length;){const c=[];for(let l=0;l<16&&a<r.length;l++){l===8&&c.push("");const u=r[a++].toString(16).padStart(2,"0");c.push(u)}s.push(`${i}${c.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}yn.oidSerializer=Kt;yn.algorithmSerializer=t0;class Wt{constructor(...e){if(e.length===1){const t=e[0];this.rawData=L.serialize(t),this.onInit(t)}else{const t=L.parse(e[0],e[1]);this.rawData=U.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof Wt?Kd(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return L.toString(this.rawData);case"text":return yn.serialize(this.toTextObject());case"hex":return W.ToHex(this.rawData);case"base64":return W.ToBase64(this.rawData);case"base64url":return W.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ae(this.getTextName(),{},e)}}Wt.NAME="ASN";class tt extends Wt{constructor(...e){let t;U.isBufferSource(e[0])?t=U.toArrayBuffer(e[0]):t=L.serialize(new Qe({extnID:e[0],critical:e[1],extnValue:new re(U.toArrayBuffer(e[2]))})),super(t,Qe)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ae.NAME]===tt.NAME&&(e[ae.NAME]=Kt.toString(this.type)),e}}var $f;class Tt{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[$f]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Tt.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Tt.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=Tt.DEFAULT){const t=this.items.get(e.toLowerCase());if(!t)throw new Error(`Cannot get Crypto by name '${e}'`);return t}set(e,t){if(typeof e=="string"){if(!t)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),t)}else this.items.set(Tt.DEFAULT,e);return this}}$f=Symbol.toStringTag;Tt.DEFAULT="default";const Ee=new Tt,n0=/^[0-2](?:\.[1-9][0-9]*)+$/;function i0(n){return new RegExp(n0).test(n)}class Cf{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return i0(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const He=new Cf;He.register("CN","2.5.4.3");He.register("L","2.5.4.7");He.register("ST","2.5.4.8");He.register("O","2.5.4.10");He.register("OU","2.5.4.11");He.register("C","2.5.4.6");He.register("DC","0.9.2342.19200300.100.1.25");He.register("E","1.2.840.113549.1.9.1");He.register("G","2.5.4.42");He.register("I","2.5.4.43");He.register("SN","2.5.4.4");He.register("T","2.5.4.12");function r0(n,e){return`\\${W.ToHex(W.FromUtf8String(e)).toUpperCase()}`}function s0(n){return n.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,r0)}class Ye{static isASCII(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new Cf,this.asn=new ve;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const r=t[i];this.extraNames.register(i,r)}typeof e=="string"?this.asn=this.fromString(e):e instanceof ve?this.asn=e:U.isBufferSource(e)?this.asn=L.parse(e,ve):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||He.findId(e),i=[];for(const r of this.asn)for(const s of r)s.type===t&&i.push(s.value.toString());return i}getName(e){return this.extraNames.get(e)||He.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,r=t.value.anyValue?`#${W.ToHex(t.value.anyValue)}`:s0(t.value.toString());return`${i}=${r}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const r={};for(const s of i){const a=this.getName(s.type)||s.type;(e=r[a])!==null&&e!==void 0||(r[a]=[]),r[a].push(s.value.anyValue?`#${W.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(r)}return t}fromString(e){const t=new ve,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let r=null,s=",";for(;r=i.exec(`${e},`);){let[,a,c]=r;const l=c[c.length-1];(l===","||l==="+")&&(c=c.slice(0,c.length-1),r[3]=l);const u=r[3];a=this.getTypeOid(a);const p=this.createAttribute(a,c);s==="+"?t[t.length-1].push(p):t.push(new On([p])),s=u}return t}fromJSON(e){const t=new ve;for(const i of e){const r=new On;for(const s in i){const a=this.getTypeOid(s),c=i[s];for(const l of c){const u=this.createAttribute(a,l);r.push(u)}}t.push(r)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const i=new As({type:e});if(typeof t=="object")for(const r in t)switch(r){case"ia5String":i.value.ia5String=t[r];break;case"utf8String":i.value.utf8String=t[r];break;case"universalString":i.value.universalString=t[r];break;case"bmpString":i.value.bmpString=t[r];break;case"printableString":i.value.printableString=t[r];break}else if(t[0]==="#")i.value.anyValue=W.FromHex(t.slice(1));else{const r=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?i.value.ia5String=r:Ye.isPrintableString(r)?i.value.printableString=r:i.value.utf8String=r}return i}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
119
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return L.serialize(this.asn)}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ee.get()):i=e[0]||Ee.get(),await i.subtle.digest(r,this.toArrayBuffer())}}const jf="Cannot initialize GeneralName from ASN.1 data.",Hu=`${jf} Unsupported string format in use.`,o0=`${jf} Value doesn't match to GUID regular expression.`,Du=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,qu="1.3.6.1.4.1.311.25.1",Fu="1.3.6.1.4.1.311.20.2.3",co="dns",lo="dn",uo="email",po="ip",fo="url",ho="guid",go="upn",Yi="id";class Rt extends Wt{constructor(...e){let t;if(e.length===2)switch(e[0]){case lo:{const i=new Ye(e[1]).toArrayBuffer(),r=L.parse(i,ve);t=new Q({directoryName:r});break}case co:t=new Q({dNSName:e[1]});break;case uo:t=new Q({rfc822Name:e[1]});break;case ho:{const i=new RegExp(Du,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const r=i.slice(1).map((s,a)=>a<3?W.ToHex(new Uint8Array(W.FromHex(s)).reverse()):s).join("");t=new Q({otherName:new mi({typeId:qu,value:L.serialize(new re(W.FromHex(r)))})});break}case po:t=new Q({iPAddress:e[1]});break;case Yi:t=new Q({registeredID:e[1]});break;case go:{t=new Q({otherName:new mi({typeId:Fu,value:L.serialize(Kp.toASN(e[1]))})});break}case fo:t=new Q({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else U.isBufferSource(e[0])?t=L.parse(e[0],Q):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=co,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=uo,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=po,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=fo,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Yi,this.value=e.registeredID;else if(e.directoryName!=null)this.type=lo,this.value=new Ye(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===qu){this.type=ho;const t=L.parse(e.otherName.value,re),i=new RegExp(Du,"i").exec(W.ToHex(t));if(!i)throw new Error(o0);this.value=i.slice(1).map((r,s)=>s<3?W.ToHex(new Uint8Array(W.FromHex(r)).reverse()):r).join("-")}else if(e.otherName.typeId===Fu)this.type=go,this.value=L.parse(e.otherName.value,Ce).toString();else throw new Error(Hu);else throw new Error(Hu)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case lo:case co:case ho:case po:case Yi:case go:case fo:e=this.type.toUpperCase();break;case uo:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Yi&&(t=Kt.toString(t)),new ae(e,void 0,t)}}class Ai extends Wt{constructor(e){let t;if(e instanceof Te)t=e;else if(Array.isArray(e)){const i=[];for(const r of e)if(r instanceof Q)i.push(r);else{const s=L.parse(new Rt(r.type,r.value).rawData,Q);i.push(s)}t=new Te(i)}else if(U.isBufferSource(e))t=L.parse(e,Te);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let r=null;try{r=new Rt(i)}catch{continue}t.push(r)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let r=e[i[ae.NAME]];Array.isArray(r)||(r=[],e[i[ae.NAME]]=r),r.push(i)}return e}}Ai.NAME="GeneralNames";const pi="-{5}",Ii="\\n",a0=`[^${Ii}]+`,c0=`${pi}BEGIN (${a0}(?=${pi}))${pi}`,l0=`${pi}END \\1${pi}`,Mn="\\n",u0=`[^:${Ii}]+`,d0=`(?:[^${Ii}]+${Mn}(?: +[^${Ii}]+${Mn})*)`,p0="[a-zA-Z0-9=+/]+",f0=`(?:${p0}${Mn})+`,Ku=`${c0}${Mn}(?:((?:${u0}: ${d0})+))?${Mn}?(${f0})${l0}`;class We{static isPem(e){return typeof e=="string"&&new RegExp(Ku,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Ku,"g"),i=[];let r=null;for(;r=t.exec(e);){const s=r[3].replace(new RegExp(`[${Ii}]+`,"g"),""),a={type:r[1],headers:[],rawData:W.FromBase64(s)},c=r[2];if(c){const l=c.split(new RegExp(Mn,"g"));let u=null;for(const p of l){const[g,_]=p.split(/:(.*)/);if(_===void 0){if(!u)throw new Error("Cannot parse PEM string. Incorrect header value");u.value+=g.trim()}else u&&a.headers.push(u),u={key:g,value:_.trim()}}u&&a.headers.push(u)}i.push(a)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(r=>{if(!U.isBufferSource(r))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:U.toArrayBuffer(r)}))}):e.forEach(r=>{if(!("type"in r))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(r))}),i.join(`
120
+ `)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:U.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),r=[];if(r.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const u of e.headers)r.push(`${u.key}: ${u.value}`);r.push("")}const s=W.ToBase64(e.rawData);let a,c=0;const l=Array();for(;c<s.length&&(s.length-c<64?a=s.substring(c):(a=s.substring(c,c+64),c+=64),a.length!==0);)if(l.push(a),a.length<64)break;return r.push(...l),r.push(`-----END ${i}-----`),r.join(`
121
+ `)}}We.CertificateTag="CERTIFICATE";We.CrlTag="CRL";We.CertificateRequestTag="CERTIFICATE REQUEST";We.PublicKeyTag="PUBLIC KEY";We.PrivateKeyTag="PRIVATE KEY";class Ct extends Wt{static isAsnEncoded(e){return U.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(We.isPem(e))return We.decode(e)[0];if(W.isHex(e))return W.FromHex(e);if(W.isBase64(e))return W.FromBase64(e);if(W.isBase64Url(e))return W.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=W.ToBinary(e);return We.isPem(t)?We.decode(t)[0]:W.isHex(t)?W.FromHex(t):W.isBase64(t)?W.FromBase64(t):W.isBase64Url(t)?W.FromBase64Url(t):U.toArrayBuffer(e)}}constructor(...e){Ct.isAsnEncoded(e[0])?super(Ct.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return We.encode(this.rawData,this.tag);default:return super.toString(e)}}}class ct extends Ct{static async create(e,t=Ee.get()){if(e instanceof ct)return e;if(Tt.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const i=await t.subtle.exportKey("spki",e);return new ct(i)}else{if(e.publicKey)return e.publicKey;if(U.isBufferSource(e))return new ct(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Ct.isAsnEncoded(e)?super(e,at):super(e),this.tag=We.PublicKeyTag}async export(...e){let t,i=["verify"],r={hash:"SHA-256",...this.algorithm};e.length>1?(r=e[0]||r,i=e[1]||i,t=e[2]||Ee.get()):t=e[0]||Ee.get();let s=this.rawData;const a=L.parse(this.rawData,at);return a.algorithm.algorithm===di&&(s=h0(a,s)),t.subtle.importKey("spki",s,r,!0,i)}onInit(e){const t=je.resolve(mn),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case hn:{const r=L.parse(e.subjectPublicKey,Nc),s=U.toUint8Array(r.modulus);i.publicExponent=U.toUint8Array(r.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,r="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(r=e[0]||r,i=e[1]||Ee.get()):i=e[0]||Ee.get(),await i.subtle.digest(r,this.rawData)}async getKeyIdentifier(...e){let t,i="SHA-1";e.length===1?typeof e[0]=="string"?(i=e[0],t=Ee.get()):t=e[0]:e.length===2?(i=e[0],t=e[1]):t=Ee.get();const r=L.parse(this.rawData,at);return await t.subtle.digest(i,r.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,at);switch(e.Algorithm=yn.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case bi:e["EC Point"]=t.subjectPublicKey;break;case hn:default:e["Raw Data"]=t.subjectPublicKey}return e}}function h0(n,e){return n.algorithm=new H({algorithm:hn,parameters:null}),e=L.serialize(n),e}class Ei extends tt{static async create(e,t=!1,i=Ee.get()){if("name"in e&&"serialNumber"in e)return new Ei(e,t);const s=await(await ct.create(e,i)).getKeyIdentifier(i);return new Ei(W.ToHex(s),t)}constructor(...e){if(U.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new en({keyIdentifier:new fc(W.FromHex(e[0]))});super(Oo,e[1],L.serialize(t))}else{const t=e[0],i=t.name instanceof Ai?L.parse(t.name.rawData,Te):t.name,r=new en({authorityCertIssuer:i,authorityCertSerialNumber:W.FromHex(t.serialNumber)});super(Oo,e[1],L.serialize(r))}}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,en);t.keyIdentifier&&(this.keyId=W.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?W.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,en);return t.authorityCertIssuer&&(e["Authority Issuer"]=new Ai(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}Ei.NAME="Authority Key Identifier";class Rc extends tt{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,xr);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new xr({cA:e[0],pathLenConstraint:e[1]});super(Jp,e[2],L.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}Rc.NAME="Basic Constraints";var Wu;(function(n){n.serverAuth="1.3.6.1.5.5.7.3.1",n.clientAuth="1.3.6.1.5.5.7.3.2",n.codeSigning="1.3.6.1.5.5.7.3.3",n.emailProtection="1.3.6.1.5.5.7.3.4",n.timeStamping="1.3.6.1.5.5.7.3.8",n.ocspSigning="1.3.6.1.5.5.7.3.9"})(Wu||(Wu={}));class Pc extends tt{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,Er);this.usages=t.map(i=>i)}else{const t=new Er(e[0]);super(Xp,e[1],L.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Kt.toString(t)).join(", "),e}}Pc.NAME="Extended Key Usages";var Qr;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(Qr||(Qr={}));class Lc extends tt{constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,ao);this.usages=t.toNumber()}else{const t=new ao(e[0]);super(Qp,e[1],L.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,ao);return e[""]=t.toJSON().join(", "),e}}Lc.NAME="Key Usages";class Ki extends tt{static async create(e,t=!1,i=Ee.get()){const s=await(await ct.create(e,i)).getKeyIdentifier(i);return new Ki(W.ToHex(s),t)}constructor(...e){if(U.isBufferSource(e[0])){super(e[0]);const t=L.parse(this.value,Lt);this.keyId=W.ToHex(t)}else{const t=typeof e[0]=="string"?W.FromHex(e[0]):e[0],i=new Lt(t);super(rf,e[1],L.serialize(i)),this.keyId=W.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=L.parse(this.value,Lt);return e[""]=t,e}}Ki.NAME="Subject Key Identifier";class Nf extends tt{constructor(...e){U.isBufferSource(e[0])?super(e[0]):super(nf,e[1],new Ai(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,Go);this.names=new Ai(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}Nf.NAME="Subject Alternative Name";class nt{static register(e,t){this.items.set(e,t)}static create(e){const t=new tt(e),i=this.items.get(t.type);return i?new i(e):t}}nt.items=new Map;class Of extends tt{constructor(...e){var t;if(U.isBufferSource(e[0])){super(e[0]);const i=L.parse(this.value,Ar);this.policies=i.map(r=>r.policyIdentifier)}else{const i=e[0],r=(t=e[1])!==null&&t!==void 0?t:!1,s=new Ar(i.map(a=>new Es({policyIdentifier:a})));super(Zp,r,L.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new ae("",{},Kt.toString(t))),e}}Of.NAME="Certificate Policies";nt.register(Zp,Of);class Bf extends tt{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const r=e[0].map(a=>new Kn({distributionPoint:new un({fullName:[new Q({uniformResourceIdentifier:a})]})})),s=new $n(r);super(Lo,e[1],L.serialize(s))}else{const i=new $n(e[0]);super(Lo,e[1],L.serialize(i))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=L.parse(e.extnValue,$n);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var i;const r={};return t.distributionPoint&&(r[""]=(i=t.distributionPoint.fullName)===null||i===void 0?void 0:i.map(s=>new Rt(s).toString()).join(", ")),t.reasons&&(r.Reasons=t.reasons.toString()),t.cRLIssuer&&(r["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),r}),e}}Bf.NAME="CRL Distribution Points";class Tf extends tt{constructor(...e){var t,i,r,s;if(U.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof In){const a=new In(e[0]);super(No,e[1],L.serialize(a))}else{const a=e[0],c=new In;Qi(c,a,Cl,"ocsp"),Qi(c,a,jl,"caIssuers"),Qi(c,a,Nl,"timeStamping"),Qi(c,a,Ol,"caRepository"),super(No,e[1],L.serialize(c))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(i=this.caIssuers)!==null&&i!==void 0||(this.caIssuers=[]),(r=this.timeStamping)!==null&&r!==void 0||(this.timeStamping=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],L.parse(e.extnValue,In).forEach(i=>{switch(i.accessMethod){case Cl:this.ocsp.push(new Rt(i.accessLocation));break;case jl:this.caIssuers.push(new Rt(i.accessLocation));break;case Nl:this.timeStamping.push(new Rt(i.accessLocation));break;case Ol:this.caRepository.push(new Rt(i.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Xi(e,"OCSP",this.ocsp),this.caIssuers.length&&Xi(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Xi(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Xi(e,"CA Repository",this.caRepository),e}}Tf.NAME="Authority Info Access";function Xi(n,e,t){if(t.length===1)n[e]=t[0].toTextObject();else{const i=new ae("");t.forEach((r,s)=>{const a=r.toTextObject(),c=`${a[ae.NAME]} ${s+1}`;let l=i[c];Array.isArray(l)||(l=[],i[c]=l),l.push(a)}),n[e]=i}}function Qi(n,e,t,i){const r=e[i];r&&(Array.isArray(r)?r:[r]).forEach(a=>{typeof a=="string"&&(a=new Rt("url",a)),n.push(new Oi({accessMethod:t,accessLocation:L.parse(a.rawData,Q)}))})}class Qn extends Wt{constructor(...e){let t;if(U.isBufferSource(e[0]))t=U.toArrayBuffer(e[0]);else{const i=e[0],r=Array.isArray(e[1])?e[1].map(s=>U.toArrayBuffer(s)):[];t=L.serialize(new Et({type:i,values:r}))}super(t,Et)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new ae("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ae.NAME]===Qn.NAME&&(e[ae.NAME]=Kt.toString(this.type)),e}}Qn.NAME="Attribute";class Rf extends Qn{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else{const i=new Yr({printableString:e[0]});super(If,[L.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=L.parse(this.values[0],Yr);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ae.VALUE]=this.password,e}}Rf.NAME="Challenge Password";class Uc extends Qn{constructor(...e){var t;if(U.isBufferSource(e[0]))super(e[0]);else{const i=e[0],r=new Mt;for(const s of i)r.push(L.parse(s.rawData,Qe));super(Tc,[L.serialize(r)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=L.parse(this.values[0],Mt);this.items=t.map(i=>nt.create(L.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[ae.NAME]]=i;return e}}Uc.NAME="Extensions";class Zs{static register(e,t){this.items.set(e,t)}static create(e){const t=new Qn(e),i=this.items.get(t.type);return i?new i(e):t}}Zs.items=new Map;const Wi="crypto.signatureFormatter";class g0{toAsnSignature(e,t){return U.toArrayBuffer(t)}toWebSignature(e,t){return U.toArrayBuffer(t)}}var or;let La=or=class{static createPssParams(e,t){const i=or.getHashAlgorithm(e);return i?new _n({hashAlgorithm:i,maskGenAlgorithm:new H({algorithm:Ms,parameters:L.serialize(i)}),saltLength:t}):null}static getHashAlgorithm(e){const t=je.resolve(mn);return typeof e=="string"?t.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new H({algorithm:Mr,parameters:null});case"sha-256":return new H({algorithm:ga,parameters:null});case"sha-384":return new H({algorithm:Hr,parameters:null});case"sha-512":return new H({algorithm:Dr,parameters:null})}}else return new H({algorithm:hn,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=or.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new H({algorithm:di,parameters:L.serialize(t)})}else return new H({algorithm:di,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case hn:return{name:"RSASSA-PKCS1-v1_5"};case Mr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case ga:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Hr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Dr:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case di:if(e.parameters){const t=L.parse(e.parameters,_n);return{name:"RSA-PSS",hash:je.resolve(mn).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};La=or=d([Fs()],La);je.registerSingleton(Fi,La);let Ua=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new H({algorithm:qr});case"sha-256":return new H({algorithm:Fr});case"sha-384":return new H({algorithm:Kr});case"sha-512":return new H({algorithm:Wr})}return null}toWebAlgorithm(e){switch(e.algorithm){case qr:return{name:"SHA-1"};case Fr:return{name:"SHA-256"};case Kr:return{name:"SHA-384"};case Wr:return{name:"SHA-512"}}return null}};Ua=d([Fs()],Ua);je.registerSingleton(Fi,Ua);class Xe{addPadding(e,t){const i=U.toUint8Array(t),r=new Uint8Array(e);return r.set(i,e-i.length),r}removePadding(e,t=!1){let i=U.toUint8Array(e);for(let r=0;r<i.length;r++)if(i[r]){i=i.slice(r);break}if(t&&i[0]>127){const r=new Uint8Array(i.length+1);return r.set(i,1),r.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,r=Xe.namedCurveSize.get(i)||Xe.defaultNamedCurveSize,s=new Vr,a=U.toUint8Array(t);return s.r=this.removePadding(a.slice(0,r),!0),s.s=this.removePadding(a.slice(r,r+r),!0),L.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=L.parse(t,Vr),r=e.namedCurve,s=Xe.namedCurveSize.get(r)||Xe.defaultNamedCurveSize,a=this.addPadding(s,this.removePadding(i.r)),c=this.addPadding(s,this.removePadding(i.s));return zg(a,c)}return null}}Xe.namedCurveSize=new Map;Xe.defaultNamedCurveSize=32;const _o="1.3.101.110",Gu="1.3.101.111",mo="1.3.101.112",Ju="1.3.101.113";let Va=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=mo;break;case"x25519":t=_o;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=mo;break;case"ed448":t=Ju;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=_o;break;case"x448":t=Gu;break}}return t?new H({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case mo:return{name:"Ed25519"};case Ju:return{name:"EdDSA",namedCurve:"Ed448"};case _o:return{name:"X25519"};case Gu:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Va=d([Fs()],Va);je.registerSingleton(Fi,Va);class _0 extends Ct{constructor(e){Ct.isAsnEncoded(e)?super(e,xi):super(e),this.tag=We.CertificateRequestTag}onInit(e){this.tbs=L.serialize(e.certificationRequestInfo),this.publicKey=new ct(e.certificationRequestInfo.subjectPKInfo);const t=je.resolve(mn);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(r=>Zs.create(L.serialize(r)));const i=this.getAttribute(Tc);this.extensions=[],i instanceof Uc&&(this.extensions=i.items),this.subjectName=new Ye(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const t of this.attributes)if(t.type===e)return t;return null}getAttributes(e){return this.attributes.filter(t=>t.type===e)}getExtension(e){for(const t of this.extensions)if(t.type===e)return t;return null}getExtensions(e){return this.extensions.filter(t=>t.type===e)}async verify(e=Ee.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),r=je.resolveAll(Wi).reverse();let s=null;for(const c of r)if(s=c.toWebSignature(t,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,xi),i=t.certificationRequestInfo,r=new ae("",{Version:`${dn[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ae("");for(const a of this.attributes){const c=a.toTextObject();s[c[ae.NAME]]=c}r.Attributes=s}return e.Data=r,e.Signature=new ae("",{Algorithm:yn.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}_0.NAME="PKCS#10 Certificate Request";class Vc extends Ct{constructor(e){Ct.isAsnEncoded(e)?super(e,pn):super(e),this.tag=We.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=L.serialize(t),this.serialNumber=W.ToHex(t.serialNumber),this.subjectName=new Ye(t.subject),this.subject=new Ye(t.subject).toString(),this.issuerName=new Ye(t.issuer),this.issuer=this.issuerName.toString();const i=je.resolve(mn);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const r=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!r)throw new Error("Cannot get 'notBefore' value");this.notBefore=r;const s=t.validity.notAfter.utcTime||t.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.extensions=[],t.extensions&&(this.extensions=t.extensions.map(a=>nt.create(L.serialize(a)))),this.publicKey=new ct(t.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if(typeof e=="string"){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>typeof e=="string"?t.type===e:t instanceof e)}async verify(e={},t=Ee.get()){let i,r;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},r=await s.publicKey.export(i,["verify"],t);else if(s instanceof ct)i={...s.algorithm,...this.signatureAlgorithm},r=await s.export(i,["verify"],t);else if(U.isBufferSource(s)){const u=new ct(s);i={...u.algorithm,...this.signatureAlgorithm},r=await u.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},r=s}catch{return!1}const a=je.resolveAll(Wi).reverse();let c=null;for(const u of a)if(c=u.toWebSignature(i,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await t.subtle.verify(this.signatureAlgorithm,r,c,this.tbs);if(e.signatureOnly)return l;{const p=(e.date||new Date).getTime();return l&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Ee.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Ee.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=L.parse(this.rawData,pn),i=t.tbsCertificate,r=new ae("",{Version:`${dn[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":yn.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new ae("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(r["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(r["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new ae("");for(const a of this.extensions){const c=a.toTextObject();s[c[ae.NAME]]=c}r.Extensions=s}return e.Data=r,e.Signature=new ae("",{Algorithm:yn.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}Vc.NAME="Certificate";class m0{static async createSelfSigned(e,t=Ee.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},t)}static async create(e,t=Ee.get()){var i;let r;e.publicKey instanceof ct?r=e.publicKey.rawData:"publicKey"in e.publicKey?r=e.publicKey.publicKey.rawData:U.isBufferSource(e.publicKey)?r=e.publicKey:r=await t.subtle.exportKey("spki",e.publicKey);const s=e.serialNumber?U.toUint8Array(W.FromHex(e.serialNumber)):t.getRandomValues(new Uint8Array(16));s[0]>127&&(s[0]&=127),s.length>1&&s[0]===0&&(s[1]|=128);const a=e.notBefore||new Date,c=e.notAfter||new Date(a.getTime()+31536e6),l=new pn({tbsCertificate:new Je({version:dn.v3,serialNumber:s,validity:new Bi({notBefore:a,notAfter:c}),extensions:new Mt(((i=e.extensions)===null||i===void 0?void 0:i.map(b=>L.parse(b.rawData,Qe)))||[]),subjectPublicKeyInfo:L.parse(r,at)})});if(e.subject){const b=e.subject instanceof Ye?e.subject:new Ye(e.subject);l.tbsCertificate.subject=L.parse(b.toArrayBuffer(),ve)}if(e.issuer){const b=e.issuer instanceof Ye?e.issuer:new Ye(e.issuer);l.tbsCertificate.issuer=L.parse(b.toArrayBuffer(),ve)}const u={hash:"SHA-256"},p="signingKey"in e?{...u,...e.signingAlgorithm,...e.signingKey.algorithm}:{...u,...e.signingAlgorithm},g=je.resolve(mn);l.tbsCertificate.signature=l.signatureAlgorithm=g.toAsnAlgorithm(p);const _=L.serialize(l.tbsCertificate),x="signingKey"in e?await t.subtle.sign(p,e.signingKey,_):e.signature,h=je.resolveAll(Wi).reverse();let m=null;for(const b of h)if(m=b.toAsnSignature(p,x),m)break;if(!m)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return l.signatureValue=m,new Vc(L.serialize(l))}}var Zu;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Zu||(Zu={}));nt.register(Jp,Rc);nt.register(Xp,Pc);nt.register(Qp,Lc);nt.register(rf,Ki);nt.register(Oo,Ei);nt.register(nf,Nf);nt.register(Lo,Bf);nt.register(No,Tf);Zs.register(If,Rf);Zs.register(Tc,Uc);je.registerSingleton(Wi,g0);je.registerSingleton(Wi,Xe);Xe.namedCurveSize.set("P-256",32);Xe.namedCurveSize.set("K-256",32);Xe.namedCurveSize.set("P-384",48);Xe.namedCurveSize.set("P-521",66);const Yu="0123456789abcdef";function Ma(n){const e=new Uint8Array(n);let t="";for(let i=0;i<e.length;i++){const r=e[i]>>4;t+=Yu[r];const s=e[i]&15;t+=Yu[s]}return t}class Pf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=5;)s-=5,i+=this.alphabet[r>>s&31];if(s>0&&(i+=this.alphabet[r<<5-s&31]),(t==null?void 0:t.includePadding)??!0){const c=(8-i.length%8)%8;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/8),s=[];for(let a=0;a<r;a++){let c=0;const l=[];for(let p=0;p<8;p++){const g=e[a*8+p];if(g==="="){if(a+1!==r)throw new Error(`Invalid character: ${g}`);c+=1;continue}if(g===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const _=this.decodeMap.get(g)??null;if(_===null)throw new Error(`Invalid character: ${g}`);l.push(_)}if(c===8||c===7||c===5||c===2)throw new Error("Invalid padding");const u=(l[0]<<3)+(l[1]>>2);if(s.push(u),c<6){const p=((l[1]&3)<<6)+(l[2]<<1)+(l[3]>>4);s.push(p)}if(c<4){const p=((l[3]&255)<<4)+(l[4]>>1);s.push(p)}if(c<3){const p=((l[4]&1)<<7)+(l[5]<<2)+(l[6]>>3);s.push(p)}if(c<1){const p=((l[6]&7)<<5)+l[7];s.push(p)}}return Uint8Array.from(s)}}new Pf("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new Pf("0123456789ABCDEFGHIJKLMNOPQRSTUV");class Lf{constructor(e,t){te(this,"alphabet");te(this,"padding");te(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(t==null?void 0:t.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let i=0;i<e.length;i++)this.decodeMap.set(e[i],i)}encode(e,t){let i="",r=0,s=0;for(let c=0;c<e.length;c++)for(r=r<<8|e[c],s+=8;s>=6;)s+=-6,i+=this.alphabet[r>>s&63];if(s>0&&(i+=this.alphabet[r<<6-s&63]),(t==null?void 0:t.includePadding)??!0){const c=(4-i.length%4)%4;for(let l=0;l<c;l++)i+="="}return i}decode(e,t){const i=(t==null?void 0:t.strict)??!0,r=Math.ceil(e.length/4),s=[];for(let a=0;a<r;a++){let c=0,l=0;for(let u=0;u<4;u++){const p=e[a*4+u];if(p==="="){if(a+1!==r)throw new Error(`Invalid character: ${p}`);c+=1;continue}if(p===void 0){if(i)throw new Error("Invalid data");c+=1;continue}const g=this.decodeMap.get(p)??null;if(g===null)throw new Error(`Invalid character: ${p}`);l+=g<<6*(3-u)}s.push(l>>16&255),c<2&&s.push(l>>8&255),c<1&&s.push(l&255)}return Uint8Array.from(s)}}const y0=new Lf("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),sn=new Lf("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");class v0{constructor(e){te(this,"hash");this.hash=e}async verify(e,t,i){const r=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",r,t,i)}async sign(e,t){const i=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",i,t)}async generateKeyPair(e){const t=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),i=await crypto.subtle.exportKey("pkcs8",t.privateKey),r=await crypto.subtle.exportKey("spki",t.publicKey);return{privateKey:i,publicKey:r}}}async function Uf(n){return await crypto.subtle.digest("SHA-256",n)}async function Ha(n){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},t=await crypto.subtle.generateKey(e,!0,["sign","verify"]),i=Me(),r=Ma(new TextEncoder().encode(i)),s=await m0.createSelfSigned({serialNumber:r,name:n.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:t,extensions:[new Rc(!0,2,!0),new Pc(["1.3.6.1.5.5.7.3.1"],!0),new Lc(Qr.keyCertSign|Qr.cRLSign,!0),await Ki.create(t.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",t.privateKey),c=s.toString("pem"),l=await b0(s),u=Ma(await s.getThumbprint()),p=w0("PRIVATE",a);return{kid:s.serialNumber,cert:c,thumbprint:u,fingerprint:l,pkcs7:p}}function w0(n,e){const t=y0.encode(new Uint8Array(e));let i=`-----BEGIN ${n} KEY-----\r
122
122
  `,r=0;for(;r<t.length;)r+64<=t.length?i+=t.substr(r,64)+`\r
123
123
  `:i+=t.substr(r)+`\r
124
124
  `,r+=64;return i+=`-----END ${n} KEY-----\r
125
- `,i}async function w0(n){const e=await n.publicKey.export(),t=await crypto.subtle.exportKey("jwk",e),i=JSON.stringify(t,Object.keys(t).sort()),s=new TextEncoder().encode(i);return Va(await Uf(s))}const b0=1e3*60*60*24,k0=new a.OpenAPIHono().openapi(a.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.array(ko)}},description:"List of keys"}}}),async n=>{const t=(await n.env.data.keys.list()).filter(i=>"cert"in i).map(i=>i);return n.json(t)}).openapi(a.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({kid:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:ko}},description:"The requested key"}}}),async n=>{const{kid:e}=n.req.valid("param"),i=(await n.env.data.keys.list()).find(r=>r.kid===e);if(!i)throw new j(404,{message:"Key not found"});return n.json(i)}).openapi(a.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const e=await n.env.data.keys.list();for await(const i of e)await n.env.data.keys.update(i.kid,{revoked_at:new Date(Date.now()+b0).toISOString()});const t=await Ma({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(t),n.text("OK",{status:201})}).openapi(a.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({kid:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const{kid:e}=n.req.valid("param");if(!await n.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new j(404,{message:"Key not found"});const i=await Ma({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(i),n.text("OK")}),x0=new a.OpenAPIHono().openapi(a.createRoute({tags:["users"],method:"get",path:"/",request:{query:a.z.object({email:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:a.z.array(qa)}},description:"List of users"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{email:t}=n.req.valid("query"),r=(await Fd(n.env.data.users,e,t)).filter(s=>!s.linked_to);return n.json(r)}),S0=Ft.extend({clients:a.z.array(Xt)}),A0=new a.OpenAPIHono().openapi(a.createRoute({tags:["clients"],method:"get",path:"/",request:{query:on,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([S0,a.z.array(Xt)])}},description:"List of clients"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:o}=n.req.valid("query"),l=(await n.env.data.applications.list(e,{page:t,per_page:i,include_totals:r,sort:Dn(s),q:o})).applications;return r?n.json({clients:l,start:0,limit:10,length:l.length}):n.json(l)}).openapi(a.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Xt}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=(await n.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(s=>s.id===t);if(!r)throw new j(404);return n.json(r)}).openapi(a.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.applications.remove(e,t))throw new j(404,{message:"Application not found"});return n.text("OK")}).openapi(a.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:a.z.object(hr.shape).partial()}}},params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Xt}},description:"The update application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=n.req.valid("json");await n.env.data.applications.update(e,t,r);const s=await n.env.data.applications.get(e,t);if(!s)throw new j(404,{message:"Application not found"});return n.json(s)}).openapi(a.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.object(hr.shape)}}},headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:a.z.object(Xt.shape)}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i={...t,id:t.id||Ve(),client_secret:t.client_secret||Ve()},r=await n.env.data.applications.create(e,i);return n.json(r,{status:201})});a.z.object({start:a.z.number(),limit:a.z.number(),length:a.z.number()});rs.extend({email:a.z.string(),login_count:a.z.number(),multifactor:a.z.array(a.z.string()).optional(),last_ip:a.z.string().optional(),last_login:a.z.string().optional(),user_id:a.z.string()}).catchall(a.z.any());const I0=Ft.extend({tenants:a.z.array(En)}),E0=new a.OpenAPIHono().openapi(a.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:on},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:a.z.union([a.z.array(En),I0])}},description:"List of tenants"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),o=await n.env.data.tenants.list({page:e,per_page:t,include_totals:i,sort:Dn(r),q:s});return i?n.json(o):n.json(o.tenants)}).openapi(a.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:En}},description:"A tenant"}}}),async n=>{const{id:e}=n.req.valid("param"),t=await n.env.data.tenants.get(e);if(!t)throw new j(404);return n.json(t)}).openapi(a.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param");return await n.env.data.tenants.remove(e),n.text("OK")}).openapi(a.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:a.z.object(_r.shape).partial()}}},params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param"),t=n.req.valid("json");return await n.env.data.tenants.update(e,t),n.text("OK")}).openapi(a.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.object(_r.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:En}},description:"An tenant"}}}),async n=>{const e=n.req.valid("json"),t=await n.env.data.tenants.create(e);return n.json(t,{status:201})}),$0=Ft.extend({logs:a.z.array(yr)}),C0=new a.OpenAPIHono().openapi(a.createRoute({tags:["logs"],method:"get",path:"/",request:{query:on,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(yr),$0])}},description:"List of log rows"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":o}=n.req.valid("header"),c=await n.env.data.logs.list(o,{page:e,per_page:t,include_totals:i,sort:Dn(r),q:s});return i?n.json(c):n.json(c.logs)}).openapi(a.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yr}},description:"A log entry"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.logs.get(e,t);if(!i)throw new j(404);return n.json(i)}),z0=Ft.extend({hooks:a.z.array(An)}),j0=new a.OpenAPIHono().openapi(a.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:on,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(An),z0])}},description:"List of hooks"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:o}=n.req.valid("query"),c=await n.env.data.hooks.list(e,{page:t,per_page:i,include_totals:r,sort:Dn(s),q:o});return r?n.json(c):n.json(c.hooks)}).openapi(a.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(mr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:An}},description:"The created hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.hooks.create(e,t);return n.json(i,{status:201})}).openapi(a.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({hook_id:a.z.string()}),body:{content:{"application/json":{schema:a.z.object(mr.shape).omit({hook_id:!0}).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:An.shape}},description:"The updated hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=n.req.valid("json");await n.env.data.hooks.update(e,t,i);const r=await n.env.data.hooks.get(e,t);if(!r)throw new j(404,{message:"Hook not found"});return n.json(r)}).openapi(a.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({hook_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:An}},description:"A hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=await n.env.data.hooks.get(e,t);if(!i)throw new j(404,{message:"Hook not found"});return n.json(i)}).openapi(a.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:a.z.object({"tenant-id":a.z.string()}),params:a.z.object({hook_id:a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param");if(!await n.env.data.hooks.remove(e,t))throw new j(404,{message:"Hook not found"});return n.text("OK")}),N0=Ft.extend({connections:a.z.array(Bt)}),O0=new a.OpenAPIHono().openapi(a.createRoute({tags:["connections"],method:"get",path:"/",request:{query:on,headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:a.z.union([a.z.array(Bt),N0])}},description:"List of connectionss"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r=!1,sort:s,q:o}=n.req.valid("query"),c=await n.env.data.connections.list(e,{page:t,per_page:i,include_totals:r,sort:Dn(s),q:o});return r?n.json(c):n.json(c.connections)}).openapi(a.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Bt}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.connections.get(e,t);if(!i)throw new j(404);return n.json(i)}).openapi(a.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.connections.remove(e,t))throw new j(404,{message:"Connection not found"});return n.text("OK")}).openapi(a.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:a.z.object(gr.shape).partial()}}},params:a.z.object({id:a.z.string()}),headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Bt}},description:"The updated connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=n.req.valid("json");if(!await n.env.data.connections.update(e,t,i))throw new j(404,{message:"Connection not found"});const s=await n.env.data.connections.get(e,t);if(!s)throw new j(404,{message:"Connection not found"});return n.json(s)}).openapi(a.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.object(gr.shape)}}},headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Bt}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.connections.create(e,t);return n.json(i,{status:201})}),B0=new a.OpenAPIHono().openapi(a.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:tr}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.promptSettings.get(e);return t?n.json(t):n.json(tr.parse({}))}).openapi(a.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(tr.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.promptSettings.get(e);return Object.assign(i,t),await n.env.data.promptSettings.set(e,i),n.json(i)});let Xu=!1;function Vf(n){n.use(async(e,t)=>(Xu||(n.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),Xu=!0),await t()))}a.z.object({alg:a.z.literal("RS256"),kty:a.z.literal("RSA"),use:a.z.literal("sig"),n:a.z.string(),e:a.z.string(),kid:a.z.string(),x5t:a.z.string(),x5c:a.z.array(a.z.string())});async function T0(n){try{const e=await n.JWKS_SERVICE.fetch(n.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new j(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function R0(n,e){const i=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),r=new Uint8Array(Array.from(e.signature).map(l=>l.charCodeAt(0))),o=(await T0(n.env)).find(l=>l.kid===e.header.kid);if(!o)return console.log("No matching kid found"),!1;const c=await crypto.subtle.importKey("jwk",o,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",c,r,i)}function P0(n){const[e,t,i]=n.split(".");if(!e||!t||!i)return null;const r=JSON.parse(atob(e)),s=JSON.parse(atob(t)),o=atob(i.replace(/-/g,"+").replace(/_/g,"/"));return{header:r,payload:s,signature:o,raw:{header:e,payload:t,signature:i}}}function Mf(n){return async(e,t)=>{var r,s,o;const i=n.openAPIRegistry.definitions.find(c=>"route"in c&&c.route.path===e.req.path&&c.route.method.toUpperCase()===e.req.method);if(i&&"route"in i){const c=(s=(r=i.route.security)==null?void 0:r[0])==null?void 0:s.Bearer;if(!(c!=null&&c.length))return await t();const l=e.req.header("authorization")||"",[u,p]=l.split(" ");if((u==null?void 0:u.toLowerCase())!=="bearer"||!p)throw new j(401,{message:"Missing bearer token"});const g=P0(p);if(!g||!await R0(e,g))throw new j(403,{message:"Invalid JWT signature"});e.set("user_id",g.payload.sub),e.set("user",g.payload);const _=g.payload.permissions||[],x=((o=g.payload.scope)==null?void 0:o.split(" "))||[];if(c.length&&!(c.some(h=>_.includes(h))||c.some(h=>x.includes(h))))throw new j(403,{message:"Unauthorized"})}return await t()}}const L0=new a.OpenAPIHono().openapi(a.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:nr}},description:"Email provider"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.emailProviders.get(e);if(!t)throw new j(404,{message:"Email provider not found"});return n.json(t)}).openapi(a.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(nr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.create(e,t),n.text("OK",{status:201})}).openapi(a.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:a.z.object({"tenant-id":a.z.string()}),body:{content:{"application/json":{schema:a.z.object(nr.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.update(e,t),n.text("OK")});function U0(){const n=new a.OpenAPIHono;n.use(Mf(n));const e=n.route("/branding",sg).route("/email/providers",L0).route("/users",kg).route("/keys",k0).route("/users-by-email",x0).route("/clients",A0).route("/tenants",E0).route("/logs",C0).route("/hooks",j0).route("/connections",O0).route("/prompts",B0);return Vf(e),e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management api"}}),e}function V0(n,e){Object.keys(e).forEach(t=>{const i=e[t];i!=null&&i.length&&n.searchParams.set(t,i)})}function Hn(n){var e,t,i;return{auth0Client:(e=n.query("auth0Client"))==null?void 0:e.slice(0,255),ip:(t=n.header("x-real-ip"))==null?void 0:t.slice(0,45),useragent:(i=n.header("user-agent"))==null?void 0:i.slice(0,512)}}const er=60*5,Mc=30*24*60*60,es=24*60*60,M0="auth-token",Qu=30*60*1e3,H0=5*60,D0=5*60;var ed;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(ed||(ed={}));var td;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(td||(td={}));function F0(n){return Df(n,q0,$i.Include)}function Hf(n){return Df(n,K0,$i.None)}function Df(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,o=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],o+=8;for(let c=0;c<4;c++)o>=6?(i+=e[s>>o-6&63],o-=6):o>0?(i+=e[s<<6-o&63],o=0):t===$i.Include&&(i+="=")}return i}const q0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var $i;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})($i||($i={}));var nd;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(nd||(nd={}));class W0{uint8(e,t){if(e.byteLength<t+1)throw new TypeError("Insufficient bytes");return e[t]}uint16(e,t){if(e.byteLength<t+2)throw new TypeError("Insufficient bytes");return e[t]<<8|e[t+1]}uint32(e,t){if(e.byteLength<t+4)throw new TypeError("Insufficient bytes");let i=0;for(let r=0;r<4;r++)i|=e[t+r]<<24-r*8;return i}uint64(e,t){if(e.byteLength<t+8)throw new TypeError("Insufficient bytes");let i=0n;for(let r=0;r<8;r++)i|=BigInt(e[t+r])<<BigInt(56-r*8);return i}putUint8(e,t,i){if(e.length<i+1)throw new TypeError("Not enough space");if(t<0||t>255)throw new TypeError("Invalid uint8 value");e[i]=t}putUint16(e,t,i){if(e.length<i+2)throw new TypeError("Not enough space");if(t<0||t>65535)throw new TypeError("Invalid uint16 value");e[i]=t>>8,e[i+1]=t&255}putUint32(e,t,i){if(e.length<i+4)throw new TypeError("Not enough space");if(t<0||t>4294967295)throw new TypeError("Invalid uint32 value");for(let r=0;r<4;r++)e[i+r]=t>>(3-r)*8&255}putUint64(e,t,i){if(e.length<i+8)throw new TypeError("Not enough space");if(t<0||t>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let r=0;r<8;r++)e[i+r]=Number(t>>BigInt((7-r)*8)&0xffn)}}const id=new W0;function pt(n,e){return(n<<32-e|n>>>e)>>>0}function G0(n){const e=new J0;return e.update(n),e.digest()}class J0{constructor(){te(this,"blockSize",64);te(this,"size",32);te(this,"blocks",new Uint8Array(64));te(this,"currentBlockSize",0);te(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));te(this,"l",0n);te(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let t=0;if(this.currentBlockSize>0){const i=e.slice(0,64-this.currentBlockSize);this.blocks.set(i,this.currentBlockSize),this.process(),t+=i.byteLength,this.currentBlockSize=0}for(;t+64<=e.byteLength;){const i=e.slice(t,t+64);this.blocks.set(i),this.process(),t+=64}if(e.byteLength-t>0){const i=e.slice(t);this.blocks.set(i),this.currentBlockSize=i.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),id.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let t=0;t<8;t++)id.putUint32(e,this.H[t],t*4);return e}process(){for(let u=0;u<16;u++)this.w[u]=(this.blocks[u*4]<<24|this.blocks[u*4+1]<<16|this.blocks[u*4+2]<<8|this.blocks[u*4+3])>>>0;for(let u=16;u<64;u++){const p=(pt(this.w[u-2],17)^pt(this.w[u-2],19)^this.w[u-2]>>>10)>>>0,g=(pt(this.w[u-15],7)^pt(this.w[u-15],18)^this.w[u-15]>>>3)>>>0;this.w[u]=p+this.w[u-7]+g+this.w[u-16]|0}let e=this.H[0],t=this.H[1],i=this.H[2],r=this.H[3],s=this.H[4],o=this.H[5],c=this.H[6],l=this.H[7];for(let u=0;u<64;u++){const p=(pt(s,6)^pt(s,11)^pt(s,25))>>>0,g=(s&o^~s&c)>>>0,_=l+p+g+Z0[u]+this.w[u]|0,x=(pt(e,2)^pt(e,13)^pt(e,22))>>>0,h=(e&t^e&i^t&i)>>>0,m=x+h|0;l=c,c=o,o=s,s=r+_|0,r=i,i=t,t=e,e=_+m|0}this.H[0]=e+this.H[0]|0,this.H[1]=t+this.H[1]|0,this.H[2]=i+this.H[2]|0,this.H[3]=r+this.H[3]|0,this.H[4]=s+this.H[4]|0,this.H[5]=o+this.H[5]|0,this.H[6]=c+this.H[6]|0,this.H[7]=l+this.H[7]|0}}const Z0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class Y0{constructor(e){te(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function X0(n){const e=G0(new TextEncoder().encode(n));return Hf(e)}function Q0(){const n=new Uint8Array(32);return crypto.getRandomValues(n),Hf(n)}function fi(n,e){const t=new TextEncoder().encode(e.toString()),i=new Request(n,{method:"POST",body:t});return i.headers.set("Content-Type","application/x-www-form-urlencoded"),i.headers.set("Accept","application/json"),i.headers.set("User-Agent","arctic"),i.headers.set("Content-Length",t.byteLength.toString()),i}function mo(n,e){const t=new TextEncoder().encode(`${n}:${e}`);return F0(t)}async function ts(n){let e;try{e=await fetch(n)}catch(t){throw new qf(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new ar(e.status)}if(typeof t!="object"||t===null)throw new zn(e.status,t);let i;try{i=Ff(t)}catch{throw new zn(e.status,t)}throw i}if(e.status===200){let t;try{t=await e.json()}catch{throw new ar(e.status)}if(typeof t!="object"||t===null)throw new zn(e.status,t);return new Y0(t)}throw e.body!==null&&await e.body.cancel(),new ar(e.status)}async function em(n){let e;try{e=await fetch(n)}catch(t){throw new qf(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new zn(e.status,null)}if(typeof t!="object"||t===null)throw new zn(e.status,t);let i;try{i=Ff(t)}catch{throw new zn(e.status,t)}throw i}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new ar(e.status)}function Ff(n){let e;if("error"in n&&typeof n.error=="string")e=n.error;else throw new Error("Invalid error response");let t=null,i=null,r=null;if("error_description"in n){if(typeof n.error_description!="string")throw new Error("Invalid data");t=n.error_description}if("error_uri"in n){if(typeof n.error_uri!="string")throw new Error("Invalid data");i=n.error_uri}if("state"in n){if(typeof n.state!="string")throw new Error("Invalid data");r=n.state}return new tm(e,t,i,r)}class qf extends Error{constructor(e){super("Failed to send request",{cause:e})}}class tm extends Error{constructor(t,i,r,s){super(`OAuth request error: ${t}`);te(this,"code");te(this,"description");te(this,"uri");te(this,"state");this.code=t,this.description=i,this.uri=r,this.state=s}}class ar extends Error{constructor(t){super("Unexpected error response");te(this,"status");this.status=t}}class zn extends Error{constructor(t,i){super("Unexpected error response body");te(this,"status");te(this,"data");this.status=t,this.data=i}}class Hc{constructor(e,t,i){te(this,"clientId");te(this,"clientPassword");te(this,"redirectURI");this.clientId=e,this.clientPassword=t,this.redirectURI=i}createAuthorizationURL(e,t,i){const r=new URL(e);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&r.searchParams.set("redirect_uri",this.redirectURI),r.searchParams.set("state",t),i.length>0&&r.searchParams.set("scope",i.join(" ")),r}createAuthorizationURLWithPKCE(e,t,i,r,s){const o=new URL(e);if(o.searchParams.set("response_type","code"),o.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&o.searchParams.set("redirect_uri",this.redirectURI),o.searchParams.set("state",t),i===Ci.S256){const c=X0(r);o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("code_challenge",c)}else i===Ci.Plain&&(o.searchParams.set("code_challenge_method","plain"),o.searchParams.set("code_challenge",r));return s.length>0&&o.searchParams.set("scope",s.join(" ")),o}async validateAuthorizationCode(e,t,i){const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",t),this.redirectURI!==null&&r.set("redirect_uri",this.redirectURI),i!==null&&r.set("code_verifier",i),this.clientPassword===null&&r.set("client_id",this.clientId);const s=fi(e,r);if(this.clientPassword!==null){const c=mo(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await ts(s)}async refreshAccessToken(e,t,i){const r=new URLSearchParams;r.set("grant_type","refresh_token"),r.set("refresh_token",t),this.clientPassword===null&&r.set("client_id",this.clientId),i.length>0&&r.set("scope",i.join(" "));const s=fi(e,r);if(this.clientPassword!==null){const c=mo(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await ts(s)}async revokeToken(e,t){const i=new URLSearchParams;i.set("token",t),this.clientPassword===null&&i.set("client_id",this.clientId);const r=fi(e,i);if(this.clientPassword!==null){const s=mo(this.clientId,this.clientPassword);r.headers.set("Authorization",`Basic ${s}`)}await em(r)}}var Ci;(function(n){n[n.S256=0]="S256",n[n.Plain=1]="Plain"})(Ci||(Ci={}));var rd;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(rd||(rd={}));var sd;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(sd||(sd={}));function hi(n){return nm(n,im,ns.None)}function nm(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,o=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],o+=8;for(let c=0;c<4;c++)o>=6?(i+=e[s>>o-6&63],o-=6):o>0?(i+=e[s<<6-o&63],o=0):t===ns.Include&&(i+="=")}return i}const im="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var ns;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(ns||(ns={}));var od;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(od||(od={}));function rm(n,e,t){const i=hi(new TextEncoder().encode(n)),r=hi(new TextEncoder().encode(e)),s=hi(t);return i+"."+r+"."+s}function sm(n,e){const t=hi(new TextEncoder().encode(n)),i=hi(new TextEncoder().encode(e)),r=t+"."+i;return new TextEncoder().encode(r)}const om="https://appleid.apple.com/auth/authorize",am="https://appleid.apple.com/auth/token";class Kf{constructor(e,t,i,r,s){te(this,"clientId");te(this,"teamId");te(this,"keyId");te(this,"pkcs8PrivateKey");te(this,"redirectURI");this.clientId=e,this.teamId=t,this.keyId=i,this.pkcs8PrivateKey=r,this.redirectURI=s}createAuthorizationURL(e,t){const i=new URL(om);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId);const i=await this.createClientSecret();t.set("client_secret",i);const r=fi(am,t);return await ts(r)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),t=Math.floor(Date.now()/1e3),i=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),r=JSON.stringify({iss:this.teamId,exp:t+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:t}),s=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,sm(i,r)));return rm(i,r,s)}}const cm="https://www.facebook.com/v16.0/dialog/oauth",lm="https://graph.facebook.com/v16.0/oauth/access_token";class Wf{constructor(e,t,i){te(this,"clientId");te(this,"clientSecret");te(this,"redirectURI");this.clientId=e,this.clientSecret=t,this.redirectURI=i}createAuthorizationURL(e,t){const i=new URL(cm);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId),t.set("client_secret",this.clientSecret);const i=fi(lm,t);return await ts(i)}}const um="https://accounts.google.com/o/oauth2/v2/auth",ad="https://oauth2.googleapis.com/token",dm="https://oauth2.googleapis.com/revoke";class Gf{constructor(e,t,i){te(this,"client");this.client=new Hc(e,t,i)}createAuthorizationURL(e,t,i){return this.client.createAuthorizationURLWithPKCE(um,e,Ci.S256,t,i)}async validateAuthorizationCode(e,t){return await this.client.validateAuthorizationCode(ad,e,t)}async refreshAccessToken(e){return await this.client.refreshAccessToken(ad,e,[])}async revokeToken(e){await this.client.revokeToken(dm,e)}}class Dc{constructor(e,t){te(this,"value");te(this,"unit");this.value=e,this.unit=t}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Dc(Math.round(this.milliseconds()*e),"ms")}}async function cd(n,e,t,i){const r={alg:n,typ:"JWT",...i==null?void 0:i.headers},s={...t};(i==null?void 0:i.audiences)!==void 0&&(s.aud=i.audiences),(i==null?void 0:i.subject)!==void 0&&(s.sub=i.subject),(i==null?void 0:i.issuer)!==void 0&&(s.iss=i.issuer),(i==null?void 0:i.jwtId)!==void 0&&(s.jti=i.jwtId),(i==null?void 0:i.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+i.expiresIn.seconds()),(i==null?void 0:i.notBefore)!==void 0&&(s.nbf=Math.floor(i.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const o=new TextEncoder,c=sn.encode(o.encode(JSON.stringify(r)),{includePadding:!1}),l=sn.encode(o.encode(JSON.stringify(s)),{includePadding:!1}),u=o.encode([c,l].join(".")),p=await fm(n).sign(e,u),g=sn.encode(new Uint8Array(p),{includePadding:!1});return[c,l,g].join(".")}function pm(n){const e=n.split(".");return e.length!==3?null:e}function Fc(n){const e=pm(n);if(!e)return null;const t=new TextDecoder,i=sn.decode(e[0],{strict:!1}),r=sn.decode(e[1],{strict:!1}),s=JSON.parse(t.decode(i));if(typeof s!="object"||s===null||!("alg"in s)||!hm(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const o=JSON.parse(t.decode(r));if(typeof o!="object"||o===null)return null;const c={algorithm:s.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in o){if(typeof o.exp!="number")return null;c.expiresAt=new Date(o.exp*1e3)}if("iss"in o){if(typeof o.iss!="string")return null;c.issuer=o.iss}if("sub"in o){if(typeof o.sub!="string")return null;c.subject=o.sub}if("aud"in o)if(Array.isArray(o.aud)){for(const l of o.aud)if(typeof l!="string")return null;c.audiences=o.aud}else{if(typeof o.aud!="string")return null;c.audiences=[o.aud]}if("nbf"in o){if(typeof o.nbf!="number")return null;c.notBefore=new Date(o.nbf*1e3)}if("iat"in o){if(typeof o.iat!="number")return null;c.issuedAt=new Date(o.iat*1e3)}if("jti"in o){if(typeof o.jti!="string")return null;c.jwtId=o.jti}return{value:n,header:{...s,typ:"JWT",alg:s.alg},payload:{...o},parts:e,...c}}function fm(n){return new y0(gm[n])}function hm(n){return typeof n!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(n)}const gm={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"},Zs=a.z.object({iss:a.z.string().url(),sub:a.z.string(),aud:a.z.string(),exp:a.z.number(),email:a.z.string().optional(),given_name:a.z.string().optional(),family_name:a.z.string().optional(),name:a.z.string().optional(),iat:a.z.number(),auth_time:a.z.number().optional(),nonce:a.z.string().optional(),acr:a.z.string().optional(),amr:a.z.array(a.z.string()).optional(),azp:a.z.string().optional(),at_hash:a.z.string().optional(),c_hash:a.z.string().optional()}).passthrough();Zs.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function yt(n){return n.UNIVERSAL_LOGIN_URL||`${n.ISSUER}u/`}function kt(n){return n.OAUTH_API_URL||n.ISSUER}function Jf(n){const{options:e}=n;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const t=Buffer.from(e.app_secret,"utf-8"),i=t.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),r=Uint8Array.from(Buffer.from(i,"base64"));return t.fill(0),{options:e,keyArray:r}}async function _m(n,e){var l,u;const{options:t,keyArray:i}=Jf(e),r=new Kf(t.client_id,t.team_id,t.kid,i,`${kt(n.env)}callback`),s=Ve(),o=await r.createAuthorizationURL(s,((l=t.scope)==null?void 0:l.split(" "))||["name","email"]);return(((u=t.scope)==null?void 0:u.split(" "))||["name","email"]).some(p=>["email","name"].includes(p))&&o.searchParams.set("response_mode","form_post"),{redirectUrl:o.href,code:s}}async function mm(n,e,t){const{options:i,keyArray:r}=Jf(e),o=await new Kf(i.client_id,i.team_id,i.kid,r,`${kt(n.env)}callback`).validateAuthorizationCode(t),c=Fc(o.idToken());if(!c)throw new Error("Invalid ID token");const l=Zs.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const ym=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:_m,validateAuthorizationCodeAndGetUser:mm},Symbol.toStringTag,{value:"Module"}));async function vm(n,e){var o;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Wf(t.client_id,t.client_secret,`${kt(n.env)}callback`),r=Ve();return{redirectUrl:i.createAuthorizationURL(r,((o=t.scope)==null?void 0:o.split(" "))||["email"]).href,code:r}}async function wm(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Wf(i.client_id,i.client_secret,`${kt(n.env)}callback`).validateAuthorizationCode(t),o=await fetch("https://graph.facebook.com/v16.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${s.accessToken()}`}});if(!o.ok)throw new Error("Failed to fetch user info");const c=await o.json();return n.set("log",`Userinfo: ${JSON.stringify(c)}`),{sub:c.id,email:c.email,name:c.name}}const bm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:vm,validateAuthorizationCodeAndGetUser:wm},Symbol.toStringTag,{value:"Module"}));async function km(n,e){var c;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required Google authentication parameters");const i=new Gf(t.client_id,t.client_secret,`${kt(n.env)}callback`),r=Ve(),s=Q0();return{redirectUrl:i.createAuthorizationURL(r,s,((c=t.scope)==null?void 0:c.split(" "))??["email","profile"]).href,code:r,codeVerifier:s}}async function xm(n,e,t,i){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret||!i)throw new Error("Missing required authentication parameters");const o=await new Gf(r.client_id,r.client_secret,`${kt(n.env)}callback`).validateAuthorizationCode(t,i);console.log("got here");const c=Fc(o.idToken());if(!c)throw new Error("Invalid ID token");const l=Zs.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const Sm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:km,validateAuthorizationCodeAndGetUser:xm},Symbol.toStringTag,{value:"Module"}));async function Am(n,e){var o;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Hc(t.client_id,t.client_secret,`${kt(n.env)}callback`),r=Ve(),s=i.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",r,((o=t.scope)==null?void 0:o.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return s.searchParams.set("response_type","code"),s.searchParams.set("response_mode","query"),{redirectUrl:s.href,code:r}}async function Im(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Hc(i.client_id,i.client_secret,`${kt(n.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",t,null),o=Fc(s.idToken());if(!o)throw new Error("Invalid ID token");const c=Zs.parse(o.payload);if(typeof c.msn!="string")throw new Error("msn not available in id token");const l=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${s.accessToken()}`,"Merchant-Serial-Number":c.msn}});if(!l.ok)throw new j(400,{message:"Failed to get user from vipps"});return await l.json()}const Em=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Am,validateAuthorizationCodeAndGetUser:Im},Symbol.toStringTag,{value:"Module"}));function Zf(n,e){const t=n.env.STRATEGIES||{},r={apple:ym,facebook:bm,"google-oauth2":Sm,vipps:Em,...t}[e];if(!r)throw new Error(`Strategy ${e} not found`);return r}async function qc(n,e){const t=await n.data.clients.get(e);if(!t)throw new j(403,{message:"Client not found"});const i=n.DEFAULT_CLIENT_ID?await n.data.clients.get(n.DEFAULT_CLIENT_ID):void 0,r=await n.data.connections.list(t.tenant.id),s=n.DEFAULT_TENANT_ID?await n.data.connections.list(n.DEFAULT_TENANT_ID):{connections:[]},o=r.connections.map(c=>{var p;const l=(p=s.connections)==null?void 0:p.find(g=>g.name===c.name);return l!=null&&l.options?Bt.parse({...l||{},...c,options:{...l.options||{},...c.options}}):c}).filter(c=>c);return{...t,web_origins:[...(i==null?void 0:i.web_origins)||[],...t.web_origins||[],`${yt(n)}login`],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...t.allowed_logout_urls||[],n.ISSUER],callbacks:[...(i==null?void 0:i.callbacks)||[],...t.callbacks||[],`${yt(n)}info`],connections:o,domains:[...t.domains||[],...(i==null?void 0:i.domains)||[]],tenant:{...(i==null?void 0:i.tenant)||{},...t.tenant}}}function Ys(n,e=[],t={}){try{const i=new URL(n);return e.some(r=>{try{return $m(i,new URL(r),t.allowPathWildcards)}catch{return!1}})}catch{return!1}}function $m(n,e,t){if(n.protocol!==e.protocol)return!1;if(t&&e.pathname.includes("*")){const i=e.pathname.replace(/\*/g,".*").replace(/\//g,"\\/");if(!new RegExp(`^${i}$`).test(n.pathname))return!1}else if(n.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const i=e.hostname.split(".").slice(1).join(".");return n.hostname.endsWith(i)}return n.hostname===e.hostname}function Cm(n){try{const t=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(n);if(!t||!t[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(t[1].replace(/\s/g,"")),i=>i.charCodeAt(0)).buffer}finally{n=n.replace(/./g,"\0")}}async function zm(n,e){if(e==="plain")return n;const t=new TextEncoder().encode(n),i=await Uf(t);return sn.encode(new Uint8Array(i),{includePadding:!1})}function Yf(n,e,t){const i=[];return i.push([encodeURIComponent(n),encodeURIComponent(e)]),(t==null?void 0:t.domain)!==void 0&&i.push(["Domain",t.domain]),(t==null?void 0:t.expires)!==void 0&&i.push(["Expires",t.expires.toUTCString()]),t!=null&&t.httpOnly&&i.push(["HttpOnly"]),(t==null?void 0:t.maxAge)!==void 0&&i.push(["Max-Age",t.maxAge.toString()]),(t==null?void 0:t.path)!==void 0&&i.push(["Path",t.path]),(t==null?void 0:t.sameSite)==="lax"&&i.push(["SameSite","Lax"]),(t==null?void 0:t.sameSite)==="none"&&i.push(["SameSite","None"]),(t==null?void 0:t.sameSite)==="strict"&&i.push(["SameSite","Strict"]),t!=null&&t.secure&&i.push(["Secure"]),i.map(r=>r.join("=")).join("; ")}function jm(n){const e=new Map,t=n.split("; ");for(const i of t){const r=i.split("="),s=r[0],o=r[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(o))}return e}function Kc(n){return`${n}-${M0}`}function Xf(n,e){return e?jm(e).get(Kc(n)):void 0}function Nm(n){const e={path:"/",httpOnly:!0,secure:!0,maxAge:0};return Yf(Kc(n),"",{...e,sameSite:"none"})}function Qf(n,e){const t={path:"/",httpOnly:!0,secure:!0,maxAge:Mc};return Yf(Kc(n),e,{...t,sameSite:"none"})}var Wc={},Xs={};(function(n){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",i="["+e+"]["+t+"]*",r=new RegExp("^"+i+"$"),s=function(c,l){const u=[];let p=l.exec(c);for(;p;){const g=[];g.startIndex=l.lastIndex-p[0].length;const _=p.length;for(let x=0;x<_;x++)g.push(p[x]);u.push(g),p=l.exec(c)}return u},o=function(c){const l=r.exec(c);return!(l===null||typeof l>"u")};n.isExist=function(c){return typeof c<"u"},n.isEmptyObject=function(c){return Object.keys(c).length===0},n.merge=function(c,l,u){if(l){const p=Object.keys(l),g=p.length;for(let _=0;_<g;_++)u==="strict"?c[p[_]]=[l[p[_]]]:c[p[_]]=l[p[_]]}},n.getValue=function(c){return n.isExist(c)?c:""},n.isName=o,n.getAllMatches=s,n.nameRegexp=i})(Xs);const Gc=Xs,Om={allowBooleanAttributes:!1,unpairedTags:[]};Wc.validate=function(n,e){e=Object.assign({},Om,e);const t=[];let i=!1,r=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let s=0;s<n.length;s++)if(n[s]==="<"&&n[s+1]==="?"){if(s+=2,s=ud(n,s),s.err)return s}else if(n[s]==="<"){let o=s;if(s++,n[s]==="!"){s=dd(n,s);continue}else{let c=!1;n[s]==="/"&&(c=!0,s++);let l="";for(;s<n.length&&n[s]!==">"&&n[s]!==" "&&n[s]!==" "&&n[s]!==`
126
- `&&n[s]!=="\r";s++)l+=n[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!Mm(l)){let g;return l.trim().length===0?g="Invalid space after '<'.":g="Tag '"+l+"' is an invalid name.",ye("InvalidTag",g,Oe(n,s))}const u=Rm(n,s);if(u===!1)return ye("InvalidAttr","Attributes for '"+l+"' have open quote.",Oe(n,s));let p=u.value;if(s=u.index,p[p.length-1]==="/"){const g=s-p.length;p=p.substring(0,p.length-1);const _=pd(p,e);if(_===!0)i=!0;else return ye(_.err.code,_.err.msg,Oe(n,g+_.err.line))}else if(c)if(u.tagClosed){if(p.trim().length>0)return ye("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Oe(n,o));if(t.length===0)return ye("InvalidTag","Closing tag '"+l+"' has not been opened.",Oe(n,o));{const g=t.pop();if(l!==g.tagName){let _=Oe(n,g.tagStartPos);return ye("InvalidTag","Expected closing tag '"+g.tagName+"' (opened in line "+_.line+", col "+_.col+") instead of closing tag '"+l+"'.",Oe(n,o))}t.length==0&&(r=!0)}}else return ye("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Oe(n,s));else{const g=pd(p,e);if(g!==!0)return ye(g.err.code,g.err.msg,Oe(n,s-p.length+g.err.line));if(r===!0)return ye("InvalidXml","Multiple possible root nodes found.",Oe(n,s));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),i=!0}for(s++;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="!"){s++,s=dd(n,s);continue}else if(n[s+1]==="?"){if(s=ud(n,++s),s.err)return s}else break;else if(n[s]==="&"){const g=Um(n,s);if(g==-1)return ye("InvalidChar","char '&' is not expected.",Oe(n,s));s=g}else if(r===!0&&!ld(n[s]))return ye("InvalidXml","Extra text at the end",Oe(n,s));n[s]==="<"&&s--}}else{if(ld(n[s]))continue;return ye("InvalidChar","char '"+n[s]+"' is not expected.",Oe(n,s))}if(i){if(t.length==1)return ye("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",Oe(n,t[0].tagStartPos));if(t.length>0)return ye("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ye("InvalidXml","Start tag expected.",1);return!0};function ld(n){return n===" "||n===" "||n===`
127
- `||n==="\r"}function ud(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const i=n.substr(t,e-t);if(e>5&&i==="xml")return ye("InvalidXml","XML declaration allowed only at the start of the document.",Oe(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function dd(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const Bm='"',Tm="'";function Rm(n,e){let t="",i="",r=!1;for(;e<n.length;e++){if(n[e]===Bm||n[e]===Tm)i===""?i=n[e]:i!==n[e]||(i="");else if(n[e]===">"&&i===""){r=!0;break}t+=n[e]}return i!==""?!1:{value:t,index:e,tagClosed:r}}const Pm=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function pd(n,e){const t=Gc.getAllMatches(n,Pm),i={};for(let r=0;r<t.length;r++){if(t[r][1].length===0)return ye("InvalidAttr","Attribute '"+t[r][2]+"' has no space in starting.",ri(t[r]));if(t[r][3]!==void 0&&t[r][4]===void 0)return ye("InvalidAttr","Attribute '"+t[r][2]+"' is without value.",ri(t[r]));if(t[r][3]===void 0&&!e.allowBooleanAttributes)return ye("InvalidAttr","boolean attribute '"+t[r][2]+"' is not allowed.",ri(t[r]));const s=t[r][2];if(!Vm(s))return ye("InvalidAttr","Attribute '"+s+"' is an invalid name.",ri(t[r]));if(!i.hasOwnProperty(s))i[s]=1;else return ye("InvalidAttr","Attribute '"+s+"' is repeated.",ri(t[r]))}return!0}function Lm(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function Um(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Lm(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function ye(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Vm(n){return Gc.isName(n)}function Mm(n){return Gc.isName(n)}function Oe(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ri(n){return n.startIndex+n[1].length}var Jc={};const eh={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n}},Hm=function(n){return Object.assign({},eh,n)};Jc.buildOptions=Hm;Jc.defaultOptions=eh;class Dm{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Fm=Dm;const qm=Xs;function Km(n,e){const t={};if(n[e+3]==="O"&&n[e+4]==="C"&&n[e+5]==="T"&&n[e+6]==="Y"&&n[e+7]==="P"&&n[e+8]==="E"){e=e+9;let i=1,r=!1,s=!1,o="";for(;e<n.length;e++)if(n[e]==="<"&&!s){if(r&&Jm(n,e)){e+=7;let c,l;[c,l,e]=Wm(n,e+1),l.indexOf("&")===-1&&(t[Qm(c)]={regx:RegExp(`&${c};`,"g"),val:l})}else if(r&&Zm(n,e))e+=8;else if(r&&Ym(n,e))e+=8;else if(r&&Xm(n,e))e+=9;else if(Gm)s=!0;else throw new Error("Invalid DOCTYPE");i++,o=""}else if(n[e]===">"){if(s?n[e-1]==="-"&&n[e-2]==="-"&&(s=!1,i--):i--,i===0)break}else n[e]==="["?r=!0:o+=n[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Wm(n,e){let t="";for(;e<n.length&&n[e]!=="'"&&n[e]!=='"';e++)t+=n[e];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const i=n[e++];let r="";for(;e<n.length&&n[e]!==i;e++)r+=n[e];return[t,r,e]}function Gm(n,e){return n[e+1]==="!"&&n[e+2]==="-"&&n[e+3]==="-"}function Jm(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="N"&&n[e+4]==="T"&&n[e+5]==="I"&&n[e+6]==="T"&&n[e+7]==="Y"}function Zm(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="L"&&n[e+4]==="E"&&n[e+5]==="M"&&n[e+6]==="E"&&n[e+7]==="N"&&n[e+8]==="T"}function Ym(n,e){return n[e+1]==="!"&&n[e+2]==="A"&&n[e+3]==="T"&&n[e+4]==="T"&&n[e+5]==="L"&&n[e+6]==="I"&&n[e+7]==="S"&&n[e+8]==="T"}function Xm(n,e){return n[e+1]==="!"&&n[e+2]==="N"&&n[e+3]==="O"&&n[e+4]==="T"&&n[e+5]==="A"&&n[e+6]==="T"&&n[e+7]==="I"&&n[e+8]==="O"&&n[e+9]==="N"}function Qm(n){if(qm.isName(n))return n;throw new Error(`Invalid entity name ${n}`)}var ey=Km;const ty=/^[-+]?0x[a-fA-F0-9]+$/,ny=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const iy={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ry(n,e={}){if(e=Object.assign({},iy,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(e.hex&&ty.test(t))return Number.parseInt(t,16);{const i=ny.exec(t);if(i){const r=i[1],s=i[2];let o=sy(i[3]);const c=i[4]||i[6];if(!e.leadingZeros&&s.length>0&&r&&t[2]!==".")return n;if(!e.leadingZeros&&s.length>0&&!r&&t[1]!==".")return n;{const l=Number(t),u=""+l;return u.search(/[eE]/)!==-1||c?e.eNotation?l:n:t.indexOf(".")!==-1?u==="0"&&o===""||u===o||r&&u==="-"+o?l:n:s?o===u||r+o===u?l:n:t===u||t===r+u?l:n}}else return n}}function sy(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substr(0,n.length-1))),n}var oy=ry;function ay(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var th=ay;const nh=Xs,si=Fm,cy=ey,ly=oy,uy=th;let dy=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=py,this.parseXml=my,this.parseTextData=fy,this.resolveNameSpace=hy,this.buildAttributesMap=_y,this.isItStopNode=by,this.replaceEntitiesValue=vy,this.readStopNodeData=xy,this.saveTextToParentTag=wy,this.addChild=yy,this.ignoreAttributesFn=uy(this.options.ignoreAttributes)}};function py(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:n[i]}}}function fy(n,e,t,i,r,s,o){if(n!==void 0&&(this.options.trimValues&&!i&&(n=n.trim()),n.length>0)){o||(n=this.replaceEntitiesValue(n));const c=this.options.tagValueProcessor(e,n,t,r,s);return c==null?n:typeof c!=typeof n||c!==n?c:this.options.trimValues?Da(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?Da(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function hy(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const gy=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function _y(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const i=nh.getAllMatches(n,gy),r=i.length,s={};for(let o=0;o<r;o++){const c=this.resolveNameSpace(i[o][1]);if(this.ignoreAttributesFn(c,e))continue;let l=i[o][4],u=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const p=this.options.attributeValueProcessor(c,l,e);p==null?s[u]=l:typeof p!=typeof l||p!==l?s[u]=p:s[u]=Da(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=s,o}return s}}const my=function(n){n=n.replace(/\r\n?/g,`
128
- `);const e=new si("!xml");let t=e,i="",r="";for(let s=0;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="/"){const c=tn(n,">",s,"Closing Tag is not closed.");let l=n.substring(s+2,c).trim();if(this.options.removeNSPrefix){const g=l.indexOf(":");g!==-1&&(l=l.substr(g+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(i=this.saveTextToParentTag(i,t,r));const u=r.substring(r.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let p=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(p=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=r.lastIndexOf("."),r=r.substring(0,p),t=this.tagsNodeStack.pop(),i="",s=c}else if(n[s+1]==="?"){let c=Ha(n,s,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,t,r),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const l=new si(c.tagName);l.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,r,c.tagName)),this.addChild(t,l,r)}s=c.closeIndex+1}else if(n.substr(s+1,3)==="!--"){const c=tn(n,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const l=n.substring(s+4,c-2);i=this.saveTextToParentTag(i,t,r),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}s=c}else if(n.substr(s+1,2)==="!D"){const c=cy(n,s);this.docTypeEntities=c.entities,s=c.i}else if(n.substr(s+1,2)==="!["){const c=tn(n,"]]>",s,"CDATA is not closed.")-2,l=n.substring(s+9,c);i=this.saveTextToParentTag(i,t,r);let u=this.parseTextData(l,t.tagname,r,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,u),s=c+2}else{let c=Ha(n,s,this.options.removeNSPrefix),l=c.tagName;const u=c.rawTagName;let p=c.tagExp,g=c.attrExpPresent,_=c.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&i&&t.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,t,r,!1));const x=t;if(x&&this.options.unpairedTags.indexOf(x.tagname)!==-1&&(t=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),l!==e.tagname&&(r+=r?"."+l:l),this.isItStopNode(this.options.stopNodes,r,l)){let h="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),p=l):p=p.substr(0,p.length-1),s=c.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)s=c.closeIndex;else{const b=this.readStopNodeData(n,u,_+1);if(!b)throw new Error(`Unexpected end of ${u}`);s=b.i,h=b.tagContent}const m=new si(l);l!==p&&g&&(m[":@"]=this.buildAttributesMap(p,r,l)),h&&(h=this.parseTextData(h,l,r,!0,g,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),m.add(this.options.textNodeName,h),this.addChild(t,m,r)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),p=l):p=p.substr(0,p.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const h=new si(l);l!==p&&g&&(h[":@"]=this.buildAttributesMap(p,r,l)),this.addChild(t,h,r),r=r.substr(0,r.lastIndexOf("."))}else{const h=new si(l);this.tagsNodeStack.push(t),l!==p&&g&&(h[":@"]=this.buildAttributesMap(p,r,l)),this.addChild(t,h,r),t=h}i="",s=_}}else i+=n[s];return e.child};function yy(n,e,t){const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),n.addChild(e))}const vy=function(n){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];n=n.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];n=n.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];n=n.replace(t.regex,t.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function wy(n,e,t,i){return n&&(i===void 0&&(i=Object.keys(e.child).length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function by(n,e,t){const i="*."+t;for(const r in n){const s=n[r];if(i===s||e===s)return!0}return!1}function ky(n,e,t=">"){let i,r="";for(let s=e;s<n.length;s++){let o=n[s];if(i)o===i&&(i="");else if(o==='"'||o==="'")i=o;else if(o===t[0])if(t[1]){if(n[s+1]===t[1])return{data:r,index:s}}else return{data:r,index:s};else o===" "&&(o=" ");r+=o}}function tn(n,e,t,i){const r=n.indexOf(e,t);if(r===-1)throw new Error(i);return r+e.length-1}function Ha(n,e,t,i=">"){const r=ky(n,e+1,i);if(!r)return;let s=r.data;const o=r.index,c=s.search(/\s/);let l=s,u=!0;c!==-1&&(l=s.substring(0,c),s=s.substring(c+1).trimStart());const p=l;if(t){const g=l.indexOf(":");g!==-1&&(l=l.substr(g+1),u=l!==r.data.substr(g+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:p}}function xy(n,e,t){const i=t;let r=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const s=tn(n,">",t,`${e} is not closed`);if(n.substring(t+2,s).trim()===e&&(r--,r===0))return{tagContent:n.substring(i,t),i:s};t=s}else if(n[t+1]==="?")t=tn(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=tn(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=tn(n,"]]>",t,"StopNode is not closed.")-2;else{const s=Ha(n,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&r++,t=s.closeIndex)}}function Da(n,e,t){if(e&&typeof n=="string"){const i=n.trim();return i==="true"?!0:i==="false"?!1:ly(n,t)}else return nh.isExist(n)?n:""}var Sy=dy,ih={};function Ay(n,e){return rh(n,e)}function rh(n,e,t){let i;const r={};for(let s=0;s<n.length;s++){const o=n[s],c=Iy(o);let l="";if(t===void 0?l=c:l=t+"."+c,c===e.textNodeName)i===void 0?i=o[c]:i+=""+o[c];else{if(c===void 0)continue;if(o[c]){let u=rh(o[c],e,l);const p=$y(u,e);o[":@"]?Ey(u,o[":@"],l,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),r[c]!==void 0&&r.hasOwnProperty(c)?(Array.isArray(r[c])||(r[c]=[r[c]]),r[c].push(u)):e.isArray(c,l,p)?r[c]=[u]:r[c]=u}}}return typeof i=="string"?i.length>0&&(r[e.textNodeName]=i):i!==void 0&&(r[e.textNodeName]=i),r}function Iy(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function Ey(n,e,t,i){if(e){const r=Object.keys(e),s=r.length;for(let o=0;o<s;o++){const c=r[o];i.isArray(c,t+"."+c,!0,!0)?n[c]=[e[c]]:n[c]=e[c]}}}function $y(n,e){const{textNodeName:t}=e,i=Object.keys(n).length;return!!(i===0||i===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}ih.prettify=Ay;const{buildOptions:Cy}=Jc,zy=Sy,{prettify:jy}=ih,Ny=Wc;let Oy=class{constructor(e){this.externalEntities={},this.options=Cy(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const s=Ny.validate(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const i=new zy(this.options);i.addExternalEntities(this.externalEntities);const r=i.parseXml(e);return this.options.preserveOrder||r===void 0?r:jy(r,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};var By=Oy;const Ty=`
129
- `;function Ry(n,e){let t="";return e.format&&e.indentBy.length>0&&(t=Ty),sh(n,e,"",t)}function sh(n,e,t,i){let r="",s=!1;for(let o=0;o<n.length;o++){const c=n[o],l=Py(c);if(l===void 0)continue;let u="";if(t.length===0?u=l:u=`${t}.${l}`,l===e.textNodeName){let h=c[l];Ly(u,e)||(h=e.tagValueProcessor(l,h),h=oh(h,e)),s&&(r+=i),r+=h,s=!1;continue}else if(l===e.cdataPropName){s&&(r+=i),r+=`<![CDATA[${c[l][0][e.textNodeName]}]]>`,s=!1;continue}else if(l===e.commentPropName){r+=i+`<!--${c[l][0][e.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const h=fd(c[":@"],e),m=l==="?xml"?"":i;let b=c[l][0][e.textNodeName];b=b.length!==0?" "+b:"",r+=m+`<${l}${b}${h}?>`,s=!0;continue}let p=i;p!==""&&(p+=e.indentBy);const g=fd(c[":@"],e),_=i+`<${l}${g}`,x=sh(c[l],e,u,p);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?r+=_+">":r+=_+"/>":(!x||x.length===0)&&e.suppressEmptyNode?r+=_+"/>":x&&x.endsWith(">")?r+=_+`>${x}${i}</${l}>`:(r+=_+">",x&&i!==""&&(x.includes("/>")||x.includes("</"))?r+=i+e.indentBy+x+i:r+=x,r+=`</${l}>`),s=!0}return r}function Py(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(n.hasOwnProperty(i)&&i!==":@")return i}}function fd(n,e){let t="";if(n&&!e.ignoreAttributes)for(let i in n){if(!n.hasOwnProperty(i))continue;let r=e.attributeValueProcessor(i,n[i]);r=oh(r,e),r===!0&&e.suppressBooleanAttributes?t+=` ${i.substr(e.attributeNamePrefix.length)}`:t+=` ${i.substr(e.attributeNamePrefix.length)}="${r}"`}return t}function Ly(n,e){n=n.substr(0,n.length-e.textNodeName.length-1);let t=n.substr(n.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===n||e.stopNodes[i]==="*."+t)return!0;return!1}function oh(n,e){if(n&&n.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const i=e.entities[t];n=n.replace(i.regex,i.val)}return n}var Uy=Ry;const Vy=Uy,My=th,Hy={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Gt(n){this.options=Object.assign({},Hy,n),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=My(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=qy),this.processTextOrObjNode=Dy,this.options.format?(this.indentate=Fy,this.tagEndChar=`>
125
+ `,i}async function b0(n){const e=await n.publicKey.export(),t=await crypto.subtle.exportKey("jwk",e),i=JSON.stringify(t,Object.keys(t).sort()),s=new TextEncoder().encode(i);return Ma(await Uf(s))}const k0=1e3*60*60*24,x0=new o.OpenAPIHono().openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.array(xo)}},description:"List of keys"}}}),async n=>{const t=(await n.env.data.keys.list()).filter(i=>"cert"in i).map(i=>i);return n.json(t)}).openapi(o.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:xo}},description:"The requested key"}}}),async n=>{const{kid:e}=n.req.valid("param"),i=(await n.env.data.keys.list()).find(r=>r.kid===e);if(!i)throw new j(404,{message:"Key not found"});return n.json(i)}).openapi(o.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const e=await n.env.data.keys.list();for await(const i of e)await n.env.data.keys.update(i.kid,{revoked_at:new Date(Date.now()+k0).toISOString()});const t=await Ha({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(t),n.text("OK",{status:201})}).openapi(o.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({kid:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async n=>{const{kid:e}=n.req.valid("param");if(!await n.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new j(404,{message:"Key not found"});const i=await Ha({name:`CN=${n.env.ORGANIZATION_NAME}`});return await n.env.data.keys.create(i),n.text("OK")}),S0=new o.OpenAPIHono().openapi(o.createRoute({tags:["users"],method:"get",path:"/",request:{query:o.z.object({email:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.array(Ka)}},description:"List of users"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{email:t}=n.req.valid("query"),r=(await qd(n.env.data.users,e,t)).filter(s=>!s.linked_to);return n.json(r)}),A0=qt.extend({clients:o.z.array(Xt)}),I0=new o.OpenAPIHono().openapi(o.createRoute({tags:["clients"],method:"get",path:"/",request:{query:on,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([A0,o.z.array(Xt)])}},description:"List of clients"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:a}=n.req.valid("query"),l=(await n.env.data.applications.list(e,{page:t,per_page:i,include_totals:r,sort:Dn(s),q:a})).applications;return r?n.json({clients:l,start:0,limit:10,length:l.length}):n.json(l)}).openapi(o.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Xt}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=(await n.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(s=>s.id===t);if(!r)throw new j(404);return n.json(r)}).openapi(o.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.applications.remove(e,t))throw new j(404,{message:"Application not found"});return n.text("OK")}).openapi(o.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(hr.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Xt}},description:"The update application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),r=n.req.valid("json");await n.env.data.applications.update(e,t,r);const s=await n.env.data.applications.get(e,t);if(!s)throw new j(404,{message:"Application not found"});return n.json(s)}).openapi(o.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(hr.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:o.z.object(Xt.shape)}},description:"An application"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i={...t,id:t.id||Me(),client_secret:t.client_secret||Me()},r=await n.env.data.applications.create(e,i);return n.json(r,{status:201})});o.z.object({start:o.z.number(),limit:o.z.number(),length:o.z.number()});rs.extend({email:o.z.string(),login_count:o.z.number(),multifactor:o.z.array(o.z.string()).optional(),last_ip:o.z.string().optional(),last_login:o.z.string().optional(),user_id:o.z.string()}).catchall(o.z.any());const E0=qt.extend({tenants:o.z.array(En)}),z0=new o.OpenAPIHono().openapi(o.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:on},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:o.z.union([o.z.array(En),E0])}},description:"List of tenants"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),a=await n.env.data.tenants.list({page:e,per_page:t,include_totals:i,sort:Dn(r),q:s});return i?n.json(a):n.json(a.tenants)}).openapi(o.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:En}},description:"A tenant"}}}),async n=>{const{id:e}=n.req.valid("param"),t=await n.env.data.tenants.get(e);if(!t)throw new j(404);return n.json(t)}).openapi(o.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param");return await n.env.data.tenants.remove(e),n.text("OK")}).openapi(o.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(_r.shape).partial()}}},params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{id:e}=n.req.valid("param"),t=n.req.valid("json");return await n.env.data.tenants.update(e,t),n.text("OK")}).openapi(o.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(_r.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"tenant/json":{schema:En}},description:"An tenant"}}}),async n=>{const e=n.req.valid("json"),t=await n.env.data.tenants.create(e);return n.json(t,{status:201})}),$0=qt.extend({logs:o.z.array(yr)}),C0=new o.OpenAPIHono().openapi(o.createRoute({tags:["logs"],method:"get",path:"/",request:{query:on,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(yr),$0])}},description:"List of log rows"}}}),async n=>{const{page:e,per_page:t,include_totals:i,sort:r,q:s}=n.req.valid("query"),{"tenant-id":a}=n.req.valid("header"),c=await n.env.data.logs.list(a,{page:e,per_page:t,include_totals:i,sort:Dn(r),q:s});return i?n.json(c):n.json(c.logs)}).openapi(o.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:yr}},description:"A log entry"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.logs.get(e,t);if(!i)throw new j(404);return n.json(i)}),j0=qt.extend({hooks:o.z.array(An)}),N0=new o.OpenAPIHono().openapi(o.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:on,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(An),j0])}},description:"List of hooks"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r,sort:s,q:a}=n.req.valid("query"),c=await n.env.data.hooks.list(e,{page:t,per_page:i,include_totals:r,sort:Dn(s),q:a});return r?n.json(c):n.json(c.hooks)}).openapi(o.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(mr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:An}},description:"The created hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.hooks.create(e,t);return n.json(i,{status:201})}).openapi(o.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()}),body:{content:{"application/json":{schema:o.z.object(mr.shape).omit({hook_id:!0}).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:An.shape}},description:"The updated hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=n.req.valid("json");await n.env.data.hooks.update(e,t,i);const r=await n.env.data.hooks.get(e,t);if(!r)throw new j(404,{message:"Hook not found"});return n.json(r)}).openapi(o.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:An}},description:"A hook"},404:{description:"Hook not found"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param"),i=await n.env.data.hooks.get(e,t);if(!i)throw new j(404,{message:"Hook not found"});return n.json(i)}).openapi(o.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:o.z.object({"tenant-id":o.z.string()}),params:o.z.object({hook_id:o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{hook_id:t}=n.req.valid("param");if(!await n.env.data.hooks.remove(e,t))throw new j(404,{message:"Hook not found"});return n.text("OK")}),O0=qt.extend({connections:o.z.array(Bt)}),B0=new o.OpenAPIHono().openapi(o.createRoute({tags:["connections"],method:"get",path:"/",request:{query:on,headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:o.z.union([o.z.array(Bt),O0])}},description:"List of connectionss"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{page:t,per_page:i,include_totals:r=!1,sort:s,q:a}=n.req.valid("query"),c=await n.env.data.connections.list(e,{page:t,per_page:i,include_totals:r,sort:Dn(s),q:a});return r?n.json(c):n.json(c.connections)}).openapi(o.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Bt}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.connections.get(e,t);if(!i)throw new j(404);return n.json(i)}).openapi(o.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.connections.remove(e,t))throw new j(404,{message:"Connection not found"});return n.text("OK")}).openapi(o.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:o.z.object(gr.shape).partial()}}},params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Bt}},description:"The updated connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=n.req.valid("json");if(!await n.env.data.connections.update(e,t,i))throw new j(404,{message:"Connection not found"});const s=await n.env.data.connections.get(e,t);if(!s)throw new j(404,{message:"Connection not found"});return n.json(s)}).openapi(o.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.object(gr.shape)}}},headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Bt}},description:"A connection"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.connections.create(e,t);return n.json(i,{status:201})}),T0=new o.OpenAPIHono().openapi(o.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:tr}},description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.promptSettings.get(e);return t?n.json(t):n.json(tr.parse({}))}).openapi(o.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(tr.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json"),i=await n.env.data.promptSettings.get(e);return Object.assign(i,t),await n.env.data.promptSettings.set(e,i),n.json(i)});let Xu=!1;function Vf(n){n.use(async(e,t)=>(Xu||(n.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),Xu=!0),await t()))}o.z.object({alg:o.z.literal("RS256"),kty:o.z.literal("RSA"),use:o.z.literal("sig"),n:o.z.string(),e:o.z.string(),kid:o.z.string(),x5t:o.z.string(),x5c:o.z.array(o.z.string())});async function R0(n){try{const e=await n.JWKS_SERVICE.fetch(n.JWKS_URL);if(!e.ok)throw new Error("Failed to fetch jwks");return(await e.json()).keys}catch(e){throw new j(500,{message:`Failed to fetch jwks: ${e.message}`})}}async function P0(n,e){const i=new TextEncoder().encode([e.raw.header,e.raw.payload].join(".")),r=new Uint8Array(Array.from(e.signature).map(l=>l.charCodeAt(0))),a=(await R0(n.env)).find(l=>l.kid===e.header.kid);if(!a)return console.log("No matching kid found"),!1;const c=await crypto.subtle.importKey("jwk",a,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return crypto.subtle.verify("RSASSA-PKCS1-v1_5",c,r,i)}function L0(n){const[e,t,i]=n.split(".");if(!e||!t||!i)return null;const r=JSON.parse(atob(e)),s=JSON.parse(atob(t)),a=atob(i.replace(/-/g,"+").replace(/_/g,"/"));return{header:r,payload:s,signature:a,raw:{header:e,payload:t,signature:i}}}function Mf(n){return async(e,t)=>{var r,s,a;const i=n.openAPIRegistry.definitions.find(c=>"route"in c&&c.route.path===e.req.path&&c.route.method.toUpperCase()===e.req.method);if(i&&"route"in i){const c=(s=(r=i.route.security)==null?void 0:r[0])==null?void 0:s.Bearer;if(!(c!=null&&c.length))return await t();const l=e.req.header("authorization")||"",[u,p]=l.split(" ");if((u==null?void 0:u.toLowerCase())!=="bearer"||!p)throw new j(401,{message:"Missing bearer token"});const g=L0(p);if(!g||!await P0(e,g))throw new j(403,{message:"Invalid JWT signature"});e.set("user_id",g.payload.sub),e.set("user",g.payload);const _=g.payload.permissions||[],x=((a=g.payload.scope)==null?void 0:a.split(" "))||[];if(c.length&&!(c.some(h=>_.includes(h))||c.some(h=>x.includes(h))))throw new j(403,{message:"Unauthorized"})}return await t()}}const U0=new o.OpenAPIHono().openapi(o.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:nr}},description:"Email provider"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=await n.env.data.emailProviders.get(e);if(!t)throw new j(404,{message:"Email provider not found"});return n.json(t)}).openapi(o.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(nr.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.create(e,t),n.text("OK",{status:201})}).openapi(o.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:o.z.object({"tenant-id":o.z.string()}),body:{content:{"application/json":{schema:o.z.object(nr.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),t=n.req.valid("json");return await n.env.data.emailProviders.update(e,t),n.text("OK")}),V0=new o.OpenAPIHono().openapi(o.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:os}},description:"A session"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param"),i=await n.env.data.sessions.get(e,t);if(!i)throw new j(404);return n.json(i)}).openapi(o.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.sessions.remove(e,t))throw new j(404,{message:"Session not found"});return n.text("OK")}).openapi(o.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:o.z.object({id:o.z.string()}),headers:o.z.object({"tenant-id":o.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async n=>{const{"tenant-id":e}=n.req.valid("header"),{id:t}=n.req.valid("param");if(!await n.env.data.sessions.update(e,t,{revoked_at:new Date().toDateString()}))throw new j(404,{message:"Session not found"});return n.text("Session deletion request accepted.",{status:202})});function M0(){const n=new o.OpenAPIHono;n.use(Mf(n));const e=n.route("/branding",og).route("/email/providers",U0).route("/users",xg).route("/keys",x0).route("/users-by-email",S0).route("/clients",I0).route("/tenants",z0).route("/logs",C0).route("/hooks",N0).route("/connections",B0).route("/prompts",T0).route("/sessions",V0);return Vf(e),e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management api"}}),e}function H0(n,e){Object.keys(e).forEach(t=>{const i=e[t];i!=null&&i.length&&n.searchParams.set(t,i)})}function Hn(n){var e,t,i;return{auth0Client:(e=n.query("auth0Client"))==null?void 0:e.slice(0,255),ip:(t=n.header("x-real-ip"))==null?void 0:t.slice(0,45),useragent:(i=n.header("user-agent"))==null?void 0:i.slice(0,512)}}const er=60*5,Mc=30*24*60*60,es=24*60*60,D0="auth-token",Qu=30*60*1e3,q0=5*60,F0=5*60;var ed;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(ed||(ed={}));var td;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(td||(td={}));function K0(n){return Df(n,W0,zi.Include)}function Hf(n){return Df(n,G0,zi.None)}function Df(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,a=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],a+=8;for(let c=0;c<4;c++)a>=6?(i+=e[s>>a-6&63],a-=6):a>0?(i+=e[s<<6-a&63],a=0):t===zi.Include&&(i+="=")}return i}const W0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",G0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var zi;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(zi||(zi={}));var nd;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(nd||(nd={}));class J0{uint8(e,t){if(e.byteLength<t+1)throw new TypeError("Insufficient bytes");return e[t]}uint16(e,t){if(e.byteLength<t+2)throw new TypeError("Insufficient bytes");return e[t]<<8|e[t+1]}uint32(e,t){if(e.byteLength<t+4)throw new TypeError("Insufficient bytes");let i=0;for(let r=0;r<4;r++)i|=e[t+r]<<24-r*8;return i}uint64(e,t){if(e.byteLength<t+8)throw new TypeError("Insufficient bytes");let i=0n;for(let r=0;r<8;r++)i|=BigInt(e[t+r])<<BigInt(56-r*8);return i}putUint8(e,t,i){if(e.length<i+1)throw new TypeError("Not enough space");if(t<0||t>255)throw new TypeError("Invalid uint8 value");e[i]=t}putUint16(e,t,i){if(e.length<i+2)throw new TypeError("Not enough space");if(t<0||t>65535)throw new TypeError("Invalid uint16 value");e[i]=t>>8,e[i+1]=t&255}putUint32(e,t,i){if(e.length<i+4)throw new TypeError("Not enough space");if(t<0||t>4294967295)throw new TypeError("Invalid uint32 value");for(let r=0;r<4;r++)e[i+r]=t>>(3-r)*8&255}putUint64(e,t,i){if(e.length<i+8)throw new TypeError("Not enough space");if(t<0||t>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let r=0;r<8;r++)e[i+r]=Number(t>>BigInt((7-r)*8)&0xffn)}}const id=new J0;function ft(n,e){return(n<<32-e|n>>>e)>>>0}function Z0(n){const e=new Y0;return e.update(n),e.digest()}class Y0{constructor(){te(this,"blockSize",64);te(this,"size",32);te(this,"blocks",new Uint8Array(64));te(this,"currentBlockSize",0);te(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));te(this,"l",0n);te(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let t=0;if(this.currentBlockSize>0){const i=e.slice(0,64-this.currentBlockSize);this.blocks.set(i,this.currentBlockSize),this.process(),t+=i.byteLength,this.currentBlockSize=0}for(;t+64<=e.byteLength;){const i=e.slice(t,t+64);this.blocks.set(i),this.process(),t+=64}if(e.byteLength-t>0){const i=e.slice(t);this.blocks.set(i),this.currentBlockSize=i.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),id.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let t=0;t<8;t++)id.putUint32(e,this.H[t],t*4);return e}process(){for(let u=0;u<16;u++)this.w[u]=(this.blocks[u*4]<<24|this.blocks[u*4+1]<<16|this.blocks[u*4+2]<<8|this.blocks[u*4+3])>>>0;for(let u=16;u<64;u++){const p=(ft(this.w[u-2],17)^ft(this.w[u-2],19)^this.w[u-2]>>>10)>>>0,g=(ft(this.w[u-15],7)^ft(this.w[u-15],18)^this.w[u-15]>>>3)>>>0;this.w[u]=p+this.w[u-7]+g+this.w[u-16]|0}let e=this.H[0],t=this.H[1],i=this.H[2],r=this.H[3],s=this.H[4],a=this.H[5],c=this.H[6],l=this.H[7];for(let u=0;u<64;u++){const p=(ft(s,6)^ft(s,11)^ft(s,25))>>>0,g=(s&a^~s&c)>>>0,_=l+p+g+X0[u]+this.w[u]|0,x=(ft(e,2)^ft(e,13)^ft(e,22))>>>0,h=(e&t^e&i^t&i)>>>0,m=x+h|0;l=c,c=a,a=s,s=r+_|0,r=i,i=t,t=e,e=_+m|0}this.H[0]=e+this.H[0]|0,this.H[1]=t+this.H[1]|0,this.H[2]=i+this.H[2]|0,this.H[3]=r+this.H[3]|0,this.H[4]=s+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=c+this.H[6]|0,this.H[7]=l+this.H[7]|0}}const X0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class Q0{constructor(e){te(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function em(n){const e=Z0(new TextEncoder().encode(n));return Hf(e)}function tm(){const n=new Uint8Array(32);return crypto.getRandomValues(n),Hf(n)}function fi(n,e){const t=new TextEncoder().encode(e.toString()),i=new Request(n,{method:"POST",body:t});return i.headers.set("Content-Type","application/x-www-form-urlencoded"),i.headers.set("Accept","application/json"),i.headers.set("User-Agent","arctic"),i.headers.set("Content-Length",t.byteLength.toString()),i}function yo(n,e){const t=new TextEncoder().encode(`${n}:${e}`);return K0(t)}async function ts(n){let e;try{e=await fetch(n)}catch(t){throw new Ff(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new ar(e.status)}if(typeof t!="object"||t===null)throw new Cn(e.status,t);let i;try{i=qf(t)}catch{throw new Cn(e.status,t)}throw i}if(e.status===200){let t;try{t=await e.json()}catch{throw new ar(e.status)}if(typeof t!="object"||t===null)throw new Cn(e.status,t);return new Q0(t)}throw e.body!==null&&await e.body.cancel(),new ar(e.status)}async function nm(n){let e;try{e=await fetch(n)}catch(t){throw new Ff(t)}if(e.status===400||e.status===401){let t;try{t=await e.json()}catch{throw new Cn(e.status,null)}if(typeof t!="object"||t===null)throw new Cn(e.status,t);let i;try{i=qf(t)}catch{throw new Cn(e.status,t)}throw i}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new ar(e.status)}function qf(n){let e;if("error"in n&&typeof n.error=="string")e=n.error;else throw new Error("Invalid error response");let t=null,i=null,r=null;if("error_description"in n){if(typeof n.error_description!="string")throw new Error("Invalid data");t=n.error_description}if("error_uri"in n){if(typeof n.error_uri!="string")throw new Error("Invalid data");i=n.error_uri}if("state"in n){if(typeof n.state!="string")throw new Error("Invalid data");r=n.state}return new im(e,t,i,r)}class Ff extends Error{constructor(e){super("Failed to send request",{cause:e})}}class im extends Error{constructor(t,i,r,s){super(`OAuth request error: ${t}`);te(this,"code");te(this,"description");te(this,"uri");te(this,"state");this.code=t,this.description=i,this.uri=r,this.state=s}}class ar extends Error{constructor(t){super("Unexpected error response");te(this,"status");this.status=t}}class Cn extends Error{constructor(t,i){super("Unexpected error response body");te(this,"status");te(this,"data");this.status=t,this.data=i}}class Hc{constructor(e,t,i){te(this,"clientId");te(this,"clientPassword");te(this,"redirectURI");this.clientId=e,this.clientPassword=t,this.redirectURI=i}createAuthorizationURL(e,t,i){const r=new URL(e);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&r.searchParams.set("redirect_uri",this.redirectURI),r.searchParams.set("state",t),i.length>0&&r.searchParams.set("scope",i.join(" ")),r}createAuthorizationURLWithPKCE(e,t,i,r,s){const a=new URL(e);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&a.searchParams.set("redirect_uri",this.redirectURI),a.searchParams.set("state",t),i===$i.S256){const c=em(r);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",c)}else i===$i.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",r));return s.length>0&&a.searchParams.set("scope",s.join(" ")),a}async validateAuthorizationCode(e,t,i){const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",t),this.redirectURI!==null&&r.set("redirect_uri",this.redirectURI),i!==null&&r.set("code_verifier",i),this.clientPassword===null&&r.set("client_id",this.clientId);const s=fi(e,r);if(this.clientPassword!==null){const c=yo(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await ts(s)}async refreshAccessToken(e,t,i){const r=new URLSearchParams;r.set("grant_type","refresh_token"),r.set("refresh_token",t),this.clientPassword===null&&r.set("client_id",this.clientId),i.length>0&&r.set("scope",i.join(" "));const s=fi(e,r);if(this.clientPassword!==null){const c=yo(this.clientId,this.clientPassword);s.headers.set("Authorization",`Basic ${c}`)}return await ts(s)}async revokeToken(e,t){const i=new URLSearchParams;i.set("token",t),this.clientPassword===null&&i.set("client_id",this.clientId);const r=fi(e,i);if(this.clientPassword!==null){const s=yo(this.clientId,this.clientPassword);r.headers.set("Authorization",`Basic ${s}`)}await nm(r)}}var $i;(function(n){n[n.S256=0]="S256",n[n.Plain=1]="Plain"})($i||($i={}));var rd;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(rd||(rd={}));var sd;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(sd||(sd={}));function hi(n){return rm(n,sm,ns.None)}function rm(n,e,t){let i="";for(let r=0;r<n.byteLength;r+=3){let s=0,a=0;for(let c=0;c<3&&r+c<n.byteLength;c++)s=s<<8|n[r+c],a+=8;for(let c=0;c<4;c++)a>=6?(i+=e[s>>a-6&63],a-=6):a>0?(i+=e[s<<6-a&63],a=0):t===ns.Include&&(i+="=")}return i}const sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var ns;(function(n){n[n.Include=0]="Include",n[n.None=1]="None"})(ns||(ns={}));var od;(function(n){n[n.Required=0]="Required",n[n.Ignore=1]="Ignore"})(od||(od={}));function om(n,e,t){const i=hi(new TextEncoder().encode(n)),r=hi(new TextEncoder().encode(e)),s=hi(t);return i+"."+r+"."+s}function am(n,e){const t=hi(new TextEncoder().encode(n)),i=hi(new TextEncoder().encode(e)),r=t+"."+i;return new TextEncoder().encode(r)}const cm="https://appleid.apple.com/auth/authorize",lm="https://appleid.apple.com/auth/token";class Kf{constructor(e,t,i,r,s){te(this,"clientId");te(this,"teamId");te(this,"keyId");te(this,"pkcs8PrivateKey");te(this,"redirectURI");this.clientId=e,this.teamId=t,this.keyId=i,this.pkcs8PrivateKey=r,this.redirectURI=s}createAuthorizationURL(e,t){const i=new URL(cm);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId);const i=await this.createClientSecret();t.set("client_secret",i);const r=fi(lm,t);return await ts(r)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),t=Math.floor(Date.now()/1e3),i=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),r=JSON.stringify({iss:this.teamId,exp:t+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:t}),s=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,am(i,r)));return om(i,r,s)}}const um="https://www.facebook.com/v16.0/dialog/oauth",dm="https://graph.facebook.com/v16.0/oauth/access_token";class Wf{constructor(e,t,i){te(this,"clientId");te(this,"clientSecret");te(this,"redirectURI");this.clientId=e,this.clientSecret=t,this.redirectURI=i}createAuthorizationURL(e,t){const i=new URL(um);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),i.searchParams.set("state",e),t.length>0&&i.searchParams.set("scope",t.join(" ")),i.searchParams.set("redirect_uri",this.redirectURI),i}async validateAuthorizationCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("code",e),t.set("redirect_uri",this.redirectURI),t.set("client_id",this.clientId),t.set("client_secret",this.clientSecret);const i=fi(dm,t);return await ts(i)}}const pm="https://accounts.google.com/o/oauth2/v2/auth",ad="https://oauth2.googleapis.com/token",fm="https://oauth2.googleapis.com/revoke";class Gf{constructor(e,t,i){te(this,"client");this.client=new Hc(e,t,i)}createAuthorizationURL(e,t,i){return this.client.createAuthorizationURLWithPKCE(pm,e,$i.S256,t,i)}async validateAuthorizationCode(e,t){return await this.client.validateAuthorizationCode(ad,e,t)}async refreshAccessToken(e){return await this.client.refreshAccessToken(ad,e,[])}async revokeToken(e){await this.client.revokeToken(fm,e)}}class Dc{constructor(e,t){te(this,"value");te(this,"unit");this.value=e,this.unit=t}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new Dc(Math.round(this.milliseconds()*e),"ms")}}async function cd(n,e,t,i){const r={alg:n,typ:"JWT",...i==null?void 0:i.headers},s={...t};(i==null?void 0:i.audiences)!==void 0&&(s.aud=i.audiences),(i==null?void 0:i.subject)!==void 0&&(s.sub=i.subject),(i==null?void 0:i.issuer)!==void 0&&(s.iss=i.issuer),(i==null?void 0:i.jwtId)!==void 0&&(s.jti=i.jwtId),(i==null?void 0:i.expiresIn)!==void 0&&(s.exp=Math.floor(Date.now()/1e3)+i.expiresIn.seconds()),(i==null?void 0:i.notBefore)!==void 0&&(s.nbf=Math.floor(i.notBefore.getTime()/1e3)),s.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,c=sn.encode(a.encode(JSON.stringify(r)),{includePadding:!1}),l=sn.encode(a.encode(JSON.stringify(s)),{includePadding:!1}),u=a.encode([c,l].join(".")),p=await gm(n).sign(e,u),g=sn.encode(new Uint8Array(p),{includePadding:!1});return[c,l,g].join(".")}function hm(n){const e=n.split(".");return e.length!==3?null:e}function qc(n){const e=hm(n);if(!e)return null;const t=new TextDecoder,i=sn.decode(e[0],{strict:!1}),r=sn.decode(e[1],{strict:!1}),s=JSON.parse(t.decode(i));if(typeof s!="object"||s===null||!("alg"in s)||!_m(s.alg)||"typ"in s&&s.typ!=="JWT")return null;const a=JSON.parse(t.decode(r));if(typeof a!="object"||a===null)return null;const c={algorithm:s.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;c.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;c.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;c.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const l of a.aud)if(typeof l!="string")return null;c.audiences=a.aud}else{if(typeof a.aud!="string")return null;c.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;c.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;c.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;c.jwtId=a.jti}return{value:n,header:{...s,typ:"JWT",alg:s.alg},payload:{...a},parts:e,...c}}function gm(n){return new v0(mm[n])}function _m(n){return typeof n!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(n)}const mm={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"},Ys=o.z.object({iss:o.z.string().url(),sub:o.z.string(),aud:o.z.string(),exp:o.z.number(),email:o.z.string().optional(),given_name:o.z.string().optional(),family_name:o.z.string().optional(),name:o.z.string().optional(),iat:o.z.number(),auth_time:o.z.number().optional(),nonce:o.z.string().optional(),acr:o.z.string().optional(),amr:o.z.array(o.z.string()).optional(),azp:o.z.string().optional(),at_hash:o.z.string().optional(),c_hash:o.z.string().optional()}).passthrough();Ys.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function ym(n){return n.ISSUER}function vt(n){return n.UNIVERSAL_LOGIN_URL||`${n.ISSUER}u/`}function Ie(n){return n.OAUTH_API_URL||n.ISSUER}function Jf(n){const{options:e}=n;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const t=Buffer.from(e.app_secret,"utf-8"),i=t.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),r=Uint8Array.from(Buffer.from(i,"base64"));return t.fill(0),{options:e,keyArray:r}}async function vm(n,e){var l,u;const{options:t,keyArray:i}=Jf(e),r=new Kf(t.client_id,t.team_id,t.kid,i,`${Ie(n.env)}callback`),s=Me(),a=await r.createAuthorizationURL(s,((l=t.scope)==null?void 0:l.split(" "))||["name","email"]);return(((u=t.scope)==null?void 0:u.split(" "))||["name","email"]).some(p=>["email","name"].includes(p))&&a.searchParams.set("response_mode","form_post"),{redirectUrl:a.href,code:s}}async function wm(n,e,t){const{options:i,keyArray:r}=Jf(e),a=await new Kf(i.client_id,i.team_id,i.kid,r,`${Ie(n.env)}callback`).validateAuthorizationCode(t),c=qc(a.idToken());if(!c)throw new Error("Invalid ID token");const l=Ys.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const bm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:vm,validateAuthorizationCodeAndGetUser:wm},Symbol.toStringTag,{value:"Module"}));async function km(n,e){var a;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Wf(t.client_id,t.client_secret,`${Ie(n.env)}callback`),r=Me();return{redirectUrl:i.createAuthorizationURL(r,((a=t.scope)==null?void 0:a.split(" "))||["email"]).href,code:r}}async function xm(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Wf(i.client_id,i.client_secret,`${Ie(n.env)}callback`).validateAuthorizationCode(t),a=await fetch("https://graph.facebook.com/v16.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${s.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const c=await a.json();return n.set("log",`Userinfo: ${JSON.stringify(c)}`),{sub:c.id,email:c.email,name:c.name}}const Sm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:km,validateAuthorizationCodeAndGetUser:xm},Symbol.toStringTag,{value:"Module"}));async function Am(n,e){var c;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required Google authentication parameters");const i=new Gf(t.client_id,t.client_secret,`${Ie(n.env)}callback`),r=Me(),s=tm();return{redirectUrl:i.createAuthorizationURL(r,s,((c=t.scope)==null?void 0:c.split(" "))??["email","profile"]).href,code:r,codeVerifier:s}}async function Im(n,e,t,i){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret||!i)throw new Error("Missing required authentication parameters");const a=await new Gf(r.client_id,r.client_secret,`${Ie(n.env)}callback`).validateAuthorizationCode(t,i);console.log("got here");const c=qc(a.idToken());if(!c)throw new Error("Invalid ID token");const l=Ys.parse(c.payload);return{sub:l.sub,email:l.email,given_name:l.given_name,family_name:l.family_name,name:l.name,picture:l.picture,locale:l.locale}}const Em=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Am,validateAuthorizationCodeAndGetUser:Im},Symbol.toStringTag,{value:"Module"}));async function zm(n,e){var a;const{options:t}=e;if(!(t!=null&&t.client_id)||!t.client_secret)throw new Error("Missing required authentication parameters");const i=new Hc(t.client_id,t.client_secret,`${Ie(n.env)}callback`),r=Me(),s=i.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",r,((a=t.scope)==null?void 0:a.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return s.searchParams.set("response_type","code"),s.searchParams.set("response_mode","query"),{redirectUrl:s.href,code:r}}async function $m(n,e,t){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret)throw new Error("Missing required authentication parameters");const s=await new Hc(i.client_id,i.client_secret,`${Ie(n.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",t,null),a=qc(s.idToken());if(!a)throw new Error("Invalid ID token");const c=Ys.parse(a.payload);if(typeof c.msn!="string")throw new Error("msn not available in id token");const l=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${s.accessToken()}`,"Merchant-Serial-Number":c.msn}});if(!l.ok)throw new j(400,{message:"Failed to get user from vipps"});return await l.json()}const Cm=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:zm,validateAuthorizationCodeAndGetUser:$m},Symbol.toStringTag,{value:"Module"}));function Zf(n,e){const t=n.env.STRATEGIES||{},r={apple:bm,facebook:Sm,"google-oauth2":Em,vipps:Cm,...t}[e];if(!r)throw new Error(`Strategy ${e} not found`);return r}async function Fc(n,e){const t=await n.data.clients.get(e);if(!t)throw new j(403,{message:"Client not found"});const i=n.DEFAULT_CLIENT_ID?await n.data.clients.get(n.DEFAULT_CLIENT_ID):void 0,r=await n.data.connections.list(t.tenant.id),s=n.DEFAULT_TENANT_ID?await n.data.connections.list(n.DEFAULT_TENANT_ID):{connections:[]},a=r.connections.map(c=>{var p;const l=(p=s.connections)==null?void 0:p.find(g=>g.name===c.name);return l!=null&&l.options?Bt.parse({...l||{},...c,options:{...l.options||{},...c.options}}):c}).filter(c=>c);return{...t,web_origins:[...(i==null?void 0:i.web_origins)||[],...t.web_origins||[],`${vt(n)}login`],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...t.allowed_logout_urls||[],n.ISSUER],callbacks:[...(i==null?void 0:i.callbacks)||[],...t.callbacks||[],`${vt(n)}info`],connections:a,domains:[...t.domains||[],...(i==null?void 0:i.domains)||[]],tenant:{...(i==null?void 0:i.tenant)||{},...t.tenant}}}function Xs(n,e=[],t={}){try{const i=new URL(n);return e.some(r=>{try{return jm(i,new URL(r),t.allowPathWildcards)}catch{return!1}})}catch{return!1}}function jm(n,e,t){if(n.protocol!==e.protocol)return!1;if(t&&e.pathname.includes("*")){const i=e.pathname.replace(/\*/g,".*").replace(/\//g,"\\/");if(!new RegExp(`^${i}$`).test(n.pathname))return!1}else if(n.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const i=e.hostname.split(".").slice(1).join(".");return n.hostname.endsWith(i)}return n.hostname===e.hostname}function Nm(n){try{const t=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(n);if(!t||!t[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(t[1].replace(/\s/g,"")),i=>i.charCodeAt(0)).buffer}finally{n=n.replace(/./g,"\0")}}async function Om(n,e){if(e==="plain")return n;const t=new TextEncoder().encode(n),i=await Uf(t);return sn.encode(new Uint8Array(i),{includePadding:!1})}function Yf(n,e,t){const i=[];return i.push([encodeURIComponent(n),encodeURIComponent(e)]),(t==null?void 0:t.domain)!==void 0&&i.push(["Domain",t.domain]),(t==null?void 0:t.expires)!==void 0&&i.push(["Expires",t.expires.toUTCString()]),t!=null&&t.httpOnly&&i.push(["HttpOnly"]),(t==null?void 0:t.maxAge)!==void 0&&i.push(["Max-Age",t.maxAge.toString()]),(t==null?void 0:t.path)!==void 0&&i.push(["Path",t.path]),(t==null?void 0:t.sameSite)==="lax"&&i.push(["SameSite","Lax"]),(t==null?void 0:t.sameSite)==="none"&&i.push(["SameSite","None"]),(t==null?void 0:t.sameSite)==="strict"&&i.push(["SameSite","Strict"]),t!=null&&t.secure&&i.push(["Secure"]),i.map(r=>r.join("=")).join("; ")}function Bm(n){const e=new Map,t=n.split("; ");for(const i of t){const r=i.split("="),s=r[0],a=r[1]??"";s&&e.set(decodeURIComponent(s),decodeURIComponent(a))}return e}function Kc(n){return`${n}-${D0}`}function Xf(n,e){return e?Bm(e).get(Kc(n)):void 0}function Tm(n){const e={path:"/",httpOnly:!0,secure:!0,maxAge:0};return Yf(Kc(n),"",{...e,sameSite:"none"})}function Qf(n,e){const t={path:"/",httpOnly:!0,secure:!0,maxAge:Mc};return Yf(Kc(n),e,{...t,sameSite:"none"})}var Wc={},Qs={};(function(n){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",i="["+e+"]["+t+"]*",r=new RegExp("^"+i+"$"),s=function(c,l){const u=[];let p=l.exec(c);for(;p;){const g=[];g.startIndex=l.lastIndex-p[0].length;const _=p.length;for(let x=0;x<_;x++)g.push(p[x]);u.push(g),p=l.exec(c)}return u},a=function(c){const l=r.exec(c);return!(l===null||typeof l>"u")};n.isExist=function(c){return typeof c<"u"},n.isEmptyObject=function(c){return Object.keys(c).length===0},n.merge=function(c,l,u){if(l){const p=Object.keys(l),g=p.length;for(let _=0;_<g;_++)u==="strict"?c[p[_]]=[l[p[_]]]:c[p[_]]=l[p[_]]}},n.getValue=function(c){return n.isExist(c)?c:""},n.isName=a,n.getAllMatches=s,n.nameRegexp=i})(Qs);const Gc=Qs,Rm={allowBooleanAttributes:!1,unpairedTags:[]};Wc.validate=function(n,e){e=Object.assign({},Rm,e);const t=[];let i=!1,r=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let s=0;s<n.length;s++)if(n[s]==="<"&&n[s+1]==="?"){if(s+=2,s=ud(n,s),s.err)return s}else if(n[s]==="<"){let a=s;if(s++,n[s]==="!"){s=dd(n,s);continue}else{let c=!1;n[s]==="/"&&(c=!0,s++);let l="";for(;s<n.length&&n[s]!==">"&&n[s]!==" "&&n[s]!==" "&&n[s]!==`
126
+ `&&n[s]!=="\r";s++)l+=n[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!qm(l)){let g;return l.trim().length===0?g="Invalid space after '<'.":g="Tag '"+l+"' is an invalid name.",ye("InvalidTag",g,Be(n,s))}const u=Um(n,s);if(u===!1)return ye("InvalidAttr","Attributes for '"+l+"' have open quote.",Be(n,s));let p=u.value;if(s=u.index,p[p.length-1]==="/"){const g=s-p.length;p=p.substring(0,p.length-1);const _=pd(p,e);if(_===!0)i=!0;else return ye(_.err.code,_.err.msg,Be(n,g+_.err.line))}else if(c)if(u.tagClosed){if(p.trim().length>0)return ye("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Be(n,a));if(t.length===0)return ye("InvalidTag","Closing tag '"+l+"' has not been opened.",Be(n,a));{const g=t.pop();if(l!==g.tagName){let _=Be(n,g.tagStartPos);return ye("InvalidTag","Expected closing tag '"+g.tagName+"' (opened in line "+_.line+", col "+_.col+") instead of closing tag '"+l+"'.",Be(n,a))}t.length==0&&(r=!0)}}else return ye("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Be(n,s));else{const g=pd(p,e);if(g!==!0)return ye(g.err.code,g.err.msg,Be(n,s-p.length+g.err.line));if(r===!0)return ye("InvalidXml","Multiple possible root nodes found.",Be(n,s));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:a}),i=!0}for(s++;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="!"){s++,s=dd(n,s);continue}else if(n[s+1]==="?"){if(s=ud(n,++s),s.err)return s}else break;else if(n[s]==="&"){const g=Hm(n,s);if(g==-1)return ye("InvalidChar","char '&' is not expected.",Be(n,s));s=g}else if(r===!0&&!ld(n[s]))return ye("InvalidXml","Extra text at the end",Be(n,s));n[s]==="<"&&s--}}else{if(ld(n[s]))continue;return ye("InvalidChar","char '"+n[s]+"' is not expected.",Be(n,s))}if(i){if(t.length==1)return ye("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",Be(n,t[0].tagStartPos));if(t.length>0)return ye("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ye("InvalidXml","Start tag expected.",1);return!0};function ld(n){return n===" "||n===" "||n===`
127
+ `||n==="\r"}function ud(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const i=n.substr(t,e-t);if(e>5&&i==="xml")return ye("InvalidXml","XML declaration allowed only at the start of the document.",Be(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function dd(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const Pm='"',Lm="'";function Um(n,e){let t="",i="",r=!1;for(;e<n.length;e++){if(n[e]===Pm||n[e]===Lm)i===""?i=n[e]:i!==n[e]||(i="");else if(n[e]===">"&&i===""){r=!0;break}t+=n[e]}return i!==""?!1:{value:t,index:e,tagClosed:r}}const Vm=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function pd(n,e){const t=Gc.getAllMatches(n,Vm),i={};for(let r=0;r<t.length;r++){if(t[r][1].length===0)return ye("InvalidAttr","Attribute '"+t[r][2]+"' has no space in starting.",ri(t[r]));if(t[r][3]!==void 0&&t[r][4]===void 0)return ye("InvalidAttr","Attribute '"+t[r][2]+"' is without value.",ri(t[r]));if(t[r][3]===void 0&&!e.allowBooleanAttributes)return ye("InvalidAttr","boolean attribute '"+t[r][2]+"' is not allowed.",ri(t[r]));const s=t[r][2];if(!Dm(s))return ye("InvalidAttr","Attribute '"+s+"' is an invalid name.",ri(t[r]));if(!i.hasOwnProperty(s))i[s]=1;else return ye("InvalidAttr","Attribute '"+s+"' is repeated.",ri(t[r]))}return!0}function Mm(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function Hm(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Mm(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function ye(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Dm(n){return Gc.isName(n)}function qm(n){return Gc.isName(n)}function Be(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ri(n){return n.startIndex+n[1].length}var Jc={};const eh={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n}},Fm=function(n){return Object.assign({},eh,n)};Jc.buildOptions=Fm;Jc.defaultOptions=eh;class Km{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Wm=Km;const Gm=Qs;function Jm(n,e){const t={};if(n[e+3]==="O"&&n[e+4]==="C"&&n[e+5]==="T"&&n[e+6]==="Y"&&n[e+7]==="P"&&n[e+8]==="E"){e=e+9;let i=1,r=!1,s=!1,a="";for(;e<n.length;e++)if(n[e]==="<"&&!s){if(r&&Xm(n,e)){e+=7;let c,l;[c,l,e]=Zm(n,e+1),l.indexOf("&")===-1&&(t[ny(c)]={regx:RegExp(`&${c};`,"g"),val:l})}else if(r&&Qm(n,e))e+=8;else if(r&&ey(n,e))e+=8;else if(r&&ty(n,e))e+=9;else if(Ym)s=!0;else throw new Error("Invalid DOCTYPE");i++,a=""}else if(n[e]===">"){if(s?n[e-1]==="-"&&n[e-2]==="-"&&(s=!1,i--):i--,i===0)break}else n[e]==="["?r=!0:a+=n[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Zm(n,e){let t="";for(;e<n.length&&n[e]!=="'"&&n[e]!=='"';e++)t+=n[e];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const i=n[e++];let r="";for(;e<n.length&&n[e]!==i;e++)r+=n[e];return[t,r,e]}function Ym(n,e){return n[e+1]==="!"&&n[e+2]==="-"&&n[e+3]==="-"}function Xm(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="N"&&n[e+4]==="T"&&n[e+5]==="I"&&n[e+6]==="T"&&n[e+7]==="Y"}function Qm(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="L"&&n[e+4]==="E"&&n[e+5]==="M"&&n[e+6]==="E"&&n[e+7]==="N"&&n[e+8]==="T"}function ey(n,e){return n[e+1]==="!"&&n[e+2]==="A"&&n[e+3]==="T"&&n[e+4]==="T"&&n[e+5]==="L"&&n[e+6]==="I"&&n[e+7]==="S"&&n[e+8]==="T"}function ty(n,e){return n[e+1]==="!"&&n[e+2]==="N"&&n[e+3]==="O"&&n[e+4]==="T"&&n[e+5]==="A"&&n[e+6]==="T"&&n[e+7]==="I"&&n[e+8]==="O"&&n[e+9]==="N"}function ny(n){if(Gm.isName(n))return n;throw new Error(`Invalid entity name ${n}`)}var iy=Jm;const ry=/^[-+]?0x[a-fA-F0-9]+$/,sy=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const oy={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ay(n,e={}){if(e=Object.assign({},oy,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(e.hex&&ry.test(t))return Number.parseInt(t,16);{const i=sy.exec(t);if(i){const r=i[1],s=i[2];let a=cy(i[3]);const c=i[4]||i[6];if(!e.leadingZeros&&s.length>0&&r&&t[2]!==".")return n;if(!e.leadingZeros&&s.length>0&&!r&&t[1]!==".")return n;{const l=Number(t),u=""+l;return u.search(/[eE]/)!==-1||c?e.eNotation?l:n:t.indexOf(".")!==-1?u==="0"&&a===""||u===a||r&&u==="-"+a?l:n:s?a===u||r+a===u?l:n:t===u||t===r+u?l:n}}else return n}}function cy(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substr(0,n.length-1))),n}var ly=ay;function uy(n){return typeof n=="function"?n:Array.isArray(n)?e=>{for(const t of n)if(typeof t=="string"&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1}var th=uy;const nh=Qs,si=Wm,dy=iy,py=ly,fy=th;let hy=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=gy,this.parseXml=wy,this.parseTextData=_y,this.resolveNameSpace=my,this.buildAttributesMap=vy,this.isItStopNode=Sy,this.replaceEntitiesValue=ky,this.readStopNodeData=Iy,this.saveTextToParentTag=xy,this.addChild=by,this.ignoreAttributesFn=fy(this.options.ignoreAttributes)}};function gy(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:n[i]}}}function _y(n,e,t,i,r,s,a){if(n!==void 0&&(this.options.trimValues&&!i&&(n=n.trim()),n.length>0)){a||(n=this.replaceEntitiesValue(n));const c=this.options.tagValueProcessor(e,n,t,r,s);return c==null?n:typeof c!=typeof n||c!==n?c:this.options.trimValues?qa(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?qa(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function my(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const yy=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function vy(n,e,t){if(this.options.ignoreAttributes!==!0&&typeof n=="string"){const i=nh.getAllMatches(n,yy),r=i.length,s={};for(let a=0;a<r;a++){const c=this.resolveNameSpace(i[a][1]);if(this.ignoreAttributesFn(c,e))continue;let l=i[a][4],u=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const p=this.options.attributeValueProcessor(c,l,e);p==null?s[u]=l:typeof p!=typeof l||p!==l?s[u]=p:s[u]=qa(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const wy=function(n){n=n.replace(/\r\n?/g,`
128
+ `);const e=new si("!xml");let t=e,i="",r="";for(let s=0;s<n.length;s++)if(n[s]==="<")if(n[s+1]==="/"){const c=tn(n,">",s,"Closing Tag is not closed.");let l=n.substring(s+2,c).trim();if(this.options.removeNSPrefix){const g=l.indexOf(":");g!==-1&&(l=l.substr(g+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(i=this.saveTextToParentTag(i,t,r));const u=r.substring(r.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let p=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(p=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=r.lastIndexOf("."),r=r.substring(0,p),t=this.tagsNodeStack.pop(),i="",s=c}else if(n[s+1]==="?"){let c=Da(n,s,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,t,r),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const l=new si(c.tagName);l.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,r,c.tagName)),this.addChild(t,l,r)}s=c.closeIndex+1}else if(n.substr(s+1,3)==="!--"){const c=tn(n,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const l=n.substring(s+4,c-2);i=this.saveTextToParentTag(i,t,r),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}s=c}else if(n.substr(s+1,2)==="!D"){const c=dy(n,s);this.docTypeEntities=c.entities,s=c.i}else if(n.substr(s+1,2)==="!["){const c=tn(n,"]]>",s,"CDATA is not closed.")-2,l=n.substring(s+9,c);i=this.saveTextToParentTag(i,t,r);let u=this.parseTextData(l,t.tagname,r,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,u),s=c+2}else{let c=Da(n,s,this.options.removeNSPrefix),l=c.tagName;const u=c.rawTagName;let p=c.tagExp,g=c.attrExpPresent,_=c.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&i&&t.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,t,r,!1));const x=t;if(x&&this.options.unpairedTags.indexOf(x.tagname)!==-1&&(t=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),l!==e.tagname&&(r+=r?"."+l:l),this.isItStopNode(this.options.stopNodes,r,l)){let h="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),p=l):p=p.substr(0,p.length-1),s=c.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)s=c.closeIndex;else{const b=this.readStopNodeData(n,u,_+1);if(!b)throw new Error(`Unexpected end of ${u}`);s=b.i,h=b.tagContent}const m=new si(l);l!==p&&g&&(m[":@"]=this.buildAttributesMap(p,r,l)),h&&(h=this.parseTextData(h,l,r,!0,g,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),m.add(this.options.textNodeName,h),this.addChild(t,m,r)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),p=l):p=p.substr(0,p.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const h=new si(l);l!==p&&g&&(h[":@"]=this.buildAttributesMap(p,r,l)),this.addChild(t,h,r),r=r.substr(0,r.lastIndexOf("."))}else{const h=new si(l);this.tagsNodeStack.push(t),l!==p&&g&&(h[":@"]=this.buildAttributesMap(p,r,l)),this.addChild(t,h,r),t=h}i="",s=_}}else i+=n[s];return e.child};function by(n,e,t){const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),n.addChild(e))}const ky=function(n){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];n=n.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];n=n.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];n=n.replace(t.regex,t.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function xy(n,e,t,i){return n&&(i===void 0&&(i=Object.keys(e.child).length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function Sy(n,e,t){const i="*."+t;for(const r in n){const s=n[r];if(i===s||e===s)return!0}return!1}function Ay(n,e,t=">"){let i,r="";for(let s=e;s<n.length;s++){let a=n[s];if(i)a===i&&(i="");else if(a==='"'||a==="'")i=a;else if(a===t[0])if(t[1]){if(n[s+1]===t[1])return{data:r,index:s}}else return{data:r,index:s};else a===" "&&(a=" ");r+=a}}function tn(n,e,t,i){const r=n.indexOf(e,t);if(r===-1)throw new Error(i);return r+e.length-1}function Da(n,e,t,i=">"){const r=Ay(n,e+1,i);if(!r)return;let s=r.data;const a=r.index,c=s.search(/\s/);let l=s,u=!0;c!==-1&&(l=s.substring(0,c),s=s.substring(c+1).trimStart());const p=l;if(t){const g=l.indexOf(":");g!==-1&&(l=l.substr(g+1),u=l!==r.data.substr(g+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:p}}function Iy(n,e,t){const i=t;let r=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const s=tn(n,">",t,`${e} is not closed`);if(n.substring(t+2,s).trim()===e&&(r--,r===0))return{tagContent:n.substring(i,t),i:s};t=s}else if(n[t+1]==="?")t=tn(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=tn(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=tn(n,"]]>",t,"StopNode is not closed.")-2;else{const s=Da(n,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&r++,t=s.closeIndex)}}function qa(n,e,t){if(e&&typeof n=="string"){const i=n.trim();return i==="true"?!0:i==="false"?!1:py(n,t)}else return nh.isExist(n)?n:""}var Ey=hy,ih={};function zy(n,e){return rh(n,e)}function rh(n,e,t){let i;const r={};for(let s=0;s<n.length;s++){const a=n[s],c=$y(a);let l="";if(t===void 0?l=c:l=t+"."+c,c===e.textNodeName)i===void 0?i=a[c]:i+=""+a[c];else{if(c===void 0)continue;if(a[c]){let u=rh(a[c],e,l);const p=jy(u,e);a[":@"]?Cy(u,a[":@"],l,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),r[c]!==void 0&&r.hasOwnProperty(c)?(Array.isArray(r[c])||(r[c]=[r[c]]),r[c].push(u)):e.isArray(c,l,p)?r[c]=[u]:r[c]=u}}}return typeof i=="string"?i.length>0&&(r[e.textNodeName]=i):i!==void 0&&(r[e.textNodeName]=i),r}function $y(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function Cy(n,e,t,i){if(e){const r=Object.keys(e),s=r.length;for(let a=0;a<s;a++){const c=r[a];i.isArray(c,t+"."+c,!0,!0)?n[c]=[e[c]]:n[c]=e[c]}}}function jy(n,e){const{textNodeName:t}=e,i=Object.keys(n).length;return!!(i===0||i===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}ih.prettify=zy;const{buildOptions:Ny}=Jc,Oy=Ey,{prettify:By}=ih,Ty=Wc;let Ry=class{constructor(e){this.externalEntities={},this.options=Ny(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const s=Ty.validate(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const i=new Oy(this.options);i.addExternalEntities(this.externalEntities);const r=i.parseXml(e);return this.options.preserveOrder||r===void 0?r:By(r,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};var Py=Ry;const Ly=`
129
+ `;function Uy(n,e){let t="";return e.format&&e.indentBy.length>0&&(t=Ly),sh(n,e,"",t)}function sh(n,e,t,i){let r="",s=!1;for(let a=0;a<n.length;a++){const c=n[a],l=Vy(c);if(l===void 0)continue;let u="";if(t.length===0?u=l:u=`${t}.${l}`,l===e.textNodeName){let h=c[l];My(u,e)||(h=e.tagValueProcessor(l,h),h=oh(h,e)),s&&(r+=i),r+=h,s=!1;continue}else if(l===e.cdataPropName){s&&(r+=i),r+=`<![CDATA[${c[l][0][e.textNodeName]}]]>`,s=!1;continue}else if(l===e.commentPropName){r+=i+`<!--${c[l][0][e.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const h=fd(c[":@"],e),m=l==="?xml"?"":i;let b=c[l][0][e.textNodeName];b=b.length!==0?" "+b:"",r+=m+`<${l}${b}${h}?>`,s=!0;continue}let p=i;p!==""&&(p+=e.indentBy);const g=fd(c[":@"],e),_=i+`<${l}${g}`,x=sh(c[l],e,u,p);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?r+=_+">":r+=_+"/>":(!x||x.length===0)&&e.suppressEmptyNode?r+=_+"/>":x&&x.endsWith(">")?r+=_+`>${x}${i}</${l}>`:(r+=_+">",x&&i!==""&&(x.includes("/>")||x.includes("</"))?r+=i+e.indentBy+x+i:r+=x,r+=`</${l}>`),s=!0}return r}function Vy(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(n.hasOwnProperty(i)&&i!==":@")return i}}function fd(n,e){let t="";if(n&&!e.ignoreAttributes)for(let i in n){if(!n.hasOwnProperty(i))continue;let r=e.attributeValueProcessor(i,n[i]);r=oh(r,e),r===!0&&e.suppressBooleanAttributes?t+=` ${i.substr(e.attributeNamePrefix.length)}`:t+=` ${i.substr(e.attributeNamePrefix.length)}="${r}"`}return t}function My(n,e){n=n.substr(0,n.length-e.textNodeName.length-1);let t=n.substr(n.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===n||e.stopNodes[i]==="*."+t)return!0;return!1}function oh(n,e){if(n&&n.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const i=e.entities[t];n=n.replace(i.regex,i.val)}return n}var Hy=Uy;const Dy=Hy,qy=th,Fy={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Gt(n){this.options=Object.assign({},Fy,n),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=qy(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Gy),this.processTextOrObjNode=Ky,this.options.format?(this.indentate=Wy,this.tagEndChar=`>
130
130
  `,this.newLine=`
131
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Gt.prototype.build=function(n){return this.options.preserveOrder?Vy(n,this.options):(Array.isArray(n)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(n={[this.options.arrayNodeName]:n}),this.j2x(n,0,[]).val)};Gt.prototype.j2x=function(n,e,t){let i="",r="";const s=t.join(".");for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))if(typeof n[o]>"u")this.isAttribute(o)&&(r+="");else if(n[o]===null)this.isAttribute(o)?r+="":o[0]==="?"?r+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(n[o]instanceof Date)r+=this.buildTextValNode(n[o],o,"",e);else if(typeof n[o]!="object"){const c=this.isAttribute(o);if(c&&!this.ignoreAttributesFn(c,s))i+=this.buildAttrPairStr(c,""+n[o]);else if(!c)if(o===this.options.textNodeName){let l=this.options.tagValueProcessor(o,""+n[o]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(n[o],o,"",e)}else if(Array.isArray(n[o])){const c=n[o].length;let l="",u="";for(let p=0;p<c;p++){const g=n[o][p];if(!(typeof g>"u"))if(g===null)o[0]==="?"?r+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){const _=this.j2x(g,e+1,t.concat(o));l+=_.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(u+=_.attrStr)}else l+=this.processTextOrObjNode(g,o,e,t);else if(this.options.oneListGroup){let _=this.options.tagValueProcessor(o,g);_=this.replaceEntitiesValue(_),l+=_}else l+=this.buildTextValNode(g,o,"",e)}this.options.oneListGroup&&(l=this.buildObjectNode(l,o,u,e)),r+=l}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){const c=Object.keys(n[o]),l=c.length;for(let u=0;u<l;u++)i+=this.buildAttrPairStr(c[u],""+n[o][c[u]])}else r+=this.processTextOrObjNode(n[o],o,e,t);return{attrStr:i,val:r}};Gt.prototype.buildAttrPairStr=function(n,e){return e=this.options.attributeValueProcessor(n,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+n:" "+n+'="'+e+'"'};function Dy(n,e,t,i){const r=this.j2x(n,t+1,i.concat(e));return n[this.options.textNodeName]!==void 0&&Object.keys(n).length===1?this.buildTextValNode(n[this.options.textNodeName],e,r.attrStr,t):this.buildObjectNode(r.val,e,r.attrStr,t)}Gt.prototype.buildObjectNode=function(n,e,t,i){if(n==="")return e[0]==="?"?this.indentate(i)+"<"+e+t+"?"+this.tagEndChar:this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let r="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",r=""),(t||t==="")&&n.indexOf("<")===-1?this.indentate(i)+"<"+e+t+s+">"+n+r:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(i)+`<!--${n}-->`+this.newLine:this.indentate(i)+"<"+e+t+s+this.tagEndChar+n+this.indentate(i)+r}};Gt.prototype.closeTag=function(n){let e="";return this.options.unpairedTags.indexOf(n)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${n}`,e};Gt.prototype.buildTextValNode=function(n,e,t,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${n}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${n}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+t+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,n);return r=this.replaceEntitiesValue(r),r===""?this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+t+">"+r+"</"+e+this.tagEndChar}};Gt.prototype.replaceEntitiesValue=function(n){if(n&&n.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];n=n.replace(t.regex,t.val)}return n};function Fy(n){return this.options.indentBy.repeat(n)}function qy(n){return n.startsWith(this.options.attributeNamePrefix)&&n!==this.options.textNodeName?n.substr(this.attrPrefixLen):!1}var Ky=Gt;const Wy=Wc,Gy=By,Jy=Ky;var Zy={XMLParser:Gy,XMLValidator:Wy,XMLBuilder:Jy};function Yy(n,e,t){const i=t?`<input type="hidden" name="RelayState" value="${t}" />`:"",r=`
131
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Gt.prototype.build=function(n){return this.options.preserveOrder?Dy(n,this.options):(Array.isArray(n)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(n={[this.options.arrayNodeName]:n}),this.j2x(n,0,[]).val)};Gt.prototype.j2x=function(n,e,t){let i="",r="";const s=t.join(".");for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a))if(typeof n[a]>"u")this.isAttribute(a)&&(r+="");else if(n[a]===null)this.isAttribute(a)?r+="":a[0]==="?"?r+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(n[a]instanceof Date)r+=this.buildTextValNode(n[a],a,"",e);else if(typeof n[a]!="object"){const c=this.isAttribute(a);if(c&&!this.ignoreAttributesFn(c,s))i+=this.buildAttrPairStr(c,""+n[a]);else if(!c)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+n[a]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(n[a],a,"",e)}else if(Array.isArray(n[a])){const c=n[a].length;let l="",u="";for(let p=0;p<c;p++){const g=n[a][p];if(!(typeof g>"u"))if(g===null)a[0]==="?"?r+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(typeof g=="object")if(this.options.oneListGroup){const _=this.j2x(g,e+1,t.concat(a));l+=_.val,this.options.attributesGroupName&&g.hasOwnProperty(this.options.attributesGroupName)&&(u+=_.attrStr)}else l+=this.processTextOrObjNode(g,a,e,t);else if(this.options.oneListGroup){let _=this.options.tagValueProcessor(a,g);_=this.replaceEntitiesValue(_),l+=_}else l+=this.buildTextValNode(g,a,"",e)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,u,e)),r+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const c=Object.keys(n[a]),l=c.length;for(let u=0;u<l;u++)i+=this.buildAttrPairStr(c[u],""+n[a][c[u]])}else r+=this.processTextOrObjNode(n[a],a,e,t);return{attrStr:i,val:r}};Gt.prototype.buildAttrPairStr=function(n,e){return e=this.options.attributeValueProcessor(n,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+n:" "+n+'="'+e+'"'};function Ky(n,e,t,i){const r=this.j2x(n,t+1,i.concat(e));return n[this.options.textNodeName]!==void 0&&Object.keys(n).length===1?this.buildTextValNode(n[this.options.textNodeName],e,r.attrStr,t):this.buildObjectNode(r.val,e,r.attrStr,t)}Gt.prototype.buildObjectNode=function(n,e,t,i){if(n==="")return e[0]==="?"?this.indentate(i)+"<"+e+t+"?"+this.tagEndChar:this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let r="</"+e+this.tagEndChar,s="";return e[0]==="?"&&(s="?",r=""),(t||t==="")&&n.indexOf("<")===-1?this.indentate(i)+"<"+e+t+s+">"+n+r:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(i)+`<!--${n}-->`+this.newLine:this.indentate(i)+"<"+e+t+s+this.tagEndChar+n+this.indentate(i)+r}};Gt.prototype.closeTag=function(n){let e="";return this.options.unpairedTags.indexOf(n)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${n}`,e};Gt.prototype.buildTextValNode=function(n,e,t,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${n}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${n}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+t+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,n);return r=this.replaceEntitiesValue(r),r===""?this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+t+">"+r+"</"+e+this.tagEndChar}};Gt.prototype.replaceEntitiesValue=function(n){if(n&&n.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];n=n.replace(t.regex,t.val)}return n};function Wy(n){return this.options.indentBy.repeat(n)}function Gy(n){return n.startsWith(this.options.attributeNamePrefix)&&n!==this.options.textNodeName?n.substr(this.attrPrefixLen):!1}var Jy=Gt;const Zy=Wc,Yy=Py,Xy=Jy;var Qy={XMLParser:Yy,XMLValidator:Zy,XMLBuilder:Xy};function ev(n,e,t){const i=t?`<input type="hidden" name="RelayState" value="${t}" />`:"",r=`
132
132
  <!DOCTYPE html>
133
133
  <html>
134
134
  <body onload="document.forms[0].submit()">
@@ -146,7 +146,7 @@ PERFORMANCE OF THIS SOFTWARE.
146
146
  }};
147
147
  <\/script>
148
148
  </body>
149
- </html>`;return new Response(r,{headers:{"Content-Type":"text/html"}})}async function Xy(n,e,t,i,r){var _,x,h;if(!t.redirect_uri)throw new j(400,{message:"Missing redirect_uri in authParams"});const[s]=await n.env.data.keys.list();if(!s)throw new j(500,{message:"No signing key found"});if(!((_=e.addons)!=null&&_.samlp))throw new j(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:o,audience:c}=e.addons.samlp,l=t.state||"";if(!o||!l||!i||!t.state)throw new j(400,{message:"Missing recipient or inResponseTo"});const u=JSON.parse(t.state),p=new URL(t.redirect_uri),g=await Qy(n,{issuer:n.env.ISSUER,audience:c||t.client_id,destination:p.toString(),inResponseTo:u.requestId,userId:((h=(x=i.app_metadata)==null?void 0:x.vimeo)==null?void 0:h.user_id)||i.user_id,email:i.email,sessionIndex:r,signature:{privateKeyPem:s.pkcs7,cert:s.cert,kid:s.kid}});return Yy(p.toString(),g,u.relayState)}async function Qy(n,e){const t=e.notBefore||new Date().toISOString(),i=e.notAfter||new Date(new Date(t).getTime()+10*60*1e3).toISOString(),r=e.issueInstant||t,s=e.sessionNotOnOrAfter||i,o=e.responseId||`_${Ve()}`,c=e.assertionId||`_${Ve()}`,l=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":i,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":t,"@_NotOnOrAfter":i}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":r,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":s}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":r,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":o,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":r,"@_Version":"2.0"}}];let p=new Zy.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(l);if(e.signature){const _=await fetch(n.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:p,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!_.ok)throw new Error(`Failed to sign SAML response: ${_.status}`);p=await _.text()}return e.encode===!1?p:btoa(p)}const hd=["sub","iss","aud","exp","nbf","iat","jti"];async function Zc(n,e){var m,b;const{authParams:t,user:i,client:r,session_id:s}=e,c=(await n.env.data.keys.list()).filter(S=>!S.revoked_at||new Date(S.revoked_at)>new Date),l=c[c.length-1];if(!(l!=null&&l.pkcs7))throw new j(500,{message:"No signing key available"});const u=Cm(l.pkcs7),p={aud:t.audience||"default",scope:t.scope||"",sub:(i==null?void 0:i.user_id)||t.client_id,iss:n.env.ISSUER,tenant_id:n.var.tenant_id,sid:s},g=i&&((m=t.scope)!=null&&m.split(" ").includes("openid"))?{aud:t.client_id,sub:i.user_id,iss:n.env.ISSUER,sid:s,nonce:t.nonce,given_name:i.given_name,family_name:i.family_name,nickname:i.nickname,picture:i.picture,locale:i.locale,name:i.name,email:i.email,email_verified:i.email_verified}:void 0;(b=n.env.hooks)!=null&&b.onExecuteCredentialsExchange&&await n.env.hooks.onExecuteCredentialsExchange({client:r,user:i,scope:t.scope||"",grant_type:""},{accessToken:{setCustomClaim:(S,O)=>{if(hd.includes(S))throw new Error(`Cannot overwrite reserved claim '${S}'`);p[S]=O}},idToken:{setCustomClaim:(S,O)=>{if(hd.includes(S))throw new Error(`Cannot overwrite reserved claim '${S}'`);g&&(g[S]=O)}},access:{deny:S=>{throw new j(400,{message:`Access denied: ${S}`})}}});const _={includeIssuedTimestamp:!0,expiresIn:new Dc(1,"d"),headers:{kid:l.kid}},x=await cd("RS256",u,p,_),h=g?await cd("RS256",u,g,_):void 0;return{access_token:x,refresh_token:e.refresh_token,id_token:h,token_type:"Bearer",expires_in:86400}}async function ev(n,e){const{client:t,scope:i,audience:r=t.tenant.audience,session_id:s}=e;return await n.env.data.refreshTokens.create(t.tenant.id,{token:Ve(),session_id:s,expires_at:new Date(Date.now()+Mc*1e3).toISOString(),used_at:new Date().toISOString(),scope:i,audience:r})}async function ah(n,e){const{user:t,client:i,scope:r,audience:s}=e,o=await n.env.data.sessions.create(i.tenant.id,{session_id:Ve(),user_id:t.user_id,client_id:i.id,expires_at:new Date(Date.now()+Mc*1e3).toISOString(),used_at:new Date().toISOString()}),c=r!=null&&r.split(" ").includes("offline_access")?await ev(n,{...e,session_id:o.session_id,scope:r,audience:s}):void 0;return{...o,refresh_token:c}}async function ei(n,e){var g;const{authParams:t,user:i,client:r}=e,s=be(n,{type:_e.SUCCESS_LOGIN,description:`Successful login for ${i.user_id}`,userId:i.user_id});gt(n,n.env.data.logs.create(r.tenant.id,s)),gt(n,n.env.data.users.update(r.tenant.id,i.user_id,{last_login:new Date().toISOString(),last_ip:n.req.header("x-real-ip")||"",login_count:i.login_count+1}));let o=e.refreshToken,c=e.sessionId;if(!c){const _=await ah(n,{user:i,client:r,scope:t.scope,audience:t.audience});c=_.session_id,o=(g=_.refresh_token)==null?void 0:g.token}if(e.authParams.response_mode===Vt.SAML_POST)return Xy(n,e.client,e.authParams,i,c);const l=await Zc(n,{authParams:t,user:i,client:r,session_id:c,refresh_token:o}),u=new Headers({"set-cookie":Qf(r.tenant.id,c)});if(t.response_mode===Vt.WEB_MESSAGE)return n.json(l,{headers:u});if((t.response_type||Ut.CODE)===Ut.CODE){if(!e.loginSession)throw new j(500,{message:"Login session not found"});const _=await n.env.data.codes.create(r.tenant.id,{code_id:Ve(),user_id:i.user_id,code_type:"authorization_code",login_id:e.loginSession.login_id,expires_at:new Date(Date.now()+H0*1e3).toISOString()});u.set("location",`${t.redirect_uri}?state=${e.authParams.state}&code=${_.code_id}`)}return new Response("Redirecting",{status:302,headers:u})}function tv(n){return async(e,t)=>{if(!t.email||!t.email_verified)return n.users.create(e,t);const i=await qd({userAdapter:n.users,tenant_id:e,email:t.email});return i?(await n.users.create(e,{...t,linked_to:i.user_id}),i):n.users.create(e,t)}}async function ch(n,e,t){for await(const i of e)if(!(await fetch(i.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok){const s=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});await t.logs.create(n.var.tenant_id,s)}}function nv(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t);return await ch(n,r,{tenant_id:t,user:i,trigger_id:"post-user-registration"}),i}}function iv(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await ch(n,r,{tenant_id:t,email:i,trigger_id:"pre-user-signup"})}}function rv(n,e){return async(t,i)=>{let r=await tv(e)(t,i);return await nv(n,e)(t,r),r}}async function sv(n,e,t,i){if(e.disable_sign_ups&&!await qd({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:i})){const s=be(n,{type:_e.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.env.data.logs.create(e.tenant.id,s),new j(400,{message:"Signups are disabled for this client"})}await iv(n,t)(n.var.tenant_id||"",i)}function ov(n,e){return{...e,users:{...e.users,create:rv(n,e)}}}async function av(n,e,t,i){if(!i.state)throw new j(400,{message:"State not found"});const r=e.connections.find(l=>l.name===t);if(!r){n.set("client_id",e.id);const l=be(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await n.env.data.logs.create(e.tenant.id,l),new j(403,{message:"Connection Not Found"})}let s=await n.env.data.logins.get(e.tenant.id,i.state);s||(s=await n.env.data.logins.create(e.tenant.id,{expires_at:new Date(Date.now()+es*1e3).toISOString(),authParams:i,...Hn(n.req)}));const c=await Zf(n,r.strategy).getRedirect(n,r);return await n.env.data.codes.create(e.tenant.id,{login_id:s.login_id,code_id:c.code,code_type:"oauth2_state",connection_id:r.id,code_verifier:c.codeVerifier,expires_at:new Date(Date.now()+D0*1e3).toISOString()}),n.redirect(c.redirectUrl)}async function gd(n,{code:e,state:t}){var h;const{env:i}=n,r=await i.data.codes.get(n.var.tenant_id||"",t,"oauth2_state");if(!r||!r.connection_id)throw new j(403,{message:"State not found"});const s=await i.data.logins.get(n.var.tenant_id||"",r.login_id);if(!s)throw new j(403,{message:"Session not found"});const o=await qc(i,s.authParams.client_id);n.set("client_id",o.id),n.set("tenant_id",o.tenant.id);const c=o.connections.find(m=>m.id===r.connection_id);if(!c){const m=be(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await i.data.logs.create(o.tenant.id,m),new j(403,{message:"Connection not found"})}if(n.set("connection",c.name),!s.authParams.redirect_uri){const m=be(n,{type:_e.FAILED_LOGIN,description:"Redirect URI not defined"});throw await i.data.logs.create(o.tenant.id,m),new j(403,{message:"Redirect URI not defined"})}if(!Ys(s.authParams.redirect_uri,o.callbacks||[],{allowPathWildcards:!0})){const m=`Invalid redirect URI - ${s.authParams.redirect_uri}`,b=be(n,{type:_e.FAILED_LOGIN,description:m});throw await i.data.logs.create(o.tenant.id,b),new j(403,{message:m})}const u=await Zf(n,c.strategy).validateAuthorizationCodeAndGetUser(n,c,e,r.code_verifier),{sub:p,...g}=u;n.set("user_id",p);const _=((h=u.email)==null?void 0:h.toLocaleLowerCase())||`${c.name}.${p}@${new URL(n.env.ISSUER).hostname}`;n.set("username",_);let x=await os({userAdapter:i.data.users,tenant_id:o.tenant.id,email:_,provider:c.name});if(!x){try{await sv(n,o,n.env.data,_)}catch(m){const b=m;throw new j(500,{message:`Failed to run preUserSignupHook: ${b.message}`})}x=await i.data.users.create(o.tenant.id,{user_id:`${c.name}|${p}`,email:_,name:_,provider:c.name,connection:c.name,email_verified:!0,last_ip:"",is_social:!0,last_login:new Date().toISOString(),profileData:JSON.stringify(g)}),n.set("user_id",x.user_id)}return ei(n,{client:o,authParams:s.authParams,loginSession:s,user:x})}async function _d(n,e,t,i,r,s){const o=await n.env.data.codes.get(n.var.tenant_id||"",e,"oauth2_state");if(!o)throw new j(400,{message:"State not found"});const c=await n.env.data.logins.get(n.var.tenant_id,o.login_id);if(!c)throw new j(400,{message:"Login not found"});const{redirect_uri:l}=c.authParams;if(!l)throw new j(400,{message:"Redirect uri not found"});const u=be(n,{type:_e.FAILED_LOGIN,description:`Failed connection login: ${r} ${t}, ${i}`});gt(n,n.env.data.logs.create(n.var.tenant_id,u));const p=new URL(l);return V0(p,{error:t,error_description:i,error_reason:s,error_code:r,state:c.authParams.state}),n.redirect(`${yt(n.env)}enter-email?state=${c.login_id}&error=${t}`)}const cv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:a.z.object({state:a.z.string(),code:a.z.string().optional(),scope:a.z.string().optional(),hd:a.z.string().optional(),error:a.z.string().optional(),error_description:a.z.string().optional(),error_code:a.z.string().optional(),error_reason:a.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:o}=n.req.valid("query");if(i)return _d(n,e,i,r,s,o);if(!t)throw new j(400,{message:"Code is required"});return gd(n,{code:t,state:e})}).openapi(a.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:a.z.object({state:a.z.string(),code:a.z.string().optional(),scope:a.z.string().optional(),hd:a.z.string().optional(),error:a.z.string().optional(),error_description:a.z.string().optional(),error_code:a.z.string().optional(),error_reason:a.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:o}=n.req.valid("form");if(i)return _d(n,e,i,r,s,o);if(!t)throw new j(400,{message:"Code is required"});return gd(n,{code:t,state:e})}),lv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:a.z.object({client_id:a.z.string(),returnTo:a.z.string().optional()}),header:a.z.object({cookie:a.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async n=>{const{client_id:e,returnTo:t}=n.req.valid("query"),i=await n.env.data.clients.get(e);if(!i)return n.text("OK");const r=await n.env.data.clients.get("DEFAULT_CLIENT");n.set("client_id",e),n.set("tenant_id",i.tenant.id);const s=t||n.req.header("referer");if(!s)return n.text("OK");if(!Ys(s,[...i.allowed_logout_urls||[],...(r==null?void 0:r.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new j(400,{message:"Invalid redirect uri"});const o=n.req.header("cookie");if(o){const l=Xf(i.tenant.id,o);if(l){const u=await n.env.data.sessions.get(i.tenant.id,l);if(u){const p=await n.env.data.users.get(i.tenant.id,u.user_id);p&&(n.set("user_id",p.user_id),n.set("connection",p.connection))}await n.env.data.sessions.remove(i.tenant.id,l)}}const c=be(n,{type:_e.SUCCESS_LOGOUT,description:"User successfully logged out"});return await n.env.data.logs.create(i.tenant.id,c),new Response("Redirecting",{status:302,headers:{"set-cookie":Nm(i.tenant.id),location:s}})}),md=a.z.object({sub:a.z.string(),email:a.z.string().optional(),family_name:a.z.string().optional(),given_name:a.z.string().optional(),email_verified:a.z.boolean()}),uv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:md}},description:"Userinfo"}}}),async n=>{if(!n.var.user)throw new j(404,{message:"User not found"});const e=await n.env.data.users.get(n.var.user.tenant_id,n.var.user.sub);if(!e)throw new j(404,{message:"User not found"});return n.json(md.parse({...e,sub:e.user_id}))}),dv=new a.OpenAPIHono().openapi(a.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:zd}},description:"List of tenants"}}}),async n=>{const e=await n.env.data.keys.list(),t=await Promise.all(e.map(async i=>{const s=await new Vc(i.cert).publicKey.export(),o=await crypto.subtle.exportKey("jwk",s);return Wa.parse({...o,kid:i.kid})}));return n.json({keys:t},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${er}, stale-while-revalidate=${er*2}, stale-if-error=86400`}})}).openapi(a.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:bo}},description:"List of tenants"}}}),async n=>{const e=n.env.ISSUER,t=bo.parse({issuer:e,authorization_endpoint:`${e}authorize`,token_endpoint:`${e}oauth/token`,device_authorization_endpoint:`${e}oauth/device/code`,userinfo_endpoint:`${e}userinfo`,mfa_challenge_endpoint:`${e}mfa/challenge`,jwks_uri:`${e}.well-known/jwks.json`,registration_endpoint:`${e}oidc/register`,revocation_endpoint:`${e}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return n.json(t,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${er}, stale-while-revalidate=${er*2}, stale-if-error=86400`}})});function cr(n,e){if(!n||!e||n.length!==e.length)return!1;let t=0;for(let i=0;i<n.length;i++)t|=n.charCodeAt(i)^e.charCodeAt(i);return t===0}const lh=a.z.object({grant_type:a.z.literal("client_credentials"),scope:a.z.string().optional(),client_secret:a.z.string(),client_id:a.z.string(),audience:a.z.string().optional()});async function pv(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new j(403,{message:"Invalid client credentials"});if(t.client_secret&&!cr(t.client_secret,e.client_secret))throw new j(403,{message:"Invalid client credentials"});const i={client_id:t.id,scope:e.scope,audience:e.audience},r=await Zc(n,{authParams:i,client:t});return n.json(r)}const fv=a.z.object({grant_type:a.z.literal("authorization_code"),client_id:a.z.string(),code:a.z.string(),redirect_uri:a.z.string().optional(),client_secret:a.z.string().optional(),code_verifier:a.z.string().optional()}).refine(n=>"client_secret"in n&&!("code_verifier"in n)||!("client_secret"in n)&&"code_verifier"in n,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function hv(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new j(403,{message:"Client not found"});const i=await n.env.data.codes.get(t.tenant.id,e.code,"authorization_code");if(!i||!i.user_id)throw new j(403,{message:"Invalid client credentials"});if(new Date(i.expires_at)<new Date)throw new j(403,{message:"Code expired"});if(i.used_at)throw new j(403,{message:"Code already used"});const r=await n.env.data.logins.get(t.tenant.id,i.login_id);if(!r)throw new j(403,{message:"Invalid login"});if("client_secret"in e){const o=await n.env.data.clients.get("DEFAULT_CLIENT");if(!cr(t.client_secret,e.client_secret)&&!cr(o==null?void 0:o.client_secret,e.client_secret))throw new j(403,{message:"Invalid client credentials"})}else if("code_verifier"in e&&typeof e.code_verifier=="string"&&"code_challenge_method"in r.authParams&&typeof r.authParams.code_challenge_method=="string"){const o=await zm(e.code_verifier,r.authParams.code_challenge_method);if(!cr(o,r.authParams.code_challenge||""))throw new j(403,{message:"Invalid client credentials"})}if(r.authParams.redirect_uri&&r.authParams.redirect_uri!==e.redirect_uri)throw new j(403,{message:"Invalid redirect uri"});const s=await n.env.data.users.get(t.tenant.id,i.user_id);if(!s)throw new j(403,{message:"User not found"});return await n.env.data.codes.used(t.tenant.id,e.code),ei(n,{user:s,client:t,loginSession:r,authParams:{...r.authParams,response_mode:Vt.WEB_MESSAGE}})}const gv=a.z.object({grant_type:a.z.literal("refresh_token"),client_id:a.z.string(),redirect_uri:a.z.string().optional(),refresh_token:a.z.string()});async function _v(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new j(403,{message:"Client not found"});const i=await n.env.data.refreshTokens.get(t.tenant.id,e.refresh_token);if(i){if(new Date(i.expires_at)<new Date)throw new j(403,{message:"Refresh token expired"})}else throw new j(403,{message:"Invalid refresh token"});const r=await n.env.data.sessions.get(t.tenant.id,i.session_id);if(!r)throw new j(403,{message:"Session not found"});const s=await n.env.data.users.get(t.tenant.id,r.user_id);if(!s)throw new j(403,{message:"User not found"});return ei(n,{user:s,client:t,refreshToken:i.token,sessionId:r.session_id,authParams:{client_id:t.id,audience:i.audience,scope:i.scope,response_mode:Vt.WEB_MESSAGE}})}const yd=a.z.object({client_id:a.z.string().optional(),client_secret:a.z.string().optional()}),mv=a.z.union([lh.extend(yd.shape),a.z.object({grant_type:a.z.literal("authorization_code"),client_id:a.z.string(),code:a.z.string(),redirect_uri:a.z.string(),code_verifier:a.z.string().min(43).max(128)}),a.z.object({grant_type:a.z.literal("authorization_code"),code:a.z.string(),redirect_uri:a.z.string().optional(),...yd.shape}),a.z.object({grant_type:a.z.literal("refresh_token"),client_id:a.z.string(),refresh_token:a.z.string(),redirect_uri:a.z.string().optional()})]);function yv(n){if(!n)return{};const[e,t]=n.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&t){const[i,r]=atob(t).split(":");return{client_id:i,client_secret:r}}return{}}const vv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:mv}}}},responses:{200:{content:{"application/json":{schema:Td}},description:"Tokens"}}}),async n=>{const e=n.req.valid("form"),t=yv(n.req.header("Authorization")),i={...e,...t};if(!i.client_id)throw new j(400,{message:"client_id is required"});switch(e.grant_type){case ci.AuthorizationCode:return hv(n,fv.parse(i));case ci.ClientCredential:return pv(n,lh.parse(i));case ci.RefreshToken:return _v(n,gv.parse(i));default:throw new j(400,{message:"Not implemented"})}});var Yc={exports:{}};const Xc=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],uh=(n,e=Xc,t="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let i=n||"";e[0].minDiversity=0,e[0].minLength=0;const r=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];t&&r.push({regex:`[${t}]`,message:"symbol"});let s={};s.contains=r.filter(c=>new RegExp(`${c.regex}`).test(i)).map(c=>c.message),s.length=i.length;let o=e.filter(c=>s.contains.length>=c.minDiversity).filter(c=>s.length>=c.minLength).sort((c,l)=>l.id-c.id).map(c=>({id:c.id,value:c.value}));return Object.assign(s,o[0]),s};Yc.exports={passwordStrength:uh,defaultOptions:Xc};var wv=Yc.exports.passwordStrength=uh;Yc.exports.defaultOptions=Xc;function bv(n){return wv(n).id<2?!1:n.length>=8&&/[a-z]/.test(n)&&/[A-Z]/.test(n)&&/[0-9]/.test(n)&&/[^A-Za-z0-9]/.test(n)}async function Qs(n,e){var r;const t=await n.env.data.emailProviders.get(n.var.tenant_id)||(n.env.DEFAULT_TENANT_ID?await n.env.data.emailProviders.get(n.env.DEFAULT_TENANT_ID):null);if(!t)throw new j(500,{message:"Email provider not found"});const i=(r=n.env.emailProviders)==null?void 0:r[t.name];if(!i)throw new j(500,{message:"Email provider not found"});await i({emailProvider:t,...e,from:t.default_from_address||`login@${n.env.ISSUER}`})}async function kv(n,e,t,i){const r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new j(500,{message:"Tenant not found"});const s=`${yt(n.env)}reset-password?state=${i}&code=${t}`,o={vendorName:r.name,lng:r.language||"en"};await Qs(n,{to:e,subject:"Reset your password",html:`Click here to reset your password: ${yt(n.env)}reset-password?state=${i}&code=${t}`,template:"auth-password-reset",data:{vendorName:r.name,logo:r.logo||"",passwordResetUrl:s,supportUrl:r.support_url||"https://support.sesamy.com",buttonColor:r.primary_color||"#7d68f4",passwordResetTitle:ue("password_reset_title",o),resetPasswordEmailClickToReset:ue("reset_password_email_click_to_reset",o),resetPasswordEmailReset:ue("reset_password_email_reset",o),supportInfo:ue("support_info",o),contactUs:ue("contact_us",o),copyright:ue("copyright",o)}})}async function xv(n,e,t){const i=await n.env.data.tenants.get(n.var.tenant_id);if(!i)throw new j(500,{message:"Tenant not found"});const r={vendorName:i.name,code:t,lng:i.language||"en"};await Qs(n,{to:e,subject:ue("code_email_subject",r),html:`Click here to validate your email: ${yt(n.env)}validate-email`,template:"auth-link",data:{code:t,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:`${kt(n.env)}passwordless/verify_redirect?ticket=${t}`,buttonColor:i.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",r),linkEmailClickToLogin:ue("link_email_click_to_login",r),linkEmailLogin:ue("link_email_login",r),linkEmailOrEnterCode:ue("link_email_or_enter_code",r),codeValid30Mins:ue("code_valid_30_minutes",r),supportInfo:ue("support_info",r),contactUs:ue("contact_us",r),copyright:ue("copyright",r)}});const s=be(n,{type:_e.CODE_LINK_SENT,description:e});gt(n,n.env.data.logs.create(i.id,s))}async function dh(n,e,t){const i=await n.env.data.tenants.get(n.var.tenant_id);if(!i)throw new j(500,{message:"Tenant not found"});const r={vendorName:i.name,code:t,lng:i.language||"en"};await Qs(n,{to:e,subject:ue("code_email_subject",r),html:`Click here to validate your email: ${yt(n.env)}validate-email`,template:"auth-link",data:{code:t,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:`${kt(n.env)}passwordless/verify_redirect?ticket=${t}`,buttonColor:i.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",r),linkEmailClickToLogin:ue("link_email_click_to_login",r),linkEmailLogin:ue("link_email_login",r),linkEmailOrEnterCode:ue("link_email_or_enter_code",r),codeValid30Mins:ue("code_valid_30_minutes",r),supportInfo:ue("support_info",r),contactUs:ue("contact_us",r),copyright:ue("copyright",r)}});const s=be(n,{type:_e.CODE_LINK_SENT,description:e});gt(n,n.env.data.logs.create(i.id,s))}async function ph(n,e){const t=await n.env.data.tenants.get(n.var.tenant_id);if(!t)throw new j(500,{message:"Tenant not found"});const i={vendorName:t.name,lng:t.language||"en"};await Qs(n,{to:e.email,subject:"Validate your email address",html:`Click here to validate your email: ${yt(n.env)}validate-email`,template:"auth-verify-email",data:{vendorName:t.name,logo:t.logo||"",emailValidationUrl:`${yt(n.env)}validate-email`,supportUrl:t.support_url||"https://support.sesamy.com",buttonColor:t.primary_color||"#7d68f4",welcomeToYourAccount:ue("welcome_to_your_account",i),verifyEmailVerify:ue("verify_email_verify",i),supportInfo:ue("support_info",i),contactUs:ue("contact_us",i),copyright:ue("copyright",i)}})}const Sv=new a.OpenAPIHono().openapi(a.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:a.z.object({client_id:a.z.string(),connection:a.z.literal("Username-Password-Authentication"),email:a.z.string().transform(n=>n.toLowerCase()),password:a.z.string()})}}}},responses:{200:{content:{"application/json":{schema:a.z.object({_id:a.z.string(),email:a.z.string(),email_verified:a.z.boolean(),app_metadata:a.z.object({}),user_metadata:a.z.object({})})}},description:"Created user"}}}),async n=>{const{email:e,password:t,client_id:i}=n.req.valid("json"),r=await n.env.data.clients.get(i);if(!r)throw new j(400,{message:"Client not found"});if(n.set("client_id",r.id),n.set("tenant_id",r.tenant.id),!bv(t))throw new j(400,{message:"Password does not meet the requirements"});if(await os({userAdapter:n.env.data.users,tenant_id:r.tenant.id,email:e,provider:"auth2"}))throw new j(400,{message:"Invalid sign up"});const o=await n.env.data.users.create(r.tenant.id,{user_id:`auth2|${Za()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});n.set("user_id",o.user_id),n.set("username",o.email),n.set("connection",o.connection);const c=await Ja.hash(t,10);await n.env.data.passwords.create(r.tenant.id,{user_id:o.user_id,password:c,algorithm:"bcrypt"}),await ph(n,o);const l=be(n,{type:_e.SUCCESS_SIGNUP,description:"Successful signup"});return await n.env.data.logs.create(r.tenant.id,l),n.json({_id:o.user_id,email:o.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(a.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:a.z.object({client_id:a.z.string(),connection:a.z.literal("Username-Password-Authentication"),email:a.z.string().transform(n=>n.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{email:e,client_id:t}=n.req.valid("json"),i=await n.env.data.clients.get(t);if(!i)throw new j(400,{message:"Client not found"});if(n.set("client_id",i.id),n.set("tenant_id",i.tenant.id),!await Ya({userAdapter:n.env.data.users,tenant_id:i.tenant.id,email:e,provider:"auth2"}))return n.html("If an account with that email exists, we've sent instructions to reset your password.");const s={client_id:t,username:e},o=await n.env.data.logins.create(i.tenant.id,{expires_at:new Date(Date.now()+es*1e3).toISOString(),authParams:s,...Hn(n.req)});return await kv(n,e,o.login_id,o.authParams.state),n.html("If an account with that email exists, we've sent instructions to reset your password.")});function fh(){const n="1234567890";let e="";for(let t=0;t<6;t+=1)e+=n[Math.floor(Math.random()*10)];return e.toString()}const Av=new a.OpenAPIHono().openapi(a.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:a.z.object({client_id:a.z.string(),connection:a.z.string(),email:a.z.string().transform(n=>n.toLowerCase()),send:a.z.enum(["link","code"]),authParams:Ka.omit({client_id:!0})})}}}},responses:{200:{description:"Status"}}}),async n=>{const e=n.req.valid("json"),{env:t}=n,{client_id:i,email:r,send:s,authParams:o}=e,c=await n.env.data.clients.get(i);if(!c)throw new j(400,{message:"Client not found"});n.set("client_id",c.id),n.set("tenant_id",c.tenant.id);const l=await t.data.logins.create(c.tenant.id,{authParams:{...o,client_id:i,username:r},expires_at:new Date(Date.now()+Qu).toISOString(),...Hn(n.req)}),u=await t.data.codes.create(c.tenant.id,{code_id:fh(),code_type:"otp",login_id:l.login_id,expires_at:new Date(Date.now()+Qu).toISOString()});return s==="link"?await dh(n,r,u.code_id):await xv(n,r,u.code_id),n.html("OK")}).openapi(a.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:a.z.object({scope:a.z.string(),response_type:a.z.nativeEnum(Ut),redirect_uri:a.z.string(),state:a.z.string(),nonce:a.z.string().optional(),verification_code:a.z.string(),connection:a.z.string(),client_id:a.z.string(),email:a.z.string().transform(n=>n.toLowerCase()),audience:a.z.string().optional()})},responses:{302:{description:"Status"}}}),async n=>{const{env:e}=n,{client_id:t,email:i,verification_code:r,redirect_uri:s,state:o,scope:c,audience:l,response_type:u,nonce:p}=n.req.valid("query"),g=await qc(e,t);n.set("client_id",g.id),n.set("tenant_id",g.tenant.id),n.set("connection","email");const _=await e.data.codes.get(g.tenant.id,r,"otp");if(!_)throw new j(400,{message:"Code not found or expired"});if(_.expires_at<new Date().toISOString())throw new j(400,{message:"Code expired"});const x=await e.data.logins.get(g.tenant.id,_.login_id);if(!x||x.authParams.username!==i)throw new j(400,{message:"Code not found or expired"});const h=Hn(n.req);if(x.ip!==h.ip)return n.redirect(`${yt(n.env)}invalid-session?state=${x.login_id}`);if(!Ys(s,g.callbacks,{allowPathWildcards:!0}))throw new j(400,{message:`Invalid redirect URI - ${s}`});const m={client_id:t,redirect_uri:s,state:o,nonce:p,scope:c,audience:l,response_type:u},b=await os({userAdapter:e.data.users,tenant_id:g.tenant.id,email:i,provider:"email"});if(!b)throw new j(400,{message:"User not found"});return ei(n,{user:b,client:g,loginSession:x,authParams:m})});class oi extends j{constructor(t,i){super(t,i);te(this,"_code");this._code=i==null?void 0:i.code}get code(){return this._code}}async function Iv(n,e,t){const{env:i}=n,r=t.username;if(n.set("username",r),!r)throw new j(400,{message:"Username is required"});const s=await Ya({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:r,provider:"auth2"});if(!s){const _=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw gt(n,n.env.data.logs.create(e.tenant.id,_)),new oi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const o=s.linked_to?await i.data.users.get(e.tenant.id,s.linked_to):s;if(!o)throw new oi(403,{message:"User not found",code:"USER_NOT_FOUND"});n.set("connection",s.connection),n.set("user_id",o.user_id);const{password:c}=await i.data.passwords.get(e.tenant.id,s.user_id);if(!await Ja.compare(t.password,c)){const _=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw gt(n,n.env.data.logs.create(e.tenant.id,_)),new oi(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${o.user_id}`})).logs.filter(_=>_.type===_e.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(_.date)>new Date(Date.now()-1e3*60*5)).length>=3){const _=be(n,{type:_e.FAILED_LOGIN,description:"Too many failed login attempts"});throw gt(n,n.env.data.logs.create(e.tenant.id,_)),new oi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!s.email_verified&&e.email_validation==="enforced"){await ph(n,s);const _=be(n,{type:_e.FAILED_LOGIN,description:"Email not verified"});throw await n.env.data.logs.create(e.tenant.id,_),new oi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}const g=be(n,{type:_e.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return gt(n,n.env.data.logs.create(e.tenant.id,g)),o}function Ev(){const n=new Uint8Array(32);return crypto.getRandomValues(n),sn.encode(n,{includePadding:!1})}function vd(){return new j(403,{res:new Response(JSON.stringify({error:"access_denied",error_description:"Wrong email or verification code."}),{status:403,headers:{"Content-Type":"application/json"}}),message:"Wrong email or verification code."})}const wd=30*60*1e3,$v=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:a.z.union([a.z.object({credential_type:a.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:a.z.string(),client_id:a.z.string(),username:a.z.string().transform(n=>n.toLowerCase()),realm:a.z.enum(["email"]),scope:a.z.string().optional()}),a.z.object({credential_type:a.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:a.z.string(),username:a.z.string().transform(n=>n.toLowerCase()),password:a.z.string(),realm:a.z.enum(["Username-Password-Authentication"]),scope:a.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async n=>{const e=n.req.valid("json"),{client_id:t,username:i}=e;n.set("username",i);const r=await n.env.data.clients.get(t);if(!r)throw new j(400,{message:"Client not found"});n.set("client_id",t),n.set("tenant_id",r.tenant.id);const s=i.toLocaleLowerCase();let o;if("otp"in e){const p=await n.env.data.codes.get(r.tenant.id,e.otp,"otp");if(!p)throw vd();const g=await n.env.data.logins.get(r.tenant.id,p.login_id);if(!g||g.authParams.username!==s)throw vd();o=g}else if("password"in e)await Iv(n,r,{username:i,password:e.password,client_id:t}),o=await n.env.data.logins.create(r.tenant.id,{expires_at:new Date(Date.now()+wd).toISOString(),authParams:{client_id:r.id,username:s},...Hn(n.req)});else throw new j(400,{message:"Code or password required"});const c=Ev(),l=Ve(12),u=await n.env.data.codes.create(r.tenant.id,{code_id:Ve(),code_type:"ticket",login_id:o.login_id,expires_at:new Date(Date.now()+wd).toISOString(),code_verifier:[l,c].join("|")});return n.json({login_ticket:u.code_id,co_verifier:c,co_id:l})});function Cv(n,e){var i,r,s;if(!n||e.length===0)return!1;const t=((i=yo(n))==null?void 0:i.host)??null;if(!t)return!1;for(const o of e){let c;if(o.startsWith("http://")||o.startsWith("https://")?c=((r=yo(o))==null?void 0:r.host)??null:c=((s=yo("https://"+o))==null?void 0:s.host)??null,t===c)return!0}return!1}function yo(n){try{return new URL(n)}catch{return null}}async function zv({ctx:n,session:e,client:t,authParams:i,connection:r,login_hint:s}){const o=await n.env.data.logins.create(t.tenant.id,{expires_at:new Date(Date.now()+es*1e3).toISOString(),authParams:i,...Hn(n.req)});if(e&&s){const c=await n.env.data.users.get(t.tenant.id,e.user_id);if((c==null?void 0:c.email)===s)return ei(n,{client:t,loginSession:o,authParams:i,user:c,sessionId:e.session_id})}if(r==="email"&&s){const c=fh();return await n.env.data.codes.create(t.tenant.id,{code_id:c,code_type:"otp",login_id:o.login_id,expires_at:new Date(Date.now()+es*1e3).toISOString()}),await dh(n,s,c),n.redirect(`/u/enter-code?state=${o.login_id}`)}return e?n.redirect(`/u/check-account?state=${o.login_id}`):n.redirect(`/u/enter-email?state=${o.login_id}`)}function jv(n){if(n==="Username-Password-Authentication")return"auth2";if(n==="email")return"email";throw new j(403,{message:"Invalid realm"})}async function Nv(n,e,t,i,r){var _;const{env:s}=n;n.set("connection",r);const o=await s.data.codes.get(e,t,"ticket");if(!o||o.used_at)throw new j(403,{message:"Ticket not found"});const c=await s.data.logins.get(e,o.login_id);if(!c||!c.authParams.username)throw new j(403,{message:"Session not found"});const l=await s.data.clients.get(c.authParams.client_id);if(!l)throw new j(403,{message:"Client not found"});n.set("client_id",c.authParams.client_id),await s.data.codes.used(e,t);const u=jv(r);let p=await os({userAdapter:s.data.users,tenant_id:e,email:c.authParams.username,provider:u});p||(p=await s.data.users.create(e,{user_id:`email|${Za()}`,email:c.authParams.username,name:c.authParams.username,provider:"email",connection:"email",email_verified:!0,is_social:!1,last_ip:"",last_login:new Date().toISOString()})),n.set("username",p.email),n.set("user_id",p.user_id);const g=await ah(n,{user:p,client:l,scope:i.scope,audience:i.audience});return ei(n,{authParams:{scope:(_=c.authParams)==null?void 0:_.scope,...i},loginSession:c,sessionId:g.session_id,user:p,client:l})}async function bd(n,e){return`<!DOCTYPE html>
149
+ </html>`;return new Response(r,{headers:{"Content-Type":"text/html"}})}async function tv(n,e,t,i,r){var _,x,h;if(!t.redirect_uri)throw new j(400,{message:"Missing redirect_uri in authParams"});const[s]=await n.env.data.keys.list();if(!s)throw new j(500,{message:"No signing key found"});if(!((_=e.addons)!=null&&_.samlp))throw new j(400,{message:`SAML Addon is not enabled for client ${e.id}`});const{recipient:a,audience:c}=e.addons.samlp,l=t.state||"";if(!a||!l||!i||!t.state)throw new j(400,{message:"Missing recipient or inResponseTo"});const u=JSON.parse(t.state),p=new URL(t.redirect_uri),g=await nv(n,{issuer:n.env.ISSUER,audience:c||t.client_id,destination:p.toString(),inResponseTo:u.requestId,userId:((h=(x=i.app_metadata)==null?void 0:x.vimeo)==null?void 0:h.user_id)||i.user_id,email:i.email,sessionIndex:r,signature:{privateKeyPem:s.pkcs7,cert:s.cert,kid:s.kid}});return ev(p.toString(),g,u.relayState)}async function nv(n,e){const t=e.notBefore||new Date().toISOString(),i=e.notAfter||new Date(new Date(t).getTime()+10*60*1e3).toISOString(),r=e.issueInstant||t,s=e.sessionNotOnOrAfter||i,a=e.responseId||`_${Me()}`,c=e.assertionId||`_${Me()}`,l=[{"samlp:Response":[{"saml:Issuer":[{"#text":e.issuer}]},{"samlp:Status":[{"samlp:StatusCode":[],":@":{"@_Value":"urn:oasis:names:tc:SAML:2.0:status:Success"}}]},{"saml:Assertion":[{"saml:Issuer":[{"#text":e.issuer}]},{"saml:Subject":[{"saml:NameID":[{"#text":e.email}],":@":{"@_Format":"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"}},{"saml:SubjectConfirmation":[{"saml:SubjectConfirmationData":[],":@":{"@_InResponseTo":e.inResponseTo,"@_NotOnOrAfter":i,"@_Recipient":e.destination}}],":@":{"@_Method":"urn:oasis:names:tc:SAML:2.0:cm:bearer"}}]},{"saml:Conditions":[{"saml:AudienceRestriction":[{"saml:Audience":[{"#text":e.audience}]}]}],":@":{"@_NotBefore":t,"@_NotOnOrAfter":i}},{"saml:AuthnStatement":[{"saml:AuthnContext":[{"saml:AuthnContextClassRef":[{"#text":"urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"}]}]}],":@":{"@_AuthnInstant":r,"@_SessionIndex":e.sessionIndex,"@_SessionNotOnOrAfter":s}},{"saml:AttributeStatement":[{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.userId}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_FriendlyName":"persistent","@_Name":"id","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":e.email}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"email","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"default-roles-master"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"offline_access"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"view-profile"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"uma_authorization"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}},{"saml:Attribute":[{"saml:AttributeValue":[{"#text":"manage-account-links"}],":@":{"@_xmlns:xs":"http://www.w3.org/2001/XMLSchema","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xsi:type":"xs:string"}}],":@":{"@_Name":"Role","@_NameFormat":"urn:oasis:names:tc:SAML:2.0:attrname-format:basic"}}]}],":@":{"@_xmlns":"urn:oasis:names:tc:SAML:2.0:assertion","@_ID":c,"@_IssueInstant":r,"@_Version":"2.0"}}],":@":{"@_xmlns:samlp":"urn:oasis:names:tc:SAML:2.0:protocol","@_xmlns:saml":"urn:oasis:names:tc:SAML:2.0:assertion","@_Destination":e.destination,"@_ID":a,"@_InResponseTo":e.inResponseTo,"@_IssueInstant":r,"@_Version":"2.0"}}];let p=new Qy.XMLBuilder({ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}).build(l);if(e.signature){const _=await fetch(n.env.SAML_SIGN_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({xmlContent:p,privateKey:e.signature.privateKeyPem,publicCert:e.signature.cert})});if(!_.ok)throw new Error(`Failed to sign SAML response: ${_.status}`);p=await _.text()}return e.encode===!1?p:btoa(p)}const hd=["sub","iss","aud","exp","nbf","iat","jti"];async function Zc(n,e){var m,b;const{authParams:t,user:i,client:r,session_id:s}=e,c=(await n.env.data.keys.list()).filter(S=>!S.revoked_at||new Date(S.revoked_at)>new Date),l=c[c.length-1];if(!(l!=null&&l.pkcs7))throw new j(500,{message:"No signing key available"});const u=Nm(l.pkcs7),p={aud:t.audience||"default",scope:t.scope||"",sub:(i==null?void 0:i.user_id)||t.client_id,iss:n.env.ISSUER,tenant_id:n.var.tenant_id,sid:s},g=i&&((m=t.scope)!=null&&m.split(" ").includes("openid"))?{aud:t.client_id,sub:i.user_id,iss:n.env.ISSUER,sid:s,nonce:t.nonce,given_name:i.given_name,family_name:i.family_name,nickname:i.nickname,picture:i.picture,locale:i.locale,name:i.name,email:i.email,email_verified:i.email_verified}:void 0;(b=n.env.hooks)!=null&&b.onExecuteCredentialsExchange&&await n.env.hooks.onExecuteCredentialsExchange({client:r,user:i,scope:t.scope||"",grant_type:""},{accessToken:{setCustomClaim:(S,O)=>{if(hd.includes(S))throw new Error(`Cannot overwrite reserved claim '${S}'`);p[S]=O}},idToken:{setCustomClaim:(S,O)=>{if(hd.includes(S))throw new Error(`Cannot overwrite reserved claim '${S}'`);g&&(g[S]=O)}},access:{deny:S=>{throw new j(400,{message:`Access denied: ${S}`})}}});const _={includeIssuedTimestamp:!0,expiresIn:new Dc(1,"d"),headers:{kid:l.kid}},x=await cd("RS256",u,p,_),h=g?await cd("RS256",u,g,_):void 0;return{access_token:x,refresh_token:e.refresh_token,id_token:h,token_type:"Bearer",expires_in:86400}}async function iv(n,e){const{client:t,scope:i,audience:r=t.tenant.audience,session_id:s}=e;return await n.env.data.refreshTokens.create(t.tenant.id,{token:Me(),session_id:s,expires_at:new Date(Date.now()+Mc*1e3).toISOString(),used_at:new Date().toISOString(),scope:i,audience:r})}async function ah(n,e){const{user:t,client:i,scope:r,audience:s}=e,a=await n.env.data.sessions.create(i.tenant.id,{id:Me(),user_id:t.user_id,client_id:i.id,expires_at:new Date(Date.now()+Mc*1e3).toISOString(),used_at:new Date().toISOString(),device:{last_ip:n.req.header("x-real-ip")||"",initial_ip:n.req.header("x-real-ip")||"",last_user_agent:n.req.header("user-agent")||"",initial_user_agent:n.req.header("user-agent")||"",initial_asn:"",last_asn:""},clients:[i.id]}),c=r!=null&&r.split(" ").includes("offline_access")?await iv(n,{...e,session_id:a.id,scope:r,audience:s}):void 0;return{...a,refresh_token:c}}async function ei(n,e){var g;const{authParams:t,user:i,client:r}=e,s=be(n,{type:_e.SUCCESS_LOGIN,description:`Successful login for ${i.user_id}`,userId:i.user_id});_t(n,n.env.data.logs.create(r.tenant.id,s)),_t(n,n.env.data.users.update(r.tenant.id,i.user_id,{last_login:new Date().toISOString(),last_ip:n.req.header("x-real-ip")||"",login_count:i.login_count+1}));let a=e.refreshToken,c=e.sessionId;if(!c){const _=await ah(n,{user:i,client:r,scope:t.scope,audience:t.audience});c=_.id,a=(g=_.refresh_token)==null?void 0:g.token}if(e.authParams.response_mode===Vt.SAML_POST)return tv(n,e.client,e.authParams,i,c);const l=await Zc(n,{authParams:t,user:i,client:r,session_id:c,refresh_token:a}),u=new Headers({"set-cookie":Qf(r.tenant.id,c)});if(t.response_mode===Vt.WEB_MESSAGE)return n.json(l,{headers:u});if((t.response_type||Ut.CODE)===Ut.CODE){if(!e.loginSession)throw new j(500,{message:"Login session not found"});const _=await n.env.data.codes.create(r.tenant.id,{code_id:Me(),user_id:i.user_id,code_type:"authorization_code",login_id:e.loginSession.login_id,expires_at:new Date(Date.now()+q0*1e3).toISOString()});u.set("location",`${t.redirect_uri}?state=${e.authParams.state}&code=${_.code_id}`)}return new Response("Redirecting",{status:302,headers:u})}function rv(n){return async(e,t)=>{if(!t.email||!t.email_verified)return n.users.create(e,t);const i=await Fd({userAdapter:n.users,tenant_id:e,email:t.email});return i?(await n.users.create(e,{...t,linked_to:i.user_id}),i):n.users.create(e,t)}}async function ch(n,e,t){for await(const i of e)if(!(await fetch(i.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok){const s=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});await t.logs.create(n.var.tenant_id,s)}}function sv(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t);return await ch(n,r,{tenant_id:t,user:i,trigger_id:"post-user-registration"}),i}}function ov(n,e){return async(t,i)=>{const{hooks:r}=await e.hooks.list(t,{q:"trigger_id:pre-user-signup",page:0,per_page:100,include_totals:!1});await ch(n,r,{tenant_id:t,email:i,trigger_id:"pre-user-signup"})}}function av(n,e){return async(t,i)=>{let r=await rv(e)(t,i);return await sv(n,e)(t,r),r}}async function cv(n,e,t,i){if(e.disable_sign_ups&&!await Fd({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:i})){const s=be(n,{type:_e.FAILED_SIGNUP,description:"Public signup is disabled"});throw await n.env.data.logs.create(e.tenant.id,s),new j(400,{message:"Signups are disabled for this client"})}await ov(n,t)(n.var.tenant_id||"",i)}function lv(n,e){return{...e,users:{...e.users,create:av(n,e)}}}async function uv(n,e,t,i){if(!i.state)throw new j(400,{message:"State not found"});const r=e.connections.find(l=>l.name===t);if(!r){n.set("client_id",e.id);const l=be(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await n.env.data.logs.create(e.tenant.id,l),new j(403,{message:"Connection Not Found"})}let s=await n.env.data.logins.get(e.tenant.id,i.state);s||(s=await n.env.data.logins.create(e.tenant.id,{expires_at:new Date(Date.now()+es*1e3).toISOString(),authParams:i,...Hn(n.req)}));const c=await Zf(n,r.strategy).getRedirect(n,r);return await n.env.data.codes.create(e.tenant.id,{login_id:s.login_id,code_id:c.code,code_type:"oauth2_state",connection_id:r.id,code_verifier:c.codeVerifier,expires_at:new Date(Date.now()+F0*1e3).toISOString()}),n.redirect(c.redirectUrl)}async function gd(n,{code:e,state:t}){var h;const{env:i}=n,r=await i.data.codes.get(n.var.tenant_id||"",t,"oauth2_state");if(!r||!r.connection_id)throw new j(403,{message:"State not found"});const s=await i.data.logins.get(n.var.tenant_id||"",r.login_id);if(!s)throw new j(403,{message:"Session not found"});const a=await Fc(i,s.authParams.client_id);n.set("client_id",a.id),n.set("tenant_id",a.tenant.id);const c=a.connections.find(m=>m.id===r.connection_id);if(!c){const m=be(n,{type:_e.FAILED_LOGIN,description:"Connection not found"});throw await i.data.logs.create(a.tenant.id,m),new j(403,{message:"Connection not found"})}if(n.set("connection",c.name),!s.authParams.redirect_uri){const m=be(n,{type:_e.FAILED_LOGIN,description:"Redirect URI not defined"});throw await i.data.logs.create(a.tenant.id,m),new j(403,{message:"Redirect URI not defined"})}if(!Xs(s.authParams.redirect_uri,a.callbacks||[],{allowPathWildcards:!0})){const m=`Invalid redirect URI - ${s.authParams.redirect_uri}`,b=be(n,{type:_e.FAILED_LOGIN,description:m});throw await i.data.logs.create(a.tenant.id,b),new j(403,{message:m})}const u=await Zf(n,c.strategy).validateAuthorizationCodeAndGetUser(n,c,e,r.code_verifier),{sub:p,...g}=u;n.set("user_id",p);const _=((h=u.email)==null?void 0:h.toLocaleLowerCase())||`${c.name}.${p}@${new URL(n.env.ISSUER).hostname}`;n.set("username",_);let x=await as({userAdapter:i.data.users,tenant_id:a.tenant.id,email:_,provider:c.name});if(!x){try{await cv(n,a,n.env.data,_)}catch(m){const b=m;throw new j(500,{message:`Failed to run preUserSignupHook: ${b.message}`})}x=await i.data.users.create(a.tenant.id,{user_id:`${c.name}|${p}`,email:_,name:_,provider:c.name,connection:c.name,email_verified:!0,last_ip:"",is_social:!0,last_login:new Date().toISOString(),profileData:JSON.stringify(g)}),n.set("user_id",x.user_id)}return ei(n,{client:a,authParams:s.authParams,loginSession:s,user:x})}async function _d(n,e,t,i,r,s){const a=await n.env.data.codes.get(n.var.tenant_id||"",e,"oauth2_state");if(!a)throw new j(400,{message:"State not found"});const c=await n.env.data.logins.get(n.var.tenant_id,a.login_id);if(!c)throw new j(400,{message:"Login not found"});const{redirect_uri:l}=c.authParams;if(!l)throw new j(400,{message:"Redirect uri not found"});const u=be(n,{type:_e.FAILED_LOGIN,description:`Failed connection login: ${r} ${t}, ${i}`});_t(n,n.env.data.logs.create(n.var.tenant_id,u));const p=new URL(l);return H0(p,{error:t,error_description:i,error_reason:s,error_code:r,state:c.authParams.state}),n.redirect(`${vt(n.env)}enter-email?state=${c.login_id}&error=${t}`)}const dv=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:a}=n.req.valid("query");if(i)return _d(n,e,i,r,s,a);if(!t)throw new j(400,{message:"Code is required"});return gd(n,{code:t,state:e})}).openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:o.z.object({state:o.z.string(),code:o.z.string().optional(),scope:o.z.string().optional(),hd:o.z.string().optional(),error:o.z.string().optional(),error_description:o.z.string().optional(),error_code:o.z.string().optional(),error_reason:o.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{state:e,code:t,error:i,error_description:r,error_code:s,error_reason:a}=n.req.valid("form");if(i)return _d(n,e,i,r,s,a);if(!t)throw new j(400,{message:"Code is required"});return gd(n,{code:t,state:e})}),pv=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),returnTo:o.z.string().optional()}),header:o.z.object({cookie:o.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async n=>{const{client_id:e,returnTo:t}=n.req.valid("query"),i=await n.env.data.clients.get(e);if(!i)return n.text("OK");const r=await n.env.data.clients.get("DEFAULT_CLIENT");n.set("client_id",e),n.set("tenant_id",i.tenant.id);const s=t||n.req.header("referer");if(!s)return n.text("OK");if(!Xs(s,[...i.allowed_logout_urls||[],...(r==null?void 0:r.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new j(400,{message:"Invalid redirect uri"});const a=n.req.header("cookie");if(a){const l=Xf(i.tenant.id,a);if(l){const u=await n.env.data.sessions.get(i.tenant.id,l);if(u){const p=await n.env.data.users.get(i.tenant.id,u.user_id);p&&(n.set("user_id",p.user_id),n.set("connection",p.connection))}await n.env.data.sessions.remove(i.tenant.id,l)}}const c=be(n,{type:_e.SUCCESS_LOGOUT,description:"User successfully logged out"});return await n.env.data.logs.create(i.tenant.id,c),new Response("Redirecting",{status:302,headers:{"set-cookie":Tm(i.tenant.id),location:s}})}),md=o.z.object({sub:o.z.string(),email:o.z.string().optional(),family_name:o.z.string().optional(),given_name:o.z.string().optional(),email_verified:o.z.boolean()}),fv=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:md}},description:"Userinfo"}}}),async n=>{if(!n.var.user)throw new j(404,{message:"User not found"});const e=await n.env.data.users.get(n.var.user.tenant_id,n.var.user.sub);if(!e)throw new j(404,{message:"User not found"});return n.json(md.parse({...e,sub:e.user_id}))}),hv=new o.OpenAPIHono().openapi(o.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:Cd}},description:"List of tenants"}}}),async n=>{const e=await n.env.data.keys.list(),t=await Promise.all(e.map(async i=>{const s=await new Vc(i.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",s);return Ga.parse({...a,kid:i.kid})}));return n.json({keys:t},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${er}, stale-while-revalidate=${er*2}, stale-if-error=86400`}})}).openapi(o.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:ko}},description:"List of tenants"}}}),async n=>{const e=ko.parse({issuer:ym(n.env),authorization_endpoint:`${Ie(n.env)}authorize`,token_endpoint:`${Ie(n.env)}oauth/token`,device_authorization_endpoint:`${Ie(n.env)}oauth/device/code`,userinfo_endpoint:`${Ie(n.env)}userinfo`,mfa_challenge_endpoint:`${Ie(n.env)}mfa/challenge`,jwks_uri:`${Ie(n.env)}.well-known/jwks.json`,registration_endpoint:`${Ie(n.env)}oidc/register`,revocation_endpoint:`${Ie(n.env)}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return n.json(e,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${er}, stale-while-revalidate=${er*2}, stale-if-error=86400`}})});function cr(n,e){if(!n||!e||n.length!==e.length)return!1;let t=0;for(let i=0;i<n.length;i++)t|=n.charCodeAt(i)^e.charCodeAt(i);return t===0}const lh=o.z.object({grant_type:o.z.literal("client_credentials"),scope:o.z.string().optional(),client_secret:o.z.string(),client_id:o.z.string(),audience:o.z.string().optional()});async function gv(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new j(403,{message:"Invalid client credentials"});if(t.client_secret&&!cr(t.client_secret,e.client_secret))throw new j(403,{message:"Invalid client credentials"});const i={client_id:t.id,scope:e.scope,audience:e.audience},r=await Zc(n,{authParams:i,client:t});return n.json(r)}const _v=o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string().optional(),client_secret:o.z.string().optional(),code_verifier:o.z.string().optional()}).refine(n=>"client_secret"in n&&!("code_verifier"in n)||!("client_secret"in n)&&"code_verifier"in n,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function mv(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new j(403,{message:"Client not found"});const i=await n.env.data.codes.get(t.tenant.id,e.code,"authorization_code");if(!i||!i.user_id)throw new j(403,{message:"Invalid client credentials"});if(new Date(i.expires_at)<new Date)throw new j(403,{message:"Code expired"});if(i.used_at)throw new j(403,{message:"Code already used"});const r=await n.env.data.logins.get(t.tenant.id,i.login_id);if(!r)throw new j(403,{message:"Invalid login"});if("client_secret"in e){const a=await n.env.data.clients.get("DEFAULT_CLIENT");if(!cr(t.client_secret,e.client_secret)&&!cr(a==null?void 0:a.client_secret,e.client_secret))throw new j(403,{message:"Invalid client credentials"})}else if("code_verifier"in e&&typeof e.code_verifier=="string"&&"code_challenge_method"in r.authParams&&typeof r.authParams.code_challenge_method=="string"){const a=await Om(e.code_verifier,r.authParams.code_challenge_method);if(!cr(a,r.authParams.code_challenge||""))throw new j(403,{message:"Invalid client credentials"})}if(r.authParams.redirect_uri&&r.authParams.redirect_uri!==e.redirect_uri)throw new j(403,{message:"Invalid redirect uri"});const s=await n.env.data.users.get(t.tenant.id,i.user_id);if(!s)throw new j(403,{message:"User not found"});return await n.env.data.codes.used(t.tenant.id,e.code),ei(n,{user:s,client:t,loginSession:r,authParams:{...r.authParams,response_mode:Vt.WEB_MESSAGE}})}const yv=o.z.object({grant_type:o.z.literal("refresh_token"),client_id:o.z.string(),redirect_uri:o.z.string().optional(),refresh_token:o.z.string()});async function vv(n,e){const t=await n.env.data.clients.get(e.client_id);if(!t)throw new j(403,{message:"Client not found"});const i=await n.env.data.refreshTokens.get(t.tenant.id,e.refresh_token);if(i){if(new Date(i.expires_at)<new Date)throw new j(403,{message:"Refresh token expired"})}else throw new j(403,{message:"Invalid refresh token"});const r=await n.env.data.sessions.get(t.tenant.id,i.session_id);if(!r)throw new j(403,{message:"Session not found"});const s=await n.env.data.users.get(t.tenant.id,r.user_id);if(!s)throw new j(403,{message:"User not found"});return ei(n,{user:s,client:t,refreshToken:i.token,sessionId:r.session_id,authParams:{client_id:t.id,audience:i.audience,scope:i.scope,response_mode:Vt.WEB_MESSAGE}})}const yd=o.z.object({client_id:o.z.string().optional(),client_secret:o.z.string().optional()}),wv=o.z.union([lh.extend(yd.shape),o.z.object({grant_type:o.z.literal("authorization_code"),client_id:o.z.string(),code:o.z.string(),redirect_uri:o.z.string(),code_verifier:o.z.string().min(43).max(128)}),o.z.object({grant_type:o.z.literal("authorization_code"),code:o.z.string(),redirect_uri:o.z.string().optional(),...yd.shape}),o.z.object({grant_type:o.z.literal("refresh_token"),client_id:o.z.string(),refresh_token:o.z.string(),redirect_uri:o.z.string().optional()})]);function bv(n){if(!n)return{};const[e,t]=n.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&t){const[i,r]=atob(t).split(":");return{client_id:i,client_secret:r}}return{}}const kv=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:wv}}}},responses:{200:{content:{"application/json":{schema:Td}},description:"Tokens"}}}),async n=>{const e=n.req.valid("form"),t=bv(n.req.header("Authorization")),i={...e,...t};if(!i.client_id)throw new j(400,{message:"client_id is required"});switch(e.grant_type){case ci.AuthorizationCode:return mv(n,_v.parse(i));case ci.ClientCredential:return gv(n,lh.parse(i));case ci.RefreshToken:return vv(n,yv.parse(i));default:throw new j(400,{message:"Not implemented"})}});var Yc={exports:{}};const Xc=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],uh=(n,e=Xc,t="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let i=n||"";e[0].minDiversity=0,e[0].minLength=0;const r=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];t&&r.push({regex:`[${t}]`,message:"symbol"});let s={};s.contains=r.filter(c=>new RegExp(`${c.regex}`).test(i)).map(c=>c.message),s.length=i.length;let a=e.filter(c=>s.contains.length>=c.minDiversity).filter(c=>s.length>=c.minLength).sort((c,l)=>l.id-c.id).map(c=>({id:c.id,value:c.value}));return Object.assign(s,a[0]),s};Yc.exports={passwordStrength:uh,defaultOptions:Xc};var xv=Yc.exports.passwordStrength=uh;Yc.exports.defaultOptions=Xc;function Sv(n){return xv(n).id<2?!1:n.length>=8&&/[a-z]/.test(n)&&/[A-Z]/.test(n)&&/[0-9]/.test(n)&&/[^A-Za-z0-9]/.test(n)}async function eo(n,e){var r;const t=await n.env.data.emailProviders.get(n.var.tenant_id)||(n.env.DEFAULT_TENANT_ID?await n.env.data.emailProviders.get(n.env.DEFAULT_TENANT_ID):null);if(!t)throw new j(500,{message:"Email provider not found"});const i=(r=n.env.emailProviders)==null?void 0:r[t.name];if(!i)throw new j(500,{message:"Email provider not found"});await i({emailProvider:t,...e,from:t.default_from_address||`login@${n.env.ISSUER}`})}async function Av(n,e,t,i){const r=await n.env.data.tenants.get(n.var.tenant_id);if(!r)throw new j(500,{message:"Tenant not found"});const s=`${vt(n.env)}reset-password?state=${i}&code=${t}`,a={vendorName:r.name,lng:r.language||"en"};await eo(n,{to:e,subject:"Reset your password",html:`Click here to reset your password: ${vt(n.env)}reset-password?state=${i}&code=${t}`,template:"auth-password-reset",data:{vendorName:r.name,logo:r.logo||"",passwordResetUrl:s,supportUrl:r.support_url||"https://support.sesamy.com",buttonColor:r.primary_color||"#7d68f4",passwordResetTitle:ue("password_reset_title",a),resetPasswordEmailClickToReset:ue("reset_password_email_click_to_reset",a),resetPasswordEmailReset:ue("reset_password_email_reset",a),supportInfo:ue("support_info",a),contactUs:ue("contact_us",a),copyright:ue("copyright",a)}})}async function Iv(n,e,t){const i=await n.env.data.tenants.get(n.var.tenant_id);if(!i)throw new j(500,{message:"Tenant not found"});const r={vendorName:i.name,code:t,lng:i.language||"en"};await eo(n,{to:e,subject:ue("code_email_subject",r),html:`Click here to validate your email: ${vt(n.env)}validate-email`,template:"auth-link",data:{code:t,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:`${Ie(n.env)}passwordless/verify_redirect?ticket=${t}`,buttonColor:i.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",r),linkEmailClickToLogin:ue("link_email_click_to_login",r),linkEmailLogin:ue("link_email_login",r),linkEmailOrEnterCode:ue("link_email_or_enter_code",r),codeValid30Mins:ue("code_valid_30_minutes",r),supportInfo:ue("support_info",r),contactUs:ue("contact_us",r),copyright:ue("copyright",r)}});const s=be(n,{type:_e.CODE_LINK_SENT,description:e});_t(n,n.env.data.logs.create(i.id,s))}async function dh(n,e,t){const i=await n.env.data.tenants.get(n.var.tenant_id);if(!i)throw new j(500,{message:"Tenant not found"});const r={vendorName:i.name,code:t,lng:i.language||"en"};await eo(n,{to:e,subject:ue("code_email_subject",r),html:`Click here to validate your email: ${vt(n.env)}validate-email`,template:"auth-link",data:{code:t,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:`${Ie(n.env)}passwordless/verify_redirect?ticket=${t}`,buttonColor:i.primary_color||"",welcomeToYourAccount:ue("welcome_to_your_account",r),linkEmailClickToLogin:ue("link_email_click_to_login",r),linkEmailLogin:ue("link_email_login",r),linkEmailOrEnterCode:ue("link_email_or_enter_code",r),codeValid30Mins:ue("code_valid_30_minutes",r),supportInfo:ue("support_info",r),contactUs:ue("contact_us",r),copyright:ue("copyright",r)}});const s=be(n,{type:_e.CODE_LINK_SENT,description:e});_t(n,n.env.data.logs.create(i.id,s))}async function ph(n,e){const t=await n.env.data.tenants.get(n.var.tenant_id);if(!t)throw new j(500,{message:"Tenant not found"});const i={vendorName:t.name,lng:t.language||"en"};await eo(n,{to:e.email,subject:"Validate your email address",html:`Click here to validate your email: ${vt(n.env)}validate-email`,template:"auth-verify-email",data:{vendorName:t.name,logo:t.logo||"",emailValidationUrl:`${vt(n.env)}validate-email`,supportUrl:t.support_url||"https://support.sesamy.com",buttonColor:t.primary_color||"#7d68f4",welcomeToYourAccount:ue("welcome_to_your_account",i),verifyEmailVerify:ue("verify_email_verify",i),supportInfo:ue("support_info",i),contactUs:ue("contact_us",i),copyright:ue("copyright",i)}})}const Ev=new o.OpenAPIHono().openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.z.string().transform(n=>n.toLowerCase()),password:o.z.string()})}}}},responses:{200:{content:{"application/json":{schema:o.z.object({_id:o.z.string(),email:o.z.string(),email_verified:o.z.boolean(),app_metadata:o.z.object({}),user_metadata:o.z.object({})})}},description:"Created user"}}}),async n=>{const{email:e,password:t,client_id:i}=n.req.valid("json"),r=await n.env.data.clients.get(i);if(!r)throw new j(400,{message:"Client not found"});if(n.set("client_id",r.id),n.set("tenant_id",r.tenant.id),!Sv(t))throw new j(400,{message:"Password does not meet the requirements"});if(await as({userAdapter:n.env.data.users,tenant_id:r.tenant.id,email:e,provider:"auth2"}))throw new j(400,{message:"Invalid sign up"});const a=await n.env.data.users.create(r.tenant.id,{user_id:`auth2|${Za()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});n.set("user_id",a.user_id),n.set("username",a.email),n.set("connection",a.connection);const c=await Ja.hash(t,10);await n.env.data.passwords.create(r.tenant.id,{user_id:a.user_id,password:c,algorithm:"bcrypt"}),await ph(n,a);const l=be(n,{type:_e.SUCCESS_SIGNUP,description:"Successful signup"});return await n.env.data.logs.create(r.tenant.id,l),n.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(o.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.literal("Username-Password-Authentication"),email:o.z.string().transform(n=>n.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{email:e,client_id:t}=n.req.valid("json"),i=await n.env.data.clients.get(t);if(!i)throw new j(400,{message:"Client not found"});if(n.set("client_id",i.id),n.set("tenant_id",i.tenant.id),!await Ya({userAdapter:n.env.data.users,tenant_id:i.tenant.id,email:e,provider:"auth2"}))return n.html("If an account with that email exists, we've sent instructions to reset your password.");const s={client_id:t,username:e},a=await n.env.data.logins.create(i.tenant.id,{expires_at:new Date(Date.now()+es*1e3).toISOString(),authParams:s,...Hn(n.req)});return await Av(n,e,a.login_id,a.authParams.state),n.html("If an account with that email exists, we've sent instructions to reset your password.")});function fh(){const n="1234567890";let e="";for(let t=0;t<6;t+=1)e+=n[Math.floor(Math.random()*10)];return e.toString()}const zv=new o.OpenAPIHono().openapi(o.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:o.z.object({client_id:o.z.string(),connection:o.z.string(),email:o.z.string().transform(n=>n.toLowerCase()),send:o.z.enum(["link","code"]),authParams:Wa.omit({client_id:!0})})}}}},responses:{200:{description:"Status"}}}),async n=>{const e=n.req.valid("json"),{env:t}=n,{client_id:i,email:r,send:s,authParams:a}=e,c=await n.env.data.clients.get(i);if(!c)throw new j(400,{message:"Client not found"});n.set("client_id",c.id),n.set("tenant_id",c.tenant.id);const l=await t.data.logins.create(c.tenant.id,{authParams:{...a,client_id:i,username:r},expires_at:new Date(Date.now()+Qu).toISOString(),...Hn(n.req)}),u=await t.data.codes.create(c.tenant.id,{code_id:fh(),code_type:"otp",login_id:l.login_id,expires_at:new Date(Date.now()+Qu).toISOString()});return s==="link"?await dh(n,r,u.code_id):await Iv(n,r,u.code_id),n.html("OK")}).openapi(o.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:o.z.object({scope:o.z.string(),response_type:o.z.nativeEnum(Ut),redirect_uri:o.z.string(),state:o.z.string(),nonce:o.z.string().optional(),verification_code:o.z.string(),connection:o.z.string(),client_id:o.z.string(),email:o.z.string().transform(n=>n.toLowerCase()),audience:o.z.string().optional()})},responses:{302:{description:"Status"}}}),async n=>{const{env:e}=n,{client_id:t,email:i,verification_code:r,redirect_uri:s,state:a,scope:c,audience:l,response_type:u,nonce:p}=n.req.valid("query"),g=await Fc(e,t);n.set("client_id",g.id),n.set("tenant_id",g.tenant.id),n.set("connection","email");const _=await e.data.codes.get(g.tenant.id,r,"otp");if(!_)throw new j(400,{message:"Code not found or expired"});if(_.expires_at<new Date().toISOString())throw new j(400,{message:"Code expired"});const x=await e.data.logins.get(g.tenant.id,_.login_id);if(!x||x.authParams.username!==i)throw new j(400,{message:"Code not found or expired"});const h=Hn(n.req);if(x.ip!==h.ip)return n.redirect(`${vt(n.env)}invalid-session?state=${x.login_id}`);if(!Xs(s,g.callbacks,{allowPathWildcards:!0}))throw new j(400,{message:`Invalid redirect URI - ${s}`});const m={client_id:t,redirect_uri:s,state:a,nonce:p,scope:c,audience:l,response_type:u},b=await as({userAdapter:e.data.users,tenant_id:g.tenant.id,email:i,provider:"email"});if(!b)throw new j(400,{message:"User not found"});return ei(n,{user:b,client:g,loginSession:x,authParams:m})});class oi extends j{constructor(t,i){super(t,i);te(this,"_code");this._code=i==null?void 0:i.code}get code(){return this._code}}async function $v(n,e,t){const{env:i}=n,r=t.username;if(n.set("username",r),!r)throw new j(400,{message:"Username is required"});const s=await Ya({userAdapter:n.env.data.users,tenant_id:e.tenant.id,email:r,provider:"auth2"});if(!s){const _=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw _t(n,n.env.data.logs.create(e.tenant.id,_)),new oi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const a=s.linked_to?await i.data.users.get(e.tenant.id,s.linked_to):s;if(!a)throw new oi(403,{message:"User not found",code:"USER_NOT_FOUND"});n.set("connection",s.connection),n.set("user_id",a.user_id);const{password:c}=await i.data.passwords.get(e.tenant.id,s.user_id);if(!await Ja.compare(t.password,c)){const _=be(n,{type:_e.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw _t(n,n.env.data.logs.create(e.tenant.id,_)),new oi(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.data.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${a.user_id}`})).logs.filter(_=>_.type===_e.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date(_.date)>new Date(Date.now()-1e3*60*5)).length>=3){const _=be(n,{type:_e.FAILED_LOGIN,description:"Too many failed login attempts"});throw _t(n,n.env.data.logs.create(e.tenant.id,_)),new oi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!s.email_verified&&e.email_validation==="enforced"){await ph(n,s);const _=be(n,{type:_e.FAILED_LOGIN,description:"Email not verified"});throw await n.env.data.logs.create(e.tenant.id,_),new oi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}const g=be(n,{type:_e.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return _t(n,n.env.data.logs.create(e.tenant.id,g)),a}function Cv(){const n=new Uint8Array(32);return crypto.getRandomValues(n),sn.encode(n,{includePadding:!1})}function vd(){return new j(403,{res:new Response(JSON.stringify({error:"access_denied",error_description:"Wrong email or verification code."}),{status:403,headers:{"Content-Type":"application/json"}}),message:"Wrong email or verification code."})}const wd=30*60*1e3,jv=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:o.z.union([o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:o.z.string(),client_id:o.z.string(),username:o.z.string().transform(n=>n.toLowerCase()),realm:o.z.enum(["email"]),scope:o.z.string().optional()}),o.z.object({credential_type:o.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:o.z.string(),username:o.z.string().transform(n=>n.toLowerCase()),password:o.z.string(),realm:o.z.enum(["Username-Password-Authentication"]),scope:o.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async n=>{const e=n.req.valid("json"),{client_id:t,username:i}=e;n.set("username",i);const r=await n.env.data.clients.get(t);if(!r)throw new j(400,{message:"Client not found"});n.set("client_id",t),n.set("tenant_id",r.tenant.id);const s=i.toLocaleLowerCase();let a;if("otp"in e){const p=await n.env.data.codes.get(r.tenant.id,e.otp,"otp");if(!p)throw vd();const g=await n.env.data.logins.get(r.tenant.id,p.login_id);if(!g||g.authParams.username!==s)throw vd();a=g}else if("password"in e)await $v(n,r,{username:i,password:e.password,client_id:t}),a=await n.env.data.logins.create(r.tenant.id,{expires_at:new Date(Date.now()+wd).toISOString(),authParams:{client_id:r.id,username:s},...Hn(n.req)});else throw new j(400,{message:"Code or password required"});const c=Cv(),l=Me(12),u=await n.env.data.codes.create(r.tenant.id,{code_id:Me(),code_type:"ticket",login_id:a.login_id,expires_at:new Date(Date.now()+wd).toISOString(),code_verifier:[l,c].join("|")});return n.json({login_ticket:u.code_id,co_verifier:c,co_id:l})});function Nv(n,e){var i,r,s;if(!n||e.length===0)return!1;const t=((i=vo(n))==null?void 0:i.host)??null;if(!t)return!1;for(const a of e){let c;if(a.startsWith("http://")||a.startsWith("https://")?c=((r=vo(a))==null?void 0:r.host)??null:c=((s=vo("https://"+a))==null?void 0:s.host)??null,t===c)return!0}return!1}function vo(n){try{return new URL(n)}catch{return null}}async function Ov({ctx:n,session:e,client:t,authParams:i,connection:r,login_hint:s}){const a=await n.env.data.logins.create(t.tenant.id,{expires_at:new Date(Date.now()+es*1e3).toISOString(),authParams:i,...Hn(n.req)});if(e&&s){const c=await n.env.data.users.get(t.tenant.id,e.user_id);if((c==null?void 0:c.email)===s)return ei(n,{client:t,loginSession:a,authParams:i,user:c,sessionId:e.session_id})}if(r==="email"&&s){const c=fh();return await n.env.data.codes.create(t.tenant.id,{code_id:c,code_type:"otp",login_id:a.login_id,expires_at:new Date(Date.now()+es*1e3).toISOString()}),await dh(n,s,c),n.redirect(`/u/enter-code?state=${a.login_id}`)}return e?n.redirect(`/u/check-account?state=${a.login_id}`):n.redirect(`/u/enter-email?state=${a.login_id}`)}function Bv(n){if(n==="Username-Password-Authentication")return"auth2";if(n==="email")return"email";throw new j(403,{message:"Invalid realm"})}async function Tv(n,e,t,i,r){var _;const{env:s}=n;n.set("connection",r);const a=await s.data.codes.get(e,t,"ticket");if(!a||a.used_at)throw new j(403,{message:"Ticket not found"});const c=await s.data.logins.get(e,a.login_id);if(!c||!c.authParams.username)throw new j(403,{message:"Session not found"});const l=await s.data.clients.get(c.authParams.client_id);if(!l)throw new j(403,{message:"Client not found"});n.set("client_id",c.authParams.client_id),await s.data.codes.used(e,t);const u=Bv(r);let p=await as({userAdapter:s.data.users,tenant_id:e,email:c.authParams.username,provider:u});p||(p=await s.data.users.create(e,{user_id:`email|${Za()}`,email:c.authParams.username,name:c.authParams.username,provider:"email",connection:"email",email_verified:!0,is_social:!1,last_ip:"",last_login:new Date().toISOString()})),n.set("username",p.email),n.set("user_id",p.user_id);const g=await ah(n,{user:p,client:l,scope:i.scope,audience:i.audience});return ei(n,{authParams:{scope:(_=c.authParams)==null?void 0:_.scope,...i},loginSession:c,sessionId:g.id,user:p,client:l})}async function bd(n,e){return`<!DOCTYPE html>
150
150
  <html>
151
151
 
152
152
  <head>
@@ -189,32 +189,32 @@ PERFORMANCE OF THIS SOFTWARE.
189
189
  <\/script>
190
190
  </body>
191
191
 
192
- </html>`}async function Ov({ctx:n,client:e,session:t,redirect_uri:i,state:r,nonce:s,code_challenge_method:o,code_challenge:c,audience:l,scope:u}){const{env:p}=n,g=new URL(i);if(t){n.set("user_id",t.user_id);const x=new Headers,h=Qf(e.tenant.id,t.session_id);x.set("set-cookie",h);const m=await p.data.users.get(e.tenant.id,t.user_id);if(m){n.set("username",m.email),n.set("connection",m.connection);const b=await Zc(n,{client:e,authParams:{client_id:e.id,audience:l,code_challenge_method:o,code_challenge:c,scope:u,state:r,nonce:s,response_type:Ut.TOKEN_ID_TOKEN},user:m,session_id:t.session_id});await p.data.sessions.update(e.tenant.id,t.session_id,{used_at:new Date().toISOString()});const S=be(n,{type:_e.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});return await n.env.data.logs.create(e.tenant.id,S),n.html(bd(`${g.protocol}//${g.host}`,JSON.stringify(b)),{headers:x})}}const _=be(n,{type:_e.FAILED_SILENT_AUTH,description:"Login required"});return await n.env.data.logs.create(e.tenant.id,_),n.html(bd(`${g.protocol}//${g.host}`,JSON.stringify({error:"login_required",error_description:"Login required",state:r})))}const Bv=new a.OpenAPIHono().openapi(a.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:a.z.object({client_id:a.z.string(),vendor_id:a.z.string().optional(),redirect_uri:a.z.string(),scope:a.z.string().optional(),state:a.z.string(),prompt:a.z.string().optional(),response_mode:a.z.nativeEnum(Vt).optional(),response_type:a.z.nativeEnum(Ut).optional(),audience:a.z.string().optional(),connection:a.z.string().optional(),nonce:a.z.string().optional(),max_age:a.z.string().optional(),login_ticket:a.z.string().optional(),code_challenge_method:a.z.nativeEnum(ss).optional(),code_challenge:a.z.string().optional(),realm:a.z.string().optional(),auth0Client:a.z.string().optional(),login_hint:a.z.string().optional(),ui_locales:a.z.string().optional()})},responses:{200:{description:"Silent authentication page"},302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{env:e}=n,{client_id:t,vendor_id:i,redirect_uri:r,scope:s,state:o,audience:c,nonce:l,connection:u,response_type:p,response_mode:g,code_challenge:_,code_challenge_method:x,prompt:h,login_ticket:m,realm:b,auth0Client:S,login_hint:O,ui_locales:T}=n.req.valid("query");n.set("log","authorize");const q=await qc(e,t);n.set("client_id",q.id),n.set("tenant_id",q.tenant.id);const oe={redirect_uri:r,scope:s,state:o,client_id:t,vendor_id:i,audience:c,nonce:l,prompt:h,response_type:p,response_mode:g,code_challenge:_,code_challenge_method:x,username:O,ui_locales:T},pe=n.req.header("origin");if(pe&&!Cv(pe,q.web_origins||[]))throw new j(403,{message:`Origin ${pe} not allowed`});if(oe.redirect_uri&&!Ys(oe.redirect_uri,q.callbacks||[],{allowPathWildcards:!0}))throw new j(400,{message:`Invalid redirect URI - ${oe.redirect_uri}`});const ce=Xf(q.tenant.id,n.req.header("cookie")),Re=ce?await e.data.sessions.get(q.tenant.id,ce):void 0;if(h=="none"){if(!p)throw new j(400,{message:"Missing response_type"});return Ov({ctx:n,session:Re||void 0,redirect_uri:r,state:o,response_type:p,client:q,nonce:l,code_challenge_method:x,code_challenge:_,audience:c,scope:s})}return u&&u!=="email"?av(n,q,u,oe):m?Nv(n,q.tenant.id,m,oe,b):zv({ctx:n,client:q,auth0Client:S,authParams:oe,session:Re||void 0,connection:u,login_hint:O})});function Tv(){const n=new a.OpenAPIHono;n.use(Mf(n));const e=n.route("/v2/logout",lv).route("/userinfo",uv).route("/.well-known",dv).route("/oauth/token",vv).route("/dbconnections",Sv).route("/passwordless",Av).route("/co/authenticate",$v).route("/authorize",Bv).route("/callback",cv);return e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"}}),Vf(e),e}function Rv(){const e=new a.OpenAPIHono;return e.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),e}const Pv="Account detected",Lv="We have detected that you have already created an account through",Uv="By signing in, you agree to our",Vv="and",Mv="Callback URL mismatch",Hv="The provided redirect_uri is not in the list of allowed callback URLs.",Dv="continue with user",Fv="Please click the button to create a new password account.",qv="Enter the code at {{vendorName}} to complete the login",Kv="Welcome to {{vendorName}}! {{code}} is the login code",Wv="Welcome to {{vendorName}}! {{code}} is the login code",Gv="The code is valid for 30 minutes",Jv="Confirm password",Zv="Need Help?",Yv="Contact us",Xv="or continue with social account",Qv="Continue with {{provider}}",ew="Would you like to continue with your existing account?",tw="Copyright © 2023 SESAMY. All rights reserved.",nw="©2023 Sesamy",iw="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",rw="Please enter a valid email address.",sw="The passwords didn't match. Try again.",ow="Choose password",aw="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",cw="Create new account",lw="Sign up with password",uw="You are currently logged in as <0>{{email}}</0>",dw="Email",pw="Email address",fw="Your email address has been validated",hw="Now enter your password to login again",gw="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",_w="Email verification sent",mw="Enter a code",yw="We'll send you a verification link to ensure you own this email address.",vw="Enter new password",ww="Enter password",bw="Enter your email address and password to login.",kw="Enter your password",xw="The magic link has expired. Please click on the button below to receive a new link in your inbox.",Sw="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",Aw="Send password reset email",Iw="Click the button below and we’ll send instructions on how to reset your password.",Ew="Password reset email sent",$w="Forgot password?",Cw="Forgot password?",zw="Go back",jw="Invalid password",Nw=`The link is no longer valid.
192
+ </html>`}async function Rv({ctx:n,client:e,session:t,redirect_uri:i,state:r,nonce:s,code_challenge_method:a,code_challenge:c,audience:l,scope:u}){const{env:p}=n,g=new URL(i);if(t){n.set("user_id",t.user_id);const x=new Headers,h=Qf(e.tenant.id,t.id);x.set("set-cookie",h);const m=await p.data.users.get(e.tenant.id,t.user_id);if(m){n.set("username",m.email),n.set("connection",m.connection);const b=await Zc(n,{client:e,authParams:{client_id:e.id,audience:l,code_challenge_method:a,code_challenge:c,scope:u,state:r,nonce:s,response_type:Ut.TOKEN_ID_TOKEN},user:m,session_id:t.id});await p.data.sessions.update(e.tenant.id,t.id,{used_at:new Date().toISOString()});const S=be(n,{type:_e.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});return await n.env.data.logs.create(e.tenant.id,S),n.html(bd(`${g.protocol}//${g.host}`,JSON.stringify(b)),{headers:x})}}const _=be(n,{type:_e.FAILED_SILENT_AUTH,description:"Login required"});return await n.env.data.logs.create(e.tenant.id,_),n.html(bd(`${g.protocol}//${g.host}`,JSON.stringify({error:"login_required",error_description:"Login required",state:r})))}const Pv=new o.OpenAPIHono().openapi(o.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:o.z.object({client_id:o.z.string(),vendor_id:o.z.string().optional(),redirect_uri:o.z.string(),scope:o.z.string().optional(),state:o.z.string(),prompt:o.z.string().optional(),response_mode:o.z.nativeEnum(Vt).optional(),response_type:o.z.nativeEnum(Ut).optional(),audience:o.z.string().optional(),connection:o.z.string().optional(),nonce:o.z.string().optional(),max_age:o.z.string().optional(),login_ticket:o.z.string().optional(),code_challenge_method:o.z.nativeEnum(ss).optional(),code_challenge:o.z.string().optional(),realm:o.z.string().optional(),auth0Client:o.z.string().optional(),login_hint:o.z.string().optional(),ui_locales:o.z.string().optional()})},responses:{200:{description:"Silent authentication page"},302:{description:"Redirect to the client's redirect uri"}}}),async n=>{const{env:e}=n,{client_id:t,vendor_id:i,redirect_uri:r,scope:s,state:a,audience:c,nonce:l,connection:u,response_type:p,response_mode:g,code_challenge:_,code_challenge_method:x,prompt:h,login_ticket:m,realm:b,auth0Client:S,login_hint:O,ui_locales:T}=n.req.valid("query");n.set("log","authorize");const F=await Fc(e,t);n.set("client_id",F.id),n.set("tenant_id",F.tenant.id);const oe={redirect_uri:r,scope:s,state:a,client_id:t,vendor_id:i,audience:c,nonce:l,prompt:h,response_type:p,response_mode:g,code_challenge:_,code_challenge_method:x,username:O,ui_locales:T},pe=n.req.header("origin");if(pe&&!Nv(pe,F.web_origins||[]))throw new j(403,{message:`Origin ${pe} not allowed`});if(oe.redirect_uri&&!Xs(oe.redirect_uri,F.callbacks||[],{allowPathWildcards:!0}))throw new j(400,{message:`Invalid redirect URI - ${oe.redirect_uri}`});const ce=Xf(F.tenant.id,n.req.header("cookie")),Pe=ce?await e.data.sessions.get(F.tenant.id,ce):void 0;if(h=="none"){if(!p)throw new j(400,{message:"Missing response_type"});return Rv({ctx:n,session:Pe||void 0,redirect_uri:r,state:a,response_type:p,client:F,nonce:l,code_challenge_method:x,code_challenge:_,audience:c,scope:s})}return u&&u!=="email"?uv(n,F,u,oe):m?Tv(n,F.tenant.id,m,oe,b):Ov({ctx:n,client:F,auth0Client:S,authParams:oe,session:Pe||void 0,connection:u,login_hint:O})});function Lv(){const n=new o.OpenAPIHono;n.use(Mf(n));const e=n.route("/v2/logout",pv).route("/userinfo",fv).route("/.well-known",hv).route("/oauth/token",kv).route("/dbconnections",Ev).route("/passwordless",zv).route("/co/authenticate",jv).route("/authorize",Pv).route("/callback",dv);return e.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"}}),Vf(e),e}function Uv(){const e=new o.OpenAPIHono;return e.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),e}const Vv="Account detected",Mv="We have detected that you have already created an account through",Hv="By signing in, you agree to our",Dv="and",qv="Callback URL mismatch",Fv="The provided redirect_uri is not in the list of allowed callback URLs.",Kv="continue with user",Wv="Please click the button to create a new password account.",Gv="Enter the code at {{vendorName}} to complete the login",Jv="Welcome to {{vendorName}}! {{code}} is the login code",Zv="Welcome to {{vendorName}}! {{code}} is the login code",Yv="The code is valid for 30 minutes",Xv="Confirm password",Qv="Need Help?",ew="Contact us",tw="or continue with social account",nw="Continue with {{provider}}",iw="Would you like to continue with your existing account?",rw="Copyright © 2023 SESAMY. All rights reserved.",sw="©2023 Sesamy",ow="Choose a password with a mix of uppercase and lowercase letters, numbers, and symbols.",aw="Please enter a valid email address.",cw="The passwords didn't match. Try again.",lw="Choose password",uw="Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one number and one symbol.",dw="Create new account",pw="Sign up with password",fw="You are currently logged in as <0>{{email}}</0>",hw="Email",gw="Email address",_w="Your email address has been validated",mw="Now enter your password to login again",yw="An email has been sent to <0>{{email}}</0> with a verification link. Please click the link to verify your email address and set a password.",vw="Email verification sent",ww="Enter a code",bw="We'll send you a verification link to ensure you own this email address.",kw="Enter new password",xw="Enter password",Sw="Enter your email address and password to login.",Aw="Enter your password",Iw="The magic link has expired. Please click on the button below to receive a new link in your inbox.",Ew="Hey! We updated our login experience. <0>Click here to learn more about it.</0>",zw="Send password reset email",$w="Click the button below and we’ll send instructions on how to reset your password.",Cw="Password reset email sent",jw="Forgot password?",Nw="Forgot password?",Ow="Go back",Bw="Invalid password",Tw=`The link is no longer valid.
193
193
 
194
194
  Please make sure to open the login link in the same browser you started the login with.
195
195
 
196
- You can click the link below to start a new login.`,Ow="Invalid link",Bw="Click the button to log in",Tw="Login",Rw="Or enter the code at {{vendorName}} to complete the login.",Pw="Enter your email address to unlock this show on {{service}}",Lw="Link your account with {{service}}",Uw="You are logged in as",Vw="Login",Mw="Enter your email address to sign in.",Hw="Enter your email address and we will send you a login code.",Dw="Enter your email address and we will send you a login link.",Fw="Log out",qw="No, I want to use another account",Kw="or",Ww="Password",Gw="The password has been reset",Jw="Success",Zw="Change password for your {{vendorName}} account",Yw="Change password for your {{vendorName}} account",Xw="Privacy Policy",Qw="Redirecting",eb="Confirm password",tb="Register a new password",nb="Resend code",ib="Change password",rb="Enter your new password below for the email account: ",sb="Click the button to reset your password",ob="Click the button to reset your password",ab="Reset your password",cb="Change password for your {{vendorName}} account",lb="Reset password",ub="Send",db="Send me a new magic link",pb="Remember to check your spam folder if the email did not arrive.",fb="Set password",hb="Sign in",gb="Signup",_b="Sign up successful",mb="It appears that your Spotify account is currently linked to another Sesamy account. But fear not, we're here to guide you through the process to get this fixed.",yb="Go to Spotify's Content Access page",vb=`Let's start by unlinking your Spotify account. Click the button below to go to Spotify's Content Access page. After you've logged in to your Spotify account, find Sesamy on the list of connected platforms. Click "Unlink" next to the Sesamy logo.`,wb="Step 1: Unlink Your Spotify Account",bb="Once you've successfully unlinked your Spotify account, you can relink it to Sesamy. Simply repeat the steps you previously took that led you to this page.",kb="Step 2: Relink Your Spotify Account to Sesamy",xb="Oops! Your Spotify Account Is Already Linked",Sb="If you have questions or need assistance, you can contact our support team",Ab="Terms and Conditions",Ib="Your email address needs validating. We have sent a new email to your inbox",Eb="User account does not exist",$b="User account does not exist",Cb="We could not find a user with the provided email address. Please, try again.",zb="Try again.",jb="Validate code",Nb="Check your inbox for email validation instructions.",Ob="Signed up",Bb="Click the button to verify your email address",Tb="Validate your email address",Rb="Validate your email address",Pb="Verify account",Lb="Verify your email",Ub="Please check your email at <0>{{email}}</0> and enter the six-digit code that we've sent you.",Vb="Welcome",Mb="Welcome to your {{vendorName}} account!",Hb="Continue with this account",Db="Yes, continue with {{text}}",Fb="Yes, continue with existing account",qb={"Server error: Invalid code":"Invalid code","Wrong email or verification code":{"":"Wrong email or verification code."},account_detected:Pv,account_with_sso_provider:Lv,agree_to:Uv,and:Vv,callback_url_mismatch:Mv,callback_url_not_allowed:Hv,check_email_title:Dv,click_to_sign_up_description:Fv,code_email_enter_code:qv,code_email_subject:Kv,code_email_title:Wv,code_valid_30_minutes:Gv,confirm_password:Jv,contact_support:Zv,contact_us:Yv,continue:"Continue",continue_social_login:Xv,continue_with:Qv,continue_with_sso_provider_headline:ew,copyright:tw,copyright_sesamy:nw,create_account_description:iw,create_account_email_invalid:rw,create_account_passwords_didnt_match:sw,create_account_title:ow,create_account_weak_password:aw,create_new_account_link:cw,create_password_account_title:lw,currently_logged_in_as:uw,email:dw,email_placeholder:pw,email_validated:fw,email_validated_cta:hw,email_verification_for_signup_sent_description:gw,email_verification_for_signup_sent_title:_w,enter_a_code_btn:mw,enter_email_for_verification_description:yw,enter_new_password_placeholder:vw,enter_password:ww,enter_password_description:bw,enter_your_password_btn:kw,expired_code:xw,fokus_info_message:Sw,forgot_password_cta:Aw,forgot_password_description:Iw,forgot_password_email_sent:Ew,forgot_password_link:$w,forgot_password_title:Cw,go_back:zw,"invalid-email":"Invalid email",invalid_password:jw,invalid_session_body:Nw,invalid_session_title:Ow,link_email_click_to_login:Bw,link_email_login:Tw,link_email_or_enter_code:Rw,link_page_body:Pw,link_page_headline:Lw,logged_in_as:Uw,login:Vw,login_description:Mw,login_description_code:Hw,login_description_link:Dw,logout:Fw,no_use_another:qw,or:Kw,password:Ww,password_has_been_reset:Gw,password_has_been_reset_title:Jw,password_reset_subject:Zw,password_reset_title:Yw,privacy_policy:Xw,redirecting:Qw,reenter_new_password_placeholder:eb,register_password_account:tb,resend_code:nb,reset_password_cta:ib,reset_password_description:rb,reset_password_email_click_to_reset:sb,reset_password_email_cta:ob,reset_password_email_reset:ab,reset_password_subject:cb,reset_password_title:lb,send:ub,send_me_a_new_magic_link:db,sent_code_spam:pb,set_password:fb,sign_in:hb,signup:gb,signup_success:_b,spotify_already_linked_body:mb,spotify_already_linked_cta:yb,spotify_already_linked_step1_body:vb,spotify_already_linked_step1_title:wb,spotify_already_linked_step2_body:bb,spotify_already_linked_step2_title:kb,spotify_already_linked_title:xb,support_info:Sb,terms:Ab,unverified_email:Ib,user_account_does_not_exist:Eb,user_not_found:$b,user_not_found_body:Cb,user_not_found_cta:zb,validate_code:jb,validate_email_body:Nb,validate_email_title:Ob,verify_email_click_to_verify:Bb,verify_email_subject:Tb,verify_email_title:Rb,verify_email_verify:Pb,verify_your_email:Lb,we_sent_a_code_to:Ub,welcome:Vb,welcome_to_your_account:Mb,yes_continue:Hb,yes_continue_with:Db,yes_continue_with_existing_account:Fb},Kb="Account rilevato",Wb="Abbiamo rilevato che l'utente ha già creato un account tramite",Gb="Effettuando l'accesso, l'utente accetta la nostra",Jb="e",Zb="Mancata corrispondenza dell'URL di callback",Yb="Il redirect_uri fornito non è nell'elenco degli URL di callback consentiti.",Xb="continuare con l'utente",Qb="Fare clic sul pulsante per creare un nuovo account con password.",ek="Inserite il codice all'indirizzo {{vendorName}} per completare il login.",tk="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",nk="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",ik="Il codice è valido per 30 minuti",rk="Confermare la password",sk="Avete bisogno di aiuto?",ok="Contattateci",ak="o continuare con il conto sociale",ck="Continua con {{provider}}",lk="Desidera continuare a utilizzare l'account esistente?",uk="Copyright © 2023 SESAMY. Tutti i diritti riservati.",dk="©2023 Sesamy",pk="Scegliete una password con un mix di lettere maiuscole e minuscole, numeri e simboli.",fk="Inserire un indirizzo e-mail valido.",hk="Le password non corrispondono. Riprovare.",gk="Scegliere la password",_k="La password deve essere lunga almeno 8 caratteri e contenere almeno una lettera minuscola, una lettera maiuscola, un numero e un simbolo.",mk="Creare un nuovo account",yk="Iscriviti con la password",vk="Attualmente si è connessi come <0>{{email}}</0>",wk="Email",bk="Indirizzo e-mail",kk="Il tuo indirizzo e-mail è stato convalidato",xk="Ora inserire la password per accedere nuovamente",Sk="È stata inviata un'e-mail a <0>{{email}}</0> con un link di verifica. Fare clic sul link per verificare l'indirizzo e-mail e impostare una password.",Ak="Email di verifica inviata",Ik="Inserire un codice",Ek="Vi invieremo un link di verifica per assicurarvi di possedere questo indirizzo e-mail.",$k="Inserire la nuova password",Ck="Inserire la password",zk="Inserire l'indirizzo e-mail e la password per accedere.",jk="Inserire la password",Nk="Il link magico è scaduto. Cliccate sul pulsante sottostante per ricevere un nuovo link nella vostra casella di posta elettronica.",Ok="Abbiamo aggiornato la nostra esperienza di accesso. <0>Clicca qui per saperne di più.</0>",Bk="Inviare l'e-mail di reimpostazione della password",Tk="Fare clic sul pulsante sottostante per ricevere le istruzioni su come reimpostare la password.",Rk="Email di reimpostazione della password inviata",Pk="Hai dimenticato la password?",Lk="Hai dimenticato la password?",Uk="Torna indietro",Vk="Password non valida",Mk=`Il link non è più valido.
196
+ You can click the link below to start a new login.`,Rw="Invalid link",Pw="Click the button to log in",Lw="Login",Uw="Or enter the code at {{vendorName}} to complete the login.",Vw="Enter your email address to unlock this show on {{service}}",Mw="Link your account with {{service}}",Hw="You are logged in as",Dw="Login",qw="Enter your email address to sign in.",Fw="Enter your email address and we will send you a login code.",Kw="Enter your email address and we will send you a login link.",Ww="Log out",Gw="No, I want to use another account",Jw="or",Zw="Password",Yw="The password has been reset",Xw="Success",Qw="Change password for your {{vendorName}} account",eb="Change password for your {{vendorName}} account",tb="Privacy Policy",nb="Redirecting",ib="Confirm password",rb="Register a new password",sb="Resend code",ob="Change password",ab="Enter your new password below for the email account: ",cb="Click the button to reset your password",lb="Click the button to reset your password",ub="Reset your password",db="Change password for your {{vendorName}} account",pb="Reset password",fb="Send",hb="Send me a new magic link",gb="Remember to check your spam folder if the email did not arrive.",_b="Set password",mb="Sign in",yb="Signup",vb="Sign up successful",wb="It appears that your Spotify account is currently linked to another Sesamy account. But fear not, we're here to guide you through the process to get this fixed.",bb="Go to Spotify's Content Access page",kb=`Let's start by unlinking your Spotify account. Click the button below to go to Spotify's Content Access page. After you've logged in to your Spotify account, find Sesamy on the list of connected platforms. Click "Unlink" next to the Sesamy logo.`,xb="Step 1: Unlink Your Spotify Account",Sb="Once you've successfully unlinked your Spotify account, you can relink it to Sesamy. Simply repeat the steps you previously took that led you to this page.",Ab="Step 2: Relink Your Spotify Account to Sesamy",Ib="Oops! Your Spotify Account Is Already Linked",Eb="If you have questions or need assistance, you can contact our support team",zb="Terms and Conditions",$b="Your email address needs validating. We have sent a new email to your inbox",Cb="User account does not exist",jb="User account does not exist",Nb="We could not find a user with the provided email address. Please, try again.",Ob="Try again.",Bb="Validate code",Tb="Check your inbox for email validation instructions.",Rb="Signed up",Pb="Click the button to verify your email address",Lb="Validate your email address",Ub="Validate your email address",Vb="Verify account",Mb="Verify your email",Hb="Please check your email at <0>{{email}}</0> and enter the six-digit code that we've sent you.",Db="Welcome",qb="Welcome to your {{vendorName}} account!",Fb="Continue with this account",Kb="Yes, continue with {{text}}",Wb="Yes, continue with existing account",Gb={"Server error: Invalid code":"Invalid code","Wrong email or verification code":{"":"Wrong email or verification code."},account_detected:Vv,account_with_sso_provider:Mv,agree_to:Hv,and:Dv,callback_url_mismatch:qv,callback_url_not_allowed:Fv,check_email_title:Kv,click_to_sign_up_description:Wv,code_email_enter_code:Gv,code_email_subject:Jv,code_email_title:Zv,code_valid_30_minutes:Yv,confirm_password:Xv,contact_support:Qv,contact_us:ew,continue:"Continue",continue_social_login:tw,continue_with:nw,continue_with_sso_provider_headline:iw,copyright:rw,copyright_sesamy:sw,create_account_description:ow,create_account_email_invalid:aw,create_account_passwords_didnt_match:cw,create_account_title:lw,create_account_weak_password:uw,create_new_account_link:dw,create_password_account_title:pw,currently_logged_in_as:fw,email:hw,email_placeholder:gw,email_validated:_w,email_validated_cta:mw,email_verification_for_signup_sent_description:yw,email_verification_for_signup_sent_title:vw,enter_a_code_btn:ww,enter_email_for_verification_description:bw,enter_new_password_placeholder:kw,enter_password:xw,enter_password_description:Sw,enter_your_password_btn:Aw,expired_code:Iw,fokus_info_message:Ew,forgot_password_cta:zw,forgot_password_description:$w,forgot_password_email_sent:Cw,forgot_password_link:jw,forgot_password_title:Nw,go_back:Ow,"invalid-email":"Invalid email",invalid_password:Bw,invalid_session_body:Tw,invalid_session_title:Rw,link_email_click_to_login:Pw,link_email_login:Lw,link_email_or_enter_code:Uw,link_page_body:Vw,link_page_headline:Mw,logged_in_as:Hw,login:Dw,login_description:qw,login_description_code:Fw,login_description_link:Kw,logout:Ww,no_use_another:Gw,or:Jw,password:Zw,password_has_been_reset:Yw,password_has_been_reset_title:Xw,password_reset_subject:Qw,password_reset_title:eb,privacy_policy:tb,redirecting:nb,reenter_new_password_placeholder:ib,register_password_account:rb,resend_code:sb,reset_password_cta:ob,reset_password_description:ab,reset_password_email_click_to_reset:cb,reset_password_email_cta:lb,reset_password_email_reset:ub,reset_password_subject:db,reset_password_title:pb,send:fb,send_me_a_new_magic_link:hb,sent_code_spam:gb,set_password:_b,sign_in:mb,signup:yb,signup_success:vb,spotify_already_linked_body:wb,spotify_already_linked_cta:bb,spotify_already_linked_step1_body:kb,spotify_already_linked_step1_title:xb,spotify_already_linked_step2_body:Sb,spotify_already_linked_step2_title:Ab,spotify_already_linked_title:Ib,support_info:Eb,terms:zb,unverified_email:$b,user_account_does_not_exist:Cb,user_not_found:jb,user_not_found_body:Nb,user_not_found_cta:Ob,validate_code:Bb,validate_email_body:Tb,validate_email_title:Rb,verify_email_click_to_verify:Pb,verify_email_subject:Lb,verify_email_title:Ub,verify_email_verify:Vb,verify_your_email:Mb,we_sent_a_code_to:Hb,welcome:Db,welcome_to_your_account:qb,yes_continue:Fb,yes_continue_with:Kb,yes_continue_with_existing_account:Wb},Jb="Account rilevato",Zb="Abbiamo rilevato che l'utente ha già creato un account tramite",Yb="Effettuando l'accesso, l'utente accetta la nostra",Xb="e",Qb="Mancata corrispondenza dell'URL di callback",ek="Il redirect_uri fornito non è nell'elenco degli URL di callback consentiti.",tk="continuare con l'utente",nk="Fare clic sul pulsante per creare un nuovo account con password.",ik="Inserite il codice all'indirizzo {{vendorName}} per completare il login.",rk="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",sk="Benvenuti su {{vendorName}}! {{code}} è il codice di accesso",ok="Il codice è valido per 30 minuti",ak="Confermare la password",ck="Avete bisogno di aiuto?",lk="Contattateci",uk="o continuare con il conto sociale",dk="Continua con {{provider}}",pk="Desidera continuare a utilizzare l'account esistente?",fk="Copyright © 2023 SESAMY. Tutti i diritti riservati.",hk="©2023 Sesamy",gk="Scegliete una password con un mix di lettere maiuscole e minuscole, numeri e simboli.",_k="Inserire un indirizzo e-mail valido.",mk="Le password non corrispondono. Riprovare.",yk="Scegliere la password",vk="La password deve essere lunga almeno 8 caratteri e contenere almeno una lettera minuscola, una lettera maiuscola, un numero e un simbolo.",wk="Creare un nuovo account",bk="Iscriviti con la password",kk="Attualmente si è connessi come <0>{{email}}</0>",xk="Email",Sk="Indirizzo e-mail",Ak="Il tuo indirizzo e-mail è stato convalidato",Ik="Ora inserire la password per accedere nuovamente",Ek="È stata inviata un'e-mail a <0>{{email}}</0> con un link di verifica. Fare clic sul link per verificare l'indirizzo e-mail e impostare una password.",zk="Email di verifica inviata",$k="Inserire un codice",Ck="Vi invieremo un link di verifica per assicurarvi di possedere questo indirizzo e-mail.",jk="Inserire la nuova password",Nk="Inserire la password",Ok="Inserire l'indirizzo e-mail e la password per accedere.",Bk="Inserire la password",Tk="Il link magico è scaduto. Cliccate sul pulsante sottostante per ricevere un nuovo link nella vostra casella di posta elettronica.",Rk="Abbiamo aggiornato la nostra esperienza di accesso. <0>Clicca qui per saperne di più.</0>",Pk="Inviare l'e-mail di reimpostazione della password",Lk="Fare clic sul pulsante sottostante per ricevere le istruzioni su come reimpostare la password.",Uk="Email di reimpostazione della password inviata",Vk="Hai dimenticato la password?",Mk="Hai dimenticato la password?",Hk="Torna indietro",Dk="Password non valida",qk=`Il link non è più valido.
197
197
 
198
198
  Assicuratevi di aprire il link di accesso con lo stesso browser con cui avete iniziato l'accesso.
199
199
 
200
- Potete fare clic sul link sottostante per iniziare un nuovo accesso.`,Hk="Collegamento non valido",Dk="Fare clic sul pulsante per accedere",Fk="Accedi",qk="Oppure inserire il codice all'indirizzo {{vendorName}} per completare il login.",Kk="Inserisci il tuo indirizzo e-mail per sbloccare questo spettacolo su {{service}}",Wk="Collegate il vostro account con {{service}}",Gk="L'utente ha effettuato l'accesso come",Jk="Accesso",Zk="Inserire l'indirizzo e-mail per accedere.",Yk="Inserite il vostro indirizzo e-mail e vi invieremo un codice di accesso.",Xk="Inserite il vostro indirizzo e-mail e vi invieremo un link di accesso.",Qk="Disconnettersi",e1="No, voglio usare un altro account",t1="o",n1="Password",i1="La password è stata reimpostata",r1="Il successo",s1="Modifica della password dell'account {{vendorName}}",o1="Modifica della password dell'account {{vendorName}} ",a1="Informativa sulla privacy",c1="Reindirizzamento",l1="Confermare la password",u1="Registrazione di una nuova password",d1="Reinvio del codice",p1="Modifica della password",f1="Immettere di seguito la nuova password per l'account e-mail: ",h1="Fare clic sul pulsante per reimpostare la password",g1="Fare clic sul pulsante per reimpostare la password",_1="Reimpostare la password",m1="Modifica della password dell'account {{vendorName}} ",y1="Reimpostare la password",v1="Inviare",w1="Inviami un nuovo link magico",b1="Ricordate di controllare la cartella spam se l'e-mail non è arrivata.",k1="Impostare la password",x1="Accedi",S1="Iscriviti",A1="Iscriviti con successo",I1="Sembra che il vostro account Spotify sia attualmente collegato a un altro account Sesamy. Ma non temete, siamo qui per guidarvi attraverso la procedura per risolvere il problema.",E1="Vai alla pagina di accesso ai contenuti di Spotify",$1=`Cominciamo con lo scollegare il vostro account Spotify. Fare clic sul pulsante sottostante per accedere alla pagina di accesso ai contenuti di Spotify. Dopo aver effettuato l'accesso al vostro account Spotify, trovate Sesamy nell'elenco delle piattaforme collegate. Fate clic su "Unlink" accanto al logo di Sesamy.`,C1="Passo 1: Disconnettere l'account Spotify",z1="Dopo aver scollegato con successo il proprio account Spotify, è possibile ricollegarlo a Sesamy. È sufficiente ripetere i passaggi precedenti che vi hanno portato a questa pagina.",j1="Passo 2: ricollegare l'account Spotify a Sesamy",N1="Ops! Il tuo account Spotify è già collegato",O1="Se avete domande o bisogno di assistenza, potete contattare il nostro team di supporto",B1="Termini e condizioni",T1="Il tuo indirizzo e-mail deve essere convalidato. Abbiamo inviato una nuova e-mail alla tua casella di posta.",R1="L'account utente non esiste",P1="L'account utente non esiste",L1="Non è stato possibile trovare un utente con l'indirizzo e-mail fornito. Si prega di riprovare.",U1="Riprova.",V1="Convalida del codice",M1="Controllate la vostra casella di posta per le istruzioni di convalida dell'e-mail.",H1="Iscritta",D1="Fare clic sul pulsante per verificare l'indirizzo e-mail",F1="Convalidare l'indirizzo e-mail",q1="Convalidare l'indirizzo e-mail",K1="Verifica dell'account",W1="Verificare l'e-mail",G1="Controllate la vostra e-mail all'indirizzo <0>{{email}}</0> e inserisca il codice a sei cifre che le abbiamo inviato.",J1="Benvenuti",Z1="Benvenuto nel tuo account {{vendorName}}!",Y1="Continuare con questo account",X1="Sì, continuare con {{text}}",Q1="Sì, continuare con l'account esistente",ex={"Server error: Invalid code":"Codice non valido","Wrong email or verification code":{"":"Email o codice di verifica errati."},account_detected:Kb,account_with_sso_provider:Wb,agree_to:Gb,and:Jb,callback_url_mismatch:Zb,callback_url_not_allowed:Yb,check_email_title:Xb,click_to_sign_up_description:Qb,code_email_enter_code:ek,code_email_subject:tk,code_email_title:nk,code_valid_30_minutes:ik,confirm_password:rk,contact_support:sk,contact_us:ok,continue:"Continua",continue_social_login:ak,continue_with:ck,continue_with_sso_provider_headline:lk,copyright:uk,copyright_sesamy:dk,create_account_description:pk,create_account_email_invalid:fk,create_account_passwords_didnt_match:hk,create_account_title:gk,create_account_weak_password:_k,create_new_account_link:mk,create_password_account_title:yk,currently_logged_in_as:vk,email:wk,email_placeholder:bk,email_validated:kk,email_validated_cta:xk,email_verification_for_signup_sent_description:Sk,email_verification_for_signup_sent_title:Ak,enter_a_code_btn:Ik,enter_email_for_verification_description:Ek,enter_new_password_placeholder:$k,enter_password:Ck,enter_password_description:zk,enter_your_password_btn:jk,expired_code:Nk,fokus_info_message:Ok,forgot_password_cta:Bk,forgot_password_description:Tk,forgot_password_email_sent:Rk,forgot_password_link:Pk,forgot_password_title:Lk,go_back:Uk,"invalid-email":"Email non valida",invalid_password:Vk,invalid_session_body:Mk,invalid_session_title:Hk,link_email_click_to_login:Dk,link_email_login:Fk,link_email_or_enter_code:qk,link_page_body:Kk,link_page_headline:Wk,logged_in_as:Gk,login:Jk,login_description:Zk,login_description_code:Yk,login_description_link:Xk,logout:Qk,no_use_another:e1,or:t1,password:n1,password_has_been_reset:i1,password_has_been_reset_title:r1,password_reset_subject:s1,password_reset_title:o1,privacy_policy:a1,redirecting:c1,reenter_new_password_placeholder:l1,register_password_account:u1,resend_code:d1,reset_password_cta:p1,reset_password_description:f1,reset_password_email_click_to_reset:h1,reset_password_email_cta:g1,reset_password_email_reset:_1,reset_password_subject:m1,reset_password_title:y1,send:v1,send_me_a_new_magic_link:w1,sent_code_spam:b1,set_password:k1,sign_in:x1,signup:S1,signup_success:A1,spotify_already_linked_body:I1,spotify_already_linked_cta:E1,spotify_already_linked_step1_body:$1,spotify_already_linked_step1_title:C1,spotify_already_linked_step2_body:z1,spotify_already_linked_step2_title:j1,spotify_already_linked_title:N1,support_info:O1,terms:B1,unverified_email:T1,user_account_does_not_exist:R1,user_not_found:P1,user_not_found_body:L1,user_not_found_cta:U1,validate_code:V1,validate_email_body:M1,validate_email_title:H1,verify_email_click_to_verify:D1,verify_email_subject:F1,verify_email_title:q1,verify_email_verify:K1,verify_your_email:W1,we_sent_a_code_to:G1,welcome:J1,welcome_to_your_account:Z1,yes_continue:Y1,yes_continue_with:X1,yes_continue_with_existing_account:Q1},tx="Konto oppdaget",nx="Vi har oppdaget at du allerede har opprettet en konto gjennom",ix="Ved å logge på godtar du vår",rx="og",sx="Callback-URLen samsvarer ikke",ox="Den oppgitte redirect_uri er ikke på listen over tillatte tilbakeringings-URLer.",ax="fortsett med bruker",cx="Klikk på knappen for å opprette en ny passordkonto.",lx="Skriv inn koden på {{vendorName}} for å fullføre påloggingen",ux="Velkommen til {{vendorName}} ! {{code}} er påloggingskoden",dx="Velkommen til {{vendorName}}! {{code}} er påloggingskoden",px="Koden er gyldig i 30 minutter",fx="Bekreft passord",hx="Trenger hjelp?",gx="Kontakt oss",_x="eller fortsett med sosial konto",mx="Fortsett med {{provider}}",yx="Vil du fortsette med din eksisterende konto?",vx="Opphavsrett © 2023 SESAMY. Alle rettigheter forbeholdt.",wx="©2023 Sesamy",bx="Velg et passord med en blanding av store og små bokstaver, tall og symboler.",kx="Vennligst skriv inn en gyldig e-postadresse.",xx="Passordene stemte ikke overens. Prøv igjen.",Sx="Velg passord",Ax="Passordet må være på minst 8 tegn og inneholde minst én liten bokstav, én stor bokstav, ett tall og ett symbol.",Ix="Opprett ny konto",Ex="Registrer deg med passord",$x="Du er logget på som <0> {{email}}</0>",Cx="E-post",zx="E-postadresse",jx="E-postadressen din har blitt validert",Nx="Skriv nå inn passordet ditt for å logge inn igjen",Ox="En e-post har blitt sendt til <0>{{email}}</0> med en bekreftelseslenke. Klikk på lenken for å bekrefte e-postadressen din og angi et passord.",Bx="E-postbekreftelse sendt",Tx="Angi en kode",Rx="Vi sender deg en bekreftelseskobling for å sikre at du eier denne e-postadressen.",Px="Skriv inn nytt passord",Lx="Oppgi passord",Ux="Skriv inn e-postadressen og passordet ditt for å logge inn.",Vx="Skriv inn passordet ditt",Mx="Den magiske lenken er utløpt. Vennligst klikk på knappen nedenfor for å motta en ny lenke i innboksen din.",Hx="Hei! Vi oppdaterte påloggingsopplevelsen vår. <0>Klikk her for å lære mer om det.</0>",Dx="Send e-post om tilbakestilling av passord",Fx="Klikk på knappen nedenfor, så sender vi deg instruksjoner om hvordan du tilbakestiller passordet ditt.",qx="E-post om tilbakestilling av passord sendt",Kx="Har du glemt passordet?",Wx="Har du glemt passordet?",Gx="Gå tilbake",Jx="Ugyldig passord",Zx=`Lenken er ikke lenger gyldig.
200
+ Potete fare clic sul link sottostante per iniziare un nuovo accesso.`,Fk="Collegamento non valido",Kk="Fare clic sul pulsante per accedere",Wk="Accedi",Gk="Oppure inserire il codice all'indirizzo {{vendorName}} per completare il login.",Jk="Inserisci il tuo indirizzo e-mail per sbloccare questo spettacolo su {{service}}",Zk="Collegate il vostro account con {{service}}",Yk="L'utente ha effettuato l'accesso come",Xk="Accesso",Qk="Inserire l'indirizzo e-mail per accedere.",e1="Inserite il vostro indirizzo e-mail e vi invieremo un codice di accesso.",t1="Inserite il vostro indirizzo e-mail e vi invieremo un link di accesso.",n1="Disconnettersi",i1="No, voglio usare un altro account",r1="o",s1="Password",o1="La password è stata reimpostata",a1="Il successo",c1="Modifica della password dell'account {{vendorName}}",l1="Modifica della password dell'account {{vendorName}} ",u1="Informativa sulla privacy",d1="Reindirizzamento",p1="Confermare la password",f1="Registrazione di una nuova password",h1="Reinvio del codice",g1="Modifica della password",_1="Immettere di seguito la nuova password per l'account e-mail: ",m1="Fare clic sul pulsante per reimpostare la password",y1="Fare clic sul pulsante per reimpostare la password",v1="Reimpostare la password",w1="Modifica della password dell'account {{vendorName}} ",b1="Reimpostare la password",k1="Inviare",x1="Inviami un nuovo link magico",S1="Ricordate di controllare la cartella spam se l'e-mail non è arrivata.",A1="Impostare la password",I1="Accedi",E1="Iscriviti",z1="Iscriviti con successo",$1="Sembra che il vostro account Spotify sia attualmente collegato a un altro account Sesamy. Ma non temete, siamo qui per guidarvi attraverso la procedura per risolvere il problema.",C1="Vai alla pagina di accesso ai contenuti di Spotify",j1=`Cominciamo con lo scollegare il vostro account Spotify. Fare clic sul pulsante sottostante per accedere alla pagina di accesso ai contenuti di Spotify. Dopo aver effettuato l'accesso al vostro account Spotify, trovate Sesamy nell'elenco delle piattaforme collegate. Fate clic su "Unlink" accanto al logo di Sesamy.`,N1="Passo 1: Disconnettere l'account Spotify",O1="Dopo aver scollegato con successo il proprio account Spotify, è possibile ricollegarlo a Sesamy. È sufficiente ripetere i passaggi precedenti che vi hanno portato a questa pagina.",B1="Passo 2: ricollegare l'account Spotify a Sesamy",T1="Ops! Il tuo account Spotify è già collegato",R1="Se avete domande o bisogno di assistenza, potete contattare il nostro team di supporto",P1="Termini e condizioni",L1="Il tuo indirizzo e-mail deve essere convalidato. Abbiamo inviato una nuova e-mail alla tua casella di posta.",U1="L'account utente non esiste",V1="L'account utente non esiste",M1="Non è stato possibile trovare un utente con l'indirizzo e-mail fornito. Si prega di riprovare.",H1="Riprova.",D1="Convalida del codice",q1="Controllate la vostra casella di posta per le istruzioni di convalida dell'e-mail.",F1="Iscritta",K1="Fare clic sul pulsante per verificare l'indirizzo e-mail",W1="Convalidare l'indirizzo e-mail",G1="Convalidare l'indirizzo e-mail",J1="Verifica dell'account",Z1="Verificare l'e-mail",Y1="Controllate la vostra e-mail all'indirizzo <0>{{email}}</0> e inserisca il codice a sei cifre che le abbiamo inviato.",X1="Benvenuti",Q1="Benvenuto nel tuo account {{vendorName}}!",ex="Continuare con questo account",tx="Sì, continuare con {{text}}",nx="Sì, continuare con l'account esistente",ix={"Server error: Invalid code":"Codice non valido","Wrong email or verification code":{"":"Email o codice di verifica errati."},account_detected:Jb,account_with_sso_provider:Zb,agree_to:Yb,and:Xb,callback_url_mismatch:Qb,callback_url_not_allowed:ek,check_email_title:tk,click_to_sign_up_description:nk,code_email_enter_code:ik,code_email_subject:rk,code_email_title:sk,code_valid_30_minutes:ok,confirm_password:ak,contact_support:ck,contact_us:lk,continue:"Continua",continue_social_login:uk,continue_with:dk,continue_with_sso_provider_headline:pk,copyright:fk,copyright_sesamy:hk,create_account_description:gk,create_account_email_invalid:_k,create_account_passwords_didnt_match:mk,create_account_title:yk,create_account_weak_password:vk,create_new_account_link:wk,create_password_account_title:bk,currently_logged_in_as:kk,email:xk,email_placeholder:Sk,email_validated:Ak,email_validated_cta:Ik,email_verification_for_signup_sent_description:Ek,email_verification_for_signup_sent_title:zk,enter_a_code_btn:$k,enter_email_for_verification_description:Ck,enter_new_password_placeholder:jk,enter_password:Nk,enter_password_description:Ok,enter_your_password_btn:Bk,expired_code:Tk,fokus_info_message:Rk,forgot_password_cta:Pk,forgot_password_description:Lk,forgot_password_email_sent:Uk,forgot_password_link:Vk,forgot_password_title:Mk,go_back:Hk,"invalid-email":"Email non valida",invalid_password:Dk,invalid_session_body:qk,invalid_session_title:Fk,link_email_click_to_login:Kk,link_email_login:Wk,link_email_or_enter_code:Gk,link_page_body:Jk,link_page_headline:Zk,logged_in_as:Yk,login:Xk,login_description:Qk,login_description_code:e1,login_description_link:t1,logout:n1,no_use_another:i1,or:r1,password:s1,password_has_been_reset:o1,password_has_been_reset_title:a1,password_reset_subject:c1,password_reset_title:l1,privacy_policy:u1,redirecting:d1,reenter_new_password_placeholder:p1,register_password_account:f1,resend_code:h1,reset_password_cta:g1,reset_password_description:_1,reset_password_email_click_to_reset:m1,reset_password_email_cta:y1,reset_password_email_reset:v1,reset_password_subject:w1,reset_password_title:b1,send:k1,send_me_a_new_magic_link:x1,sent_code_spam:S1,set_password:A1,sign_in:I1,signup:E1,signup_success:z1,spotify_already_linked_body:$1,spotify_already_linked_cta:C1,spotify_already_linked_step1_body:j1,spotify_already_linked_step1_title:N1,spotify_already_linked_step2_body:O1,spotify_already_linked_step2_title:B1,spotify_already_linked_title:T1,support_info:R1,terms:P1,unverified_email:L1,user_account_does_not_exist:U1,user_not_found:V1,user_not_found_body:M1,user_not_found_cta:H1,validate_code:D1,validate_email_body:q1,validate_email_title:F1,verify_email_click_to_verify:K1,verify_email_subject:W1,verify_email_title:G1,verify_email_verify:J1,verify_your_email:Z1,we_sent_a_code_to:Y1,welcome:X1,welcome_to_your_account:Q1,yes_continue:ex,yes_continue_with:tx,yes_continue_with_existing_account:nx},rx="Konto oppdaget",sx="Vi har oppdaget at du allerede har opprettet en konto gjennom",ox="Ved å logge på godtar du vår",ax="og",cx="Callback-URLen samsvarer ikke",lx="Den oppgitte redirect_uri er ikke på listen over tillatte tilbakeringings-URLer.",ux="fortsett med bruker",dx="Klikk på knappen for å opprette en ny passordkonto.",px="Skriv inn koden på {{vendorName}} for å fullføre påloggingen",fx="Velkommen til {{vendorName}} ! {{code}} er påloggingskoden",hx="Velkommen til {{vendorName}}! {{code}} er påloggingskoden",gx="Koden er gyldig i 30 minutter",_x="Bekreft passord",mx="Trenger hjelp?",yx="Kontakt oss",vx="eller fortsett med sosial konto",wx="Fortsett med {{provider}}",bx="Vil du fortsette med din eksisterende konto?",kx="Opphavsrett © 2023 SESAMY. Alle rettigheter forbeholdt.",xx="©2023 Sesamy",Sx="Velg et passord med en blanding av store og små bokstaver, tall og symboler.",Ax="Vennligst skriv inn en gyldig e-postadresse.",Ix="Passordene stemte ikke overens. Prøv igjen.",Ex="Velg passord",zx="Passordet må være på minst 8 tegn og inneholde minst én liten bokstav, én stor bokstav, ett tall og ett symbol.",$x="Opprett ny konto",Cx="Registrer deg med passord",jx="Du er logget på som <0> {{email}}</0>",Nx="E-post",Ox="E-postadresse",Bx="E-postadressen din har blitt validert",Tx="Skriv nå inn passordet ditt for å logge inn igjen",Rx="En e-post har blitt sendt til <0>{{email}}</0> med en bekreftelseslenke. Klikk på lenken for å bekrefte e-postadressen din og angi et passord.",Px="E-postbekreftelse sendt",Lx="Angi en kode",Ux="Vi sender deg en bekreftelseskobling for å sikre at du eier denne e-postadressen.",Vx="Skriv inn nytt passord",Mx="Oppgi passord",Hx="Skriv inn e-postadressen og passordet ditt for å logge inn.",Dx="Skriv inn passordet ditt",qx="Den magiske lenken er utløpt. Vennligst klikk på knappen nedenfor for å motta en ny lenke i innboksen din.",Fx="Hei! Vi oppdaterte påloggingsopplevelsen vår. <0>Klikk her for å lære mer om det.</0>",Kx="Send e-post om tilbakestilling av passord",Wx="Klikk på knappen nedenfor, så sender vi deg instruksjoner om hvordan du tilbakestiller passordet ditt.",Gx="E-post om tilbakestilling av passord sendt",Jx="Har du glemt passordet?",Zx="Har du glemt passordet?",Yx="Gå tilbake",Xx="Ugyldig passord",Qx=`Lenken er ikke lenger gyldig.
201
201
 
202
202
  Sørg for å åpne påloggingslenken i samme nettleser som du startet påloggingen med.
203
203
 
204
- Du kan klikke på lenken nedenfor for å starte en ny pålogging.`,Yx="Ugyldig lenke",Xx="Klikk på knappen for å logge inn",Qx="Logg inn",eS="Eller skriv inn koden på {{vendorName}} for å fullføre påloggingen.",tS="Skriv inn e-postadressen din for å låse opp dette programmet på {{service}}",nS="Koble kontoen din til {{service}}",iS="Du er innlogget som",rS="Logg inn",sS="Skriv inn e-postadressen din for å logge på.",oS="Skriv inn e-postadressen din og vi sender deg en påloggingskode.",aS="Skriv inn e-postadressen din og vi sender deg en påloggingslenke.",cS="Logg ut",lS="Nei, jeg vil bruke en annen konto",uS="eller",dS="Passord",pS="Passordet har blitt tilbakestilt",fS="Suksess",hS="Endre passord for {{vendorName}} kontoen din",gS="Endre passord for {{vendorName}} kontoen din",_S="Personvernerklæring",mS="Omdirigerer",yS="Bekreft passord",vS="Registrer et nytt passord",wS="Send kode på nytt",bS="Endre passord",kS="Skriv inn det nye passordet for e-postkontoen nedenfor: ",xS="Klikk på knappen for å tilbakestille passordet ditt",SS="Klikk på knappen for å tilbakestille passordet ditt",AS="Tilbakestill passordet ditt",IS="Endre passord for {{vendorName}} -kontoen din",ES="Tilbakestill passord",$S="Send",CS="Send meg en ny magisk lenke",zS="Husk å sjekke søppelpostmappen din hvis e-posten ikke kom.",jS="Angi passord",NS="Logg inn",OS="Påmelding",BS="Vellykket registrering",TS="Det ser ut til at Spotify-kontoen din for øyeblikket er koblet til en annen Sesamy-konto. Men ikke vær redd, vi er her for å veilede deg gjennom prosessen for å få dette fikset.",RS="Gå til Spotifys innholdstilgangsside",PS='La oss starte med å koble fra Spotify-kontoen din. Klikk på knappen nedenfor for å gå til Spotifys innholdstilgang-side. Etter at du har logget på Spotify-kontoen din, finner du Sesamy på listen over tilkoblede plattformer. Klikk "Fjern kobling" ved siden av Sesamy-logoen.',LS="Trinn 1: Koble fra Spotify-kontoen din",US="Når du har koblet fra Spotify-kontoen din, kan du koble den til Sesamy på nytt. Bare gjenta trinnene du tidligere tok som førte deg til denne siden.",VS="Trinn 2: Koble Spotify-kontoen din til Sesamy på nytt",MS="Oops! Spotify-kontoen din er allerede koblet",HS="Hvis du har spørsmål eller trenger hjelp, kan du kontakte supportteamet vårt",DS="vilkår",FS="E-postadressen din må bekreftes. Vi har sendt en ny e-post til innboksen din.",qS="Brukerkonto eksisterer ikke",KS="Brukerkonto eksisterer ikke",WS="Vi kunne ikke finne en bruker med den oppgitte e-postadressen. Vær så snill, prøv på nytt.",GS="Prøv igjen.",JS="Bekreft koden",ZS="Sjekk innboksen din for instruksjoner om e-postvalidering.",YS="Registrerte seg",XS="Klikk på knappen for å bekrefte e-postadressen din",QS="Bekreft e-postadressen din",e2="Bekreft e-postadressen din",t2="Bekreft konto",n2="Bekreft e-posten din",i2="Vennligst sjekk e-posten din på <0>{{email}}</0> og skriv inn den sekssifrede koden som vi har sendt deg.",r2="Velkommen",s2="Velkommen til din brukerkonto hos {{vendorName}} !",o2="Fortsett med denne kontoen",a2="Ja, fortsett med {{text}}",c2="Ja, fortsett med eksisterende konto",l2={"Server error: Invalid code":"Ugyldig kode","Wrong email or verification code":{"":"Feil e-post eller bekreftelseskode."},account_detected:tx,account_with_sso_provider:nx,agree_to:ix,and:rx,callback_url_mismatch:sx,callback_url_not_allowed:ox,check_email_title:ax,click_to_sign_up_description:cx,code_email_enter_code:lx,code_email_subject:ux,code_email_title:dx,code_valid_30_minutes:px,confirm_password:fx,contact_support:hx,contact_us:gx,continue:"Fortsette",continue_social_login:_x,continue_with:mx,continue_with_sso_provider_headline:yx,copyright:vx,copyright_sesamy:wx,create_account_description:bx,create_account_email_invalid:kx,create_account_passwords_didnt_match:xx,create_account_title:Sx,create_account_weak_password:Ax,create_new_account_link:Ix,create_password_account_title:Ex,currently_logged_in_as:$x,email:Cx,email_placeholder:zx,email_validated:jx,email_validated_cta:Nx,email_verification_for_signup_sent_description:Ox,email_verification_for_signup_sent_title:Bx,enter_a_code_btn:Tx,enter_email_for_verification_description:Rx,enter_new_password_placeholder:Px,enter_password:Lx,enter_password_description:Ux,enter_your_password_btn:Vx,expired_code:Mx,fokus_info_message:Hx,forgot_password_cta:Dx,forgot_password_description:Fx,forgot_password_email_sent:qx,forgot_password_link:Kx,forgot_password_title:Wx,go_back:Gx,"invalid-email":"Ugyldig epost",invalid_password:Jx,invalid_session_body:Zx,invalid_session_title:Yx,link_email_click_to_login:Xx,link_email_login:Qx,link_email_or_enter_code:eS,link_page_body:tS,link_page_headline:nS,logged_in_as:iS,login:rS,login_description:sS,login_description_code:oS,login_description_link:aS,logout:cS,no_use_another:lS,or:uS,password:dS,password_has_been_reset:pS,password_has_been_reset_title:fS,password_reset_subject:hS,password_reset_title:gS,privacy_policy:_S,redirecting:mS,reenter_new_password_placeholder:yS,register_password_account:vS,resend_code:wS,reset_password_cta:bS,reset_password_description:kS,reset_password_email_click_to_reset:xS,reset_password_email_cta:SS,reset_password_email_reset:AS,reset_password_subject:IS,reset_password_title:ES,send:$S,send_me_a_new_magic_link:CS,sent_code_spam:zS,set_password:jS,sign_in:NS,signup:OS,signup_success:BS,spotify_already_linked_body:TS,spotify_already_linked_cta:RS,spotify_already_linked_step1_body:PS,spotify_already_linked_step1_title:LS,spotify_already_linked_step2_body:US,spotify_already_linked_step2_title:VS,spotify_already_linked_title:MS,support_info:HS,terms:DS,unverified_email:FS,user_account_does_not_exist:qS,user_not_found:KS,user_not_found_body:WS,user_not_found_cta:GS,validate_code:JS,validate_email_body:ZS,validate_email_title:YS,verify_email_click_to_verify:XS,verify_email_subject:QS,verify_email_title:e2,verify_email_verify:t2,verify_your_email:n2,we_sent_a_code_to:i2,welcome:r2,welcome_to_your_account:s2,yes_continue:o2,yes_continue_with:a2,yes_continue_with_existing_account:c2},u2="Fortsätt med existerande konto",d2="Det verkar som att du redan har skapat ett konto genom",p2="Genom att logga in godkänner du våra",f2="och",h2="Callback URL mismatch",g2="The provided redirect_uri is not in the list of allowed callback URLs.",_2="fortsätt med användaren",m2="Klicka på knappen för att skapa ett nytt lösenordskonto.",y2="Skriv in koden på {{vendorName}} för att slutföra inloggningen",v2="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",w2="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",b2="Koden är giltig i 30 minuter",k2="Bekräfta lösenord",x2="Behöver du hjälp?",S2="Kontakta oss",A2="eller via sociala medier",I2="Fortsätt med {{provider}}",E2="Vill du fortsätta med det här kontot?",$2="Copyright © 2023 SESAMY. Alla rättigheter förbehållna.",C2="©2023 Sesamy",z2="Välj ett lösenord med en blandning av stora och små bokstäver, siffror och symboler.",j2="Ange en giltig e-postadress.",N2="Lösenorden stämde inte överens. Försök igen.",O2="Välj lösenord",B2="Lösenordet måste vara minst 8 tecken långt och innehålla minst en gemen bokstav, en versal bokstav, en siffra och en symbol.",T2="Skapa nytt konto",R2="Registrera dig med lösenord",P2="Du är inloggad som <0>{{email}}</0>",L2="E-postadress",U2="E-postadress",V2="Din e-postadress har validerats",M2="Ange nu ditt lösenord för att logga in igen",H2="Ett e-postmeddelande har skickats till <0>{{email}}</0> med en verifieringslänk. Vänligen klicka på länken för att verifiera din e-postadress och välja ett lösenord.",D2="E-postverifiering skickad",F2="Logga in med kod",q2="Vi skickar dig en verifieringslänk för att säkerställa att du äger den här e-postadressen.",K2="Ange nytt lösenord",W2="Ange lösenord",G2="Ange din e-postadress och ditt lösenord för att logga in.",J2="Logga in med lösenord",Z2="Länken är inte längre giltig. Klicka på knappen för att skicka en ny länk till din epost.",Y2="Vi har bytt inloggningssystem, <0>här kan du läsa mer om vad det innebär</0>",X2="Skicka",Q2="Klicka på knappen nedan så skickar vi instruktioner om hur du återställer ditt lösenord.",eA="Vi har skickat ett e-postmeddelande med instruktioner om hur du återställer ditt lösenord till den e-postadress du angav.",tA="Har du glömt lösenordet?",nA="Har du glömt lösenordet?",iA="Gå tillbaka",rA="Ogiltigt lösenord",sA=`Länken är inte längre giltig.
204
+ Du kan klikke på lenken nedenfor for å starte en ny pålogging.`,eS="Ugyldig lenke",tS="Klikk på knappen for å logge inn",nS="Logg inn",iS="Eller skriv inn koden på {{vendorName}} for å fullføre påloggingen.",rS="Skriv inn e-postadressen din for å låse opp dette programmet på {{service}}",sS="Koble kontoen din til {{service}}",oS="Du er innlogget som",aS="Logg inn",cS="Skriv inn e-postadressen din for å logge på.",lS="Skriv inn e-postadressen din og vi sender deg en påloggingskode.",uS="Skriv inn e-postadressen din og vi sender deg en påloggingslenke.",dS="Logg ut",pS="Nei, jeg vil bruke en annen konto",fS="eller",hS="Passord",gS="Passordet har blitt tilbakestilt",_S="Suksess",mS="Endre passord for {{vendorName}} kontoen din",yS="Endre passord for {{vendorName}} kontoen din",vS="Personvernerklæring",wS="Omdirigerer",bS="Bekreft passord",kS="Registrer et nytt passord",xS="Send kode på nytt",SS="Endre passord",AS="Skriv inn det nye passordet for e-postkontoen nedenfor: ",IS="Klikk på knappen for å tilbakestille passordet ditt",ES="Klikk på knappen for å tilbakestille passordet ditt",zS="Tilbakestill passordet ditt",$S="Endre passord for {{vendorName}} -kontoen din",CS="Tilbakestill passord",jS="Send",NS="Send meg en ny magisk lenke",OS="Husk å sjekke søppelpostmappen din hvis e-posten ikke kom.",BS="Angi passord",TS="Logg inn",RS="Påmelding",PS="Vellykket registrering",LS="Det ser ut til at Spotify-kontoen din for øyeblikket er koblet til en annen Sesamy-konto. Men ikke vær redd, vi er her for å veilede deg gjennom prosessen for å få dette fikset.",US="Gå til Spotifys innholdstilgangsside",VS='La oss starte med å koble fra Spotify-kontoen din. Klikk på knappen nedenfor for å gå til Spotifys innholdstilgang-side. Etter at du har logget på Spotify-kontoen din, finner du Sesamy på listen over tilkoblede plattformer. Klikk "Fjern kobling" ved siden av Sesamy-logoen.',MS="Trinn 1: Koble fra Spotify-kontoen din",HS="Når du har koblet fra Spotify-kontoen din, kan du koble den til Sesamy på nytt. Bare gjenta trinnene du tidligere tok som førte deg til denne siden.",DS="Trinn 2: Koble Spotify-kontoen din til Sesamy på nytt",qS="Oops! Spotify-kontoen din er allerede koblet",FS="Hvis du har spørsmål eller trenger hjelp, kan du kontakte supportteamet vårt",KS="vilkår",WS="E-postadressen din må bekreftes. Vi har sendt en ny e-post til innboksen din.",GS="Brukerkonto eksisterer ikke",JS="Brukerkonto eksisterer ikke",ZS="Vi kunne ikke finne en bruker med den oppgitte e-postadressen. Vær så snill, prøv på nytt.",YS="Prøv igjen.",XS="Bekreft koden",QS="Sjekk innboksen din for instruksjoner om e-postvalidering.",e2="Registrerte seg",t2="Klikk på knappen for å bekrefte e-postadressen din",n2="Bekreft e-postadressen din",i2="Bekreft e-postadressen din",r2="Bekreft konto",s2="Bekreft e-posten din",o2="Vennligst sjekk e-posten din på <0>{{email}}</0> og skriv inn den sekssifrede koden som vi har sendt deg.",a2="Velkommen",c2="Velkommen til din brukerkonto hos {{vendorName}} !",l2="Fortsett med denne kontoen",u2="Ja, fortsett med {{text}}",d2="Ja, fortsett med eksisterende konto",p2={"Server error: Invalid code":"Ugyldig kode","Wrong email or verification code":{"":"Feil e-post eller bekreftelseskode."},account_detected:rx,account_with_sso_provider:sx,agree_to:ox,and:ax,callback_url_mismatch:cx,callback_url_not_allowed:lx,check_email_title:ux,click_to_sign_up_description:dx,code_email_enter_code:px,code_email_subject:fx,code_email_title:hx,code_valid_30_minutes:gx,confirm_password:_x,contact_support:mx,contact_us:yx,continue:"Fortsette",continue_social_login:vx,continue_with:wx,continue_with_sso_provider_headline:bx,copyright:kx,copyright_sesamy:xx,create_account_description:Sx,create_account_email_invalid:Ax,create_account_passwords_didnt_match:Ix,create_account_title:Ex,create_account_weak_password:zx,create_new_account_link:$x,create_password_account_title:Cx,currently_logged_in_as:jx,email:Nx,email_placeholder:Ox,email_validated:Bx,email_validated_cta:Tx,email_verification_for_signup_sent_description:Rx,email_verification_for_signup_sent_title:Px,enter_a_code_btn:Lx,enter_email_for_verification_description:Ux,enter_new_password_placeholder:Vx,enter_password:Mx,enter_password_description:Hx,enter_your_password_btn:Dx,expired_code:qx,fokus_info_message:Fx,forgot_password_cta:Kx,forgot_password_description:Wx,forgot_password_email_sent:Gx,forgot_password_link:Jx,forgot_password_title:Zx,go_back:Yx,"invalid-email":"Ugyldig epost",invalid_password:Xx,invalid_session_body:Qx,invalid_session_title:eS,link_email_click_to_login:tS,link_email_login:nS,link_email_or_enter_code:iS,link_page_body:rS,link_page_headline:sS,logged_in_as:oS,login:aS,login_description:cS,login_description_code:lS,login_description_link:uS,logout:dS,no_use_another:pS,or:fS,password:hS,password_has_been_reset:gS,password_has_been_reset_title:_S,password_reset_subject:mS,password_reset_title:yS,privacy_policy:vS,redirecting:wS,reenter_new_password_placeholder:bS,register_password_account:kS,resend_code:xS,reset_password_cta:SS,reset_password_description:AS,reset_password_email_click_to_reset:IS,reset_password_email_cta:ES,reset_password_email_reset:zS,reset_password_subject:$S,reset_password_title:CS,send:jS,send_me_a_new_magic_link:NS,sent_code_spam:OS,set_password:BS,sign_in:TS,signup:RS,signup_success:PS,spotify_already_linked_body:LS,spotify_already_linked_cta:US,spotify_already_linked_step1_body:VS,spotify_already_linked_step1_title:MS,spotify_already_linked_step2_body:HS,spotify_already_linked_step2_title:DS,spotify_already_linked_title:qS,support_info:FS,terms:KS,unverified_email:WS,user_account_does_not_exist:GS,user_not_found:JS,user_not_found_body:ZS,user_not_found_cta:YS,validate_code:XS,validate_email_body:QS,validate_email_title:e2,verify_email_click_to_verify:t2,verify_email_subject:n2,verify_email_title:i2,verify_email_verify:r2,verify_your_email:s2,we_sent_a_code_to:o2,welcome:a2,welcome_to_your_account:c2,yes_continue:l2,yes_continue_with:u2,yes_continue_with_existing_account:d2},f2="Fortsätt med existerande konto",h2="Det verkar som att du redan har skapat ett konto genom",g2="Genom att logga in godkänner du våra",_2="och",m2="Callback URL mismatch",y2="The provided redirect_uri is not in the list of allowed callback URLs.",v2="fortsätt med användaren",w2="Klicka på knappen för att skapa ett nytt lösenordskonto.",b2="Skriv in koden på {{vendorName}} för att slutföra inloggningen",k2="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",x2="Välkommen till {{vendorName}}! {{code}} är koden för att logga in",S2="Koden är giltig i 30 minuter",A2="Bekräfta lösenord",I2="Behöver du hjälp?",E2="Kontakta oss",z2="eller via sociala medier",$2="Fortsätt med {{provider}}",C2="Vill du fortsätta med det här kontot?",j2="Copyright © 2023 SESAMY. Alla rättigheter förbehållna.",N2="©2023 Sesamy",O2="Välj ett lösenord med en blandning av stora och små bokstäver, siffror och symboler.",B2="Ange en giltig e-postadress.",T2="Lösenorden stämde inte överens. Försök igen.",R2="Välj lösenord",P2="Lösenordet måste vara minst 8 tecken långt och innehålla minst en gemen bokstav, en versal bokstav, en siffra och en symbol.",L2="Skapa nytt konto",U2="Registrera dig med lösenord",V2="Du är inloggad som <0>{{email}}</0>",M2="E-postadress",H2="E-postadress",D2="Din e-postadress har validerats",q2="Ange nu ditt lösenord för att logga in igen",F2="Ett e-postmeddelande har skickats till <0>{{email}}</0> med en verifieringslänk. Vänligen klicka på länken för att verifiera din e-postadress och välja ett lösenord.",K2="E-postverifiering skickad",W2="Logga in med kod",G2="Vi skickar dig en verifieringslänk för att säkerställa att du äger den här e-postadressen.",J2="Ange nytt lösenord",Z2="Ange lösenord",Y2="Ange din e-postadress och ditt lösenord för att logga in.",X2="Logga in med lösenord",Q2="Länken är inte längre giltig. Klicka på knappen för att skicka en ny länk till din epost.",eA="Vi har bytt inloggningssystem, <0>här kan du läsa mer om vad det innebär</0>",tA="Skicka",nA="Klicka på knappen nedan så skickar vi instruktioner om hur du återställer ditt lösenord.",iA="Vi har skickat ett e-postmeddelande med instruktioner om hur du återställer ditt lösenord till den e-postadress du angav.",rA="Har du glömt lösenordet?",sA="Har du glömt lösenordet?",oA="Gå tillbaka",aA="Ogiltigt lösenord",cA=`Länken är inte längre giltig.
205
205
 
206
206
  Vänligen se till att öppna inloggningslänken i samma webbläsare som du startade inloggningen med.
207
207
 
208
- Du kan klicka på länken nedan för att starta en ny inloggning.`,oA="Ogiltig länk",aA="Klicka på knappen för att logga in",cA="Logga in",lA="Eller skriv in koden på {{vendorName}} för att slutföra inloggningen.",uA="Ange din epost för att låsa upp den här showen på {{service}}",dA="Koppla ditt konto till {{service}}",pA="Du är inloggad som",fA="Logga in",hA="Ange din e-postadress för att logga in.",gA="Ange din mejladress, så skickar vi en kod till dig som du kan logga in med.",_A="Ange din mejladress, så skickar vi en länk till dig som du kan logga in med.",mA="Logga ut",yA="Nej, jag vill använda ett annat konto",vA="eller",wA="Lösenord",bA="Lösenordet har återställts",kA="Framgång",xA="Byt lösenord för ditt {{vendorName}} konto",SA="Byt lösenord för ditt {{vendorName}} konto",AA="Integritetspolicy",IA="Du skickas vidare",EA="Bekräfta lösenord",$A="Registrera ett nytt lösenord",CA="Skicka koden igen",zA="Ändra lösenord",jA="Ange ditt nya lösenord nedan för e-postkontot: ",NA="Klicka på knappen för att återställa ditt lösenord",OA="Klicka på knappen för att återställa ditt lösenord",BA="Återställ ditt lösenord",TA="Byt lösenord för ditt {{vendorName}} konto",RA="Återställ lösenord",PA="Skicka",LA="Skicka en ny inloggninglänk",UA="Kom ihåg att kontrollera din skräppost om du inte kan hitta mailet vi har skickat.",VA="Välj lösenord",MA="Logga in",HA="Registrera dig",DA="Registrera dig framgångsrik",FA="Det verkar som att ditt Spotify-konto för närvarande är kopplat till ett annat Sesamy-konto. Ingen fara, vi är här för att guida dig genom processen för att lösa detta.",qA="Gå till Spotify's Content Access sida",KA=`Vi börjar med att avlänka ditt Spotify-konto. Klicka på knappen nedan för att komma till Spotify's Content Access sida. När du har loggat in på ditt Spotify-konto, leta upp Sesamy i listan över anslutna plattformar. Klicka på "Unlink" bredvid Sesamys logotyp.`,WA="Steg 1: Avlänka ditt Spotify-konto",GA="När du har avlänkat ditt Spotify-konto kan du koppla det till Sesamy igen. Upprepa helt enkelt de steg du tog som ledde dig till den här sidan.",JA="Steg 2: Koppla ditt Spotify-konto till Sesamy igen",ZA="Oj! Ditt Spotify-konto är redan kopplat",YA="Om du har frågor eller behöver hjälp kan du kontakta vårt supportteam",XA="Villkor",QA="Din e-postadress behöver valideras. Vi har skickat ett nytt e-postmeddelande till din inkorg",eI="Kontot existerar inte",tI="Kontot extisterar inte",nI="Vi kan inte hitta en användare med denna eposten. Vänligen försök igen.",iI="Försök igen.",rI="Validera kod",sI="Kontrollera din inkorg för instruktioner om validering av e-post.",oI="Registrerad",aI="Klicka på knappen för att verifiera din e-postadress",cI="Bekräfta din e-postadress",lI="Bekräfta din e-postadress",uI="Verifiera konto",dI="Ange engångskod",pI="Vänligen kontrollera din e-post för <0>{{email}}</0> och ange den sexsiffriga koden som vi har skickat till dig.",fI="Välkommen",hI="Välkommen till ditt {{vendorName}}-konto!",gI="Fortsätt med konto",_I="Ja, fortsätt med {{text}}",mI="Ja, fortsätt med detta kontot",yI={"Server error: Invalid code":"Koden är inte giltig","Wrong email or verification code":{"":"Fel e-post eller verifieringskod."},account_detected:u2,account_with_sso_provider:d2,agree_to:p2,and:f2,callback_url_mismatch:h2,callback_url_not_allowed:g2,check_email_title:_2,click_to_sign_up_description:m2,code_email_enter_code:y2,code_email_subject:v2,code_email_title:w2,code_valid_30_minutes:b2,confirm_password:k2,contact_support:x2,contact_us:S2,continue:"Fortsätt",continue_social_login:A2,continue_with:I2,continue_with_sso_provider_headline:E2,copyright:$2,copyright_sesamy:C2,create_account_description:z2,create_account_email_invalid:j2,create_account_passwords_didnt_match:N2,create_account_title:O2,create_account_weak_password:B2,create_new_account_link:T2,create_password_account_title:R2,currently_logged_in_as:P2,email:L2,email_placeholder:U2,email_validated:V2,email_validated_cta:M2,email_verification_for_signup_sent_description:H2,email_verification_for_signup_sent_title:D2,enter_a_code_btn:F2,enter_email_for_verification_description:q2,enter_new_password_placeholder:K2,enter_password:W2,enter_password_description:G2,enter_your_password_btn:J2,expired_code:Z2,fokus_info_message:Y2,forgot_password_cta:X2,forgot_password_description:Q2,forgot_password_email_sent:eA,forgot_password_link:tA,forgot_password_title:nA,go_back:iA,"invalid-email":"Ogiltig e-postadress",invalid_password:rA,invalid_session_body:sA,invalid_session_title:oA,link_email_click_to_login:aA,link_email_login:cA,link_email_or_enter_code:lA,link_page_body:uA,link_page_headline:dA,logged_in_as:pA,login:fA,login_description:hA,login_description_code:gA,login_description_link:_A,logout:mA,no_use_another:yA,or:vA,password:wA,password_has_been_reset:bA,password_has_been_reset_title:kA,password_reset_subject:xA,password_reset_title:SA,privacy_policy:AA,redirecting:IA,reenter_new_password_placeholder:EA,register_password_account:$A,resend_code:CA,reset_password_cta:zA,reset_password_description:jA,reset_password_email_click_to_reset:NA,reset_password_email_cta:OA,reset_password_email_reset:BA,reset_password_subject:TA,reset_password_title:RA,send:PA,send_me_a_new_magic_link:LA,sent_code_spam:UA,set_password:VA,sign_in:MA,signup:HA,signup_success:DA,spotify_already_linked_body:FA,spotify_already_linked_cta:qA,spotify_already_linked_step1_body:KA,spotify_already_linked_step1_title:WA,spotify_already_linked_step2_body:GA,spotify_already_linked_step2_title:JA,spotify_already_linked_title:ZA,support_info:YA,terms:XA,unverified_email:QA,user_account_does_not_exist:eI,user_not_found:tI,user_not_found_body:nI,user_not_found_cta:iI,validate_code:rI,validate_email_body:sI,validate_email_title:oI,verify_email_click_to_verify:aI,verify_email_subject:cI,verify_email_title:lI,verify_email_verify:uI,verify_your_email:dI,we_sent_a_code_to:pI,welcome:fI,welcome_to_your_account:hI,yes_continue:gI,yes_continue_with:_I,yes_continue_with_existing_account:mI},vI="Wykryto konto",wI="Wykryliśmy, że użytkownik utworzył już konto za pośrednictwem",bI="Logując się, wyrażasz zgodę na nasze",kI="i",xI="Niezgodność adresu URL wywołania zwrotnego",SI="Podany adres redirect_uri nie znajduje się na liście dozwolonych adresów URL wywołania zwrotnego.",AI="kontynuować z użytkownikiem",II="Kliknij przycisk, aby utworzyć nowe konto z hasłem.",EI="Wpisz kod na stronie {{vendorName}}, aby się zalogować.",$I="Witamy na {{vendorName}}! {{code}} to kod logowania do Twojego konta.",CI="Witamy na {{vendorName}}! {{code}} to kod logowania.",zI="Kod jest ważny przez 30 minut",jI="Potwierdź hasło",NI="Potrzebujesz pomocy?",OI="Skontaktuj się z nami",BI="lub kontynuować korzystanie z konta społecznościowego",TI="Kontynuuj {{provider}}",RI="Czy chcesz kontynuować korzystanie z istniejącego konta?",PI="Copyright © 2023 SESAMY. Wszelkie prawa zastrzeżone.",LI="©2023 Sesamy",UI="Wybierz hasło składające się z małych i wielkich liter, cyfr i symboli.",VI="Wprowadź prawidłowy adres e-mail.",MI="Hasła nie są zgodne. Spróbuj ponownie.",HI="Wybierz hasło",DI="Hasło musi mieć co najmniej 8 znaków i zawierać co najmniej jedną małą literę, jedną wielką literę, jedną cyfrę i jeden symbol.",FI="Utwórz nowe konto",qI="Zarejestruj się przy użyciu hasła",KI="Jesteś obecnie zalogowany jako <0>{{email}}</0>",WI="E-mail",GI="Adres e-mail",JI="Twój adres e-mail został zweryfikowany",ZI="Teraz wprowadź hasło, aby zalogować się ponownie",YI="Wiadomość e-mail została wysłana do <0>{{email}}</0> z linkiem weryfikacyjnym. Kliknij łącze, aby zweryfikować swój adres e-mail i ustawić hasło.",XI="Wysłano weryfikację e-mail",QI="Wprowadź kod",e4="Wyślemy Ci link weryfikacyjny, aby upewnić się, że posiadasz ten adres e-mail.",t4="Wprowadź nowe hasło",n4="Wprowadź hasło",i4="Wprowadź swój adres e-mail i hasło, aby się zalogować.",r4="Wprowadź hasło",s4="Magiczny link wygasł. Kliknij poniższy przycisk, aby otrzymać nowy link w skrzynce odbiorczej.",o4="Zaktualizowaliśmy sposób logowania. <0>Kliknij tutaj, aby dowiedzieć się więcej.</0>",a4="Wyślij wiadomość e-mail z resetem hasła",c4="Kliknij poniższy przycisk, a my wyślemy Ci instrukcje, jak zresetować hasło.",l4="Wysłano wiadomość e-mail z resetem hasła",u4="Zapomniałeś hasła?",d4="Zapomniałeś hasła?",p4="Wróć",f4="Nieprawidłowe hasło",h4=`Link jest już nieaktualny.
208
+ Du kan klicka på länken nedan för att starta en ny inloggning.`,lA="Ogiltig länk",uA="Klicka på knappen för att logga in",dA="Logga in",pA="Eller skriv in koden på {{vendorName}} för att slutföra inloggningen.",fA="Ange din epost för att låsa upp den här showen på {{service}}",hA="Koppla ditt konto till {{service}}",gA="Du är inloggad som",_A="Logga in",mA="Ange din e-postadress för att logga in.",yA="Ange din mejladress, så skickar vi en kod till dig som du kan logga in med.",vA="Ange din mejladress, så skickar vi en länk till dig som du kan logga in med.",wA="Logga ut",bA="Nej, jag vill använda ett annat konto",kA="eller",xA="Lösenord",SA="Lösenordet har återställts",AA="Framgång",IA="Byt lösenord för ditt {{vendorName}} konto",EA="Byt lösenord för ditt {{vendorName}} konto",zA="Integritetspolicy",$A="Du skickas vidare",CA="Bekräfta lösenord",jA="Registrera ett nytt lösenord",NA="Skicka koden igen",OA="Ändra lösenord",BA="Ange ditt nya lösenord nedan för e-postkontot: ",TA="Klicka på knappen för att återställa ditt lösenord",RA="Klicka på knappen för att återställa ditt lösenord",PA="Återställ ditt lösenord",LA="Byt lösenord för ditt {{vendorName}} konto",UA="Återställ lösenord",VA="Skicka",MA="Skicka en ny inloggninglänk",HA="Kom ihåg att kontrollera din skräppost om du inte kan hitta mailet vi har skickat.",DA="Välj lösenord",qA="Logga in",FA="Registrera dig",KA="Registrera dig framgångsrik",WA="Det verkar som att ditt Spotify-konto för närvarande är kopplat till ett annat Sesamy-konto. Ingen fara, vi är här för att guida dig genom processen för att lösa detta.",GA="Gå till Spotify's Content Access sida",JA=`Vi börjar med att avlänka ditt Spotify-konto. Klicka på knappen nedan för att komma till Spotify's Content Access sida. När du har loggat in på ditt Spotify-konto, leta upp Sesamy i listan över anslutna plattformar. Klicka på "Unlink" bredvid Sesamys logotyp.`,ZA="Steg 1: Avlänka ditt Spotify-konto",YA="När du har avlänkat ditt Spotify-konto kan du koppla det till Sesamy igen. Upprepa helt enkelt de steg du tog som ledde dig till den här sidan.",XA="Steg 2: Koppla ditt Spotify-konto till Sesamy igen",QA="Oj! Ditt Spotify-konto är redan kopplat",eI="Om du har frågor eller behöver hjälp kan du kontakta vårt supportteam",tI="Villkor",nI="Din e-postadress behöver valideras. Vi har skickat ett nytt e-postmeddelande till din inkorg",iI="Kontot existerar inte",rI="Kontot extisterar inte",sI="Vi kan inte hitta en användare med denna eposten. Vänligen försök igen.",oI="Försök igen.",aI="Validera kod",cI="Kontrollera din inkorg för instruktioner om validering av e-post.",lI="Registrerad",uI="Klicka på knappen för att verifiera din e-postadress",dI="Bekräfta din e-postadress",pI="Bekräfta din e-postadress",fI="Verifiera konto",hI="Ange engångskod",gI="Vänligen kontrollera din e-post för <0>{{email}}</0> och ange den sexsiffriga koden som vi har skickat till dig.",_I="Välkommen",mI="Välkommen till ditt {{vendorName}}-konto!",yI="Fortsätt med konto",vI="Ja, fortsätt med {{text}}",wI="Ja, fortsätt med detta kontot",bI={"Server error: Invalid code":"Koden är inte giltig","Wrong email or verification code":{"":"Fel e-post eller verifieringskod."},account_detected:f2,account_with_sso_provider:h2,agree_to:g2,and:_2,callback_url_mismatch:m2,callback_url_not_allowed:y2,check_email_title:v2,click_to_sign_up_description:w2,code_email_enter_code:b2,code_email_subject:k2,code_email_title:x2,code_valid_30_minutes:S2,confirm_password:A2,contact_support:I2,contact_us:E2,continue:"Fortsätt",continue_social_login:z2,continue_with:$2,continue_with_sso_provider_headline:C2,copyright:j2,copyright_sesamy:N2,create_account_description:O2,create_account_email_invalid:B2,create_account_passwords_didnt_match:T2,create_account_title:R2,create_account_weak_password:P2,create_new_account_link:L2,create_password_account_title:U2,currently_logged_in_as:V2,email:M2,email_placeholder:H2,email_validated:D2,email_validated_cta:q2,email_verification_for_signup_sent_description:F2,email_verification_for_signup_sent_title:K2,enter_a_code_btn:W2,enter_email_for_verification_description:G2,enter_new_password_placeholder:J2,enter_password:Z2,enter_password_description:Y2,enter_your_password_btn:X2,expired_code:Q2,fokus_info_message:eA,forgot_password_cta:tA,forgot_password_description:nA,forgot_password_email_sent:iA,forgot_password_link:rA,forgot_password_title:sA,go_back:oA,"invalid-email":"Ogiltig e-postadress",invalid_password:aA,invalid_session_body:cA,invalid_session_title:lA,link_email_click_to_login:uA,link_email_login:dA,link_email_or_enter_code:pA,link_page_body:fA,link_page_headline:hA,logged_in_as:gA,login:_A,login_description:mA,login_description_code:yA,login_description_link:vA,logout:wA,no_use_another:bA,or:kA,password:xA,password_has_been_reset:SA,password_has_been_reset_title:AA,password_reset_subject:IA,password_reset_title:EA,privacy_policy:zA,redirecting:$A,reenter_new_password_placeholder:CA,register_password_account:jA,resend_code:NA,reset_password_cta:OA,reset_password_description:BA,reset_password_email_click_to_reset:TA,reset_password_email_cta:RA,reset_password_email_reset:PA,reset_password_subject:LA,reset_password_title:UA,send:VA,send_me_a_new_magic_link:MA,sent_code_spam:HA,set_password:DA,sign_in:qA,signup:FA,signup_success:KA,spotify_already_linked_body:WA,spotify_already_linked_cta:GA,spotify_already_linked_step1_body:JA,spotify_already_linked_step1_title:ZA,spotify_already_linked_step2_body:YA,spotify_already_linked_step2_title:XA,spotify_already_linked_title:QA,support_info:eI,terms:tI,unverified_email:nI,user_account_does_not_exist:iI,user_not_found:rI,user_not_found_body:sI,user_not_found_cta:oI,validate_code:aI,validate_email_body:cI,validate_email_title:lI,verify_email_click_to_verify:uI,verify_email_subject:dI,verify_email_title:pI,verify_email_verify:fI,verify_your_email:hI,we_sent_a_code_to:gI,welcome:_I,welcome_to_your_account:mI,yes_continue:yI,yes_continue_with:vI,yes_continue_with_existing_account:wI},kI="Wykryto konto",xI="Wykryliśmy, że użytkownik utworzył już konto za pośrednictwem",SI="Logując się, wyrażasz zgodę na nasze",AI="i",II="Niezgodność adresu URL wywołania zwrotnego",EI="Podany adres redirect_uri nie znajduje się na liście dozwolonych adresów URL wywołania zwrotnego.",zI="kontynuować z użytkownikiem",$I="Kliknij przycisk, aby utworzyć nowe konto z hasłem.",CI="Wpisz kod na stronie {{vendorName}}, aby się zalogować.",jI="Witamy na {{vendorName}}! {{code}} to kod logowania do Twojego konta.",NI="Witamy na {{vendorName}}! {{code}} to kod logowania.",OI="Kod jest ważny przez 30 minut",BI="Potwierdź hasło",TI="Potrzebujesz pomocy?",RI="Skontaktuj się z nami",PI="lub kontynuować korzystanie z konta społecznościowego",LI="Kontynuuj {{provider}}",UI="Czy chcesz kontynuować korzystanie z istniejącego konta?",VI="Copyright © 2023 SESAMY. Wszelkie prawa zastrzeżone.",MI="©2023 Sesamy",HI="Wybierz hasło składające się z małych i wielkich liter, cyfr i symboli.",DI="Wprowadź prawidłowy adres e-mail.",qI="Hasła nie są zgodne. Spróbuj ponownie.",FI="Wybierz hasło",KI="Hasło musi mieć co najmniej 8 znaków i zawierać co najmniej jedną małą literę, jedną wielką literę, jedną cyfrę i jeden symbol.",WI="Utwórz nowe konto",GI="Zarejestruj się przy użyciu hasła",JI="Jesteś obecnie zalogowany jako <0>{{email}}</0>",ZI="E-mail",YI="Adres e-mail",XI="Twój adres e-mail został zweryfikowany",QI="Teraz wprowadź hasło, aby zalogować się ponownie",e4="Wiadomość e-mail została wysłana do <0>{{email}}</0> z linkiem weryfikacyjnym. Kliknij łącze, aby zweryfikować swój adres e-mail i ustawić hasło.",t4="Wysłano weryfikację e-mail",n4="Wprowadź kod",i4="Wyślemy Ci link weryfikacyjny, aby upewnić się, że posiadasz ten adres e-mail.",r4="Wprowadź nowe hasło",s4="Wprowadź hasło",o4="Wprowadź swój adres e-mail i hasło, aby się zalogować.",a4="Wprowadź hasło",c4="Magiczny link wygasł. Kliknij poniższy przycisk, aby otrzymać nowy link w skrzynce odbiorczej.",l4="Zaktualizowaliśmy sposób logowania. <0>Kliknij tutaj, aby dowiedzieć się więcej.</0>",u4="Wyślij wiadomość e-mail z resetem hasła",d4="Kliknij poniższy przycisk, a my wyślemy Ci instrukcje, jak zresetować hasło.",p4="Wysłano wiadomość e-mail z resetem hasła",f4="Zapomniałeś hasła?",h4="Zapomniałeś hasła?",g4="Wróć",_4="Nieprawidłowe hasło",m4=`Link jest już nieaktualny.
209
209
 
210
210
  Upewnij się, że otworzyłeś link logowania w tej samej przeglądarce, w której rozpocząłeś logowanie.
211
211
 
212
- Możesz kliknąć poniższy link, aby rozpocząć nowe logowanie.`,g4="Nieprawidłowy link",_4="Kliknij przycisk, aby się zalogować",m4="Zaloguj się",y4="Lub wprowadź kod na stronie {{vendorName}}, aby dokończyć logowanie.",v4="Wprowadź swój adres e-mail, aby odblokować ten program na {{service}}",w4="Połącz swoje konto z {{service}}",b4="Jesteś zalogowany jako",k4="Logowanie",x4="Wprowadź swój adres e-mail, aby się zalogować.",S4="Wprowadź swój adres e-mail, a my wyślemy Ci kod logowania.",A4="Wprowadź swój adres e-mail, a my wyślemy Ci link do logowania.",I4="Wylogowanie",E4="Nie, chcę użyć innego konta",$4="lub",C4="Hasło",z4="Hasło zostało zresetowane",j4="Sukces",N4="Zmień hasło do konta {{vendorName}} ",O4="Zmiana hasła do konta {{vendorName}} ",B4="Polityka prywatności",T4="Przekierowanie",R4="Potwierdź hasło",P4="Zarejestruj nowe hasło",L4="Wyślij ponownie kod",U4="Zmiana hasła",V4="Wprowadź poniżej nowe hasło do konta e-mail: ",M4="Kliknij przycisk, aby zresetować hasło",H4="Kliknij przycisk, aby zresetować hasło",D4="Zmień hasło",F4="Zmiana hasła do konta {{vendorName}} ",q4="Resetowanie hasła",K4="Wyślij",W4="Wyślij mi nowy magiczny link",G4="Pamiętaj, aby sprawdzić folder spamu, jeśli wiadomość e-mail nie dotarła.",J4="Ustaw hasło",Z4="Zaloguj się",Y4="Rejestracja",X4="Rejestracja zakończona sukcesem",Q4="Wygląda na to, że Twoje konto Spotify jest obecnie połączone z innym kontem Sesamy. Ale nie martw się, jesteśmy tutaj, aby poprowadzić Cię przez proces, aby to naprawić.",eE="Przejdź do strony dostępu do treści Spotify",tE='Zacznijmy od odłączenia konta Spotify. Kliknij poniższy przycisk, aby przejść do strony dostępu do treści Spotify. Po zalogowaniu się na swoje konto Spotify, znajdź Sesamy na liście połączonych platform. Kliknij "Odłącz" obok logo Sesamy.',nE="Krok 1: Odłącz swoje konto Spotify",iE="Po pomyślnym odłączeniu konta Spotify możesz ponownie połączyć je z Sesamy. Wystarczy powtórzyć poprzednie kroki, które doprowadziły Cię do tej strony.",rE="Krok 2: Połącz ponownie swoje konto Spotify z Sesamy",sE="Ups! Twoje konto Spotify jest już połączone",oE="Jeśli masz pytania lub potrzebujesz pomocy, skontaktuj się z nami",aE="Zasady i warunki",cE="Twój adres e-mail wymaga weryfikacji. Wysłaliśmy nową wiadomość e-mail na Twoją skrzynkę odbiorczą",lE="Konto użytkownika nie istnieje",uE="Konto użytkownika nie istnieje",dE="Nie mogliśmy znaleźć użytkownika o podanym adresie e-mail. Spróbuj ponownie.",pE="Spróbuj ponownie.",fE="Sprawdź poprawność kodu",hE="Sprawdź swoją skrzynkę odbiorczą, aby uzyskać instrukcje dotyczące weryfikacji wiadomości e-mail.",gE="Zarejestrowany",_E="Kliknij przycisk, aby zweryfikować swój adres e-mail",mE="Potwierdź swój adres e-mail",yE="Potwierdź swój adres e-mail",vE="Zweryfikuj konto",wE="Zweryfikuj swój adres e-mail",bE="Sprawdź swoją skrzynkę e-mail pod adresem <0>{{email}}</0> i wprowadź sześciocyfrowy kod, który wysłaliśmy.",kE="Witamy",xE="Witamy na koncie {{vendorName}}!",SE="Kontynuuj korzystanie z tego konta",AE="Tak, kontynuuj {{text}}",IE="Tak, kontynuuj korzystanie z istniejącego konta",EE={"Server error: Invalid code":"Nieprawidłowy kod","Wrong email or verification code":{"":"Nieprawidłowy adres e-mail lub kod weryfikacyjny."},account_detected:vI,account_with_sso_provider:wI,agree_to:bI,and:kI,callback_url_mismatch:xI,callback_url_not_allowed:SI,check_email_title:AI,click_to_sign_up_description:II,code_email_enter_code:EI,code_email_subject:$I,code_email_title:CI,code_valid_30_minutes:zI,confirm_password:jI,contact_support:NI,contact_us:OI,continue:"Kontynuuj",continue_social_login:BI,continue_with:TI,continue_with_sso_provider_headline:RI,copyright:PI,copyright_sesamy:LI,create_account_description:UI,create_account_email_invalid:VI,create_account_passwords_didnt_match:MI,create_account_title:HI,create_account_weak_password:DI,create_new_account_link:FI,create_password_account_title:qI,currently_logged_in_as:KI,email:WI,email_placeholder:GI,email_validated:JI,email_validated_cta:ZI,email_verification_for_signup_sent_description:YI,email_verification_for_signup_sent_title:XI,enter_a_code_btn:QI,enter_email_for_verification_description:e4,enter_new_password_placeholder:t4,enter_password:n4,enter_password_description:i4,enter_your_password_btn:r4,expired_code:s4,fokus_info_message:o4,forgot_password_cta:a4,forgot_password_description:c4,forgot_password_email_sent:l4,forgot_password_link:u4,forgot_password_title:d4,go_back:p4,"invalid-email":"Nieprawidłowy adres e-mail",invalid_password:f4,invalid_session_body:h4,invalid_session_title:g4,link_email_click_to_login:_4,link_email_login:m4,link_email_or_enter_code:y4,link_page_body:v4,link_page_headline:w4,logged_in_as:b4,login:k4,login_description:x4,login_description_code:S4,login_description_link:A4,logout:I4,no_use_another:E4,or:$4,password:C4,password_has_been_reset:z4,password_has_been_reset_title:j4,password_reset_subject:N4,password_reset_title:O4,privacy_policy:B4,redirecting:T4,reenter_new_password_placeholder:R4,register_password_account:P4,resend_code:L4,reset_password_cta:U4,reset_password_description:V4,reset_password_email_click_to_reset:M4,reset_password_email_cta:H4,reset_password_email_reset:D4,reset_password_subject:F4,reset_password_title:q4,send:K4,send_me_a_new_magic_link:W4,sent_code_spam:G4,set_password:J4,sign_in:Z4,signup:Y4,signup_success:X4,spotify_already_linked_body:Q4,spotify_already_linked_cta:eE,spotify_already_linked_step1_body:tE,spotify_already_linked_step1_title:nE,spotify_already_linked_step2_body:iE,spotify_already_linked_step2_title:rE,spotify_already_linked_title:sE,support_info:oE,terms:aE,unverified_email:cE,user_account_does_not_exist:lE,user_not_found:uE,user_not_found_body:dE,user_not_found_cta:pE,validate_code:fE,validate_email_body:hE,validate_email_title:gE,verify_email_click_to_verify:_E,verify_email_subject:mE,verify_email_title:yE,verify_email_verify:vE,verify_your_email:wE,we_sent_a_code_to:bE,welcome:kE,welcome_to_your_account:xE,yes_continue:SE,yes_continue_with:AE,yes_continue_with_existing_account:IE},$E="Zjištěný účet",CE="Zjistili jsme, že jste si již vytvořili účet prostřednictvím",zE="Přihlášením souhlasíte s našimi",jE="a",NE="Neshoda adresy URL zpětného volání",OE="Zadané redirect_uri není v seznamu povolených zpětných adres URL.",BE="pokračovat s uživatelem",TE="Klikněte na tlačítko pro vytvoření nového účtu s heslem.",RE="Pro dokončení přihlášení zadejte kód na adrese {{vendorName}}.",PE="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",LE="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",UE="Kód je platný po dobu 30 minut",VE="Potvrzení hesla",ME="Potřebujete pomoc?",HE="Kontaktujte nás",DE="nebo pokračovat v sociálním účtu",FE="Pokračovat s {{provider}}",qE="Chcete pokračovat ve svém stávajícím účtu?",KE="Copyright © 2023 SESAMY. Všechna práva vyhrazena.",WE="©2023 Sesamy",GE="Zvolte heslo složené z velkých a malých písmen, číslic a symbolů.",JE="Zadejte prosím platnou e-mailovou adresu.",ZE="Hesla se neshodovala. Zkuste to znovu.",YE="Zvolte heslo",XE="Heslo musí mít alespoň 8 znaků a obsahovat alespoň jedno malé písmeno, jedno velké písmeno, jednu číslici a jeden symbol.",QE="Vytvořit nový účet",e$="Zaregistrujte se pomocí hesla",t$="V současné době jste přihlášeni jako <0>{{email}}</0>",n$="E-mail",i$="E-mailová adresa",r$="Vaše e-mailová adresa byla ověřena",s$="Nyní zadejte své heslo a znovu se přihlaste",o$="E-mail byl odeslán na adresu <0>{{email}}</0> s ověřovacím odkazem. Kliknutím na odkaz ověřte svou e-mailovou adresu a nastavte heslo.",a$="Ověření e-mailem odesláno",c$="Zadejte kód",l$="Pošleme vám ověřovací odkaz, abychom se ujistili, že tuto e-mailovou adresu vlastníte.",u$="Zadejte nové heslo",d$="Zadejte heslo",p$="Pro přihlášení zadejte svou e-mailovou adresu a heslo.",f$="Zadejte své heslo",h$="Platnost kouzelného odkazu vypršela. Klikněte na tlačítko níže, abyste obdrželi nový odkaz do své e-mailové schránky.",g$="Ahoj! Aktualizovali jsme naše přihlašovací prostředí. <0>Klikněte sem a dozvíte se o něm více.</0>",_$="Odeslání e-mailu pro obnovení hesla",m$="Klikněte na tlačítko níže a my vám zašleme pokyny k obnovení hesla.",y$="Odeslání e-mailu s žádostí o obnovení hesla",v$="Zapomněli jste heslo?",w$="Zapomněli jste heslo?",b$="Vrátit se zpět",k$="Neplatné heslo",x$=`Odkaz již není platný.
212
+ Możesz kliknąć poniższy link, aby rozpocząć nowe logowanie.`,y4="Nieprawidłowy link",v4="Kliknij przycisk, aby się zalogować",w4="Zaloguj się",b4="Lub wprowadź kod na stronie {{vendorName}}, aby dokończyć logowanie.",k4="Wprowadź swój adres e-mail, aby odblokować ten program na {{service}}",x4="Połącz swoje konto z {{service}}",S4="Jesteś zalogowany jako",A4="Logowanie",I4="Wprowadź swój adres e-mail, aby się zalogować.",E4="Wprowadź swój adres e-mail, a my wyślemy Ci kod logowania.",z4="Wprowadź swój adres e-mail, a my wyślemy Ci link do logowania.",$4="Wylogowanie",C4="Nie, chcę użyć innego konta",j4="lub",N4="Hasło",O4="Hasło zostało zresetowane",B4="Sukces",T4="Zmień hasło do konta {{vendorName}} ",R4="Zmiana hasła do konta {{vendorName}} ",P4="Polityka prywatności",L4="Przekierowanie",U4="Potwierdź hasło",V4="Zarejestruj nowe hasło",M4="Wyślij ponownie kod",H4="Zmiana hasła",D4="Wprowadź poniżej nowe hasło do konta e-mail: ",q4="Kliknij przycisk, aby zresetować hasło",F4="Kliknij przycisk, aby zresetować hasło",K4="Zmień hasło",W4="Zmiana hasła do konta {{vendorName}} ",G4="Resetowanie hasła",J4="Wyślij",Z4="Wyślij mi nowy magiczny link",Y4="Pamiętaj, aby sprawdzić folder spamu, jeśli wiadomość e-mail nie dotarła.",X4="Ustaw hasło",Q4="Zaloguj się",eE="Rejestracja",tE="Rejestracja zakończona sukcesem",nE="Wygląda na to, że Twoje konto Spotify jest obecnie połączone z innym kontem Sesamy. Ale nie martw się, jesteśmy tutaj, aby poprowadzić Cię przez proces, aby to naprawić.",iE="Przejdź do strony dostępu do treści Spotify",rE='Zacznijmy od odłączenia konta Spotify. Kliknij poniższy przycisk, aby przejść do strony dostępu do treści Spotify. Po zalogowaniu się na swoje konto Spotify, znajdź Sesamy na liście połączonych platform. Kliknij "Odłącz" obok logo Sesamy.',sE="Krok 1: Odłącz swoje konto Spotify",oE="Po pomyślnym odłączeniu konta Spotify możesz ponownie połączyć je z Sesamy. Wystarczy powtórzyć poprzednie kroki, które doprowadziły Cię do tej strony.",aE="Krok 2: Połącz ponownie swoje konto Spotify z Sesamy",cE="Ups! Twoje konto Spotify jest już połączone",lE="Jeśli masz pytania lub potrzebujesz pomocy, skontaktuj się z nami",uE="Zasady i warunki",dE="Twój adres e-mail wymaga weryfikacji. Wysłaliśmy nową wiadomość e-mail na Twoją skrzynkę odbiorczą",pE="Konto użytkownika nie istnieje",fE="Konto użytkownika nie istnieje",hE="Nie mogliśmy znaleźć użytkownika o podanym adresie e-mail. Spróbuj ponownie.",gE="Spróbuj ponownie.",_E="Sprawdź poprawność kodu",mE="Sprawdź swoją skrzynkę odbiorczą, aby uzyskać instrukcje dotyczące weryfikacji wiadomości e-mail.",yE="Zarejestrowany",vE="Kliknij przycisk, aby zweryfikować swój adres e-mail",wE="Potwierdź swój adres e-mail",bE="Potwierdź swój adres e-mail",kE="Zweryfikuj konto",xE="Zweryfikuj swój adres e-mail",SE="Sprawdź swoją skrzynkę e-mail pod adresem <0>{{email}}</0> i wprowadź sześciocyfrowy kod, który wysłaliśmy.",AE="Witamy",IE="Witamy na koncie {{vendorName}}!",EE="Kontynuuj korzystanie z tego konta",zE="Tak, kontynuuj {{text}}",$E="Tak, kontynuuj korzystanie z istniejącego konta",CE={"Server error: Invalid code":"Nieprawidłowy kod","Wrong email or verification code":{"":"Nieprawidłowy adres e-mail lub kod weryfikacyjny."},account_detected:kI,account_with_sso_provider:xI,agree_to:SI,and:AI,callback_url_mismatch:II,callback_url_not_allowed:EI,check_email_title:zI,click_to_sign_up_description:$I,code_email_enter_code:CI,code_email_subject:jI,code_email_title:NI,code_valid_30_minutes:OI,confirm_password:BI,contact_support:TI,contact_us:RI,continue:"Kontynuuj",continue_social_login:PI,continue_with:LI,continue_with_sso_provider_headline:UI,copyright:VI,copyright_sesamy:MI,create_account_description:HI,create_account_email_invalid:DI,create_account_passwords_didnt_match:qI,create_account_title:FI,create_account_weak_password:KI,create_new_account_link:WI,create_password_account_title:GI,currently_logged_in_as:JI,email:ZI,email_placeholder:YI,email_validated:XI,email_validated_cta:QI,email_verification_for_signup_sent_description:e4,email_verification_for_signup_sent_title:t4,enter_a_code_btn:n4,enter_email_for_verification_description:i4,enter_new_password_placeholder:r4,enter_password:s4,enter_password_description:o4,enter_your_password_btn:a4,expired_code:c4,fokus_info_message:l4,forgot_password_cta:u4,forgot_password_description:d4,forgot_password_email_sent:p4,forgot_password_link:f4,forgot_password_title:h4,go_back:g4,"invalid-email":"Nieprawidłowy adres e-mail",invalid_password:_4,invalid_session_body:m4,invalid_session_title:y4,link_email_click_to_login:v4,link_email_login:w4,link_email_or_enter_code:b4,link_page_body:k4,link_page_headline:x4,logged_in_as:S4,login:A4,login_description:I4,login_description_code:E4,login_description_link:z4,logout:$4,no_use_another:C4,or:j4,password:N4,password_has_been_reset:O4,password_has_been_reset_title:B4,password_reset_subject:T4,password_reset_title:R4,privacy_policy:P4,redirecting:L4,reenter_new_password_placeholder:U4,register_password_account:V4,resend_code:M4,reset_password_cta:H4,reset_password_description:D4,reset_password_email_click_to_reset:q4,reset_password_email_cta:F4,reset_password_email_reset:K4,reset_password_subject:W4,reset_password_title:G4,send:J4,send_me_a_new_magic_link:Z4,sent_code_spam:Y4,set_password:X4,sign_in:Q4,signup:eE,signup_success:tE,spotify_already_linked_body:nE,spotify_already_linked_cta:iE,spotify_already_linked_step1_body:rE,spotify_already_linked_step1_title:sE,spotify_already_linked_step2_body:oE,spotify_already_linked_step2_title:aE,spotify_already_linked_title:cE,support_info:lE,terms:uE,unverified_email:dE,user_account_does_not_exist:pE,user_not_found:fE,user_not_found_body:hE,user_not_found_cta:gE,validate_code:_E,validate_email_body:mE,validate_email_title:yE,verify_email_click_to_verify:vE,verify_email_subject:wE,verify_email_title:bE,verify_email_verify:kE,verify_your_email:xE,we_sent_a_code_to:SE,welcome:AE,welcome_to_your_account:IE,yes_continue:EE,yes_continue_with:zE,yes_continue_with_existing_account:$E},jE="Zjištěný účet",NE="Zjistili jsme, že jste si již vytvořili účet prostřednictvím",OE="Přihlášením souhlasíte s našimi",BE="a",TE="Neshoda adresy URL zpětného volání",RE="Zadané redirect_uri není v seznamu povolených zpětných adres URL.",PE="pokračovat s uživatelem",LE="Klikněte na tlačítko pro vytvoření nového účtu s heslem.",UE="Pro dokončení přihlášení zadejte kód na adrese {{vendorName}}.",VE="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",ME="Vítejte na {{vendorName}}! {{code}} je přihlašovací kód.",HE="Kód je platný po dobu 30 minut",DE="Potvrzení hesla",qE="Potřebujete pomoc?",FE="Kontaktujte nás",KE="nebo pokračovat v sociálním účtu",WE="Pokračovat s {{provider}}",GE="Chcete pokračovat ve svém stávajícím účtu?",JE="Copyright © 2023 SESAMY. Všechna práva vyhrazena.",ZE="©2023 Sesamy",YE="Zvolte heslo složené z velkých a malých písmen, číslic a symbolů.",XE="Zadejte prosím platnou e-mailovou adresu.",QE="Hesla se neshodovala. Zkuste to znovu.",ez="Zvolte heslo",tz="Heslo musí mít alespoň 8 znaků a obsahovat alespoň jedno malé písmeno, jedno velké písmeno, jednu číslici a jeden symbol.",nz="Vytvořit nový účet",iz="Zaregistrujte se pomocí hesla",rz="V současné době jste přihlášeni jako <0>{{email}}</0>",sz="E-mail",oz="E-mailová adresa",az="Vaše e-mailová adresa byla ověřena",cz="Nyní zadejte své heslo a znovu se přihlaste",lz="E-mail byl odeslán na adresu <0>{{email}}</0> s ověřovacím odkazem. Kliknutím na odkaz ověřte svou e-mailovou adresu a nastavte heslo.",uz="Ověření e-mailem odesláno",dz="Zadejte kód",pz="Pošleme vám ověřovací odkaz, abychom se ujistili, že tuto e-mailovou adresu vlastníte.",fz="Zadejte nové heslo",hz="Zadejte heslo",gz="Pro přihlášení zadejte svou e-mailovou adresu a heslo.",_z="Zadejte své heslo",mz="Platnost kouzelného odkazu vypršela. Klikněte na tlačítko níže, abyste obdrželi nový odkaz do své e-mailové schránky.",yz="Ahoj! Aktualizovali jsme naše přihlašovací prostředí. <0>Klikněte sem a dozvíte se o něm více.</0>",vz="Odeslání e-mailu pro obnovení hesla",wz="Klikněte na tlačítko níže a my vám zašleme pokyny k obnovení hesla.",bz="Odeslání e-mailu s žádostí o obnovení hesla",kz="Zapomněli jste heslo?",xz="Zapomněli jste heslo?",Sz="Vrátit se zpět",Az="Neplatné heslo",Iz=`Odkaz již není platný.
213
213
 
214
214
  Ujistěte se, že jste odkaz na přihlášení otevřeli ve stejném prohlížeči, ve kterém jste přihlášení zahájili.
215
215
 
216
- Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,S$="Neplatný odkaz",A$="Kliknutím na tlačítko se přihlásíte",I$="Přihlášení",E$="Nebo zadejte kód na adrese {{vendorName}} a dokončete přihlášení.",$$="Zadejte svou e-mailovou adresu pro odemknutí tohoto pořadu na {{service}}",C$="Propojte svůj účet s {{service}}",z$="Jste přihlášeni jako",j$="Přihlášení",N$="Pro přihlášení zadejte svou e-mailovou adresu.",O$="Zadejte svou e-mailovou adresu a my vám zašleme přihlašovací kód.",B$="Zadejte svou e-mailovou adresu a my vám zašleme odkaz pro přihlášení.",T$="Odhlášení",R$="Ne, chci použít jiný účet",P$="nebo",L$="Heslo",U$="Heslo bylo resetováno",V$="Úspěch",M$="Změna hesla k účtu {{vendorName}} ",H$="Změna hesla k účtu {{vendorName}} ",D$="Zásady ochrany osobních údajů",F$="Přesměrování",q$="Potvrzení hesla",K$="Registrace nového hesla",W$="Opětovné odeslání kódu",G$="Změna hesla",J$="Níže zadejte nové heslo k e-mailovému účtu: ",Z$="Kliknutím na tlačítko obnovíte své heslo",Y$="Kliknutím na tlačítko obnovíte své heslo",X$="Obnovení hesla",Q$="Změna hesla k účtu {{vendorName}} ",e6="Obnovení hesla",t6="Odeslat",n6="Pošlete mi nový kouzelný odkaz",i6="Pokud e-mail nedorazil, nezapomeňte zkontrolovat složku nevyžádané pošty.",r6="Nastavení hesla",s6="Přihlásit se",o6="Registrace",a6="Úspěšná registrace",c6="Zdá se, že váš účet Spotify je v současné době propojen s jiným účtem Sesamy. Ale nebojte se, jsme tu, abychom vás provedli procesem, jak to napravit.",l6="Přejděte na stránku Spotify pro přístup k obsahu",u6='Začněme odpojením účtu Spotify. Kliknutím na tlačítko níže přejděte na stránku přístupu k obsahu služby Spotify. Po přihlášení k účtu Spotify najděte v seznamu připojených platforem položku Sesamy. Klikněte na tlačítko "Unlink" vedle loga Sesamy.',d6="Krok 1: Odpojení účtu Spotify",p6="Po úspěšném odpojení účtu Spotify jej můžete znovu propojit se službou Sesamy. Stačí zopakovat předchozí kroky, které vás přivedly na tuto stránku.",f6="Krok 2: Propojení účtu Spotify s aplikací Sesamy",h6="Ups! Váš účet Spotify je již propojen",g6="Pokud máte dotazy nebo potřebujete pomoc, můžete se obrátit na náš tým podpory.",_6="Podmínky a pravidla",m6="Vaši e-mailovou adresu je třeba ověřit. Do vaší e-mailové schránky jsme odeslali nový e-mail.",y6="Uživatelský účet neexistuje",v6="Uživatelský účet neexistuje",w6="Nepodařilo se nám najít uživatele se zadanou e-mailovou adresou. Zkuste to prosím znovu.",b6="Zkuste to znovu.",k6="Ověření kódu",x6="Pokyny k ověření e-mailu najdete ve své e-mailové schránce.",S6="Zaregistrovali jste se",A6="Klikněte na tlačítko pro ověření e-mailové adresy",I6="Ověřte svou e-mailovou adresu",E6="Ověřte svou e-mailovou adresu",$6="Ověření účtu",C6="Ověření e-mailu",z6="Zkontrolujte si prosím svůj e-mail na adrese <0>{{email}}</0> a zadejte šestimístný kód, který jsme vám zaslali.",j6="Vítejte na",N6="Vítejte na svém účtu {{vendorName}}!",O6="Pokračujte s tímto účtem",B6="Ano, pokračujte {{text}}",T6="Ano, pokračujte ve stávajícím účtu",R6={"Server error: Invalid code":"Neplatný kód","Wrong email or verification code":{"":"Špatný e-mail nebo ověřovací kód."},account_detected:$E,account_with_sso_provider:CE,agree_to:zE,and:jE,callback_url_mismatch:NE,callback_url_not_allowed:OE,check_email_title:BE,click_to_sign_up_description:TE,code_email_enter_code:RE,code_email_subject:PE,code_email_title:LE,code_valid_30_minutes:UE,confirm_password:VE,contact_support:ME,contact_us:HE,continue:"Pokračovat",continue_social_login:DE,continue_with:FE,continue_with_sso_provider_headline:qE,copyright:KE,copyright_sesamy:WE,create_account_description:GE,create_account_email_invalid:JE,create_account_passwords_didnt_match:ZE,create_account_title:YE,create_account_weak_password:XE,create_new_account_link:QE,create_password_account_title:e$,currently_logged_in_as:t$,email:n$,email_placeholder:i$,email_validated:r$,email_validated_cta:s$,email_verification_for_signup_sent_description:o$,email_verification_for_signup_sent_title:a$,enter_a_code_btn:c$,enter_email_for_verification_description:l$,enter_new_password_placeholder:u$,enter_password:d$,enter_password_description:p$,enter_your_password_btn:f$,expired_code:h$,fokus_info_message:g$,forgot_password_cta:_$,forgot_password_description:m$,forgot_password_email_sent:y$,forgot_password_link:v$,forgot_password_title:w$,go_back:b$,"invalid-email":"Neplatný e-mail",invalid_password:k$,invalid_session_body:x$,invalid_session_title:S$,link_email_click_to_login:A$,link_email_login:I$,link_email_or_enter_code:E$,link_page_body:$$,link_page_headline:C$,logged_in_as:z$,login:j$,login_description:N$,login_description_code:O$,login_description_link:B$,logout:T$,no_use_another:R$,or:P$,password:L$,password_has_been_reset:U$,password_has_been_reset_title:V$,password_reset_subject:M$,password_reset_title:H$,privacy_policy:D$,redirecting:F$,reenter_new_password_placeholder:q$,register_password_account:K$,resend_code:W$,reset_password_cta:G$,reset_password_description:J$,reset_password_email_click_to_reset:Z$,reset_password_email_cta:Y$,reset_password_email_reset:X$,reset_password_subject:Q$,reset_password_title:e6,send:t6,send_me_a_new_magic_link:n6,sent_code_spam:i6,set_password:r6,sign_in:s6,signup:o6,signup_success:a6,spotify_already_linked_body:c6,spotify_already_linked_cta:l6,spotify_already_linked_step1_body:u6,spotify_already_linked_step1_title:d6,spotify_already_linked_step2_body:p6,spotify_already_linked_step2_title:f6,spotify_already_linked_title:h6,support_info:g6,terms:_6,unverified_email:m6,user_account_does_not_exist:y6,user_not_found:v6,user_not_found_body:w6,user_not_found_cta:b6,validate_code:k6,validate_email_body:x6,validate_email_title:S6,verify_email_click_to_verify:A6,verify_email_subject:I6,verify_email_title:E6,verify_email_verify:$6,verify_your_email:C6,we_sent_a_code_to:z6,welcome:j6,welcome_to_your_account:N6,yes_continue:O6,yes_continue_with:B6,yes_continue_with_existing_account:T6},P6="Tili havaittu",L6="Olemme havainneet, että olet jo luonut tilin kautta",U6="Kirjautumalla sisään hyväksyt",V6="ja",M6="Takaisinkutsun URL-osoite ei vastaa toisiaan",H6="Annettu redirect_uri ei ole sallittujen takaisinsoitto-URL-osoitteiden luettelossa.",D6="jatka käyttäjän kanssa",F6="Klikkaa painiketta luodaksesi uuden salasanatilin.",q6="Kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",K6="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",W6="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",G6="Koodi on voimassa 30 minuuttia",J6="Vahvista salasana",Z6="Tarvitsetko apua?",Y6="Ota yhteyttä",X6="tai jatka sosiaalisella tilillä",Q6="Jatka {{provider}}",eC="Haluatko jatkaa olemassa olevalla tililläsi?",tC="Copyright © 2023 SESAMY. Kaikki oikeudet pidätetään.",nC="©2023 Sesamy",iC="Valitse salasana, jossa on isoja ja pieniä kirjaimia, numeroita ja symboleja.",rC="Kirjoita voimassa oleva sähköpostiosoite.",sC="Salasanat eivät vastanneet toisiaan. Yritä uudelleen.",oC="Valitse salasana",aC="Salasanan on oltava vähintään 8 merkkiä pitkä ja sisällettävä vähintään yksi pieni kirjain, yksi iso kirjain, yksi numero ja yksi symboli.",cC="Luo uusi tili",lC="Rekisteröidy salasanalla",uC="Olet tällä hetkellä kirjautuneena sisään nimellä <0>{{email}}</0>",dC="Sähköposti",pC="Sähköpostiosoite",fC="Sähköpostiosoitteesi on vahvistettu",hC="Kirjoita nyt salasanasi kirjautuaksesi uudelleen",gC="Sähköposti on lähetetty osoitteeseen <0>{{email}}</0> jossa on vahvistuslinkki. Klikkaa linkkiä vahvistaaksesi sähköpostiosoitteesi ja asettaaksesi salasanan.",_C="Sähköpostivarmennus lähetetty",mC="Syötä koodi",yC="Lähetämme sinulle vahvistuslinkin varmistaaksemme, että omistat tämän sähköpostiosoitteen.",vC="Anna uusi salasana",wC="Anna salasana",bC="Anna sähköpostiosoitteesi ja salasanasi kirjautuaksesi sisään.",kC="Syötä salasanasi",xC="Taikalinkki on vanhentunut. Klikkaa alla olevaa painiketta saadaksesi uuden linkin sähköpostiisi.",SC="Hei! Päivitimme kirjautumiskokemuksemme. <0>Klikkaa tästä saadaksesi lisätietoja siitä.</0>",AC="Lähetä salasanan palautussähköposti",IC="Napsauta alla olevaa painiketta, niin lähetämme ohjeet salasanasi palauttamiseen.",EC="Salasanan palautussähköposti lähetetty",$C="Unohditko salasanan?",CC="Unohditko salasanan?",zC="Palaa takaisin",jC="Virheellinen salasana",NC=`Linkki ei ole enää voimassa.
216
+ Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,Ez="Neplatný odkaz",zz="Kliknutím na tlačítko se přihlásíte",$z="Přihlášení",Cz="Nebo zadejte kód na adrese {{vendorName}} a dokončete přihlášení.",jz="Zadejte svou e-mailovou adresu pro odemknutí tohoto pořadu na {{service}}",Nz="Propojte svůj účet s {{service}}",Oz="Jste přihlášeni jako",Bz="Přihlášení",Tz="Pro přihlášení zadejte svou e-mailovou adresu.",Rz="Zadejte svou e-mailovou adresu a my vám zašleme přihlašovací kód.",Pz="Zadejte svou e-mailovou adresu a my vám zašleme odkaz pro přihlášení.",Lz="Odhlášení",Uz="Ne, chci použít jiný účet",Vz="nebo",Mz="Heslo",Hz="Heslo bylo resetováno",Dz="Úspěch",qz="Změna hesla k účtu {{vendorName}} ",Fz="Změna hesla k účtu {{vendorName}} ",Kz="Zásady ochrany osobních údajů",Wz="Přesměrování",Gz="Potvrzení hesla",Jz="Registrace nového hesla",Zz="Opětovné odeslání kódu",Yz="Změna hesla",Xz="Níže zadejte nové heslo k e-mailovému účtu: ",Qz="Kliknutím na tlačítko obnovíte své heslo",e$="Kliknutím na tlačítko obnovíte své heslo",t$="Obnovení hesla",n$="Změna hesla k účtu {{vendorName}} ",i$="Obnovení hesla",r$="Odeslat",s$="Pošlete mi nový kouzelný odkaz",o$="Pokud e-mail nedorazil, nezapomeňte zkontrolovat složku nevyžádané pošty.",a$="Nastavení hesla",c$="Přihlásit se",l$="Registrace",u$="Úspěšná registrace",d$="Zdá se, že váš účet Spotify je v současné době propojen s jiným účtem Sesamy. Ale nebojte se, jsme tu, abychom vás provedli procesem, jak to napravit.",p$="Přejděte na stránku Spotify pro přístup k obsahu",f$='Začněme odpojením účtu Spotify. Kliknutím na tlačítko níže přejděte na stránku přístupu k obsahu služby Spotify. Po přihlášení k účtu Spotify najděte v seznamu připojených platforem položku Sesamy. Klikněte na tlačítko "Unlink" vedle loga Sesamy.',h$="Krok 1: Odpojení účtu Spotify",g$="Po úspěšném odpojení účtu Spotify jej můžete znovu propojit se službou Sesamy. Stačí zopakovat předchozí kroky, které vás přivedly na tuto stránku.",_$="Krok 2: Propojení účtu Spotify s aplikací Sesamy",m$="Ups! Váš účet Spotify je již propojen",y$="Pokud máte dotazy nebo potřebujete pomoc, můžete se obrátit na náš tým podpory.",v$="Podmínky a pravidla",w$="Vaši e-mailovou adresu je třeba ověřit. Do vaší e-mailové schránky jsme odeslali nový e-mail.",b$="Uživatelský účet neexistuje",k$="Uživatelský účet neexistuje",x$="Nepodařilo se nám najít uživatele se zadanou e-mailovou adresou. Zkuste to prosím znovu.",S$="Zkuste to znovu.",A$="Ověření kódu",I$="Pokyny k ověření e-mailu najdete ve své e-mailové schránce.",E$="Zaregistrovali jste se",z$="Klikněte na tlačítko pro ověření e-mailové adresy",$$="Ověřte svou e-mailovou adresu",C$="Ověřte svou e-mailovou adresu",j$="Ověření účtu",N$="Ověření e-mailu",O$="Zkontrolujte si prosím svůj e-mail na adrese <0>{{email}}</0> a zadejte šestimístný kód, který jsme vám zaslali.",B$="Vítejte na",T$="Vítejte na svém účtu {{vendorName}}!",R$="Pokračujte s tímto účtem",P$="Ano, pokračujte {{text}}",L$="Ano, pokračujte ve stávajícím účtu",U$={"Server error: Invalid code":"Neplatný kód","Wrong email or verification code":{"":"Špatný e-mail nebo ověřovací kód."},account_detected:jE,account_with_sso_provider:NE,agree_to:OE,and:BE,callback_url_mismatch:TE,callback_url_not_allowed:RE,check_email_title:PE,click_to_sign_up_description:LE,code_email_enter_code:UE,code_email_subject:VE,code_email_title:ME,code_valid_30_minutes:HE,confirm_password:DE,contact_support:qE,contact_us:FE,continue:"Pokračovat",continue_social_login:KE,continue_with:WE,continue_with_sso_provider_headline:GE,copyright:JE,copyright_sesamy:ZE,create_account_description:YE,create_account_email_invalid:XE,create_account_passwords_didnt_match:QE,create_account_title:ez,create_account_weak_password:tz,create_new_account_link:nz,create_password_account_title:iz,currently_logged_in_as:rz,email:sz,email_placeholder:oz,email_validated:az,email_validated_cta:cz,email_verification_for_signup_sent_description:lz,email_verification_for_signup_sent_title:uz,enter_a_code_btn:dz,enter_email_for_verification_description:pz,enter_new_password_placeholder:fz,enter_password:hz,enter_password_description:gz,enter_your_password_btn:_z,expired_code:mz,fokus_info_message:yz,forgot_password_cta:vz,forgot_password_description:wz,forgot_password_email_sent:bz,forgot_password_link:kz,forgot_password_title:xz,go_back:Sz,"invalid-email":"Neplatný e-mail",invalid_password:Az,invalid_session_body:Iz,invalid_session_title:Ez,link_email_click_to_login:zz,link_email_login:$z,link_email_or_enter_code:Cz,link_page_body:jz,link_page_headline:Nz,logged_in_as:Oz,login:Bz,login_description:Tz,login_description_code:Rz,login_description_link:Pz,logout:Lz,no_use_another:Uz,or:Vz,password:Mz,password_has_been_reset:Hz,password_has_been_reset_title:Dz,password_reset_subject:qz,password_reset_title:Fz,privacy_policy:Kz,redirecting:Wz,reenter_new_password_placeholder:Gz,register_password_account:Jz,resend_code:Zz,reset_password_cta:Yz,reset_password_description:Xz,reset_password_email_click_to_reset:Qz,reset_password_email_cta:e$,reset_password_email_reset:t$,reset_password_subject:n$,reset_password_title:i$,send:r$,send_me_a_new_magic_link:s$,sent_code_spam:o$,set_password:a$,sign_in:c$,signup:l$,signup_success:u$,spotify_already_linked_body:d$,spotify_already_linked_cta:p$,spotify_already_linked_step1_body:f$,spotify_already_linked_step1_title:h$,spotify_already_linked_step2_body:g$,spotify_already_linked_step2_title:_$,spotify_already_linked_title:m$,support_info:y$,terms:v$,unverified_email:w$,user_account_does_not_exist:b$,user_not_found:k$,user_not_found_body:x$,user_not_found_cta:S$,validate_code:A$,validate_email_body:I$,validate_email_title:E$,verify_email_click_to_verify:z$,verify_email_subject:$$,verify_email_title:C$,verify_email_verify:j$,verify_your_email:N$,we_sent_a_code_to:O$,welcome:B$,welcome_to_your_account:T$,yes_continue:R$,yes_continue_with:P$,yes_continue_with_existing_account:L$},V$="Tili havaittu",M$="Olemme havainneet, että olet jo luonut tilin kautta",H$="Kirjautumalla sisään hyväksyt",D$="ja",q$="Takaisinkutsun URL-osoite ei vastaa toisiaan",F$="Annettu redirect_uri ei ole sallittujen takaisinsoitto-URL-osoitteiden luettelossa.",K$="jatka käyttäjän kanssa",W$="Klikkaa painiketta luodaksesi uuden salasanatilin.",G$="Kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",J$="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",Z$="Tervetuloa osoitteeseen {{vendorName}}! {{code}} on kirjautumiskoodi.",Y$="Koodi on voimassa 30 minuuttia",X$="Vahvista salasana",Q$="Tarvitsetko apua?",e6="Ota yhteyttä",t6="tai jatka sosiaalisella tilillä",n6="Jatka {{provider}}",i6="Haluatko jatkaa olemassa olevalla tililläsi?",r6="Copyright © 2023 SESAMY. Kaikki oikeudet pidätetään.",s6="©2023 Sesamy",o6="Valitse salasana, jossa on isoja ja pieniä kirjaimia, numeroita ja symboleja.",a6="Kirjoita voimassa oleva sähköpostiosoite.",c6="Salasanat eivät vastanneet toisiaan. Yritä uudelleen.",l6="Valitse salasana",u6="Salasanan on oltava vähintään 8 merkkiä pitkä ja sisällettävä vähintään yksi pieni kirjain, yksi iso kirjain, yksi numero ja yksi symboli.",d6="Luo uusi tili",p6="Rekisteröidy salasanalla",f6="Olet tällä hetkellä kirjautuneena sisään nimellä <0>{{email}}</0>",h6="Sähköposti",g6="Sähköpostiosoite",_6="Sähköpostiosoitteesi on vahvistettu",m6="Kirjoita nyt salasanasi kirjautuaksesi uudelleen",y6="Sähköposti on lähetetty osoitteeseen <0>{{email}}</0> jossa on vahvistuslinkki. Klikkaa linkkiä vahvistaaksesi sähköpostiosoitteesi ja asettaaksesi salasanan.",v6="Sähköpostivarmennus lähetetty",w6="Syötä koodi",b6="Lähetämme sinulle vahvistuslinkin varmistaaksemme, että omistat tämän sähköpostiosoitteen.",k6="Anna uusi salasana",x6="Anna salasana",S6="Anna sähköpostiosoitteesi ja salasanasi kirjautuaksesi sisään.",A6="Syötä salasanasi",I6="Taikalinkki on vanhentunut. Klikkaa alla olevaa painiketta saadaksesi uuden linkin sähköpostiisi.",E6="Hei! Päivitimme kirjautumiskokemuksemme. <0>Klikkaa tästä saadaksesi lisätietoja siitä.</0>",z6="Lähetä salasanan palautussähköposti",$6="Napsauta alla olevaa painiketta, niin lähetämme ohjeet salasanasi palauttamiseen.",C6="Salasanan palautussähköposti lähetetty",j6="Unohditko salasanan?",N6="Unohditko salasanan?",O6="Palaa takaisin",B6="Virheellinen salasana",T6=`Linkki ei ole enää voimassa.
217
217
 
218
218
  Varmista, että avaat kirjautumislinkin samalla selaimella, jolla aloitit kirjautumisen.
219
219
 
220
- Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,OC="Virheellinen linkki",BC="Kirjaudu sisään napsauttamalla painiketta",TC="Kirjaudu sisään",RC="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",PC="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",LC="Yhdistä tilisi {{service}}",UC="Olet kirjautunut sisään nimellä",VC="Kirjaudu sisään",MC="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",HC="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",DC="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",FC="Kirjaudu ulos",qC="Ei, haluan käyttää toista tiliä",KC="tai",WC="Salasana",GC="Salasana on nollattu",JC="Menestys",ZC="Vaihda salasana tilillesi {{vendorName}} ",YC="Vaihda salasana tilillesi {{vendorName}} ",XC="Tietosuojakäytäntö",QC="Uudelleenohjaus",e3="Vahvista salasana",t3="Rekisteröi uusi salasana",n3="Lähetä koodi uudelleen",i3="Vaihda salasana",r3="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",s3="Napsauta painiketta salasanasi palauttamiseksi",o3="Napsauta painiketta salasanasi palauttamiseksi",a3="Nollaa salasanasi",c3="Vaihda salasana tilillesi {{vendorName}} ",l3="Nollaa salasana",u3="Lähetä",d3="Lähetä minulle uusi maaginen linkki",p3="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",f3="Aseta salasana",h3="Kirjaudu sisään",g3="Rekisteröityminen",_3="Rekisteröidy onnistuneesti",m3="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",y3="Siirry Spotifyn Content Access -sivulle",v3='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',w3="Vaihe 1: Poista Spotify-tilisi linkitys",b3="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",k3="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",x3="Hups! Spotify-tilisi on jo linkitetty",S3="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",A3="Ehdot ja edellytykset",I3="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",E3="Käyttäjätiliä ei ole olemassa",$3="Käyttäjätiliä ei ole olemassa",C3="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",z3="Yritä uudelleen.",j3="Validoi koodi",N3="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",O3="Rekisteröitynyt",B3="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",T3="Vahvista sähköpostiosoitteesi",R3="Vahvista sähköpostiosoitteesi",P3="Vahvista tili",L3="Vahvista sähköpostiosoitteesi",U3="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",V3="Tervetuloa",M3="Tervetuloa tilillesi {{vendorName}}!",H3="Jatka tällä tilillä",D3="Kyllä, jatka {{text}}",F3="Kyllä, jatka olemassa olevalla tilillä",q3={"Server error: Invalid code":"Virheellinen koodi","Wrong email or verification code":{"":"Väärä sähköpostiosoite tai vahvistuskoodi."},account_detected:P6,account_with_sso_provider:L6,agree_to:U6,and:V6,callback_url_mismatch:M6,callback_url_not_allowed:H6,check_email_title:D6,click_to_sign_up_description:F6,code_email_enter_code:q6,code_email_subject:K6,code_email_title:W6,code_valid_30_minutes:G6,confirm_password:J6,contact_support:Z6,contact_us:Y6,continue:"Jatka",continue_social_login:X6,continue_with:Q6,continue_with_sso_provider_headline:eC,copyright:tC,copyright_sesamy:nC,create_account_description:iC,create_account_email_invalid:rC,create_account_passwords_didnt_match:sC,create_account_title:oC,create_account_weak_password:aC,create_new_account_link:cC,create_password_account_title:lC,currently_logged_in_as:uC,email:dC,email_placeholder:pC,email_validated:fC,email_validated_cta:hC,email_verification_for_signup_sent_description:gC,email_verification_for_signup_sent_title:_C,enter_a_code_btn:mC,enter_email_for_verification_description:yC,enter_new_password_placeholder:vC,enter_password:wC,enter_password_description:bC,enter_your_password_btn:kC,expired_code:xC,fokus_info_message:SC,forgot_password_cta:AC,forgot_password_description:IC,forgot_password_email_sent:EC,forgot_password_link:$C,forgot_password_title:CC,go_back:zC,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:jC,invalid_session_body:NC,invalid_session_title:OC,link_email_click_to_login:BC,link_email_login:TC,link_email_or_enter_code:RC,link_page_body:PC,link_page_headline:LC,logged_in_as:UC,login:VC,login_description:MC,login_description_code:HC,login_description_link:DC,logout:FC,no_use_another:qC,or:KC,password:WC,password_has_been_reset:GC,password_has_been_reset_title:JC,password_reset_subject:ZC,password_reset_title:YC,privacy_policy:XC,redirecting:QC,reenter_new_password_placeholder:e3,register_password_account:t3,resend_code:n3,reset_password_cta:i3,reset_password_description:r3,reset_password_email_click_to_reset:s3,reset_password_email_cta:o3,reset_password_email_reset:a3,reset_password_subject:c3,reset_password_title:l3,send:u3,send_me_a_new_magic_link:d3,sent_code_spam:p3,set_password:f3,sign_in:h3,signup:g3,signup_success:_3,spotify_already_linked_body:m3,spotify_already_linked_cta:y3,spotify_already_linked_step1_body:v3,spotify_already_linked_step1_title:w3,spotify_already_linked_step2_body:b3,spotify_already_linked_step2_title:k3,spotify_already_linked_title:x3,support_info:S3,terms:A3,unverified_email:I3,user_account_does_not_exist:E3,user_not_found:$3,user_not_found_body:C3,user_not_found_cta:z3,validate_code:j3,validate_email_body:N3,validate_email_title:O3,verify_email_click_to_verify:B3,verify_email_subject:T3,verify_email_title:R3,verify_email_verify:P3,verify_your_email:L3,we_sent_a_code_to:U3,welcome:V3,welcome_to_your_account:M3,yes_continue:H3,yes_continue_with:D3,yes_continue_with_existing_account:F3};Ne.init({supportedLngs:["en","it","nb","sv","pl","cs","fi"],fallbackLng:"en",resources:{en:{translation:qb},it:{translation:ex},nb:{translation:l2},sv:{translation:yI},pl:{translation:EE},cs:{translation:R6},fi:{translation:q3}}});function K3(n){const e=new a.OpenAPIHono;e.use(async(s,o)=>(s.env.data=ov(s,n.dataAdapter),o())),e.get("/",s=>s.json({name:"authhero"}));const t=U0();e.route("/api/v2",t);const i=Tv();e.route("/",i);const r=Rv();return e.route("/u",r),{app:e,managementApp:t,oauthApp:i,universalApp:r,createX509Certificate:Ma}}exports.Auth0Client=Nd;exports.AuthorizationResponseMode=Vt;exports.AuthorizationResponseType=Ut;exports.CodeChallengeMethod=ss;exports.GrantType=ci;exports.LogTypes=_e;exports.applicationInsertSchema=hr;exports.applicationSchema=Xt;exports.auth0UserResponseSchema=ft;exports.authParamsSchema=Ka;exports.baseUserSchema=rs;exports.bordersSchema=Rd;exports.brandingSchema=wo;exports.codeInsertSchema=$d;exports.codeSchema=Yh;exports.codeTypeSchema=Ed;exports.colorsSchema=Pd;exports.connectionInsertSchema=gr;exports.connectionSchema=Bt;exports.domainInsertSchema=Cd;exports.domainSchema=Xh;exports.emailProviderSchema=nr;exports.fontDetailsSchema=Zt;exports.fontsSchema=Ld;exports.hookInsertSchema=mr;exports.hookSchema=An;exports.identitySchema=Ad;exports.init=K3;exports.jwksKeySchema=zd;exports.jwksSchema=Wa;exports.logSchema=yr;exports.loginInsertSchema=jd;exports.loginSchema=Qh;exports.openIDConfigurationSchema=bo;exports.pageBackgroundSchema=Ud;exports.parseUserId=rg;exports.passwordInsertSchema=Od;exports.passwordSchema=tg;exports.profileDataSchema=Sd;exports.promptSettingSchema=tr;exports.refreshTokenInsertSchema=Hd;exports.refreshTokenSchema=ig;exports.samlpAddon=Id;exports.sessionInsertSchema=Bd;exports.sessionSchema=Ga;exports.signingKeySchema=ko;exports.tenantInsertSchema=_r;exports.tenantSchema=En;exports.themeInsertSchema=Md;exports.themeSchema=ng;exports.tokenResponseSchema=Td;exports.totalsSchema=Ft;exports.userInsertSchema=fr;exports.userResponseSchema=Kh;exports.userSchema=qa;exports.vendorSettingsSchema=Jh;exports.widgetSchema=Vd;
220
+ Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,R6="Virheellinen linkki",P6="Kirjaudu sisään napsauttamalla painiketta",L6="Kirjaudu sisään",U6="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",V6="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",M6="Yhdistä tilisi {{service}}",H6="Olet kirjautunut sisään nimellä",D6="Kirjaudu sisään",q6="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",F6="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",K6="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",W6="Kirjaudu ulos",G6="Ei, haluan käyttää toista tiliä",J6="tai",Z6="Salasana",Y6="Salasana on nollattu",X6="Menestys",Q6="Vaihda salasana tilillesi {{vendorName}} ",eC="Vaihda salasana tilillesi {{vendorName}} ",tC="Tietosuojakäytäntö",nC="Uudelleenohjaus",iC="Vahvista salasana",rC="Rekisteröi uusi salasana",sC="Lähetä koodi uudelleen",oC="Vaihda salasana",aC="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",cC="Napsauta painiketta salasanasi palauttamiseksi",lC="Napsauta painiketta salasanasi palauttamiseksi",uC="Nollaa salasanasi",dC="Vaihda salasana tilillesi {{vendorName}} ",pC="Nollaa salasana",fC="Lähetä",hC="Lähetä minulle uusi maaginen linkki",gC="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",_C="Aseta salasana",mC="Kirjaudu sisään",yC="Rekisteröityminen",vC="Rekisteröidy onnistuneesti",wC="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",bC="Siirry Spotifyn Content Access -sivulle",kC='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',xC="Vaihe 1: Poista Spotify-tilisi linkitys",SC="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",AC="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",IC="Hups! Spotify-tilisi on jo linkitetty",EC="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",zC="Ehdot ja edellytykset",$C="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",CC="Käyttäjätiliä ei ole olemassa",jC="Käyttäjätiliä ei ole olemassa",NC="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",OC="Yritä uudelleen.",BC="Validoi koodi",TC="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",RC="Rekisteröitynyt",PC="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",LC="Vahvista sähköpostiosoitteesi",UC="Vahvista sähköpostiosoitteesi",VC="Vahvista tili",MC="Vahvista sähköpostiosoitteesi",HC="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",DC="Tervetuloa",qC="Tervetuloa tilillesi {{vendorName}}!",FC="Jatka tällä tilillä",KC="Kyllä, jatka {{text}}",WC="Kyllä, jatka olemassa olevalla tilillä",GC={"Server error: Invalid code":"Virheellinen koodi","Wrong email or verification code":{"":"Väärä sähköpostiosoite tai vahvistuskoodi."},account_detected:V$,account_with_sso_provider:M$,agree_to:H$,and:D$,callback_url_mismatch:q$,callback_url_not_allowed:F$,check_email_title:K$,click_to_sign_up_description:W$,code_email_enter_code:G$,code_email_subject:J$,code_email_title:Z$,code_valid_30_minutes:Y$,confirm_password:X$,contact_support:Q$,contact_us:e6,continue:"Jatka",continue_social_login:t6,continue_with:n6,continue_with_sso_provider_headline:i6,copyright:r6,copyright_sesamy:s6,create_account_description:o6,create_account_email_invalid:a6,create_account_passwords_didnt_match:c6,create_account_title:l6,create_account_weak_password:u6,create_new_account_link:d6,create_password_account_title:p6,currently_logged_in_as:f6,email:h6,email_placeholder:g6,email_validated:_6,email_validated_cta:m6,email_verification_for_signup_sent_description:y6,email_verification_for_signup_sent_title:v6,enter_a_code_btn:w6,enter_email_for_verification_description:b6,enter_new_password_placeholder:k6,enter_password:x6,enter_password_description:S6,enter_your_password_btn:A6,expired_code:I6,fokus_info_message:E6,forgot_password_cta:z6,forgot_password_description:$6,forgot_password_email_sent:C6,forgot_password_link:j6,forgot_password_title:N6,go_back:O6,"invalid-email":"Virheellinen sähköpostiosoite",invalid_password:B6,invalid_session_body:T6,invalid_session_title:R6,link_email_click_to_login:P6,link_email_login:L6,link_email_or_enter_code:U6,link_page_body:V6,link_page_headline:M6,logged_in_as:H6,login:D6,login_description:q6,login_description_code:F6,login_description_link:K6,logout:W6,no_use_another:G6,or:J6,password:Z6,password_has_been_reset:Y6,password_has_been_reset_title:X6,password_reset_subject:Q6,password_reset_title:eC,privacy_policy:tC,redirecting:nC,reenter_new_password_placeholder:iC,register_password_account:rC,resend_code:sC,reset_password_cta:oC,reset_password_description:aC,reset_password_email_click_to_reset:cC,reset_password_email_cta:lC,reset_password_email_reset:uC,reset_password_subject:dC,reset_password_title:pC,send:fC,send_me_a_new_magic_link:hC,sent_code_spam:gC,set_password:_C,sign_in:mC,signup:yC,signup_success:vC,spotify_already_linked_body:wC,spotify_already_linked_cta:bC,spotify_already_linked_step1_body:kC,spotify_already_linked_step1_title:xC,spotify_already_linked_step2_body:SC,spotify_already_linked_step2_title:AC,spotify_already_linked_title:IC,support_info:EC,terms:zC,unverified_email:$C,user_account_does_not_exist:CC,user_not_found:jC,user_not_found_body:NC,user_not_found_cta:OC,validate_code:BC,validate_email_body:TC,validate_email_title:RC,verify_email_click_to_verify:PC,verify_email_subject:LC,verify_email_title:UC,verify_email_verify:VC,verify_your_email:MC,we_sent_a_code_to:HC,welcome:DC,welcome_to_your_account:qC,yes_continue:FC,yes_continue_with:KC,yes_continue_with_existing_account:WC};Oe.init({supportedLngs:["en","it","nb","sv","pl","cs","fi"],fallbackLng:"en",resources:{en:{translation:Gb},it:{translation:ix},nb:{translation:p2},sv:{translation:bI},pl:{translation:CE},cs:{translation:U$},fi:{translation:GC}}});function JC(n){const e=new o.OpenAPIHono;e.use(async(s,a)=>(s.env.data=lv(s,n.dataAdapter),a())),e.get("/",s=>s.json({name:"authhero"}));const t=M0();e.route("/api/v2",t);const i=Lv();e.route("/",i);const r=Uv();return e.route("/u",r),{app:e,managementApp:t,oauthApp:i,universalApp:r,createX509Certificate:Ha}}exports.Auth0Client=Nd;exports.AuthorizationResponseMode=Vt;exports.AuthorizationResponseType=Ut;exports.CodeChallengeMethod=ss;exports.GrantType=ci;exports.LogTypes=_e;exports.applicationInsertSchema=hr;exports.applicationSchema=Xt;exports.auth0UserResponseSchema=ht;exports.authParamsSchema=Wa;exports.baseUserSchema=rs;exports.bordersSchema=Rd;exports.brandingSchema=bo;exports.codeInsertSchema=zd;exports.codeSchema=Yh;exports.codeTypeSchema=Ed;exports.colorsSchema=Pd;exports.connectionInsertSchema=gr;exports.connectionSchema=Bt;exports.domainInsertSchema=$d;exports.domainSchema=Xh;exports.emailProviderSchema=nr;exports.fontDetailsSchema=Zt;exports.fontsSchema=Ld;exports.hookInsertSchema=mr;exports.hookSchema=An;exports.identitySchema=Ad;exports.init=JC;exports.jwksKeySchema=Cd;exports.jwksSchema=Ga;exports.logSchema=yr;exports.loginInsertSchema=jd;exports.loginSchema=Qh;exports.openIDConfigurationSchema=ko;exports.pageBackgroundSchema=Ud;exports.parseUserId=sg;exports.passwordInsertSchema=Od;exports.passwordSchema=tg;exports.profileDataSchema=Sd;exports.promptSettingSchema=tr;exports.refreshTokenInsertSchema=Hd;exports.refreshTokenSchema=rg;exports.samlpAddon=Id;exports.sessionInsertSchema=Bd;exports.sessionSchema=os;exports.signingKeySchema=xo;exports.tenantInsertSchema=_r;exports.tenantSchema=En;exports.themeInsertSchema=Md;exports.themeSchema=ig;exports.tokenResponseSchema=Td;exports.totalsSchema=qt;exports.userInsertSchema=fr;exports.userResponseSchema=Kh;exports.userSchema=Ka;exports.vendorSettingsSchema=Jh;exports.widgetSchema=Vd;